Merge branch 'dev' into 6321_negative_tickets
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
ac7c28cd27
80
CHANGELOG.md
80
CHANGELOG.md
|
@ -1,3 +1,83 @@
|
||||||
|
# Version 24.28 - 2024-07-09
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- feat boxPicking refs #7357 by:sergiodt
|
||||||
|
- feat boxPicking refs #7357 (origin/7357_dipole_review) by:sergiodt
|
||||||
|
- feat:concurrency issue refs #6861 by:Carlos Andrés
|
||||||
|
- feat expeditionPalletPrint refs #5210 by:sergiodt
|
||||||
|
- feat front-reservas refs #6861 (origin/6861-Reservas-front) by:sergiodt
|
||||||
|
- feat itemShelving_filterBuyer refs #7023 by:sergiodt
|
||||||
|
- feat itemShelvingLog refs #7168 by:sergiodt
|
||||||
|
- feat itemShelvingSale refs #6861 by:sergiodt
|
||||||
|
- feat: previas con reserva refs #6861 by:Carlos Andrés
|
||||||
|
- feat: previas con sitema de reservas refs #6861 by:Carlos Andrés
|
||||||
|
- feat: previas con sitema de reservas refs #6861 (origin/6861-Pasar-modo-trabajo-de-previa-a-reservas) by:Carlos Andrés
|
||||||
|
- feat refactor setParking REGEXP refs #7575 (origin/7575_setParking_regExp) by:sergiodt
|
||||||
|
- feat: refs #6238 add travelKgPercentage table and model (origin/6238-addPercentage) by:jorgep
|
||||||
|
- feat: refs #6286 check if is teamBoss (origin/6286-setRightWorkerTimeControlAcls) by:jorgep
|
||||||
|
- feat: refs #6701 Fix error by:guillermo
|
||||||
|
- feat: refs #6861 trigger by:sergiodt
|
||||||
|
- feat: refs #7027 mailError managed by:jgallego
|
||||||
|
- feat: refs #7168 Added vRecords param in proc by:guillermo
|
||||||
|
- feat: refs #7168 Minor change by:guillermo
|
||||||
|
- feat: refs #7216 logUnpaid (origin/7216-clientUnpaid) by:jgallego
|
||||||
|
- feat: refs #7216 triggers by:jgallego
|
||||||
|
- feat: refs #7296 by:robert
|
||||||
|
- feat: refs #7296 drop column expeditionTruckFk by:robert
|
||||||
|
- feat: refs #7490 Changes (origin/7490-duaInvoiceInBooking) by:guillermo
|
||||||
|
- feat: refs #7545 Deleted hasIncoterms client column (origin/7545-hasIncoterms) by:guillermo
|
||||||
|
- feat: refs #7555 remove account.password__ by:alexm
|
||||||
|
- feat: return sql check error by:alexm
|
||||||
|
- feat roadmap refs #7195 by:sergiodt
|
||||||
|
- #refs 5890 feat:add assignCollection by:sergiodt
|
||||||
|
- refs#5890 feat: delete trigger and modify getTickets by:sergiodt
|
||||||
|
- refs #5890 feat:itemShelving_add by:sergiodt
|
||||||
|
- refs #5890 feat:reserves by:sergiodt
|
||||||
|
- refs #5890 feat:trigger by:sergiodt
|
||||||
|
- refs #5890 feat: triggers by:sergiodt
|
||||||
|
- refs #6861 feat: getLock by:sergiodt
|
||||||
|
- refs #6861 feat: obsrevation by:sergiodt
|
||||||
|
- refs #6861 feat: previas a reservas by:sergiodt
|
||||||
|
- refs #6861 feat:reserve previos by:sergiodt
|
||||||
|
- refs #6861 feat: reservePrevious by:sergiodt
|
||||||
|
- refs #6861 feat:reserveWithReservation by:sergiodt
|
||||||
|
- refs #6861 feat:sectoCollection reserve by:sergiodt
|
||||||
|
- refs #6861 feat: skipTest by:sergiodt
|
||||||
|
- refs #6861 feat: trigger by:sergiodt
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- feat refactor setParking REGEXP refs #7575 (origin/7575_setParking_regExp) by:sergiodt
|
||||||
|
- refactor: refs #5447 changed models by:Jon
|
||||||
|
- refactor: refs #6238 drop useless round by:jorgep
|
||||||
|
- refactor: refs #6286 replace name by:jorgep
|
||||||
|
- refactor: refs #6701 Refactor claim_ratio_routine by:guillermo
|
||||||
|
- refactor: refs #7490 Added final update by:guillermo
|
||||||
|
- refactor: refs #7490 Deleted update duaInvoiceInBooking by:guillermo
|
||||||
|
- refactor: refs #7490 Minor changes by:guillermo
|
||||||
|
- refactor: refs #7519 Minor change by:guillermo
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- acls, fixtures, models by:carlossa
|
||||||
|
- fix: refs #6238 delete unused SQL script by:jorgep
|
||||||
|
- fix: refs #6238 insert ignore by:jorgep
|
||||||
|
- fix: refs #6238 use scheme by:jorgep
|
||||||
|
- fix: refs #6286 replace id for reason by:jorgep
|
||||||
|
- fix: refs #6286 update WorkerTimeControl permissions by:jorgep
|
||||||
|
- fix(WorkerIncome): refs #7409 fix models by:alexm
|
||||||
|
- refs #5890 fix: dev by:sergiodt
|
||||||
|
- refs #6897 fix entry Salix by:carlossa
|
||||||
|
- refs #6897 fix es.yml by:carlossa
|
||||||
|
- refs #6897 fix redirection by:carlossa
|
||||||
|
- refs #6897 fix remove by:carlossa
|
||||||
|
- refs #7406 fix back by:carlossa
|
||||||
|
- refs #7406 fix pr by:carlossa
|
||||||
|
- refs #7409 fix acls by:carlossa
|
||||||
|
- refs #7409 fix back (origin/7409-workerIncome) by:carlossa
|
||||||
|
- refs #7409 fix pr by:carlossa
|
||||||
|
|
||||||
# Version 24.24 - 2024-06-11
|
# Version 24.24 - 2024-06-11
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -60,15 +60,17 @@ 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) {
|
for (let ticket of tickets) {
|
||||||
let observations = ticket.observaciones.split(' ');
|
if (ticket.observaciones) {
|
||||||
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
for (let observation of observations) {
|
for (let observation of observations) {
|
||||||
const salesPerson = ticket.salesPersonFk;
|
const salesPerson = ticket.salesPersonFk;
|
||||||
if (observation.startsWith('#') || observation.startsWith('@')) {
|
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||||
await models.Chat.send(ctx,
|
await models.Chat.send(ctx,
|
||||||
observation,
|
observation,
|
||||||
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,7 @@ module.exports = Self => {
|
||||||
iss.isPicked
|
iss.isPicked
|
||||||
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 ticket t ON t.id = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
|
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||||
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
|
||||||
|
@ -103,9 +102,8 @@ module.exports = Self => {
|
||||||
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
|
||||||
JOIN ticket t ON t.id = sg.ticketFk
|
LEFT JOIN saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.id = sgd.saleFk
|
||||||
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
|
|
||||||
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
|
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
|
||||||
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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<soap:Header>
|
<soap:Header>
|
||||||
<mrw:AuthInfo>
|
<mrw:AuthInfo>
|
||||||
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
||||||
<mrw:CodigoAbonado><%= mrw.subscriberCode %></mrw:CodigoAbonado>
|
<mrw:CodigoAbonado><%= clientType %></mrw:CodigoAbonado>
|
||||||
<mrw:CodigoDepartamento/>
|
<mrw:CodigoDepartamento/>
|
||||||
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
||||||
<mrw:Password><%= mrw.password %></mrw:Password>
|
<mrw:Password><%= mrw.password %></mrw:Password>
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = Self => {
|
||||||
required: true
|
required: true
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: ['object'],
|
type: 'boolean',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -27,9 +27,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
const mrw = await models.MrwConfig.findOne();
|
const mrw = await models.MrwConfig.findOne();
|
||||||
const {externalId} = await models.Expedition.findById(expeditionFk);
|
const {externalId} = await models.Expedition.findById(expeditionFk);
|
||||||
|
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
||||||
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
||||||
const renderedXml = ejs.render(template, {mrw, externalId});
|
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
||||||
const response = await axios.post(mrw.url, renderedXml, {
|
const response = await axios.post(mrw.url, renderedXml, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/soap+xml; charset=utf-8'
|
'Content-Type': 'application/soap+xml; charset=utf-8'
|
||||||
|
@ -39,6 +39,7 @@ 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');
|
||||||
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||||
|
return result.toLowerCase().includes('se ha cancelado correctamente');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<soap:Header>
|
<soap:Header>
|
||||||
<mrw:AuthInfo>
|
<mrw:AuthInfo>
|
||||||
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
||||||
<mrw:CodigoAbonado><%= mrw.subscriberCode %></mrw:CodigoAbonado>
|
<mrw:CodigoAbonado><%= clientType %></mrw:CodigoAbonado>
|
||||||
<mrw:CodigoDepartamento/>
|
<mrw:CodigoDepartamento/>
|
||||||
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
||||||
<mrw:Password><%= mrw.password %></mrw:Password>
|
<mrw:Password><%= mrw.password %></mrw:Password>
|
||||||
|
|
|
@ -22,6 +22,7 @@ module.exports = Self => {
|
||||||
Self.createShipment = async expeditionFk => {
|
Self.createShipment = async expeditionFk => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const mrw = await Self.getConfig();
|
const mrw = await Self.getConfig();
|
||||||
|
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
||||||
|
|
||||||
const today = Date.vnNew();
|
const today = Date.vnNew();
|
||||||
const [hours, minutes] = mrw?.expeditionDeadLine ? mrw.expeditionDeadLine.split(':').map(Number) : [0, 0];
|
const [hours, minutes] = mrw?.expeditionDeadLine ? mrw.expeditionDeadLine.split(':').map(Number) : [0, 0];
|
||||||
|
@ -50,7 +51,7 @@ module.exports = Self => {
|
||||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||||
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
|
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
|
||||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||||
oa.description deliveryObservation
|
oa.description deliveryObservation
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
|
@ -62,8 +63,7 @@ module.exports = Self => {
|
||||||
JOIN client c ON t.clientFk = c.id
|
JOIN client c ON t.clientFk = c.id
|
||||||
JOIN address a ON t.addressFk = a.id
|
JOIN address a ON t.addressFk = a.id
|
||||||
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||||
LEFT JOIN observationType ot ON ot.id = oa.observationTypeFk
|
AND oa.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'delivery')
|
||||||
AND ot.code = 'delivery'
|
|
||||||
JOIN province p ON a.provinceFk = p.id
|
JOIN province p ON a.provinceFk = p.id
|
||||||
JOIN country co ON co.id = p.countryFk
|
JOIN country co ON co.id = p.countryFk
|
||||||
JOIN mrwConfig mc
|
JOIN mrwConfig mc
|
||||||
|
@ -72,22 +72,19 @@ module.exports = Self => {
|
||||||
|
|
||||||
const [expeditionData] = await Self.rawSql(query, [expeditionFk]);
|
const [expeditionData] = await Self.rawSql(query, [expeditionFk]);
|
||||||
|
|
||||||
if (!expeditionData)
|
|
||||||
throw new UserError(`This expedition is not a MRW shipment`);
|
|
||||||
|
|
||||||
if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today.setHours(0, 0, 0, 0))
|
if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today.setHours(0, 0, 0, 0))
|
||||||
throw new UserError(`This ticket has a shipped date earlier than today`);
|
throw new UserError(`This ticket has a shipped date earlier than today`);
|
||||||
|
|
||||||
const shipmentResponse = await Self.sendXmlDoc(
|
const shipmentResponse = await Self.sendXmlDoc(
|
||||||
__dirname + `/createShipment.ejs`,
|
__dirname + `/createShipment.ejs`,
|
||||||
{mrw, expeditionData},
|
{mrw, expeditionData, clientType},
|
||||||
'application/soap+xml'
|
'application/soap+xml'
|
||||||
);
|
);
|
||||||
const shipmentId = Self.getTextByTag(shipmentResponse, 'NumeroEnvio');
|
const shipmentId = Self.getTextByTag(shipmentResponse, 'NumeroEnvio');
|
||||||
|
|
||||||
if (!shipmentId) throw new UserError(Self.getTextByTag(shipmentResponse, 'Mensaje'));
|
if (!shipmentId) throw new UserError(Self.getTextByTag(shipmentResponse, 'Mensaje'));
|
||||||
|
|
||||||
const file = await models.MrwConfig.getLabel(shipmentId);
|
const file = await models.MrwConfig.getLabel(shipmentId, clientType);
|
||||||
|
|
||||||
return {shipmentId, file};
|
return {shipmentId, file};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<soapenv:Header>
|
<soapenv:Header>
|
||||||
<mrw:AuthInfo>
|
<mrw:AuthInfo>
|
||||||
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
|
||||||
<mrw:CodigoAbonado><%= mrw.subscriberCode %></mrw:CodigoAbonado>
|
<mrw:CodigoAbonado><%= clientType %></mrw:CodigoAbonado>
|
||||||
<mrw:CodigoDepartamento/>
|
<mrw:CodigoDepartamento/>
|
||||||
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
<mrw:UserName><%= mrw.user %></mrw:UserName>
|
||||||
<mrw:Password><%= mrw.password %></mrw:Password>
|
<mrw:Password><%= mrw.password %></mrw:Password>
|
||||||
|
|
|
@ -6,7 +6,13 @@ module.exports = Self => {
|
||||||
arg: 'shipmentId',
|
arg: 'shipmentId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true
|
required: true
|
||||||
}],
|
},
|
||||||
|
{
|
||||||
|
arg: 'clientType',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
root: true
|
root: true
|
||||||
|
@ -17,10 +23,14 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getLabel = async shipmentId => {
|
Self.getLabel = async(shipmentId, clientType) => {
|
||||||
const mrw = await Self.getConfig();
|
const mrw = await Self.getConfig();
|
||||||
|
|
||||||
const getLabelResponse = await Self.sendXmlDoc(__dirname + `/getLabel.ejs`, {mrw, shipmentId}, 'text/xml');
|
const getLabelResponse = await Self.sendXmlDoc(
|
||||||
|
__dirname + `/getLabel.ejs`,
|
||||||
|
{mrw, shipmentId, clientType},
|
||||||
|
'text/xml'
|
||||||
|
);
|
||||||
|
|
||||||
return Self.getTextByTag(getLabelResponse, 'EtiquetaFile');
|
return Self.getTextByTag(getLabelResponse, 'EtiquetaFile');
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,15 +40,12 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await models.MrwService.create(
|
||||||
|
{'agencyModeCodeFk': 'mrw', 'clientType': '000001', 'serviceType': 105, 'kg': 10}
|
||||||
|
);
|
||||||
|
|
||||||
await createMrwConfig();
|
await createMrwConfig();
|
||||||
|
|
||||||
await models.Application.rawSql(
|
|
||||||
`INSERT INTO vn.mrwService
|
|
||||||
SET agencyModeCodeFk = 'mrw',
|
|
||||||
clientType = 1,
|
|
||||||
serviceType = 1,
|
|
||||||
kg = 1`, null
|
|
||||||
);
|
|
||||||
await models.Ticket.create(ticket1);
|
await models.Ticket.create(ticket1);
|
||||||
await models.Expedition.create(expedition1);
|
await models.Expedition.create(expedition1);
|
||||||
});
|
});
|
||||||
|
@ -82,7 +79,8 @@ describe('MRWConfig createShipment()', () => {
|
||||||
'user': 'user',
|
'user': 'user',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
'franchiseCode': 'franchiseCode',
|
'franchiseCode': 'franchiseCode',
|
||||||
'subscriberCode': 'subscriberCode'
|
'subscriberCode': 'subscriberCode',
|
||||||
|
'clientTypeWidth': 6
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -115,10 +113,10 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should fail if expeditionFk is not a MrwExpedition', async() => {
|
it('should fail if expeditionFk is not a MrwExpedition', async() => {
|
||||||
let error;
|
let error;
|
||||||
await models.MrwConfig.createShipment(undefined).catch(e => {
|
await models.MrwConfig.createShipment(15).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
}).finally(async() => {
|
}).finally(async() => {
|
||||||
expect(error.message).toEqual(`This expedition is not a MRW shipment`);
|
expect(error.message).toEqual(`ClientType not available`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.renderer = async (expeditionFk) => {
|
Self.renderer = async expeditionFk => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
const viaexpressConfig = await models.ViaexpressConfig.findOne({
|
const viaexpressConfig = await models.ViaexpressConfig.findOne({
|
||||||
|
@ -109,7 +109,7 @@ module.exports = Self => {
|
||||||
const ticket = expedition.ticket();
|
const ticket = expedition.ticket();
|
||||||
const sender = ticket.company().client();
|
const sender = ticket.company().client();
|
||||||
const shipped = ticket.shipped.toISOString();
|
const shipped = ticket.shipped.toISOString();
|
||||||
const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk)
|
const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk);
|
||||||
const data = {
|
const data = {
|
||||||
viaexpressConfig,
|
viaexpressConfig,
|
||||||
sender,
|
sender,
|
||||||
|
|
|
@ -192,5 +192,8 @@
|
||||||
},
|
},
|
||||||
"RouteConfig": {
|
"RouteConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"MrwService": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,5 +31,30 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
return parser.parseFromString(data.data, 'text/xml');
|
return parser.parseFromString(data.data, 'text/xml');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Self.getClientType = async function(expeditionFk) {
|
||||||
|
if (!expeditionFk) throw new UserError(`No expeditionFk defined`);
|
||||||
|
|
||||||
|
const {clientTypeWidth} = await Self.getConfig();
|
||||||
|
const result = await Self.app.models.Expedition.findById(expeditionFk,
|
||||||
|
{include: [{
|
||||||
|
relation: 'ticket',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'agencyMode',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'mrwService',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]}
|
||||||
|
);
|
||||||
|
const clientType = result?.ticket()?.agencyMode()?.mrwService()?.clientType;
|
||||||
|
if (!clientType || !clientTypeWidth) throw new UserError(`ClientType not available`);
|
||||||
|
|
||||||
|
return clientType.toString().padStart(clientTypeWidth, '0');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
},
|
},
|
||||||
"notified":{
|
"notified":{
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
},
|
||||||
|
"clientTypeWidth": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "MrwService",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "mrwService"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"agencyModeCodeFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"clientType": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"serviceType": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"kg": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"agency": {
|
||||||
|
"type": "hasOne",
|
||||||
|
"model": "AgencyMode",
|
||||||
|
"foreignKey": "code"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,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','11114','cf0f80142fed798c3307565a69158d7dba9276c4','2024-06-25 09:25:54','11115');
|
INSERT INTO `version` VALUES ('vn-database','11117','5558e69e648c3819d4a1edf86f8df4b94d36e71a','2024-07-09 07:39:39','11141');
|
||||||
|
|
||||||
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);
|
||||||
|
@ -644,6 +644,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10849','15-invoiceInLog.sql','je
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10852','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:37',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL);
|
||||||
|
@ -776,6 +777,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','je
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10978','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:33',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10978','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:33',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10983','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:37',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
||||||
|
@ -844,24 +846,39 @@ INSERT INTO `versionLog` VALUES ('vn-database','11068','00-firstScript.sql','jen
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11069','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11069','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11070','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11070','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11073','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11074','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11074','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11075','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-28 12:54:13',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11075','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-28 12:54:13',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11078','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11078','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11079','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 08:22:10',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11079','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 08:22:10',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11080','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 12:01:58',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11080','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 12:01:58',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11081','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11082','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11082','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-03 10:46:36',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-03 10:46:36',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','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','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','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);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11093','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11093','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','11096','00-addBuyerAcl.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 12:48:51',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','11096','00-addBuyerAcl.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 12:48:51',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11099','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11100','00-modifyTimeControlAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11101','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11102','00-createTravelKgPercentage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11103','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','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','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','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','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','11134','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-05 11:02:07',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','11139','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-08 10:58:01',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 */;
|
||||||
|
@ -958,6 +975,7 @@ INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11
|
||||||
INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL);
|
INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL);
|
||||||
INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783);
|
INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783);
|
||||||
INSERT INTO `role` VALUES (130,'reviewer','Revisor de producción',1,'2024-06-11 00:00:00','2024-06-11 00:00:00',10578);
|
INSERT INTO `role` VALUES (130,'reviewer','Revisor de producción',1,'2024-06-11 00:00:00','2024-06-11 00:00:00',10578);
|
||||||
|
INSERT INTO `role` VALUES (131,'supplier','Privilegios básicos de un proveedor',1,'2024-07-05 10:18:58','2024-07-05 10:18:58',19295);
|
||||||
|
|
||||||
INSERT INTO `roleInherit` VALUES (1,1,2,NULL);
|
INSERT INTO `roleInherit` VALUES (1,1,2,NULL);
|
||||||
INSERT INTO `roleInherit` VALUES (2,1,3,NULL);
|
INSERT INTO `roleInherit` VALUES (2,1,3,NULL);
|
||||||
|
@ -1228,6 +1246,8 @@ INSERT INTO `roleInherit` VALUES (368,130,49,10578);
|
||||||
INSERT INTO `roleInherit` VALUES (369,50,130,10578);
|
INSERT INTO `roleInherit` VALUES (369,50,130,10578);
|
||||||
INSERT INTO `roleInherit` VALUES (370,72,130,10578);
|
INSERT INTO `roleInherit` VALUES (370,72,130,10578);
|
||||||
INSERT INTO `roleInherit` VALUES (371,36,35,NULL);
|
INSERT INTO `roleInherit` VALUES (371,36,35,NULL);
|
||||||
|
INSERT INTO `roleInherit` VALUES (372,126,13,19295);
|
||||||
|
INSERT INTO `roleInherit` VALUES (373,131,2,19295);
|
||||||
|
|
||||||
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
|
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
|
||||||
|
|
||||||
|
@ -1886,12 +1906,12 @@ INSERT INTO `ACL` VALUES (772,'Route','getExpeditionSummary','READ','ALLOW','ROL
|
||||||
INSERT INTO `ACL` VALUES (773,'WorkerTimeControl','login','READ','ALLOW','ROLE','timeControl');
|
INSERT INTO `ACL` VALUES (773,'WorkerTimeControl','login','READ','ALLOW','ROLE','timeControl');
|
||||||
INSERT INTO `ACL` VALUES (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl');
|
INSERT INTO `ACL` VALUES (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl');
|
||||||
INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl');
|
INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl');
|
||||||
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||||
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||||
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||||
INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','developer');
|
||||||
INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateWorkerTimeControlMail','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateMailState','WRITE','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','teamBoss');
|
||||||
INSERT INTO `ACL` VALUES (782,'WorkerTimeControl','getMailStates','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (782,'WorkerTimeControl','getMailStates','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee');
|
||||||
|
@ -1941,7 +1961,6 @@ INSERT INTO `ACL` VALUES (830,'InvoiceIn','*','READ','ALLOW','ROLE','deliveryBos
|
||||||
INSERT INTO `ACL` VALUES (831,'InvoiceIn','exchangeRateUpdate','*','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (831,'InvoiceIn','exchangeRateUpdate','*','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (832,'AgencyLog','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (832,'AgencyLog','*','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (833,'AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (833,'AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (834,'AgencyMode','*','READ','ALLOW','ROLE','employee');
|
|
||||||
INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
||||||
INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
||||||
|
@ -1983,6 +2002,24 @@ INSERT INTO `ACL` VALUES (874,'Roadmap','*','READ','ALLOW','ROLE','production');
|
||||||
INSERT INTO `ACL` VALUES (875,'RoadmapStop','*','WRITE','ALLOW','ROLE','palletizerBoss');
|
INSERT INTO `ACL` VALUES (875,'RoadmapStop','*','WRITE','ALLOW','ROLE','palletizerBoss');
|
||||||
INSERT INTO `ACL` VALUES (876,'RoadmapStop','*','READ','ALLOW','ROLE','production');
|
INSERT INTO `ACL` VALUES (876,'RoadmapStop','*','READ','ALLOW','ROLE','production');
|
||||||
INSERT INTO `ACL` VALUES (877,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (877,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `ACL` VALUES (878,'MrwConfig','getLabel','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `ACL` VALUES (879,'AgencyMode','*','*','ALLOW','ROLE','deliveryAssistant');
|
||||||
|
INSERT INTO `ACL` VALUES (880,'Collection','assignCollection','WRITE','ALLOW','ROLE','production');
|
||||||
|
INSERT INTO `ACL` VALUES (881,'TrainingCourse','*','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (882,'TrainingCourseType','*','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (883,'TrainingCenter','*','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (884,'Worker','__get__trainingCourse','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (885,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (886,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (887,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (888,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (889,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (890,'WorkerTimeControl','updateMailState','WRITE','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (891,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `ACL` VALUES (892,'WorkerIncome','*','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (893,'PayrollComponent','*','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (894,'Worker','__get__incomes','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO `ACL` VALUES (895,'ItemShelvingLog','*','READ','ALLOW','ROLE','production');
|
||||||
|
|
||||||
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');
|
||||||
|
|
|
@ -259,7 +259,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran'
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
|
@ -281,8 +281,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','inter','ale
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buySource','alexm@%','0000-00-00 00:00:00','Select','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buy_edi','alexm@%','0000-00-00 00:00:00','Select','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -313,7 +311,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Cajas','
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Compres','alexm@%','0000-00-00 00:00:00','Select,Update','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -348,7 +345,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','empresa','alex
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','sectorType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','sectorType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Compres','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -364,7 +361,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','tickets_
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@%','0000-00-00 00:00:00','Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -372,9 +369,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','flight','jenki
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','zones','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','zones','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','businessReasonEnd','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','businessCalendar','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','buy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','business','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buySource','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','budgetNotes','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','budgetNotes','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','specialLabels','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','specialLabels','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetDms','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetDms','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||||
|
@ -383,7 +380,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','grafana','offerList','juan@d
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bookingPlanner','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bookingPlanner','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetInvoiceIn','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetInvoiceIn','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','beach','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','beach','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','business','alexm@%','0000-00-00 00:00:00','Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','business','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_revisar','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_revisar','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Select,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Select,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
|
@ -414,7 +411,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Ordenes','alexm@%','0000-00-00 00:00:00','Select,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Ordenes','alexm@%','0000-00-00 00:00:00','Select,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','awb','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awb','alexm@%','0000-00-00 00:00:00','Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awb','alexm@%','0000-00-00 00:00:00','Update','');
|
||||||
|
@ -485,7 +481,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','absenceType','alexm@%','
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buyMark','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendarHolidays','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendarHolidays','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claim','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claim','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -638,7 +633,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeGroup','a
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','floramondoNotOfferDay__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','floramondoNotOfferDay__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','fuelType','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','fuelType','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeDMS','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeDMS','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','genericAllocation','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppe','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppe','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','glsExpedition__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','glsExpedition__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
|
@ -744,7 +738,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','mrw','guille
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwService','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwService','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppePlan','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppePlan','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','accountingConfig','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','accountingConfig','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@%','0000-00-00 00:00:00','Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
||||||
|
@ -759,9 +753,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','moving','guill
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDetail','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDetail','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDms','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDms','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awb','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awb','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machine','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machine','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buy','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_dits','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_dits','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','coolerBoss','rotacion','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','coolerBoss','rotacion','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -909,7 +902,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketService','a
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketServiceType','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketServiceType','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketState','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketState','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketStateToday','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketStateToday','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','claims_ratio','alexm@%','0000-00-00 00:00:00','Select','');
|
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greugeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greugeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','time','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','time','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketWeekly','alexm@%','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketWeekly','alexm@%','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -1404,6 +1396,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guill
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','greenhouseBoss','business','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','teamBoss','business','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketServiceType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','business','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierAgencyTerm','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientRate','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert','Update');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert','Update');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
@ -1422,6 +1420,17 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','expedition
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','failureLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','failureLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','movingLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','movingLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','sorterLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','sorterLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','genericAllocation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','businessReasonEnd','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buySource','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','salesPerson','claims_ratio','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran_gestdoc','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran_state','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNoteDms','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNoteState','guillermo@db-proxy1.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 */;
|
||||||
|
@ -1481,6 +1490,10 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','user_id','0
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','extension','0000-00-00 00:00:00','Select');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','extension','0000-00-00 00:00:00','Select');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','name','0000-00-00 00:00:00','Select');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','name','0000-00-00 00:00:00','Select');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','workerFk','0000-00-00 00:00:00','Select');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','id','0000-00-00 00:00:00','Select');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','departmentFk','0000-00-00 00:00:00','Select');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','companyCodeFk','0000-00-00 00:00:00','Select');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','routeFk','0000-00-00 00:00:00','Update');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','routeFk','0000-00-00 00:00:00','Update');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','name','0000-00-00 00:00:00','Update');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','name','0000-00-00 00:00:00','Update');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','beachFk','0000-00-00 00:00:00','Update');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','beachFk','0000-00-00 00:00:00','Update');
|
||||||
|
@ -2018,7 +2031,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_hasrouti
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','account','grafana','user_hasRole','FUNCTION','jgallego@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','account','grafana','user_hasRole','FUNCTION','jgallego@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','time_generate','PROCEDURE','jenkins@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','time_generate','PROCEDURE','jenkins@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addbyclaim','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addbyclaim','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvingtransfer','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_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','production','item_getsimilar','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','item_getsimilar','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
|
@ -2070,7 +2082,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_add','
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_getsaledate','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_getsaledate','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_filterbuyer','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_filterbuyer','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_addbyclaim','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelvingtransfer','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','delivery','item_getsimilar','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','item_getsimilar','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
|
@ -2185,7 +2196,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"vers
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
||||||
|
@ -2201,7 +2212,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"ver
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','maintenance','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','maintenance','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true,\"version_id\":101106}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true,\"version_id\":101106}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
|
@ -2220,6 +2231,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}');
|
||||||
|
INSERT IGNORE INTO `global_priv` VALUES ('','teamBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
/*!40000 ALTER TABLE `global_priv` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `global_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
|
@ -3616,6 +3616,46 @@ 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=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeInsert`
|
||||||
|
BEFORE INSERT ON `clientUnpaid`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
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=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientUnpaid_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `clientUnpaid`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
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=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete`
|
||||||
BEFORE DELETE ON `cmr`
|
BEFORE DELETE ON `cmr`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -4671,11 +4711,9 @@ BEGIN
|
||||||
IF NEW.isBooked = OLD.isBooked AND (
|
IF NEW.isBooked = OLD.isBooked AND (
|
||||||
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
||||||
NOT (NEW.dated <=> OLD.dated) OR
|
NOT (NEW.dated <=> OLD.dated) OR
|
||||||
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
|
|
||||||
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
||||||
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
||||||
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
||||||
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
|
|
||||||
NOT (NEW.typeFk <=> OLD.typeFk)
|
NOT (NEW.typeFk <=> OLD.typeFk)
|
||||||
) THEN
|
) THEN
|
||||||
|
|
||||||
|
@ -6144,6 +6182,7 @@ DELIMITER ;;
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
SET NEW.userFk = account.myUser_getId();
|
SET NEW.userFk = account.myUser_getId();
|
||||||
|
SET NEW.available = NEW.visible;
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
@ -6160,48 +6199,20 @@ 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=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterInsert`
|
|
||||||
AFTER INSERT ON `itemShelving`
|
|
||||||
FOR EACH ROW
|
|
||||||
INSERT INTO vn.itemShelvingLog( itemShelvingFk,
|
|
||||||
workerFk,
|
|
||||||
accion,
|
|
||||||
itemFk,
|
|
||||||
shelvingFk,
|
|
||||||
visible,
|
|
||||||
`grouping`,
|
|
||||||
packing)
|
|
||||||
VALUES( NEW.id,
|
|
||||||
NEW.userFk,
|
|
||||||
'CREA REGISTRO',
|
|
||||||
NEW.itemFk,
|
|
||||||
NEW.shelvingFk,
|
|
||||||
NEW.visible,
|
|
||||||
NEW.`grouping`,
|
|
||||||
NEW.packing
|
|
||||||
) */;;
|
|
||||||
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=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
|
||||||
BEFORE UPDATE ON `itemShelving`
|
BEFORE UPDATE ON `itemShelving`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
IF NEW.userFk IS NULL THEN
|
IF NEW.userFk IS NULL THEN
|
||||||
SET NEW.userFk = account.myUser_getId();
|
SET NEW.userFk = account.myUser_getId();
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF (NEW.visible <> OLD.visible) THEN
|
||||||
|
SET NEW.available = GREATEST(NEW.available + NEW.visible - OLD.visible, 0);
|
||||||
|
END IF;
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -6220,7 +6231,8 @@ DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
|
||||||
AFTER UPDATE ON `itemShelving`
|
AFTER UPDATE ON `itemShelving`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
INSERT INTO itemShelvingLog
|
BEGIN
|
||||||
|
INSERT INTO itemShelvingLog
|
||||||
SET itemShelvingFk = NEW.id,
|
SET itemShelvingFk = NEW.id,
|
||||||
workerFk = account.myUser_getId(),
|
workerFk = account.myUser_getId(),
|
||||||
accion = 'CAMBIO',
|
accion = 'CAMBIO',
|
||||||
|
@ -6228,7 +6240,10 @@ INSERT INTO itemShelvingLog
|
||||||
shelvingFk = NEW.shelvingFk,
|
shelvingFk = NEW.shelvingFk,
|
||||||
visible = NEW.visible,
|
visible = NEW.visible,
|
||||||
`grouping` = NEW.`grouping`,
|
`grouping` = NEW.`grouping`,
|
||||||
packing = NEW.packing */;;
|
packing = NEW.packing,
|
||||||
|
available = NEW.available;
|
||||||
|
|
||||||
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||||
|
@ -6297,12 +6312,12 @@ DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
|
||||||
AFTER INSERT ON `itemShelvingSale`
|
AFTER INSERT ON `itemShelvingSale`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
UPDATE vn.sale
|
UPDATE sale s
|
||||||
SET isPicked = TRUE
|
JOIN operator o ON o.workerFk = account.myUser_getId()
|
||||||
WHERE id = NEW.saleFk;
|
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
|
||||||
|
WHERE id = NEW.saleFk;
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -10924,4 +10939,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-06-25 7:27:06
|
-- Dump completed on 2024-07-09 5:48:24
|
||||||
|
|
|
@ -314,5 +314,4 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`)
|
||||||
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
|
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
|
||||||
FROM mysql.roles_mapping
|
FROM mysql.roles_mapping
|
||||||
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
|
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
|
||||||
|
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
|
|
|
@ -115,10 +115,13 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
||||||
VALUES
|
VALUES
|
||||||
(1, 978, 1, 0, 2000, 9, 0);
|
(1, 978, 1, 0, 2000, 9, 0);
|
||||||
|
|
||||||
|
INSERT INTO hedera.orderConfig (`id`, `employeeFk`, `defaultAgencyFk`, `guestMethod`, `guestAgencyFk`, `reserveTime`, `defaultCompanyFk`)
|
||||||
|
VALUES (1, 1, 2, 'PICKUP', 1, '00:20:00', 442);
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'brucewayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'),
|
(1101, 'brucewayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'),
|
||||||
(1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en','1102'),
|
(1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 131, 1, 'PetterParker@mydomain.com', 'en','1102'),
|
||||||
(1103, 'clarkkent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'),
|
(1103, 'clarkkent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'),
|
||||||
(1104, 'tonystark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'),
|
(1104, 'tonystark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'),
|
||||||
(1105, 'maxeisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'),
|
(1105, 'maxeisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'),
|
||||||
|
@ -301,6 +304,17 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
|
||||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
|
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
|
||||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10;
|
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10;
|
||||||
|
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'inhouse pickup' WHERE `id` = 1;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Super-Man delivery' WHERE `id` = 2;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Teleportation device' WHERE `id` = 3;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Entanglement' WHERE `id` = 4;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Quantum break device' WHERE `id` = 5;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Walking' WHERE `id` = 6;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Gotham247' WHERE `id` = 7;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Gotham247Expensive' WHERE `id` = 8;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Other agency' WHERE `id` = 10;
|
||||||
|
UPDATE `vn`.`agencyMode` SET `description` = 'Refund' WHERE `id` = 23;
|
||||||
|
|
||||||
UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com';
|
UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com';
|
||||||
|
|
||||||
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
||||||
|
@ -528,7 +542,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
|
||||||
(5, 'Administrative', 'administrative'),
|
(5, 'Administrative', 'administrative'),
|
||||||
(6, 'Weight', 'weight'),
|
(6, 'Weight', 'weight'),
|
||||||
(7, 'InvoiceOut', 'invoiceOut'),
|
(7, 'InvoiceOut', 'invoiceOut'),
|
||||||
(8, 'DropOff', 'dropOff');
|
(8, 'DropOff', 'dropOff'),
|
||||||
|
(9, 'Sustitución', 'substitution');
|
||||||
|
|
||||||
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -978,6 +993,14 @@ INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`
|
||||||
(2, 3, 10, 10, 10, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()),
|
(2, 3, 10, 10, 10, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()),
|
||||||
(3, 13, 8.5, 10, 7.5, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 1, 2, util.VN_CURDATE());
|
(3, 13, 8.5, 10, 7.5, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 1, 2, util.VN_CURDATE());
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`itemMinimumQuantity`(`itemFk`, `quantity`, `started`, `ended`, `warehouseFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 5, util.VN_CURDATE() - INTERVAL 2 MONTH, util.VN_CURDATE() + INTERVAL 1 MONTH, 1),
|
||||||
|
(2, 10, util.VN_CURDATE() - INTERVAL 2 DAY, util.VN_CURDATE() - INTERVAL 1 DAY, 2),
|
||||||
|
(3, 15, util.VN_CURDATE() + INTERVAL 3 DAY, util.VN_CURDATE() + INTERVAL 2 WEEK, 3),
|
||||||
|
(2, 10, util.VN_CURDATE() + INTERVAL 2 MONTH, NULL, 5),
|
||||||
|
(4, 8, util.VN_CURDATE() - INTERVAL 3 MONTH, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`)
|
INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`)
|
||||||
VALUES
|
VALUES
|
||||||
(71,0.141,1);
|
(71,0.141,1);
|
||||||
|
@ -1476,7 +1499,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
|
||||||
(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),
|
(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),
|
||||||
(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),
|
(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),
|
||||||
(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),
|
(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),
|
||||||
(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);
|
(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),
|
||||||
|
(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);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1487,7 +1511,9 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
||||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
|
(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, 0, 'observation six'),
|
(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, 0, 'observation seven'),
|
(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, 1, '');
|
(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, 1, ''),
|
||||||
|
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
|
||||||
|
|
||||||
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
|
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3920,3 +3946,19 @@ VALUES(1, '');
|
||||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||||
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||||
|
|
||||||
|
INSERT INTO vn.accountDetail
|
||||||
|
(id, value, accountDetailTypeFk, supplierAccountFk)
|
||||||
|
VALUES
|
||||||
|
(21, 'ES12345B12345678', 3, 241),
|
||||||
|
(35, 'ES12346B12345679', 3, 241);
|
||||||
|
|
||||||
|
INSERT INTO vn.accountDetailType
|
||||||
|
(id, description)
|
||||||
|
VALUES
|
||||||
|
(1, 'IBAN'),
|
||||||
|
(2, 'SWIFT'),
|
||||||
|
(3, 'Referencia Remesas'),
|
||||||
|
(4, 'Referencia Transferencias'),
|
||||||
|
(5, 'Referencia Nominas'),
|
||||||
|
(6, 'ABA');
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`visible_refresh`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`visible_refresh`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT)
|
||||||
proc: BEGIN
|
proc:BEGIN
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL cache_calc_unlock (v_calc);
|
CALL cache_calc_unlock (v_calc);
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CALL cache_calc_start (v_calc, v_refresh, 'visible', v_warehouse);
|
CALL cache_calc_start (v_calc, v_refresh, 'visible', v_warehouse);
|
||||||
|
|
||||||
IF !v_refresh THEN
|
IF !v_refresh THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
|
@ -15,22 +15,23 @@ proc: BEGIN
|
||||||
|
|
||||||
-- Calculamos el stock hasta ayer
|
-- Calculamos el stock hasta ayer
|
||||||
|
|
||||||
CALL `cache`.stock_refresh(false);
|
CALL cache.stock_refresh(false);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
|
||||||
(PRIMARY KEY (item_id))
|
(PRIMARY KEY (item_id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT item_id, amount stock, amount visible FROM `cache`.stock
|
SELECT item_id, amount stock, amount visible
|
||||||
|
FROM cache.stock
|
||||||
WHERE warehouse_id = v_warehouse;
|
WHERE warehouse_id = v_warehouse;
|
||||||
|
|
||||||
-- Calculamos los movimientos confirmados de hoy
|
-- Calculamos los movimientos confirmados de hoy
|
||||||
CALL vn.item_GetVisible(v_warehouse, NULL);
|
CALL vn.item_calcVisible(NULL, v_warehouse);
|
||||||
DELETE FROM visible WHERE calc_id = v_calc;
|
DELETE FROM visible WHERE calc_id = v_calc;
|
||||||
|
|
||||||
INSERT INTO visible (calc_id, item_id,visible)
|
INSERT INTO visible (calc_id, item_id,visible)
|
||||||
SELECT v_calc, item_id, visible FROM tmp.itemVisible;
|
SELECT v_calc, item_id, visible FROM tmp.itemVisible;
|
||||||
|
|
||||||
CALL cache_calc_end (v_calc);
|
CALL cache_calc_end (v_calc);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.itemVisible;
|
DROP TEMPORARY TABLE tmp.itemVisible;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -25,12 +25,7 @@ BEGIN
|
||||||
JOIN vn.warehouse w ON w.id = p.warehouseFk
|
JOIN vn.warehouse w ON w.id = p.warehouseFk
|
||||||
ORDER BY warehouseFk, `grouping`;
|
ORDER BY warehouseFk, `grouping`;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
CALL vn.ticketCalculatePurge();
|
||||||
tmp.ticketCalculateItem,
|
DROP TEMPORARY TABLE tmp.item;
|
||||||
tmp.ticketComponentPrice,
|
|
||||||
tmp.ticketComponent,
|
|
||||||
tmp.ticketLot,
|
|
||||||
tmp.zoneGetShipped,
|
|
||||||
tmp.item;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -56,11 +56,23 @@ BEGIN
|
||||||
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
|
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT IFNULL(minQuantity, 0) INTO vMinQuantity
|
WITH itemMinQuantityPriority AS (
|
||||||
FROM vn.item
|
SELECT quantity,
|
||||||
WHERE id = vItem;
|
ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY itemFk
|
||||||
|
ORDER BY warehouseFk IS NULL
|
||||||
|
) priority
|
||||||
|
FROM vn.itemMinimumQuantity
|
||||||
|
WHERE itemFk = vItem
|
||||||
|
AND `started` <= vShipment
|
||||||
|
AND (`ended` >= vShipment OR `ended` IS NULL)
|
||||||
|
AND (warehouseFk = vWarehouse OR warehouseFk IS NULL)
|
||||||
|
)
|
||||||
|
SELECT quantity INTO vMinQuantity
|
||||||
|
FROM itemMinQuantityPriority
|
||||||
|
WHERE priority = 1;
|
||||||
|
|
||||||
IF vAmount < LEAST(vMinQuantity, vAvailable) THEN
|
IF vAmount < LEAST(IFNULL(vMinQuantity, 0), vAvailable) THEN
|
||||||
CALL util.throw ('quantityLessThanMin');
|
CALL util.throw ('quantityLessThanMin');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState`
|
||||||
|
ON SCHEDULE EVERY 1 DAY
|
||||||
|
STARTS '2024-06-06 07:52:46.000'
|
||||||
|
ON COMPLETION PRESERVE
|
||||||
|
ENABLE
|
||||||
|
DO BEGIN
|
||||||
|
|
||||||
|
DECLARE vClaimState INT;
|
||||||
|
|
||||||
|
SELECT id INTO vClaimState
|
||||||
|
FROM claimState cs
|
||||||
|
WHERE cs.code = 'canceled';
|
||||||
|
|
||||||
|
UPDATE claim c
|
||||||
|
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||||
|
SET c.claimStateFk = vClaimState
|
||||||
|
WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH
|
||||||
|
AND cs.code IN('incomplete','coming','waiting','out');
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,27 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isProblemCalcNeeded`(
|
||||||
|
vSelf INT
|
||||||
|
)
|
||||||
|
RETURNS BOOL
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Check if the ticket requires to update column vn.ticket.problem
|
||||||
|
*
|
||||||
|
* @param vSelf Id ticket
|
||||||
|
* @return BOOL
|
||||||
|
*/
|
||||||
|
DECLARE vIsProblemCalcNeeded BOOL;
|
||||||
|
|
||||||
|
SELECT COUNT(*) INTO vIsProblemCalcNeeded
|
||||||
|
FROM ticket t
|
||||||
|
JOIN client c ON c.id = t.clientFk
|
||||||
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
|
WHERE t.id = vSelf
|
||||||
|
AND dm.code IN ('AGENCY','DELIVERY','PICKUP')
|
||||||
|
AND c.typeFk = 'normal';
|
||||||
|
|
||||||
|
RETURN vIsProblemCalcNeeded;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,25 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
|
||||||
|
vTicketFk INT,
|
||||||
|
vLongitude INT,
|
||||||
|
vLatitude INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Actualiza las coordenadas de una dirección.
|
||||||
|
*
|
||||||
|
* @param vTicketFk Id del ticket
|
||||||
|
* @param vLongitude Longitud de la dirección
|
||||||
|
* @param vLatitude Latitud de la dirección
|
||||||
|
*/
|
||||||
|
DECLARE vAddressFK INT;
|
||||||
|
|
||||||
|
SELECT addressFK INTO vAddressFK
|
||||||
|
FROM ticket
|
||||||
|
WHERE id = vTicketFk;
|
||||||
|
|
||||||
|
UPDATE address
|
||||||
|
SET longitude = vLongitude,
|
||||||
|
latitude = vLatitude
|
||||||
|
WHERE id = vAddressFK;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,5 +1,8 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimate`(vWarehouseFk SMALLINT, vDated DATE)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimate`(
|
||||||
|
vWarehouseFk SMALLINT,
|
||||||
|
vDated DATE
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula las últimas compras realizadas hasta una fecha
|
* Calcula las últimas compras realizadas hasta una fecha
|
||||||
|
@ -19,21 +22,22 @@ BEGIN
|
||||||
FROM cache.last_buy
|
FROM cache.last_buy
|
||||||
WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL;
|
WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL;
|
||||||
|
|
||||||
CALL buyUltimateFromInterval(vWarehouseFk, util.VN_CURDATE(), vDated);
|
IF vDated >= util.VN_CURDATE() THEN
|
||||||
|
CALL buyUltimateFromInterval(vWarehouseFk, util.VN_CURDATE(), vDated);
|
||||||
|
|
||||||
REPLACE INTO tmp.buyUltimate
|
REPLACE INTO tmp.buyUltimate
|
||||||
SELECT itemFk, buyFk, warehouseFk, landed landing
|
SELECT itemFk, buyFk, warehouseFk, landed landing
|
||||||
FROM tmp.buyUltimateFromInterval
|
FROM tmp.buyUltimateFromInterval
|
||||||
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
||||||
AND landed <= vDated
|
AND landed <= vDated
|
||||||
AND NOT isIgnored;
|
AND NOT isIgnored;
|
||||||
|
|
||||||
INSERT IGNORE INTO tmp.buyUltimate
|
|
||||||
SELECT itemFk, buyFk, warehouseFk, landed landing
|
|
||||||
FROM tmp.buyUltimateFromInterval
|
|
||||||
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
|
||||||
AND landed > vDated
|
|
||||||
ORDER BY isIgnored = FALSE DESC;
|
|
||||||
|
|
||||||
|
INSERT IGNORE INTO tmp.buyUltimate
|
||||||
|
SELECT itemFk, buyFk, warehouseFk, landed landing
|
||||||
|
FROM tmp.buyUltimateFromInterval
|
||||||
|
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
||||||
|
AND landed > vDated
|
||||||
|
ORDER BY isIgnored = FALSE DESC;
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`(
|
||||||
|
vWarehouseFk SMALLINT,
|
||||||
|
vStarted DATE,
|
||||||
|
vEnded DATE
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula las últimas compras realizadas
|
* Calcula las últimas compras realizadas
|
||||||
|
@ -21,12 +25,13 @@ BEGIN
|
||||||
-- Item
|
-- Item
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval;
|
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval;
|
||||||
CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval
|
CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval
|
||||||
(PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk))
|
(PRIMARY KEY (itemFk, warehouseFk),
|
||||||
|
INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
buyFk,
|
buyFk,
|
||||||
MAX(landed) landed,
|
landed,
|
||||||
isIgnored
|
isIgnored
|
||||||
FROM (SELECT b.itemFk,
|
FROM (SELECT b.itemFk,
|
||||||
t.warehouseInFk warehouseFk,
|
t.warehouseInFk warehouseFk,
|
||||||
|
@ -45,93 +50,117 @@ BEGIN
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
||||||
SELECT
|
SELECT itemFk,
|
||||||
b.itemFk,
|
warehouseFk,
|
||||||
t.warehouseInFk warehouseFk,
|
buyFk,
|
||||||
b.id buyFk,
|
landed,
|
||||||
t.landed,
|
isIgnored
|
||||||
b.isIgnored
|
FROM (SELECT b.itemFk,
|
||||||
FROM buy b
|
t.warehouseInFk warehouseFk,
|
||||||
JOIN entry e ON e.id = b.entryFk
|
b.id buyFk,
|
||||||
JOIN travel t ON t.id = e.travelFk
|
t.landed,
|
||||||
WHERE t.landed > vEnded
|
b.isIgnored
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
FROM buy b
|
||||||
AND b.price2 > 0
|
JOIN entry e ON e.id = b.entryFk
|
||||||
AND NOT b.isIgnored
|
JOIN travel t ON t.id = e.travelFk
|
||||||
GROUP BY itemFk, warehouseInFk;
|
WHERE t.landed > vEnded
|
||||||
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
|
AND b.price2 > 0
|
||||||
|
AND NOT b.isIgnored
|
||||||
|
ORDER BY NOT b.isIgnored DESC, t.landed DESC, b.id DESC
|
||||||
|
LIMIT 10000000000000000000) sub
|
||||||
|
GROUP BY itemFk, warehouseFk;
|
||||||
|
|
||||||
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
||||||
SELECT
|
SELECT itemFk,
|
||||||
b.itemFk,
|
warehouseFk,
|
||||||
t.warehouseInFk warehouseFk,
|
buyFk,
|
||||||
b.id buyFk,
|
landed,
|
||||||
t.landed,
|
isIgnored
|
||||||
b.isIgnored
|
FROM (SELECT b.itemFk,
|
||||||
FROM buy b
|
t.warehouseInFk warehouseFk,
|
||||||
JOIN entry e ON e.id = b.entryFk
|
b.id buyFk,
|
||||||
JOIN travel t ON t.id = e.travelFk
|
t.landed,
|
||||||
WHERE t.landed BETWEEN vStarted AND vEnded
|
b.isIgnored
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
FROM buy b
|
||||||
AND b.quantity = 0
|
JOIN entry e ON e.id = b.entryFk
|
||||||
GROUP BY itemFk, warehouseInFk;
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
WHERE t.landed BETWEEN vStarted AND vEnded
|
||||||
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
|
AND b.quantity = 0
|
||||||
|
ORDER BY NOT b.isIgnored DESC, t.landed DESC, b.id DESC
|
||||||
|
LIMIT 10000000000000000000) sub
|
||||||
|
GROUP BY itemFk, warehouseFk;
|
||||||
|
|
||||||
-- ItemOriginal
|
-- ItemOriginal
|
||||||
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
buyFk,
|
buyFk,
|
||||||
MAX(landed) landed,
|
landed,
|
||||||
isIgnored
|
isIgnored
|
||||||
FROM (SELECT b.itemFk,
|
FROM (SELECT b.itemFk,
|
||||||
t.warehouseInFk warehouseFk,
|
t.warehouseInFk warehouseFk,
|
||||||
b.id buyFk,
|
b.id buyFk,
|
||||||
t.landed,
|
t.landed,
|
||||||
itemOriginalFk,
|
itemOriginalFk,
|
||||||
b.isIgnored
|
b.isIgnored
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
WHERE t.landed BETWEEN vStarted AND vEnded
|
WHERE t.landed BETWEEN vStarted AND vEnded
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
AND b.price2 > 0
|
AND b.price2 > 0
|
||||||
AND NOT b.isIgnored
|
AND NOT b.isIgnored
|
||||||
AND b.quantity > 0
|
AND b.quantity > 0
|
||||||
AND itemOriginalFk
|
AND itemOriginalFk
|
||||||
ORDER BY t.landed DESC, b.id DESC
|
ORDER BY t.landed DESC, b.id DESC
|
||||||
LIMIT 10000000000000000000) sub
|
LIMIT 10000000000000000000) sub
|
||||||
GROUP BY itemOriginalFk, warehouseFk;
|
GROUP BY itemFk, warehouseFk;
|
||||||
|
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
||||||
|
SELECT itemFk,
|
||||||
|
warehouseFk,
|
||||||
|
buyFk,
|
||||||
|
landed,
|
||||||
|
isIgnored
|
||||||
|
FROM (SELECT b.itemFk,
|
||||||
|
t.warehouseInFk warehouseFk,
|
||||||
|
b.id buyFk,
|
||||||
|
t.landed,
|
||||||
|
b.isIgnored
|
||||||
|
FROM buy b
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
WHERE t.landed > vEnded
|
||||||
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
|
AND b.price2 > 0
|
||||||
|
AND NOT b.isIgnored
|
||||||
|
AND itemOriginalFk
|
||||||
|
ORDER BY t.landed DESC, b.id DESC
|
||||||
|
LIMIT 10000000000000000000) sub
|
||||||
|
GROUP BY itemFk, warehouseFk;
|
||||||
|
|
||||||
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
||||||
SELECT
|
SELECT itemFk,
|
||||||
b.itemFk,
|
warehouseFk,
|
||||||
t.warehouseInFk warehouseFk,
|
buyFk,
|
||||||
b.id buyFk,
|
landed,
|
||||||
t.landed,
|
isIgnored
|
||||||
b.isIgnored
|
FROM
|
||||||
FROM buy b
|
(SELECT b.itemFk,
|
||||||
JOIN entry e ON e.id = b.entryFk
|
t.warehouseInFk warehouseFk,
|
||||||
JOIN travel t ON t.id = e.travelFk
|
b.id buyFk,
|
||||||
WHERE t.landed > vEnded
|
t.landed,
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
b.isIgnored
|
||||||
AND b.price2 > 0
|
FROM buy b
|
||||||
AND NOT b.isIgnored
|
JOIN entry e ON e.id = b.entryFk
|
||||||
AND itemOriginalFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
GROUP BY itemOriginalFk, warehouseInFk;
|
WHERE t.landed BETWEEN vStarted AND vEnded
|
||||||
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
|
AND b.quantity = 0
|
||||||
SELECT
|
AND itemOriginalFk
|
||||||
b.itemFk,
|
ORDER BY t.landed DESC, b.id DESC
|
||||||
t.warehouseInFk warehouseFk,
|
LIMIT 10000000000000000000) sub
|
||||||
b.id buyFk,
|
GROUP BY itemFk, warehouseFk;
|
||||||
t.landed,
|
|
||||||
b.isIgnored
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
WHERE t.landed BETWEEN vStarted AND vEnded
|
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
|
||||||
AND b.quantity = 0
|
|
||||||
AND itemOriginalFk
|
|
||||||
GROUP BY itemOriginalFk, warehouseInFk;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -45,8 +45,7 @@ BEGIN
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
CALL catalog_componentPrepare();
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem;
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketCalculateItem(
|
||||||
CREATE TEMPORARY TABLE tmp.ticketCalculateItem(
|
|
||||||
itemFk INT(11) NOT NULL,
|
itemFk INT(11) NOT NULL,
|
||||||
available INT(11),
|
available INT(11),
|
||||||
producer VARCHAR(50),
|
producer VARCHAR(50),
|
||||||
|
@ -60,11 +59,11 @@ BEGIN
|
||||||
price DECIMAL(10,2),
|
price DECIMAL(10,2),
|
||||||
priceKg DECIMAL(10,2),
|
priceKg DECIMAL(10,2),
|
||||||
`grouping` INT(10) UNSIGNED,
|
`grouping` INT(10) UNSIGNED,
|
||||||
|
minQuantity INT(10) UNSIGNED,
|
||||||
PRIMARY KEY `itemFk` (`itemFk`)
|
PRIMARY KEY `itemFk` (`itemFk`)
|
||||||
) ENGINE = MEMORY DEFAULT CHARSET=utf8;
|
) ENGINE = MEMORY DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
OPEN cTravelTree;
|
OPEN cTravelTree;
|
||||||
|
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
|
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
|
||||||
|
@ -136,7 +135,7 @@ BEGIN
|
||||||
|
|
||||||
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
||||||
|
|
||||||
INSERT INTO tmp.ticketCalculateItem (
|
INSERT INTO tmp.ticketCalculateItem(
|
||||||
itemFk,
|
itemFk,
|
||||||
available,
|
available,
|
||||||
producer,
|
producer,
|
||||||
|
@ -149,9 +148,9 @@ BEGIN
|
||||||
origin,
|
origin,
|
||||||
price,
|
price,
|
||||||
priceKg,
|
priceKg,
|
||||||
`grouping`)
|
`grouping`,
|
||||||
SELECT
|
minQuantity)
|
||||||
tl.itemFk,
|
SELECT tl.itemFk,
|
||||||
SUM(tl.available) available,
|
SUM(tl.available) available,
|
||||||
p.name producer,
|
p.name producer,
|
||||||
i.name item,
|
i.name item,
|
||||||
|
@ -163,7 +162,8 @@ BEGIN
|
||||||
o.code origin,
|
o.code origin,
|
||||||
bl.price,
|
bl.price,
|
||||||
bl.priceKg,
|
bl.priceKg,
|
||||||
bl.`grouping`
|
bl.`grouping`,
|
||||||
|
mq.quantity
|
||||||
FROM tmp.ticketLot tl
|
FROM tmp.ticketLot tl
|
||||||
JOIN item i ON tl.itemFk = i.id
|
JOIN item i ON tl.itemFk = i.id
|
||||||
LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
|
LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
|
||||||
|
@ -179,12 +179,28 @@ BEGIN
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
) bl ON bl.itemFk = tl.itemFk
|
) bl ON bl.itemFk = tl.itemFk
|
||||||
WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk
|
LEFT JOIN (
|
||||||
|
WITH itemMinQuantityPriority AS (
|
||||||
|
SELECT itemFk,
|
||||||
|
quantity,
|
||||||
|
ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY itemFk
|
||||||
|
ORDER BY warehouseFk IS NULL
|
||||||
|
) priority
|
||||||
|
FROM vn.itemMinimumQuantity
|
||||||
|
WHERE `started` <= vShipped
|
||||||
|
AND (`ended` >= vShipped OR `ended` IS NULL)
|
||||||
|
AND (warehouseFk = vWarehouseFk OR warehouseFk IS NULL)
|
||||||
|
)
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM itemMinQuantityPriority
|
||||||
|
WHERE priority = 1
|
||||||
|
) mq ON mq.itemFk = tl.itemFk
|
||||||
|
WHERE tl.zoneFk = vZoneFk
|
||||||
|
AND tl.warehouseFk = vWarehouseFk
|
||||||
GROUP BY tl.itemFk
|
GROUP BY tl.itemFk
|
||||||
ON DUPLICATE KEY UPDATE available = available + VALUES(available);
|
ON DUPLICATE KEY UPDATE available = available + VALUES(available);
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
CLOSE cTravelTree;
|
CLOSE cTravelTree;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -34,20 +34,25 @@ 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 defaultPayMethodFk,
|
SELECT cc.defaultPayMethodFk,
|
||||||
defaultDueDay,
|
cc.defaultDueDay,
|
||||||
defaultCredit,
|
cc.defaultCredit,
|
||||||
defaultIsTaxDataChecked,
|
cc.defaultIsTaxDataChecked,
|
||||||
defaultHasCoreVnl,
|
cc.defaultHasCoreVnl,
|
||||||
defaultMandateTypeFk
|
cc.defaultMandateTypeFk,
|
||||||
|
c.hasDailyInvoice
|
||||||
INTO vPayMethodFk,
|
INTO vPayMethodFk,
|
||||||
vDueDay,
|
vDueDay,
|
||||||
vDefaultCredit,
|
vDefaultCredit,
|
||||||
vIsTaxDataChecked,
|
vIsTaxDataChecked,
|
||||||
vHasCoreVnl,
|
vHasCoreVnl,
|
||||||
vMandateTypeFk
|
vMandateTypeFk,
|
||||||
FROM clientConfig;
|
vHasDailyInvoice
|
||||||
|
FROM clientConfig cc
|
||||||
|
LEFT JOIN province p ON p.id = vProvinceFk
|
||||||
|
LEFT JOIN country c ON c.id = p.countryFk;
|
||||||
|
|
||||||
INSERT INTO `client`
|
INSERT INTO `client`
|
||||||
SET id = vUserFk,
|
SET id = vUserFk,
|
||||||
|
@ -65,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,
|
||||||
|
|
|
@ -26,16 +26,16 @@ BEGIN
|
||||||
vErrorNumber = MYSQL_ERRNO,
|
vErrorNumber = MYSQL_ERRNO,
|
||||||
vErrorMsg = MESSAGE_TEXT;
|
vErrorMsg = MESSAGE_TEXT;
|
||||||
|
|
||||||
|
CALL util.debugAdd('collection_assign', JSON_OBJECT(
|
||||||
|
'errorNumber', vErrorNumber,
|
||||||
|
'errorMsg', vErrorMsg,
|
||||||
|
'lockName', vLockName,
|
||||||
|
'userFk', vUserFk
|
||||||
|
)); -- Tmp
|
||||||
|
|
||||||
IF vLockName IS NOT NULL THEN
|
IF vLockName IS NOT NULL THEN
|
||||||
DO RELEASE_LOCK(vLockName);
|
DO RELEASE_LOCK(vLockName);
|
||||||
CALL util.debugAdd('collection_assign', JSON_OBJECT(
|
|
||||||
'errorNumber', vErrorNumber,
|
|
||||||
'errorMsg', vErrorMsg,
|
|
||||||
'lockName', vLockName,
|
|
||||||
'userFk', vUserFk
|
|
||||||
)); -- Tmp
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ BEGIN
|
||||||
INTO vHasTooMuchCollections,
|
INTO vHasTooMuchCollections,
|
||||||
vLockName
|
vLockName
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tmp.collection ON TRUE;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
|
|
|
@ -7,27 +7,32 @@ BEGIN
|
||||||
* @param vWorkerFk id del worker.
|
* @param vWorkerFk id del worker.
|
||||||
* @table Devuelve tabla temporal con las colecciones pendientes
|
* @table Devuelve tabla temporal con las colecciones pendientes
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tCollection;
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tCollection
|
CREATE OR REPLACE TEMPORARY TABLE tmp.collection
|
||||||
SELECT c.id collectionFk,
|
ENGINE = MEMORY
|
||||||
date(c.created) created,
|
SELECT c.id collectionFk,
|
||||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
DATE(c.created) created,
|
||||||
FROM collection c
|
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
FROM collection c
|
||||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||||
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
JOIN state s2 ON s2.id = ts.stateFk
|
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
||||||
JOIN productionConfig pc
|
JOIN state s2 ON s2.id = ts.stateFk
|
||||||
JOIN vn.state ss on ss.code = 'PREPARED'
|
JOIN productionConfig pc
|
||||||
LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id
|
JOIN vn.state ss ON ss.code = 'PREPARED'
|
||||||
WHERE c.workerFk = vWorkerFk
|
LEFT JOIN vn.saleTracking st ON st.saleFk = s.id
|
||||||
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
AND st.stateFk = ss.id
|
||||||
AND s.quantity != 0
|
WHERE c.workerFk = vWorkerFk
|
||||||
AND s2.order < pc.pendingCollectionsOrder
|
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
||||||
GROUP BY c.id
|
AND s.quantity
|
||||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
AND s2.order < pc.pendingCollectionsOrder
|
||||||
|
GROUP BY c.id
|
||||||
|
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||||
|
|
||||||
SELECT * FROM tCollection;
|
SELECT * FROM tmp.collection;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -34,10 +34,10 @@ BEGIN
|
||||||
pc.collection_assign_lockname
|
pc.collection_assign_lockname
|
||||||
INTO vHasTooMuchCollections,
|
INTO vHasTooMuchCollections,
|
||||||
vLockName
|
vLockName
|
||||||
FROM tCollection tc
|
FROM tmp.collection c
|
||||||
JOIN productionConfig pc;
|
JOIN productionConfig pc;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('There are pending collections');
|
CALL util.throw('There are pending collections');
|
||||||
|
|
|
@ -53,17 +53,17 @@ BEGIN
|
||||||
vErrorNumber = MYSQL_ERRNO,
|
vErrorNumber = MYSQL_ERRNO,
|
||||||
vErrorMsg = MESSAGE_TEXT;
|
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
|
IF vLockName IS NOT NULL THEN
|
||||||
DO RELEASE_LOCK(vLockName);
|
DO RELEASE_LOCK(vLockName);
|
||||||
CALL util.debugAdd('collection_new', JSON_OBJECT(
|
|
||||||
'errorNumber', vErrorNumber,
|
|
||||||
'errorMsg', vErrorMsg,
|
|
||||||
'lockName', vLockName,
|
|
||||||
'userFk', vUserFk,
|
|
||||||
'ticketFk', vTicketFk
|
|
||||||
)); -- Tmp
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setParking`(IN `vCollectionFk` VARCHAR(8), IN `vParkingFk` INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setParking`(
|
||||||
proc: BEGIN
|
vSelf INT,
|
||||||
|
vParkingFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Aparca una colección en un parking.
|
* Aparca una colección en un parking.
|
||||||
*
|
*
|
||||||
* @param vCollectionFk Id de la colección
|
* @param vSelf Id colección
|
||||||
* @param vParkingFk Id del parking
|
* @param vParkingFk Id parking
|
||||||
*/
|
*/
|
||||||
REPLACE vn.ticketParking(ticketFk, parkingFk)
|
REPLACE ticketParking(ticketFk, parkingFk)
|
||||||
SELECT tc.ticketFk, vParkingFk
|
SELECT tc.ticketFk, vParkingFk
|
||||||
FROM vn.ticketCollection tc
|
FROM ticketCollection tc
|
||||||
WHERE tc.collectionFk = vCollectionFk;
|
WHERE tc.collectionFk = vSelf;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -81,7 +81,7 @@ BEGIN
|
||||||
AND (NOT e.isBooked OR NOT e.isConfirmed)
|
AND (NOT e.isBooked OR NOT e.isConfirmed)
|
||||||
),
|
),
|
||||||
notBookedEntries AS (
|
notBookedEntries AS (
|
||||||
SELECT e.id
|
SELECT entryFk
|
||||||
FROM vn.duaEntry
|
FROM vn.duaEntry
|
||||||
WHERE duaFk = vDuaFk
|
WHERE duaFk = vDuaFk
|
||||||
AND NOT customsValue
|
AND NOT customsValue
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
AND e.id = vSelf;
|
AND e.id = vSelf;
|
||||||
|
|
||||||
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||||
CALL util.throw('Entry is not editable');
|
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -13,60 +13,45 @@ BEGIN
|
||||||
DECLARE vBuyStickers INT;
|
DECLARE vBuyStickers INT;
|
||||||
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,
|
||||||
FLOOR(ish.visible / ish.packing) ishStickers,
|
FLOOR(ish.visible / ish.packing) ishStickers,
|
||||||
bb.stickers buyStickers
|
bb.stickers buyStickers
|
||||||
FROM vn.itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN (SELECT b.id, b.itemFk, b.stickers
|
JOIN (SELECT b.id, b.itemFk, b.stickers
|
||||||
FROM vn.buy b
|
FROM buy b
|
||||||
WHERE b.entryFk = vFromEntryFk
|
|
||||||
ORDER BY b.stickers DESC
|
|
||||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
|
||||||
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
|
||||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
|
||||||
GROUP BY ish.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
|
|
||||||
-- Cantidades de la matrícula que exceden la de las entradas
|
|
||||||
SELECT ish.itemFk,
|
|
||||||
i.longName,
|
|
||||||
FLOOR(ish.visible / ish.packing) AS etiEnMatricula,
|
|
||||||
bb.stickers etiEnEntrada
|
|
||||||
FROM vn.itemShelving ish
|
|
||||||
JOIN vn.item i ON i.id = ish.itemFk
|
|
||||||
LEFT JOIN (SELECT b.id, b.itemFk, b.stickers
|
|
||||||
FROM vn.buy b
|
|
||||||
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 shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
||||||
AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing)
|
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
||||||
|
AND NOT ish.isSplit
|
||||||
GROUP BY ish.id;
|
GROUP BY ish.id;
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
read_loop: LOOP
|
read_loop: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
|
|
||||||
FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers;
|
FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE read_loop;
|
LEAVE read_loop;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vIshStickers = vBuyStickers THEN
|
IF vIshStickers = vBuyStickers THEN
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET entryFk = vToEntryFk
|
SET entryFk = vToEntryFk
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET stickers = stickers - vIshStickers,
|
SET stickers = stickers - vIshStickers,
|
||||||
quantity = stickers * packing
|
quantity = stickers * packing
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
INSERT INTO vn.buy(entryFk,
|
INSERT INTO buy(entryFk,
|
||||||
itemFk,
|
itemFk,
|
||||||
quantity,
|
quantity,
|
||||||
buyingValue,
|
buyingValue,
|
||||||
|
@ -117,13 +102,16 @@ BEGIN
|
||||||
weight,
|
weight,
|
||||||
deliveryFk,
|
deliveryFk,
|
||||||
itemOriginalFk
|
itemOriginalFk
|
||||||
FROM vn.buy
|
FROM buy
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET isSplit = TRUE
|
||||||
|
WHERE shelvingFk = vShelvingFk;
|
||||||
|
END LOOP;
|
||||||
CLOSE cur;
|
CLOSE cur;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -13,20 +13,32 @@ BEGIN
|
||||||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||||
*/
|
*/
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
DECLARE vHasDistinctTransactions INT;
|
DECLARE vDistinctTransactions INT;
|
||||||
|
DECLARE vHasRepeatedTransactions BOOL;
|
||||||
|
|
||||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
||||||
FROM invoiceIn ii
|
FROM invoiceIn ii
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||||
WHERE ii.id = vSelf
|
WHERE iit.invoiceInFk = vSelf
|
||||||
AND iis.taxAreaFk = 'CEE'
|
AND iis.taxAreaFk = 'CEE'
|
||||||
AND transactionTypeSageFk;
|
AND iit.transactionTypeSageFk;
|
||||||
|
|
||||||
IF vHasDistinctTransactions > 1 THEN
|
IF vDistinctTransactions > 1 THEN
|
||||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SELECT TRUE INTO vHasRepeatedTransactions
|
||||||
|
FROM invoiceInTax
|
||||||
|
WHERE invoiceInFk = vSelf
|
||||||
|
GROUP BY transactionTypeSageFk
|
||||||
|
HAVING COUNT(transactionTypeSageFk) > 1
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vHasRepeatedTransactions THEN
|
||||||
|
CALL util.throw ('This invoice contains repeated types of transactions');
|
||||||
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ii.bookEntried,
|
SELECT ii.bookEntried,
|
||||||
|
|
|
@ -1,102 +1,114 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySale`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySale`(
|
||||||
vSaleFk INT
|
vSaleFk INT
|
||||||
)
|
)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Reserva una línea de venta en la ubicación más óptima
|
* Reserva una línea de venta en la ubicación más óptima
|
||||||
*
|
*
|
||||||
* @param vSaleFk Id de sale
|
* @param vSaleFk Id de sale
|
||||||
* @param vItemShelvingSaleFk Id de reserva
|
* @param vItemShelvingSaleFk Id de reserva
|
||||||
*/
|
*/
|
||||||
DECLARE vLastPickingOrder INT;
|
DECLARE vLastPickingOrder INT;
|
||||||
DECLARE vDone INT DEFAULT FALSE;
|
DECLARE vDone INT DEFAULT FALSE;
|
||||||
DECLARE vItemShelvingFk INT;
|
DECLARE vItemShelvingFk INT;
|
||||||
DECLARE vAvailable INT;
|
DECLARE vAvailable INT;
|
||||||
DECLARE vReservedQuantity INT;
|
DECLARE vReservedQuantity INT;
|
||||||
DECLARE vOutStanding INT;
|
DECLARE vOutStanding INT;
|
||||||
DECLARE vUserFk INT;
|
DECLARE vUserFk INT;
|
||||||
|
DECLARE vTotalReservedQuantity INT;
|
||||||
DECLARE vItemShelvingAvailable CURSOR FOR
|
DECLARE vSaleQuantity INT;
|
||||||
SELECT ish.id itemShelvingFk,
|
|
||||||
ish.available
|
DECLARE vItemShelvingAvailable CURSOR FOR
|
||||||
FROM sale s
|
SELECT ish.id itemShelvingFk,
|
||||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
ish.available
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
FROM sale s
|
||||||
JOIN parking p ON p.id = sh.parkingFk
|
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
JOIN sector sc ON sc.id = p.sectorFk
|
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN productionConfig pc
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
WHERE s.id = vSaleFk
|
JOIN sector sc ON sc.id = p.sectorFk
|
||||||
AND NOT sc.isHideForPickers
|
JOIN productionConfig pc
|
||||||
ORDER BY s.id,
|
WHERE s.id = vSaleFk
|
||||||
p.pickingOrder >= vLastPickingOrder,
|
AND NOT sc.isHideForPickers
|
||||||
sh.priority DESC,
|
ORDER BY s.id,
|
||||||
ish.available >= s.quantity DESC,
|
p.pickingOrder >= vLastPickingOrder,
|
||||||
s.quantity MOD ish.grouping = 0 DESC,
|
sh.priority DESC,
|
||||||
ish.grouping DESC,
|
ish.available >= s.quantity DESC,
|
||||||
IF(pc.orderMode = 'Location', p.pickingOrder, ish.created);
|
s.quantity MOD ish.grouping = 0 DESC,
|
||||||
|
ish.grouping DESC,
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
IF(pc.orderMode = 'Location', p.pickingOrder, ish.created);
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
ROLLBACK;
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
RESIGNAL;
|
BEGIN
|
||||||
END;
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0))
|
END;
|
||||||
INTO vLastPickingOrder, vOutStanding
|
|
||||||
FROM sale s
|
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
|
||||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
INTO vLastPickingOrder, vOutStanding, vSaleQuantity
|
||||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
FROM sale s
|
||||||
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
WHERE s.id = vSaleFk;
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
IF vOutStanding <= 0 THEN
|
WHERE s.id = vSaleFk;
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
IF vOutStanding <= 0 THEN
|
||||||
|
LEAVE proc;
|
||||||
SELECT getUser() INTO vUserFk;
|
END IF;
|
||||||
|
|
||||||
OPEN vItemShelvingAvailable;
|
SELECT getUser() INTO vUserFk;
|
||||||
l: LOOP
|
|
||||||
SET vDone = FALSE;
|
OPEN vItemShelvingAvailable;
|
||||||
FETCH vItemShelvingAvailable INTO vItemShelvingFk, vAvailable;
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
IF vOutStanding <= 0 OR vDone THEN
|
FETCH vItemShelvingAvailable INTO vItemShelvingFk, vAvailable;
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
IF vOutStanding <= 0 OR vDone THEN
|
||||||
|
SELECT SUM(IFNULL(quantity, 0))
|
||||||
START TRANSACTION;
|
INTO vTotalReservedQuantity
|
||||||
|
FROM itemShelvingSale
|
||||||
SELECT id INTO vItemShelvingFk
|
WHERE saleFk = vSaleFk;
|
||||||
FROM itemShelving
|
|
||||||
WHERE id = vItemShelvingFk
|
IF vTotalReservedQuantity <> vSaleQuantity THEN
|
||||||
FOR UPDATE;
|
UPDATE sale
|
||||||
|
SET quantity = vTotalReservedQuantity
|
||||||
SELECT LEAST(vOutStanding, vAvailable) INTO vReservedQuantity;
|
WHERE id = vSaleFk;
|
||||||
SET vOutStanding = vOutStanding - vReservedQuantity;
|
END IF;
|
||||||
|
LEAVE l;
|
||||||
IF vReservedQuantity > 0 THEN
|
END IF;
|
||||||
|
|
||||||
INSERT INTO itemShelvingSale(
|
START TRANSACTION;
|
||||||
itemShelvingFk,
|
|
||||||
saleFk,
|
SELECT id INTO vItemShelvingFk
|
||||||
quantity,
|
FROM itemShelving
|
||||||
userFk)
|
WHERE id = vItemShelvingFk
|
||||||
SELECT vItemShelvingFk,
|
FOR UPDATE;
|
||||||
vSaleFk,
|
|
||||||
vReservedQuantity,
|
SELECT LEAST(vOutStanding, vAvailable) INTO vReservedQuantity;
|
||||||
vUserFk;
|
SET vOutStanding = vOutStanding - vReservedQuantity;
|
||||||
|
|
||||||
UPDATE itemShelving
|
IF vReservedQuantity > 0 THEN
|
||||||
SET available = available - vReservedQuantity
|
|
||||||
WHERE id = vItemShelvingFk;
|
INSERT INTO itemShelvingSale(
|
||||||
|
itemShelvingFk,
|
||||||
END IF;
|
saleFk,
|
||||||
|
quantity,
|
||||||
COMMIT;
|
userFk)
|
||||||
END LOOP;
|
SELECT vItemShelvingFk,
|
||||||
CLOSE vItemShelvingAvailable;
|
vSaleFk,
|
||||||
END$$
|
vReservedQuantity,
|
||||||
|
vUserFk;
|
||||||
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET available = available - vReservedQuantity
|
||||||
|
WHERE id = vItemShelvingFk;
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE vItemShelvingAvailable;
|
||||||
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -21,6 +21,7 @@ BEGIN
|
||||||
DECLARE vRemainingQuantity INT;
|
DECLARE vRemainingQuantity INT;
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vTotalQuantity INT;
|
DECLARE vTotalQuantity INT;
|
||||||
|
DECLARE vStateCode VARCHAR(45);
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -32,10 +33,19 @@ BEGIN
|
||||||
CALL util.throw('Reservation completed');
|
CALL util.throw('Reservation completed');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
|
SELECT s.itemFk,
|
||||||
INTO vItemFk, vSaleFk, vItemShelvingFk, vReservedQuantity
|
iss.saleFk,
|
||||||
|
iss.itemShelvingFk,
|
||||||
|
SUM(IFNULL(iss.quantity,0)),
|
||||||
|
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
|
||||||
|
INTO vItemFk,
|
||||||
|
vSaleFk,
|
||||||
|
vItemShelvingFk,
|
||||||
|
vReservedQuantity,
|
||||||
|
vStateCode
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN sale s ON s.id = iss.saleFk
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
|
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
||||||
WHERE iss.id = vItemShelvingSaleFk
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
AND NOT iss.isPicked;
|
AND NOT iss.isPicked;
|
||||||
|
|
||||||
|
@ -74,7 +84,7 @@ BEGIN
|
||||||
vTotalQuantity,
|
vTotalQuantity,
|
||||||
`account`.`myUser_getId`(),
|
`account`.`myUser_getId`(),
|
||||||
NULL,
|
NULL,
|
||||||
'PREPARED',
|
vStateCode,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_GetVisible`(vWarehouse SMALLINT, vItem INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, util.VN_CURDATE());
|
|
||||||
|
|
||||||
INSERT INTO tmp.itemVisible (item_id, visible)
|
|
||||||
SELECT item_id, SUM(amount) amount
|
|
||||||
FROM (
|
|
||||||
SELECT i.itemFk AS item_id, quantity AS amount
|
|
||||||
FROM itemTicketOut i
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
|
|
||||||
JOIN state s ON s.id = ts.stateFk
|
|
||||||
LEFT JOIN (SELECT DISTINCT saleFk
|
|
||||||
FROM saleTracking st
|
|
||||||
JOIN state s ON s.id = st.stateFk
|
|
||||||
WHERE st.created > util.VN_CURDATE()
|
|
||||||
AND (s.isPicked OR st.isChecked)
|
|
||||||
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
|
|
||||||
WHERE i.warehouseFk = vWarehouse
|
|
||||||
AND (vItem IS NULL OR i.itemFk = vItem)
|
|
||||||
AND (s.isPicked OR i.reserved OR stPrevious.saleFk )
|
|
||||||
AND i.shipped >= util.VN_CURDATE() AND i.shipped < vTomorrow
|
|
||||||
UNION ALL
|
|
||||||
SELECT iei.itemFk, quantity
|
|
||||||
FROM itemEntryIn iei
|
|
||||||
WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > util.VN_CURDATE()*/)
|
|
||||||
AND iei.landed >= util.VN_CURDATE() AND iei.landed < vTomorrow
|
|
||||||
AND iei.warehouseInFk = vWarehouse
|
|
||||||
AND (vItem IS NULL OR iei.itemFk = vItem)
|
|
||||||
AND iei.isVirtualStock is FALSE
|
|
||||||
UNION ALL
|
|
||||||
SELECT itemFk, quantity
|
|
||||||
FROM itemEntryOut
|
|
||||||
WHERE isDelivered != FALSE
|
|
||||||
AND shipped >= util.VN_CURDATE() AND shipped < vTomorrow
|
|
||||||
AND warehouseOutFk = vWarehouse
|
|
||||||
AND (vItem IS NULL OR itemFk = vItem)
|
|
||||||
) t
|
|
||||||
GROUP BY item_id
|
|
||||||
ON DUPLICATE KEY UPDATE
|
|
||||||
visible = IFNULL(stock,0) + VALUES(visible);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_calcVisible`(
|
||||||
|
vSelf INT,
|
||||||
|
vWarehouseFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula el visible de un artículo o de todos.
|
||||||
|
*
|
||||||
|
* @param vWarehouse Warehouse id
|
||||||
|
* @param vSelf Item id
|
||||||
|
* @param tmp.itemVisible(item_id, stock, visible)
|
||||||
|
*/
|
||||||
|
DECLARE vDated DATE DEFAULT util.VN_CURDATE();
|
||||||
|
DECLARE vTomorrow DATETIME DEFAULT util.tomorrow();
|
||||||
|
|
||||||
|
INSERT INTO tmp.itemVisible(item_id, visible)
|
||||||
|
SELECT itemFk, SUM(quantity)
|
||||||
|
FROM (
|
||||||
|
SELECT i.itemFk, i.quantity
|
||||||
|
FROM itemTicketOut i
|
||||||
|
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
|
||||||
|
JOIN `state` s ON s.id = ts.stateFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT st.saleFk
|
||||||
|
FROM saleTracking st
|
||||||
|
JOIN state s ON s.id = st.stateFk
|
||||||
|
WHERE st.created > vDated
|
||||||
|
AND (s.isPicked OR st.isChecked)
|
||||||
|
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
|
||||||
|
WHERE IFNULL(vWarehouseFk, i.warehouseFk) = i.warehouseFk
|
||||||
|
AND (vSelf IS NULL OR i.itemFk = vSelf)
|
||||||
|
AND (s.isPicked OR i.reserved OR stPrevious.saleFk)
|
||||||
|
AND i.shipped >= vDated AND i.shipped < vTomorrow
|
||||||
|
UNION ALL
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM itemEntryIn
|
||||||
|
WHERE isReceived
|
||||||
|
AND landed >= vDated AND landed < vTomorrow
|
||||||
|
AND IFNULL(vWarehouseFk, warehouseInFk) = warehouseInFk
|
||||||
|
AND (vSelf IS NULL OR itemFk = vSelf)
|
||||||
|
AND NOT isVirtualStock
|
||||||
|
UNION ALL
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM itemEntryOut
|
||||||
|
WHERE isDelivered
|
||||||
|
AND shipped >= vDated
|
||||||
|
AND shipped < vTomorrow
|
||||||
|
AND IFNULL(vWarehouseFk, warehouseOutFk) = warehouseOutFk
|
||||||
|
AND (vSelf IS NULL OR itemFk = vSelf)
|
||||||
|
) t
|
||||||
|
GROUP BY itemFk
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
visible = IFNULL(stock, 0) + VALUES(visible);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -10,19 +10,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_comparative`(
|
||||||
)
|
)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Genera una tabla de comparativa de artículos por itemType/comprador/fecha.
|
* Generates a comparison table of items by itemType/buyer/date.
|
||||||
* Los datos se calculan en función de los parámetros proporcionados.
|
* The data is calculated based on the provided parameters.
|
||||||
*
|
*
|
||||||
* @param vDate La fecha para la cual se generará la comparativa.
|
* @param vDate The date for which the comparison will be generated.
|
||||||
* @param vDayRange El rango de días a considerar para la comparativa.
|
* @param vDayRange The range of days to consider for the comparison.
|
||||||
* @param vWarehouseFk El identificador del almacén para filtrar los artículos.
|
* @param vWarehouseFk The warehouse identifier to filter the items.
|
||||||
* @param vAvailableSince La fecha de disponibilidad desde la cual se consideran los artículos disponibles.
|
* @param vAvailableSince The availability date from which the items are considered available.
|
||||||
* @param vBuyerFk El identificador del comprador para filtrar los artículos.
|
* @param vBuyerFk The buyer identifier to filter the items.
|
||||||
* @param vIsFloramondo Indica si se deben incluir solo los artículos de Floramondo (opcional).
|
* @param vIsFloramondo Indicates whether only Floramondo items should be included (optional).
|
||||||
* @param vCountryFk El identificador del país.
|
* @param vCountryFk The country identifier.
|
||||||
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT)
|
* @param tmp.comparativeFilterType(filterFk INT, itemTypeFk INT)
|
||||||
* @return tmp.comparative
|
* @return tmp.comparative
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vDayRangeStart DATE;
|
DECLARE vDayRangeStart DATE;
|
||||||
DECLARE vDayRangeEnd DATE;
|
DECLARE vDayRangeEnd DATE;
|
||||||
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;
|
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;
|
||||||
|
|
|
@ -2,94 +2,84 @@ DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vWarehouseFk INT,
|
vWarehouseFk INT,
|
||||||
vDate DATETIME
|
vDated DATETIME
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* @vItemFk item a buscar
|
* Calcula el balance de un artículo.
|
||||||
* @vWarehouseFk almacen donde buscar
|
*
|
||||||
* @vDate Si la fecha es null, muestra el histórico desde el inventario.
|
* @vItemFk Id de artículo
|
||||||
* Si la fecha no es null, muestra histórico desde la fecha de vDate.
|
* @vWarehouseFk Id de almacén
|
||||||
|
* @vDated Fecha a calcular, si es NULL muestra el histórico desde el inventario
|
||||||
*/
|
*/
|
||||||
DECLARE vDateInventory DATETIME;
|
DECLARE vDateInventory DATETIME
|
||||||
|
DEFAULT (
|
||||||
|
SELECT IF(vDated, uc.mockUtcTime, c.inventoried)
|
||||||
|
FROM config c
|
||||||
|
JOIN util.config uc
|
||||||
|
);
|
||||||
|
DECLARE vSupplierInventoryFk INT
|
||||||
|
DEFAULT (SELECT supplierFk FROM inventoryConfig);
|
||||||
|
|
||||||
IF vDate IS NULL THEN
|
IF NOT vSupplierInventoryFk OR NOT vDateInventory THEN
|
||||||
SELECT inventoried INTO vDateInventory
|
CALL util.throw('Config variables are not set');
|
||||||
FROM config;
|
|
||||||
ELSE
|
|
||||||
SELECT mockUtcTime INTO vDateInventory
|
|
||||||
FROM util.config;
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemDiary(
|
CREATE OR REPLACE TEMPORARY TABLE tItemDiary
|
||||||
shipped DATE,
|
ENGINE = MEMORY
|
||||||
`in` INT(11),
|
|
||||||
`out` INT(11),
|
|
||||||
alertLevel INT(11),
|
|
||||||
stateName VARCHAR(20),
|
|
||||||
`name` VARCHAR(50),
|
|
||||||
reference VARCHAR(50),
|
|
||||||
origin INT(11),
|
|
||||||
clientFk INT(11),
|
|
||||||
isPicked INT(11),
|
|
||||||
isTicket TINYINT(1),
|
|
||||||
lineFk INT(11),
|
|
||||||
`order` TINYINT(3) UNSIGNED,
|
|
||||||
clientType VARCHAR(20),
|
|
||||||
claimFk INT(10) UNSIGNED,
|
|
||||||
inventorySupplierFk INT(10)
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO tItemDiary
|
|
||||||
WITH entriesIn AS (
|
WITH entriesIn AS (
|
||||||
SELECT tr.landed shipped,
|
SELECT 'entry' originType,
|
||||||
|
e.id originId,
|
||||||
|
tr.landed shipped,
|
||||||
b.quantity `in`,
|
b.quantity `in`,
|
||||||
NULL `out`,
|
NULL `out`,
|
||||||
st.alertLevel ,
|
st.alertLevel ,
|
||||||
st.name stateName,
|
st.name stateName,
|
||||||
s.name `name`,
|
|
||||||
e.invoiceNumber reference,
|
e.invoiceNumber reference,
|
||||||
e.id origin,
|
'supplier' entityType,
|
||||||
s.id clientFk,
|
s.id entityId,
|
||||||
|
s.name entityName,
|
||||||
IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked,
|
IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked,
|
||||||
FALSE isTicket,
|
FALSE isTicket,
|
||||||
b.id lineFk,
|
b.id lineFk,
|
||||||
NULL `order`,
|
NULL `order`,
|
||||||
NULL clientType,
|
NULL clientType,
|
||||||
NULL claimFk,
|
NULL claimFk,
|
||||||
ec.inventorySupplierFk
|
vSupplierInventoryFk inventorySupplierFk
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN vn.supplier s ON s.id = e.supplierFk
|
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||||
JOIN vn.state st ON st.`code` = IF( tr.landed < util.VN_CURDATE()
|
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
|
||||||
OR (util.VN_CURDATE() AND tr.isReceived),
|
OR (util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
JOIN vn.entryConfig ec
|
|
||||||
WHERE tr.landed >= vDateInventory
|
WHERE tr.landed >= vDateInventory
|
||||||
AND vWarehouseFk = tr.warehouseInFk
|
AND tr.warehouseInFk = vWarehouseFk
|
||||||
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT e.isRaid
|
||||||
), entriesOut AS (
|
),
|
||||||
SELECT tr.shipped,
|
entriesOut AS (
|
||||||
|
SELECT 'entry',
|
||||||
|
e.id originType,
|
||||||
|
tr.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
b.quantity,
|
b.quantity,
|
||||||
st.alertLevel,
|
st.alertLevel,
|
||||||
st.name stateName,
|
st.name stateName,
|
||||||
s.name ,
|
|
||||||
e.invoiceNumber,
|
e.invoiceNumber,
|
||||||
e.id entryFk,
|
'supplier' entityType,
|
||||||
s.id supplierFk,
|
s.id entityId,
|
||||||
|
s.name,
|
||||||
IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
|
IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
|
||||||
FALSE isTicket,
|
FALSE isTicket,
|
||||||
b.id,
|
b.id,
|
||||||
NULL `order`,
|
NULL `order`,
|
||||||
NULL clientType,
|
NULL clientType,
|
||||||
NULL claimFk,
|
NULL claimFk,
|
||||||
ec.inventorySupplierFk
|
vSupplierInventoryFk
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
|
@ -99,86 +89,108 @@ BEGIN
|
||||||
OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
|
OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
JOIN vn.entryConfig ec
|
|
||||||
WHERE tr.shipped >= vDateInventory
|
WHERE tr.shipped >= vDateInventory
|
||||||
AND vWarehouseFk = tr.warehouseOutFk
|
AND tr.warehouseOutFk = vWarehouseFk
|
||||||
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT w.isFeedStock
|
AND NOT w.isFeedStock
|
||||||
AND NOT e.isRaid
|
AND NOT e.isRaid
|
||||||
), sales AS (
|
),
|
||||||
SELECT DATE(t.shipped) shipped,
|
sales AS (
|
||||||
s.quantity,
|
WITH itemSales AS (
|
||||||
st2.alertLevel,
|
SELECT DATE(t.shipped) shipped,
|
||||||
st2.name,
|
s.quantity,
|
||||||
t.nickname,
|
st2.alertLevel,
|
||||||
t.refFk,
|
st2.name,
|
||||||
t.id ticketFk,
|
t.refFk,
|
||||||
t.clientFk,
|
t.id ticketFk,
|
||||||
s.id saleFk,
|
'client' entityType,
|
||||||
st.`order`,
|
t.clientFk entityId,
|
||||||
c.typeFk,
|
t.nickname,
|
||||||
cb.claimFk
|
s.id saleFk,
|
||||||
FROM vn.sale s
|
st.`order`,
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
c.typeFk,
|
||||||
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
cb.claimFk
|
||||||
LEFT JOIN vn.state st ON st.`code` = ts.`code`
|
FROM vn.sale s
|
||||||
JOIN vn.client c ON c.id = t.clientFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN vn.state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
'DELIVERED',
|
LEFT JOIN vn.state st ON st.code = ts.code
|
||||||
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
JOIN vn.client c ON c.id = t.clientFk
|
||||||
'FREE',
|
JOIN vn.state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
||||||
IFNULL(ts.code, 'FREE')))
|
'DELIVERED',
|
||||||
LEFT JOIN vn.claimBeginning cb ON s.id = cb.saleFk
|
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
||||||
WHERE t.shipped >= vDateInventory
|
'FREE',
|
||||||
AND s.itemFk = vItemFk
|
IFNULL(st.code, 'FREE')))
|
||||||
AND vWarehouseFk = t.warehouseFk
|
LEFT JOIN vn.claimBeginning cb ON cb.saleFk = s.id
|
||||||
),sale AS (
|
WHERE t.shipped >= vDateInventory
|
||||||
SELECT s.shipped,
|
AND s.itemFk = vItemFk
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
)
|
||||||
|
SELECT 'ticket',
|
||||||
|
s.ticketFk,
|
||||||
|
s.shipped,
|
||||||
NULL `in`,
|
NULL `in`,
|
||||||
s.quantity,
|
s.quantity,
|
||||||
s.alertLevel,
|
s.alertLevel,
|
||||||
s.name,
|
s.name,
|
||||||
s.nickname,
|
|
||||||
s.refFk,
|
s.refFk,
|
||||||
s.ticketFk,
|
s.entityType,
|
||||||
s.clientFk,
|
s.entityId,
|
||||||
IF(stk.saleFk, TRUE, NULL),
|
s.nickname,
|
||||||
|
IF(stk.saleFk, TRUE, FALSE),
|
||||||
TRUE,
|
TRUE,
|
||||||
s.saleFk,
|
s.saleFk,
|
||||||
s.`order`,
|
s.`order`,
|
||||||
s.typeFk,
|
s.typeFk,
|
||||||
s.claimFk,
|
s.claimFk,
|
||||||
NULL
|
NULL
|
||||||
FROM sales s
|
FROM itemSales s
|
||||||
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
||||||
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
||||||
AND stk.stateFk = stPrep.id
|
AND stk.stateFk = stPrep.id
|
||||||
GROUP BY s.saleFk
|
GROUP BY s.saleFk
|
||||||
) SELECT shipped,
|
),
|
||||||
`in`,
|
orders AS (
|
||||||
`out`,
|
SELECT 'order' originType,
|
||||||
alertLevel,
|
o.id originId,
|
||||||
stateName,
|
r.shipment,
|
||||||
`name`,
|
NULL 'in',
|
||||||
reference,
|
r.amount,
|
||||||
origin,
|
NULL alertLevel,
|
||||||
clientFk,
|
NULL stateName,
|
||||||
isPicked,
|
NULL invoiceNumber,
|
||||||
isTicket,
|
'client' entityType,
|
||||||
lineFk,
|
c.id,
|
||||||
`order`,
|
c.name,
|
||||||
clientType,
|
FALSE,
|
||||||
claimFk,
|
FALSE isTicket,
|
||||||
inventorySupplierFk
|
NULL buyFk,
|
||||||
FROM entriesIn
|
NULL 'order',
|
||||||
|
c.typeFk,
|
||||||
|
NULL claimFk,
|
||||||
|
NULL
|
||||||
|
FROM hedera.orderRow r
|
||||||
|
JOIN hedera.`order` o ON o.id = r.orderFk
|
||||||
|
JOIN vn.client c ON c.id = o.customer_id
|
||||||
|
WHERE r.shipment >= vDateInventory
|
||||||
|
AND r.warehouseFk = vWarehouseFk
|
||||||
|
AND r.created >= (
|
||||||
|
SELECT SUBTIME(util.VN_NOW(), reserveTime)
|
||||||
|
FROM hedera.orderConfig
|
||||||
|
)
|
||||||
|
AND NOT o.confirmed
|
||||||
|
AND r.itemFk = vItemFk
|
||||||
|
)
|
||||||
|
SELECT * FROM entriesIn
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT * FROM entriesOut
|
SELECT * FROM entriesOut
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT * FROM sale
|
SELECT * FROM sales
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM orders
|
||||||
ORDER BY shipped,
|
ORDER BY shipped,
|
||||||
(inventorySupplierFk = clientFk) DESC,
|
(inventorySupplierFk = entityId) DESC,
|
||||||
alertLevel DESC,
|
alertLevel DESC,
|
||||||
isTicket,
|
isTicket,
|
||||||
`order` DESC,
|
`order` DESC,
|
||||||
|
@ -186,19 +198,20 @@ BEGIN
|
||||||
`in` DESC,
|
`in` DESC,
|
||||||
`out` DESC;
|
`out` DESC;
|
||||||
|
|
||||||
IF vDate IS NULL THEN
|
IF vDated IS NULL THEN
|
||||||
|
|
||||||
SET @a := 0;
|
SET @a := 0;
|
||||||
SET @currentLineFk := 0;
|
SET @currentLineFk := 0;
|
||||||
SET @shipped := '';
|
SET @shipped := '';
|
||||||
|
|
||||||
SELECT DATE(@shipped:= t.shipped) shipped,
|
SELECT t.originType,
|
||||||
|
t.originId,
|
||||||
|
DATE(@shipped:= t.shipped) shipped,
|
||||||
t.alertLevel,
|
t.alertLevel,
|
||||||
t.stateName,
|
t.stateName,
|
||||||
t.origin,
|
|
||||||
t.reference,
|
t.reference,
|
||||||
t.clientFk,
|
t.entityType,
|
||||||
t.name,
|
t.entityId,
|
||||||
|
t.entityName,
|
||||||
t.`in` invalue,
|
t.`in` invalue,
|
||||||
t.`out`,
|
t.`out`,
|
||||||
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
||||||
|
@ -214,37 +227,41 @@ BEGIN
|
||||||
t.`order`
|
t.`order`
|
||||||
FROM tItemDiary t
|
FROM tItemDiary t
|
||||||
LEFT JOIN alertLevel a ON a.id = t.alertLevel;
|
LEFT JOIN alertLevel a ON a.id = t.alertLevel;
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a
|
SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a
|
||||||
FROM tItemDiary
|
FROM tItemDiary
|
||||||
WHERE shipped < vDate;
|
WHERE shipped < vDated;
|
||||||
|
|
||||||
SELECT vDate shipped,
|
SELECT NULL originType,
|
||||||
0 alertLevel,
|
NULL originId,
|
||||||
0 stateName,
|
vDated shipped,
|
||||||
0 origin,
|
NULL alertLevel,
|
||||||
'' reference,
|
NULL stateName,
|
||||||
0 clientFk,
|
NULL reference,
|
||||||
|
NULL entityType,
|
||||||
|
NULL entityId,
|
||||||
'Inventario calculado',
|
'Inventario calculado',
|
||||||
@a invalue,
|
@a invalue,
|
||||||
NULL `out`,
|
NULL `out`,
|
||||||
@a balance,
|
@a balance,
|
||||||
0 lastPreparedLineFk,
|
NULL lastPreparedLineFk,
|
||||||
0 isTicket,
|
NULL isTicket,
|
||||||
0 lineFk,
|
NULL lineFk,
|
||||||
0 isPicked,
|
NULL isPicked,
|
||||||
0 clientType,
|
NULL clientType,
|
||||||
0 claimFk,
|
NULL claimFk,
|
||||||
NULL `order`
|
NULL `order`
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT shipped,
|
SELECT originType,
|
||||||
|
originId,
|
||||||
|
shipped,
|
||||||
alertlevel,
|
alertlevel,
|
||||||
stateName,
|
stateName,
|
||||||
origin,
|
reference,
|
||||||
reference,
|
entityType,
|
||||||
clientFk,
|
entityId,
|
||||||
name, `in`,
|
entityName,
|
||||||
|
`in`,
|
||||||
`out`,
|
`out`,
|
||||||
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
||||||
0,
|
0,
|
||||||
|
@ -255,7 +272,7 @@ BEGIN
|
||||||
claimFk,
|
claimFk,
|
||||||
`order`
|
`order`
|
||||||
FROM tItemDiary
|
FROM tItemDiary
|
||||||
WHERE shipped >= vDate;
|
WHERE shipped >= vDated;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tItemDiary;
|
DROP TEMPORARY TABLE tItemDiary;
|
||||||
|
|
|
@ -63,7 +63,7 @@ BEGIN
|
||||||
WHEN b.groupingMode = 'grouping' THEN b.grouping
|
WHEN b.groupingMode = 'grouping' THEN b.grouping
|
||||||
WHEN b.groupingMode = 'packing' THEN b.packing
|
WHEN b.groupingMode = 'packing' THEN b.packing
|
||||||
ELSE 1
|
ELSE 1
|
||||||
END AS minQuantity,
|
END minQuantity,
|
||||||
v.visible located,
|
v.visible located,
|
||||||
b.price2
|
b.price2
|
||||||
FROM vn.item i
|
FROM vn.item i
|
||||||
|
|
|
@ -46,12 +46,18 @@ BEGIN
|
||||||
i.tag8 = JSON_VALUE(vTags, '$.8'),
|
i.tag8 = JSON_VALUE(vTags, '$.8'),
|
||||||
i.tag9 = JSON_VALUE(vTags, '$.9'),
|
i.tag9 = JSON_VALUE(vTags, '$.9'),
|
||||||
i.tag10 = JSON_VALUE(vTags, '$.10'),
|
i.tag10 = JSON_VALUE(vTags, '$.10'),
|
||||||
|
i.tag11 = JSON_VALUE(vTags, '$.11'),
|
||||||
|
i.tag12 = JSON_VALUE(vTags, '$.12'),
|
||||||
|
i.tag13 = JSON_VALUE(vTags, '$.13'),
|
||||||
i.value5 = JSON_VALUE(vValues, '$.5'),
|
i.value5 = JSON_VALUE(vValues, '$.5'),
|
||||||
i.value6 = JSON_VALUE(vValues, '$.6'),
|
i.value6 = JSON_VALUE(vValues, '$.6'),
|
||||||
i.value7 = JSON_VALUE(vValues, '$.7'),
|
i.value7 = JSON_VALUE(vValues, '$.7'),
|
||||||
i.value8 = JSON_VALUE(vValues, '$.8'),
|
i.value8 = JSON_VALUE(vValues, '$.8'),
|
||||||
i.value9 = JSON_VALUE(vValues, '$.9'),
|
i.value9 = JSON_VALUE(vValues, '$.9'),
|
||||||
i.value10 = JSON_VALUE(vValues, '$.10'),
|
i.value10 = JSON_VALUE(vValues, '$.10'),
|
||||||
|
i.value11 = JSON_VALUE(vValues, '$.11'),
|
||||||
|
i.value12 = JSON_VALUE(vValues, '$.12'),
|
||||||
|
i.value13 = JSON_VALUE(vValues, '$.13'),
|
||||||
i.producerFk = p.id,
|
i.producerFk = p.id,
|
||||||
i.inkFk = k.id,
|
i.inkFk = k.id,
|
||||||
i.originFk = IFNULL(o.id, i.originFk)
|
i.originFk = IFNULL(o.id, i.originFk)
|
||||||
|
|
|
@ -6,7 +6,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_setVisibleDisc
|
||||||
vAddressFk INT)
|
vAddressFk INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Procedimiento para dar dar de baja/alta un item, si vAddressFk es NULL se entiende que se da de alta y se toma el addressFk de la configuración
|
* Procedimiento para dar dar de baja/alta un item, si vAdressFk es NULL
|
||||||
|
* se entiende que se da de alta y se toma el addressFk de la configuración
|
||||||
*
|
*
|
||||||
* @param vItemFk Identificador del ítem
|
* @param vItemFk Identificador del ítem
|
||||||
* @param vWarehouseFk id del warehouse
|
* @param vWarehouseFk id del warehouse
|
||||||
|
|
|
@ -10,6 +10,7 @@ proc: BEGIN
|
||||||
DECLARE vDateTo DATETIME;
|
DECLARE vDateTo DATETIME;
|
||||||
DECLARE vDateToTomorrow DATETIME;
|
DECLARE vDateToTomorrow DATETIME;
|
||||||
DECLARE vDefaultDayRange INT;
|
DECLARE vDefaultDayRange INT;
|
||||||
|
DECLARE vCalcFk INT;
|
||||||
|
|
||||||
IF vDate < util.VN_CURDATE() THEN
|
IF vDate < util.VN_CURDATE() THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
|
@ -40,8 +41,7 @@ proc: BEGIN
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
SUM(quantity) quantity,
|
SUM(quantity) quantity
|
||||||
SUM(quantity) visible
|
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, - s.quantity quantity
|
SELECT s.itemFk, - s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -75,56 +75,27 @@ proc: BEGIN
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
-- Cálculo del visible
|
|
||||||
UPDATE tItemInventoryCalc iic
|
|
||||||
JOIN (
|
|
||||||
SELECT itemFk, SUM(quantity) visible
|
|
||||||
FROM (
|
|
||||||
SELECT s.itemFk, s.quantity
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
|
||||||
WHERE t.shipped >= vDate
|
|
||||||
AND t.shipped < vDateTomorrow
|
|
||||||
AND (NOT isPicked AND NOT t.isLabeled AND t.refFk IS NULL)
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
|
||||||
AND w.isComparative
|
|
||||||
UNION ALL
|
|
||||||
SELECT b.itemFk, - b.quantity
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
|
||||||
WHERE t.landed = vDate
|
|
||||||
AND NOT t.isReceived
|
|
||||||
AND NOT e.isExcludedFromAvailable
|
|
||||||
AND NOT e.isRaid
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
|
||||||
AND w.isComparative
|
|
||||||
UNION ALL
|
|
||||||
SELECT b.itemFk, b.quantity
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
|
||||||
WHERE t.shipped = vDate
|
|
||||||
AND NOT t.isReceived
|
|
||||||
AND NOT e.isExcludedFromAvailable
|
|
||||||
AND NOT e.isRaid
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
|
||||||
AND w.isComparative
|
|
||||||
) sub2
|
|
||||||
GROUP BY itemFk
|
|
||||||
) sub ON sub.itemFk = iic.itemFk
|
|
||||||
SET iic.visible = iic.visible + sub.visible;
|
|
||||||
|
|
||||||
UPDATE tmp.itemInventory ai
|
UPDATE tmp.itemInventory ai
|
||||||
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||||
SET ai.inventory = iic.quantity,
|
SET ai.inventory = iic.quantity,
|
||||||
ai.visible = iic.visible,
|
ai.visible = iic.quantity,
|
||||||
ai.avalaible = iic.quantity,
|
ai.avalaible = iic.quantity,
|
||||||
ai.sd = iic.quantity;
|
ai.sd = iic.quantity;
|
||||||
|
|
||||||
|
-- Cálculo del visible
|
||||||
|
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||||
|
(PRIMARY KEY (item_id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT item_id, visible
|
||||||
|
FROM cache.visible
|
||||||
|
WHERE calc_id = vCalcFk;
|
||||||
|
|
||||||
|
UPDATE tmp.itemInventory it
|
||||||
|
JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||||
|
SET it.visible = it.visible + ivc.visible;
|
||||||
|
|
||||||
-- Calculo del disponible
|
-- Calculo del disponible
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
(INDEX (itemFk, warehouseFk))
|
(INDEX (itemFk, warehouseFk))
|
||||||
|
@ -194,7 +165,8 @@ proc: BEGIN
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.itemTravel,
|
tmp.itemTravel,
|
||||||
tmp.itemCalc,
|
tmp.itemCalc,
|
||||||
|
tmp.itemAtp,
|
||||||
tItemInventoryCalc,
|
tItemInventoryCalc,
|
||||||
tmp.itemAtp;
|
tItemVisibleCalc;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -15,6 +15,11 @@ proc: BEGIN
|
||||||
DECLARE vEndingDate DATETIME;
|
DECLARE vEndingDate DATETIME;
|
||||||
DECLARE vIsTodayRelative BOOLEAN;
|
DECLARE vIsTodayRelative BOOLEAN;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
|
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
|
||||||
INTO vEndingDate
|
INTO vEndingDate
|
||||||
FROM productionConfig;
|
FROM productionConfig;
|
||||||
|
@ -31,7 +36,8 @@ proc: BEGIN
|
||||||
CALL prepareClientList();
|
CALL prepareClientList();
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
||||||
(INDEX (ticketFk)) ENGINE = MEMORY
|
(INDEX (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
||||||
FROM tmp.productionTicket tt
|
FROM tmp.productionTicket tt
|
||||||
JOIN ticket t ON t.id = tt.ticketFk;
|
JOIN ticket t ON t.id = tt.ticketFk;
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(IN `vSaleGroupFk` VARCHAR(8), IN `vParkingFk` INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(
|
||||||
proc: BEGIN
|
vSaleGroupFk VARCHAR(8),
|
||||||
|
vParkingFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Aparca una preparación previa en un parking
|
* Aparca una preparación previa en un parking.
|
||||||
*
|
*
|
||||||
* @param vSaleGroupFk id de la preparación previa
|
* @param vSaleGroupFk id de la preparación previa
|
||||||
* @param vParkingFk id del parking
|
* @param vParkingFk id del parking
|
||||||
*/
|
*/
|
||||||
UPDATE vn.saleGroup sg
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
UPDATE saleGroup sg
|
||||||
SET sg.parkingFk = vParkingFk
|
SET sg.parkingFk = vParkingFk
|
||||||
WHERE sg.id = vSaleGroupFk
|
WHERE sg.id = vSaleGroupFk
|
||||||
AND sg.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK;
|
||||||
|
|
||||||
CALL vn.ticket_setNextState(vn.ticket_get(vSaleGroupFk));
|
CALL ticket_setNextState(ticket_get(vSaleGroupFk));
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -19,21 +19,20 @@ BEGIN
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(saleFk INT PRIMARY KEY)
|
(saleFk INT PRIMARY KEY)
|
||||||
SELECT
|
SELECT s.ticketFk,
|
||||||
s.ticketFk,
|
s.id saleFk,
|
||||||
s.id saleFk,
|
s.itemFk,
|
||||||
s.itemFk,
|
s.concept,
|
||||||
s.concept,
|
s.quantity,
|
||||||
s.quantity,
|
MAKETIME(pb.HH,pb.mm,0) etd,
|
||||||
MAKETIME(pb.HH,pb.mm,0) etd,
|
pb.routeFk,
|
||||||
pb.routeFk,
|
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
|
||||||
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
|
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
|
||||||
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
|
IF(pa.isPackageReturnable, pc.defaultBigPackageFk, b.packagingFk) packagingFk
|
||||||
b.packagingFk
|
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
LEFT JOIN ( SELECT iss.itemShelvingFk,
|
LEFT JOIN ( SELECT iss.itemShelvingFk,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
SUM(iss.quantity) reserve
|
SUM(iss.quantity) reserve
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
|
@ -52,6 +51,8 @@ BEGIN
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
|
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
|
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
|
||||||
LEFT JOIN buy b ON b.id = lb.buy_id
|
LEFT JOIN buy b ON b.id = lb.buy_id
|
||||||
|
LEFT JOIN packaging pa ON pa.id = b.packagingFk
|
||||||
|
JOIN packagingConfig pc
|
||||||
WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
|
WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
|
||||||
<= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
|
<= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
|
||||||
AND NOT pb.problem
|
AND NOT pb.problem
|
||||||
|
|
|
@ -278,12 +278,11 @@ BEGIN
|
||||||
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
||||||
CALL buyUltimate(vWarehouseFk, vDate);
|
CALL buyUltimate(vWarehouseFk, vDate);
|
||||||
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||||
SELECT ticketFk, problem, saleFk
|
SELECT ticketFk, problem ,saleFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT tl.ticketFk,
|
SELECT tl.ticketFk,
|
||||||
s.id saleFk ,
|
s.id saleFk,
|
||||||
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem,
|
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
|
||||||
MOD(s.quantity, b.`grouping`) hasRounding
|
|
||||||
FROM tmp.ticket_list tl
|
FROM tmp.ticket_list tl
|
||||||
JOIN ticket t ON t.id = tl.ticketFk
|
JOIN ticket t ON t.id = tl.ticketFk
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
@ -291,9 +290,9 @@ BEGIN
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
|
WHERE MOD(s.quantity, b.`grouping`)
|
||||||
GROUP BY tl.ticketFk
|
GROUP BY tl.ticketFk
|
||||||
HAVING hasRounding
|
)sub
|
||||||
) sub
|
|
||||||
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vCursor;
|
CLOSE vCursor;
|
||||||
|
|
|
@ -5,14 +5,32 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Update column sale.problem with a problem code
|
* Update column sale.problem with a problem code
|
||||||
|
*
|
||||||
* @param vProblemCode Code to set or unset
|
* @param vProblemCode Code to set or unset
|
||||||
* @table tmp.sale(saleFk, hasProblem)
|
* @table tmp.sale(saleFk, hasProblem, isProblemCalcNeeded)
|
||||||
*/
|
*/
|
||||||
UPDATE sale s
|
DECLARE vSaleFk INT;
|
||||||
JOIN tmp.sale ts ON ts.saleFk = s.id
|
DECLARE vHasProblem INT;
|
||||||
SET s.problem = CONCAT(
|
DECLARE vDone BOOL;
|
||||||
IF(ts.hasProblem,
|
DECLARE vSaleList CURSOR FOR SELECT saleFk, hasProblem FROM tmp.sale;
|
||||||
CONCAT(s.problem, ',', vProblemCode),
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
REPLACE(s.problem, vProblemCode , '')));
|
|
||||||
|
OPEN vSaleList;
|
||||||
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
|
FETCH vSaleList INTO vSaleFk, vHasProblem;
|
||||||
|
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE l;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
UPDATE sale
|
||||||
|
SET problem = CONCAT(
|
||||||
|
IF(vHasProblem,
|
||||||
|
CONCAT(problem, ',', vProblemCode),
|
||||||
|
REPLACE(problem, vProblemCode , '')))
|
||||||
|
WHERE id = vSaleFk;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE vSaleList;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -10,9 +10,13 @@ BEGIN
|
||||||
* @param vSelf Id del sale
|
* @param vSelf Id del sale
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(INDEX(saleFk))
|
(INDEX(saleFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vSelf saleFk, sale_hasComponentLack(vSelf) hasProblem;
|
SELECT vSelf saleFk,
|
||||||
|
sale_hasComponentLack(vSelf) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
||||||
|
FROM sale
|
||||||
|
WHERE id = vSelf;
|
||||||
|
|
||||||
CALL sale_setProblem('hasComponentLack');
|
CALL sale_setProblem('hasComponentLack');
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@ BEGIN
|
||||||
* @param vComponentFk Id component
|
* @param vComponentFk Id component
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
(INDEX(saleFk))
|
(INDEX(saleFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT saleFk, sale_hasComponentLack(saleFk)hasProblem
|
SELECT saleFk,
|
||||||
|
sale_hasComponentLack(saleFk) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.id saleFk
|
SELECT s.id saleFk, s.ticketFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
|
|
|
@ -11,9 +11,10 @@ BEGIN
|
||||||
DECLARE vWarehouseFk INT;
|
DECLARE vWarehouseFk INT;
|
||||||
DECLARE vShipped DATE;
|
DECLARE vShipped DATE;
|
||||||
DECLARE vQuantity INT;
|
DECLARE vQuantity INT;
|
||||||
|
DECLARE vIsProblemCalcNeeded BOOL;
|
||||||
|
|
||||||
SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity
|
SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id)
|
||||||
INTO vItemFk, vWarehouseFk, vShipped, vQuantity
|
INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
WHERE s.id = vSelf;
|
WHERE s.id = vSelf;
|
||||||
|
@ -21,7 +22,9 @@ BEGIN
|
||||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
SELECT vSelf saleFk, MOD(vQuantity, b.`grouping`) hasProblem
|
SELECT vSelf saleFk,
|
||||||
|
MOD(vQuantity, b.`grouping`) hasProblem,
|
||||||
|
vIsProblemCalcNeeded isProblemCalcNeeded
|
||||||
FROM tmp.buyUltimate bu
|
FROM tmp.buyUltimate bu
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
WHERE bu.itemFk = vItemFk;
|
WHERE bu.itemFk = vItemFk;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`setParking`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8))
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`setParking`(
|
||||||
proc: BEGIN
|
vParam VARCHAR(8),
|
||||||
|
vParkingCode VARCHAR(8)
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Aparca una colección, un ticket, un saleGroup o un shelving en un parking
|
* Aparca una colección, un ticket, un saleGroup o un shelving en un parking
|
||||||
*
|
*
|
||||||
|
@ -8,56 +11,41 @@ proc: BEGIN
|
||||||
* @param vParkingCode código del parking
|
* @param vParkingCode código del parking
|
||||||
*/
|
*/
|
||||||
DECLARE vParkingFk INT;
|
DECLARE vParkingFk INT;
|
||||||
DECLARE vIsSaleGroup BOOL;
|
DECLARE vLastWeek DATE;
|
||||||
DECLARE vIsTicket BOOL;
|
|
||||||
DECLARE vIsCollection BOOL;
|
|
||||||
|
|
||||||
SET vParkingCode = replace(vParkingCode,' ','');
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
SET vParkingCode = REPLACE(vParkingCode, ' ', '');
|
||||||
|
|
||||||
SELECT id INTO vParkingFk
|
SELECT id INTO vParkingFk
|
||||||
FROM vn.parking
|
FROM parking
|
||||||
WHERE code = vParkingCode COLLATE utf8_unicode_ci;
|
WHERE code = vParkingCode COLLATE utf8_unicode_ci;
|
||||||
|
|
||||||
IF vParkingFk IS NULL THEN
|
IF vParkingFk IS NULL THEN
|
||||||
CALL util.throw('parkingNotExist');
|
CALL util.throw('parkingNotExist');
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vParam REGEXP '^[0-9]+$' THEN
|
|
||||||
-- Se comprueba si es una preparación previa
|
|
||||||
SELECT COUNT(*) INTO vIsSaleGroup
|
|
||||||
FROM vn.saleGroup sg
|
|
||||||
WHERE sg.id = vParam;
|
|
||||||
|
|
||||||
IF vIsSaleGroup THEN
|
START TRANSACTION;
|
||||||
CALL vn.saleGroup_setParking(vParam, vParkingFk);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Se comprueba si es un ticket
|
SET vLastWeek = util.VN_CURDATE() - INTERVAL 1 WEEK;
|
||||||
SELECT COUNT(*) INTO vIsTicket
|
|
||||||
FROM vn.ticket t
|
|
||||||
WHERE t.id = vParam
|
|
||||||
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
|
||||||
|
|
||||||
IF vIsTicket THEN
|
-- Comprobamos si es una prep. previa, ticket, colección o shelving
|
||||||
CALL vn.ticket_setParking(vParam, vParkingFk);
|
IF (SELECT TRUE FROM saleGroup WHERE id = vParam) THEN
|
||||||
LEAVE proc;
|
CALL saleGroup_setParking(vParam, vParkingFk);
|
||||||
END IF;
|
ELSEIF (SELECT TRUE FROM ticket WHERE id = vParam AND shipped >= vLastWeek) THEN
|
||||||
|
CALL ticket_setParking(vParam, vParkingFk);
|
||||||
-- Se comprueba si es una coleccion de tickets
|
ELSEIF (SELECT TRUE FROM `collection` WHERE id = vParam AND created >= vLastWeek) THEN
|
||||||
SELECT COUNT(*) INTO vIsCollection
|
CALL collection_setParking(vParam, vParkingFk);
|
||||||
FROM vn.collection c
|
ELSEIF (SELECT TRUE FROM shelving WHERE code = vParam COLLATE utf8_unicode_ci) THEN
|
||||||
WHERE c.id = vParam
|
CALL shelving_setParking(vParam, vParkingFk);
|
||||||
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
|
|
||||||
|
|
||||||
IF vIsCollection THEN
|
|
||||||
CALL vn.collection_setParking(vParam, vParkingFk);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
ELSE
|
ELSE
|
||||||
-- Por descarte, se considera una matrícula
|
CALL util.throw('paramNotExist');
|
||||||
CALL vn.shelving_setParking(vParam, vParkingFk);
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -9,6 +9,11 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vStateFk INT;
|
DECLARE vStateFk INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
INSERT INTO ticket (
|
INSERT INTO ticket (
|
||||||
clientFk,
|
clientFk,
|
||||||
shipped,
|
shipped,
|
||||||
|
|
|
@ -44,14 +44,14 @@ BEGIN
|
||||||
t.shipped,
|
t.shipped,
|
||||||
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
|
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
|
||||||
w.isManaged,
|
w.isManaged,
|
||||||
c.hasToInvoice
|
c.hasToInvoice
|
||||||
INTO vClientFk,
|
INTO vClientFk,
|
||||||
vIsTaxDataChecked,
|
vIsTaxDataChecked,
|
||||||
vCompanyFk,
|
vCompanyFk,
|
||||||
vShipped,
|
vShipped,
|
||||||
vHasDailyInvoice,
|
vHasDailyInvoice,
|
||||||
vWithPackage,
|
vWithPackage,
|
||||||
vHasToInvoice
|
vHasToInvoice
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN `client` c ON c.id = t.clientFk
|
JOIN `client` c ON c.id = t.clientFk
|
||||||
JOIN province p ON p.id = c.provinceFk
|
JOIN province p ON p.id = c.provinceFk
|
||||||
|
@ -64,8 +64,12 @@ BEGIN
|
||||||
(SELECT vCurTicketFk, p.id, COUNT(*)
|
(SELECT vCurTicketFk, p.id, COUNT(*)
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN packaging p ON p.id = e.packagingFk
|
JOIN packaging p ON p.id = e.packagingFk
|
||||||
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
|
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
||||||
AND vWithPackage
|
AND vWithPackage
|
||||||
|
AND NOT dm.`code`= 'PICKUP'
|
||||||
GROUP BY p.itemFk);
|
GROUP BY p.itemFk);
|
||||||
|
|
||||||
-- No retornables o no catalogados
|
-- No retornables o no catalogados
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(vSelf INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(
|
||||||
|
vSelf INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Cambia el estado del ticket al siguiente estado según la tabla state
|
* Cambia el estado del ticket al siguiente estado según la tabla state.
|
||||||
*
|
*
|
||||||
* @param vSelf id dle ticket
|
* @param vSelf Id ticket
|
||||||
*/
|
*/
|
||||||
DECLARE vStateFk INT;
|
DECLARE vStateFk INT;
|
||||||
DECLARE vNewStateFk INT;
|
DECLARE vNewStateFk INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
SELECT stateFk INTO vStateFk
|
SELECT stateFk INTO vStateFk
|
||||||
FROM ticketState
|
FROM ticketState
|
||||||
WHERE ticketFk = vSelf;
|
WHERE ticketFk = vSelf;
|
||||||
|
@ -17,6 +24,10 @@ BEGIN
|
||||||
FROM state
|
FROM state
|
||||||
WHERE id = vStateFk;
|
WHERE id = vStateFk;
|
||||||
|
|
||||||
|
IF vNewStateFk IS NULL THEN
|
||||||
|
CALL util.throw('The ticket not have next state');
|
||||||
|
END IF;
|
||||||
|
|
||||||
INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
|
INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
|
||||||
VALUES (vNewStateFk, vSelf, account.myUser_getId());
|
VALUES (vNewStateFk, vSelf, account.myUser_getId());
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setParking`(IN `vTicketFk` VARCHAR(8), IN `vParkingFk` INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setParking`(
|
||||||
proc: BEGIN
|
vSelf INT,
|
||||||
|
vParkingFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Aparca un ticket en un parking
|
* Aparca un ticket en un parking.
|
||||||
*
|
*
|
||||||
* @param vTicketFk id del ticket
|
* @param vSelf Id ticket
|
||||||
* @param vParkingFk id del parking
|
* @param vParkingFk Id parking
|
||||||
*/
|
*/
|
||||||
DECLARE vDone INT DEFAULT FALSE;
|
DECLARE vDone INT DEFAULT FALSE;
|
||||||
DECLARE vCollectionTicketFk INT;
|
DECLARE vCollectionTicketFk INT;
|
||||||
|
@ -14,16 +17,21 @@ proc: BEGIN
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
|
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
|
||||||
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
|
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
|
||||||
WHERE t.id = vTicketFk;
|
WHERE t.id = vSelf;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
INSERT INTO vn.ticketParking(ticketFk, parkingFk)
|
INSERT INTO vn.ticketParking(ticketFk, parkingFk)
|
||||||
SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk
|
SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
|
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
|
||||||
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
|
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
|
||||||
WHERE t.id = vTicketFk
|
WHERE t.id = vSelf
|
||||||
ON DUPLICATE KEY UPDATE parkingFk = vParkingFk;
|
ON DUPLICATE KEY UPDATE parkingFk = vParkingFk;
|
||||||
|
|
||||||
OPEN vCursor;
|
OPEN vCursor;
|
||||||
|
|
|
@ -4,16 +4,34 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Update column ticket.problem with a problem code
|
* Update column ticket.problem with a problem code and SET NULL when
|
||||||
|
* the problem is not requiered
|
||||||
*
|
*
|
||||||
* @param vProblemCode Code to set or unset
|
* @param vProblemCode Code to set or unset
|
||||||
* @table tmp.ticket(ticketFk, hasProblem)
|
* @table tmp.ticket(ticketFk, hasProblem, isProblemCalcNeeded)
|
||||||
*/
|
*/
|
||||||
UPDATE ticket t
|
DECLARE vTicketFk INT;
|
||||||
JOIN tmp.ticket tt ON tt.ticketFk = t.id
|
DECLARE vHasProblem INT;
|
||||||
SET t.problem = CONCAT(
|
DECLARE vDone BOOL;
|
||||||
IF(tt.hasProblem,
|
DECLARE vTicketList CURSOR FOR SELECT ticketFk, hasProblem FROM tmp.ticket;
|
||||||
CONCAT(problem, ',', vProblemCode),
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
REPLACE(problem, vProblemCode , '')));
|
|
||||||
|
OPEN vTicketList;
|
||||||
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
|
FETCH vTicketList INTO vTicketFk, vHasProblem;
|
||||||
|
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE l;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
UPDATE ticket
|
||||||
|
SET problem = CONCAT(
|
||||||
|
IF(vHasProblem,
|
||||||
|
CONCAT(problem, ',', vProblemCode),
|
||||||
|
REPLACE(problem, vProblemCode , '')))
|
||||||
|
WHERE id = vTicketFk;
|
||||||
|
END LOOP;
|
||||||
|
CLOSE vTicketList;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -9,9 +9,11 @@ BEGIN
|
||||||
* @param vClientFk Id Cliente, if NULL all clients
|
* @param vClientFk Id Cliente, if NULL all clients
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk, FALSE hasProblem
|
SELECT t.id ticketFk,
|
||||||
|
FALSE hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
WHERE t.shipped >= util.VN_CURDATE()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
||||||
|
@ -21,7 +23,7 @@ BEGIN
|
||||||
JOIN client c ON c.id = ti.clientFk
|
JOIN client c ON c.id = ti.clientFk
|
||||||
SET t.hasProblem = TRUE
|
SET t.hasProblem = TRUE
|
||||||
WHERE c.isFreezed;
|
WHERE c.isFreezed;
|
||||||
|
|
||||||
CALL ticket_setProblem('isFreezed');
|
CALL ticket_setProblem('isFreezed');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.ticket;
|
||||||
|
|
|
@ -9,9 +9,11 @@ BEGIN
|
||||||
* @param vSelf Id ticket, if NULL ALL tickets
|
* @param vSelf Id ticket, if NULL ALL tickets
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk, FALSE hasProblem
|
SELECT t.id ticketFk,
|
||||||
|
FALSE hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
WHERE t.shipped >= util.VN_CURDATE()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (vSelf IS NULL OR t.id = vSelf);
|
AND (vSelf IS NULL OR t.id = vSelf);
|
||||||
|
|
|
@ -10,21 +10,30 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vHasRisk BOOL;
|
DECLARE vHasRisk BOOL;
|
||||||
DECLARE vHasHighRisk BOOL;
|
DECLARE vHasHighRisk BOOL;
|
||||||
|
DECLARE vIsProblemCalcNeeded BOOL;
|
||||||
|
|
||||||
SELECT t.risk > (c.credit + 10), ((t.risk - cc.riskTolerance) > (c.credit + 10))
|
SELECT t.risk > (c.credit + 10),
|
||||||
INTO vHasRisk, vHasHighRisk
|
(t.risk - cc.riskTolerance) > (c.credit + 10),
|
||||||
|
ticket_isProblemCalcNeeded(t.id)
|
||||||
|
INTO vHasRisk, vHasHighRisk, vIsProblemCalcNeeded
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN ticket t ON t.clientFk = c.id
|
JOIN ticket t ON t.clientFk = c.id
|
||||||
JOIN clientConfig cc
|
JOIN clientConfig cc
|
||||||
WHERE t.id = vSelf;
|
WHERE t.id = vSelf;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
SELECT vSelf ticketFk, vHasRisk hasProblem;
|
ENGINE = MEMORY
|
||||||
|
SELECT vSelf ticketFk,
|
||||||
|
vHasRisk hasProblem,
|
||||||
|
vIsProblemCalcNeeded isProblemCalcNeeded;
|
||||||
|
|
||||||
CALL ticket_setProblem('hasRisk');
|
CALL ticket_setProblem('hasRisk');
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
SELECT vSelf ticketFk, vHasHighRisk hasProblem;
|
ENGINE = MEMORY
|
||||||
|
SELECT vSelf ticketFk,
|
||||||
|
vHasHighRisk hasProblem,
|
||||||
|
vIsProblemCalcNeeded isProblemCalcNeeded;
|
||||||
|
|
||||||
CALL ticket_setProblem('hasHighRisk');
|
CALL ticket_setProblem('hasHighRisk');
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,11 @@ BEGIN
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vDated);
|
CALL buyUltimate(vWarehouseFk, vDated);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
SELECT s.id saleFk , MOD(s.quantity, b.`grouping`) hasProblem
|
(INDEX(saleFk, isProblemCalcNeeded))
|
||||||
|
SELECT s.id saleFk ,
|
||||||
|
MOD(s.quantity, b.`grouping`) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||||
|
|
|
@ -9,9 +9,11 @@ BEGIN
|
||||||
* @param vClientFk Id cliente, if NULL all clients
|
* @param vClientFk Id cliente, if NULL all clients
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
SELECT t.id ticketFk,
|
||||||
|
IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
WHERE t.shipped >= util.VN_CURDATE()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
|
|
|
@ -8,13 +8,17 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSelf Id del ticket
|
* @param vSelf Id del ticket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vSelf ticketFk, ticket_isTooLittle(vSelf) hasProblem;
|
SELECT vSelf ticketFk,
|
||||||
|
ticket_isTooLittle(vSelf) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(vSelf) isProblemCalcNeeded;
|
||||||
|
|
||||||
CALL ticket_setProblem('isTooLittle');
|
CALL ticket_setProblem('isTooLittle');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket;
|
DROP TEMPORARY TABLE tmp.ticket;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -10,7 +10,7 @@ BEGIN
|
||||||
* @param vItemFk Id del item, NULL ALL items
|
* @param vItemFk Id del item, NULL ALL items
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
(INDEX(ticketFk))
|
(INDEX(ticketFk, isProblemCalcNeeded))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
WITH tickets AS(
|
WITH tickets AS(
|
||||||
SELECT t.id ticketFk
|
SELECT t.id ticketFk
|
||||||
|
@ -19,7 +19,9 @@ BEGIN
|
||||||
WHERE t.shipped >= util.VN_CURDATE()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
|
)SELECT ticketFk,
|
||||||
|
ticket_isTooLittle(ticketFk) hasProblem,
|
||||||
|
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
||||||
FROM tickets;
|
FROM tickets;
|
||||||
|
|
||||||
CALL ticket_setProblem('isTooLittle');
|
CALL ticket_setProblem('isTooLittle');
|
||||||
|
|
|
@ -8,6 +8,7 @@ BEGIN
|
||||||
* @param vClientFk Id cliente
|
* @param vClientFk Id cliente
|
||||||
*/
|
*/
|
||||||
DECLARE vHasDebt BOOL;
|
DECLARE vHasDebt BOOL;
|
||||||
|
DECLARE vStarted DATETIME;
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vHasDebt
|
SELECT COUNT(*) INTO vHasDebt
|
||||||
FROM `client`
|
FROM `client`
|
||||||
|
@ -16,22 +17,24 @@ BEGIN
|
||||||
|
|
||||||
IF vHasDebt THEN
|
IF vHasDebt THEN
|
||||||
|
|
||||||
|
SELECT util.VN_CURDATE() - INTERVAL riskScope MONTH INTO vStarted
|
||||||
|
FROM clientConfig;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tTicketRisk
|
CREATE OR REPLACE TEMPORARY TABLE tTicketRisk
|
||||||
(KEY (ticketFk))
|
(KEY (ticketFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
WITH ticket AS(
|
WITH ticket AS(
|
||||||
SELECT id ticketFk, companyFk, DATE(shipped) dated
|
SELECT id ticketFk,
|
||||||
FROM vn.ticket t
|
companyFk,
|
||||||
|
DATE(shipped) dated,
|
||||||
|
totalWithVat,
|
||||||
|
ticket_isProblemCalcNeeded(id) isProblemCalcNeeded
|
||||||
|
FROM vn.ticket
|
||||||
WHERE clientFk = vClientFk
|
WHERE clientFk = vClientFk
|
||||||
AND refFk IS NULL
|
AND refFk IS NULL
|
||||||
AND NOT isDeleted
|
AND NOT isDeleted
|
||||||
AND totalWithoutVat <> 0
|
AND IFNULL(totalWithVat, 0) <> 0
|
||||||
), dated AS(
|
AND shipped > vStarted
|
||||||
SELECT t.companyFk, MIN(DATE(t.dated) - INTERVAL cc.riskScope MONTH) started,
|
|
||||||
MAX(DATE(t.dated)) ended
|
|
||||||
FROM ticket t
|
|
||||||
JOIN vn.clientConfig cc
|
|
||||||
GROUP BY t.companyFk
|
|
||||||
), balance AS(
|
), balance AS(
|
||||||
SELECT SUM(amount)amount, companyFk
|
SELECT SUM(amount)amount, companyFk
|
||||||
FROM (
|
FROM (
|
||||||
|
@ -49,15 +52,11 @@ BEGIN
|
||||||
WHERE companyFk
|
WHERE companyFk
|
||||||
GROUP BY companyFk
|
GROUP BY companyFk
|
||||||
), uninvoiced AS(
|
), uninvoiced AS(
|
||||||
SELECT t.companyFk, DATE(t.shipped) dated, SUM(IFNULL(t.totalWithVat, 0)) amount
|
SELECT companyFk, dated, SUM(totalWithVat) amount
|
||||||
FROM vn.ticket t
|
FROM ticket
|
||||||
JOIN dated d
|
GROUP BY companyFk, dated
|
||||||
WHERE t.clientFk = vClientFk
|
|
||||||
AND t.refFk IS NULL
|
|
||||||
AND t.shipped BETWEEN d.started AND d.ended
|
|
||||||
GROUP BY t.companyFk, DATE(t.shipped)
|
|
||||||
), receipt AS(
|
), receipt AS(
|
||||||
SELECT companyFk,DATE(payed) dated, SUM(amountPaid) amount
|
SELECT companyFk, DATE(payed) dated, SUM(amountPaid) amount
|
||||||
FROM vn.receipt
|
FROM vn.receipt
|
||||||
WHERE clientFk = vClientFk
|
WHERE clientFk = vClientFk
|
||||||
AND payed > util.VN_CURDATE()
|
AND payed > util.VN_CURDATE()
|
||||||
|
@ -73,13 +72,21 @@ BEGIN
|
||||||
LEFT JOIN receipt r ON r.dated > ui.dated AND r.companyFk = ui.companyFk
|
LEFT JOIN receipt r ON r.dated > ui.dated AND r.companyFk = ui.companyFk
|
||||||
GROUP BY b.companyFk, ui.dated
|
GROUP BY b.companyFk, ui.dated
|
||||||
)
|
)
|
||||||
SELECT ti.ticketFk, r.amount
|
SELECT ti.ticketFk, r.amount, ti.isProblemCalcNeeded
|
||||||
FROM ticket ti
|
FROM ticket ti
|
||||||
JOIN risk r ON r.dated = ti.dated AND r.companyFk = ti.companyFk;
|
JOIN risk r ON r.dated = ti.dated AND r.companyFk = ti.companyFk;
|
||||||
|
|
||||||
UPDATE ticket t
|
UPDATE ticket t
|
||||||
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
||||||
SET t.risk = tr.amount;
|
SET t.risk = tr.amount
|
||||||
|
WHERE tr.isProblemCalcNeeded
|
||||||
|
ORDER BY t.id;
|
||||||
|
|
||||||
|
UPDATE ticket t
|
||||||
|
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
||||||
|
SET t.risk = NULL
|
||||||
|
WHERE tr.isProblemCalcNeeded
|
||||||
|
ORDER BY t.id;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tTicketRisk;
|
DROP TEMPORARY TABLE tTicketRisk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -1,59 +1,79 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
|
||||||
vTicketFk INT,
|
vSelf INT,
|
||||||
vOriginalItemPackingTypeFk VARCHAR(1)
|
vItemPackingTypeFk VARCHAR(1)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado.
|
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado.
|
||||||
* Respeta el id inicial para el tipo propuesto.
|
* Respeta el id inicial para el tipo propuesto.
|
||||||
*
|
*
|
||||||
* @param vTicketFk Identificador de vn.ticket
|
* @param vSelf Id ticket
|
||||||
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
* @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||||
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||||
*/
|
*/
|
||||||
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
|
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
|
||||||
DECLARE vNewTicketFk INT;
|
DECLARE vNewTicketFk INT;
|
||||||
DECLARE vPackingTypesToSplit INT;
|
DECLARE vPackingTypesToSplit INT;
|
||||||
DECLARE vDone INT DEFAULT FALSE;
|
DECLARE vDone INT DEFAULT FALSE;
|
||||||
|
DECLARE vErrorNumber INT;
|
||||||
|
DECLARE vErrorMsg TEXT;
|
||||||
|
|
||||||
DECLARE cur1 CURSOR FOR
|
DECLARE vSaleGroup CURSOR FOR
|
||||||
SELECT itemPackingTypeFk
|
SELECT itemPackingTypeFk
|
||||||
FROM tmp.saleGroup
|
FROM tSaleGroup
|
||||||
WHERE itemPackingTypeFk IS NOT NULL
|
WHERE itemPackingTypeFk IS NOT NULL
|
||||||
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
|
ORDER BY (itemPackingTypeFk = vItemPackingTypeFk) DESC;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
GET DIAGNOSTICS CONDITION 1
|
||||||
|
vErrorNumber = MYSQL_ERRNO,
|
||||||
|
vErrorMsg = MESSAGE_TEXT;
|
||||||
|
|
||||||
|
CALL util.debugAdd('ticket_splitItemPackingType', JSON_OBJECT(
|
||||||
|
'errorNumber', vErrorNumber,
|
||||||
|
'errorMsg', vErrorMsg,
|
||||||
|
'ticketFk', vSelf
|
||||||
|
)); -- Tmp
|
||||||
|
ROLLBACK;
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DELETE FROM vn.sale
|
START TRANSACTION;
|
||||||
WHERE quantity = 0
|
|
||||||
AND ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
SELECT id
|
||||||
|
FROM sale
|
||||||
|
WHERE ticketFk = vSelf
|
||||||
|
AND NOT quantity
|
||||||
|
FOR UPDATE;
|
||||||
|
|
||||||
|
DELETE FROM sale
|
||||||
|
WHERE NOT quantity
|
||||||
|
AND ticketFk = vSelf;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tSale
|
||||||
(PRIMARY KEY (id))
|
(PRIMARY KEY (id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT s.id, i.itemPackingTypeFk , IFNULL(sv.litros, 0) litros
|
SELECT s.id, i.itemPackingTypeFk, IFNULL(sv.litros, 0) litros
|
||||||
FROM vn.sale s
|
FROM sale s
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
|
LEFT JOIN saleVolume sv ON sv.saleFk = s.id
|
||||||
WHERE s.ticketFk = vTicketFk;
|
WHERE s.ticketFk = vSelf;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
|
CREATE OR REPLACE TEMPORARY TABLE tSaleGroup
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemPackingTypeFk, SUM(litros) totalLitros
|
SELECT itemPackingTypeFk, SUM(litros) totalLitros
|
||||||
FROM tmp.sale
|
FROM tSale
|
||||||
GROUP BY itemPackingTypeFk;
|
GROUP BY itemPackingTypeFk;
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vPackingTypesToSplit
|
SELECT COUNT(*) INTO vPackingTypesToSplit
|
||||||
FROM tmp.saleGroup
|
FROM tSaleGroup
|
||||||
WHERE itemPackingTypeFk IS NOT NULL;
|
WHERE itemPackingTypeFk IS NOT NULL;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
|
||||||
ticketFk INT,
|
ticketFk INT,
|
||||||
itemPackingTypeFk VARCHAR(1)
|
itemPackingTypeFk VARCHAR(1)
|
||||||
) ENGINE = MEMORY;
|
) ENGINE = MEMORY;
|
||||||
|
@ -61,55 +81,63 @@ BEGIN
|
||||||
CASE vPackingTypesToSplit
|
CASE vPackingTypesToSplit
|
||||||
WHEN 0 THEN
|
WHEN 0 THEN
|
||||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||||
VALUES(vTicketFk, vItemPackingTypeFk);
|
VALUES(vSelf, vItemPackingTypeFk);
|
||||||
WHEN 1 THEN
|
WHEN 1 THEN
|
||||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||||
SELECT vTicketFk, itemPackingTypeFk
|
SELECT vSelf, itemPackingTypeFk
|
||||||
FROM tmp.saleGroup
|
FROM tSaleGroup
|
||||||
WHERE itemPackingTypeFk IS NOT NULL;
|
WHERE itemPackingTypeFk IS NOT NULL;
|
||||||
ELSE
|
ELSE
|
||||||
OPEN cur1;
|
OPEN vSaleGroup;
|
||||||
|
FETCH vSaleGroup INTO vItemPackingTypeFk;
|
||||||
FETCH cur1 INTO vItemPackingTypeFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||||
VALUES(vTicketFk, vItemPackingTypeFk);
|
VALUES(vSelf, vItemPackingTypeFk);
|
||||||
|
|
||||||
read_loop: LOOP
|
l: LOOP
|
||||||
FETCH cur1 INTO vItemPackingTypeFk;
|
SET vDone = FALSE;
|
||||||
|
FETCH vSaleGroup INTO vItemPackingTypeFk;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE read_loop;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL vn.ticket_Clone(vTicketFk, vNewTicketFk);
|
CALL ticket_Clone(vSelf, vNewTicketFk);
|
||||||
|
|
||||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||||
VALUES(vNewTicketFk, vItemPackingTypeFk);
|
VALUES(vNewTicketFk, vItemPackingTypeFk);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
CLOSE cur1;
|
CLOSE vSaleGroup;
|
||||||
|
|
||||||
UPDATE vn.sale s
|
SELECT s.id
|
||||||
JOIN tmp.sale ts ON ts.id = s.id
|
FROM sale s
|
||||||
|
JOIN tSale ts ON ts.id = s.id
|
||||||
|
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
|
||||||
|
FOR UPDATE;
|
||||||
|
|
||||||
|
UPDATE sale s
|
||||||
|
JOIN tSale ts ON ts.id = s.id
|
||||||
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
|
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
|
||||||
SET s.ticketFk = t.ticketFk;
|
SET s.ticketFk = t.ticketFk;
|
||||||
|
|
||||||
SELECT itemPackingTypeFk INTO vItemPackingTypeFk
|
SELECT itemPackingTypeFk INTO vItemPackingTypeFk
|
||||||
FROM tmp.saleGroup sg
|
FROM tSaleGroup sg
|
||||||
WHERE sg.itemPackingTypeFk IS NOT NULL
|
WHERE sg.itemPackingTypeFk IS NOT NULL
|
||||||
ORDER BY sg.itemPackingTypeFk
|
ORDER BY sg.itemPackingTypeFk
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
UPDATE vn.sale s
|
UPDATE sale s
|
||||||
JOIN tmp.sale ts ON ts.id = s.id
|
JOIN tSale ts ON ts.id = s.id
|
||||||
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
|
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
|
||||||
SET s.ticketFk = t.ticketFk
|
SET s.ticketFk = t.ticketFk
|
||||||
WHERE ts.itemPackingTypeFk IS NULL;
|
WHERE ts.itemPackingTypeFk IS NULL;
|
||||||
END CASE;
|
END CASE;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.sale,
|
tSale,
|
||||||
tmp.saleGroup;
|
tSaleGroup;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -9,6 +9,8 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vLastIn DATETIME ;
|
DECLARE vLastIn DATETIME ;
|
||||||
DECLARE vIsMiddleOdd BOOLEAN ;
|
DECLARE vIsMiddleOdd BOOLEAN ;
|
||||||
|
DECLARE vMailTo VARCHAR(50) DEFAULT NULL;
|
||||||
|
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
|
||||||
|
|
||||||
IF (vTimed IS NULL) THEN
|
IF (vTimed IS NULL) THEN
|
||||||
SET vTimed = util.VN_NOW();
|
SET vTimed = util.VN_NOW();
|
||||||
|
@ -57,5 +59,18 @@ BEGIN
|
||||||
VALUES('in', NULL);
|
VALUES('in', NULL);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF (SELECT option1 IS NULL AND option2 IS NULL FROM tmp.workerTimeControlDirection) THEN
|
||||||
|
SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName)
|
||||||
|
INTO vMailTo, vUserName
|
||||||
|
FROM account.user u
|
||||||
|
JOIN worker w ON w.bossFk = u.id
|
||||||
|
WHERE w.id = vWorkerFk;
|
||||||
|
|
||||||
|
CALL mail_insert(
|
||||||
|
vMailTo,
|
||||||
|
vMailTo,
|
||||||
|
'Error al fichar',
|
||||||
|
CONCAT(vUserName, ' tiene problemas para fichar'));
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert
|
||||||
BEFORE INSERT ON `delivery`
|
BEFORE INSERT ON `delivery`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
IF (NEW.longitude IS NOT NULL
|
||||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
|
AND NEW.latitude IS NOT NULL
|
||||||
|
AND NEW.ticketFK IS NOT NULL)
|
||||||
THEN
|
THEN
|
||||||
UPDATE address
|
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
|
||||||
SET longitude = NEW.longitude,
|
|
||||||
latitude = NEW.latitude
|
|
||||||
WHERE id IN (
|
|
||||||
SELECT addressFK
|
|
||||||
FROM ticket
|
|
||||||
WHERE id = NEW.ticketFk
|
|
||||||
);
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate
|
||||||
BEFORE UPDATE ON `delivery`
|
BEFORE UPDATE ON `delivery`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
IF (NEW.longitude IS NOT NULL
|
||||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
|
AND NEW.latitude IS NOT NULL
|
||||||
|
AND NEW.ticketFK IS NOT NULL)
|
||||||
THEN
|
THEN
|
||||||
UPDATE address
|
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
|
||||||
SET longitude = NEW.longitude,
|
|
||||||
latitude = NEW.latitude
|
|
||||||
WHERE id IN (
|
|
||||||
SELECT addressFK
|
|
||||||
FROM ticket
|
|
||||||
WHERE id = NEW.ticketFk
|
|
||||||
);
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -11,11 +11,9 @@ BEGIN
|
||||||
IF NEW.isBooked = OLD.isBooked AND (
|
IF NEW.isBooked = OLD.isBooked AND (
|
||||||
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
||||||
NOT (NEW.dated <=> OLD.dated) OR
|
NOT (NEW.dated <=> OLD.dated) OR
|
||||||
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
|
|
||||||
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
||||||
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
||||||
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
||||||
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
|
|
||||||
NOT (NEW.typeFk <=> OLD.typeFk)
|
NOT (NEW.typeFk <=> OLD.typeFk)
|
||||||
) THEN
|
) THEN
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
|
||||||
|
AFTER DELETE ON `itemMinimumQuantity`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO itemLog
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'ItemMinimumQuantity',
|
||||||
|
`changedModelId` = OLD.id,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
|
||||||
|
BEFORE INSERT ON `itemMinimumQuantity`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `itemMinimumQuantity`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving _afterDelete`
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterDelete`
|
||||||
AFTER DELETE ON `itemShelving`
|
AFTER DELETE ON `itemShelving`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_afterDelete`
|
||||||
|
AFTER DELETE ON `productionConfig`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO productionConfig
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'ProductionConfig',
|
||||||
|
`changedModelId` = OLD.id,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeInsert`
|
||||||
|
BEFORE INSERT ON `productionConfig`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `productionConfig`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -54,8 +54,7 @@ AS SELECT `b`.`entryFk` AS `Id_Entrada`,
|
||||||
`i`.`packingOut` AS `packingOut`,
|
`i`.`packingOut` AS `packingOut`,
|
||||||
`b`.`itemOriginalFk` AS `itemOriginalFk`,
|
`b`.`itemOriginalFk` AS `itemOriginalFk`,
|
||||||
`io`.`longName` AS `itemOriginalName`,
|
`io`.`longName` AS `itemOriginalName`,
|
||||||
`it`.`gramsMax` AS `gramsMax`,
|
`it`.`gramsMax` AS `gramsMax`
|
||||||
`i`.`minQuantity` AS `minQuantity`
|
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`agencyIncoming` (
|
||||||
|
`agencyModeFk` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`agencyModeFk`)
|
||||||
|
)
|
||||||
|
ENGINE=InnoDB
|
||||||
|
DEFAULT CHARSET=utf8mb3
|
||||||
|
COLLATE=utf8mb3_unicode_ci COMMENT='Agencias de entrada de mercancias';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO vn.agencyIncoming (agencyModeFk) VALUES
|
||||||
|
(1343), (1002), (1282), (841), (1303), (714), (556), (1786), (1785), (1784),
|
||||||
|
(1780), (1783), (1758), (1782), (1772), (1789), (1776), (1791), (1778), (1792),
|
||||||
|
(1779), (1362), (681), (1765), (15), (1594), (1706), (1707), (907), (1260),
|
||||||
|
(1715), (1371), (1372), (53), (689), (1375), (738), (742), (1307), (1700), (608),
|
||||||
|
(1311), (1315), (1339), (1433), (1338), (1332), (1844), (842), (1382), (1466),
|
||||||
|
(1719), (1723), (1725), (1720), (1732), (1736), (1728), (1724), (1726), (1727),
|
||||||
|
(1767), (1734), (1730), (1845), (1729), (1746), (1699), (2), (671), (1379), (614),
|
||||||
|
(1718), (1697), (62), (1529), (1392), (1378), (1438), (1796), (1688), (686),
|
||||||
|
(1326), (1691), (1), (1560), (1695), (1696), (1558), (1648), (1649), (1598),
|
||||||
|
(1680), (1694), (1600), (1601), (1602), (1712), (1603), (1604), (1641), (1692),
|
||||||
|
(1693), (1650), (1683), (1682), (1681), (1713), (1826), (1768), (1769), (1770),
|
||||||
|
(1593), (1443), (1244), (1679), (1006), (1361), (1102), (1655), (1744), (1225),
|
||||||
|
(1007);
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE `vn`.`client`
|
||||||
|
ADD COLUMN `hasDailyInvoice` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el cliente requiere facturación diaria por defecto se copiará lo que tenga country.hasDailyInvoice';
|
|
@ -0,0 +1,23 @@
|
||||||
|
ALTER TABLE vn.productionConfig
|
||||||
|
ADD editorFk int(10) unsigned DEFAULT NULL NULL;
|
||||||
|
ALTER TABLE vn.productionConfig
|
||||||
|
ADD CONSTRAINT productionConfig_user_FK FOREIGN KEY (editorFk) REFERENCES account.`user`(id);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE `vn`.`productionConfigLog` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`originFk` int(11) DEFAULT NULL,
|
||||||
|
`userFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
`action` set('insert','update','delete','select') NOT NULL,
|
||||||
|
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||||
|
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||||
|
`changedModel` enum('ProductionConfig') NOT NULL DEFAULT 'ProductionConfig',
|
||||||
|
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||||
|
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||||
|
`changedModelId` int(11) NOT NULL,
|
||||||
|
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `productionConfigLog_userFk` (`userFk`),
|
||||||
|
KEY `productionConfigLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||||
|
KEY `productionConfigLog_originFk` (`originFk`,`creationDate`),
|
||||||
|
CONSTRAINT `productionConfigUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.itemShelving ADD isSplit tinyint(1) NULL COMMENT 'Este valor cambia al splitar un carro que se ha quedado en holanda';
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT IGNORE INTO vn.observationType (`description`,code)
|
||||||
|
VALUES ('Sustitución','substitution');
|
|
@ -0,0 +1,42 @@
|
||||||
|
USE `vn`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS vn.`tillSerial` (
|
||||||
|
`code` varchar(2) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`description` varchar(30) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`account` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES(' S', 'Saldos final / inicial', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('A', 'Factura cliente', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('B', 'Factura cliente', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('C', 'Facturas Contado', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CC', 'Cuadre caja', '6780000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CD', 'Cuenta Director Comercial', '5510000002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CH', 'Cheques', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CM', 'Cambio', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CR', 'Ingreso/Reintegro Caja Rural', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CT', 'Correos y telégrafos', '6290000005');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DC', 'Dietas conductores', '6290000010');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DH', 'Deudas Holland', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DT', 'Dietas', '6290000011');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('E', 'Entrada mercancia', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('EN', 'Enric Martinez', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GC', 'Cuenta con dto. Comercial', '5510000003');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GP', 'Gastos de personal', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GR', 'Gastos RRPP dpto comercial', '6290001002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GS', 'Gasoil', '6280000002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GV', 'Gastos viaje', '6290001000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('JV', 'Juanvi', '6290000553');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MB', 'Movimiento bancario', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MP', 'Materias Primas', '6000000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('OG', 'Otros gastos', '6290000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('PM', 'Pequeño material', '6290000007');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('R', 'Factura proveedor', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RC', 'Ingreso/Reintegro Ruralcaja', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RN', 'Reparación nave', '6220000004');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('SS', 'Gastos Silla', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('T', 'Ticket', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TA', 'Factura rapida', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TC', 'Ticket contado', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TR', 'Traspaso', NULL);
|
|
@ -0,0 +1 @@
|
||||||
|
CREATE INDEX travel_landed_IDX USING BTREE ON vn.travel (landed DESC,warehouseInFk,warehouseOutFk);
|
|
@ -0,0 +1,6 @@
|
||||||
|
RENAME TABLE vn.addressShortage TO vn.addressWaste;
|
||||||
|
ALTER TABLE vn.addressWaste ADD `type` ENUM('internal', 'external') NOT NULL;
|
||||||
|
INSERT IGNORE INTO vn.addressWaste (addressFk,`type`) VALUES
|
||||||
|
(2230,'external'),
|
||||||
|
(5986,'external'),
|
||||||
|
(7475,'external');
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE vn.expeditionState
|
||||||
|
MODIFY COLUMN userFk INT(10) UNSIGNED,
|
||||||
|
ADD CONSTRAINT expeditionState_userFk FOREIGN KEY (userFk)
|
||||||
|
REFERENCES account.`user`(id);
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE `vn`.`claimDestination`
|
||||||
|
ADD COLUMN `code` varchar(45) DEFAULT NULL;
|
||||||
|
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Good' WHERE description= 'Bueno';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Garbage/Loss' WHERE description = 'Basura/Perd.';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Manufacturing' WHERE description = 'Confeccion';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Claim' WHERE description = 'Reclam.PRAG';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Corrected' WHERE description = 'Corregido';
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS clientTypeWidth int(10) unsigned NULL
|
||||||
|
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
|
||||||
|
|
||||||
|
UPDATE vn.mrwConfig
|
||||||
|
SET clientTypeWidth = 6;
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE vn.vehicle DROP FOREIGN KEY provinceFk;
|
||||||
|
ALTER TABLE vn.vehicle
|
||||||
|
ADD CONSTRAINT vehicle_warehouse_FK FOREIGN KEY (warehouseFk) REFERENCES vn.warehouse(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.payrollWorker CHANGE grupotarifa__ grupotarifa int(10) NOT NULL;
|
||||||
|
ALTER TABLE vn.payrollWorker MODIFY COLUMN grupotarifa int(10) NOT NULL;
|
|
@ -0,0 +1,30 @@
|
||||||
|
ALTER TABLE vn.item CHANGE minQuantity minQuantity__ int(10) unsigned DEFAULT
|
||||||
|
NULL NULL COMMENT '@deprecated 2024-07-11 refs #7704 Cantidad mínima para una línea de venta';
|
||||||
|
|
||||||
|
CREATE TABLE `vn`.`itemMinimumQuantity` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`itemFk` int(10) NOT NULL,
|
||||||
|
`quantity` int(10) NOT NULL,
|
||||||
|
`started` date NOT NULL,
|
||||||
|
`ended` date DEFAULT NULL,
|
||||||
|
`warehouseFk` smallint(5) unsigned DEFAULT NULL,
|
||||||
|
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
|
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `itemMinimumQuantity_UNIQUE` (`itemFk`, `started`, `ended`, `warehouseFk`),
|
||||||
|
KEY `itemFk` (`itemFk`),
|
||||||
|
KEY `started` (`started`),
|
||||||
|
KEY `ended` (`ended`),
|
||||||
|
KEY `warehouseFk` (`warehouseFk`),
|
||||||
|
KEY `editorFk` (`editorFk`),
|
||||||
|
CONSTRAINT `itemMinimumQuantity_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `itemMinimumQuantity_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `itemMinimumQuantity_ibfk_3` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
|
||||||
|
CONSTRAINT `itemMinimumQuantity_check_1` CHECK (`started` <= `ended`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
GRANT SELECT, UPDATE, DELETE, INSERT ON TABLE vn.itemMinimumQuantity TO buyer;
|
||||||
|
GRANT EXECUTE ON PROCEDURE vn.ticketCalculatePurge TO guest;
|
||||||
|
|
||||||
|
ALTER TABLE vn.itemLog MODIFY COLUMN changedModel enum('Item','ItemBarcode','ItemBotanical','ItemNiche','ItemTag','ItemTaxCountry','ItemMinimumQuantity')
|
||||||
|
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Item' NOT NULL;
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.itemMinimumQuantity
|
||||||
|
ADD CONSTRAINT itemMinimumQuantity_check CHECK (quantity > 0);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue