Compare commits

..

1 Commits

Author SHA1 Message Date
Carlos Andrés f1d6503674 fix: version anterior 2024-09-20 09:53:51 +02:00
828 changed files with 21572 additions and 12157 deletions

View File

@ -36,7 +36,3 @@ rules:
jasmine/no-focused-tests: 0 jasmine/no-focused-tests: 0
jasmine/prefer-toHaveBeenCalledWith: 0 jasmine/prefer-toHaveBeenCalledWith: 0
arrow-spacing: ["error", { "before": true, "after": true }] arrow-spacing: ["error", { "before": true, "after": true }]
no-restricted-syntax:
- "error"
- selector: "NewExpression[callee.name='Date']"
message: "Use Date.vnNew() instead of new Date()."

View File

@ -32,7 +32,8 @@ RUN apt-get update \
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
samba-common-bin samba-dsdb-modules\ samba-common-bin samba-dsdb-modules\
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/* \
&& npm -g install pm2
# Salix # Salix
@ -54,4 +55,7 @@ COPY \
README.md \ README.md \
./ ./
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"] CMD ["pm2-runtime", "./back/process.yml"]
HEALTHCHECK --interval=15s --timeout=10s \
CMD curl -f http://localhost:3000/api/Applications/status || exit 1

View File

@ -19,15 +19,8 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const [info, info2, [{'@vCollectionFk': collectionFk}]] = await Self.rawSql(
const randStr = Math.random().toString(36).substring(3); 'CALL vn.collection_getAssigned(?, @vCollectionFk);SELECT @vCollectionFk', [userId], myOptions);
const result = await Self.rawSql(`
CALL vn.collection_getAssigned(?, @vCollectionFk);
SELECT @vCollectionFk ?
`, [userId, randStr], myOptions);
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
if (!collectionFk) throw new UserError('There are not picking tickets'); if (!collectionFk) throw new UserError('There are not picking tickets');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions); await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);

View File

@ -29,8 +29,10 @@ module.exports = Self => {
}); });
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => { Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;
const myOptions = {userId}; const myOptions = {userId};
const $t = ctx.req.__;
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -57,6 +59,22 @@ module.exports = Self => {
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
for (let ticket of tickets) {
if (ticket.observaciones) {
let observations = ticket.observaciones.split(' ');
for (let observation of observations) {
const salesPerson = ticket.salesPersonFk;
if (observation.startsWith('#') || observation.startsWith('@')) {
await models.Chat.send(ctx,
observation,
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
);
}
}
}
}
return getCollection(id, tickets, sales, placements, myOptions); return getCollection(id, tickets, sales, placements, myOptions);
}; };

View File

@ -57,13 +57,12 @@ module.exports = Self => {
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving, ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving, COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
sh.code, sh.code,
p2.code parkingCodePrevia, p2.code parkingCode,
p2.pickingOrder pickingOrderPrevia, p2.pickingOrder pickingOrder,
p.code parkingCode, p.code parkingCodePrevia,
p.pickingOrder pickingOrder, p.pickingOrder pickingOrderPrevia,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
iss.isPicked, iss.isPicked
iss.itemShelvingFk
FROM ticketCollection tc FROM ticketCollection tc
LEFT JOIN collection c ON c.id = tc.collectionFk LEFT JOIN collection c ON c.id = tc.collectionFk
JOIN sale s ON s.ticketFk = tc.ticketFk JOIN sale s ON s.ticketFk = tc.ticketFk
@ -73,7 +72,7 @@ module.exports = Self => {
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN itemShelvingSale iss ON iss.saleFk = s.id JOIN itemShelvingSale iss ON iss.saleFk = s.id
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
LEFT JOIN parking p ON p.id = sh.parkingFk LEFT JOIN parking p ON p.id = sh.parkingFk
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
LEFT JOIN origin o ON o.id = i.originFk LEFT JOIN origin o ON o.id = i.originFk
@ -103,8 +102,7 @@ module.exports = Self => {
p.code, p.code,
p.pickingOrder, p.pickingOrder,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
iss.isPicked, iss.isPicked
iss.itemShelvingFk
FROM sectorCollection sc FROM sectorCollection sc
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN saleGroup sg ON sg.id = ss.saleGroupFk JOIN saleGroup sg ON sg.id = ss.saleGroupFk
@ -114,7 +112,7 @@ module.exports = Self => {
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN itemShelvingSale iss ON iss.saleFk = s.id JOIN itemShelvingSale iss ON iss.saleFk = s.id
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
LEFT JOIN parking p ON p.id = sh.parkingFk LEFT JOIN parking p ON p.id = sh.parkingFk
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
LEFT JOIN origin o ON o.id = i.originFk LEFT JOIN origin o ON o.id = i.originFk

View File

@ -28,10 +28,9 @@ describe('ticket assign()', () => {
await tx.rollback(); await tx.rollback();
}); });
it('should throw an error when there are no picking tickets', async() => { it('should throw an error when there is not picking tickets', async() => {
try { try {
await models.Collection.assign(ctx, options); await models.Collection.assign(ctx, options);
fail('Expected an error to be thrown, but none was thrown.');
} catch (e) { } catch (e) {
expect(e.message).toEqual('There are not picking tickets'); expect(e.message).toEqual('There are not picking tickets');
} }

View File

@ -38,7 +38,7 @@ module.exports = Self => {
{ {
arg: 'hasFile', arg: 'hasFile',
type: 'Boolean', type: 'Boolean',
description: 'True if has the original in paper' description: 'True if has an attached file'
}, },
{ {
arg: 'hasFileAttached', arg: 'hasFileAttached',

View File

@ -4,45 +4,21 @@ module.exports = Self => {
/** /**
* Returns basic headers * Returns basic headers
* *
* @param {string} cookie - The docuware cookie
* @return {object} - The headers * @return {object} - The headers
*/ */
Self.getOptions = async() => { Self.getOptions = async() => {
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne(); const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
const now = Date.vnNow();
let {url, username, password, token, expired} = docuwareConfig;
if (process.env.NODE_ENV && (!expired || expired < now + 60)) {
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
const {data} = await axios.post(token_endpoint, {
grant_type: 'password',
scope: 'docuware.platform',
client_id: 'docuware.platform.net.client',
username,
password
}, {headers: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
}});
const newToken = data.access_token;
token = data.token_type + ' ' + newToken;
await docuwareConfig.updateAttributes({
token,
expired: now + data.expires_in
});
}
const headers = { const headers = {
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': token 'Cookie': docuwareConfig.cookie
} }
}; };
return { return {
url, url: docuwareConfig.url,
headers headers
}; };
}; };

View File

@ -2,54 +2,87 @@ const axios = require('axios');
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('Docuware core', () => { describe('Docuware core', () => {
const fileCabinetCode = 'deliveryNote'; beforeAll(() => {
beforeAll(async() => {
process.env.NODE_ENV = 'testing'; process.env.NODE_ENV = 'testing';
});
const docuwareInfo = await models.Docuware.findOne({ afterAll(() => {
where: { delete process.env.NODE_ENV;
code: fileCabinetCode });
}
describe('getOptions()', () => {
it('should return url and headers', async() => {
const result = await models.Docuware.getOptions();
expect(result.url).toBeDefined();
expect(result.headers).toBeDefined();
}); });
});
spyOn(axios, 'get').and.callFake(url => { describe('getDialog()', () => {
if (url.includes('IdentityServiceInfo')) return {data: {IdentityServiceUrl: 'IdentityServiceUrl'}}; it('should return dialogId', async() => {
if (url.includes('IdentityServiceUrl')) return {data: {token_endpoint: 'token_endpoint'}}; const dialogs = {
if (url.includes('dialogs')) { data: {
return { Dialog: [
data: { {
Dialog: [ DisplayName: 'find',
{ Id: 'getDialogTest'
DisplayName: 'find', }
Id: 'getDialogTest' ]
} }
] };
} spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
}; const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
}
if (url.includes('FileCabinets')) { expect(result).toEqual('getDialogTest');
return {data: { });
});
describe('getFileCabinet()', () => {
it('should return fileCabinetId', async() => {
const code = 'deliveryNote';
const docuwareInfo = await models.Docuware.findOne({
where: {
code
}
});
const dialogs = {
data: {
FileCabinet: [ FileCabinet: [
{ {
Name: docuwareInfo.fileCabinetName, Name: docuwareInfo.fileCabinetName,
Id: 'getFileCabinetTest' Id: 'getFileCabinetTest'
} }
] ]
}}; }
} };
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
const result = await models.Docuware.getFileCabinet(code);
expect(result).toEqual('getFileCabinetTest');
});
});
describe('get()', () => {
it('should return data without parse', async() => {
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = {
data: {
id: 1
}
};
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const result = await models.Docuware.get('deliveryNote');
expect(result.id).toEqual(1);
}); });
spyOn(axios, 'post').and.callFake(url => { it('should return data with parse', async() => {
if (url.includes('token_endpoint')) { spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
return {data: { spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
access_token: 'access_token', const data = {
token_type: 'bearer', data: {
expires_in: 10000
}};
}
if (url.includes('DialogExpression')) {
return {data: {
Items: [{ Items: [{
Fields: [ Fields: [
{ {
@ -70,52 +103,12 @@ describe('Docuware core', () => {
] ]
}] }]
} }
}; };
}
});
});
afterAll(() => {
delete process.env.NODE_ENV;
});
describe('getOptions()', () => {
it('should return url and headers', async() => {
const result = await models.Docuware.getOptions();
expect(result.url).toBeDefined();
expect(result.headers).toBeDefined();
});
});
describe('Dialog()', () => {
it('should return dialogId', async() => {
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
expect(result).toEqual('getDialogTest');
});
});
describe('getFileCabinet()', () => {
it('should return fileCabinetId', async() => {
const result = await models.Docuware.getFileCabinet(fileCabinetCode);
expect(result).toEqual('getFileCabinetTest');
});
});
describe('get()', () => {
it('should return data without parse', async() => {
const [result] = await models.Docuware.get('deliveryNote');
expect(result.firstRequiredField).toEqual(1);
});
it('should return data with parse', async() => {
const parse = { const parse = {
'firstRequiredField': 'id', 'firstRequiredField': 'id',
'secondRequiredField': 'name', 'secondRequiredField': 'name',
}; };
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const [result] = await models.Docuware.get('deliveryNote', null, parse); const [result] = await models.Docuware.get('deliveryNote', null, parse);
expect(result.id).toEqual(1); expect(result.id).toEqual(1);
@ -126,14 +119,17 @@ describe('Docuware core', () => {
describe('getById()', () => { describe('getById()', () => {
it('should return data', async() => { it('should return data', async() => {
spyOn(models.Docuware, 'get'); spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
await models.Docuware.getById('deliveryNote', 1); spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = {
data: {
id: 1
}
};
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const result = await models.Docuware.getById('deliveryNote', 1);
expect(models.Docuware.get).toHaveBeenCalledWith( expect(result.id).toEqual(1);
'deliveryNote',
{condition: [Object({DBName: 'N__ALBAR_N', Value: [1]})]},
undefined
);
}); });
}); });
}); });

View File

@ -143,7 +143,7 @@ module.exports = Self => {
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
'X-File-ModifiedDate': Date.vnNew(), 'X-File-ModifiedDate': Date.vnNew(),
'Authorization': docuwareOptions.headers.headers.Authorization, 'Cookie': docuwareOptions.headers.headers.Cookie,
...data.getHeaders() ...data.getHeaders()
}, },
}; };

View File

@ -0,0 +1,132 @@
const {models} = require('vn-loopback/server/server');
describe('machineWorker updateInTime()', () => {
const itBoss = 104;
const davidCharles = 1106;
beforeAll(async() => {
ctx = {
req: {
accessToken: {},
headers: {origin: 'http://localhost'},
__: value => value
}
};
});
it('should throw an error if the plate does not exist', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
const plate = 'RE-123';
ctx.req.accessToken.userId = 1106;
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toContain('the plate does not exist');
await tx.rollback();
}
});
it('should grab a machine where is not in use', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
const plate = 'RE-003';
ctx.req.accessToken.userId = 1107;
try {
const totalBefore = await models.MachineWorker.find(null, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const totalAfter = await models.MachineWorker.find(null, options);
expect(totalAfter.length).toEqual(totalBefore.length + 1);
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
describe('less than 12h', () => {
const plate = 'RE-001';
it('should trow an error if it is not himself', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = davidCharles;
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toContain('This machine is already in use');
await tx.rollback();
}
});
it('should throw an error if it is himself with a different machine', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = itBoss;
const plate = 'RE-003';
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toEqual('You are already using a machine');
await tx.rollback();
}
});
it('should set the out time if it is himself', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = itBoss;
try {
const isNotParked = await models.MachineWorker.findOne({
where: {workerFk: itBoss}
}, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const isParked = await models.MachineWorker.findOne({
where: {workerFk: itBoss}
}, options);
expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined();
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});
describe('equal or more than 12h', () => {
const plate = 'RE-002';
it('should set the out time and grab the machine', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = davidCharles;
const filter = {
where: {workerFk: davidCharles, machineFk: 2}
};
try {
const isNotParked = await models.MachineWorker.findOne(filter, options);
const totalBefore = await models.MachineWorker.find(null, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const isParked = await models.MachineWorker.findOne(filter, options);
const totalAfter = await models.MachineWorker.find(null, options);
expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined();
expect(totalAfter.length).toEqual(totalBefore.length + 1);
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});
});

View File

@ -0,0 +1,77 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('updateInTime', {
description: 'Updates the corresponding registry if the worker has been registered in the last few hours',
accessType: 'WRITE',
accepts: [
{
arg: 'plate',
type: 'string',
}
],
http: {
path: `/updateInTime`,
verb: 'POST'
}
});
Self.updateInTime = async(ctx, plate, options) => {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const $t = ctx.req.__;
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const machine = await models.Machine.findOne({
fields: ['id', 'plate'],
where: {plate}
}, myOptions);
if (!machine)
throw new UserError($t('the plate does not exist', {plate}));
const machineWorker = await Self.findOne({
where: {
or: [{machineFk: machine.id}, {workerFk: userId}],
outTime: null,
}
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;
const isSameMachine = machine.id == machineWorker.machineFk;
if (hoursDifference < maxHours && !isHimself)
throw new UserError($t('This machine is already in use.'));
if (hoursDifference < maxHours && isHimself && !isSameMachine)
throw new UserError($t('You are already using a machine'));
await machineWorker.updateAttributes({
outTime: Date.vnNew()
}, myOptions);
}
if (!machineWorker || hoursDifference >= maxHours)
await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -39,9 +39,6 @@ module.exports = Self => {
const xmlString = response.data; const xmlString = response.data;
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente'); return result.toLowerCase().includes('se ha cancelado correctamente');
}; };

View File

@ -12,8 +12,9 @@ const ticket1 = {
'addressFk': 1, 'addressFk': 1,
'agencyModeFk': 999 'agencyModeFk': 999
}; };
let expedition;
const expedition1 = { const expedition1 = {
'id': 17,
'agencyModeFk': 999, 'agencyModeFk': 999,
'ticketFk': 44, 'ticketFk': 44,
'freightItemFk': 71, 'freightItemFk': 71,
@ -46,7 +47,7 @@ describe('MRWConfig createShipment()', () => {
await createMrwConfig(); await createMrwConfig();
await models.Ticket.create(ticket1); await models.Ticket.create(ticket1);
expedition = await models.Expedition.create(expedition1); await models.Expedition.create(expedition1);
}); });
afterAll(async() => { afterAll(async() => {
@ -92,7 +93,7 @@ describe('MRWConfig createShipment()', () => {
} }
it('should create a shipment and return a base64Binary label', async() => { it('should create a shipment and return a base64Binary label', async() => {
const {file} = await models.MrwConfig.createShipment(expedition.id); const {file} = await models.MrwConfig.createShipment(expedition1.id);
expect(file).toEqual(mockBase64Binary); expect(file).toEqual(mockBase64Binary);
}); });
@ -100,7 +101,7 @@ describe('MRWConfig createShipment()', () => {
it('should fail if mrwConfig has no data', async() => { it('should fail if mrwConfig has no data', async() => {
let error; let error;
await models.MrwConfig.destroyAll(); await models.MrwConfig.destroyAll();
await models.MrwConfig.createShipment(expedition.id).catch(e => { await models.MrwConfig.createShipment(expedition1.id).catch(e => {
error = e; error = e;
}).finally(async() => { }).finally(async() => {
expect(error.message).toEqual(`MRW service is not configured`); expect(error.message).toEqual(`MRW service is not configured`);
@ -125,7 +126,7 @@ describe('MRWConfig createShipment()', () => {
yesterday.setDate(yesterday.getDate() - 1); yesterday.setDate(yesterday.getDate() - 1);
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday}); await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
await models.MrwConfig.createShipment(expedition.id).catch(e => { await models.MrwConfig.createShipment(expedition1.id).catch(e => {
error = e; error = e;
}).finally(async() => { }).finally(async() => {
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`); expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
@ -135,7 +136,7 @@ describe('MRWConfig createShipment()', () => {
it('should send mail if you are past the dead line and is not notified today', async() => { it('should send mail if you are past the dead line and is not notified today', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null}); await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
await models.MrwConfig.createShipment(expedition.id); await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification(); const notification = await getLastNotification();
expect(notification.notificationFk).toEqual(filter.notificationFk); expect(notification.notificationFk).toEqual(filter.notificationFk);
@ -143,7 +144,7 @@ describe('MRWConfig createShipment()', () => {
it('should send mail if you are past the dead line and it is notified from another day', async() => { it('should send mail if you are past the dead line and it is notified from another day', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()}); await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
await models.MrwConfig.createShipment(expedition.id); await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification(); const notification = await getLastNotification();
expect(notification.notificationFk).toEqual(filter.notificationFk); expect(notification.notificationFk).toEqual(filter.notificationFk);
@ -151,7 +152,7 @@ describe('MRWConfig createShipment()', () => {
it('should not send mail if you are past the dead line and it is notified', async() => { it('should not send mail if you are past the dead line and it is notified', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()}); await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
await models.MrwConfig.createShipment(expedition.id); await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification(); const notification = await getLastNotification();
expect(notification).toEqual(null); expect(notification).toEqual(null);

View File

@ -29,7 +29,7 @@ describe('Postcode filter()', () => {
} }
}, options); }, options);
expect(results.length).toEqual(5); expect(results.length).toEqual(4);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
@ -63,7 +63,7 @@ describe('Postcode filter()', () => {
search: 'one', search: 'one',
}}, options); }}, options);
expect(results.length).toEqual(5); expect(results.length).toEqual(4);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();

View File

@ -72,9 +72,9 @@ describe('Renew Token', () => {
} }
expect(error).toBeDefined(); expect(error).toBeDefined();
const query = 'SELECT * FROM util.debug';
const query = 'SELECT * FROM util.debug WHERE variable = "renewToken"'; const debugLog = await models.Application.rawSql(query, null);
const debugLog = await models.Application.rawSql(query);
expect(debugLog.length).toEqual(1); expect(debugLog.length).toEqual(1);
}); });

View File

@ -26,7 +26,7 @@ module.exports = Self => {
description: 'The user lang' description: 'The user lang'
}, { }, {
arg: 'twoFactor', arg: 'twoFactor',
type: 'any', type: 'string',
description: 'The user twoFactor' description: 'The user twoFactor'
} }
], ],

View File

@ -31,7 +31,7 @@ module.exports = Self => {
return await Self.rawSql(` return await Self.rawSql(`
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model) INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
SELECT ?, ?, ? SELECT ?, ?, ?
FROM workerTimeControlConfig wtcc FROM workerTimeControlParams wtcp
LEFT JOIN ( LEFT JOIN (
SELECT wa.workerFk, SELECT wa.workerFk,
wa.created, wa.created,
@ -44,7 +44,7 @@ module.exports = Self => {
) sub ON TRUE ) sub ON TRUE
WHERE sub.workerFk IS NULL WHERE sub.workerFk IS NULL
OR sub.code <> ? OR sub.code <> ?
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;` OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcp.dayBreak;`
, [userId, code, model, userId, code], myOptions); , [userId, code, model, userId, code], myOptions);
}; };
}; };

View File

@ -79,9 +79,6 @@
"ImageCollectionSize": { "ImageCollectionSize": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ImageConfig": {
"dataSource": "vn"
},
"ImageContainer": { "ImageContainer": {
"dataSource": "imageStorage" "dataSource": "imageStorage"
}, },
@ -91,6 +88,12 @@
"Machine": { "Machine": {
"dataSource": "vn" "dataSource": "vn"
}, },
"MachineWorker": {
"dataSource": "vn"
},
"MachineWorkerConfig": {
"dataSource": "vn"
},
"MobileAppVersionControl": { "MobileAppVersionControl": {
"dataSource": "vn" "dataSource": "vn"
}, },
@ -142,12 +145,6 @@
"StarredModule": { "StarredModule": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SaySimpleCountry": {
"dataSource": "vn"
},
"SaySimpleConfig": {
"dataSource": "vn"
},
"TempContainer": { "TempContainer": {
"dataSource": "tempStorage" "dataSource": "tempStorage"
}, },
@ -178,9 +175,6 @@
"PrintConfig": { "PrintConfig": {
"dataSource": "vn" "dataSource": "vn"
}, },
"QueueMember": {
"dataSource": "vn"
},
"ViaexpressConfig": { "ViaexpressConfig": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -16,10 +16,6 @@
"name": { "name": {
"type": "string", "type": "string",
"required": true "required": true
},
"hasDailyInvoice": {
"type": "boolean",
"description": "Indicates if the autonomy has daily invoice enabled"
} }
}, },
"relations": { "relations": {

View File

@ -28,10 +28,6 @@
}, },
"continentFk": { "continentFk": {
"type": "number" "type": "number"
},
"hasDailyInvoice": {
"type": "boolean",
"description": "Indicates if the autonomy has daily invoice enabled"
} }
}, },
"relations": { "relations": {
@ -44,11 +40,6 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Continent", "model": "Continent",
"foreignKey": "continentFk" "foreignKey": "continentFk"
},
"saySimpleCountry": {
"type": "hasOne",
"model": "SaySimpleCountry",
"foreignKey": "countryFk"
} }
}, },
"acls": [ "acls": [

View File

@ -16,17 +16,17 @@
"url": { "url": {
"type": "string" "type": "string"
}, },
"token": { "cookie": {
"type": "string" "type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
},
"expired":{
"type": "number"
} }
} },
"acls": [
{
"property": "*",
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
} }

View File

@ -14,6 +14,9 @@
}, },
"itemFk": { "itemFk": {
"type": "number" "type": "number"
},
"isChecked": {
"type": "boolean"
} }
} }
} }

View File

@ -1,22 +0,0 @@
{
"name": "ImageConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "hedera.imageConfig"
}
},
"properties": {
"url": {
"type": "string"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

@ -0,0 +1,18 @@
{
"name": "MachineWorkerConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.machineWorkerConfig"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"maxHours": {
"type": "number"
}
}
}

View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/machine-worker/updateInTime')(Self);
};

View File

@ -0,0 +1,33 @@
{
"name": "MachineWorker",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.machineWorker"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"workerFk": {
"type": "number"
},
"machineFk": {
"type": "number"
},
"inTime": {
"type": "date",
"mysql": {
"columnName": "inTimed"
}
},
"outTime": {
"type": "date",
"mysql": {
"columnName": "outTimed"
}
}
}
}

View File

@ -16,9 +16,6 @@
"name": { "name": {
"type": "string", "type": "string",
"required": true "required": true
},
"autonomyFk": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -1,38 +0,0 @@
{
"name": "QueueMember",
"base": "VnModel",
"options": {
"mysql": {
"table": "pbx.queueMember"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"queue": {
"type": "string"
},
"extension": {
"type": "string"
}
},
"relations": {
"queueRelation": {
"type": "belongsTo",
"model": "Queue",
"foreignKey": "queue",
"primaryKey": "name"
}
},
"acls": [
{
"property": "*",
"accessType": "READ",
"principalType": "ROLE",
"principalId": "employee",
"permission": "ALLOW"
}
]
}

View File

@ -1,29 +0,0 @@
{
"name": "SaySimpleConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "saySimpleConfig"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"url": {
"type": "string"
},
"defaultChannel": {
"type": "number"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

@ -1,26 +0,0 @@
{
"name": "SaySimpleCountry",
"base": "VnModel",
"options": {
"mysql": {
"table": "saySimpleCountry"
}
},
"properties": {
"countryFk": {
"type": "number",
"id": true
},
"channel": {
"type": "number"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

@ -165,8 +165,7 @@
"hasGrant", "hasGrant",
"realm", "realm",
"email", "email",
"emailVerified", "emailVerified"
"twoFactor"
] ]
} }
} }

7
back/process.yml Normal file
View File

@ -0,0 +1,7 @@
apps:
- script: ./loopback/server/server.js
name: salix-back
instances: 1
max_restarts: 0
autorestart: false
node_args: --tls-min-v1.0 --openssl-legacy-provider

View File

@ -4,7 +4,7 @@ USE `util`;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('vn-database','11311','315864403260623fede9f0471ef3d9036faf23b1','2024-11-12 08:00:59','11336'); INSERT INTO `version` VALUES ('vn-database','11196','91ee956fbd1557848e4ab522bc5d39b2ec10e9b2','2024-09-18 07:28:14','11245');
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
@ -862,7 +862,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','11084','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11084','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11086','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-27 10:02:02',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11086','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-27 10:02:02',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11087','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11087','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11088','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11089','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11089','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11090','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11090','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11092','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-07 08:21:23',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11092','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-07 08:21:23',NULL,NULL);
@ -876,37 +875,12 @@ INSERT INTO `versionLog` VALUES ('vn-database','11103','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','11104','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11104','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11105','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-20 15:36:07',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11105','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-20 15:36:07',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11106','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11106','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','01-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','02-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','03-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','04-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','05-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:44:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','06-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:04',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','07-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','08-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','09-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:47',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','10-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','11-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:45:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','12-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','14-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','15-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','17-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','18-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','19-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:19',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','20-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:46:19',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','21-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','22-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','23-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11107','24-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11108','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:39',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11108','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:39',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11109','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-18 19:09:56',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11109','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-18 19:09:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11110','00-clientUnpaid.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11110','00-clientUnpaid.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11111','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11111','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11112','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:40',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11112','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:40',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11113','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11114','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11114','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11115','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11116','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11116','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11117','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11117','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11118','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-19 12:28:49',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11118','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-19 12:28:49',NULL,NULL);
@ -968,7 +942,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','11172','14-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','11172','15-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:57:44',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11172','15-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:57:44',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11175','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:57:44',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11175','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:57:44',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11177','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-30 12:42:28',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11177','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-30 12:42:28',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11178','00-aclSetWeight.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11179','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-20 08:34:43',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11179','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-20 08:34:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11180','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-20 08:34:43',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11180','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-20 08:34:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11182','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-08-09 08:19:36',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11182','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-08-09 08:19:36',NULL,NULL);
@ -988,88 +961,18 @@ INSERT INTO `versionLog` VALUES ('vn-database','11194','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','11195','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11195','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11196','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-18 07:28:14',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11196','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-18 07:28:14',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11197','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11197','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11198','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11201','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-27 13:04:26',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11201','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-27 13:04:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11204','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11204','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11205','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-04 13:54:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11205','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-04 13:54:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11206','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11206','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11207','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11207','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11209','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11209','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11210','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11210','01-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11210','02-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:40',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11210','03-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11211','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11211','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11213','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-06 06:31:13',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11213','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-06 06:31:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11215','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11215','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 07:38:42',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11216','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11217','00-hederaMessages.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-09 12:21:45',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11217','00-hederaMessages.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-09 12:21:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11219','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11221','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11222','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11223','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11224','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11225','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11225','01-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11225','02-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11227','00-addWorkerTimeControlMailAcl.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11229','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-16 08:24:17',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11229','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-16 08:24:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11230','00-addClientObservationType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:52',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11234','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:42',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11235','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11236','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11236','01-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11237','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11239','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 12:57:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11239','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 12:57:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11240','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11241','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-20 09:08:25',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11242','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:52',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11246','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-18 12:39:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11247','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-19 12:10:08',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11248','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-23 11:12:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11249','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11251','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:43:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11251','01-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:57:30',NULL,'Connection lost: The server closed the connection.');
INSERT INTO `versionLog` VALUES ('vn-database','11253','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-20 14:41:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11254','00-thermographTemperature.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11254','01-thermographFk.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11255','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11256','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-23 12:18:24',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11258','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11260','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11261','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11262','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11263','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-27 12:05:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11264','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11271','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11272','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11273','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 10:50:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript2.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:29',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript3.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript5.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript6.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript7.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11277','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11278','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11279','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-10-02 08:05:24',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11280','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-02 08:46:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11281','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11283','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11284','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11285','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11287','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11288','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-10 08:26:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11289','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-15 07:01:33',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11290','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11291','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-17 09:10:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11294','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11295','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-10 08:45:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11298','00-closure.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11300','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-18 08:27:05',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11302','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11308','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-23 12:41:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11311','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:57',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -1442,10 +1345,6 @@ INSERT INTO `roleInherit` VALUES (373,131,2,19295);
INSERT INTO `roleInherit` VALUES (375,120,131,1437); INSERT INTO `roleInherit` VALUES (375,120,131,1437);
INSERT INTO `roleInherit` VALUES (376,124,21,19336); INSERT INTO `roleInherit` VALUES (376,124,21,19336);
INSERT INTO `roleInherit` VALUES (377,47,49,19295); INSERT INTO `roleInherit` VALUES (377,47,49,19295);
INSERT INTO `roleInherit` VALUES (378,101,15,19294);
INSERT INTO `roleInherit` VALUES (379,103,121,19294);
INSERT INTO `roleInherit` VALUES (381,119,123,19295);
INSERT INTO `roleInherit` VALUES (382,48,72,783);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@ -1546,7 +1445,7 @@ INSERT INTO `ACL` VALUES (112,'Defaulter','*','READ','ALLOW','ROLE','employee',N
INSERT INTO `ACL` VALUES (113,'ClientRisk','*','READ','ALLOW','ROLE','trainee',NULL); INSERT INTO `ACL` VALUES (113,'ClientRisk','*','READ','ALLOW','ROLE','trainee',NULL);
INSERT INTO `ACL` VALUES (114,'Receipt','*','READ','ALLOW','ROLE','trainee',NULL); INSERT INTO `ACL` VALUES (114,'Receipt','*','READ','ALLOW','ROLE','trainee',NULL);
INSERT INTO `ACL` VALUES (115,'Receipt','*','WRITE','ALLOW','ROLE','administrative',NULL); INSERT INTO `ACL` VALUES (115,'Receipt','*','WRITE','ALLOW','ROLE','administrative',NULL);
INSERT INTO `ACL` VALUES (116,'BankEntity','*','READ','ALLOW','ROLE','employee',10578); INSERT INTO `ACL` VALUES (116,'BankEntity','*','*','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (117,'ClientSample','*','*','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (117,'ClientSample','*','*','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson',NULL); INSERT INTO `ACL` VALUES (118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson',NULL);
INSERT INTO `ACL` VALUES (119,'Travel','*','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (119,'Travel','*','READ','ALLOW','ROLE','employee',NULL);
@ -1642,6 +1541,8 @@ INSERT INTO `ACL` VALUES (234,'WorkerLog','find','READ','ALLOW','ROLE','hr',NULL
INSERT INTO `ACL` VALUES (235,'CustomsAgent','*','*','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (235,'CustomsAgent','*','*','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (236,'Buy','*','*','ALLOW','ROLE','buyer',NULL); INSERT INTO `ACL` VALUES (236,'Buy','*','*','ALLOW','ROLE','buyer',NULL);
INSERT INTO `ACL` VALUES (237,'WorkerDms','filter','*','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (237,'WorkerDms','filter','*','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (238,'Town','*','WRITE','ALLOW','ROLE','deliveryAssistant',NULL);
INSERT INTO `ACL` VALUES (239,'Province','*','WRITE','ALLOW','ROLE','deliveryAssistant',NULL);
INSERT INTO `ACL` VALUES (241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative',NULL); INSERT INTO `ACL` VALUES (241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative',NULL);
INSERT INTO `ACL` VALUES (248,'RoleMapping','*','READ','ALLOW','ROLE','account',NULL); INSERT INTO `ACL` VALUES (248,'RoleMapping','*','READ','ALLOW','ROLE','account',NULL);
INSERT INTO `ACL` VALUES (249,'UserPassword','*','READ','ALLOW','ROLE','account',NULL); INSERT INTO `ACL` VALUES (249,'UserPassword','*','READ','ALLOW','ROLE','account',NULL);
@ -1655,7 +1556,7 @@ INSERT INTO `ACL` VALUES (257,'FixedPrice','*','*','ALLOW','ROLE','buyer',NULL);
INSERT INTO `ACL` VALUES (258,'PayDem','*','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (258,'PayDem','*','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant',NULL); INSERT INTO `ACL` VALUES (259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant',NULL);
INSERT INTO `ACL` VALUES (260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (261,'SupplierAccount','*','WRITE','ALLOW','ROLE','administrative',783); INSERT INTO `ACL` VALUES (261,'SupplierAccount','*','*','ALLOW','ROLE','administrative',NULL);
INSERT INTO `ACL` VALUES (262,'Entry','*','*','ALLOW','ROLE','administrative',NULL); INSERT INTO `ACL` VALUES (262,'Entry','*','*','ALLOW','ROLE','administrative',NULL);
INSERT INTO `ACL` VALUES (263,'InvoiceIn','*','READ','ALLOW','ROLE','administrative',NULL); INSERT INTO `ACL` VALUES (263,'InvoiceIn','*','READ','ALLOW','ROLE','administrative',NULL);
INSERT INTO `ACL` VALUES (264,'StarredModule','*','*','ALLOW','ROLE','$authenticated',NULL); INSERT INTO `ACL` VALUES (264,'StarredModule','*','*','ALLOW','ROLE','$authenticated',NULL);
@ -1762,6 +1663,7 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL); INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL); INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
INSERT INTO `ACL` VALUES (382,'Item','labelPdf','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
@ -2029,7 +1931,7 @@ INSERT INTO `ACL` VALUES (699,'TicketSms','find','READ','ALLOW','ROLE','salesPer
INSERT INTO `ACL` VALUES (701,'Docuware','upload','WRITE','ALLOW','ROLE','deliveryAssistant',NULL); INSERT INTO `ACL` VALUES (701,'Docuware','upload','WRITE','ALLOW','ROLE','deliveryAssistant',NULL);
INSERT INTO `ACL` VALUES (702,'Ticket','docuwareDownload','READ','ALLOW','ROLE','salesPerson',NULL); INSERT INTO `ACL` VALUES (702,'Ticket','docuwareDownload','READ','ALLOW','ROLE','salesPerson',NULL);
INSERT INTO `ACL` VALUES (703,'Worker','search','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (703,'Worker','search','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (704,'ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','production',19294); INSERT INTO `ACL` VALUES (704,'ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','delivery',NULL);
INSERT INTO `ACL` VALUES (705,'SaleGroupDetail','deleteById','WRITE','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (705,'SaleGroupDetail','deleteById','WRITE','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (706,'Ticket','setDeleted','WRITE','ALLOW','ROLE','buyer',NULL); INSERT INTO `ACL` VALUES (706,'Ticket','setDeleted','WRITE','ALLOW','ROLE','buyer',NULL);
INSERT INTO `ACL` VALUES (707,'DeviceLog','create','WRITE','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (707,'DeviceLog','create','WRITE','ALLOW','ROLE','employee',NULL);
@ -2084,7 +1986,7 @@ INSERT INTO `ACL` VALUES (756,'Route','findOne','READ','ALLOW','ROLE','employee'
INSERT INTO `ACL` VALUES (757,'Route','getRoutesByWorker','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (757,'Route','getRoutesByWorker','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (758,'Route','canViewAllRoute','READ','ALLOW','ROLE','deliveryAssistant',NULL); INSERT INTO `ACL` VALUES (758,'Route','canViewAllRoute','READ','ALLOW','ROLE','deliveryAssistant',NULL);
INSERT INTO `ACL` VALUES (759,'Route','cmr','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (759,'Route','cmr','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (760,'Cmr','downloadZip','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (760,'Route','downloadCmrsZip','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee',NULL); INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee',NULL);
@ -2213,6 +2115,7 @@ INSERT INTO `ACL` VALUES (892,'WorkerIncome','*','*','ALLOW','ROLE','hr',NULL);
INSERT INTO `ACL` VALUES (893,'PayrollComponent','*','*','ALLOW','ROLE','hr',NULL); INSERT INTO `ACL` VALUES (893,'PayrollComponent','*','*','ALLOW','ROLE','hr',NULL);
INSERT INTO `ACL` VALUES (894,'Worker','__get__incomes','*','ALLOW','ROLE','hr',NULL); INSERT INTO `ACL` VALUES (894,'Worker','__get__incomes','*','ALLOW','ROLE','hr',NULL);
INSERT INTO `ACL` VALUES (895,'ItemShelvingLog','*','READ','ALLOW','ROLE','production',NULL); INSERT INTO `ACL` VALUES (895,'ItemShelvingLog','*','READ','ALLOW','ROLE','production',NULL);
INSERT INTO `ACL` VALUES (897,'WorkerLog','*','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (901,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','system',NULL); INSERT INTO `ACL` VALUES (901,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','system',NULL);
INSERT INTO `ACL` VALUES (902,'Entry','filter','READ','ALLOW','ROLE','supplier',NULL); INSERT INTO `ACL` VALUES (902,'Entry','filter','READ','ALLOW','ROLE','supplier',NULL);
INSERT INTO `ACL` VALUES (903,'Entry','getBuys','READ','ALLOW','ROLE','supplier',NULL); INSERT INTO `ACL` VALUES (903,'Entry','getBuys','READ','ALLOW','ROLE','supplier',NULL);
@ -2228,28 +2131,12 @@ INSERT INTO `ACL` VALUES (912,'Worker','__get__medicalReview','*','ALLOW','ROLE'
INSERT INTO `ACL` VALUES (913,'VnToken','*','READ','ALLOW','ROLE','developer',10578); INSERT INTO `ACL` VALUES (913,'VnToken','*','READ','ALLOW','ROLE','developer',10578);
INSERT INTO `ACL` VALUES (914,'VnToken','killSession','*','ALLOW','ROLE','developer',10578); INSERT INTO `ACL` VALUES (914,'VnToken','killSession','*','ALLOW','ROLE','developer',10578);
INSERT INTO `ACL` VALUES (915,'ACL','*','WRITE','ALLOW','ROLE','developerBoss',10578); INSERT INTO `ACL` VALUES (915,'ACL','*','WRITE','ALLOW','ROLE','developerBoss',10578);
INSERT INTO `ACL` VALUES (916,'Entry','getBuysCsv','READ','ALLOW','ROLE','supplier',10578);
INSERT INTO `ACL` VALUES (917,'InvoiceOut','refundAndInvoice','WRITE','ALLOW','ROLE','administrative',10578); INSERT INTO `ACL` VALUES (917,'InvoiceOut','refundAndInvoice','WRITE','ALLOW','ROLE','administrative',10578);
INSERT INTO `ACL` VALUES (918,'Worker','__get__descriptor','READ','ALLOW','ROLE','employee',10578); INSERT INTO `ACL` VALUES (918,'Worker','__get__descriptor','READ','ALLOW','ROLE','employee',10578);
INSERT INTO `ACL` VALUES (919,'Worker','findById','READ','ALLOW','ROLE','employee',10578); INSERT INTO `ACL` VALUES (919,'Worker','findById','READ','ALLOW','ROLE','$subordinate',10578);
INSERT INTO `ACL` VALUES (920,'QuadmindsApiConfig','*','*','ALLOW','ROLE','delivery',19295); INSERT INTO `ACL` VALUES (920,'QuadmindsApiConfig','*','*','ALLOW','ROLE','delivery',19295);
INSERT INTO `ACL` VALUES (922,'SaleGroup','*','WRITE','ALLOW','ROLE','production',19294); INSERT INTO `ACL` VALUES (921,'Worker','findById','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (923,'Worker','__get__advancedSummary','READ','ALLOW','ROLE','hr',10578);
INSERT INTO `ACL` VALUES (924,'Worker','__get__summary','READ','ALLOW','ROLE','employee',10578);
INSERT INTO `ACL` VALUES (925,'Postcode','*','WRITE','ALLOW','ROLE','administrative',10578);
INSERT INTO `ACL` VALUES (926,'Province','*','WRITE','ALLOW','ROLE','administrative',10578);
INSERT INTO `ACL` VALUES (927,'Town','*','WRITE','ALLOW','ROLE','administrative',10578);
INSERT INTO `ACL` VALUES (928,'ExpeditionStateType','*','READ','ALLOW','ROLE','employee',19294);
INSERT INTO `ACL` VALUES (929,'ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','delivery',19294);
INSERT INTO `ACL` VALUES (930,'SupplierAccount','*','READ','ALLOW','ROLE','buyer',783);
INSERT INTO `ACL` VALUES (931,'StockBought','*','READ','ALLOW','ROLE','buyer',10578);
INSERT INTO `ACL` VALUES (932,'StockBought','*','WRITE','ALLOW','ROLE','buyer',10578);
INSERT INTO `ACL` VALUES (933,'Buyer','*','READ','ALLOW','ROLE','buyer',10578);
INSERT INTO `ACL` VALUES (934,'Ticket','setWeight','WRITE','ALLOW','ROLE','salesPerson',10578);
INSERT INTO `ACL` VALUES (935,'BankEntity','*','WRITE','ALLOW','ROLE','financial',10578);
INSERT INTO `ACL` VALUES (936,'Device','handleUser','*','ALLOW','ROLE','employee',10578);
INSERT INTO `ACL` VALUES (937,'WorkerTimeControlMail','count','READ','ALLOW','ROLE','employee',10578);
INSERT INTO `ACL` VALUES (938,'Worker','__get__mail','READ','ALLOW','ROLE','hr',10578);
INSERT INTO `ACL` VALUES (939,'Machine','*','*','ALLOW','ROLE','productionBoss',10578);
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -2445,8 +2332,6 @@ INSERT INTO `claimResponsible` VALUES (22,'Paletizadores',0,'pal');
INSERT INTO `claimResponsible` VALUES (23,'Preparación Previa',0,'pre'); INSERT INTO `claimResponsible` VALUES (23,'Preparación Previa',0,'pre');
INSERT INTO `claimResponsible` VALUES (24,'Almacén PCA',0,'war'); INSERT INTO `claimResponsible` VALUES (24,'Almacén PCA',0,'war');
INSERT INTO `claimResponsible` VALUES (25,'Huelga',0,'str'); INSERT INTO `claimResponsible` VALUES (25,'Huelga',0,'str');
INSERT INTO `claimResponsible` VALUES (27,'Prep. por caja',0,'');
INSERT INTO `claimResponsible` VALUES (45,'Negativo',0,'neg');
INSERT INTO `claimReason` VALUES (1,'Prisas',0); INSERT INTO `claimReason` VALUES (1,'Prisas',0);
INSERT INTO `claimReason` VALUES (2,'Novato',0); INSERT INTO `claimReason` VALUES (2,'Novato',0);
@ -2489,9 +2374,6 @@ INSERT INTO `claimReason` VALUES (52,'Mala gestión comercial',0);
INSERT INTO `claimReason` VALUES (53,'Mala gestión comprador',0); INSERT INTO `claimReason` VALUES (53,'Mala gestión comprador',0);
INSERT INTO `claimReason` VALUES (54,'A2',0); INSERT INTO `claimReason` VALUES (54,'A2',0);
INSERT INTO `claimReason` VALUES (55,'Entrega 48h o más',0); INSERT INTO `claimReason` VALUES (55,'Entrega 48h o más',0);
INSERT INTO `claimReason` VALUES (56,'Error cliente',0);
INSERT INTO `claimReason` VALUES (57,'A2/B1',0);
INSERT INTO `claimReason` VALUES (58,'Seguro',0);
INSERT INTO `claimRedelivery` VALUES (1,'Cliente'); INSERT INTO `claimRedelivery` VALUES (1,'Cliente');
INSERT INTO `claimRedelivery` VALUES (2,'No dev./No especif.'); INSERT INTO `claimRedelivery` VALUES (2,'No dev./No especif.');
@ -2499,7 +2381,6 @@ INSERT INTO `claimRedelivery` VALUES (3,'Reparto');
INSERT INTO `claimRedelivery` VALUES (4,'Agencia'); INSERT INTO `claimRedelivery` VALUES (4,'Agencia');
INSERT INTO `claimRedelivery` VALUES (5,'Tour'); INSERT INTO `claimRedelivery` VALUES (5,'Tour');
INSERT INTO `claimRedelivery` VALUES (6,'Fuera Peninsula'); INSERT INTO `claimRedelivery` VALUES (6,'Fuera Peninsula');
INSERT INTO `claimRedelivery` VALUES (7,'Francia');
INSERT INTO `claimResult` VALUES (1,'Otros daños'); INSERT INTO `claimResult` VALUES (1,'Otros daños');
INSERT INTO `claimResult` VALUES (2,'Roces'); INSERT INTO `claimResult` VALUES (2,'Roces');
@ -2556,7 +2437,6 @@ INSERT INTO `component` VALUES (45,'maná reclamacion',7,4,NULL,0,'manaClaim',0)
INSERT INTO `component` VALUES (46,'recargo a particular',2,NULL,0.25,0,'individual',0); INSERT INTO `component` VALUES (46,'recargo a particular',2,NULL,0.25,0,'individual',0);
INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0); INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0);
INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0); INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0);
INSERT INTO `component` VALUES (50,'bonus',4,NULL,NULL,1,'bonus',0);
INSERT INTO `componentType` VALUES (1,'cost','coste',1,0); INSERT INTO `componentType` VALUES (1,'cost','coste',1,0);
INSERT INTO `componentType` VALUES (2,NULL,'com ventas',1,1); INSERT INTO `componentType` VALUES (2,NULL,'com ventas',1,1);
@ -2577,39 +2457,39 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC'); INSERT INTO `continent` VALUES (5,'Oceanía','OC');
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,116,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,114,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,5,NULL,72,0,0,1,1,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,5,NULL,72,0,0,1,1,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (23,'CMA','CAMARA',15,16,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,'PREVIOUS'); INSERT INTO `department` VALUES (23,'CMA','CAMARA',15,16,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,'PREVIOUS');
INSERT INTO `department` VALUES (31,'it','INFORMATICA',6,7,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (31,'it','INFORMATICA',6,7,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (35,'finance','FINANZAS',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (35,'finance','FINANZAS',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (36,'labor','LABORAL',12,13,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (36,'labor','LABORAL',12,13,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',14,37,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',14,37,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (38,'picking','SACADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,1,NULL,NULL,NULL,'ON_PREPARATION'); INSERT INTO `department` VALUES (38,'picking','SACADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_PREPARATION');
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'PACKING'); INSERT INTO `department` VALUES (39,'packing','ENCAJADO',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'PACKING');
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',38,39,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',38,39,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',40,75,NULL,0,0,0,1,17,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (43,'VT','VENTAS',40,73,NULL,0,0,0,1,16,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (44,'management','GERENCIA',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'DELIVERY'); INSERT INTO `department` VALUES (46,'delivery','REPARTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'DELIVERY');
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',82,83,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'STORAGE'); INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',80,81,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'STORAGE');
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',21,22,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL); INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',21,22,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',23,24,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL); INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',23,24,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',90,93,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'FIELD'); INSERT INTO `department` VALUES (58,'CMP','CAMPOS',88,91,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'FIELD');
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',92,93,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',43,44,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'CLAIM'); INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',43,44,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,1,1,0,0,NULL,NULL,NULL,'CLAIM');
INSERT INTO `department` VALUES (61,NULL,'VNH',96,99,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (61,NULL,'VNH',94,97,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',100,101,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',25,26,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',25,26,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',102,103,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',100,101,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',45,46,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL); INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',45,46,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',104,105,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',106,107,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (89,NULL,'COORDINACION',104,105,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',97,98,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (90,NULL,'TRAILER',95,96,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',27,28,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PREVIOUS'); INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',27,28,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PREVIOUS');
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',47,48,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',47,48,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',49,50,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',1,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL); INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',49,50,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',1,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
@ -2617,24 +2497,23 @@ INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',51,52,24065,
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',53,54,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',53,54,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',55,56,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',55,56,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',57,58,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',57,58,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',108,109,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',106,107,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL); INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PALLETIZING'); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PALLETIZING');
INSERT INTO `department` VALUES (130,NULL,'REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_CHECKING'); INSERT INTO `department` VALUES (130,NULL,'REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_CHECKING');
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',91,92,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',89,90,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',63,64,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL); INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',63,64,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',65,66,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL); INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',65,66,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',110,111,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',112,113,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',110,111,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (137,'sorter','SORTER',114,115,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (137,'sorter','SORTER',112,113,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL); INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
INSERT INTO `department` VALUES (140,'internationalTeam','EQUIPO INTERNACIONAL',69,70,33320,0,0,0,2,0,43,'/1/43/','int_equipo',1,'international@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (141,NULL,'PREVIA',35,36,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'PREVIOUS'); INSERT INTO `department` VALUES (141,NULL,'PREVIA',35,36,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,22,'/1/22/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,22,'/1/22/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (147,'spainTeamAsia','EQUIPO ESPAÑA ASIA',71,72,40214,0,0,0,2,0,43,'/1/43/','esA_equipo',0,'esA@verdnatura.es',0,0,0,0,NULL,NULL,'5500',NULL); INSERT INTO `department` VALUES (147,'spainTeamAsia','EQUIPO ESPAÑA ASIA',71,72,40214,0,0,0,2,0,43,'/1/43/','esA_equipo',0,'esA@verdnatura.es',0,0,0,0,NULL,NULL,'5500',NULL);
INSERT INTO `department` VALUES (148,NULL,'CAPTATION FRANCIA',73,74,NULL,0,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0,NULL,NULL,'6000',NULL);
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
@ -2689,7 +2568,7 @@ INSERT INTO `sample` VALUES (16,'letter-debtor-nd','Aviso reiterado por saldo de
INSERT INTO `sample` VALUES (17,'client-lcr','Email de solicitud de datos bancarios LCR',0,1,1,0,NULL); INSERT INTO `sample` VALUES (17,'client-lcr','Email de solicitud de datos bancarios LCR',0,1,1,0,NULL);
INSERT INTO `sample` VALUES (18,'client-debt-statement','Extracto del cliente',1,0,1,1,'Clients'); INSERT INTO `sample` VALUES (18,'client-debt-statement','Extracto del cliente',1,0,1,1,'Clients');
INSERT INTO `sample` VALUES (19,'credit-request','Solicitud de crédito',1,1,1,0,'Clients'); INSERT INTO `sample` VALUES (19,'credit-request','Solicitud de crédito',1,1,1,0,'Clients');
INSERT INTO `sample` VALUES (20,'incoterms-authorization','Entregas intracomunitarias recogidas por el cliente',1,1,1,0,'Clients'); INSERT INTO `sample` VALUES (20,'incoterms-authorization','Autorización de incoterms',1,1,1,0,'Clients');
INSERT INTO `siiTrascendencyInvoiceIn` VALUES (1,'Operación de régimen general'); INSERT INTO `siiTrascendencyInvoiceIn` VALUES (1,'Operación de régimen general');
INSERT INTO `siiTrascendencyInvoiceIn` VALUES (2,'Operaciones por las que los empresarios satisfacen compensaciones REAGYP'); INSERT INTO `siiTrascendencyInvoiceIn` VALUES (2,'Operaciones por las que los empresarios satisfacen compensaciones REAGYP');
@ -2726,50 +2605,48 @@ INSERT INTO `siiTypeInvoiceOut` VALUES (7,'R3','Factura rectificativa (Art. 80.4
INSERT INTO `siiTypeInvoiceOut` VALUES (8,'R4','Factura rectificativa (Resto)'); INSERT INTO `siiTypeInvoiceOut` VALUES (8,'R4','Factura rectificativa (Resto)');
INSERT INTO `siiTypeInvoiceOut` VALUES (9,'R5','Factura rectificativa en facturas simplificadas'); INSERT INTO `siiTypeInvoiceOut` VALUES (9,'R5','Factura rectificativa en facturas simplificadas');
INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',1,0,0,0,0,0,0,4,1,'alert'); INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1,'alert');
INSERT INTO `state` VALUES (2,'Libre',2,0,'FREE',2,0,0,0,0,0,0,4,1,'notice'); INSERT INTO `state` VALUES (2,'Libre',2,0,'FREE',NULL,2,0,0,0,0,0,0,4,1,'notice');
INSERT INTO `state` VALUES (3,'OK',3,0,'OK',28,1,0,1,0,1,1,3,0,'success'); INSERT INTO `state` VALUES (3,'OK',3,0,'OK',3,28,1,0,1,0,1,1,3,0,'success');
INSERT INTO `state` VALUES (4,'Impreso',4,0,'PRINTED',29,1,0,1,0,0,1,2,0,'success'); INSERT INTO `state` VALUES (4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0,'success');
INSERT INTO `state` VALUES (5,'Preparación',6,2,'ON_PREPARATION',14,0,0,0,2,0,0,2,0,'warning'); INSERT INTO `state` VALUES (5,'Preparación',6,2,'ON_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `state` VALUES (6,'En Revisión',7,2,'ON_CHECKING',6,0,1,0,3,0,0,1,0,'warning'); INSERT INTO `state` VALUES (6,'En Revisión',7,2,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning');
INSERT INTO `state` VALUES (7,'Sin Acabar',1,0,'NOT_READY',7,0,0,0,0,0,0,4,1,'alert'); INSERT INTO `state` VALUES (7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1,'alert');
INSERT INTO `state` VALUES (8,'Revisado',8,2,'CHECKED',8,0,1,0,3,0,0,1,0,'warning'); INSERT INTO `state` VALUES (8,'Revisado',8,2,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning');
INSERT INTO `state` VALUES (9,'Encajando',9,3,'PACKING',9,0,1,0,0,0,0,1,0,NULL); INSERT INTO `state` VALUES (9,'Encajando',9,3,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL);
INSERT INTO `state` VALUES (10,'Encajado',10,3,'PACKED',10,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (10,'Encajado',10,3,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (11,'Facturado',0,4,'INVOICED',11,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (11,'Facturado',0,4,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (12,'Bloqueado',0,0,'BLOCKED',12,0,0,0,0,0,0,4,1,'alert'); INSERT INTO `state` VALUES (12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1,'alert');
INSERT INTO `state` VALUES (13,'En Reparto',11,4,'ON_DELIVERY',13,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (13,'En Reparto',11,4,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (14,'Preparado',6,2,'PREPARED',14,0,1,0,2,0,0,1,0,'warning'); INSERT INTO `state` VALUES (14,'Preparado',6,2,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning');
INSERT INTO `state` VALUES (15,'Pte Recogida',12,4,'WAITING_FOR_PICKUP',15,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (15,'Pte Recogida',12,4,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (16,'Entregado',13,4,'DELIVERED',16,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (16,'Entregado',13,4,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (20,'Asignado',4,0,'PICKER_DESIGNED',20,1,0,0,0,0,0,2,0,'success'); INSERT INTO `state` VALUES (20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0,'success');
INSERT INTO `state` VALUES (21,'Retornado',4,2,'PRINTED_BACK',21,0,0,0,0,0,0,2,0,'success'); INSERT INTO `state` VALUES (21,'Retornado',4,2,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success');
INSERT INTO `state` VALUES (22,'Pte. Ampliar',2,0,'EXPANDABLE',22,0,0,0,0,0,0,4,1,'alert'); INSERT INTO `state` VALUES (22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1,'alert');
INSERT INTO `state` VALUES (23,'URGENTE',5,2,'LAST_CALL',23,1,0,1,0,0,0,4,1,'success'); INSERT INTO `state` VALUES (23,'URGENTE',5,2,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success');
INSERT INTO `state` VALUES (24,'Encadenado',4,0,'CHAINED',24,0,0,0,0,0,0,3,1,'success'); INSERT INTO `state` VALUES (24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1,'success');
INSERT INTO `state` VALUES (25,'Embarcando',3,0,'BOARDING',25,1,0,0,0,0,0,3,0,'alert'); INSERT INTO `state` VALUES (25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0,'alert');
INSERT INTO `state` VALUES (26,'Prep Previa',5,0,'PREVIOUS_PREPARATION',28,1,0,0,1,0,0,2,0,'warning'); INSERT INTO `state` VALUES (26,'Prep Previa',5,0,'PREVIOUS_PREPARATION',1,28,1,0,0,1,0,0,2,0,'warning');
INSERT INTO `state` VALUES (27,'Prep Asistida',5,2,'ASSISTED_PREPARATION',27,0,0,0,0,0,0,2,0,'success'); INSERT INTO `state` VALUES (27,'Prep Asistida',5,2,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success');
INSERT INTO `state` VALUES (28,'Previa OK',3,0,'OK PREVIOUS',28,1,0,1,1,1,1,3,0,'warning'); INSERT INTO `state` VALUES (28,'Previa OK',3,0,'OK PREVIOUS',3,28,1,0,1,1,1,1,3,0,'warning');
INSERT INTO `state` VALUES (29,'Previa Impreso',4,0,'PRINTED PREVIOUS',29,1,0,1,0,0,1,2,0,'success'); INSERT INTO `state` VALUES (29,'Previa Impreso',4,0,'PRINTED PREVIOUS',2,29,1,0,1,0,0,1,2,0,'success');
INSERT INTO `state` VALUES (30,'Embarcado',4,2,'BOARD',30,0,0,0,2,0,0,3,0,'success'); INSERT INTO `state` VALUES (30,'Embarcado',4,2,'BOARD',5,30,0,0,0,2,0,0,3,0,'success');
INSERT INTO `state` VALUES (31,'Polizon Impreso',4,2,'PRINTED STOWAWAY',29,1,0,1,0,0,1,2,0,'success'); INSERT INTO `state` VALUES (31,'Polizon Impreso',4,2,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,2,0,'success');
INSERT INTO `state` VALUES (32,'Polizon OK',3,2,'OK STOWAWAY',31,1,0,0,1,1,1,3,0,'warning'); INSERT INTO `state` VALUES (32,'Polizon OK',3,2,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning');
INSERT INTO `state` VALUES (33,'Auto_Impreso',4,0,'PRINTED_AUTO',29,1,0,1,0,0,1,2,0,'success'); INSERT INTO `state` VALUES (33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0,'success');
INSERT INTO `state` VALUES (34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',34,0,0,0,0,0,0,4,1,'alert'); INSERT INTO `state` VALUES (34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1,'alert');
INSERT INTO `state` VALUES (35,'Semi-Encajado',9,3,'HALF_PACKED',10,0,1,0,0,0,0,1,0,NULL); INSERT INTO `state` VALUES (35,'Semi-Encajado',9,3,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL);
INSERT INTO `state` VALUES (36,'Previa Revisando',3,0,'PREVIOUS_CONTROL',37,1,0,0,4,0,1,2,0,'warning'); INSERT INTO `state` VALUES (36,'Previa Revisando',3,0,'PREVIOUS_CONTROL',2,37,1,0,0,4,0,1,2,0,'warning');
INSERT INTO `state` VALUES (37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',29,1,0,1,0,0,1,2,0,'warning'); INSERT INTO `state` VALUES (37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,1,0,1,0,0,1,2,0,'warning');
INSERT INTO `state` VALUES (38,'Prep Cámara',6,2,'COOLER_PREPARATION',14,0,0,0,2,0,0,2,0,'warning'); INSERT INTO `state` VALUES (38,'Prep Cámara',6,2,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `state` VALUES (41,'Prep Parcial',6,2,'PARTIAL_PREPARATION',14,0,0,0,2,0,0,2,0,'warning'); INSERT INTO `state` VALUES (41,'Prep Parcial',6,2,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `state` VALUES (42,'Entregado en parte',13,3,'PARTIAL_DELIVERED',16,0,1,0,0,0,0,0,0,NULL); INSERT INTO `state` VALUES (42,'Entregado en parte',13,3,'PARTIAL_DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL);
INSERT INTO `state` VALUES (43,'Preparación por caja',6,2,'BOX_PICKING',42,0,0,0,2,0,0,2,0,'warning'); INSERT INTO `state` VALUES (43,'Preparación por caja',6,2,'BOX_PICKING',7,42,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','renewPrices'); INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','renewPrices');
INSERT INTO `ticketUpdateAction` VALUES (2,'Convertir en maná','mana'); INSERT INTO `ticketUpdateAction` VALUES (2,'Convertir en maná','mana');
INSERT INTO `ticketCanAdvanceConfig` VALUES (1,5);
INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,50,200,10,167.0); INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,50,200,10,167.0);
INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL); INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL);
@ -2782,7 +2659,6 @@ INSERT INTO `workCenter` VALUES (7,'Tenerife',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL); INSERT INTO `workCenter` VALUES (8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL); INSERT INTO `workCenter` VALUES (9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL);
INSERT INTO `workCenter` VALUES (10,'Rubi',88,NULL,84,'Av. de la Llana, 131',549722,NULL); INSERT INTO `workCenter` VALUES (10,'Rubi',88,NULL,84,'Av. de la Llana, 131',549722,NULL);
INSERT INTO `workCenter` VALUES (11,'Colombia',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workerTimeControlError` VALUES (1,'IS_NOT_ALLOWED_FUTURE','No se permite fichar a futuro'); INSERT INTO `workerTimeControlError` VALUES (1,'IS_NOT_ALLOWED_FUTURE','No se permite fichar a futuro');
INSERT INTO `workerTimeControlError` VALUES (2,'INACTIVE_BUSINESS','No hay un contrato en vigor'); INSERT INTO `workerTimeControlError` VALUES (2,'INACTIVE_BUSINESS','No hay un contrato en vigor');

View File

@ -502,7 +502,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','receipt','alexm@%','0000-
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visitUser','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visitUser','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','referenceRate','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','referenceRate','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','report','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','report','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerAssistant','producer','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','productionBoss','available','guillermo@10.5.1.2','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','time','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','time','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','role','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','role','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','config__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','config__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -605,6 +605,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','project','jua
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','productionConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','productionConfig','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','productionConfig','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','productionConfig','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditInsurance','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditInsurance','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','cache','productionBoss','visible','guillermo@10.5.1.2','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','errorProduction__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','errorProduction__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','invoiceOut','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','invoiceOut','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','coolerAssist','Tickets','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','coolerAssist','Tickets','alexm@%','0000-00-00 00:00:00','Update','');
@ -791,6 +792,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemMinimumQuantity','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemMinimumQuantity','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','producer','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','link','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','link','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','delivery','vehicle','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','delivery','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
@ -969,7 +971,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','officeBoss','ticketPackagingSt
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerRelatives','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerRelatives','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketPackagingStartingStock','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketPackagingStartingStock','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierPackaging','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierPackaging','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierContact','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorrection','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorrection','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select','');
@ -1469,31 +1471,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','tillSerial','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','stockBuyed','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','stockBuyed','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','alertLevel','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','alertLevel','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivityType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivityType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','priceDelta','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parkingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','travelLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierContact','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDms','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','user','juan@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimReason','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResponsible','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResult','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimRedelivery','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','producer','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStateTag','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','material','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','saleUnit','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','origin','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemType','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','delivery','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemFarmingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemWrappingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemLanguageTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStemTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBaseTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBreederTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1873,6 +1850,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByE
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','stockbuyedbyworker','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getsplit','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getsplit','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','subordinategetlist','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','subordinategetlist','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_afterUpsert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_afterUpsert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -2020,6 +1998,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','logshow','PROCEDURE','alex
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyerBoss','supplierpackaging_reportsource','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyerBoss','supplierpackaging_reportsource','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','supplierexpenses','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','supplierexpenses','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','firstdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','firstdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','stockbuyed_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','mail_insert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','mail_insert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaParcialMake','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaParcialMake','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','palletizerBoss','packingsite_startcollection','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','palletizerBoss','packingsite_startcollection','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2093,7 +2072,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addby
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addByCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addByCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addlist','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addlist','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_selfconsumption','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_selfconsumption','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','item_getSimilar','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','item_getSimilar','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvingsale_add','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvingsale_add','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_printsticker','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_printsticker','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','deviceproductionuser_getworker','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','deviceproductionuser_getworker','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2144,7 +2123,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_filterb
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addbyclaim','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addbyclaim','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addlist','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addlist','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_selfconsumption','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_selfconsumption','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','reviewer','item_getSimilar','PROCEDURE','guillermo@10.5.1.6','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','reviewer','item_getSimilar','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelvingsale_add','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelvingsale_add','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','collection_printsticker','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','collection_printsticker','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','deviceproductionuser_getworker','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','deviceproductionuser_getworker','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2212,7 +2191,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByEn
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','entryEditor','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','entryEditor','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addBySaleGroup','PROCEDURE','alexm@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_nextTx','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_nextTx','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_docompensation','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_docompensation','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setQuantity','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setQuantity','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2228,11 +2206,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana-write','item_ValuateInv
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','guest','ticketCalculatePurge','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','guest','ticketCalculatePurge','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','bs','buyerBoss','waste_addSales','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','saletracking_sectorcollectionaddprevok','PROCEDURE','alexm@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','saleSplit','PROCEDURE','carlosap@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_deleteAdded','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

File diff suppressed because it is too large Load Diff

View File

@ -1128,28 +1128,6 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`orderRow_afterInsert`
AFTER INSERT ON `orderRow`
FOR EACH ROW
BEGIN
UPDATE `order`
SET rowUpdated = util.VN_NOW()
WHERE id = NEW.orderFk;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-- --
-- Current Database: `pbx` -- Current Database: `pbx`
@ -2454,21 +2432,11 @@ DELIMITER ;;
AFTER UPDATE ON `business` AFTER UPDATE ON `business`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
DECLARE vIsActive BOOL;
DECLARE vExtension VARCHAR(10);
CALL worker_updateBusiness(NEW.workerFk); CALL worker_updateBusiness(NEW.workerFk);
IF NOT (OLD.workerFk <=> NEW.workerFk) THEN IF NOT (OLD.workerFk <=> NEW.workerFk) THEN
CALL worker_updateBusiness(OLD.workerFk); CALL worker_updateBusiness(OLD.workerFk);
END IF; END IF;
IF NOT (OLD.departmentFk <=> NEW.departmentFk) THEN
SELECT COUNT(*) INTO vIsActive FROM worker WHERE businessFk = NEW.id;
IF vIsActive THEN
CALL queueMember_updateQueue(NEW.id);
END IF;
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -4338,13 +4306,35 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_beforeInsert`
BEFORE INSERT ON `creditInsurance`
FOR EACH ROW
BEGIN
IF NEW.creditClassificationFk THEN
SET NEW.creditClassification = NEW.creditClassificationFk;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_afterInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`creditInsurance_afterInsert`
AFTER INSERT ON `creditInsurance` AFTER INSERT ON `creditInsurance`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE `client` c UPDATE `client` c
JOIN vn.creditClassification cc ON cc.client = c.id JOIN vn.creditClassification cc ON cc.client = c.id
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassificationFk; SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -5028,10 +5018,7 @@ BEGIN
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
END IF; END IF;
IF NOT (NEW.travelFk <=> OLD.travelFk) IF NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
OR NOT (NEW.currencyFk <=> OLD.currencyFk)
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk); SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk);
END IF; END IF;
END */;; END */;;
@ -5565,7 +5552,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`host_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`host_beforeInsert`
BEFORE INSERT ON `host` BEFORE INSERT ON `host`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -6531,36 +6518,6 @@ BEGIN
SET NEW.userFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId();
SET NEW.available = NEW.visible; SET NEW.available = NEW.visible;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterInsert`
AFTER INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
INSERT INTO itemShelvingLog
SET itemShelvingFk = NEW.id,
workerFk = account.myUser_getId(),
accion = 'CREA REGISTRO',
itemFk = NEW.itemFk,
shelvingFk = NEW.shelvingFk,
visible = NEW.visible,
`grouping` = NEW.`grouping`,
packing = NEW.packing,
available = NEW.available;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -6586,9 +6543,6 @@ BEGIN
SET NEW.userFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId();
END IF; END IF;
IF NEW.shelvingFk <> OLD.shelvingFk THEN
SET NEW.movingState = NULL;
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -6689,11 +6643,11 @@ DELIMITER ;;
AFTER INSERT ON `itemShelvingSale` AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE sale s UPDATE sale s
JOIN operator o ON o.workerFk = account.myUser_getId() JOIN operator o ON o.workerFk = account.myUser_getId()
JOIN sector se ON se.id = o.sectorFk SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
SET s.isPicked = IF(IFNULL(se.isOnReservationMode, o.isOnReservationMode), s.isPicked, TRUE) WHERE id = NEW.saleFk;
WHERE s.id = NEW.saleFk;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -7971,7 +7925,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeInsert`
BEFORE INSERT ON `roadmap` BEFORE INSERT ON `roadmap`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -7995,7 +7949,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`roadmap_beforeUpdate`
BEFORE UPDATE ON `roadmap` BEFORE UPDATE ON `roadmap`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -8650,7 +8604,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeInsert`
BEFORE INSERT ON `saleGroupDetail` BEFORE INSERT ON `saleGroupDetail`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -8670,7 +8624,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
BEFORE UPDATE ON `saleGroupDetail` BEFORE UPDATE ON `saleGroupDetail`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -8690,7 +8644,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_afterDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroupDetail_afterDelete`
AFTER DELETE ON `saleGroupDetail` AFTER DELETE ON `saleGroupDetail`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
@ -8971,7 +8925,7 @@ DELIMITER ;;
BEGIN BEGIN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.id JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance; SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -8995,12 +8949,12 @@ BEGIN
IF NEW.dateLeaving IS NOT NULL THEN IF NEW.dateLeaving IS NOT NULL THEN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.id JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE ELSE
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.id JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF; END IF;
END */;; END */;;
@ -9024,7 +8978,7 @@ DELIMITER ;;
BEGIN BEGIN
UPDATE client c UPDATE client c
JOIN creditClassification cc ON cc.client = c.id JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -10023,8 +9977,6 @@ DELIMITER ;;
BEFORE INSERT ON `ticketRefund` BEFORE INSERT ON `ticketRefund`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -10045,8 +9997,6 @@ DELIMITER ;;
BEFORE UPDATE ON `ticketRefund` BEFORE UPDATE ON `ticketRefund`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -10717,15 +10667,6 @@ DELIMITER ;;
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NEW.travelFk IS NULL AND
(SELECT COUNT(*) FROM travelThermograph
WHERE thermographFk = NEW.thermographFk
AND travelFk IS NULL
AND id <> NEW.id) > 0
THEN
CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10746,15 +10687,6 @@ DELIMITER ;;
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NEW.travelFk IS NULL AND
(SELECT COUNT(*) FROM travelThermograph
WHERE thermographFk = NEW.thermographFk
AND travelFk IS NULL
AND id <> NEW.id) > 0
THEN
CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10920,8 +10852,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDms_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeInsert`
BEFORE INSERT ON `workerDms` BEFORE INSERT ON `workerDocument`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
@ -10940,8 +10872,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDms_beforeUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_beforeUpdate`
BEFORE UPDATE ON `workerDms` BEFORE UPDATE ON `workerDocument`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
@ -10960,13 +10892,13 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDms_afterDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`vn`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerDocument_afterDelete`
AFTER DELETE ON `workerDms` AFTER DELETE ON `workerDocument`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
INSERT INTO workerLog INSERT INTO workerLog
SET `action` = 'delete', SET `action` = 'delete',
`changedModel` = 'WorkerDms', `changedModel` = 'WorkerDocument',
`changedModelId` = OLD.id, `changedModelId` = OLD.id,
`userFk` = account.myUser_getId(); `userFk` = account.myUser_getId();
END */;; END */;;
@ -11526,4 +11458,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-11-12 7:06:44 -- Dump completed on 2024-09-18 9:32:59

View File

@ -185,7 +185,6 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0), (3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1), (4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0), (5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
(6, 'Warehouse six', 'vnh', 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0), (13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0); (60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
@ -336,21 +335,21 @@ INSERT INTO `vn`.`payDem`(`id`, `payDem`)
(2, 20), (2, 20),
(7, 0); (7, 0);
INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`, `hasDailyInvoice`) INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`)
VALUES VALUES
(1, 'Autonomy one', 1, 1), (1, 'Autonomy one', 1),
(2, 'Autonomy two', 1, 0), (2, 'Autonomy two', 1),
(3, 'Autonomy three', 2, 0), (3, 'Autonomy three', 2),
(4, 'Autonomy four', 13, 0); (4, 'Autonomy four', 13);
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseFk`) INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `autonomyFk`, `warehouseFk`)
VALUES VALUES
(1, 'Province one', 1, 1, NULL), (1, 'Province one', 1, 1, NULL),
(2, 'Province two', 1, 1, NULL), (2, 'Province two', 1, 1, NULL),
(3, 'Province three', 30, 2, NULL), (3, 'Province three', 30, 2, NULL),
(4, 'Province four', 2, 3, NULL), (4, 'Province four', 2, 3, NULL),
(5, 'Province five', 13, 4, NULL); (5, 'Province five', 13, 4, NULL);
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`) INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
VALUES VALUES
@ -366,7 +365,6 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
('46460', 2, 6), ('46460', 2, 6),
('46680', 3, 6), ('46680', 3, 6),
('46600', 4, 7), ('46600', 4, 7),
('46600',1, 6),
('EC170150', 5, 8); ('EC170150', 5, 8);
INSERT INTO `vn`.`clientType`(`code`, `type`) INSERT INTO `vn`.`clientType`(`code`, `type`)
@ -388,23 +386,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
(4, 'GCN Channel'), (4, 'GCN Channel'),
(5, 'The Newspaper'); (5, 'The Newspaper');
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
VALUES VALUES
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'), (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'), (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'), (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'), (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'), (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'), (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'), (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'), (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'), (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'), (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'), (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'); (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 0, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1 SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
FROM `account`.`role` `r` FROM `account`.`role` `r`
WHERE `r`.`hasLogin` = 1; WHERE `r`.`hasLogin` = 1;
@ -546,8 +544,7 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
(6, 'Weight', 'weight'), (6, 'Weight', 'weight'),
(7, 'InvoiceOut', 'invoiceOut'), (7, 'InvoiceOut', 'invoiceOut'),
(8, 'DropOff', 'dropOff'), (8, 'DropOff', 'dropOff'),
(9, 'Sustitución', 'substitution'), (9, 'Sustitución', 'substitution');
(10, 'Finance', 'finance');
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
VALUES VALUES
@ -632,21 +629,14 @@ INSERT INTO vn.invoiceOutConfig
SET id = 1, SET id = 1,
parallelism = 8; parallelism = 8;
INSERT INTO `vn`.`invoiceOutSerial` INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
(`code`,`description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES VALUES
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'), ('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'), ('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'), ('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'), ('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL), ('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick'), ('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
('H', 'Intracomunitaria rápida', 0, 'CEE', 1, 'quick'),
('P', 'Factura simplificada', 1, 'NATIONAL', 0, NULL),
('PE', 'COOPERATIE FLORAHOLLAND UA', 0, 'CEE', 1, NULL),
('S', 'Simplificada', 1, 'NATIONAL', 0, NULL),
('X', 'Exportación global', 0, 'WORLD', 0, 'global'),
('N', 'Múltiple Intracomunitaria', 0, 'CEE', 1, 'multiple');
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
VALUES VALUES
@ -831,10 +821,10 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
(12, 3, 19, util.VN_NOW()), (12, 3, 19, util.VN_NOW()),
(13, 3, 19, util.VN_NOW()), (13, 3, 19, util.VN_NOW()),
(14, 3, 19, util.VN_NOW()), (14, 3, 19, util.VN_NOW()),
(15, 10, 19, util.VN_NOW()), (15, 2, 19, util.VN_NOW()),
(16, 3, 19, util.VN_NOW()), (16, 3, 19, util.VN_NOW()),
(17, 2, 19, util.VN_NOW()), (17, 2, 19, util.VN_NOW()),
(37, 10, 19, util.VN_NOW()), (18, 2, 19, util.VN_NOW()),
(19, 2, 19, util.VN_NOW()), (19, 2, 19, util.VN_NOW()),
(20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)), (20, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
(21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)), (21, 1, 19, DATE_ADD(util.VN_NOW(), INTERVAL +1 MONTH)),
@ -1041,20 +1031,19 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`) INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
VALUES VALUES
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'), (1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, 'UR9000006041', 94, 1, 'pc1'),
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL), (2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 18, 'UR9000006041', 94, 1, NULL),
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL), (3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 18, 'UR9000006041', 94, 2, NULL),
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL), (4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 18, 'UR9000006041', 94, 2, NULL),
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL), (5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 3, NULL),
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL), (6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 18, NULL, 94, 3, NULL),
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL), (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL), (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL), (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
(10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), (10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), (11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), (12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(13, 1, 10, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL), (13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
(14, 1, 37, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
@ -1254,9 +1243,9 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`) INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`)
VALUES VALUES
(2, 11, 1, 1, 1, 2,1106), (2, 'GVC', 1, 1, 1, 2,1106),
(4, 12, 1, 1, 1, NULL,1106), (4, 'HEJ', 1, 1, 1, NULL,1106),
(1, 13, 2, 12, 12, NULL,1106); (1, 'UXN', 2, 12, 12, NULL,1106);
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
VALUES VALUES
@ -1489,8 +1478,7 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
(2, 1), (2, 1),
(3, 2), (3, 2),
(5, 6), (5, 6),
(15, 6), (15, 6);
(17, 6);
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
VALUES VALUES
@ -1505,55 +1493,53 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1), (9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1); (10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `isRaid`, `daysInForward`) INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1, FALSE, NULL), VALUES
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2, FALSE, NULL), (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, FALSE, NULL), (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2, 2),
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, FALSE, NULL), (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, FALSE, NULL), (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, FALSE,NULL), (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, TRUE, 2), (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, FALSE, NULL), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL), (10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10);
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
VALUES VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'), (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'), (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'), (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'), (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'), (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'), (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'), (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
(99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`) INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1); VALUES (2, 4, 1);
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleExternalWaste`, `saleFaultWaste`, `saleContainerWaste`, `saleBreakWaste`, `saleOtherWaste`) INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`)
VALUES VALUES
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20', '56.20', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69', '56.20', '56.20', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12', '56.20', '56.20', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20', '56.20', '56.20', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69', '56.20', '56.20', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20'); ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created) INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
VALUES VALUES
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH), (1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH), (2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
@ -1569,8 +1555,7 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), (12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()), (13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()), (14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()), (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE());
(16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000');
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`) INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
VALUES VALUES
@ -2451,33 +2436,30 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1), (1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1); (1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
INSERT INTO `vn`.`dmsType` INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
VALUES VALUES
(1, 'Facturas Recibidas', 1, 1, 'invoiceIn'), (1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
(2, 'Doc oficial', NULL, NULL, 'officialDoc'), (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
(3, 'Laboral', 37, 37, 'hhrrData'), (3, 'Laboral', 37, 37, 'hhrrData'),
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'), (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
(5, 'Otros', 1, 1, 'miscellaneous'), (5, 'Otros', 1, 1, 'miscellaneous'),
(6, 'Pruebas', NULL, NULL, 'tests'), (6, 'Pruebas', NULL, NULL, 'tests'),
(7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'), (7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
(8, 'Fiscal', NULL, NULL, 'fiscal'), (8, 'Fiscal', NULL, NULL, 'fiscal'),
(9, 'Vehiculos', NULL, NULL, 'vehicles'), (9, 'Vehiculos', NULL, NULL, 'vehicles'),
(10, 'Plantillas', NULL, NULL, 'templates'), (10, 'Plantillas', NULL, NULL, 'templates'),
(11, 'Contratos', NULL, NULL, 'contracts'), (11, 'Contratos', NULL, NULL, 'contracts'),
(12, 'ley de pagos', 1, 1, 'paymentsLaw'), (12, 'ley de pagos', 1, 1, 'paymentsLaw'),
(13, 'Basura', 1, 1, 'trash'), (13, 'Basura', 1, 1, 'trash'),
(14, 'Ticket', 1, 1, 'ticket'), (14, 'Ticket', 1, 1, 'ticket'),
(15, 'Presupuestos', NULL, NULL, 'budgets'), (15, 'Presupuestos', NULL, NULL, 'budgets'),
(16, 'Logistica', NULL, NULL, 'logistics'), (16, 'Logistica', NULL, NULL, 'logistics'),
(17, 'cmr', 1, 1, 'cmr'), (17, 'cmr', 1, 1, 'cmr'),
(18, 'dua', NULL, NULL, 'dua'), (18, 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'), (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 1, 1, 'claim'), (20, 'Reclamación', 1, 1, 'claim'),
(21, 'Entrada', 1, 1, 'entry'), (21, 'Entrada', 1, 1, 'entry'),
(22, 'Proveedor', 1, 1, 'supplier'), (22, 'Proveedor', 1, 1, 'supplier');
(23, 'Termografos', 35, 35, 'thermograph'),
(24, 'Sello de calidad', 1, 1, 'qualitySeal');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES VALUES
@ -2485,7 +2467,7 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()), (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()),
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()), (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()),
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()), (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()),
(5, 23, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()), (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()), (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
@ -2506,7 +2488,7 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
(1104, 2), (1104, 2),
(1104, 3); (1104, 3);
INSERT INTO `vn`.`workerDms`(`id`, `workerFk`, `dmsFk`,`isReadableByWorker`) INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`)
VALUES VALUES
(1, 1106, 4, TRUE), (1, 1106, 4, TRUE),
(2, 1107, 3, FALSE); (2, 1107, 3, FALSE);
@ -2521,6 +2503,10 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`)
(2, 'Normal', 'normal'), (2, 'Normal', 'normal'),
(3, 'Baja', 'low'); (3, 'Baja', 'low');
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`)
VALUES
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
INSERT INTO `vn`.`thermograph`(`id`, `model`) INSERT INTO `vn`.`thermograph`(`id`, `model`)
@ -2531,15 +2517,14 @@ INSERT INTO `vn`.`thermograph`(`id`, `model`)
('138350-0', 'DISPOSABLE'); ('138350-0', 'DISPOSABLE');
INSERT INTO `vn`.`travelThermograph` INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `result`, `dmsFk`)
(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `minTemperature`, `maxTemperature`, `result`, `dmsFk`)
VALUES VALUES
('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Ok', NULL), ('TMM190901395', util.VN_CURDATE(), 1, 1, 'WARM', 'Ok', NULL),
('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', NULL, NULL, 'Ok', NULL), ('TL.BBA85422', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL),
('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', NULL, NULL, 'can not read the temperature', NULL), ('TL.BBA85422', util.VN_CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL),
('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', NULL, NULL, 'Temperature in range', 5), ('TZ1905012010', util.VN_CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5),
('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', 2, 12, NULL, 5), ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL, NULL, NULL); ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL);
REPLACE INTO `vn`.`incoterms`(`code`, `name`) REPLACE INTO `vn`.`incoterms`(`code`, `name`)
VALUES VALUES
@ -2588,18 +2573,18 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25), (DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
(util.VN_CURDATE(), 1, 12, 17, 22, 27); (util.VN_CURDATE(), 1, 12, 17, 22, 27);
INSERT INTO `vn`.`dua` (id, code, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) INSERT INTO `vn`.`dua` (id, code, awbFk__, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
VALUES VALUES
(1, '19ES0028013A481523', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442), (1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
(2, '21ES00280136115760', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442), (2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
(3, '19ES00280131956004', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442), (3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
(4, '19ES00280131955995', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442), (4, '19ES00280131955995', 4, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 8242.50, 442),
(5, '19ES00280132022070', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442), (5, '19ES00280132022070', 5, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 10012.49, 442),
(6, '19ES00280132032308', util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442), (6, '19ES00280132032308', 6, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 19914.25, 442),
(7, '19ES00280132025489', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442), (7, '19ES00280132025489', 7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1934.06, 442),
(8, '19ES00280132025490', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442), (8, '19ES00280132025490', 8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 3618.52, 442),
(9, '19ES00280132025491', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442), (9, '19ES00280132025491', 9, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
(10, '19ES00280132025492', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442); (10, '19ES00280132025492', 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`) INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`)
VALUES VALUES
@ -2839,6 +2824,12 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442), ('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442); ('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
VALUES
(1106, 1, util.VN_CURDATE(), util.VN_CURDATE()),
(1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)),
(1106, 2, util.VN_CURDATE(), NULL),
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`) INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
VALUES VALUES
@ -2909,8 +2900,7 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(6, 'book-entry-deleted', 'accounting entries deleted'), (6, 'book-entry-deleted', 'accounting entries deleted'),
(7, 'zone-included','An email to notify zoneCollisions'), (7, 'zone-included','An email to notify zoneCollisions'),
(8, 'backup-printer-selected','A backup printer has been selected'), (8, 'backup-printer-selected','A backup printer has been selected'),
(9, 'mrw-deadline','The MRW deadline has passed'), (9, 'mrw-deadline','The MRW deadline has passed');
(10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process');
TRUNCATE `util`.`notificationAcl`; TRUNCATE `util`.`notificationAcl`;
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
@ -2951,9 +2941,9 @@ INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
VALUES VALUES
(1, 9); (1, 9);
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`, `clientSelfConsumptionFk`, `addressSelfConsumptionFk`) INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`)
VALUES VALUES
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600, 1112, 12); (0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`) INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
VALUES VALUES
@ -3067,6 +3057,9 @@ INSERT INTO `vn`.`workerTimeControlMail` (`id`, `workerFk`, `year`, `week`, `sta
(3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL), (3, 9, 2000, 51, 'CONFIRMED', util.VN_NOW(), 1, NULL),
(4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL); (4, 9, 2001, 1, 'SENDED', util.VN_NOW(), 1, NULL);
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`)
VALUES
(1, 1350, 1900, 200, 50, 6);
INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`) INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
VALUES VALUES
@ -3075,19 +3068,15 @@ INSERT INTO `vn`.`wagonTypeColor` (`id`, `name`, `rgb`)
(3, 'green', '#00ff00'), (3, 'green', '#00ff00'),
(4, 'blue', '#0000ff'); (4, 'blue', '#0000ff');
INSERT INTO `vn`.`wagonConfig` (`id`, `width`, `height`, `maxWagonHeight`, `minHeightBetweenTrays`, `maxTrays`, `defaultTrayColorFk`)
VALUES
(1, 1350, 1900, 200, 50, 6, 1);
INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`) INSERT INTO `vn`.`wagonType` (`id`, `name`, `divisible`)
VALUES VALUES
(1, 'Wagon Type #1', 1); (1, 'Wagon Type #1', 1);
INSERT INTO `vn`.`wagonTypeTray` (`id`, `wagonTypeFk`, `height`, `wagonTypeColorFk`) INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
VALUES VALUES
(1, 1, 0, 1), (1, 1, 100, 1),
(2, 1, 50, 2), (2, 1, 50, 2),
(3, 1, 100, 3); (3, 1, 0, 3);
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`) INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES VALUES
@ -3191,7 +3180,7 @@ UPDATE vn.department
SET workerFk = null; SET workerFk = null;
INSERT INTO vn.packaging INSERT INTO vn.packaging
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1); VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0);
INSERT IGNORE INTO vn.intrastat INSERT IGNORE INTO vn.intrastat
@ -3421,7 +3410,7 @@ INSERT INTO vn.buy
INSERT INTO vn.itemShelving INSERT INTO vn.itemShelving
SET id = 9931, SET id = 9931,
itemFk = 999993, itemFk = 999993,
shelvingFk = 16, shelvingFk = 'NCC',
visible = 10, visible = 10,
`grouping` = 5, `grouping` = 5,
packing = 10; packing = 10;
@ -3748,7 +3737,7 @@ INSERT vn.sale
USE vn; USE vn;
DELETE ish.* FROM vn.itemShelving ish DELETE ish.* FROM vn.itemShelving ish
JOIN vn.shelving sh ON sh.id = ish.shelvingFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.warehouse w ON w.id = s.warehouseFk JOIN vn.warehouse w ON w.id = s.warehouseFk
@ -3757,22 +3746,22 @@ DELETE ish.* FROM vn.itemShelving ish
INSERT INTO vn.itemShelving INSERT INTO vn.itemShelving
(itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) (itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked)
VALUES VALUES
(999991, 14, 8, '2023-09-20', 1, 20, NULL, 103, NULL), (999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL),
(999998, 14, 80, '2023-09-20', 10, 30, NULL, 103, NULL), (999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL),
(1000001, 14, 6, '2023-09-20', 3, 50, NULL, 103, NULL), (1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL),
(1000000, 15, 50, '2023-09-18', 25, 500, NULL, 103, NULL), (1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL),
(999993, 15, 25, '2023-09-18', NULL, 10, NULL, 103, NULL), (999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
(999999, 15, 30, '2023-09-18', 10, 500, NULL, 103, NULL), (999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL),
(999993, 16, 25, '2023-09-20', 5, 10, NULL, 103, NULL), (999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL),
(999997, 16, 10, '2023-09-20', NULL, 100, NULL, 103, NULL), (999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
(999999, 16, 40, '2023-09-20', 10, 500, NULL, 103, NULL), (999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL),
(999995, 17, 10, '2023-09-19', NULL, 20, NULL, 103, NULL), (999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
(999994, 17, 48, '2023-09-19', 4, 20, NULL, 103, NULL), (999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL),
(1000001, 18, 6, '2023-09-21', 3, 50, NULL, 103, NULL), (1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL),
(999992, 18, 50, '2023-09-21', NULL, 1, NULL, 103, NULL), (999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
(1000000, 18, 25, '2023-09-21', 25, 500, NULL, 103, NULL), (1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL),
(999996, 19, 5, '2023-09-27', 1, 5, NULL, 103, NULL), (999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL),
(999997, 21, 10, '2023-09-27', 5, 100, NULL, 103, NULL); (999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL);
-- Previous for Bolas de madera -- Previous for Bolas de madera
INSERT IGNORE INTO vn.sectorCollection INSERT IGNORE INTO vn.sectorCollection
@ -3822,6 +3811,8 @@ UPDATE vn.collection
UPDATE vn.sale UPDATE vn.sale
SET isPicked =FALSE; SET isPicked =FALSE;
INSERT INTO vn.machineWorkerConfig(id, maxHours)
VALUES(1, 12);
INSERT INTO vn.workerAppTester(workerFk) VALUES(66); INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
@ -3829,6 +3820,9 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
VALUES VALUES
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442); ('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1; UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5; UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
@ -3937,11 +3931,6 @@ INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) (id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL); VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
VALUES(35, 1.00, 1.00, '2001-01-01');
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
VALUES (1,0.6,6);
INSERT INTO vn.payrollComponent INSERT INTO vn.payrollComponent
(id, name, isSalaryAgreed, isVariable, isException) (id, name, isSalaryAgreed, isVariable, isException)
VALUES VALUES
@ -3983,53 +3972,3 @@ VALUES
INSERT IGNORE INTO ormConfig INSERT IGNORE INTO ormConfig
SET id =1, SET id =1,
selectLimit = 1000; selectLimit = 1000;
INSERT INTO pbx.queueMultiConfig
SET id = 'ring',
strategy = 20,
timeout = 2,
retry = 0,
weight = 0,
maxLen = 0,
ringInUse = 0;
INSERT INTO pbx.queue (description, name, config)
VALUES ('X-men', '1000', 1),
('Avengers', '2000', 1);
INSERT IGNORE INTO pbx.queueMember
SET queue = '1000',
extension = '1010';
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
INSERT INTO vn.workerRelatives (workerFk, isDescendant, disabilityGradeFk, birthed, adoptionYear, isDependend, isJointCustody, updated)
VALUES
(1106, 1, NULL, 0, NULL, 0, 0, '2024-10-29 08:42:44.000');
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(2, 0, 0, 450, 13000, 1, 0, 1, '01A', 1, 1, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(3, 1400, 0, 450, 13000, 1, 0, 1, '01B', 1, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(4, 0, 500, 500, 13000, 1, 4, 1, '02A', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
(5, 1400, 500, 500, 13000, 1, 4, 1, '02B', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
(6, 0, 1000, 500, 13000, 1, 1, 1, '03A', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(7, 1400, 1000, 500, 13000, 1, 1, 1, '03B', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(8, 0, 1500, 500, 13000, 1, 0, 1, '04A', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(9, 1400, 1500, 500, 13000, 1, 1, 1, '04B', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL);
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
VALUES (19, '1169'),
(8, '1183');
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
VALUES ('saysimle-url-mock', 1320);
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
VALUES (1106,'26493101E','2019-09-20');

View File

@ -7,7 +7,8 @@ AS SELECT `u`.`id` AS `id`,
`u`.`email` AS `email`, `u`.`email` AS `email`,
`u`.`nickname` AS `nickname`, `u`.`nickname` AS `nickname`,
`u`.`lang` AS `lang`, `u`.`lang` AS `lang`,
`u`.`role` AS `role` `u`.`role` AS `role`,
`u`.`recoverPass` AS `recoverPass`
FROM `account`.`user` `u` FROM `account`.`user` `u`
WHERE `u`.`name` = `myUser_getName`() WHERE `u`.`name` = `myUser_getName`()
WITH CASCADED CHECK OPTION WITH CASCADED CHECK OPTION

View File

@ -6,27 +6,25 @@ BLOCK1: BEGIN
DECLARE vShipped DATE; DECLARE vShipped DATE;
DECLARE vPreviousShipped DATE; DECLARE vPreviousShipped DATE;
DECLARE vDone boolean; DECLARE vDone boolean;
DECLARE cur cursor for
DECLARE cur CURSOR FOR SELECT clientFk, firstShipped
SELECT clientFk, firstShipped FROM bs.clientNewBorn;
FROM bs.clientNewBorn;
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
SET vDone := FALSE; SET vDone := FALSE;
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE; DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped) INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
SELECT c.id, DATE(MAX(t.shipped)), DATE(MAX(t.shipped)) SELECT c.id, MAX(t.shipped), MAX(t.shipped)
FROM vn.client c FROM vn.client c
JOIN vn.ticket t ON t.clientFk = c.id JOIN vn.ticket t on t.clientFk = c.id
LEFT JOIN clientNewBorn cb ON cb.clientFk = c.id LEFT JOIN clientNewBorn cb on cb.clientFk = c.id
WHERE t.shipped BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null
AND util.VN_CURDATE() GROUP BY c.id;
AND cb.isModified IS NULL
GROUP BY c.id;
OPEN cur; OPEN cur;
LOOP1: LOOP LOOP1: LOOP
SET vDone := FALSE; SET vDone := FALSE;
FETCH cur INTO vClientFk, vShipped; FETCH cur INTO vClientFk, vShipped;

View File

@ -32,7 +32,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tVisible CREATE OR REPLACE TEMPORARY TABLE tVisible
SELECT itemFk, SUM(visible) totalVisible SELECT itemFk, SUM(visible) totalVisible
FROM vn.itemShelving ish FROM vn.itemShelving ish
JOIN vn.shelving sh ON sh.id = ish.shelvingFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk JOIN vn.sector sc ON sc.id = p.sectorFk
WHERE sc.warehouseFk = vWarehouseFk WHERE sc.warehouseFk = vWarehouseFk

View File

@ -1,22 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
vDateFrom DATE,
vDateTo DATE
)
BEGIN BEGIN
/** DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
* Recalcula las mermas de un periodo. DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
*
* @param vDateFrom Fecha desde
* @param vDateTo Fecha hasta
*/
IF vDateFrom IS NULL THEN
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
END IF;
IF vDateTo IS NULL THEN
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
END IF;
CALL cache.last_buy_refresh(FALSE); CALL cache.last_buy_refresh(FALSE);
@ -28,35 +14,19 @@ BEGIN
s.itemFk, s.itemFk,
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity), SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
SUM(IF(aw.`type`, s.quantity, 0)), SUM(IF(aw.`type`, s.quantity, 0)),
SUM(IF( SUM(
IF(
aw.`type` = 'internal',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(
IF(
aw.`type` = 'external', aw.`type` = 'external',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0 0
) )
),
SUM(IF(
aw.`type` = 'fault',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'container',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'break',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'other',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
) )
FROM vn.sale s FROM vn.sale s
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
@ -70,6 +40,6 @@ BEGIN
JOIN vn.buy b ON b.id = lb.buy_id JOIN vn.buy b ON b.id = lb.buy_id
WHERE t.shipped BETWEEN vDateFrom AND vDateTo WHERE t.shipped BETWEEN vDateFrom AND vDateTo
AND w.isManaged AND w.isManaged
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id; GROUP BY i.id;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,6 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
BEGIN
CALL waste_addSales(NULL, NULL);
END$$
DELIMITER ;

View File

@ -53,7 +53,7 @@ proc: BEGIN
WHERE t.landed BETWEEN vInventoryDate AND vStartDate WHERE t.landed BETWEEN vInventoryDate AND vStartDate
AND t.warehouseInFk = vWarehouse AND t.warehouseInFk = vWarehouse
AND s.name != 'INVENTARIO' AND s.name != 'INVENTARIO'
AND NOT t.isRaid AND NOT e.isRaid
GROUP BY b.itemFk GROUP BY b.itemFk
) c ) c
JOIN vn.item i ON i.id = c.itemFk JOIN vn.item i ON i.id = c.itemFk

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `edi`.`floramondo`
ON SCHEDULE EVERY 6 MINUTE
STARTS '2022-01-28 09:52:45.000'
ON COMPLETION NOT PRESERVE
DISABLE
DO CALL edi.floramondo_offerRefresh()$$
DELIMITER ;

View File

@ -0,0 +1,522 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`floramondo_offerRefresh`()
proc: BEGIN
DECLARE vLanded DATETIME;
DECLARE vDone INT DEFAULT FALSE;
DECLARE vFreeId INT;
DECLARE vSupplyResponseFk INT;
DECLARE vLastInserted DATETIME;
DECLARE vIsAuctionDay BOOLEAN;
DECLARE vMaxNewItems INT DEFAULT 10000;
DECLARE vStartingTime DATETIME;
DECLARE vAalsmeerMarketPlaceID VARCHAR(13) DEFAULT '8713783439043';
DECLARE vDayRange INT;
DECLARE cur1 CURSOR FOR
SELECT id
FROM edi.item_free;
DECLARE cur2 CURSOR FOR
SELECT srId
FROM itemToInsert;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLSTATE '45000'
BEGIN
ROLLBACK;
RESIGNAL;
END;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
SET @isTriggerDisabled = FALSE;
RESIGNAL;
END;
IF 'test' = (SELECT environment FROM util.config) THEN
LEAVE proc;
END IF;
IF !GET_LOCK('edi.floramondo_offerRefresh', 0) THEN
LEAVE proc;
END IF;
SELECT dayRange INTO vDayRange
FROM offerRefreshConfig;
IF vDayRange IS NULL THEN
CALL util.throw("Variable vDayRange not declared");
END IF;
SET vStartingTime = util.VN_NOW();
TRUNCATE edi.offerList;
INSERT INTO edi.offerList(supplier, total)
SELECT v.name, COUNT(DISTINCT sr.ID) total
FROM edi.supplyResponse sr
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
WHERE sr.NumberOfUnits > 0
AND sr.EmbalageCode != 999
GROUP BY sr.vmpID;
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(*) total
FROM edi.supplyOffer sr
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.`filter` = sub.total;
-- Elimina de la lista de items libres aquellos que ya existen
DELETE itf.*
FROM edi.item_free itf
JOIN vn.item i ON i.id = itf.id;
CREATE OR REPLACE TEMPORARY TABLE tmp
(INDEX (`Item_ArticleCode`))
ENGINE = MEMORY
SELECT t.*
FROM (
SELECT *
FROM edi.supplyOffer
ORDER BY (MarketPlaceID = vAalsmeerMarketPlaceID) DESC,
NumberOfUnits DESC LIMIT 10000000000000000000) t
GROUP BY t.srId;
CREATE OR REPLACE TEMPORARY TABLE edi.offer (INDEX (`srID`), INDEX (`EmbalageCode`),
INDEX (`ef1`), INDEX (`ef2`), INDEX (`ef3`), INDEX (`ef4`),INDEX (`ef5`), INDEX (`ef6`),
INDEX (`s1Value`), INDEX (`s2Value`), INDEX (`s3Value`), INDEX (`s4Value`),INDEX (`s5Value`), INDEX (`s6Value`))
ENGINE = MEMORY
SELECT so.*,
ev1.type_description s1Value,
ev2.type_description s2Value,
ev3.type_description s3Value,
ev4.type_description s4Value,
ev5.type_description s5Value,
ev6.type_description s6Value,
eif1.feature ef1,
eif2.feature ef2,
eif3.feature ef3,
eif4.feature ef4,
eif5.feature ef5,
eif6.feature ef6
FROM tmp so
LEFT JOIN edi.item_feature eif1 ON eif1.item_id = so.Item_ArticleCode
AND eif1.presentation_order = 1
AND eif1.expiry_date IS NULL
LEFT JOIN edi.item_feature eif2 ON eif2.item_id = so.Item_ArticleCode
AND eif2.presentation_order = 2
AND eif2.expiry_date IS NULL
LEFT JOIN edi.item_feature eif3 ON eif3.item_id = so.Item_ArticleCode
AND eif3.presentation_order = 3
AND eif3.expiry_date IS NULL
LEFT JOIN edi.item_feature eif4 ON eif4.item_id = so.Item_ArticleCode
AND eif4.presentation_order = 4
AND eif4.expiry_date IS NULL
LEFT JOIN edi.item_feature eif5 ON eif5.item_id = so.Item_ArticleCode
AND eif5.presentation_order = 5
AND eif5.expiry_date IS NULL
LEFT JOIN edi.item_feature eif6 ON eif6.item_id = so.Item_ArticleCode
AND eif6.presentation_order = 6
AND eif6.expiry_date IS NULL
LEFT JOIN edi.`value` ev1 ON ev1.type_id = eif1.feature
AND so.s1 = ev1.type_value
LEFT JOIN edi.`value` ev2 ON ev2.type_id = eif2.feature
AND so.s2 = ev2.type_value
LEFT JOIN edi.`value` ev3 ON ev3.type_id = eif3.feature
AND so.s3 = ev3.type_value
LEFT JOIN edi.`value` ev4 ON ev4.type_id = eif4.feature
AND so.s4 = ev4.type_value
LEFT JOIN edi.`value` ev5 ON ev5.type_id = eif5.feature
AND so.s5 = ev5.type_value
LEFT JOIN edi.`value` ev6 ON ev6.type_id = eif6.feature
AND so.s6 = ev6.type_value
ORDER BY Price;
DROP TEMPORARY TABLE tmp;
DELETE o
FROM edi.offer o
LEFT JOIN vn.tag t1 ON t1.ediTypeFk = o.ef1 AND t1.overwrite = 'size'
LEFT JOIN vn.tag t2 ON t2.ediTypeFk = o.ef2 AND t2.overwrite = 'size'
LEFT JOIN vn.tag t3 ON t3.ediTypeFk = o.ef3 AND t3.overwrite = 'size'
LEFT JOIN vn.tag t4 ON t4.ediTypeFk = o.ef4 AND t4.overwrite = 'size'
LEFT JOIN vn.tag t5 ON t5.ediTypeFk = o.ef5 AND t5.overwrite = 'size'
LEFT JOIN vn.tag t6 ON t6.ediTypeFk = o.ef6 AND t6.overwrite = 'size'
JOIN vn.floramondoConfig fc ON TRUE
WHERE (t1.id IS NOT NULL AND CONVERT(s1Value, UNSIGNED) > fc.itemMaxSize)
OR (t2.id IS NOT NULL AND CONVERT(s2Value, UNSIGNED) > fc.itemMaxSize)
OR (t3.id IS NOT NULL AND CONVERT(s3Value, UNSIGNED) > fc.itemMaxSize)
OR (t4.id IS NOT NULL AND CONVERT(s4Value, UNSIGNED) > fc.itemMaxSize)
OR (t5.id IS NOT NULL AND CONVERT(s5Value, UNSIGNED) > fc.itemMaxSize)
OR (t6.id IS NOT NULL AND CONVERT(s6Value, UNSIGNED) > fc.itemMaxSize);
START TRANSACTION;
-- Actualizamos el campo supplyResponseFk para aquellos articulos que ya estan creados y reutilizamos
UPDATE IGNORE edi.offer o
JOIN vn.item i
ON i.name = o.product_name
AND i.subname <=> o.company_name
AND i.value5 <=> o.s1Value
AND i.value6 <=> o.s2Value
AND i.value7 <=> o.s3Value
AND i.value8 <=> o.s4Value
AND i.value9 <=> o.s5Value
AND i.value10 <=> o.s6Value
AND i.NumberOfItemsPerCask <=> o.NumberOfItemsPerCask
AND i.EmbalageCode <=> o.EmbalageCode
AND i.quality <=> o.Quality
JOIN vn.itemType it ON it.id = i.typeFk
LEFT JOIN vn.sale s ON s.itemFk = i.id
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
AND t.shipped > (util.VN_CURDATE() - INTERVAL 1 WEEK)
LEFT JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
LEFT JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
LEFT JOIN edi.putOrder po ON po.supplyResponseID = i.supplyResponseFk
AND po.OrderTradeLineDateTime > (util.VN_CURDATE() - INTERVAL 1 WEEK)
SET i.supplyResponseFk = o.srID
WHERE (sr.ID IS NULL
OR sr.NumberOfUnits = 0
OR di.LatestOrderDateTime < util.VN_NOW()
OR di.ID IS NULL)
AND it.isInventory
AND t.id IS NULL
AND po.id IS NULL;
CREATE OR REPLACE TEMPORARY TABLE itemToInsert
ENGINE = MEMORY
SELECT o.*, CAST(NULL AS DECIMAL(6,0)) itemFk
FROM edi.offer o
LEFT JOIN vn.item i ON i.supplyResponseFk = o.srId
WHERE i.id IS NULL
LIMIT vMaxNewItems;
-- Reciclado de nº de item
OPEN cur1;
OPEN cur2;
read_loop: LOOP
FETCH cur2 INTO vSupplyResponseFk;
FETCH cur1 INTO vFreeId;
IF vDone THEN
LEAVE read_loop;
END IF;
UPDATE itemToInsert
SET itemFk = vFreeId
WHERE srId = vSupplyResponseFk;
END LOOP;
CLOSE cur1;
CLOSE cur2;
-- Insertamos todos los items en Articles de la oferta
INSERT INTO vn.item(id,
`name`,
longName,
subName,
expenseFk,
typeFk,
intrastatFk,
originFk,
supplyResponseFk,
numberOfItemsPerCask,
embalageCode,
quality,
isFloramondo)
SELECT iti.itemFk,
iti.product_name,
iti.product_name,
iti.company_name,
iti.expenseFk,
iti.itemTypeFk,
iti.intrastatFk,
iti.originFk,
iti.`srId`,
iti.NumberOfItemsPerCask,
iti.EmbalageCode,
iti.Quality,
TRUE
FROM itemToInsert iti;
-- Inserta la foto de los articulos nuevos (prioridad alta)
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url)
SELECT i.id, PictureReference
FROM itemToInsert ii
JOIN vn.item i ON i.supplyResponseFk = ii.srId
WHERE PictureReference IS NOT NULL
AND i.image IS NULL;
INSERT INTO edi.`log`(tableName, fieldName,fieldValue)
SELECT 'itemImageQueue','NumImagenesPtes', COUNT(*)
FROM vn.itemImageQueue
WHERE attempts = 0;
-- Inserta si se añadiesen tags nuevos
INSERT IGNORE INTO vn.tag (name, ediTypeFk)
SELECT description, type_id FROM edi.type;
-- Desabilita el trigger para recalcular los tags al final
SET @isTriggerDisabled = TRUE;
-- Inserta los tags sólo en los articulos nuevos
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.product_name, 1
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Producto'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.product_name IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.Quality, 3
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Calidad'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.Quality IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , ii.company_name, 4
FROM itemToInsert ii
JOIN vn.tag t ON t.`name` = 'Productor'
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT ii.company_name IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s1Value, 5
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef1
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s1Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s2Value, 6
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef2
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s2Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s3Value, 7
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef3
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s3Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s4Value, 8
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef4
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s4Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s5Value, 9
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef5
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s5Value IS NULL;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id , s6Value, 10
FROM itemToInsert ii
JOIN vn.tag t ON t.ediTypeFk = ii.ef6
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
WHERE NOT s6Value IS NULL;
INSERT IGNORE INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT i.id, t.id, IFNULL(ink.name, ik.color), 11
FROM itemToInsert ii
JOIN vn.item i ON i.supplyResponseFk = ii.`srId`
JOIN vn.tag t ON t.`name` = 'Color'
LEFT JOIN edi.feature f ON f.item_id = ii.Item_ArticleCode
LEFT JOIN edi.`type` tp ON tp.type_id = f.feature_type_id
AND tp.`description` = 'Hoofdkleur 1'
LEFT JOIN vn.ink ON ink.dutchCode = f.feature_value
LEFT JOIN vn.itemInk ik ON ik.longName = i.longName
WHERE ink.name IS NOT NULL
OR ik.color IS NOT NULL;
CREATE OR REPLACE TABLE tmp.item
(PRIMARY KEY (id))
SELECT i.id FROM vn.item i
JOIN itemToInsert ii ON i.supplyResponseFk = ii.`srId`;
CALL vn.item_refreshTags();
DROP TABLE tmp.item;
SELECT MIN(LatestDeliveryDateTime) INTO vLanded
FROM edi.supplyResponse sr
JOIN edi.deliveryInformation di ON di.supplyResponseID = sr.ID
JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
JOIN vn.floramondoConfig fc
WHERE mp.isLatestOrderDateTimeRelevant
AND di.LatestOrderDateTime > IF(
fc.MaxLatestOrderHour > HOUR(util.VN_NOW()),
util.VN_CURDATE(),
util.VN_CURDATE() + INTERVAL 1 DAY);
UPDATE vn.floramondoConfig
SET nextLanded = vLanded
WHERE vLanded IS NOT NULL;
-- Elimina la oferta obsoleta
UPDATE vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
LEFT JOIN edi.deliveryInformation di ON di.ID = b.deliveryFk
SET b.quantity = 0
WHERE (IFNULL(di.LatestOrderDateTime,util.VN_NOW()) <= util.VN_NOW()
OR i.supplyResponseFk IS NULL
OR sr.NumberOfUnits = 0)
AND am.name = 'LOGIFLORA'
AND e.isRaid;
-- Localiza las entradas de cada almacen
UPDATE edi.warehouseFloramondo
SET entryFk = vn.entry_getForLogiflora(vLanded + INTERVAL travellingDays DAY, warehouseFk);
IF vLanded IS NOT NULL THEN
-- Actualiza la oferta existente
UPDATE vn.buy b
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.offer o ON i.supplyResponseFk = o.`srId`
SET b.quantity = o.NumberOfUnits * o.NumberOfItemsPerCask,
b.buyingValue = o.price
WHERE (b.quantity <> o.NumberOfUnits * o.NumberOfItemsPerCask
OR b.buyingValue <> o.price);
-- Inserta el resto
SET vLastInserted := util.VN_NOW();
-- Inserta la oferta
INSERT INTO vn.buy (
entryFk,
itemFk,
quantity,
buyingValue,
stickers,
packing,
`grouping`,
groupingMode,
packagingFk,
deliveryFk)
SELECT wf.entryFk,
i.id,
o.NumberOfUnits * o.NumberOfItemsPerCask quantity,
o.Price,
o.NumberOfUnits etiquetas,
o.NumberOfItemsPerCask packing,
GREATEST(1, IFNULL(o.MinimumQuantity,0)) * o.NumberOfItemsPerCask `grouping`,
'packing',
o.embalageCode,
o.diId
FROM edi.offer o
JOIN vn.item i ON i.supplyResponseFk = o.srId
JOIN edi.warehouseFloramondo wf
JOIN vn.packaging p ON p.id
LIKE o.embalageCode
LEFT JOIN vn.buy b ON b.itemFk = i.id
AND b.entryFk = wf.entryFk
WHERE b.id IS NULL; -- Quitar esta linea y mirar de crear los packages a tiempo REAL
INSERT INTO vn.itemCost(
itemFk,
warehouseFk,
cm3,
cm3delivery)
SELECT b.itemFk,
wf.warehouseFk,
@cm3 := vn.buy_getUnitVolume(b.id),
IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3)
FROM warehouseFloramondo wf
JOIN vn.volumeConfig vc
JOIN vn.buy b ON b.entryFk = wf.entryFk
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.itemCost ic ON ic.itemFk = b.itemFk
AND ic.warehouseFk = wf.warehouseFk
WHERE (ic.cm3 IS NULL OR ic.cm3 = 0)
ON DUPLICATE KEY UPDATE cm3 = @cm3, cm3delivery = IFNULL((vc.standardFlowerBox * 1000) / i.packingOut, @cm3);
CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc
SELECT b.id
FROM vn.buy b
JOIN warehouseFloramondo wf ON wf.entryFk = b.entryFk
WHERE b.created >= vLastInserted;
CALL vn.buy_recalcPrices();
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.warehouse w ON w.id = wf.warehouseFk
WHERE w.name = 'VNH'
AND b.quantity > 0
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.vnh = sub.total;
UPDATE edi.offerList o
JOIN (SELECT v.name, COUNT(DISTINCT b.itemFk) total
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
JOIN edi.warehouseFloramondo wf ON wf.entryFk = b.entryFk
JOIN vn.warehouse w ON w.id = wf.warehouseFk
WHERE w.name = 'ALGEMESI'
AND b.quantity > 0
GROUP BY sr.vmpID) sub ON o.supplier = sub.name
SET o.algemesi = sub.total;
END IF;
DROP TEMPORARY TABLE
edi.offer,
itemToInsert;
SET @isTriggerDisabled = FALSE;
COMMIT;
-- Esto habria que pasarlo a procesos programados o trabajar con tags y dejar las familias
UPDATE vn.item i
SET typeFk = 121
WHERE i.longName LIKE 'Rosa Garden %'
AND typeFk = 17;
UPDATE vn.item i
SET typeFk = 156
WHERE i.longName LIKE 'Rosa ec %'
AND typeFk = 17;
-- Refresca las fotos de los items existentes que mostramos (prioridad baja)
INSERT IGNORE INTO vn.itemImageQueue(itemFk, url, priority)
SELECT i.id, sr.PictureReference, 100
FROM edi.supplyResponse sr
JOIN vn.item i ON i.supplyResponseFk = sr.ID
JOIN edi.supplyOffer so ON so.srId = sr.ID
JOIN hedera.image i2 ON i2.name = i.image
AND i2.collectionFk = 'catalog'
WHERE i2.updated <= (UNIX_TIMESTAMP(util.VN_NOW()) - vDayRange)
AND sr.NumberOfUnits;
INSERT INTO edi.`log`
SET tableName = 'floramondo_offerRefresh',
fieldName = 'Tiempo de proceso',
fieldValue = TIMEDIFF(util.VN_NOW(), vStartingTime);
DO RELEASE_LOCK('edi.floramondo_offerRefresh');
END$$
DELIMITER ;

View File

@ -14,7 +14,7 @@ BEGIN
b.stickers = NEW.NumberOfUnits b.stickers = NEW.NumberOfUnits
WHERE i.supplyResponseFk = NEW.ID WHERE i.supplyResponseFk = NEW.ID
AND am.name = 'LOGIFLORA' AND am.name = 'LOGIFLORA'
AND tr.isRaid AND e.isRaid
AND tr.landed >= util.VN_CURDATE(); AND tr.landed >= util.VN_CURDATE();
END$$ END$$

View File

@ -59,7 +59,7 @@ BEGIN
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDateInv AND vDate WHERE t.landed BETWEEN vDateInv AND vDate
AND t.warehouseInFk = vWarehouse AND t.warehouseInFk = vWarehouse
AND NOT t.isRaid AND NOT e.isRaid
UNION ALL UNION ALL
SELECT b.itemFk, -b.quantity SELECT b.itemFk, -b.quantity
FROM vn.buy b FROM vn.buy b
@ -67,7 +67,7 @@ BEGIN
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
AND t.warehouseOutFk = vWarehouse AND t.warehouseOutFk = vWarehouse
AND NOT t.isRaid AND NOT e.isRaid
AND t.isDelivered AND t.isDelivered
UNION ALL UNION ALL
SELECT m.itemFk, -m.quantity SELECT m.itemFk, -m.quantity

View File

@ -1,52 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost`
PROCEDURE `hedera`.`orderRow_updateOverstocking`(vOrderFk INT)
BEGIN
/**
* Set amount = 0 to avoid overbooking sales
*
* @param vOrderFk hedera.order.id
*/
DECLARE vCalcFk INT;
DECLARE vDone BOOL;
DECLARE vWarehouseFk INT;
DECLARE cWarehouses CURSOR FOR
SELECT DISTINCT warehouseFk
FROM orderRow
WHERE orderFk = vOrderFk
AND shipment = util.VN_CURDATE();
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
OPEN cWarehouses;
checking: LOOP
SET vDone = FALSE;
FETCH cWarehouses INTO vWarehouseFk;
IF vDone THEN
LEAVE checking;
END IF;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, util.VN_CURDATE());
UPDATE orderRow r
JOIN `order` o ON o.id = r.orderFk
JOIN orderConfig oc
JOIN cache.available a ON a.calc_id = vCalcFk AND a.item_id = r.itemFk
SET r.amount = 0
WHERE ADDTIME(o.rowUpdated, oc.reserveTime) < util.VN_NOW()
AND a.available <= 0
AND r.warehouseFk = vWarehouseFk
AND r.orderFk = vOrderFk;
END LOOP;
CLOSE cWarehouses;
END$$
DELIMITER ;

View File

@ -12,7 +12,6 @@ BEGIN
* @param vUser The user identifier * @param vUser The user identifier
*/ */
DECLARE vHasRows BOOL; DECLARE vHasRows BOOL;
DECLARE vHas0Amount BOOL;
DECLARE vDone BOOL; DECLARE vDone BOOL;
DECLARE vWarehouseFk INT; DECLARE vWarehouseFk INT;
DECLARE vShipment DATE; DECLARE vShipment DATE;
@ -22,6 +21,7 @@ BEGIN
DECLARE vItemFk INT; DECLARE vItemFk INT;
DECLARE vConcept VARCHAR(30); DECLARE vConcept VARCHAR(30);
DECLARE vAmount INT; DECLARE vAmount INT;
DECLARE vAvailable INT;
DECLARE vPrice DECIMAL(10,2); DECLARE vPrice DECIMAL(10,2);
DECLARE vSaleFk INT; DECLARE vSaleFk INT;
DECLARE vRowFk INT; DECLARE vRowFk INT;
@ -31,6 +31,7 @@ BEGIN
DECLARE vClientFk INT; DECLARE vClientFk INT;
DECLARE vCompanyFk INT; DECLARE vCompanyFk INT;
DECLARE vAgencyModeFk INT; DECLARE vAgencyModeFk INT;
DECLARE vCalcFk INT;
DECLARE vIsTaxDataChecked BOOL; DECLARE vIsTaxDataChecked BOOL;
DECLARE vDates CURSOR FOR DECLARE vDates CURSOR FOR
@ -96,20 +97,6 @@ BEGIN
SELECT employeeFk INTO vUserFk FROM orderConfig; SELECT employeeFk INTO vUserFk FROM orderConfig;
END IF; END IF;
CALL orderRow_updateOverstocking(vSelf);
-- Check if any product has a quantity of 0
SELECT EXISTS (
SELECT id
FROM orderRow
WHERE orderFk = vSelf
AND amount = 0
) INTO vHas0Amount;
IF vHas0Amount THEN
CALL util.throw('Hay líneas vacías. Por favor, elimínelas');
END IF;
START TRANSACTION; START TRANSACTION;
CALL order_checkEditable(vSelf); CALL order_checkEditable(vSelf);

View File

@ -9,54 +9,45 @@ BEGIN
* @param vOrder El identificador del pedido * @param vOrder El identificador del pedido
* @return tmp.orderTax Bases imponibles, IVA y recargo de equivalencia * @return tmp.orderTax Bases imponibles, IVA y recargo de equivalencia
*/ */
-- No poner create or replace, ya que da problemas
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
CREATE TEMPORARY TABLE tmp.addressCompany CREATE TEMPORARY TABLE tmp.addressCompany
(INDEX (addressFk, companyFk)) (INDEX (addressFk, companyFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT DISTINCT o.address_id addressFk, o.company_id companyFk SELECT DISTINCT o.address_id addressFk, o.company_id companyFk
FROM tmp.`order` tmpOrder FROM tmp.`order` tmpOrder
JOIN `order` o ON o.id = tmpOrder.orderFk; JOIN hedera.`order` o ON o.id = tmpOrder.orderFk;
CALL vn.addressTaxArea(); CALL vn.addressTaxArea;
-- Calcula el IVA y el recargo desglosado. -- Calcula el IVA y el recargo desglosado.
CREATE OR REPLACE TEMPORARY TABLE tmp.orderTax
(PRIMARY KEY (orderFk, code, rate))
ENGINE = MEMORY
WITH orders AS (
SELECT tor.orderFk,
oro.amount * oro.price total,
s.countryFk,
ata.areaFk,
itc.taxClassFk
FROM hedera.orderRow oro
JOIN tmp.order tor ON tor.orderFk = oro.orderFk
JOIN hedera.`order` o ON o.id = tor.orderFk
JOIN vn.item i ON i.id = oro.itemFk
JOIN vn.`client` c ON c.id = o.customer_id
JOIN vn.supplier s ON s.id = o.company_id
JOIN tmp.addressTaxArea ata ON ata.addressFk = o.address_id
AND ata.companyFk = o.company_id
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
AND itc.countryFk = s.countryFk
HAVING total
)
SELECT o.orderFk,
tc.code,
SUM(o.total) taxableBase,
pgc.rate
FROM orders o
JOIN vn.bookingPlanner bp ON bp.countryFk = o.countryFk
AND bp.taxAreaFk = o.areaFk
AND bp.taxClassFk = o.taxClassFk
JOIN vn.pgc ON pgc.code = bp.pgcFk
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
GROUP BY o.orderFk, pgc.code, pgc.rate
HAVING taxableBase
ORDER BY bp.priority;
-- No poner create or replace, ya que da problemas DROP TEMPORARY TABLE IF EXISTS tmp.orderTax;
CREATE TEMPORARY TABLE tmp.orderTax
(INDEX (orderFk))
ENGINE = MEMORY
SELECT o.id orderFk,
tc.code,
SUM(m.amount * m.price) taxableBase,
pgc.rate
FROM tmp.`order` tmpOrder
JOIN `order` o ON o.id = tmpOrder.orderFk
JOIN orderRow m ON m.orderFk = o.id
JOIN vn.item i ON i.id = m.itemFk
JOIN vn.`client` c ON c.id = o.customer_id
JOIN vn.supplier s ON s.id = o.company_id
JOIN tmp.addressTaxArea ata
ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id
JOIN vn.itemTaxCountry itc
ON itc.itemFk = i.id AND itc.countryFk = s.countryFk
JOIN vn.bookingPlanner bp
ON bp.countryFk = s.countryFk
AND bp.taxAreaFk = ata.areaFk
AND bp.taxClassFk = itc.taxClassFk
JOIN vn.pgc ON pgc.`code` = bp.pgcFk
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate
HAVING taxableBase != 0;
DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount; DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount;
CREATE TEMPORARY TABLE tmp.orderAmount CREATE TEMPORARY TABLE tmp.orderAmount
(INDEX (orderFk)) (INDEX (orderFk))

View File

@ -1,10 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterInsert`
AFTER INSERT ON `orderRow`
FOR EACH ROW
BEGIN
UPDATE `order`
SET rowUpdated = util.VN_NOW()
WHERE id = NEW.orderFk;
END$$
DELIMITER ;

View File

@ -26,7 +26,7 @@ BEGIN
DECLARE vCursor CURSOR FOR DECLARE vCursor CURSOR FOR
SELECT it.taxableBase, SELECT it.taxableBase,
CAST(SUM((( it.taxableBase / 100) * t.PorcentajeIva)) AS DECIMAL (10,2)), CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)),
t.PorcentajeIva, t.PorcentajeIva,
it.transactionTypeSageFk, it.transactionTypeSageFk,
it.taxTypeSageFk, it.taxTypeSageFk,
@ -39,8 +39,7 @@ BEGIN
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
WHERE i.id = vInvoiceInFk WHERE i.id = vInvoiceInFk
AND d.id IS NULL AND d.id IS NULL;
GROUP BY it.taxTypeSageFk;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;

View File

@ -4,8 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NEW.`property` = '*' THEN
CALL util.throw('The property field cannot be *');
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -6,11 +6,12 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tValues; DROP TEMPORARY TABLE IF EXISTS tValues;
CREATE TEMPORARY TABLE tValues CREATE TEMPORARY TABLE tValues
ENGINE = MEMORY ENGINE = MEMORY
SELECT b.id buyFk, SELECT
b.id buyFk,
e.id entryFk, e.id entryFk,
t.id travelFk, t.id travelFk,
b.itemFk, b.itemFk,
t.isRaid, e.isRaid,
ADDTIME(t.shipped, ADDTIME(t.shipped,
IFNULL(t.shipmentHour, '00:00:00')) shipped, IFNULL(t.shipmentHour, '00:00:00')) shipped,
t.warehouseOutFk, t.warehouseOutFk,
@ -49,7 +50,7 @@ BEGIN
itemFk, itemFk,
TIMESTAMPADD(DAY, life, @dated), TIMESTAMPADD(DAY, life, @dated),
quantity, quantity,
IF(isIn, isReceived, isDelivered) AND NOT isRaid IF(isIn, isReceived, isDelivered) AND !isRaid
FROM tValues FROM tValues
WHERE isIn OR !lessThanInventory; WHERE isIn OR !lessThanInventory;
@ -64,7 +65,7 @@ BEGIN
itemFk, itemFk,
created, created,
quantity, quantity,
IF(isIn, isDelivered, isReceived) AND NOT isRaid IF(isIn, isDelivered, isReceived) AND !isRaid
FROM tValues FROM tValues
WHERE !isIn OR !lessThanInventory; WHERE !isIn OR !lessThanInventory;

View File

@ -1,8 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `util`.`log_clean`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-09 00:30:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL util.log_clean$$
DELIMITER ;

View File

@ -1,54 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`log_clean`()
BEGIN
/**
* Hace limpieza de los datos de las tablas log,
* dejando únicamente los días de retención configurados.
*/
DECLARE vSchemaName VARCHAR(65);
DECLARE vSchemaNameQuoted VARCHAR(65);
DECLARE vTableName VARCHAR(65);
DECLARE vTableNameQuoted VARCHAR(65);
DECLARE vRetentionDays INT;
DECLARE vStarted DATETIME;
DECLARE vDated DATE;
DECLARE vDone BOOL;
DECLARE vQueue CURSOR FOR
SELECT schemaName, tableName, retentionDays
FROM logCleanMultiConfig
ORDER BY `order`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vQueue;
l: LOOP
SET vDone = FALSE;
FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
IF vDone THEN
LEAVE l;
END IF;
IF vRetentionDays THEN
SET vStarted = VN_NOW();
SET vSchemaNameQuoted = quoteIdentifier(vSchemaName);
SET vTableNameQuoted = quoteIdentifier(vTableName);
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
EXECUTE IMMEDIATE CONCAT(
'DELETE FROM ', vSchemaNameQuoted,
'.', vTableNameQuoted,
" WHERE creationDate < '", vDated, "'"
);
UPDATE logCleanMultiConfig
SET `started` = vStarted,
`finished` = VN_NOW()
WHERE schemaName = vSchemaName
AND tableName = vTableName;
END IF;
END LOOP;
CLOSE vQueue;
END$$
DELIMITER ;

View File

@ -1,8 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`itemCampaig_add`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-10-18 03:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL itemCampaign_add()$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`raidUpdate`
ON SCHEDULE EVERY 1 DAY
STARTS '2017-12-29 00:05:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL raidUpdate$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`travel_setDelivered` CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
ON SCHEDULE EVERY 1 DAY ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-12 00:10:00.000' STARTS '2024-07-12 00:10:00.000'
ON COMPLETION PRESERVE ON COMPLETION PRESERVE

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`MIDNIGHT`(vDate DATE)
RETURNS datetime
DETERMINISTIC
BEGIN
RETURN TIMESTAMP(vDate,'23:59:59');
END$$
DELIMITER ;

View File

@ -14,12 +14,9 @@ BEGIN
SELECT p.geoFk INTO vGeoFk SELECT p.geoFk INTO vGeoFk
FROM address a FROM address a
JOIN town t ON t.provinceFk = a.provinceFk JOIN town t ON t.provinceFk = a.provinceFk
JOIN postCode p ON p.townFk = t.id JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode
AND (p.code = a.postalCode OR a.postalCode IS NULL)
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE a.id = vSelf WHERE a.id = vSelf
ORDER BY (a.city SOUNDS LIKE t.name) DESC, ORDER BY (a.city SOUNDS LIKE t.`name`) DESC
(p.code = a.postalCode) DESC
LIMIT 1; LIMIT 1;
RETURN vGeoFk; RETURN vGeoFk;

View File

@ -1,31 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
vItemFk INT,
vWarehouseFk INT,
vDated DATE
)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Calcula las últimas compras realizadas hasta una fecha.
*
* @param vItemFk Id del artículo
* @param vWarehouseFk Id del almacén
* @param vDated Compras hasta fecha
* @return Id de compra
*/
DECLARE vBuyFk INT;
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
SELECT buyFk INTO vBuyFk
FROM tmp.buyUltimate;
DROP TEMPORARY TABLE IF EXISTS
tmp.buyUltimate,
tmp.buyUltimateFromInterval;
RETURN vBuyFk;
END$$
DELIMITER ;

View File

@ -1,27 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getGeo`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Returns the geo for the passed client.
*
* @param vSelf The address id
* @return The geo id
*/
DECLARE vGeoFk INT;
SELECT p.geoFk INTO vGeoFk
FROM client c
JOIN town t ON t.provinceFk = c.provinceFk
JOIN postCode p ON p.townFk = t.id
AND (p.code = c.postcode OR c.postcode IS NULL)
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE c.id = vSelf
ORDER BY (c.city SOUNDS LIKE t.name) DESC,
(p.code = c.postcode) DESC
LIMIT 1;
RETURN vGeoFk;
END$$
DELIMITER ;

View File

@ -1,22 +1,48 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT, CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT,
vCurrencyFk INT, vCurrencyFk INT,
vSupplierFk INT vSupplierFk INT
) )
RETURNS int(11) RETURNS int(11)
NOT DETERMINISTIC NOT DETERMINISTIC
READS SQL DATA READS SQL DATA
BEGIN BEGIN
DECLARE vCommission INT; DECLARE vCommission INT;
DECLARE vCurrentCommission INT; DECLARE vCurrentCommission INT;
DECLARE vIsNotEUR INT; DECLARE vIsCurrencyUsd INT;
DECLARE vLastEntryFk INT; DECLARE vLastEntryFk INT;
SELECT count(*) INTO vIsNotEUR SELECT count(*) INTO vIsCurrencyUsd
FROM currency c FROM currency c
WHERE c.code <> 'EUR' AND id = vCurrencyFk; WHERE c.code = 'USD' AND id = vCurrencyFk;
IF NOT vIsCurrencyUsd THEN
SELECT e.id INTO vLastEntryFk
FROM vn.entry e
JOIN vn.travel tr ON tr.id = e.travelFk
WHERE e.supplierFk = vSupplierFk
ORDER BY tr.landed DESC
LIMIT 1;
IF vLastEntryFk THEN
SELECT commission INTO vCurrentCommission
FROM vn.entry
WHERE id = vLastEntryFk;
ELSE
SELECT commission INTO vCurrentCommission
FROM supplier s
WHERE s.id = vSupplierFk;
END IF;
RETURN vCurrentCommission;
ELSE
IF vIsNotEUR THEN
SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission
FROM travel t FROM travel t
LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped
@ -25,27 +51,8 @@ BEGIN
LIMIT 1; LIMIT 1;
RETURN IFNULL(vCommission, 0); RETURN IFNULL(vCommission, 0);
ELSE
SELECT e.id INTO vLastEntryFk
FROM `entry` e
JOIN travel tr ON tr.id = e.travelFk
WHERE e.supplierFk = vSupplierFk
ORDER BY tr.landed DESC
LIMIT 1;
IF vLastEntryFk THEN END IF;
SELECT commission INTO vCurrentCommission
FROM `entry`
WHERE id = vLastEntryFk;
ELSE
SELECT commission INTO vCurrentCommission
FROM supplier s
WHERE s.id = vSupplierFk;
END IF;
RETURN vCurrentCommission;
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,64 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Devuelve una entrada para Logiflora. Si no existe la crea.
*
* @param vLanded Fecha de llegada al almacén
* @param vWarehouseFk Identificador de vn.warehouse
*/
DECLARE vTravelFk INT;
DECLARE vEntryFk INT;
DECLARE previousEntryFk INT;
SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk);
IF vLanded THEN
SELECT IFNULL(MAX(id),0) INTO vEntryFk
FROM vn.entry
WHERE travelFk = vTravelFk
AND isRaid;
IF NOT vEntryFk THEN
INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid)
SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE
FROM vn.supplier s
JOIN vn.company c ON c.code = 'VNL'
JOIN vn.currency cu ON cu.code = 'EUR'
WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN';
SELECT MAX(id) INTO vEntryFk
FROM vn.entry
WHERE travelFk = vTravelFk;
END IF;
END IF;
SELECT entryFk INTO previousEntryFk
FROM edi.warehouseFloramondo wf
WHERE wf.warehouseFk = vWarehouseFk;
IF IFNULL(previousEntryFk,0) != vEntryFk THEN
UPDATE buy b
SET b.printedStickers = 0
WHERE entryFk = previousEntryFk;
DELETE FROM buy WHERE entryFk = previousEntryFk;
DELETE FROM entry WHERE id = previousEntryFk;
END IF;
RETURN vEntryFk;
END$$
DELIMITER ;

View File

@ -9,7 +9,7 @@ BEGIN
SELECT count(*) INTO vItemCount SELECT count(*) INTO vItemCount
FROM vn.sale s FROM vn.sale s
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
JOIN vn.shelving sh ON sh.id = ish.shelvingFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
WHERE s.ticketFk = vTicketFk WHERE s.ticketFk = vTicketFk
AND p.sectorFk = vSectorFk; AND p.sectorFk = vSectorFk;

View File

@ -10,7 +10,7 @@ BEGIN
SELECT count(*) INTO vItemCount SELECT count(*) INTO vItemCount
FROM vn.sale s FROM vn.sale s
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
JOIN vn.shelving sh ON sh.id = ish.shelvingFk JOIN vn.shelving sh ON sh.code = ish.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.parking p ON p.id = sh.parkingFk
WHERE s.ticketFk = vTicketFk WHERE s.ticketFk = vTicketFk
AND p.sectorFk = vSectorFk; AND p.sectorFk = vSectorFk;

View File

@ -0,0 +1,30 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`routeProposal_`(vTicketFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE vRouteFk INT;
DECLARE vAddressFk INT;
DECLARE vShipped DATETIME;
SELECT addressFk, date(shipped) INTO vAddressFk, vShipped
FROM vn.ticket
WHERE id = vTicketFk;
SELECT routeFk INTO vRouteFk
FROM
(SELECT t.routeFk, sum(af.friendship) friendshipSum
FROM vn.ticket t
JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk
WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped)
AND t.routeFk
GROUP BY routeFk
ORDER BY friendshipSum DESC
) sub
LIMIT 1;
RETURN vRouteFk;
END$$
DELIMITER ;

View File

@ -1,29 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`supplier_getGeo`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Returns the geo for the passed supplier.
*
* @param vSelf The address id
* @return The geo id
*/
DECLARE vGeoFk INT;
SELECT p.geoFk INTO vGeoFk
FROM supplier s
JOIN town t ON t.provinceFk = s.provinceFk
JOIN postCode p ON p.townFk = t.id
AND (p.code = s.postCode OR s.postCode IS NULL)
LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE s.id = vSelf
ORDER BY (s.city SOUNDS LIKE t.name) DESC,
(p.code = s.postCode) DESC,
(p.code = sad.postalCode) DESC
LIMIT 1;
RETURN vGeoFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,65 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Verifica la dirección de la fichada
* @param vUserFk Identificador del trabajador
* @param vTimed Hora de la fichada
* @return Retorna sentido de la fichada 'in, out, middle'
*/
DECLARE vPrevious DATETIME ;
DECLARE vNext DATETIME ;
DECLARE vPreviousDirection VARCHAR(3) ;
DECLARE vNextDirection VARCHAR(3) ;
DECLARE vDayStayMax INT;
DECLARE vTimedSeconds INT;
DECLARE vLastTimeIn INT;
SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds;
SELECT dayStayMax INTO vDayStayMax
FROM vn.workerTimeControlParams;
SELECT timed, direction INTO vNext,vNextDirection
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction IN ('in','out')
AND timed > vTimed
ORDER BY timed ASC
LIMIT 1;
SELECT timed, direction INTO vPrevious, vPreviousDirection
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction IN ('in','out')
AND timed < vTimed
ORDER BY timed DESC
LIMIT 1;
IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN
RETURN 'middle';
END IF;
IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN
IF vPreviousDirection = 'in' THEN
RETURN 'out';
ELSE
SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction ='in'
AND timed < vPrevious;
IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN
RETURN 'out';
END IF;
END IF;
END IF;
RETURN 'in';
END$$
DELIMITER ;

View File

@ -0,0 +1,52 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT)
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén.
* Si no existe lo genera.
*
* @param vLanded Fecha de llegada al almacén
* @param vWarehouseFk Identificador de vn.warehouse
*/
DECLARE vTravelFk INT;
IF vLanded THEN
SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk
FROM vn.travel tr
JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
WHERE wIn.id = vWarehouseFk
AND wOut.name = 'Holanda'
AND am.name = 'LOGIFLORA'
AND landed = vLanded;
IF NOT vTravelFk THEN
INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyModeFk)
SELECT vLanded, util.VN_CURDATE(), vWarehouseFk, wOut.id, am.id
FROM vn.warehouse wOut
JOIN vn.agencyMode am ON am.name = 'LOGIFLORA'
WHERE wOut.name = 'Holanda';
SELECT MAX(tr.id) INTO vTravelFk
FROM vn.travel tr
JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk
WHERE wIn.id = vWarehouseFk
AND wOut.name = 'Holanda'
AND landed = vLanded;
END IF;
END IF;
RETURN vTravelFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,23 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`workerMachinery_isRegistered`(vWorkerFk VARCHAR(10))
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo)
*
* @param vWorkerFk id del trabajador
* @return Devuelve TRUE/FALSE en caso de que haya o no registros
*/
IF (SELECT COUNT(*)
FROM machineWorker m
WHERE m.workerFk = vWorkerFk
AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed))
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END$$
DELIMITER ;

View File

@ -39,7 +39,7 @@ BEGIN
AND vWarehouseFk IN (tr.warehouseInFk, 0) AND vWarehouseFk IN (tr.warehouseInFk, 0)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT tr.isRaid AND NOT e.isRaid
UNION ALL UNION ALL
SELECT tr.shipped, SELECT tr.shipped,
NULL, NULL,
@ -58,7 +58,7 @@ BEGIN
AND s.id <> (SELECT supplierFk FROM inventoryConfig) AND s.id <> (SELECT supplierFk FROM inventoryConfig)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT tr.isRaid AND NOT e.isRaid
UNION ALL UNION ALL
SELECT t.shipped, SELECT t.shipped,
NULL, NULL,

View File

@ -42,7 +42,7 @@ proc: BEGIN
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
AND t.warehouseInFk = vWarehouseLanding AND t.warehouseInFk = vWarehouseLanding
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT t.isRaid AND NOT e.isRaid
GROUP BY c.itemFk; GROUP BY c.itemFk;
-- Tabla con el ultimo dia de last_buy para cada producto -- Tabla con el ultimo dia de last_buy para cada producto
@ -57,7 +57,7 @@ proc: BEGIN
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
WHERE t.warehouseFk = vWarehouseShipment WHERE t.warehouseFk = vWarehouseShipment
AND NOT tr.isRaid AND NOT e.isRaid
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated, ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
tr.landed); tr.landed);
@ -94,7 +94,7 @@ proc: BEGIN
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
WHERE NOT e.isExcludedFromAvailable WHERE NOT e.isExcludedFromAvailable
AND b.quantity <> 0 AND b.quantity <> 0
AND NOT t.isRaid AND NOT e.isRaid
AND t.warehouseInFk = vWarehouseLanding AND t.warehouseInFk = vWarehouseLanding
AND t.landed >= vDatedFrom AND t.landed >= vDatedFrom
AND (ir.dated IS NULL OR t.landed <= ir.dated) AND (ir.dated IS NULL OR t.landed <= ir.dated)

View File

@ -1,7 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
vItemFk INT, vItemFk INT,
vWarehouseFk INT, vWarehouseFk SMALLINT,
vDated DATE vDated DATE
) )
BEGIN BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
vItemFk INT, vItemFk INT,
vWarehouseFk SMALLINT, vWarehouseFk SMALLINT,
vStarted DATE, vStarted DATE,

View File

@ -0,0 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.buy;
CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY;
INSERT INTO tmp.buy
SELECT b.id
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE t.landed = vDated
AND t.agencyModeFk IN (0, vAgencyFk);
CALL buy_getVolume();
DROP TEMPORARY TABLE tmp.buy;
END$$
DELIMITER ;

View File

@ -126,10 +126,7 @@ BEGIN
AND a.available > 0 AND a.available > 0
AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0) AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0)
AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize) AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize)
AND (it.`size` IS NULL AND (itc.isReclining OR it.`size` IS NULL OR it.`size` < z.itemMaxSize OR z.itemMaxSize IS NULL)
OR IF(itc.isReclining,
it.size <= z.itemMaxLength OR z.itemMaxLength IS NULL,
it.size <= z.itemMaxSize OR z.itemMaxSize IS NULL))
AND cit.id IS NULL AND cit.id IS NULL
AND zit.id IS NULL AND zit.id IS NULL
AND ait.id IS NULL; AND ait.id IS NULL;

View File

@ -7,7 +7,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`catalog_componentCalc
) )
BEGIN BEGIN
/** /**
* Calcula los componentes de los articulos de la tabla tmp.ticketLot * Calcula los componentes de los articulos de tmp.ticketLot
* *
* @param vZoneFk para calcular el transporte * @param vZoneFk para calcular el transporte
* @param vAddressFk Consignatario * @param vAddressFk Consignatario
@ -25,41 +25,18 @@ BEGIN
FROM address FROM address
WHERE id = vAddressFk; WHERE id = vAddressFk;
CREATE OR REPLACE TEMPORARY TABLE tPriceDelta CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
(INDEX (itemFk)) (INDEX (itemFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT i.id itemFk, SELECT * FROM (
SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
pd.warehouseFk
FROM item i
JOIN priceDelta pd
ON pd.itemTypeFk = i.typeFk
AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
LEFT JOIN zoneGeo zg2 ON zg2.id = address_getGeo(vAddressFk)
WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt)
GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
(INDEX (itemFk))
ENGINE = MEMORY
SELECT * FROM (
SELECT * SELECT *
FROM specialPrice FROM specialPrice
WHERE (clientFk = vClientFk OR clientFk IS NULL) WHERE (clientFk = vClientFk OR clientFk IS NULL)
AND started <= vShipped AND started <= vShipped
AND (ended >= vShipped OR ended IS NULL) AND (ended >= vShipped OR ended IS NULL)
ORDER BY (clientFk = vClientFk) DESC, id DESC ORDER BY (clientFk = vClientFk) DESC, id DESC
LIMIT 10000000000000000000) t LIMIT 10000000000000000000) t
GROUP BY itemFk; GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate
(PRIMARY KEY (itemFk, warehouseFk)) (PRIMARY KEY (itemFk, warehouseFk))
@ -131,19 +108,6 @@ BEGIN
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
GROUP BY tc.itemFk, warehouseFk; GROUP BY tc.itemFk, warehouseFk;
-- Bonus del comprador a un rango de productos
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT
tcb.warehouseFk,
tcb.itemFk,
c.id,
IFNULL(tcb.base * tpd.ratIncreasing / 100,0) + IFNULL(tpd.absIncreasing,0)
FROM tmp.ticketComponentBase tcb
JOIN component c ON c.code = 'bonus'
JOIN tPriceDelta tpd
ON tpd.itemFk = tcb.itemFk
AND tpd.warehouseFk = tcb.warehouseFk;
-- RECOBRO -- RECOBRO
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk, tcb.itemFk, c2.id, SELECT tcb.warehouseFk, tcb.itemFk, c2.id,
@ -339,7 +303,6 @@ BEGIN
tmp.ticketComponentBase, tmp.ticketComponentBase,
tmp.ticketComponentRate, tmp.ticketComponentRate,
tmp.ticketComponentCopy, tmp.ticketComponentCopy,
tPriceDelta, tSpecialPrice;
tSpecialPrice;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -23,13 +23,6 @@ BEGIN
DELETE FROM messageInbox WHERE sendDate < v2Months; DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM messageInbox WHERE sendDate < v2Months; DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM workerTimeControl WHERE timed < v4Years; DELETE FROM workerTimeControl WHERE timed < v4Years;
DELETE FROM itemShelvingSale
WHERE itemShelvingFk IN (
SELECT id
FROM itemShelving
WHERE created < util.VN_CURDATE()
AND visible = 0
);
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0; DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
DELETE FROM ticketDown WHERE created < util.yesterday(); DELETE FROM ticketDown WHERE created < util.yesterday();
DELETE IGNORE FROM expedition WHERE created < v26Months; DELETE IGNORE FROM expedition WHERE created < v26Months;
@ -56,11 +49,17 @@ BEGIN
AND ts.id IS NULL; AND ts.id IS NULL;
DELETE FROM claim WHERE ticketCreated < v4Years; DELETE FROM claim WHERE ticketCreated < v4Years;
-- Robert ubicacion anterior de travelLog comentario para debug -- Robert ubicacion anterior de travelLog comentario para debug
DELETE FROM zoneEvent WHERE dated < v2Months OR ended < v2Months; DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Months;
DELETE bm
FROM buyMark bm
JOIN buy b ON b.id = bm.id
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE t.landed <= v2Months;
DELETE b FROM buy b DELETE b FROM buy b
JOIN entryConfig e ON e.defaultEntry = b.entryFk JOIN entryConfig e ON e.defaultEntry = b.entryFk
WHERE b.created < v2Months; WHERE b.created < v2Months;
DELETE FROM stockBought WHERE dated < v2Months; DELETE FROM stockBuyed WHERE creationDate < v2Months;
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months; DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months;
-- Equipos duplicados -- Equipos duplicados
DELETE w.* DELETE w.*

View File

@ -28,7 +28,7 @@ BEGIN
JOIN agencyMode am ON am.id = tr.agencyModeFk JOIN agencyMode am ON am.id = tr.agencyModeFk
WHERE NOT b.quantity WHERE NOT b.quantity
AND am.code = 'logiflora' AND am.code = 'logiflora'
AND tr.daysInForward; AND e.isRaid;
START TRANSACTION; START TRANSACTION;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`clearShelvingList`(vShelvingFk VARCHAR(8))
BEGIN
UPDATE vn.itemShelving
SET visible = 0
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk COLLATE utf8_unicode_ci;
END$$
DELIMITER ;

View File

@ -34,19 +34,22 @@ BEGIN
DECLARE vIsTaxDataChecked TINYINT(1); DECLARE vIsTaxDataChecked TINYINT(1);
DECLARE vHasCoreVnl BOOLEAN; DECLARE vHasCoreVnl BOOLEAN;
DECLARE vMandateTypeFk INT; DECLARE vMandateTypeFk INT;
DECLARE vHasDailyInvoice BOOLEAN;
SELECT cc.defaultPayMethodFk, SELECT cc.defaultPayMethodFk,
cc.defaultDueDay, cc.defaultDueDay,
cc.defaultCredit, cc.defaultCredit,
cc.defaultIsTaxDataChecked, cc.defaultIsTaxDataChecked,
cc.defaultHasCoreVnl, cc.defaultHasCoreVnl,
cc.defaultMandateTypeFk cc.defaultMandateTypeFk,
c.hasDailyInvoice
INTO vPayMethodFk, INTO vPayMethodFk,
vDueDay, vDueDay,
vDefaultCredit, vDefaultCredit,
vIsTaxDataChecked, vIsTaxDataChecked,
vHasCoreVnl, vHasCoreVnl,
vMandateTypeFk vMandateTypeFk,
vHasDailyInvoice
FROM clientConfig cc FROM clientConfig cc
LEFT JOIN province p ON p.id = vProvinceFk LEFT JOIN province p ON p.id = vProvinceFk
LEFT JOIN country c ON c.id = p.countryFk; LEFT JOIN country c ON c.id = p.countryFk;
@ -67,7 +70,8 @@ BEGIN
credit = vDefaultCredit, credit = vDefaultCredit,
isTaxDataChecked = vIsTaxDataChecked, isTaxDataChecked = vIsTaxDataChecked,
hasCoreVnl = vHasCoreVnl, hasCoreVnl = vHasCoreVnl,
isEqualizated = FALSE isEqualizated = FALSE,
hasDailyInvoice = vHasDailyInvoice
ON duplicate KEY UPDATE ON duplicate KEY UPDATE
payMethodFk = vPayMethodFk, payMethodFk = vPayMethodFk,
dueDay = vDueDay, dueDay = vDueDay,

View File

@ -55,20 +55,24 @@ BEGIN
SELECT ts.saleFk, SELECT ts.saleFk,
ts.itemFk, ts.itemFk,
CAST(0 AS DECIMAL(10,0)) saleOrder, CAST(0 AS DECIMAL(10,0)) saleOrder,
(IF(ish.visible > 0 OR iss.id, 1, 100000) * IF(ish.visible > 0 OR iss.id, 1, 100000) *
COALESCE(p2.pickingOrder, p.pickingOrder)) `order`, IFNULL(p2.pickingOrder, p.pickingOrder) `order`,
TO_SECONDS(COALESCE(iss.created, ish.created)) - TO_SECONDS(MAKEDATE(IFNULL(YEAR(iss.created), YEAR(ish.created)), 1)) priority, TO_SECONDS(IF(iss.id,
iss.created - INTERVAL vCurrentYear YEAR,
ish.created - INTERVAL YEAR(ish.created) YEAR)) priority,
CONCAT( CONCAT(
IF(iss.id, CONCAT('< ', COALESCE(wk.`code`, '---'),' > '), ''), IF(iss.id,
p.`code` CONCAT('< ', IFNULL(wk.`code`, '---'),' > '),
) COLLATE utf8_general_ci placement, ''),
p.`code`) COLLATE utf8_general_ci placement,
sh.priority shelvingPriority, sh.priority shelvingPriority,
sh.code COLLATE utf8_general_ci shelving, sh.code COLLATE utf8_general_ci shelving,
ish.created, ish.created,
ish.visible, ish.visible,
COALESCE( IFNULL(
IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),1) `grouping`, IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
(st.code = 'previousPrepared') isPreviousPrepared, 1) `grouping`,
st.code = 'previousPrepared' isPreviousPrepared,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
ts.ticketFk, ts.ticketFk,
iss.id, iss.id,
@ -76,28 +80,27 @@ BEGIN
iss.userFk, iss.userFk,
ts.quantity ts.quantity
FROM tSale ts FROM tSale ts
LEFT JOIN (SELECT st.saleFk LEFT JOIN (SELECT DISTINCT saleFk
FROM saleTracking st FROM saleTracking st
JOIN state s ON s.id = st.stateFk JOIN state s ON s.id = st.stateFk
WHERE st.isChecked WHERE st.isChecked
AND s.semaphore = 1 AND s.semaphore = 1) st ON st.saleFk = ts.saleFk
GROUP BY st.saleFk) st ON st.saleFk = ts.saleFk
JOIN itemShelving ish ON ish.itemFk = ts.itemFk JOIN itemShelving ish ON ish.itemFk = ts.itemFk
JOIN shelving sh ON sh.id = ish.shelvingFk JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk JOIN parking p ON p.id = sh.parkingFk
JOIN sector sc ON sc.id = p.sectorFk JOIN sector sc ON sc.id = p.sectorFk
JOIN sectorType st ON st.id = sc.typeFk JOIN sectorType st ON st.id = sc.typeFk
JOIN warehouse w ON w.id = sc.warehouseFk JOIN warehouse w ON w.id = sc.warehouseFk
LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
AND iss.itemShelvingFk = ish.id AND iss.itemShelvingFk = ish.id
LEFT JOIN worker wk ON wk.id = iss.userFk LEFT JOIN worker wk ON wk.id = iss.userFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
LEFT JOIN parking p2 ON p2.id = sg.parkingFk LEFT JOIN parking p2 ON p2.id = sg.parkingFk
WHERE w.id = vWarehouseFk WHERE w.id = vWarehouseFk
AND NOT sc.isHideForPickers AND NOT sc.isHideForPickers
AND ((iss.id AND st.saleFk) OR st.saleFk IS NULL); HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL;
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2 CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2
(INDEX(saleFk), INDEX(olderPriority)) (INDEX(saleFk), INDEX(olderPriority))

View File

@ -45,12 +45,6 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime
@ -124,19 +118,9 @@ BEGIN
IF vCollectionFk IS NULL THEN IF vCollectionFk IS NULL THEN
CALL collection_new(vUserFk, vCollectionFk); CALL collection_new(vUserFk, vCollectionFk);
START TRANSACTION; UPDATE `collection`
SET workerFk = vUserFk
SELECT workerFk INTO vCollectionWorker WHERE id = vCollectionFk;
FROM `collection`
WHERE id = vCollectionFk FOR UPDATE;
IF vCollectionWorker IS NULL THEN
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;
END IF;
COMMIT;
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -5,139 +5,100 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_getAssigne
) )
BEGIN BEGIN
/** /**
* Comprueba si existen colecciones libres que se ajustan * Comprueba si existen colecciones libres que se ajustan al perfil del usuario
* al perfil del usuario y le asigna la más antigua. * y le asigna la más antigua.
* Añade un registro al semillero de colecciones. * Añade un registro al semillero de colecciones y hace la reserva para la colección
* *
* @param vUserFk Id de usuario * @param vUserFk Id de usuario
* @param vCollectionFk Id de colección * @param vCollectionFk Id de colección
*/ */
DECLARE vHasTooMuchCollections BOOL; DECLARE vHasTooMuchCollections BOOL;
DECLARE vDone BOOL DEFAULT FALSE; DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vCollectionWorker INT; DECLARE vWarehouseFk INT;
DECLARE vMaxNotAssignedCollectionLifeTime TIME; DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30;
DECLARE vCollections CURSOR FOR
WITH collections AS (
SELECT tc.collectionFk,
SUM(sv.volume) volume,
c.saleTotalCount,
c.itemPackingTypeFk,
c.trainFk,
c.warehouseFk,
c.wagons
FROM vn.ticketCollection tc
JOIN vn.collection c ON c.id = tc.collectionFk
JOIN vn.saleVolume sv ON sv.ticketFk = tc.ticketFk
WHERE c.workerFk IS NULL
AND sv.shipped >= util.VN_CURDATE()
GROUP BY tc.collectionFk
) SELECT c.collectionFk
FROM collections c
JOIN vn.operator o
WHERE o.workerFk = vUserFk
AND (c.saleTotalCount <= o.linesLimit OR o.linesLimit IS NULL)
AND (c.itemPackingTypeFk = o.itemPackingTypeFk OR o.itemPackingTypeFk IS NULL)
AND o.numberOfWagons = c.wagons
AND o.trainFk = c.trainFk
AND o.warehouseFk = c.warehouseFk;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Si hay colecciones sin terminar, sale del proceso
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
ROLLBACK; IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
END IF;
RESIGNAL; RESIGNAL;
END; END;
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
INTO vHasTooMuchCollections, vMaxNotAssignedCollectionLifeTime pc.collection_assign_lockname
FROM productionConfig pc INTO vHasTooMuchCollections,
LEFT JOIN tmp.collection ON TRUE; vLockName
FROM tmp.collection c
JOIN productionConfig pc;
DROP TEMPORARY TABLE tmp.collection; DROP TEMPORARY TABLE tmp.collection;
IF vHasTooMuchCollections THEN IF vHasTooMuchCollections THEN
CALL util.throw('Hay colecciones pendientes'); CALL util.throw('There are pending collections');
END IF;
SELECT warehouseFk, itemPackingTypeFk
INTO vWarehouseFk, vItemPackingTypeFk
FROM operator
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
END IF; END IF;
-- Se eliminan las colecciones sin asignar que estan obsoletas -- Se eliminan las colecciones sin asignar que estan obsoletas
INSERT INTO ticketTracking(stateFk, ticketFk) INSERT INTO ticketTracking(stateFk, ticketFk)
SELECT s.id, tc.ticketFk SELECT s.id, tc.ticketFk
FROM `collection` c FROM collection c
JOIN ticketCollection tc ON tc.collectionFk = c.id JOIN ticketCollection tc ON tc.collectionFk = c.id
JOIN `state` s ON s.code = 'PRINTED_AUTO' JOIN state s ON s.code = 'PRINTED_AUTO'
JOIN productionConfig pc
WHERE c.workerFk IS NULL WHERE c.workerFk IS NULL
AND TIMEDIFF(util.VN_NOW(), c.created) > vMaxNotAssignedCollectionLifeTime; AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
DELETE FROM `collection` DELETE c
WHERE workerFk IS NULL FROM collection c
AND TIMEDIFF(util.VN_NOW(), created) > vMaxNotAssignedCollectionLifeTime; JOIN productionConfig pc
WHERE c.workerFk IS NULL
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
-- Se añade registro al semillero -- Se añade registro al semillero
INSERT INTO collectionHotbed
INSERT INTO collectionHotbed(userFk) VALUES(vUserFk); SET userFk = vUserFk;
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion -- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
SELECT MIN(c.id) INTO vCollectionFk
OPEN vCollections; FROM collection c
l: LOOP JOIN operator o ON (o.itemPackingTypeFk = c.itemPackingTypeFk
SET vDone = FALSE; OR c.itemPackingTypeFk IS NULL)
FETCH vCollections INTO vCollectionFk; AND o.numberOfWagons = c.wagons
AND o.trainFk = c.trainFk
IF vDone THEN AND o.warehouseFk = c.warehouseFk
LEAVE l; AND c.workerFk IS NULL
END IF; WHERE o.workerFk = vUserFk;
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
SET vCollectionFk = NULL;
RESIGNAL;
END;
START TRANSACTION;
SELECT workerFk INTO vCollectionWorker
FROM `collection`
WHERE id = vCollectionFk FOR UPDATE;
IF vCollectionWorker IS NULL THEN
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;
COMMIT;
LEAVE l;
END IF;
ROLLBACK;
END;
END LOOP;
CLOSE vCollections;
IF vCollectionFk IS NULL THEN IF vCollectionFk IS NULL THEN
CALL collection_new(vUserFk, vCollectionFk); CALL collection_new(vUserFk, vCollectionFk);
START TRANSACTION;
SELECT workerFk INTO vCollectionWorker
FROM `collection`
WHERE id = vCollectionFk FOR UPDATE;
IF vCollectionWorker IS NULL THEN
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;
END IF;
COMMIT;
END IF; END IF;
UPDATE collection
SET workerFk = vUserFk
WHERE id = vCollectionFk;
CALL itemShelvingSale_addByCollection(vCollectionFk); CALL itemShelvingSale_addByCollection(vCollectionFk);
DO RELEASE_LOCK(vLockName);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -21,8 +21,9 @@ BEGIN
SELECT tob.ticketFk, tob.description SELECT tob.ticketFk, tob.description
FROM vn.ticketObservation tob FROM vn.ticketObservation tob
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
JOIN vn.observationType ot ON ot.id = tob.observationTypeFk AND ot.`code` = 'itemPicker' LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
WHERE tc.collectionFk = vParamFk OR tc.ticketFk = vParamFk WHERE ot.`code` = 'itemPicker'
AND tc.collectionFk = vParamFk
) )
SELECT t.id ticketFk, SELECT t.id ticketFk,
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`, IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
@ -30,9 +31,7 @@ BEGIN
t.warehouseFk, t.warehouseFk,
w.id salesPersonFk, w.id salesPersonFk,
IFNULL(ob.description,'') observaciones, IFNULL(ob.description,'') observaciones,
cc.rgb, cc.rgb
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.ticket t FROM vn.ticket t
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
@ -45,21 +44,16 @@ BEGIN
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE t.id = vParamFk WHERE t.id = vParamFk
AND t.shipped >= vYesterday AND t.shipped >= vYesterday
UNION UNION ALL
SELECT t.id ticketFk, SELECT t.id ticketFk,
IF(NOT(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`, IF(NOT(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
am.name agencyName, am.name agencyName,
t.warehouseFk, t.warehouseFk,
w.id salesPersonFk, w.id salesPersonFk,
ob.description, ob.description,
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`, IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.ticket t FROM vn.ticket t
JOIN vn.ticketCollection tc ON t.id = tc.ticketFk JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
@ -72,20 +66,15 @@ BEGIN
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE tc.collectionFk = vParamFk WHERE tc.collectionFk = vParamFk
UNION UNION ALL
SELECT sg.ticketFk, SELECT sg.ticketFk,
NULL `level`, NULL `level`,
am.name agencyName, am.name agencyName,
t.warehouseFk, t.warehouseFk,
c.salesPersonFk, c.salesPersonFk,
ob.description, ob.description,
NULL `rgb`, NULL `rgb`
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.sectorCollection sc FROM vn.sectorCollection sc
JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk
@ -94,11 +83,7 @@ BEGIN
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE sc.id = vParamFk WHERE sc.id = vParamFk
AND t.shipped >= vYesterday AND t.shipped >= vYesterday;
GROUP BY ticketFk;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
BEGIN BEGIN
DECLARE vDone BOOL; DECLARE vDone BOOL;
DECLARE vTicketFk INT; DECLARE vTicketFk INT;

View File

@ -1,8 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_new`( CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_new`(vUserFk INT, OUT vCollectionFk INT)
vUserFk INT,
OUT vCollectionFk INT
)
BEGIN BEGIN
/** /**
* Genera colecciones de tickets sin asignar trabajador. * Genera colecciones de tickets sin asignar trabajador.
@ -15,29 +12,30 @@ BEGIN
DECLARE vLinesLimit INT; DECLARE vLinesLimit INT;
DECLARE vTicketLines INT; DECLARE vTicketLines INT;
DECLARE vVolumeLimit DECIMAL; DECLARE vVolumeLimit DECIMAL;
DECLARE vSizeLimit INT;
DECLARE vTicketVolume DECIMAL; DECLARE vTicketVolume DECIMAL;
DECLARE vSizeLimit INT;
DECLARE vMaxTickets INT; DECLARE vMaxTickets INT;
DECLARE vStateCode VARCHAR(45); DECLARE vStateFk VARCHAR(45);
DECLARE vFirstTicketFk INT; DECLARE vFirstTicketFk INT;
DECLARE vHour INT;
DECLARE vMinute INT;
DECLARE vWorkerCode VARCHAR(3); DECLARE vWorkerCode VARCHAR(3);
DECLARE vWagonCounter INT DEFAULT 1; DECLARE vWagonCounter INT DEFAULT 0;
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE vItemPackingTypeFk VARCHAR(1); DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vHasAssignedTickets BOOL; DECLARE vHasAssignedTickets BOOLEAN;
DECLARE vHasUniqueCollectionTime BOOL; DECLARE vHasUniqueCollectionTime BOOL;
DECLARE vHeight INT;
DECLARE vVolume INT;
DECLARE vLiters INT;
DECLARE vLines INT;
DECLARE vTotalLines INT DEFAULT 0;
DECLARE vTotalVolume INT DEFAULT 0;
DECLARE vFreeWagonFk INT;
DECLARE vDone INT DEFAULT FALSE; DECLARE vDone INT DEFAULT FALSE;
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30;
DECLARE vFreeWagonFk INT;
DECLARE vErrorNumber INT;
DECLARE vErrorMsg TEXT;
DECLARE vTickets CURSOR FOR DECLARE c1 CURSOR FOR
SELECT ticketFk, `lines`, m3 SELECT ticketFk, `lines`, m3
FROM tmp.productionBuffer FROM tmp.productionBuffer
WHERE ticketFk <> vFirstTicketFk
ORDER BY HH, ORDER BY HH,
mm, mm,
productionOrder DESC, productionOrder DESC,
@ -50,6 +48,26 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT;
CALL util.debugAdd('collection_new', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk,
'ticketFk', vTicketFk
)); -- Tmp
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
END IF;
RESIGNAL;
END;
SELECT pc.ticketTrolleyMax * o.numberOfWagons, SELECT pc.ticketTrolleyMax * o.numberOfWagons,
pc.hasUniqueCollectionTime, pc.hasUniqueCollectionTime,
w.code, w.code,
@ -60,26 +78,36 @@ BEGIN
o.trainFk, o.trainFk,
o.linesLimit, o.linesLimit,
o.volumeLimit, o.volumeLimit,
o.sizeLimit o.sizeLimit,
pc.collection_new_lockname
INTO vMaxTickets, INTO vMaxTickets,
vHasUniqueCollectionTime, vHasUniqueCollectionTime,
vWorkerCode, vWorkerCode,
vWarehouseFk, vWarehouseFk,
vItemPackingTypeFk, vItemPackingTypeFk,
vStateCode, vStateFk,
vWagons, vWagons,
vTrainFk, vTrainFk,
vLinesLimit, vLinesLimit,
vVolumeLimit, vVolumeLimit,
vSizeLimit vSizeLimit,
FROM worker w vLockName
JOIN operator o ON o.workerFk = w.id FROM productionConfig pc
JOIN worker w ON w.id = vUserFk
JOIN state st ON st.`code` = 'ON_PREPARATION' JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN productionConfig pc JOIN operator o ON o.workerFk = vUserFk;
WHERE w.id = vUserFk;
SET vLockName = CONCAT_WS('/',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
END IF;
-- Se prepara el tren, con tantos vagones como sea necesario. -- Se prepara el tren, con tantos vagones como sea necesario.
CREATE OR REPLACE TEMPORARY TABLE tTrain CREATE OR REPLACE TEMPORARY TABLE tTrain
(wagon INT, (wagon INT,
shelve INT, shelve INT,
@ -90,62 +118,63 @@ BEGIN
PRIMARY KEY(wagon, shelve)) PRIMARY KEY(wagon, shelve))
ENGINE = MEMORY; ENGINE = MEMORY;
INSERT INTO tTrain (wagon, shelve, liters, `lines`, height) WHILE vWagons > vWagonCounter DO
WITH RECURSIVE wagonSequence AS ( SET vWagonCounter = vWagonCounter + 1;
SELECT vWagonCounter wagon
UNION ALL INSERT INTO tTrain(wagon, shelve, liters, `lines`, height)
SELECT wagon + 1 wagon SELECT vWagonCounter, cv.`level` , cv.liters , cv.`lines` , cv.height
FROM wagonSequence FROM collectionVolumetry cv
WHERE wagon < vWagonCounter + vWagons -1 WHERE cv.trainFk = vTrainFk
)
SELECT ws.wagon, cv.`level`, cv.liters, cv.`lines`, cv.height
FROM wagonSequence ws
JOIN vn.collectionVolumetry cv ON cv.trainFk = vTrainFk
AND cv.itemPackingTypeFk = vItemPackingTypeFk; AND cv.itemPackingTypeFk = vItemPackingTypeFk;
END WHILE;
-- Esto desaparecerá cuando tengamos la table cache.ticket -- Esto desaparecerá cuando tengamos la table cache.ticket
CALL productionControl(vWarehouseFk, 0); CALL productionControl(vWarehouseFk, 0);
ALTER TABLE tmp.productionBuffer ALTER TABLE tmp.productionBuffer
ADD COLUMN liters INT, ADD COLUMN liters INT,
ADD COLUMN height INT; ADD COLUMN height INT;
-- Se obtiene nº de colección.
INSERT INTO collection
SET itemPackingTypeFk = vItemPackingTypeFk,
trainFk = vTrainFk,
wagons = vWagons,
warehouseFk = vWarehouseFk;
SELECT LAST_INSERT_ID() INTO vCollectionFk;
-- Los tickets de recogida en Algemesí sólo se sacan si están asignados. -- Los tickets de recogida en Algemesí sólo se sacan si están asignados.
-- Los pedidos con riesgo no se sacan aunque se asignen. -- Los pedidos con riesgo no se sacan aunque se asignen.
DELETE pb.*
DELETE pb
FROM tmp.productionBuffer pb FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state JOIN state s ON s.id = pb.state
WHERE (pb.agency = 'REC_ALGEMESI' WHERE (pb.agency = 'REC_ALGEMESI'
AND s.code <> 'PICKER_DESIGNED') AND s.code <> 'PICKER_DESIGNED')
OR pb.problem LIKE '%RIESGO%'; OR pb.problem LIKE '%RIESGO%';
-- Si hay tickets asignados, nos centramos exclusivamente en esos tickets -- Comprobamos si hay tickets asignados. En ese caso, nos centramos
-- y los sacamos independientemente de problemas o tamaños -- exclusivamente en esos tickets y los sacamos independientemente
-- de problemas o tamaños
SELECT EXISTS ( SELECT COUNT(*) INTO vHasAssignedTickets
SELECT TRUE FROM tmp.productionBuffer pb
FROM tmp.productionBuffer pb JOIN state s ON s.id = pb.state
JOIN state s ON s.id = pb.state WHERE s.code = 'PICKER_DESIGNED'
WHERE (s.code = 'PICKER_DESIGNED' AND pb.workerCode = vWorkerCode;
AND pb.workerCode = vWorkerCode)
OR s.code = 'LAST_CALL'
) INTO vHasAssignedTickets;
-- Se dejan en la tabla tmp.productionBuffer sólo aquellos tickets adecuados -- Se dejan en la tabla tmp.productionBuffer sólo aquellos tickets adecuados
IF vHasAssignedTickets THEN IF vHasAssignedTickets THEN
DELETE pb DELETE pb.*
FROM tmp.productionBuffer pb FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state JOIN state s ON s.id = pb.state
WHERE (s.code <> 'PICKER_DESIGNED' WHERE s.code <> 'PICKER_DESIGNED'
OR pb.workerCode <> vWorkerCode) OR pb.workerCode <> vWorkerCode;
AND s.code <> 'LAST_CALL';
ELSE ELSE
DELETE pb DELETE pb.*
FROM tmp.productionBuffer pb FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state JOIN state s ON s.id = pb.state
JOIN agencyMode am ON am.id = pb.agencyModeFk
JOIN agency a ON a.id = am.agencyFk
LEFT JOIN ( LEFT JOIN (
SELECT pb.ticketFk, MAX(i.`size`) maxSize SELECT pb.ticketFk, MAX(i.`size`) maxSize
FROM tmp.productionBuffer pb FROM tmp.productionBuffer pb
@ -156,7 +185,7 @@ BEGIN
) sub ON sub.ticketFk = pb.ticketFk ) sub ON sub.ticketFk = pb.ticketFk
JOIN productionConfig pc JOIN productionConfig pc
WHERE pb.shipped <> util.VN_CURDATE() WHERE pb.shipped <> util.VN_CURDATE()
OR pb.ubicacion IS NULL OR (pb.ubicacion IS NULL AND a.isOwn)
OR (NOT s.isPreparable AND NOT s.isPrintable) OR (NOT s.isPreparable AND NOT s.isPrintable)
OR pb.collectionH IS NOT NULL OR pb.collectionH IS NOT NULL
OR pb.collectionV IS NOT NULL OR pb.collectionV IS NOT NULL
@ -164,22 +193,13 @@ BEGIN
OR (NOT pb.H AND pb.V > 0 AND vItemPackingTypeFk = 'H') OR (NOT pb.H AND pb.V > 0 AND vItemPackingTypeFk = 'H')
OR (NOT pb.V AND vItemPackingTypeFk = 'V') OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking) OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) OR LENGTH(pb.problem) > 0
OR pb.lines > vLinesLimit OR pb.lines > vLinesLimit
OR pb.m3 > vVolumeLimit OR pb.m3 > vVolumeLimit
OR sub.maxSize > vSizeLimit OR sub.maxSize > vSizeLimit
OR pb.hasPlantTray; OR pb.hasPlantTray;
END IF; END IF;
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
IF vHasUniqueCollectionTime THEN
DELETE pb
FROM tmp.productionBuffer pb
JOIN tmp.productionBuffer pb2 ON pb2.ticketFk = vFirstTicketFk
AND (pb.HH <> pb2.HH OR pb.mm <> pb2.mm);
END IF;
SELECT ticketFk INTO vFirstTicketFk SELECT ticketFk INTO vFirstTicketFk
FROM tmp.productionBuffer FROM tmp.productionBuffer
ORDER BY HH, ORDER BY HH,
@ -192,37 +212,45 @@ BEGIN
ticketFk ticketFk
LIMIT 1; LIMIT 1;
OPEN vTickets; -- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
l: LOOP IF vHasUniqueCollectionTime THEN
SET vDone = FALSE; DELETE pb
FETCH vTickets INTO vTicketFk, vTicketLines, vTicketVolume; FROM tmp.productionBuffer pb
JOIN tmp.productionBuffer pb2 ON pb2.ticketFk = vFirstTicketFk
AND (pb.HH <> pb2.HH OR pb.mm <> pb2.mm);
END IF;
IF vDone THEN SET vTicketFk = vFirstTicketFk;
LEAVE l; SET @lines = 0;
END IF; SET @volume = 0;
OPEN c1;
read_loop: LOOP
SET vDone = FALSE;
-- Buscamos un ticket que cumpla con los requisitos en el listado -- Buscamos un ticket que cumpla con los requisitos en el listado
IF ((vTicketLines + @lines) <= vLinesLimit OR vLinesLimit IS NULL)
IF (vLinesLimit IS NULL OR (vTotalLines + vTicketLines) <= vLinesLimit) AND ((vTicketVolume + @volume) <= vVolumeLimit OR vVolumeLimit IS NULL) THEN
AND (vVolumeLimit IS NULL OR (vTotalVolume + vTicketVolume) <= vVolumeLimit) THEN
CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk); CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk);
DROP TEMPORARY TABLE tmp.ticketIPT; DROP TEMPORARY TABLE tmp.ticketIPT;
SELECT COUNT(*), SUM(litros), MAX(i.`size`), SUM(sv.volume)
INTO vLines, vLiters, vHeight, vVolume
FROM saleVolume sv
JOIN sale s ON s.id = sv.saleFk
JOIN item i ON i.id = s.itemFk
WHERE sv.ticketFk = vTicketFk;
SET vTotalVolume = vTotalVolume + vVolume,
vTotalLines = vTotalLines + vLines;
UPDATE tmp.productionBuffer pb UPDATE tmp.productionBuffer pb
SET pb.liters = vLiters, JOIN (
pb.`lines` = vLines, SELECT SUM(litros) liters,
pb.height = vHeight @lines:= COUNT(*) + @lines,
COUNT(*) `lines`,
MAX(i.`size`) height,
@volume := SUM(sv.volume) + @volume,
SUM(sv.volume) volume
FROM saleVolume sv
JOIN sale s ON s.id = sv.saleFk
JOIN item i ON i.id = s.itemFk
WHERE sv.ticketFk = vTicketFk
) sub
SET pb.liters = sub.liters,
pb.`lines` = sub.`lines`,
pb.height = sub.height
WHERE pb.ticketFk = vTicketFk; WHERE pb.ticketFk = vTicketFk;
UPDATE tTrain tt UPDATE tTrain tt
@ -239,13 +267,17 @@ BEGIN
tt.height tt.height
LIMIT 1; LIMIT 1;
-- Si no le encuentra una balda, intentamos darle un carro entero libre -- Si no le encuentra una balda adecuada, intentamos darle un carro entero si queda alguno libre
IF NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN IF NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN
SELECT wagon INTO vFreeWagonFk SELECT tt.wagon
FROM tTrain INTO vFreeWagonFk
GROUP BY wagon FROM tTrain tt
HAVING COUNT(ticketFk) = 0 LEFT JOIN (
SELECT DISTINCT wagon
FROM tTrain
WHERE ticketFk IS NOT NULL
) nn ON nn.wagon = tt.wagon
WHERE nn.wagon IS NULL
ORDER BY wagon ORDER BY wagon
LIMIT 1; LIMIT 1;
@ -254,35 +286,38 @@ BEGIN
SET ticketFk = vFirstTicketFk SET ticketFk = vFirstTicketFk
WHERE wagon = vFreeWagonFk; WHERE wagon = vFreeWagonFk;
-- Se anulan el resto de carros libres, -- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo
-- máximo un carro con pedido excesivo DELETE tt.*
DELETE tt
FROM tTrain tt FROM tTrain tt
JOIN (SELECT wagon LEFT JOIN (
FROM tTrain SELECT DISTINCT wagon
GROUP BY wagon FROM tTrain
HAVING COUNT(ticketFk) = 0 WHERE ticketFk IS NOT NULL
) sub ON sub.wagon = tt.wagon; ) nn ON nn.wagon = tt.wagon
WHERE nn.wagon IS NULL;
END IF; END IF;
END IF; END IF;
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
IF vDone OR NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk IS NULL) THEN
LEAVE read_loop;
END IF;
ELSE
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
IF vDone THEN
LEAVE read_loop;
END IF;
END IF; END IF;
END LOOP; END LOOP;
CLOSE vTickets; CLOSE c1;
IF (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN IF (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN
-- Se obtiene nº de colección UPDATE collection c
JOIN state st ON st.code = 'ON_PREPARATION'
INSERT INTO collection SET c.stateFk = st.id
SET itemPackingTypeFk = vItemPackingTypeFk, WHERE c.id = vCollectionFk;
trainFk = vTrainFk,
wagons = vWagons,
warehouseFk = vWarehouseFk;
SELECT LAST_INSERT_ID() INTO vCollectionFk;
-- Asigna las bandejas -- Asigna las bandejas
INSERT IGNORE INTO ticketCollection(ticketFk, collectionFk, `level`, wagon, liters) INSERT IGNORE INTO ticketCollection(ticketFk, collectionFk, `level`, wagon, liters)
SELECT tt.ticketFk, vCollectionFk, tt.shelve, tt.wagon, tt.liters SELECT tt.ticketFk, vCollectionFk, tt.shelve, tt.wagon, tt.liters
FROM tTrain tt FROM tTrain tt
@ -290,34 +325,37 @@ BEGIN
ORDER BY tt.wagon, tt.shelve; ORDER BY tt.wagon, tt.shelve;
-- Actualiza el estado de los tickets -- Actualiza el estado de los tickets
CALL collection_setState(vCollectionFk, vStateFk);
CALL collection_setState(vCollectionFk, vStateCode);
-- Aviso para la preparacion previa -- Aviso para la preparacion previa
INSERT INTO ticketDown(ticketFk, collectionFk) INSERT INTO ticketDown(ticketFk, collectionFk)
SELECT tc.ticketFk, tc.collectionFk SELECT tc.ticketFk, tc.collectionFk
FROM ticketCollection tc FROM ticketCollection tc
WHERE tc.collectionFk = vCollectionFk; WHERE tc.collectionFk = vCollectionFk;
CALL collection_mergeSales(vCollectionFk); CALL sales_mergeByCollection(vCollectionFk);
UPDATE `collection` c UPDATE `collection` c
JOIN( JOIN (
SELECT COUNT(*) saleTotalCount, SELECT COUNT(*) saleTotalCount,
SUM(s.isPicked <> 0) salePickedCount SUM(s.isPicked <> 0) salePickedCount
FROM ticketCollection tc FROM ticketCollection tc
JOIN sale s ON s.ticketFk = tc.ticketFk JOIN sale s ON s.ticketFk = tc.ticketFk
WHERE tc.collectionFk = vCollectionFk WHERE tc.collectionFk = vCollectionFk
AND s.quantity > 0 AND s.quantity > 0
)sub ) sub
SET c.saleTotalCount = sub.saleTotalCount, SET c.saleTotalCount = sub.saleTotalCount,
c.salePickedCount = sub.salePickedCount c.salePickedCount = sub.salePickedCount
WHERE c.id = vCollectionFk; WHERE c.id = vCollectionFk;
ELSE ELSE
SET vCollectionFk = NULL; DELETE FROM `collection`
WHERE id = vCollectionFk;
SET vCollectionFk = NULL;
END IF; END IF;
DO RELEASE_LOCK(vLockName);
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tTrain, tTrain,
tmp.productionBuffer; tmp.productionBuffer;

View File

@ -10,7 +10,7 @@ BEGIN
SELECT * FROM ( SELECT * FROM (
SELECT cc.client clientFk, ci.grade SELECT cc.client clientFk, ci.grade
FROM creditClassification cc FROM creditClassification cc
JOIN creditInsurance ci ON cc.id = ci.creditClassificationFk JOIN creditInsurance ci ON cc.id = ci.creditClassification
WHERE dateEnd IS NULL WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1 LIMIT 10000000000000000000) t1

View File

@ -17,6 +17,7 @@ BEGIN
supplierFk, supplierFk,
dated, dated,
isExcludedFromAvailable, isExcludedFromAvailable,
isRaid,
commission, commission,
currencyFk, currencyFk,
companyFk, companyFk,
@ -27,6 +28,7 @@ BEGIN
supplierFk, supplierFk,
dated, dated,
isExcludedFromAvailable, isExcludedFromAvailable,
isRaid,
commission, commission,
currencyFk, currencyFk,
companyFk, companyFk,

View File

@ -166,7 +166,7 @@ BEGIN
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
LEFT JOIN buy b3 ON b3.id = bufi.buyFk LEFT JOIN buy b3 ON b3.id = bufi.buyFk
WHERE ic.display WHERE ic.display
AND NOT tr.isRaid AND NOT e.isRaid
AND (ti.visible OR ti.available) AND (ti.visible OR ti.available)
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;

View File

@ -9,18 +9,16 @@ BEGIN
* *
* @param vSelf Id de entrada * @param vSelf Id de entrada
*/ */
DECLARE vIsNotEditable BOOL DEFAULT FALSE; DECLARE vIsEditable BOOL;
SELECT TRUE INTO vIsNotEditable SELECT e.isBooked INTO vIsEditable
FROM `entry` e FROM `entry` e
LEFT JOIN entryType et ON et.code = e.typeFk JOIN entryType et ON et.code = e.typeFk
WHERE e.id = vSelf WHERE NOT et.isInformal
AND e.isBooked AND e.id = vSelf;
AND (e.typeFk IS NULL OR NOT et.isInformal);
IF vIsNotEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable')); CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,15 +1,10 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`( CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
vShelvingCode VARCHAR(10),
vFromEntryFk INT,
vToEntryFk INT
)
BEGIN BEGIN
/** /**
* Divide las compras entre dos entradas de * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr<EFBFBD>cula
* acuerdo con lo ubicado en una matricula.
* *
* @param vShelvingCode Código de vn.shelving * @param vShelvingFk Identificador de vn.shelving
* @param vFromEntryFk Entrada origen * @param vFromEntryFk Entrada origen
* @param vToEntryFk Entrada destino * @param vToEntryFk Entrada destino
*/ */
@ -19,7 +14,7 @@ BEGIN
DECLARE vDone BOOLEAN DEFAULT FALSE; DECLARE vDone BOOLEAN DEFAULT FALSE;
DECLARE cur CURSOR FOR DECLARE cur CURSOR FOR
SELECT bb.id buyFk, SELECT bb.id buyFk,
LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers, LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers,
bb.stickers buyStickers bb.stickers buyStickers
FROM itemShelving ish FROM itemShelving ish
@ -28,7 +23,7 @@ BEGIN
WHERE b.entryFk = vFromEntryFk WHERE b.entryFk = vFromEntryFk
ORDER BY b.stickers DESC ORDER BY b.stickers DESC
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
WHERE ish.shelvingFk = vShelvingCode COLLATE utf8_general_ci WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
AND NOT ish.isSplit AND NOT ish.isSplit
GROUP BY ish.id; GROUP BY ish.id;
@ -112,10 +107,9 @@ BEGIN
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID(); UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
END IF; END IF;
UPDATE itemShelving ish UPDATE itemShelving
JOIN shelving sh ON sh.id = ish.shelvingFk SET isSplit = TRUE
SET ish.isSplit = TRUE WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci;
WHERE sh.code = vShelvingCode COLLATE utf8_general_ci;
END LOOP; END LOOP;
CLOSE cur; CLOSE cur;
END$$ END$$

View File

@ -22,7 +22,7 @@ BEGIN
FROM vn.entry e FROM vn.entry e
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
JOIN vn.warehouse w ON w.id = t.warehouseInFk JOIN vn.warehouse w ON w.id = t.warehouseInFk
WHERE t.landed >= util.VN_CURDATE() WHERE t.shipped >= util.VN_CURDATE()
AND e.currencyFk = vCurrency AND e.currencyFk = vCurrency
AND NOT e.isBooked; AND NOT e.isBooked;

View File

@ -5,26 +5,22 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionPallet_buil
vWorkerFk INT, vWorkerFk INT,
OUT vPalletFk INT OUT vPalletFk INT
) )
proc: BEGIN BEGIN
/** /** Construye un pallet de expediciones.
* Builds an expedition pallet.
* *
* First, it checks if these expeditions already belong to another pallet, * Primero comprueba si esas expediciones ya pertenecen a otro pallet,
* in which case it returns an error. * en cuyo caso actualiza ese pallet.
* *
* @param vExpeditions JSON_ARRAY with this structure [exp1, exp2, exp3, ...] * @param vExpeditions JSON_ARRAY con esta estructura [exp1, exp2, exp3, ...]
* @param vArcId INT Identifier of arcRead * @param vArcId INT Identificador de arcRead
* @param vWorkerFk INT Identifier of worker * @param vWorkerFk INT Identificador de worker
* @param out vPalletFk Identifier of expeditionPallet * @param out vPalletFk Identificador de expeditionPallet
*/ */
DECLARE vCounter INT; DECLARE vCounter INT;
DECLARE vExpeditionFk INT; DECLARE vExpeditionFk INT;
DECLARE vTruckFk INT; DECLARE vTruckFk INT;
DECLARE vPrinterFk INT; DECLARE vPrinterFk INT;
DECLARE vExpeditionStateTypeFk INT; DECLARE vExpeditionStateTypeFk INT;
DECLARE vFreeExpeditionCount INT;
DECLARE vExpeditionWithPallet INT;
CREATE OR REPLACE TEMPORARY TABLE tExpedition ( CREATE OR REPLACE TEMPORARY TABLE tExpedition (
expeditionFk INT, expeditionFk INT,
@ -48,63 +44,48 @@ proc: BEGIN
WHERE e.id = vExpeditionFk; WHERE e.id = vExpeditionFk;
END WHILE; END WHILE;
SELECT COUNT(expeditionFk) INTO vFreeExpeditionCount SELECT palletFk INTO vPalletFk
FROM tExpedition
WHERE palletFk IS NULL;
SELECT COUNT(expeditionFk) INTO vExpeditionWithPallet
FROM tExpedition
WHERE palletFk;
IF vExpeditionWithPallet THEN
UPDATE arcRead
SET error = (
SELECT GROUP_CONCAT(expeditionFk SEPARATOR ', ')
FROM tExpedition
WHERE palletFk
)
WHERE id = vArcId;
LEAVE proc;
END IF;
IF NOT vFreeExpeditionCount THEN
CALL util.throw ('NO_FREE_EXPEDITIONS');
END IF;
SELECT roadmapStopFk INTO vTruckFk
FROM ( FROM (
SELECT rm.roadmapStopFk, count(*) n SELECT palletFk, count(*) n
FROM routesMonitor rm FROM tExpedition
JOIN tExpedition e ON e.routeFk = rm.routeFk WHERE palletFk > 0
WHERE e.palletFk IS NULL GROUP BY palletFk
GROUP BY roadmapStopFk
ORDER BY n DESC ORDER BY n DESC
LIMIT 1 LIMIT 100
) sub; ) sub
LIMIT 1;
IF vTruckFk IS NULL THEN IF vPalletFk IS NULL THEN
CALL util.throw ('TRUCK_NOT_AVAILABLE'); SELECT roadmapStopFk INTO vTruckFk
FROM (
SELECT rm.roadmapStopFk, count(*) n
FROM routesMonitor rm
JOIN tExpedition e ON e.routeFk = rm.routeFk
GROUP BY roadmapStopFk
ORDER BY n DESC
LIMIT 1
) sub;
IF vTruckFk IS NULL THEN
CALL util.throw ('TRUCK_NOT_AVAILABLE');
END IF;
INSERT INTO expeditionPallet SET truckFk = vTruckFk;
SET vPalletFk = LAST_INSERT_ID();
END IF; END IF;
INSERT INTO expeditionPallet SET truckFk = vTruckFk;
SET vPalletFk = LAST_INSERT_ID();
INSERT INTO expeditionScan(expeditionFk, palletFk, workerFk) INSERT INTO expeditionScan(expeditionFk, palletFk, workerFk)
SELECT expeditionFk, vPalletFk, vWorkerFk SELECT expeditionFk, vPalletFk, vWorkerFk
FROM tExpedition FROM tExpedition
WHERE palletFk IS NULL; ON DUPLICATE KEY UPDATE palletFk = vPalletFk, workerFk = vWorkerFk;
SELECT id INTO vExpeditionStateTypeFk SELECT id INTO vExpeditionStateTypeFk
FROM expeditionStateType FROM expeditionStateType
WHERE code = 'PALLETIZED'; WHERE code = 'PALLETIZED';
INSERT INTO expeditionState(expeditionFk, typeFk) INSERT INTO expeditionState(expeditionFk, typeFk)
SELECT expeditionFk, vExpeditionStateTypeFk SELECT expeditionFk, vExpeditionStateTypeFk FROM tExpedition;
FROM tExpedition
WHERE palletFk IS NULL;
UPDATE arcRead SET error = NULL WHERE id = vArcId;
SELECT printerFk INTO vPrinterFk FROM arcRead WHERE id = vArcId; SELECT printerFk INTO vPrinterFk FROM arcRead WHERE id = vArcId;

View File

@ -4,12 +4,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Put`(
vExpeditionFk INT vExpeditionFk INT
) )
BEGIN BEGIN
IF NOT EXISTS (SELECT id FROM expeditionPallet WHERE id = vPalletFk) THEN IF NOT (SELECT TRUE FROM expedition WHERE id = vExpeditionFk LIMIT 1) THEN
CALL util.throw('Pallet not exists'); CALL util.throw('Expedition not exists');
END IF; END IF;
IF NOT EXISTS (SELECT id FROM expedition WHERE id = vExpeditionFk) THEN IF NOT (SELECT TRUE FROM expeditionPallet WHERE id = vPalletFk LIMIT 1) THEN
CALL util.throw('Expedition not exists'); CALL util.throw('Pallet not exists');
END IF; END IF;
REPLACE expeditionScan(expeditionFk, palletFk) REPLACE expeditionScan(expeditionFk, palletFk)

View File

@ -16,8 +16,7 @@ BEGIN
a.nickname, a.nickname,
sub2.itemPackingTypeConcat, sub2.itemPackingTypeConcat,
est.code, est.code,
es2.isScanned, es.isScanned
es2.scanOrder
FROM expedition e FROM expedition e
JOIN ticket t ON t.id = e.ticketFk JOIN ticket t ON t.id = e.ticketFk
JOIN ticketState ts ON ts.ticketFk = e.ticketFk JOIN ticketState ts ON ts.ticketFk = e.ticketFk
@ -39,7 +38,6 @@ BEGIN
SELECT MAX(id) SELECT MAX(id)
FROM expeditionState es FROM expeditionState es
WHERE expeditionFk = e.id) WHERE expeditionFk = e.id)
LEFT JOIN expeditionState es2 ON es2.id = es.id
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC; ORDER BY r.created, t.priority DESC;
END$$ END$$

View File

@ -1,93 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_selfConsumptionPackaging`(
vSelf INT,
vAction ENUM('add', 'remove')
)
BEGIN
/**
* Maneja el consumo de cajas para autoconsumo, permitiendo
* añadir o quitar cajas utilizadas según la acción indicada.
*
* @param vSelf Id de expedición
*/
DECLARE vClientFk INT;
DECLARE vAddressFk INT;
DECLARE vItemFk INT;
DECLARE vItemName VARCHAR(50);
DECLARE vWarehouseFk INT;
DECLARE vCreated DATE;
DECLARE vTicketFk INT;
DECLARE vSaleFk INT;
DECLARE vQuantity INT;
IF vAction NOT IN ('add', 'remove') THEN
CALL util.throw('Action not supported');
END IF;
SELECT pc.clientSelfConsumptionFk,
pc.addressSelfConsumptionFk,
i.id,
i.name,
t.warehouseFk,
e.created
INTO vClientFk,
vAddressFk,
vItemFk,
vItemName,
vWarehouseFk,
vCreated
FROM expedition e
JOIN packaging p ON p.id = e.packagingFk
JOIN item i ON i.id = p.itemFk
JOIN ticket t ON t.id = e.ticketFk
JOIN productionConfig pc
WHERE e.id = vSelf;
IF vClientFk IS NULL OR vAddressFk IS NULL THEN
CALL util.throw('Some config parameters are not set');
END IF;
SET vCreated = DATE(vCreated);
SELECT id INTO vTicketFk
FROM ticket
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
AND clientFk = vClientFk
AND addressFk = vAddressFk
AND warehouseFk = vWarehouseFk;
IF vTicketFk IS NULL AND vAction = 'add' THEN
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
VALUES (vClientFk, vWarehouseFk, vCreated, 'CAJAS AUTOCONSUMO', vAddressFk);
SET vTicketFk = LAST_INSERT_ID();
END IF;
SELECT id, quantity INTO vSaleFk, vQuantity
FROM sale
WHERE itemFk = vItemFk
AND ticketFk = vTicketFk
LIMIT 1;
IF vAction = 'add' THEN
IF vSaleFk IS NOT NULL THEN
UPDATE sale
SET quantity = quantity + 1
WHERE id = vSaleFk;
ELSE
INSERT INTO sale(itemFk, ticketFk, concept, quantity)
VALUES (vItemFk, vTicketFk, vItemName, 1);
END IF;
ELSE
IF vSaleFk IS NOT NULL THEN
IF vQuantity > 1 THEN
UPDATE sale
SET quantity = quantity - 1
WHERE id = vSaleFk;
ELSE
DELETE FROM sale WHERE id = vSaleFk;
END IF;
END IF;
END IF;
END$$
DELIMITER ;

Some files were not shown because too many files have changed in this diff Show More