feat: refs #6822 entryTransfer #2503
|
@ -20,9 +20,14 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const [, , [{collectionFk}]] =
|
||||
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
|
||||
[userId], myOptions);
|
||||
const randStr = Math.random().toString(36).substring(3);
|
||||
const result = await Self.rawSql(`
|
||||
CALL vn.collection_assign(?, @vCollectionFk);
|
||||
SELECT @vCollectionFk ?
|
||||
`, [userId, randStr], myOptions);
|
||||
|
||||
// Por si entra en SELECT FOR UPDATE una o varias veces
|
||||
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
|
||||
|
||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||
|
|
|
@ -57,8 +57,10 @@ module.exports = Self => {
|
|||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
||||
sh.code,
|
||||
IFNULL(p2.code, p.code) parkingCode,
|
||||
IFNULL(p2.pickingOrder, p.pickingOrder) pickingOrder,
|
||||
p2.code parkingCode,
|
||||
p2.pickingOrder pickingOrder,
|
||||
p.code parkingCodePrevia,
|
||||
p.pickingOrder pickingOrderPrevia,
|
||||
iss.id itemShelvingSaleFk,
|
||||
iss.isPicked
|
||||
FROM ticketCollection tc
|
||||
|
@ -95,8 +97,10 @@ module.exports = Self => {
|
|||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder),
|
||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) ,
|
||||
sh.code,
|
||||
IFNULL(p2.code, p.code),
|
||||
IFNULL(p2.pickingOrder, p.pickingOrder),
|
||||
p2.code,
|
||||
p2.pickingOrder,
|
||||
p.code,
|
||||
p.pickingOrder,
|
||||
iss.id itemShelvingSaleFk,
|
||||
iss.isPicked
|
||||
FROM sectorCollection sc
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx, userId: ctx.req.accessToken.userId};
|
||||
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
|
||||
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileMultiConfig', null, options);
|
||||
|
||||
const updatableFiles = [];
|
||||
for (const file of files) {
|
||||
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
|
||||
const tables = await Self.rawSql(`
|
||||
SELECT fileName, toTable, file
|
||||
FROM edi.tableConfig
|
||||
FROM edi.tableMultiConfig
|
||||
WHERE file IN (?)`, [fileNames], options);
|
||||
|
||||
for (const table of tables) {
|
||||
|
@ -85,9 +85,9 @@ module.exports = Self => {
|
|||
for (const file of updatableFiles) {
|
||||
console.log(`Updating file ${file.name} checksum...`);
|
||||
await Self.rawSql(`
|
||||
UPDATE edi.fileConfig
|
||||
SET checksum = ?
|
||||
WHERE name = ?`,
|
||||
UPDATE edi.fileMultiConfig
|
||||
SET checksum = ?
|
||||
WHERE name = ?`,
|
||||
[file.checksum, file.name], options);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ module.exports = Self => {
|
|||
|
||||
await Self.rawSql(sqlTemplate, [filePath], options);
|
||||
await Self.rawSql(`
|
||||
UPDATE edi.tableConfig
|
||||
UPDATE edi.tableMultiConfig
|
||||
SET updated = ?
|
||||
WHERE fileName = ?
|
||||
`, [Date.vnNew(), baseName], options);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</mrw:Direccion>
|
||||
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
|
||||
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
|
||||
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
|
||||
<mrw:Telefono><%= expeditionData.mobile %></mrw:Telefono>
|
||||
<mrw:Observaciones><%= expeditionData.deliveryObservation %></mrw:Observaciones>
|
||||
</mrw:DatosEntrega>
|
||||
<mrw:DatosServicio>
|
||||
|
|
|
@ -47,13 +47,13 @@ module.exports = Self => {
|
|||
co.code countryCode,
|
||||
c.fi,
|
||||
c.name clientName,
|
||||
c.phone,
|
||||
IFNULL(a.mobile, c.mobile) mobile,
|
||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||
t.shipped,
|
||||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
|
||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||
oa.description deliveryObservation
|
||||
ta.description deliveryObservation
|
||||
FROM expedition e
|
||||
JOIN ticket t ON e.ticketFk = t.id
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
|
@ -62,8 +62,8 @@ module.exports = Self => {
|
|||
AND mw.weekDays & (1 << WEEKDAY(t.landed))
|
||||
JOIN client c ON t.clientFk = c.id
|
||||
JOIN address a ON t.addressFk = a.id
|
||||
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||
AND oa.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'delivery')
|
||||
LEFT JOIN ticketObservation ta ON ta.ticketFk = t.id
|
||||
AND ta.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'agency')
|
||||
JOIN province p ON a.provinceFk = p.id
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
JOIN mrwConfig mc
|
||||
|
|
|
@ -11,13 +11,6 @@ module.exports = Self => {
|
|||
arg: 'filter',
|
||||
type: 'object',
|
||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'search',
|
||||
type: 'string',
|
||||
description: 'Value to filter',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
],
|
||||
returns: {
|
||||
|
@ -29,13 +22,11 @@ module.exports = Self => {
|
|||
verb: 'GET',
|
||||
},
|
||||
});
|
||||
Self.filter = async(ctx, filter, options) => {
|
||||
Self.filter = async(filter = {}, options) => {
|
||||
const myOptions = {};
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
filter = ctx?.filter ?? {};
|
||||
|
||||
const conn = Self.dataSource.connector;
|
||||
const where = buildFilter(filter?.where, (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -50,31 +41,33 @@ module.exports = Self => {
|
|||
};
|
||||
}
|
||||
}) ?? {};
|
||||
delete ctx.filter.where;
|
||||
delete filter.where;
|
||||
|
||||
const stmts = [];
|
||||
let stmt;
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
pc.townFk,
|
||||
t.provinceFk,
|
||||
p.countryFk,
|
||||
pc.code,
|
||||
t.name as town,
|
||||
p.name as province,
|
||||
c.name country
|
||||
FROM
|
||||
postCode pc
|
||||
JOIN town t on t.id = pc.townFk
|
||||
JOIN province p on p.id = t.provinceFk
|
||||
JOIN country c on c.id = p.countryFk
|
||||
SELECT
|
||||
pc.townFk,
|
||||
t.provinceFk,
|
||||
p.countryFk,
|
||||
pc.code,
|
||||
t.name as town,
|
||||
p.name as province,
|
||||
c.name country
|
||||
FROM
|
||||
postCode pc
|
||||
JOIN town t on t.id = pc.townFk
|
||||
JOIN province p on p.id = t.provinceFk
|
||||
JOIN country c on c.id = p.countryFk
|
||||
`);
|
||||
|
||||
stmt.merge(conn.makeSuffix({where, ...ctx}));
|
||||
stmt.merge(conn.makeSuffix({where}));
|
||||
stmt.merge(conn.makeLimit(filter));
|
||||
const itemsIndex = stmts.push(stmt) - 1;
|
||||
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const result = await conn.executeStmt(sql, myOptions);
|
||||
|
||||
return itemsIndex === 0 ? result : result[itemsIndex];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,12 +6,9 @@ describe('Postcode filter()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const ctx = {
|
||||
filter: {
|
||||
},
|
||||
const results = await models.Postcode.filter({
|
||||
limit: 1
|
||||
};
|
||||
const results = await models.Postcode.filter(ctx, options);
|
||||
}, options);
|
||||
|
||||
expect(results.length).toEqual(1);
|
||||
await tx.rollback();
|
||||
|
@ -26,14 +23,11 @@ describe('Postcode filter()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const ctx = {
|
||||
filter: {
|
||||
where: {
|
||||
search: 46,
|
||||
}
|
||||
},
|
||||
};
|
||||
const results = await models.Postcode.filter(ctx, options);
|
||||
const results = await models.Postcode.filter({
|
||||
where: {
|
||||
search: 46,
|
||||
}
|
||||
}, options);
|
||||
|
||||
expect(results.length).toEqual(4);
|
||||
await tx.rollback();
|
||||
|
@ -48,14 +42,9 @@ describe('Postcode filter()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const ctx = {
|
||||
filter: {
|
||||
where: {
|
||||
search: 'Alz',
|
||||
}
|
||||
},
|
||||
};
|
||||
const results = await models.Postcode.filter(ctx, options);
|
||||
const results = await models.Postcode.filter({where: {
|
||||
search: 'Alz',
|
||||
}}, options);
|
||||
|
||||
expect(results.length).toEqual(1);
|
||||
await tx.rollback();
|
||||
|
@ -70,14 +59,9 @@ describe('Postcode filter()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const ctx = {
|
||||
filter: {
|
||||
where: {
|
||||
search: 'one',
|
||||
}
|
||||
},
|
||||
};
|
||||
const results = await models.Postcode.filter(ctx, options);
|
||||
const results = await models.Postcode.filter({where: {
|
||||
search: 'one',
|
||||
}}, options);
|
||||
|
||||
expect(results.length).toEqual(4);
|
||||
await tx.rollback();
|
||||
|
@ -92,14 +76,11 @@ describe('Postcode filter()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const ctx = {
|
||||
filter: {
|
||||
where: {
|
||||
search: 'Ec',
|
||||
}
|
||||
},
|
||||
};
|
||||
const results = await models.Postcode.filter(ctx, options);
|
||||
const results = await models.Postcode.filter({
|
||||
where: {
|
||||
search: 'Ec',
|
||||
}
|
||||
}, options);
|
||||
|
||||
expect(results.length).toEqual(1);
|
||||
await tx.rollback();
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
"Company": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Config": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Continent": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "Config",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "config"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"inventoried": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "salix.defaultViewConfig"
|
||||
"table": "salix.defaultViewMultiConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
},
|
||||
"itemFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"isChecked": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,8 @@
|
|||
"properties": {
|
||||
"code": {
|
||||
"id": true,
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"type": "number"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "userConfig"
|
||||
"table": "userMultiConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
|
|
@ -2,6 +2,5 @@ apps:
|
|||
- script: ./loopback/server/server.js
|
||||
name: salix-back
|
||||
instances: 1
|
||||
max_restarts: 3
|
||||
restart_delay: 15000
|
||||
max_restarts: 0
|
||||
node_args: --tls-min-v1.0 --openssl-legacy-provider
|
||||
|
|
|
@ -3,7 +3,7 @@ USE `util`;
|
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
INSERT INTO `version` VALUES ('vn-database','11117','5558e69e648c3819d4a1edf86f8df4b94d36e71a','2024-07-09 07:39:39','11141');
|
||||
INSERT INTO `version` VALUES ('vn-database','11154','04ff3e0cc79b00272d1ebbde7196292eab651c1d','2024-07-23 09:24:55','11163');
|
||||
|
||||
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);
|
||||
|
@ -764,6 +764,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10955','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','10956','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10957','00-aclTicketClone.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10960','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:12',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10962','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-25 08:27:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10964','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10967','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||
|
@ -779,6 +780,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jen
|
|||
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','10986','00-addSummaryId.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:12',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','10991','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
|
||||
|
@ -877,8 +879,31 @@ INSERT INTO `versionLog` VALUES ('vn-database','11111','00-firstScript.sql','jen
|
|||
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','11118','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-19 12:28:49',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11119','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:13',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11120','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11121','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11126','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11128','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11129','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11130','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11131','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:15',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','11135','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:16',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11136','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:22:16',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11137','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:33',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11138','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:34',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);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11140','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:34',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11145','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 13:55:46',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11149','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11150','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11152','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-16 09:06:11',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11154','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-23 08:23:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11157','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-16 13:11:00',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11158','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-17 17:06:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11159','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-18 17:23:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11160','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-18 13:46:16',NULL,NULL);
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
@ -1248,6 +1273,7 @@ INSERT INTO `roleInherit` VALUES (370,72,130,10578);
|
|||
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 `roleInherit` VALUES (375,120,131,1437);
|
||||
|
||||
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
|
||||
|
||||
|
@ -1461,7 +1487,7 @@ INSERT INTO `ACL` VALUES (260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','emp
|
|||
INSERT INTO `ACL` VALUES (261,'SupplierAccount','*','*','ALLOW','ROLE','administrative');
|
||||
INSERT INTO `ACL` VALUES (262,'Entry','*','*','ALLOW','ROLE','administrative');
|
||||
INSERT INTO `ACL` VALUES (263,'InvoiceIn','*','READ','ALLOW','ROLE','administrative');
|
||||
INSERT INTO `ACL` VALUES (264,'StarredModule','*','*','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (264,'StarredModule','*','*','ALLOW','ROLE','$authenticated');
|
||||
INSERT INTO `ACL` VALUES (265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss');
|
||||
INSERT INTO `ACL` VALUES (266,'ZoneLog','*','READ','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss');
|
||||
|
@ -1906,12 +1932,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 (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl');
|
||||
INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl');
|
||||
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
|
||||
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','developer');
|
||||
INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateMailState','WRITE','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','teamBoss');
|
||||
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','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 (784,'VnRole','*','READ','ALLOW','ROLE','employee');
|
||||
|
@ -2020,6 +2046,13 @@ 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 `ACL` VALUES (896,'Expedition_PrintOut','*','READ','ALLOW','ROLE','production');
|
||||
INSERT INTO `ACL` VALUES (897,'WorkerLog','*','READ','ALLOW','ROLE','employee');
|
||||
INSERT INTO `ACL` VALUES (901,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','system');
|
||||
INSERT INTO `ACL` VALUES (902,'Entry','filter','READ','ALLOW','ROLE','supplier');
|
||||
INSERT INTO `ACL` VALUES (903,'Entry','getBuys','READ','ALLOW','ROLE','supplier');
|
||||
INSERT INTO `ACL` VALUES (904,'Entry','buyLabel','READ','ALLOW','ROLE','supplier');
|
||||
INSERT INTO `ACL` VALUES (905,'AddressWaste','*','READ','ALLOW','ROLE','production');
|
||||
|
||||
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
|
||||
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
||||
|
@ -2120,9 +2153,9 @@ USE `vn`;
|
|||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
INSERT INTO `alertLevel` VALUES ('FREE',0,1);
|
||||
INSERT INTO `alertLevel` VALUES ('ON_PREPARATION',1,1);
|
||||
INSERT INTO `alertLevel` VALUES ('PACKED',2,0);
|
||||
INSERT INTO `alertLevel` VALUES ('DELIVERED',3,0);
|
||||
INSERT INTO `alertLevel` VALUES ('ON_PREPARATION',2,1);
|
||||
INSERT INTO `alertLevel` VALUES ('PACKED',3,0);
|
||||
INSERT INTO `alertLevel` VALUES ('DELIVERED',4,0);
|
||||
|
||||
INSERT INTO `bookingPlanner` VALUES (5,'2017-07-01 00:00:00','4770000002','WORLD',7,4,1);
|
||||
INSERT INTO `bookingPlanner` VALUES (6,'2017-07-01 00:00:00','4770000010','NATIONAL',3,1,1);
|
||||
|
@ -2321,18 +2354,18 @@ INSERT INTO `component` VALUES (47,'promocion Italia',4,NULL,NULL,1,'italianOffe
|
|||
INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0);
|
||||
INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0);
|
||||
|
||||
INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST');
|
||||
INSERT INTO `componentType` VALUES (2,'com ventas',1,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (3,'com compras',1,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (4,'empresa',1,1,'MARGIN');
|
||||
INSERT INTO `componentType` VALUES (5,'cliente',0,0,NULL);
|
||||
INSERT INTO `componentType` VALUES (6,'agencia',0,0,'FREIGHT');
|
||||
INSERT INTO `componentType` VALUES (7,'cartera_comercial',0,0,'MANA');
|
||||
INSERT INTO `componentType` VALUES (8,'cartera_producto',0,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (9,'maniobra',1,0,NULL);
|
||||
INSERT INTO `componentType` VALUES (10,'cartera_comprador',0,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (11,'errores',0,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (12,'otros',0,1,NULL);
|
||||
INSERT INTO `componentType` VALUES (1,'cost','coste',1,0);
|
||||
INSERT INTO `componentType` VALUES (2,NULL,'com ventas',1,1);
|
||||
INSERT INTO `componentType` VALUES (3,NULL,'com compras',1,1);
|
||||
INSERT INTO `componentType` VALUES (4,'margin','empresa',1,1);
|
||||
INSERT INTO `componentType` VALUES (5,NULL,'cliente',0,0);
|
||||
INSERT INTO `componentType` VALUES (6,'freight','agencia',0,0);
|
||||
INSERT INTO `componentType` VALUES (7,'mana','cartera_comercial',0,0);
|
||||
INSERT INTO `componentType` VALUES (8,NULL,'cartera_producto',0,1);
|
||||
INSERT INTO `componentType` VALUES (9,NULL,'maniobra',1,0);
|
||||
INSERT INTO `componentType` VALUES (10,NULL,'cartera_comprador',0,1);
|
||||
INSERT INTO `componentType` VALUES (11,NULL,'errores',0,1);
|
||||
INSERT INTO `componentType` VALUES (12,'other','otros',0,1);
|
||||
|
||||
INSERT INTO `continent` VALUES (1,'Asia','AS');
|
||||
INSERT INTO `continent` VALUES (2,'América','AM');
|
||||
|
@ -2340,61 +2373,62 @@ INSERT INTO `continent` VALUES (3,'África','AF');
|
|||
INSERT INTO `continent` VALUES (4,'Europa','EU');
|
||||
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
|
||||
|
||||
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (43,'VT','VENTAS',38,69,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (44,'management','GERENCIA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (46,'delivery','REPARTO',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',76,77,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',43,44,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',45,46,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',47,48,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',1,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
|
||||
INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',1,'es1@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',51,52,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',53,54,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',55,56,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',57,58,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',59,60,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',61,62,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
|
||||
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',63,64,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
|
||||
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',65,66,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,112,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,5,NULL,72,0,0,1,1,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (23,'CMA','CAMARA',15,16,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (31,'it','INFORMATICA',6,7,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (35,'finance','FINANZAS',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (36,'labor','LABORAL',12,13,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',14,37,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (38,'picking','SACADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',38,39,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (43,'VT','VENTAS',40,71,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (44,'management','GERENCIA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (46,'delivery','REPARTO',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',78,79,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',21,22,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',23,24,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',86,89,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',43,44,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (61,NULL,'VNH',92,95,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',25,26,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',98,99,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',45,46,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',100,101,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',102,103,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (90,NULL,'TRAILER',93,94,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',27,28,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',47,48,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',49,50,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',1,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
|
||||
INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',51,52,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',1,'es1@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',53,54,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',55,56,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',57,58,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',104,105,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (130,NULL,'REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',87,88,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',63,64,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
|
||||
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',65,66,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
|
||||
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (137,'sorter','SORTER',110,111,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (141,NULL,'PREVIA',35,36,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,22,'/1/22/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
|
||||
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
|
||||
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
|
||||
|
@ -2656,38 +2690,38 @@ INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1,'al
|
|||
INSERT INTO `state` VALUES (2,'Libre',2,0,'FREE',NULL,2,0,0,0,0,0,0,4,1,'notice');
|
||||
INSERT INTO `state` VALUES (3,'OK',3,0,'OK',3,28,1,0,0,0,1,1,3,0,'success');
|
||||
INSERT INTO `state` VALUES (4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0,'success');
|
||||
INSERT INTO `state` VALUES (5,'Preparación',6,1,'ON_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (5,'Preparación',6,2,'ON_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (6,'En Revisión',7,2,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1,'alert');
|
||||
INSERT INTO `state` VALUES (8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL);
|
||||
INSERT INTO `state` VALUES (10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (11,'Facturado',0,3,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (8,'Revisado',8,2,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (9,'Encajando',9,3,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL);
|
||||
INSERT INTO `state` VALUES (10,'Encajado',10,3,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (11,'Facturado',0,4,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1,'alert');
|
||||
INSERT INTO `state` VALUES (13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (13,'En Reparto',11,4,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (14,'Preparado',6,2,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning');
|
||||
INSERT INTO `state` VALUES (15,'Pte Recogida',12,4,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (16,'Entregado',13,4,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL);
|
||||
INSERT INTO `state` VALUES (20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0,'success');
|
||||
INSERT INTO `state` VALUES (21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success');
|
||||
INSERT INTO `state` VALUES (21,'Retornado',4,2,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success');
|
||||
INSERT INTO `state` VALUES (22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1,'alert');
|
||||
INSERT INTO `state` VALUES (23,'URGENTE',5,1,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success');
|
||||
INSERT INTO `state` VALUES (23,'URGENTE',5,2,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success');
|
||||
INSERT INTO `state` VALUES (24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1,'success');
|
||||
INSERT INTO `state` VALUES (25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0,'alert');
|
||||
INSERT INTO `state` VALUES (26,'Prep Previa',5,0,'PREVIOUS_PREPARATION',1,28,1,0,0,1,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success');
|
||||
INSERT INTO `state` VALUES (27,'Prep Asistida',5,2,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success');
|
||||
INSERT INTO `state` VALUES (28,'Previa OK',3,0,'OK PREVIOUS',3,28,1,0,1,1,1,1,3,0,'warning');
|
||||
INSERT INTO `state` VALUES (29,'Previa Impreso',4,0,'PRINTED PREVIOUS',2,29,1,0,1,0,0,1,2,0,'success');
|
||||
INSERT INTO `state` VALUES (30,'Embarcado',4,1,'BOARD',5,30,0,0,0,2,0,0,3,0,'success');
|
||||
INSERT INTO `state` VALUES (31,'Polizon Impreso',4,1,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,2,0,'success');
|
||||
INSERT INTO `state` VALUES (32,'Polizon OK',3,1,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning');
|
||||
INSERT INTO `state` VALUES (30,'Embarcado',4,2,'BOARD',5,30,0,0,0,2,0,0,3,0,'success');
|
||||
INSERT INTO `state` VALUES (31,'Polizon Impreso',4,2,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,2,0,'success');
|
||||
INSERT INTO `state` VALUES (32,'Polizon OK',3,2,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning');
|
||||
INSERT INTO `state` VALUES (33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0,'success');
|
||||
INSERT INTO `state` VALUES (34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1,'alert');
|
||||
INSERT INTO `state` VALUES (35,'Semi-Encajado',9,2,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL);
|
||||
INSERT INTO `state` VALUES (35,'Semi-Encajado',9,3,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL);
|
||||
INSERT INTO `state` VALUES (36,'Previa Revisando',3,0,'PREVIOUS_CONTROL',2,37,1,0,0,4,0,1,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,1,0,1,0,0,1,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (38,'Prep Cámara',6,1,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (41,'Prep Parcial',6,1,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (38,'Prep Cámara',6,2,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
INSERT INTO `state` VALUES (41,'Prep Parcial',6,2,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
|
||||
|
||||
INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','renewPrices');
|
||||
INSERT INTO `ticketUpdateAction` VALUES (2,'Convertir en maná','mana');
|
||||
|
|
|
@ -464,6 +464,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','address','alexm@%','0000-00-00 00:00:00','Insert','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','pbx','grafana','queue','root@localhost','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','address','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountingType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingStock_byWarehouse','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
|
@ -738,7 +739,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','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','buyer','buy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','carlosap@10.5.1.8','0000-00-00 00:00:00','Select,Update,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','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
||||
|
@ -777,6 +778,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleState
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleEvent','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','cooler','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','itemBotanical','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','productionConfigLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','signInLog','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketTracking','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionState','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
|
@ -787,6 +789,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','printServerQueue__
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','buy','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemMinimumQuantity','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','producer','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1003,7 +1006,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendar','juan@db-
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','campaign','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketService','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','report','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buyer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buyer','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','bs','grafana','defaulter','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','componentType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientManaCache','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1274,7 +1277,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bs','grafana','workerProductivityC
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','antenna','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','cmr','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','accounting','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditClassification','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditClassification','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketLog','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','moving','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimDevelopment','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1389,9 +1392,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','waste','alexm@db-prox
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visit','root@localhost','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guillermo@10.5.1.3','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','');
|
||||
|
@ -1431,6 +1434,19 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran_st
|
|||
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','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','buy','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','entryType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','claimDestination','juan@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','entryLog','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','dipole','grafana','expedition_PrintOut','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketObservation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','recovery','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','observationType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientInforma','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','accountingType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicyDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicyReview','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicy','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||
|
@ -1902,6 +1918,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','invoiceoutboo
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticket_gettax','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','util','productionAssi','midnight','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','dipole','employee','expedition_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_transfer','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','itempacking','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','cache','employee','available_refresh','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
|
@ -2031,6 +2048,7 @@ 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 ('','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','itemShelvingSale_addByCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addlist','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_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');
|
||||
|
@ -2156,6 +2174,17 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPrice
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_nextTx','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_docompensation','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setQuantity','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_unpicked','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_getAssigned','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_addWithReservation','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addBySectorCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','sectorCollection_hasSalesReserved','FUNCTION','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_reallocate','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setPicked','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','sectorCollection_getMyPartial','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana-write','item_ValuateInventory','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','guest','ticketCalculatePurge','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
@ -2196,6 +2225,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 ('','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-write','{\"access\":0,\"version_id\":101106,\"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 ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -175,6 +175,70 @@ DELIMITER ;
|
|||
/*!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 `account`.`mailAliasAccount_beforeInsert`
|
||||
BEFORE INSERT ON `mailAliasAccount`
|
||||
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 `account`.`mailAliasAccount_beforeUpdate`
|
||||
BEFORE UPDATE ON `mailAliasAccount`
|
||||
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 `account`.`mailAliasAccount_afterDelete`
|
||||
AFTER DELETE ON `mailAliasAccount`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO userLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'MailAliasAccount',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = 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 `account`.`mailForward_beforeInsert`
|
||||
BEFORE INSERT ON `mailForward`
|
||||
FOR EACH ROW
|
||||
|
@ -4084,29 +4148,22 @@ DELIMITER ;
|
|||
/*!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 = utf8mb3 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb3 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
|
||||
/*!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 = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeInsert`
|
||||
BEFORE INSERT ON `delivery`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
|
||||
IF (NEW.longitude IS NOT NULL
|
||||
AND NEW.latitude IS NOT NULL
|
||||
AND NEW.ticketFK IS NOT NULL)
|
||||
THEN
|
||||
UPDATE address
|
||||
SET longitude = NEW.longitude,
|
||||
latitude = NEW.latitude
|
||||
WHERE id IN (
|
||||
SELECT addressFK
|
||||
FROM ticket
|
||||
WHERE id = NEW.ticketFk
|
||||
);
|
||||
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
|
||||
END IF;
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -4116,29 +4173,22 @@ DELIMITER ;
|
|||
/*!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 = utf8mb3 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb3 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
|
||||
/*!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 = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`delivery_beforeUpdate`
|
||||
BEFORE UPDATE ON `delivery`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
|
||||
IF (NEW.longitude IS NOT NULL
|
||||
AND NEW.latitude IS NOT NULL
|
||||
AND NEW.ticketFK IS NOT NULL)
|
||||
THEN
|
||||
UPDATE address
|
||||
SET longitude = NEW.longitude,
|
||||
latitude = NEW.latitude
|
||||
WHERE id IN (
|
||||
SELECT addressFK
|
||||
FROM ticket
|
||||
WHERE id = NEW.ticketFk
|
||||
);
|
||||
CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
|
||||
END IF;
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -6176,6 +6226,72 @@ DELIMITER ;
|
|||
/*!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`.`itemMinimumQuantity_beforeInsert`
|
||||
BEFORE INSERT ON `itemMinimumQuantity`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
CALL itemMinimumQuantity_check(NEW.id, NEW.itemFk, NEW.started, NEW.ended, NEW.warehouseFk);
|
||||
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`.`itemMinimumQuantity_beforeUpdate`
|
||||
BEFORE UPDATE ON `itemMinimumQuantity`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
CALL itemMinimumQuantity_check(NEW.id, NEW.itemFk, NEW.started, NEW.ended, NEW.warehouseFk);
|
||||
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`.`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 ;
|
||||
/*!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_beforeInsert`
|
||||
BEFORE INSERT ON `itemShelving`
|
||||
FOR EACH ROW
|
||||
|
@ -6309,6 +6425,30 @@ DELIMITER ;
|
|||
/*!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_afterDelete`
|
||||
AFTER DELETE ON `itemShelving`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO shelvingLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'itemShelving',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = 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`.`itemShelvingSale_afterInsert`
|
||||
AFTER INSERT ON `itemShelvingSale`
|
||||
FOR EACH ROW
|
||||
|
@ -7162,6 +7302,70 @@ DELIMITER ;
|
|||
/*!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`.`productionConfig_beforeInsert`
|
||||
BEFORE INSERT ON `productionConfig`
|
||||
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`.`productionConfig_beforeUpdate`
|
||||
BEFORE UPDATE ON `productionConfig`
|
||||
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`.`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 ;
|
||||
/*!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`.`projectNotes_beforeInsert`
|
||||
BEFORE INSERT ON `projectNotes`
|
||||
FOR EACH ROW
|
||||
|
@ -10939,4 +11143,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-07-09 5:48:24
|
||||
-- Dump completed on 2024-07-23 8:19:41
|
||||
|
|
|
@ -10,9 +10,6 @@ SET foreign_key_checks = 0;
|
|||
INSERT INTO util.config (id, environment, mockTime, mockUtcTime, mockEnabled)
|
||||
VALUES (1, 'local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
|
||||
|
||||
INSERT INTO util.binlogQueue (code,logName, `position`)
|
||||
VALUES ('mylogger', 'bin.000001', 4);
|
||||
|
||||
/* #5483
|
||||
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
|
||||
VALUES(1, NULL, 1, 300, 1);
|
||||
|
|
|
@ -1516,23 +1516,23 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
|||
(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`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleQuantity`, `saleInternalWaste`, `saleExternalWaste`)
|
||||
VALUES
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', 2, 1, '35074', '687', '2.0'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', 3, 1, '1777', '13', '0.7'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', 4, 1, '3182', '59', '0.6'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Crisantemo', 5, 1, '1747', '13', '0.7'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Lilium Oriental', 6, 1, '7182', '59', '0.6'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Alstroemeria', 7, 1, '1777', '13', '0.7'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 1, 1, '4181', '59', '0.6'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 2, 1, '7268', '59', '0.6'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', 2, 1, '-74', '0', '0.0'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', 3, 1, '-7', '0', '0.0'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', 4, 1, '1100', '0', '0.0'),
|
||||
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', 5, 1, '848', '-187', '-22.1'),
|
||||
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'),
|
||||
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0');
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
|
||||
|
||||
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||
VALUES
|
||||
|
@ -1968,7 +1968,7 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
|
|||
(21, 21),
|
||||
(22, 22);
|
||||
|
||||
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
|
||||
INSERT INTO `vn`.`userMultiConfig` (`userFk`, `warehouseFk`, `companyFk`)
|
||||
VALUES
|
||||
(1, 1, 69),
|
||||
(5, 1, 442),
|
||||
|
|
|
@ -1,31 +1,50 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||
BEGIN
|
||||
DECLARE vWeek INT;
|
||||
DECLARE vYear INT;
|
||||
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(CURDATE()) DAY;
|
||||
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
|
||||
|
||||
SELECT week, year
|
||||
INTO vWeek, vYear
|
||||
FROM vn.time
|
||||
WHERE dated = util.VN_CURDATE();
|
||||
CALL cache.last_buy_refresh(FALSE);
|
||||
|
||||
REPLACE bs.waste
|
||||
SELECT *, 100 * mermas / total as porcentaje
|
||||
FROM (
|
||||
SELECT buyer,
|
||||
year,
|
||||
week,
|
||||
family,
|
||||
itemFk,
|
||||
itemTypeFk,
|
||||
floor(sum(value)) as total,
|
||||
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
|
||||
FROM vn.saleValue
|
||||
where year = vYear and week = vWeek
|
||||
|
||||
GROUP BY family, itemFk
|
||||
|
||||
) sub
|
||||
ORDER BY mermas DESC;
|
||||
SELECT YEAR(t.shipped),
|
||||
WEEK(t.shipped, 4),
|
||||
it.workerFk,
|
||||
it.id,
|
||||
s.itemFk,
|
||||
SUM(s.quantity),
|
||||
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) `value`,
|
||||
SUM (
|
||||
IF(
|
||||
aw.`type` = 'internal',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
) internalWaste,
|
||||
SUM (
|
||||
IF(
|
||||
aw.`type` = 'external',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
IF(c.code = 'manaClaim',
|
||||
sc.value * s.quantity,
|
||||
0
|
||||
)
|
||||
)
|
||||
) externalWaste
|
||||
FROM vn.sale s
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN vn.address a FORCE INDEX (PRIMARY) ON a.id = t.addressFk
|
||||
LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
AND lb.warehouse_id = w.id
|
||||
JOIN vn.buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN vn.component c ON c.id = sc.componentFk
|
||||
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||
AND w.isManaged
|
||||
GROUP BY it.id, i.id;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -30,7 +30,7 @@ proc: BEGIN
|
|||
SELECT inventoried INTO started FROM vn.config LIMIT 1;
|
||||
SET ended = util.VN_CURDATE(); -- TIMESTAMPADD(DAY, -1, util.VN_CURDATE());
|
||||
|
||||
CALL vn.buyUltimateFromInterval(NULL, started, ended);
|
||||
CALL vn.buy_getUltimateFromInterval(NULL, NULL, started, ended);
|
||||
|
||||
DELETE FROM last_buy;
|
||||
|
||||
|
|
|
@ -20,9 +20,12 @@ proc:BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id, amount stock, amount visible
|
||||
FROM cache.stock
|
||||
WHERE warehouse_id = v_warehouse;
|
||||
SELECT s.item_id, SUM(s.amount) stock, SUM(s.amount) visible
|
||||
FROM stock s
|
||||
JOIN vn.warehouse w ON w.id = s.warehouse_id
|
||||
WHERE (v_warehouse IS NULL OR s.warehouse_id = v_warehouse)
|
||||
AND w.isComparative
|
||||
GROUP BY s.item_id;
|
||||
|
||||
-- Calculamos los movimientos confirmados de hoy
|
||||
CALL vn.item_calcVisible(NULL, v_warehouse);
|
||||
|
|
|
@ -1,59 +1,62 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(vSelf INT, vUserId INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(
|
||||
vSelf INT,
|
||||
vUserFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Confirms an order, creating each of its tickets on the corresponding
|
||||
* date, store and user.
|
||||
* Confirms an order, creating each of its tickets
|
||||
* on the corresponding date, store and user.
|
||||
*
|
||||
* @param vSelf The order identifier
|
||||
* @param vUser The user identifier
|
||||
*/
|
||||
DECLARE vOk BOOL;
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vHasRows BOOL;
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vShipment DATE;
|
||||
DECLARE vTicket INT;
|
||||
DECLARE vShipmentDayEnd DATETIME;
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE vNotes VARCHAR(255);
|
||||
DECLARE vItem INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vConcept VARCHAR(30);
|
||||
DECLARE vAmount INT;
|
||||
DECLARE vAvailable INT;
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
DECLARE vSale INT;
|
||||
DECLARE vRate INT;
|
||||
DECLARE vRowId INT;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vRowFk INT;
|
||||
DECLARE vPriceFixed DECIMAL(10,2);
|
||||
DECLARE vDelivery DATE;
|
||||
DECLARE vAddress INT;
|
||||
DECLARE vIsConfirmed BOOL;
|
||||
DECLARE vClientId INT;
|
||||
DECLARE vCompanyId INT;
|
||||
DECLARE vAgencyModeId INT;
|
||||
DECLARE TICKET_FREE INT DEFAULT 2;
|
||||
DECLARE vCalc INT;
|
||||
DECLARE vIsLogifloraItem BOOL;
|
||||
DECLARE vOldQuantity INT;
|
||||
DECLARE vNewQuantity INT;
|
||||
DECLARE vLanded DATE;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vClientFk INT;
|
||||
DECLARE vCompanyFk INT;
|
||||
DECLARE vAgencyModeFk INT;
|
||||
DECLARE vCalcFk INT;
|
||||
DECLARE vIsTaxDataChecked BOOL;
|
||||
|
||||
DECLARE cDates CURSOR FOR
|
||||
SELECT zgs.shipped, r.warehouse_id
|
||||
DECLARE vDates CURSOR FOR
|
||||
SELECT zgs.shipped, r.warehouseFk
|
||||
FROM `order` o
|
||||
JOIN order_row r ON r.order_id = o.id
|
||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
|
||||
WHERE o.id = vSelf AND r.amount != 0
|
||||
GROUP BY r.warehouse_id;
|
||||
JOIN orderRow r ON r.orderFk = o.id
|
||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouseFk
|
||||
WHERE o.id = vSelf
|
||||
AND r.amount
|
||||
GROUP BY r.warehouseFk;
|
||||
|
||||
DECLARE cRows CURSOR FOR
|
||||
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
|
||||
FROM order_row r
|
||||
JOIN vn.item i ON i.id = r.item_id
|
||||
WHERE r.amount != 0
|
||||
AND r.warehouse_id = vWarehouse
|
||||
AND r.order_id = vSelf
|
||||
DECLARE vRows CURSOR FOR
|
||||
SELECT r.id,
|
||||
r.itemFk,
|
||||
i.name,
|
||||
r.amount,
|
||||
r.price
|
||||
FROM orderRow r
|
||||
JOIN vn.item i ON i.id = r.itemFk
|
||||
WHERE r.amount
|
||||
AND r.warehouseFk = vWarehouseFk
|
||||
AND r.orderFk = vSelf
|
||||
ORDER BY r.rate DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
|
@ -62,26 +65,36 @@ BEGIN
|
|||
END;
|
||||
|
||||
-- Carga los datos del pedido
|
||||
SELECT o.date_send, o.address_id, o.note, a.clientFk,
|
||||
o.company_id, o.agency_id, c.isTaxDataChecked
|
||||
INTO vDelivery, vAddress, vNotes, vClientId,
|
||||
vCompanyId, vAgencyModeId, vIsTaxDataChecked
|
||||
FROM hedera.`order` o
|
||||
SELECT o.date_send,
|
||||
o.address_id,
|
||||
o.note,
|
||||
a.clientFk,
|
||||
o.company_id,
|
||||
o.agency_id,
|
||||
c.isTaxDataChecked
|
||||
INTO vLanded,
|
||||
vAddressFk,
|
||||
vNotes,
|
||||
vClientFk,
|
||||
vCompanyFk,
|
||||
vAgencyModeFk,
|
||||
vIsTaxDataChecked
|
||||
FROM `order` o
|
||||
JOIN vn.address a ON a.id = o.address_id
|
||||
JOIN vn.client c ON c.id = a.clientFk
|
||||
WHERE o.id = vSelf;
|
||||
|
||||
-- Verifica si el cliente tiene los datos comprobados
|
||||
IF NOT vIsTaxDataChecked THEN
|
||||
CALL util.throw ('clientNotVerified');
|
||||
CALL util.throw('clientNotVerified');
|
||||
END IF;
|
||||
|
||||
-- Carga las fechas de salida de cada almacen
|
||||
CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
|
||||
CALL vn.zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
||||
|
||||
-- Trabajador que realiza la accion
|
||||
IF vUserId IS NULL THEN
|
||||
SELECT employeeFk INTO vUserId FROM orderConfig;
|
||||
IF vUserFk IS NULL THEN
|
||||
SELECT employeeFk INTO vUserFk FROM orderConfig;
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
@ -89,207 +102,188 @@ BEGIN
|
|||
CALL order_checkEditable(vSelf);
|
||||
|
||||
-- Check order is not empty
|
||||
SELECT COUNT(*) > 0 INTO vHasRows
|
||||
FROM orderRow
|
||||
WHERE orderFk = vSelf
|
||||
AND amount > 0;
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vOk
|
||||
FROM order_row WHERE order_id = vSelf AND amount > 0;
|
||||
|
||||
IF NOT vOk THEN
|
||||
CALL util.throw ('ORDER_EMPTY');
|
||||
IF NOT vHasRows THEN
|
||||
CALL util.throw('ORDER_EMPTY');
|
||||
END IF;
|
||||
|
||||
-- Crea los tickets del pedido
|
||||
|
||||
OPEN cDates;
|
||||
|
||||
lDates:
|
||||
LOOP
|
||||
SET vTicket = NULL;
|
||||
OPEN vDates;
|
||||
lDates: LOOP
|
||||
SET vTicketFk = NULL;
|
||||
SET vDone = FALSE;
|
||||
FETCH cDates INTO vShipment, vWarehouse;
|
||||
FETCH vDates INTO vShipment, vWarehouseFk;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE lDates;
|
||||
END IF;
|
||||
|
||||
-- Busca un ticket existente que coincida con los parametros
|
||||
WITH tPrevia AS
|
||||
(SELECT DISTINCT s.ticketFk
|
||||
SET vShipmentDayEnd = util.dayEnd(vShipment);
|
||||
|
||||
-- Busca un ticket libre disponible
|
||||
WITH tPrevia AS (
|
||||
SELECT DISTINCT s.ticketFk
|
||||
FROM vn.sale s
|
||||
JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
|
||||
)
|
||||
SELECT t.id INTO vTicket
|
||||
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
)
|
||||
SELECT t.id INTO vTicketFk
|
||||
FROM vn.ticket t
|
||||
JOIN vn.alertLevel al ON al.code = 'FREE'
|
||||
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
|
||||
JOIN hedera.`order` o
|
||||
ON o.address_id = t.addressFk
|
||||
AND vWarehouse = t.warehouseFk
|
||||
AND o.date_send = t.landed
|
||||
AND DATE(t.shipped) = vShipment
|
||||
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
||||
JOIN hedera.`order` o ON o.address_id = t.addressFk
|
||||
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND o.date_send = t.landed
|
||||
WHERE o.id = vSelf
|
||||
AND t.refFk IS NULL
|
||||
AND tp.ticketFk IS NULL
|
||||
AND (tls.alertLevel IS NULL OR tls.alertLevel = al.id)
|
||||
LIMIT 1;
|
||||
|
||||
-- Comprobamos si hay un ticket de previa disponible
|
||||
IF vTicketFk IS NULL THEN
|
||||
WITH tItemPackingTypeOrder AS (
|
||||
SELECT GROUP_CONCAT(
|
||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
||||
) distinctItemPackingTypes,
|
||||
o.address_id
|
||||
FROM vn.item i
|
||||
JOIN hedera.orderRow oro ON oro.itemFk = i.id
|
||||
JOIN hedera.`order` o ON o.id = oro.orderFk
|
||||
WHERE oro.orderFk = vSelf
|
||||
),
|
||||
tItemPackingTypeTicket AS (
|
||||
SELECT t.id,
|
||||
GROUP_CONCAT(
|
||||
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
|
||||
) distinctItemPackingTypes
|
||||
FROM vn.ticket t
|
||||
JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
||||
JOIN vn.alertLevel al ON al.id = tls.alertLevel
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN tItemPackingTypeOrder ipto
|
||||
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
|
||||
AND t.refFk IS NULL
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND t.addressFk = ipto.address_id
|
||||
AND al.code = 'ON_PREVIOUS'
|
||||
GROUP BY t.id
|
||||
)
|
||||
SELECT iptt.id INTO vTicketFk
|
||||
FROM tItemPackingTypeTicket iptt
|
||||
JOIN tItemPackingTypeOrder ipto
|
||||
WHERE INSTR(iptt.distinctItemPackingTypes, ipto.distinctItemPackingTypes)
|
||||
LIMIT 1;
|
||||
END IF;
|
||||
|
||||
-- Crea el ticket en el caso de no existir uno adecuado
|
||||
IF vTicket IS NULL
|
||||
THEN
|
||||
|
||||
IF vTicketFk IS NULL THEN
|
||||
SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
|
||||
|
||||
CALL vn.ticket_add(
|
||||
vClientId,
|
||||
vClientFk,
|
||||
vShipment,
|
||||
vWarehouse,
|
||||
vCompanyId,
|
||||
vAddress,
|
||||
vAgencyModeId,
|
||||
vWarehouseFk,
|
||||
vCompanyFk,
|
||||
vAddressFk,
|
||||
vAgencyModeFk,
|
||||
NULL,
|
||||
vDelivery,
|
||||
vUserId,
|
||||
vLanded,
|
||||
vUserFk,
|
||||
TRUE,
|
||||
vTicket
|
||||
vTicketFk
|
||||
);
|
||||
ELSE
|
||||
INSERT INTO vn.ticketTracking
|
||||
SET ticketFk = vTicket,
|
||||
userFk = vUserId,
|
||||
stateFk = TICKET_FREE;
|
||||
SET ticketFk = vTicketFk,
|
||||
userFk = vUserFk,
|
||||
stateFk = (SELECT id FROM vn.state WHERE code = 'FREE');
|
||||
END IF;
|
||||
|
||||
INSERT IGNORE INTO vn.orderTicket
|
||||
SET orderFk = vSelf,
|
||||
ticketFk = vTicket;
|
||||
ticketFk = vTicketFk;
|
||||
|
||||
-- Añade las notas
|
||||
|
||||
IF vNotes IS NOT NULL AND vNotes != ''
|
||||
THEN
|
||||
INSERT INTO vn.ticketObservation SET
|
||||
ticketFk = vTicket,
|
||||
observationTypeFk = 4 /* salesperson */ ,
|
||||
IF vNotes IS NOT NULL AND vNotes <> '' THEN
|
||||
INSERT INTO vn.ticketObservation
|
||||
SET ticketFk = vTicketFk,
|
||||
observationTypeFk = (SELECT id FROM vn.observationType WHERE code = 'salesPerson'),
|
||||
`description` = vNotes
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
||||
END IF;
|
||||
|
||||
-- Añade los movimientos y sus componentes
|
||||
|
||||
OPEN cRows;
|
||||
|
||||
OPEN vRows;
|
||||
lRows: LOOP
|
||||
SET vSaleFk = NULL;
|
||||
SET vDone = FALSE;
|
||||
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
|
||||
FETCH vRows INTO vRowFk, vItemFk, vConcept, vAmount, vPrice;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE lRows;
|
||||
END IF;
|
||||
|
||||
SET vSale = NULL;
|
||||
|
||||
SELECT s.id, s.quantity INTO vSale, vOldQuantity
|
||||
SELECT s.id INTO vSaleFk
|
||||
FROM vn.sale s
|
||||
WHERE ticketFk = vTicket
|
||||
WHERE ticketFk = vTicketFk
|
||||
AND price = vPrice
|
||||
AND itemFk = vItem
|
||||
AND itemFk = vItemFk
|
||||
AND discount = 0
|
||||
LIMIT 1;
|
||||
|
||||
IF vSale THEN
|
||||
IF vSaleFk THEN
|
||||
UPDATE vn.sale
|
||||
SET quantity = quantity + vAmount,
|
||||
originalQuantity = quantity
|
||||
WHERE id = vSale;
|
||||
|
||||
SELECT s.quantity INTO vNewQuantity
|
||||
FROM vn.sale s
|
||||
WHERE id = vSale;
|
||||
WHERE id = vSaleFk;
|
||||
ELSE
|
||||
-- Obtiene el coste
|
||||
SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
|
||||
FROM orderRowComponent rc
|
||||
JOIN vn.component c ON c.id = rc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
|
||||
WHERE rc.rowFk = vRowId;
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
AND ct.isBase
|
||||
WHERE rc.rowFk = vRowFk;
|
||||
|
||||
INSERT INTO vn.sale
|
||||
SET itemFk = vItem,
|
||||
ticketFk = vTicket,
|
||||
SET itemFk = vItemFk,
|
||||
ticketFk = vTicketFk,
|
||||
concept = vConcept,
|
||||
quantity = vAmount,
|
||||
price = vPrice,
|
||||
priceFixed = vPriceFixed,
|
||||
isPriceFixed = TRUE;
|
||||
|
||||
SET vSale = LAST_INSERT_ID();
|
||||
SET vSaleFk = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent
|
||||
(saleFk, componentFk, `value`)
|
||||
SELECT vSale, rc.componentFk, rc.price
|
||||
INSERT INTO vn.saleComponent (saleFk, componentFk, `value`)
|
||||
SELECT vSaleFk, rc.componentFk, rc.price
|
||||
FROM orderRowComponent rc
|
||||
JOIN vn.component c ON c.id = rc.componentFk
|
||||
WHERE rc.rowFk = vRowId
|
||||
GROUP BY vSale, rc.componentFk;
|
||||
WHERE rc.rowFk = vRowFk
|
||||
GROUP BY vSaleFk, rc.componentFk;
|
||||
END IF;
|
||||
|
||||
UPDATE order_row SET Id_Movimiento = vSale
|
||||
WHERE id = vRowId;
|
||||
|
||||
-- Inserta en putOrder si la compra es de Floramondo
|
||||
IF vIsLogifloraItem THEN
|
||||
CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment);
|
||||
|
||||
SET @available := 0;
|
||||
|
||||
SELECT GREATEST(0,available) INTO @available
|
||||
FROM cache.availableNoRaids
|
||||
WHERE calc_id = vCalc
|
||||
AND item_id = vItem;
|
||||
|
||||
UPDATE cache.availableNoRaids
|
||||
SET available = GREATEST(0,available - vAmount)
|
||||
WHERE item_id = vItem
|
||||
AND calc_id = vCalc;
|
||||
|
||||
INSERT INTO edi.putOrder (
|
||||
deliveryInformationID,
|
||||
supplyResponseId,
|
||||
quantity ,
|
||||
EndUserPartyId,
|
||||
EndUserPartyGLN,
|
||||
FHAdminNumber,
|
||||
saleFk
|
||||
)
|
||||
SELECT di.ID,
|
||||
i.supplyResponseFk,
|
||||
CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask),
|
||||
o.address_id ,
|
||||
vClientId,
|
||||
IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber),
|
||||
vSale
|
||||
FROM edi.deliveryInformation di
|
||||
JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID
|
||||
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
|
||||
LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId
|
||||
JOIN edi.floraHollandConfig fhc
|
||||
JOIN hedera.`order` o ON o.id = vSelf
|
||||
WHERE i.id = vItem
|
||||
AND di.LatestOrderDateTime > util.VN_NOW()
|
||||
AND vAmount > @available
|
||||
LIMIT 1;
|
||||
END IF;
|
||||
UPDATE orderRow
|
||||
SET saleFk = vSaleFk
|
||||
WHERE id = vRowFk;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cRows;
|
||||
CLOSE vRows;
|
||||
END LOOP;
|
||||
CLOSE vDates;
|
||||
|
||||
CLOSE cDates;
|
||||
|
||||
UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW()
|
||||
UPDATE `order`
|
||||
SET confirmed = TRUE,
|
||||
confirm_date = util.VN_NOW()
|
||||
WHERE id = vSelf;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -10,5 +10,5 @@ AS SELECT `q`.`name` AS `name`,
|
|||
`c`.`ringInUse` AS `ringinuse`
|
||||
FROM (
|
||||
`pbx`.`queue` `q`
|
||||
JOIN `pbx`.`queueConfig` `c` ON(`q`.`config` = `c`.`id`)
|
||||
JOIN `pbx`.`queueMultiConfig` `c` ON(`q`.`config` = `c`.`id`)
|
||||
)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2024-07-12 00:10:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO BEGIN
|
||||
UPDATE travel t
|
||||
SET t.isDelivered = TRUE
|
||||
WHERE t.shipped < util.VN_CURDATE();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -47,7 +47,7 @@ proc: BEGIN
|
|||
|
||||
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||
-- que hace un replace de la anterior.
|
||||
CALL buyUltimate(vWarehouseShipment, util.VN_CURDATE());
|
||||
CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE());
|
||||
|
||||
INSERT INTO tItemRange
|
||||
SELECT t.itemFk, tr.landed
|
||||
|
|
|
@ -5,39 +5,14 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimate`(
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula las últimas compras realizadas hasta una fecha
|
||||
* @deprecated Usar buy_getUltimate
|
||||
* Calcula las últimas compras realizadas hasta una fecha.
|
||||
*
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vWarehouseFk Id del almacén
|
||||
* @param vDated Compras hasta fecha
|
||||
* @return tmp.buyUltimate
|
||||
*/
|
||||
CALL cache.last_buy_refresh (FALSE);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate;
|
||||
CREATE TEMPORARY TABLE tmp.buyUltimate
|
||||
(PRIMARY KEY (itemFk, warehouseFk),
|
||||
INDEX(itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing
|
||||
FROM cache.last_buy
|
||||
WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL;
|
||||
|
||||
IF vDated >= util.VN_CURDATE() THEN
|
||||
CALL buyUltimateFromInterval(vWarehouseFk, util.VN_CURDATE(), vDated);
|
||||
|
||||
REPLACE INTO tmp.buyUltimate
|
||||
SELECT itemFk, buyFk, warehouseFk, landed landing
|
||||
FROM tmp.buyUltimateFromInterval
|
||||
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
||||
AND landed <= vDated
|
||||
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;
|
||||
END IF;
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -6,6 +6,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimateFromInte
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* @deprecated Usar buy_getUltimateFromInterval
|
||||
* Calcula las últimas compras realizadas
|
||||
* desde un rango de fechas.
|
||||
*
|
||||
|
@ -14,153 +15,6 @@ BEGIN
|
|||
* @param vEnded Fecha fin
|
||||
* @return tmp.buyUltimateFromInterval
|
||||
*/
|
||||
IF vEnded IS NULL THEN
|
||||
SET vEnded = vStarted;
|
||||
END IF;
|
||||
|
||||
IF vEnded < vStarted THEN
|
||||
SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded);
|
||||
END IF;
|
||||
|
||||
-- Item
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval;
|
||||
CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval
|
||||
(PRIMARY KEY (itemFk, warehouseFk),
|
||||
INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk))
|
||||
ENGINE = MEMORY
|
||||
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 BETWEEN vStarted AND vEnded
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND b.price2 > 0
|
||||
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)
|
||||
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
|
||||
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)
|
||||
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 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
|
||||
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,
|
||||
itemOriginalFk,
|
||||
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.price2 > 0
|
||||
AND NOT b.isIgnored
|
||||
AND b.quantity > 0
|
||||
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)
|
||||
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)
|
||||
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 BETWEEN vStarted AND vEnded
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND b.quantity = 0
|
||||
AND itemOriginalFk
|
||||
ORDER BY t.landed DESC, b.id DESC
|
||||
LIMIT 10000000000000000000) sub
|
||||
GROUP BY itemFk, warehouseFk;
|
||||
CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk SMALLINT,
|
||||
vDated DATE
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula las últimas compras realizadas hasta una fecha.
|
||||
*
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vWarehouseFk Id del almacén
|
||||
* @param vDated Compras hasta fecha
|
||||
* @return tmp.buyUltimate
|
||||
*/
|
||||
CALL cache.last_buy_refresh(FALSE);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buyUltimate
|
||||
(PRIMARY KEY (itemFk, warehouseFk),
|
||||
INDEX(itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing
|
||||
FROM cache.last_buy
|
||||
WHERE (warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL)
|
||||
AND (item_id = vItemFk OR vItemFk IS NULL);
|
||||
|
||||
IF vDated >= util.VN_CURDATE() THEN
|
||||
CALL buy_getUltimateFromInterval(vItemFk, vWarehouseFk, util.VN_CURDATE(), vDated);
|
||||
|
||||
REPLACE INTO tmp.buyUltimate
|
||||
SELECT itemFk, buyFk, warehouseFk, landed landing
|
||||
FROM tmp.buyUltimateFromInterval
|
||||
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
|
||||
AND (itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND landed <= vDated
|
||||
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 (itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND landed > vDated
|
||||
ORDER BY isIgnored = FALSE DESC;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,175 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk SMALLINT,
|
||||
vStarted DATE,
|
||||
vEnded DATE
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula las últimas compras realizadas
|
||||
* desde un rango de fechas.
|
||||
*
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vWarehouseFk Id del almacén si es NULL se actualizan todos
|
||||
* @param vStarted Fecha inicial
|
||||
* @param vEnded Fecha fin
|
||||
* @return tmp.buyUltimateFromInterval
|
||||
*/
|
||||
IF vEnded IS NULL THEN
|
||||
SET vEnded = vStarted;
|
||||
END IF;
|
||||
|
||||
IF vEnded < vStarted THEN
|
||||
SET vStarted = vEnded - INTERVAL 1 MONTH;
|
||||
END IF;
|
||||
|
||||
-- Item
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buyUltimateFromInterval
|
||||
(PRIMARY KEY (itemFk, warehouseFk),
|
||||
INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk))
|
||||
ENGINE = MEMORY
|
||||
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 BETWEEN vStarted AND vEnded
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND (b.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND b.price2 > 0
|
||||
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)
|
||||
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.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
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)
|
||||
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 BETWEEN vStarted AND vEnded
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND (b.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND b.quantity = 0
|
||||
ORDER BY NOT b.isIgnored DESC, t.landed DESC, b.id DESC
|
||||
LIMIT 10000000000000000000) sub
|
||||
GROUP BY itemFk, warehouseFk;
|
||||
|
||||
-- ItemOriginal
|
||||
|
||||
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,
|
||||
itemOriginalFk,
|
||||
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.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND b.price2 > 0
|
||||
AND NOT b.isIgnored
|
||||
AND b.quantity > 0
|
||||
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)
|
||||
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.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
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)
|
||||
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 BETWEEN vStarted AND vEnded
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND (b.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
AND b.quantity = 0
|
||||
AND itemOriginalFk
|
||||
ORDER BY t.landed DESC, b.id DESC
|
||||
LIMIT 10000000000000000000) sub
|
||||
GROUP BY itemFk, warehouseFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,5 +1,9 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(
|
||||
vWarehouseFk INT,
|
||||
vItemFk INT,
|
||||
vGrouping INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el grouping de las últimas compras de un artículo
|
||||
|
@ -8,9 +12,9 @@ BEGIN
|
|||
* @param vItemFk Id del Artículo
|
||||
* @param vGrouping Cantidad de grouping
|
||||
*/
|
||||
CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
|
||||
|
||||
UPDATE vn.buy b
|
||||
UPDATE buy b
|
||||
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
|
||||
SET b.`grouping` = vGrouping
|
||||
WHERE bu.warehouseFk = vWarehouseFk
|
||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
|||
* @param vItemFk id del item
|
||||
* @param vPacking packing a actualizar
|
||||
*/
|
||||
CALL buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
|
||||
|
||||
UPDATE buy b
|
||||
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
|
||||
|
|
|
@ -29,7 +29,7 @@ BEGIN
|
|||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones);
|
||||
CALL zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot(
|
||||
|
@ -72,9 +72,9 @@ BEGIN
|
|||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
||||
CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped);
|
||||
CALL vn.buyUltimate(vWarehouseFk, vShipped);
|
||||
CALL `cache`.available_refresh(vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
||||
CALL `cache`.availableNoRaids_refresh(vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped);
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
|
||||
|
||||
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
|
||||
SELECT vWarehouseFk,
|
||||
|
@ -86,17 +86,17 @@ BEGIN
|
|||
LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id
|
||||
AND anr.calc_id = vAvailableNoRaidsCalc
|
||||
JOIN tmp.item i ON i.itemFk = a.item_id
|
||||
JOIN vn.item it ON it.id = i.itemFk
|
||||
JOIN vn.`zone` z ON z.id = vZoneFk
|
||||
JOIN item it ON it.id = i.itemFk
|
||||
JOIN `zone` z ON z.id = vZoneFk
|
||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id
|
||||
LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk
|
||||
LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||
LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
|
||||
LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed
|
||||
FROM vn.addressFilter af
|
||||
FROM addressFilter af
|
||||
JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed
|
||||
FROM vn.address ad
|
||||
JOIN vn.province p ON p.id = ad.provinceFk
|
||||
FROM address ad
|
||||
JOIN province p ON p.id = ad.provinceFk
|
||||
WHERE ad.id = vAddressFk
|
||||
) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk)
|
||||
AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk)
|
||||
|
@ -108,18 +108,18 @@ BEGIN
|
|||
OR ISNULL(af.afterDated))
|
||||
) sub ON sub.isVNHSupplier = v.isVNHSupplier
|
||||
AND (sub.isEarlyBird = mp.isEarlyBird OR ISNULL(sub.isEarlyBird))
|
||||
JOIN vn.agencyMode am ON am.id = vAgencyModeFk
|
||||
JOIN vn.agency ag ON ag.id = am.agencyFk
|
||||
JOIN vn.itemType itt ON itt.id = it.typeFk
|
||||
JOIN vn.itemCategory itc on itc.id = itt.categoryFk
|
||||
JOIN vn.address ad ON ad.id = vAddressFk
|
||||
LEFT JOIN vn.clientItemType cit
|
||||
JOIN agencyMode am ON am.id = vAgencyModeFk
|
||||
JOIN agency ag ON ag.id = am.agencyFk
|
||||
JOIN itemType itt ON itt.id = it.typeFk
|
||||
JOIN itemCategory itc on itc.id = itt.categoryFk
|
||||
JOIN address ad ON ad.id = vAddressFk
|
||||
LEFT JOIN clientItemType cit
|
||||
ON cit.clientFk = ad.clientFk
|
||||
AND cit.itemTypeFk = itt.id
|
||||
LEFT JOIN vn.zoneItemType zit
|
||||
LEFT JOIN zoneItemType zit
|
||||
ON zit.zoneFk = vZoneFk
|
||||
AND zit.itemTypeFk = itt.id
|
||||
LEFT JOIN vn.agencyModeItemType ait
|
||||
LEFT JOIN agencyModeItemType ait
|
||||
ON ait.agencyModeFk = vAgencyModeFk
|
||||
AND ait.itemTypeFk = itt.id
|
||||
WHERE a.calc_id = vAvailableCalc
|
||||
|
@ -133,7 +133,7 @@ BEGIN
|
|||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
|
||||
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
||||
|
||||
INSERT INTO tmp.ticketCalculateItem(
|
||||
itemFk,
|
||||
|
|
|
@ -28,6 +28,10 @@ BEGIN
|
|||
DELETE FROM ticketDown WHERE created < util.yesterday();
|
||||
DELETE FROM entryLog WHERE creationDate < v2Months;
|
||||
DELETE IGNORE FROM expedition WHERE created < v26Months;
|
||||
DELETE cs
|
||||
FROM sms s
|
||||
JOIN clientSms cs ON cs.smsFk = s.id
|
||||
WHERE s.created < v18Months;
|
||||
DELETE FROM sms WHERE created < v18Months;
|
||||
DELETE FROM saleTracking WHERE created < v1Years;
|
||||
DELETE FROM productionError WHERE dated < v1Years;
|
||||
|
|
|
@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_addWithR
|
|||
vItemFk INT,
|
||||
vQuantity INT,
|
||||
vTicketFk INT,
|
||||
vSaleGroupFk INT
|
||||
vSaleGroupFk INT,
|
||||
vSectorFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -67,7 +68,7 @@ BEGIN
|
|||
SELECT LAST_INSERT_ID() INTO vSaleFk;
|
||||
|
||||
CALL sale_calculateComponent(vSaleFk, NULL);
|
||||
CALL itemShelvingSale_addBySale(vSaleFk);
|
||||
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
||||
|
||||
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
|
||||
SET vHasThrow = TRUE;
|
||||
|
|
|
@ -7,7 +7,7 @@ DECLARE vCompanyFk INT;
|
|||
SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk)
|
||||
INTO vCompanyFk
|
||||
FROM vn.routeConfig rc
|
||||
LEFT JOIN userConfig uc ON uc.userFk = workerFk;
|
||||
LEFT JOIN userMultiConfig uc ON uc.userFk = workerFk;
|
||||
|
||||
|
||||
SELECT
|
||||
|
|
|
@ -12,6 +12,7 @@ BEGIN
|
|||
DECLARE vInvoiceFk INT;
|
||||
DECLARE vBookEntry INT;
|
||||
DECLARE vFiscalYear INT;
|
||||
DECLARE vIncorrectInvoiceInDueDay INT;
|
||||
|
||||
DECLARE vInvoicesIn CURSOR FOR
|
||||
SELECT DISTINCT e.invoiceInFk
|
||||
|
@ -24,6 +25,19 @@ BEGIN
|
|||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT GROUP_CONCAT(ii.id) INTO vIncorrectInvoiceInDueDay
|
||||
FROM invoiceInDueDay iidd
|
||||
JOIN invoiceIn ii ON iidd.invoiceInFk = ii.id
|
||||
JOIN `entry` e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN invoiceInConfig iic
|
||||
WHERE de.duaFk = vDuaFk
|
||||
AND iidd.dueDated <= util.VN_CURDATE() + INTERVAL iic.dueDateMarginDays DAY;
|
||||
|
||||
IF vIncorrectInvoiceInDueDay THEN
|
||||
CALL util.throw(CONCAT('Incorrect due date, invoice: ', vIncorrectInvoiceInDueDay));
|
||||
END IF;
|
||||
|
||||
UPDATE invoiceIn ii
|
||||
JOIN entry e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
|
|
|
@ -97,7 +97,7 @@ BEGIN
|
|||
FROM tmp.itemList;
|
||||
END IF;
|
||||
|
||||
CALL buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded);
|
||||
CALL buy_getUltimateFromInterval(NULL, vWarehouseIn,vInventoryDate, vDateLanded);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTransfer
|
||||
ENGINE = MEMORY
|
||||
|
|
|
@ -110,7 +110,7 @@ BEGIN
|
|||
|
||||
UPDATE itemShelving
|
||||
SET isSplit = TRUE
|
||||
WHERE shelvingFk = vShelvingFk;
|
||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci;
|
||||
END LOOP;
|
||||
CLOSE cur;
|
||||
END$$
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_build`(IN vExpeditions JSON, IN vArcId INT, IN vWorkerFk INT, OUT vPalletFk INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionPallet_build`(
|
||||
vExpeditions JSON,
|
||||
vArcId INT,
|
||||
vWorkerFk INT,
|
||||
OUT vPalletFk INT
|
||||
)
|
||||
BEGIN
|
||||
/** Construye un pallet de expediciones.
|
||||
*
|
||||
|
@ -7,28 +12,22 @@ BEGIN
|
|||
* en cuyo caso actualiza ese pallet.
|
||||
*
|
||||
* @param vExpeditions JSON_ARRAY con esta estructura [exp1, exp2, exp3, ...]
|
||||
* @param vArcId INT Identificador de vn.arcRead
|
||||
* @param vWorkerFk INT Identificador de vn.worker
|
||||
* @param out vPalletFk Identificador de vn.expeditionPallet
|
||||
* @param vArcId INT Identificador de arcRead
|
||||
* @param vWorkerFk INT Identificador de worker
|
||||
* @param out vPalletFk Identificador de expeditionPallet
|
||||
*/
|
||||
DECLARE vCounter INT;
|
||||
DECLARE vExpeditionFk INT;
|
||||
DECLARE vTruckFk INT;
|
||||
DECLARE vPrinterFk INT;
|
||||
DECLARE vExpeditionStateTypeFk INT;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tExpedition;
|
||||
CREATE TEMPORARY TABLE tExpedition
|
||||
SELECT
|
||||
e.id expeditionFk,
|
||||
r.id routeFk,
|
||||
ep.id palletFk
|
||||
FROM
|
||||
vn.expedition e,
|
||||
vn.route r,
|
||||
vn.expeditionPallet ep
|
||||
LIMIT 0;
|
||||
|
||||
ALTER TABLE tExpedition ADD PRIMARY KEY (expeditionFk);
|
||||
CREATE OR REPLACE TEMPORARY TABLE tExpedition (
|
||||
expeditionFk INT,
|
||||
routeFk INT,
|
||||
palletFk INT,
|
||||
PRIMARY KEY (expeditionFk)
|
||||
);
|
||||
|
||||
SET vCounter = JSON_LENGTH(vExpeditions);
|
||||
|
||||
|
@ -39,53 +38,58 @@ BEGIN
|
|||
|
||||
INSERT IGNORE INTO tExpedition(expeditionFk, routeFk, palletFk)
|
||||
SELECT vExpeditionFk, t.routeFk, es.palletFk
|
||||
FROM vn.expedition e
|
||||
LEFT JOIN vn.ticket t ON t.id = e.ticketFk
|
||||
LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id
|
||||
FROM expedition e
|
||||
LEFT JOIN ticket t ON t.id = e.ticketFk
|
||||
LEFT JOIN expeditionScan es ON es.expeditionFk = e.id
|
||||
WHERE e.id = vExpeditionFk;
|
||||
END WHILE;
|
||||
|
||||
SELECT palletFk INTO vPalletFk
|
||||
FROM (
|
||||
SELECT palletFk, count(*) n
|
||||
FROM tExpedition
|
||||
WHERE palletFk > 0
|
||||
GROUP BY palletFk
|
||||
ORDER BY n DESC
|
||||
LIMIT 100 ) sub
|
||||
SELECT palletFk, count(*) n
|
||||
FROM tExpedition
|
||||
WHERE palletFk > 0
|
||||
GROUP BY palletFk
|
||||
ORDER BY n DESC
|
||||
LIMIT 100
|
||||
) sub
|
||||
LIMIT 1;
|
||||
|
||||
IF vPalletFk IS NULL THEN
|
||||
SELECT roadmapStopFk
|
||||
INTO vTruckFk
|
||||
FROM (
|
||||
SELECT rm.roadmapStopFk, count(*) n
|
||||
FROM vn.routesMonitor rm
|
||||
JOIN tExpedition e ON e.routeFk = rm.routeFk
|
||||
GROUP BY roadmapStopFk
|
||||
ORDER BY n DESC
|
||||
LIMIT 1) sub;
|
||||
SELECT roadmapStopFk INTO vTruckFk
|
||||
FROM (
|
||||
SELECT rm.roadmapStopFk, count(*) n
|
||||
FROM routesMonitor rm
|
||||
JOIN tExpedition e ON e.routeFk = rm.routeFk
|
||||
GROUP BY roadmapStopFk
|
||||
ORDER BY n DESC
|
||||
LIMIT 1
|
||||
) sub;
|
||||
|
||||
IF vTruckFk IS NULL THEN
|
||||
CALL util.throw ('TRUCK_NOT_AVAILABLE');
|
||||
END IF;
|
||||
|
||||
INSERT INTO vn.expeditionPallet(truckFk)
|
||||
VALUES(vTruckFk);
|
||||
INSERT INTO expeditionPallet SET truckFk = vTruckFk;
|
||||
|
||||
SET vPalletFk = LAST_INSERT_ID();
|
||||
END IF;
|
||||
|
||||
INSERT INTO vn.expeditionScan(expeditionFk, palletFk, workerFk)
|
||||
INSERT INTO expeditionScan(expeditionFk, palletFk, workerFk)
|
||||
SELECT expeditionFk, vPalletFk, vWorkerFk
|
||||
FROM tExpedition
|
||||
ON DUPLICATE KEY UPDATE palletFk = vPalletFk, workerFk = vWorkerFk;
|
||||
|
||||
SELECT printerFk INTO vPrinterFk
|
||||
FROM vn.arcRead
|
||||
WHERE id = vArcId;
|
||||
SELECT id INTO vExpeditionStateTypeFk
|
||||
FROM expeditionStateType
|
||||
WHERE code = 'PALLETIZED';
|
||||
|
||||
CALL vn.report_print(
|
||||
INSERT INTO expeditionState(expeditionFk, typeFk)
|
||||
SELECT expeditionFk, vExpeditionStateTypeFk FROM tExpedition;
|
||||
|
||||
SELECT printerFk INTO vPrinterFk FROM arcRead WHERE id = vArcId;
|
||||
|
||||
CALL report_print(
|
||||
'LabelPalletExpedition',
|
||||
vPrinterFk,
|
||||
account.myUser_getId(),
|
||||
|
@ -93,7 +97,7 @@ BEGIN
|
|||
'high'
|
||||
);
|
||||
|
||||
UPDATE vn.expeditionPallet SET isPrint = TRUE WHERE id = vPalletFk;
|
||||
UPDATE expeditionPallet SET isPrint = TRUE WHERE id = vPalletFk;
|
||||
|
||||
DROP TEMPORARY TABLE tExpedition;
|
||||
END$$
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(vInvoiceInFk INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
|
||||
vInvoiceInFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los vctos. de una factura recibida
|
||||
|
@ -56,12 +58,13 @@ BEGIN
|
|||
COUNT(DISTINCT(pdd.detail)) cont,
|
||||
s.payDay,
|
||||
ii.issued,
|
||||
DATE(ii.created) + INTERVAL 2 DAY created
|
||||
DATE(ii.created) + INTERVAL iic.dueDateMarginDays DAY created
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk
|
||||
JOIN supplier s ON s.id = ii.supplierFk
|
||||
JOIN payDemDetail pdd ON pdd.id = s.payDemFk
|
||||
JOIN invoiceInConfig iic
|
||||
WHERE ii.id = vInvoiceInFk
|
||||
GROUP BY ii.id
|
||||
)sub
|
||||
|
|
|
@ -13,30 +13,18 @@ BEGIN
|
|||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||
*/
|
||||
DECLARE vFiscalYear INT;
|
||||
DECLARE vDistinctTransactions INT;
|
||||
DECLARE vHasRepeatedTransactions BOOL;
|
||||
|
||||
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE iit.invoiceInFk = vSelf
|
||||
AND iis.taxAreaFk = 'CEE'
|
||||
AND iit.transactionTypeSageFk;
|
||||
|
||||
IF vDistinctTransactions > 1 THEN
|
||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||
END IF;
|
||||
|
||||
SELECT TRUE INTO vHasRepeatedTransactions
|
||||
FROM invoiceInTax
|
||||
WHERE invoiceInFk = vSelf
|
||||
GROUP BY transactionTypeSageFk
|
||||
HAVING COUNT(transactionTypeSageFk) > 1
|
||||
FROM invoiceInTax iit
|
||||
JOIN invoiceIn ii ON ii.id = iit.invoiceInFk
|
||||
WHERE ii.id = vSelf
|
||||
AND ii.serial = 'E'
|
||||
HAVING COUNT(DISTINCT iit.transactionTypeSageFk) > 1
|
||||
LIMIT 1;
|
||||
|
||||
IF vHasRepeatedTransactions THEN
|
||||
CALL util.throw ('This invoice contains repeated types of transactions');
|
||||
CALL util.throw ('This invoice contains different types of transactions');
|
||||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||
|
|
|
@ -216,7 +216,7 @@ BEGIN
|
|||
i.transactionTypeSageFk,
|
||||
@vTaxCodeGeneral := i.taxClassCodeFk
|
||||
FROM tmp.ticketServiceTax tst
|
||||
JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
|
||||
JOIN invoiceOutTaxMultiConfig i ON i.taxClassCodeFk = tst.code
|
||||
WHERE i.isService
|
||||
HAVING taxableBase
|
||||
) sub;
|
||||
|
@ -229,7 +229,7 @@ BEGIN
|
|||
i.taxTypeSageFk ,
|
||||
i.transactionTypeSageFk
|
||||
FROM tmp.ticketTax tt
|
||||
JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
|
||||
JOIN invoiceOutTaxMultiConfig i ON i.taxClassCodeFk = tt.code
|
||||
WHERE !i.isService
|
||||
GROUP BY tt.pgcFk
|
||||
HAVING taxableBase
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
|
||||
vSelf INT,
|
||||
vItemFk INT,
|
||||
vStarted DATE,
|
||||
vEnded DATE,
|
||||
vWarehouseFk INT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE vHasCollision BOOL;
|
||||
|
||||
IF vStarted IS NULL THEN
|
||||
CALL util.throw('The field "started" cannot be null');
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO vHasCollision
|
||||
FROM itemMinimumQuantity
|
||||
WHERE vItemFk = itemFk
|
||||
AND ((vStarted <= ended OR ended IS NULL)
|
||||
AND (vStarted >= `started` OR vEnded IS NULL))
|
||||
AND (vWarehouseFk <=> warehouseFk)
|
||||
AND vSelf <> id;
|
||||
|
||||
IF vHasCollision THEN
|
||||
CALL util.throw('A line with the same configuration already exists');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -44,7 +44,7 @@ BEGIN
|
|||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL itemShelvingSale_addBySale(vSaleFk);
|
||||
CALL itemShelvingSale_addBySale(vSaleFk, NULL);
|
||||
END LOOP;
|
||||
CLOSE vSales;
|
||||
END$$
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySale`(
|
||||
vSaleFk INT
|
||||
vSaleFk INT,
|
||||
vSectorFk INT
|
||||
)
|
||||
proc: BEGIN
|
||||
/**
|
||||
|
@ -8,6 +9,7 @@ proc: BEGIN
|
|||
*
|
||||
* @param vSaleFk Id de sale
|
||||
* @param vItemShelvingSaleFk Id de reserva
|
||||
* @param vSectorFk Id del sector del operator
|
||||
*/
|
||||
DECLARE vLastPickingOrder INT;
|
||||
DECLARE vDone INT DEFAULT FALSE;
|
||||
|
@ -30,6 +32,7 @@ proc: BEGIN
|
|||
JOIN productionConfig pc
|
||||
WHERE s.id = vSaleFk
|
||||
AND NOT sc.isHideForPickers
|
||||
AND (sc.id = vSectorFk OR vSectorFk IS NULL)
|
||||
ORDER BY s.id,
|
||||
p.pickingOrder >= vLastPickingOrder,
|
||||
sh.priority DESC,
|
||||
|
@ -95,11 +98,13 @@ proc: BEGIN
|
|||
itemShelvingFk,
|
||||
saleFk,
|
||||
quantity,
|
||||
userFk)
|
||||
userFk,
|
||||
isPicked)
|
||||
SELECT vItemShelvingFk,
|
||||
vSaleFk,
|
||||
vReservedQuantity,
|
||||
vUserFk;
|
||||
vUserFk,
|
||||
FALSE;
|
||||
|
||||
UPDATE itemShelving
|
||||
SET available = available - vReservedQuantity
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
|
||||
vSaleGroupFk INT(11)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Reserva cantidades con ubicaciones para el contenido de una preparación previa
|
||||
* a través del saleGroup
|
||||
*
|
||||
* @param vSaleGroupFk Identificador de saleGroup
|
||||
*/
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vSectorFk INT;
|
||||
DECLARE vSales CURSOR FOR
|
||||
SELECT s.id
|
||||
FROM saleGroupDetail sgd
|
||||
JOIN sale s ON sgd.saleFk = s.id
|
||||
JOIN saleTracking str ON str.saleFk = s.id
|
||||
JOIN `state` st ON st.id = str.stateFk
|
||||
AND st.code = 'PREVIOUS_PREPARATION'
|
||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
WHERE sgd.saleGroupFk = vSaleGroupFk
|
||||
AND str.workerFk = account.myUser_getId()
|
||||
AND iss.id IS NULL;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT sectorFk INTO vSectorFk
|
||||
FROM operator
|
||||
WHERE workerFk = account.myUser_getId();
|
||||
|
||||
OPEN vSales;
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vSales INTO vSaleFk;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
||||
END LOOP;
|
||||
CLOSE vSales;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -10,6 +10,7 @@ BEGIN
|
|||
*/
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vSectorFk INT;
|
||||
DECLARE vSales CURSOR FOR
|
||||
SELECT s.id
|
||||
FROM sectorCollectionSaleGroup sc
|
||||
|
@ -25,6 +26,10 @@ BEGIN
|
|||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT sectorFk INTO vSectorFk
|
||||
FROM operator
|
||||
WHERE workerFk = account.myUser_getId();
|
||||
|
||||
OPEN vSales;
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
|
@ -34,7 +39,7 @@ BEGIN
|
|||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL itemShelvingSale_addBySale(vSaleFk);
|
||||
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
||||
END LOOP;
|
||||
CLOSE vSales;
|
||||
END$$
|
||||
|
|
|
@ -6,9 +6,10 @@ proc: BEGIN
|
|||
*/
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vSectorFk INT;
|
||||
|
||||
DECLARE vSales CURSOR FOR
|
||||
SELECT DISTINCT saleFk FROM tSale;
|
||||
SELECT DISTINCT saleFk, sectorFk FROM tSale;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
@ -26,24 +27,25 @@ proc: BEGIN
|
|||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tSale
|
||||
ENGINE = MEMORY
|
||||
SELECT id, saleFk FROM itemShelvingSaleReserve;
|
||||
SELECT id, saleFk, sectorFk FROM itemShelvingSaleReserve;
|
||||
|
||||
OPEN vSales;
|
||||
|
||||
myLoop: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vSales INTO vSaleFk;
|
||||
FETCH vSales INTO vSaleFk, vSectorFk;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE myLoop;
|
||||
END IF;
|
||||
|
||||
CALL itemShelvingSale_addBySale (vSaleFk);
|
||||
CALL itemShelvingSale_addBySale (vSaleFk, vSectorFk);
|
||||
END LOOP;
|
||||
|
||||
CLOSE vSales;
|
||||
|
||||
DELETE iss FROM itemShelvingSaleReserve iss JOIN tSale s ON s.id = iss.id;
|
||||
DELETE iss FROM itemShelvingSaleReserve iss
|
||||
JOIN tSale s ON s.id = iss.id AND s.sectorFk = iss.sectorFk;
|
||||
|
||||
DROP TEMPORARY TABLE tSale;
|
||||
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reallocate`(
|
||||
vItemShelvingFk INT(10),
|
||||
vItemFk INT(10)
|
||||
vItemFk INT(10),
|
||||
vSectorFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Elimina reservas de un itemShelving e intenta reservar en otra ubicación
|
||||
*
|
||||
* @param vItemShelvingFk Id itemShelving
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vSectorFk Id del sector
|
||||
*/
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
|
@ -17,19 +20,22 @@ BEGIN
|
|||
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT id INTO vItemShelvingFk
|
||||
FROM itemShelving
|
||||
WHERE id = vItemShelvingFk
|
||||
FOR UPDATE;
|
||||
|
||||
UPDATE itemShelving
|
||||
SET visible = 0,
|
||||
available = 0
|
||||
WHERE id = vItemShelvingFk
|
||||
AND itemFk = vItemFk;
|
||||
|
||||
INSERT INTO itemShelvingSaleReserve (saleFk)
|
||||
SELECT DISTINCT iss.saleFk
|
||||
SELECT iss.id
|
||||
FROM itemShelvingSale iss
|
||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
WHERE iss.itemShelvingFk = vItemShelvingFk
|
||||
AND ish.itemFk = vItemFk
|
||||
AND NOT iss.isPicked
|
||||
FOR UPDATE;
|
||||
|
||||
INSERT INTO itemShelvingSaleReserve (saleFk, sectorFk)
|
||||
SELECT DISTINCT iss.saleFk, vSectorFk
|
||||
FROM itemShelvingSale iss
|
||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
WHERE iss.itemShelvingFk = vItemShelvingFk
|
||||
|
|
|
@ -2,7 +2,8 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQuantity`(
|
||||
vItemShelvingSaleFk INT(10),
|
||||
vQuantity DECIMAL(10,0),
|
||||
vIsItemShelvingSaleEmpty BOOLEAN
|
||||
vIsItemShelvingSaleEmpty BOOLEAN,
|
||||
vSectorFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -14,6 +15,7 @@ BEGIN
|
|||
* @param vQuantity Cantidad real que se ha cogido de la ubicación
|
||||
* @param vIsItemShelvingSaleEmpty determina si la ubicación itemShelvingSale se ha
|
||||
* quedado vacio tras el movimiento
|
||||
* @param vSectorFk Id del sector
|
||||
*/
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vItemShelvingFk INT;
|
||||
|
@ -29,6 +31,12 @@ BEGIN
|
|||
RESIGNAL;
|
||||
END;
|
||||
|
||||
IF vQuantity > vReservedQuantity
|
||||
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
||||
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
||||
CALL util.throw('The quantity cannot be different from the reserved');
|
||||
END IF;
|
||||
|
||||
IF (SELECT isPicked FROM itemShelvingSale WHERE id = vItemShelvingSaleFk) THEN
|
||||
CALL util.throw('Reservation completed');
|
||||
END IF;
|
||||
|
@ -50,9 +58,8 @@ BEGIN
|
|||
AND NOT iss.isPicked;
|
||||
|
||||
IF vQuantity > vReservedQuantity
|
||||
OR (vQuantity < vReservedQuantity AND
|
||||
(NOT vIsItemShelvingSaleEmpty OR vIsItemShelvingSaleEmpty IS NULL))
|
||||
OR (vIsItemShelvingSaleEmpty IS NOT NULL AND vQuantity = vReservedQuantity) THEN
|
||||
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
||||
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
||||
CALL util.throw('The quantity cannot be different from the reserved');
|
||||
END IF;
|
||||
|
||||
|
@ -72,7 +79,7 @@ BEGIN
|
|||
SET visible = GREATEST(0, visible - vQuantity)
|
||||
WHERE id = vItemShelvingFk;
|
||||
|
||||
SELECT SUM(IF(isPicked, 0, quantity)), SUM(quantity)
|
||||
SELECT SUM(IF(isPicked OR id = vItemShelvingSaleFk, 0, quantity)), SUM(quantity)
|
||||
INTO vRemainingQuantity, vTotalQuantity
|
||||
FROM itemShelvingSale
|
||||
WHERE saleFk = vSaleFk;
|
||||
|
@ -96,9 +103,9 @@ BEGIN
|
|||
COMMIT;
|
||||
|
||||
IF vIsItemShelvingSaleEmpty AND vQuantity <> vReservedQuantity THEN
|
||||
INSERT INTO itemShelvingSaleReserve (saleFk)
|
||||
SELECT vSaleFk;
|
||||
CALL itemShelvingSale_reallocate(vItemShelvingFk, vItemFk);
|
||||
INSERT INTO itemShelvingSaleReserve (saleFk, sectorFk)
|
||||
SELECT vSaleFk, vSectorFk;
|
||||
CALL itemShelvingSale_reallocate(vItemShelvingFk, vItemFk, vSectorFk);
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -15,7 +15,7 @@ BEGIN
|
|||
JOIN ticket t ON t.id = c.ticketFk
|
||||
WHERE c.id = vClaimFk;
|
||||
|
||||
CALL buyUltimate (vWarehouseFk, util.VN_CURDATE());
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, util.VN_CURDATE());
|
||||
|
||||
INSERT INTO itemShelving (itemFk, shelvingFk, packing, `grouping`, visible)
|
||||
SELECT s.itemFk, vShelvingFk, b.packing, b.`grouping`, cb.quantity AS visible
|
||||
|
|
|
@ -16,7 +16,8 @@ BEGIN
|
|||
ish.id,
|
||||
s.priority,
|
||||
ish.isChecked,
|
||||
ic.url
|
||||
ic.url,
|
||||
ish.available
|
||||
FROM itemShelving ish
|
||||
JOIN item i ON i.id = ish.itemFk
|
||||
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
|||
FROM operator
|
||||
WHERE workerFk = account.myUser_getId();
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
||||
CALL buy_getUltimate(vBarcodeItem, vWarehouseFk, util.VN_CURDATE());
|
||||
|
||||
SELECT buyFk INTO vBuyFk
|
||||
FROM tmp.buyUltimate
|
||||
|
|
|
@ -21,6 +21,7 @@ BEGIN
|
|||
FROM itemTicketOut i
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
|
||||
JOIN `state` s ON s.id = ts.stateFk
|
||||
JOIN warehouse w ON w.id = i.warehouseFk
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT st.saleFk
|
||||
FROM saleTracking st
|
||||
|
@ -28,26 +29,31 @@ BEGIN
|
|||
WHERE st.created > vDated
|
||||
AND (s.isPicked OR st.isChecked)
|
||||
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
|
||||
WHERE IFNULL(vWarehouseFk, i.warehouseFk) = i.warehouseFk
|
||||
WHERE (vWarehouseFk IS NULL OR i.warehouseFk = vWarehouseFk)
|
||||
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
|
||||
AND w.isComparative
|
||||
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
|
||||
SELECT iei.itemFk, iei.quantity
|
||||
FROM itemEntryIn iei
|
||||
JOIN warehouse w ON w.id = iei.warehouseInFk
|
||||
WHERE iei.isReceived
|
||||
AND iei.landed >= vDated AND iei.landed < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR iei.warehouseInFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR iei.itemFk = vSelf)
|
||||
AND NOT iei.isVirtualStock
|
||||
AND w.isComparative
|
||||
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)
|
||||
SELECT ieo.itemFk, ieo.quantity
|
||||
FROM itemEntryOut ieo
|
||||
JOIN warehouse w ON w.id = ieo.warehouseOutFk
|
||||
WHERE ieo.isDelivered
|
||||
AND ieo.shipped >= vDated
|
||||
AND ieo.shipped < vTomorrow
|
||||
AND (vWarehouseFk IS NULL OR ieo.warehouseOutFk = vWarehouseFk)
|
||||
AND (vSelf IS NULL OR ieo.itemFk = vSelf)
|
||||
AND w.isComparative
|
||||
) t
|
||||
GROUP BY itemFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
|
|
@ -42,7 +42,7 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
SELECT warehouseFk INTO vWarehouseFk
|
||||
FROM userConfig
|
||||
FROM userMultiConfig
|
||||
WHERE userFk = account.myUser_getId();
|
||||
|
||||
IF NOT vWarehouseFk OR vWarehouseFk IS NULL THEN
|
||||
|
@ -93,7 +93,7 @@ BEGIN
|
|||
ORDER BY created DESC
|
||||
LIMIT 1;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vCurdate);
|
||||
CALL buy_getUltimate(vSelf, vWarehouseFk, vCurdate);
|
||||
|
||||
SELECT b.entryFk, bu.buyFk,IFNULL(b.buyingValue, 0) INTO vLastEntryFk, vLastBuyFk, vBuyingValueOriginal
|
||||
FROM tmp.buyUltimate bu
|
||||
|
|
|
@ -240,7 +240,7 @@ BEGIN
|
|||
NULL reference,
|
||||
NULL entityType,
|
||||
NULL entityId,
|
||||
'Inventario calculado',
|
||||
'Inventario calculado' entityName,
|
||||
@a invalue,
|
||||
NULL `out`,
|
||||
@a balance,
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getInfo`(
|
||||
`vBarcode` VARCHAR(22),
|
||||
`vWarehouseFk` INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve información relativa al item correspondiente del vBarcode pasado
|
||||
|
@ -11,12 +14,14 @@ BEGIN
|
|||
DECLARE vCacheAvailableFk INT;
|
||||
DECLARE vVisibleItemShelving INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vDated DATE;
|
||||
|
||||
SELECT barcodeToItem(vBarcode), util.VN_CURDATE() INTO vItemFk, vDated;
|
||||
|
||||
CALL cache.visible_refresh(vCacheVisibleFk, FALSE, vWarehouseFk);
|
||||
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
|
||||
CALL buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
||||
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, vDated);
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
|
||||
|
||||
SELECT barcodeToItem(vBarcode) INTO vItemFk;
|
||||
SELECT SUM(visible) INTO vVisibleItemShelving
|
||||
FROM itemShelvingStock
|
||||
WHERE itemFk = vItemFk
|
||||
|
|
|
@ -1,37 +1,40 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getMinacum`(IN vWarehouseFk TINYINT, IN vDatedFrom DATETIME, IN vRange INT, IN vItemFk INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getMinacum`(
|
||||
vWarehouseFk TINYINT,
|
||||
vDated DATE,
|
||||
vRange INT,
|
||||
vItemFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Cálculo del mínimo acumulado, para un item/almacén especificado, en caso de
|
||||
* NULL para todo.
|
||||
* Cálculo del mínimo acumulado, para un item/almacén
|
||||
* especificado, en caso de NULL para todos.
|
||||
*
|
||||
* @param vWarehouseFk -> warehouseFk
|
||||
* @param vDatedFrom -> fecha inicio
|
||||
* @param vRange -> número de días a considerar
|
||||
* @param vItemFk -> Identificador de item
|
||||
* @param vWarehouseFk Id warehouse
|
||||
* @param vDated Fecha inicio
|
||||
* @param vRange Número de días a considerar
|
||||
* @param vItemFk Id de artículo
|
||||
* @return tmp.itemMinacum
|
||||
*/
|
||||
DECLARE vDatedTo DATETIME;
|
||||
DECLARE vDatedTo DATETIME DEFAULT util.dayEnd(vDated + INTERVAL vRange DAY);
|
||||
|
||||
SET vDatedFrom = TIMESTAMP(DATE(vDatedFrom), '00:00:00');
|
||||
SET vDatedTo = TIMESTAMP(TIMESTAMPADD(DAY, vRange, vDatedFrom), '23:59:59');
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.itemCalc;
|
||||
CREATE TEMPORARY TABLE tmp.itemCalc
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT sub.itemFk,
|
||||
sub.dated,
|
||||
CAST(SUM(sub.quantity) AS SIGNED) quantity,
|
||||
sub.warehouseFk
|
||||
FROM (SELECT s.itemFk,
|
||||
FROM (
|
||||
SELECT s.itemFk,
|
||||
DATE(t.shipped) dated,
|
||||
-s.quantity quantity,
|
||||
t.warehouseFk
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
|
||||
WHERE t.shipped BETWEEN vDated AND vDatedTo
|
||||
AND t.warehouseFk
|
||||
AND s.quantity != 0
|
||||
AND s.quantity <> 0
|
||||
AND (vItemFk IS NULL OR s.itemFk = vItemFk)
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk)
|
||||
UNION ALL
|
||||
|
@ -42,10 +45,10 @@ BEGIN
|
|||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE t.landed BETWEEN vDatedFrom AND vDatedTo
|
||||
WHERE t.landed BETWEEN vDated AND vDatedTo
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND !e.isExcludedFromAvailable
|
||||
AND b.quantity != 0
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND b.quantity <> 0
|
||||
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
||||
UNION ALL
|
||||
SELECT b.itemFk,
|
||||
|
@ -55,28 +58,45 @@ BEGIN
|
|||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
|
||||
WHERE t.shipped BETWEEN vDated AND vDatedTo
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk)
|
||||
AND !e.isExcludedFromAvailable
|
||||
AND b.quantity != 0
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND b.quantity <> 0
|
||||
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
||||
AND !e.isRaid
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT r.itemFk,
|
||||
r.shipment,
|
||||
-r.amount,
|
||||
r.warehouseFk
|
||||
FROM hedera.orderRow r
|
||||
JOIN hedera.`order` o ON o.id = r.orderFk
|
||||
JOIN client c ON c.id = o.customer_id
|
||||
WHERE r.shipment BETWEEN vDated AND vDatedTo
|
||||
AND (vWarehouseFk IS NULL OR r.warehouseFk = vWarehouseFk)
|
||||
AND r.created >= (
|
||||
SELECT util.VN_NOW() - INTERVAL TIME_TO_SEC(reserveTime) SECOND
|
||||
FROM hedera.orderConfig
|
||||
)
|
||||
AND NOT o.confirmed
|
||||
AND (vItemFk IS NULL OR r.itemFk = vItemFk)
|
||||
AND r.amount <> 0
|
||||
) sub
|
||||
GROUP BY sub.itemFk, sub.warehouseFk, sub.dated;
|
||||
|
||||
CALL item_getAtp(vDatedFrom);
|
||||
DROP TEMPORARY TABLE tmp.itemCalc;
|
||||
CALL item_getAtp(vDated);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum;
|
||||
CREATE TEMPORARY TABLE tmp.itemMinacum
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemMinacum
|
||||
(INDEX(itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT i.itemFk,
|
||||
i.warehouseFk,
|
||||
i.quantity amount
|
||||
FROM tmp.itemAtp i
|
||||
HAVING amount != 0;
|
||||
SELECT itemFk,
|
||||
warehouseFk,
|
||||
quantity amount
|
||||
FROM tmp.itemAtp
|
||||
WHERE quantity <> 0;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.itemAtp;
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.itemAtp,
|
||||
tmp.itemCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
*/
|
||||
ALTER TABLE tmp.itemInventory ADD IF NOT EXISTS buy_id INT;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vDate);
|
||||
CALL buy_getUltimate (NULL, vWarehouseFk, vDate);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp
|
||||
(KEY (itemFk))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_valuateInventory`(
|
||||
vDated DATE
|
||||
vDated DATE,
|
||||
vItemTypeFk INT,
|
||||
vItemCategoryFk INT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE vInventoried DATE;
|
||||
|
@ -61,11 +63,14 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
WHERE tr.landed = vDateDayEnd
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
GROUP BY tr.warehouseInFk, b.itemFk;
|
||||
ELSE
|
||||
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
||||
|
@ -78,11 +83,14 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
WHERE tr.landed = vInventoried
|
||||
AND e.supplierFk = vInventorySupplierFk
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
GROUP BY tr.warehouseInFk, b.itemFk;
|
||||
END IF;
|
||||
|
||||
|
@ -97,6 +105,7 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
||||
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
||||
|
@ -104,6 +113,8 @@ BEGIN
|
|||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND e.supplierFk <> vInventorySupplierFk
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity * IF(vHasNotInventory, -1, 1));
|
||||
|
||||
-- Descontamos las salidas
|
||||
|
@ -117,11 +128,14 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
||||
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
|
||||
AND NOT e.isRaid
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity * IF(vHasNotInventory,1,-1));
|
||||
|
||||
-- Descontamos las lineas de venta
|
||||
|
@ -135,10 +149,13 @@ BEGIN
|
|||
JOIN `client` c ON c.id = t.clientFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd
|
||||
AND w.valuatedInventory
|
||||
AND it.isInventory
|
||||
AND (it.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1);
|
||||
|
||||
-- Volver a poner lo que esta aun en las estanterias
|
||||
|
@ -153,11 +170,14 @@ BEGIN
|
|||
JOIN `client` c ON c.id = t.clientFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vDated AND vDateDayEnd
|
||||
AND NOT (s.isPicked OR t.isLabeled)
|
||||
AND w.valuatedInventory
|
||||
AND it.isInventory
|
||||
AND (it.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 0, 1);
|
||||
END IF;
|
||||
|
||||
|
@ -172,6 +192,7 @@ BEGIN
|
|||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN itemType t ON t.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
||||
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
||||
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
||||
|
@ -179,9 +200,11 @@ BEGIN
|
|||
AND wIn.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND e.isConfirmed
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
|
||||
|
||||
CALL buyUltimate(NULL, vDateDayEnd);
|
||||
CALL buy_getUltimate (NULL, NULL, vDateDayEnd);
|
||||
|
||||
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
|
||||
|
||||
|
@ -204,7 +227,8 @@ BEGIN
|
|||
ic.name itemCategoryName,
|
||||
ti.cost,
|
||||
ti.total,
|
||||
ti.warehouseInventory
|
||||
ti.warehouseInventory,
|
||||
ic.display
|
||||
FROM tInventory ti
|
||||
JOIN warehouse w ON w.id = warehouseFk
|
||||
JOIN item i ON i.id = ti.itemFk
|
||||
|
|
|
@ -75,13 +75,6 @@ proc: BEGIN
|
|||
) sub
|
||||
GROUP BY itemFk;
|
||||
|
||||
UPDATE tmp.itemInventory ai
|
||||
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||
SET ai.inventory = iic.quantity,
|
||||
ai.visible = iic.quantity,
|
||||
ai.avalaible = iic.quantity,
|
||||
ai.sd = iic.quantity;
|
||||
|
||||
-- Cálculo del visible
|
||||
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||
|
||||
|
@ -93,8 +86,12 @@ proc: BEGIN
|
|||
WHERE calc_id = vCalcFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||
SET it.visible = it.visible + ivc.visible;
|
||||
LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
|
||||
LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||
SET it.inventory = iic.quantity,
|
||||
it.visible = ivc.visible,
|
||||
it.avalaible = iic.quantity,
|
||||
it.sd = iic.quantity;
|
||||
|
||||
-- Calculo del disponible
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||
|
@ -142,31 +139,35 @@ proc: BEGIN
|
|||
CALL item_getAtp(vDate);
|
||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||
|
||||
UPDATE tmp.itemInventory ai
|
||||
JOIN (
|
||||
SELECT it.itemFk,
|
||||
SUM(it.quantity) quantity,
|
||||
im.quantity minQuantity
|
||||
FROM tmp.itemCalc it
|
||||
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
||||
JOIN item i ON i.id = it.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
||||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||
t.landing,
|
||||
vDateToTomorrow)
|
||||
GROUP BY it.itemFk
|
||||
) sub ON sub.itemFk = ai.id
|
||||
SET ai.avalaible = IF(sub.minQuantity > 0,
|
||||
ai.avalaible,
|
||||
ai.avalaible + sub.minQuantity),
|
||||
ai.sd = ai.inventory + sub.quantity;
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT it.itemFk,
|
||||
SUM(it.quantity) quantity,
|
||||
im.quantity minQuantity
|
||||
FROM tmp.itemCalc it
|
||||
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
||||
JOIN item i ON i.id = it.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
||||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||
t.landing,
|
||||
vDateToTomorrow)
|
||||
GROUP BY it.itemFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
|
||||
SET it.avalaible = IF(iac.minQuantity > 0,
|
||||
it.avalaible,
|
||||
it.avalaible + iac.minQuantity),
|
||||
it.sd = it.inventory + iac.quantity;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.itemTravel,
|
||||
tmp.itemCalc,
|
||||
tmp.itemAtp,
|
||||
tItemInventoryCalc,
|
||||
tItemVisibleCalc;
|
||||
tItemVisibleCalc,
|
||||
tItemAvailableCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -174,27 +174,30 @@ proc: BEGIN
|
|||
WHERE NOT `lines`;
|
||||
|
||||
-- Lineas por linea de encajado
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemPackingType
|
||||
(PRIMARY KEY(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk;
|
||||
|
||||
UPDATE tmp.productionBuffer pb
|
||||
JOIN (
|
||||
SELECT ticketFk,
|
||||
SUM(sub.H) H,
|
||||
SUM(sub.V) V,
|
||||
SUM(sub.N) N
|
||||
FROM (
|
||||
SELECT t.ticketFk,
|
||||
SUM(i.itemPackingTypeFk = 'H') H,
|
||||
SUM(i.itemPackingTypeFk = 'V') V,
|
||||
SUM(i.itemPackingTypeFk IS NULL) N
|
||||
FROM tmp.productionTicket t
|
||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
GROUP BY t.ticketFk, i.itemPackingTypeFk
|
||||
) sub
|
||||
GROUP BY ticketFk
|
||||
) sub2 ON sub2.ticketFk = pb.ticketFk
|
||||
SET pb.H = sub2.H,
|
||||
pb.V = sub2.V,
|
||||
pb.N = sub2.N;
|
||||
JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
|
||||
SET pb.H = ti.H,
|
||||
pb.V = ti.V,
|
||||
pb.N = ti.N;
|
||||
|
||||
-- Colecciones segun tipo de encajado
|
||||
UPDATE tmp.productionBuffer pb
|
||||
|
@ -273,6 +276,7 @@ proc: BEGIN
|
|||
tmp.risk,
|
||||
tmp.ticket_problems,
|
||||
tmp.ticketWithPrevia,
|
||||
tItemShelvingStock;
|
||||
tItemShelvingStock,
|
||||
tItemPackingType;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(vRoute INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el volumen de la ruta.
|
||||
*
|
||||
* @param vSelf Id ruta
|
||||
*/
|
||||
DECLARE vVolume DECIMAL(10,1)
|
||||
DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf);
|
||||
|
||||
UPDATE vn.route r
|
||||
LEFT JOIN (
|
||||
SELECT routeFk, SUM(volume) AS m3
|
||||
FROM saleVolume
|
||||
WHERE routeFk = vRoute
|
||||
) v ON v.routeFk = r.id
|
||||
SET r.m3 = IFNULL(v.m3,0)
|
||||
WHERE r.id =vRoute;
|
||||
UPDATE `route`
|
||||
SET m3 = IFNULL(vVolume, 0)
|
||||
WHERE id = vSelf;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -10,15 +10,10 @@ BEGIN
|
|||
* @param vSaleGroupFk id de la preparación previa
|
||||
* @param vParkingFk id del parking
|
||||
*/
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
UPDATE saleGroup sg
|
||||
SET sg.parkingFk = vParkingFk
|
||||
WHERE sg.id = vSaleGroupFk
|
||||
AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK;
|
||||
WHERE sg.id = vSaleGroupFk
|
||||
AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK;
|
||||
|
||||
CALL ticket_setNextState(ticket_get(vSaleGroupFk));
|
||||
END$$
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
DECLARE vAvailableCache INT;
|
||||
DECLARE vVisibleCache INT;
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vComponentCount INT;
|
||||
DECLARE vRequiredComponent INT;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(tt.shipped))
|
||||
|
@ -54,7 +54,7 @@ BEGIN
|
|||
SELECT ticketFk, clientFk
|
||||
FROM tmp.sale_getProblems;
|
||||
|
||||
SELECT COUNT(*) INTO vComponentCount
|
||||
SELECT COUNT(*) INTO vRequiredComponent
|
||||
FROM component
|
||||
WHERE isRequired;
|
||||
|
||||
|
@ -96,20 +96,18 @@ BEGIN
|
|||
|
||||
-- Faltan componentes
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
|
||||
SELECT ticketFk, (vComponentCount > nComp) hasComponentLack, saleFk
|
||||
FROM (
|
||||
SELECT COUNT(s.id) nComp, tl.ticketFk, s.id saleFk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN sale s ON s.ticketFk = tl.ticketFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component c ON c.id = sc.componentFk AND c.isRequired
|
||||
JOIN ticket t ON t.id = tl.ticketFk
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
|
||||
AND s.quantity > 0
|
||||
GROUP BY s.id
|
||||
) sub
|
||||
SELECT t.id, COUNT(c.id) < vRequiredComponent hasComponentLack, s.id
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN ticket t ON t.id = tl.ticketFk
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component c ON c.id = sc.componentFk
|
||||
AND c.isRequired
|
||||
WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
|
||||
AND s.quantity > 0
|
||||
GROUP BY s.id
|
||||
HAVING hasComponentLack;
|
||||
|
||||
-- Cliente congelado
|
||||
|
@ -276,7 +274,7 @@ BEGIN
|
|||
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
|
||||
|
||||
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
||||
CALL buyUltimate(vWarehouseFk, vDate);
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||
SELECT ticketFk, problem ,saleFk
|
||||
FROM (
|
||||
|
|
|
@ -78,7 +78,7 @@ proc: BEGIN
|
|||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
||||
|
||||
-- rellena la tabla buyUltimate con la ultima compra
|
||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
||||
|
|
|
@ -53,7 +53,7 @@ BEGIN
|
|||
JOIN ticket t ON t.id = s.ticketFk
|
||||
WHERE s.id = vSaleFk;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vDate);
|
||||
CALL buy_getUltimate(vNewItemFk, vWarehouseFk, vDate);
|
||||
|
||||
SELECT `grouping`, groupingMode, packing
|
||||
INTO vGrouping,vGroupingMode,vPacking
|
||||
|
@ -61,6 +61,8 @@ BEGIN
|
|||
JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
|
||||
WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
|
||||
IF vGroupingMode = 'packing' AND vPacking > 0 THEN
|
||||
SET vRoundQuantity = vPacking;
|
||||
END IF;
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT vSelf saleFk,
|
||||
sale_hasComponentLack(vSelf) hasProblem,
|
||||
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
||||
(ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
|
||||
FROM sale
|
||||
WHERE id = vSelf;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT saleFk,
|
||||
sale_hasComponentLack(saleFk) hasProblem,
|
||||
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
||||
(ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
|
||||
FROM (
|
||||
SELECT s.id saleFk, s.ticketFk
|
||||
SELECT s.id saleFk, s.ticketFk, s.quantity
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
|||
JOIN ticket t ON t.id = s.ticketFk
|
||||
WHERE s.id = vSelf;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
SELECT vSelf saleFk,
|
||||
|
|
|
@ -13,12 +13,6 @@ BEGIN
|
|||
DECLARE vParkingFk INT;
|
||||
DECLARE vLastWeek DATE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
SET vParkingCode = REPLACE(vParkingCode, ' ', '');
|
||||
|
||||
SELECT id INTO vParkingFk
|
||||
|
@ -29,8 +23,6 @@ BEGIN
|
|||
CALL util.throw('parkingNotExist');
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
SET vLastWeek = util.VN_CURDATE() - INTERVAL 1 WEEK;
|
||||
|
||||
-- Comprobamos si es una prep. previa, ticket, colección o shelving
|
||||
|
@ -45,7 +37,5 @@ BEGIN
|
|||
ELSE
|
||||
CALL util.throw('paramNotExist');
|
||||
END IF;
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT)
|
||||
proc: BEGIN
|
||||
BEGIN
|
||||
/**
|
||||
* Aparca una matrícula en un parking
|
||||
*
|
||||
* @param vShelvingCode code de la matrícula
|
||||
* @param vParkingFk id del parking
|
||||
*/
|
||||
INSERT INTO vn.shelvingLog (originFk, userFk, action , description,changedModel,changedModelId)
|
||||
INSERT INTO shelvingLog (originFk, userFk, action , description,changedModel,changedModelId)
|
||||
SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code),'Shelving',s.id
|
||||
FROM parking p
|
||||
JOIN shelving s ON s.parkingFk = p.id
|
||||
JOIN parking pNew ON pNew.id = vParkingFk
|
||||
WHERE s.code = vShelvingCode COLLATE utf8_unicode_ci;
|
||||
|
||||
UPDATE vn.shelving
|
||||
UPDATE shelving
|
||||
SET parkingFk = vParkingFk,
|
||||
parked = util.VN_NOW(),
|
||||
isPrinted = TRUE
|
||||
|
|
|
@ -36,6 +36,6 @@ BEGIN
|
|||
WHERE warehouse_id = vAuctionWarehouseFk
|
||||
ON DUPLICATE KEY UPDATE quantity = tmp.item.quantity + VALUES(quantity);
|
||||
|
||||
CALL buyUltimate(vAuctionWarehouseFk, vDated);
|
||||
CALL buy_getUltimate(NULL, vAuctionWarehouseFk, vDated);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -56,13 +56,12 @@ BEGIN
|
|||
FROM zone
|
||||
WHERE id = vZoneFk;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
|
||||
SELECT
|
||||
vWarehouseFk AS warehouseFk,
|
||||
NULL AS available,
|
||||
SELECT vWarehouseFk warehouseFk,
|
||||
NULL available,
|
||||
s.itemFk,
|
||||
bu.buyFk,
|
||||
vZoneFk zoneFk
|
||||
|
|
|
@ -21,11 +21,6 @@ BEGIN
|
|||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
INSERT INTO vn.ticketParking(ticketFk, parkingFk)
|
||||
SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk
|
||||
FROM ticket t
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
|
||||
vClientFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Updates future ticket risk for a client.
|
||||
*
|
||||
* @param vClientFk Id client
|
||||
*/
|
||||
DECLARE vDone INT DEFAULT FALSE;
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE vTickets CURSOR FOR
|
||||
SELECT id
|
||||
FROM ticket
|
||||
WHERE clientFk = vClientFk
|
||||
AND shipped >= util.VN_CURDATE()
|
||||
AND refFk IS NULL;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
OPEN vTickets;
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vTickets INTO vTicketFk;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL vn.ticket_setProblemRisk(vTicketFk);
|
||||
END LOOP;
|
||||
CLOSE vTickets;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
FROM ticket
|
||||
WHERE id = vSelf;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vDated);
|
||||
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
(INDEX(saleFk, isProblemCalcNeeded))
|
||||
|
|
|
@ -1,92 +1,81 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRisk`(
|
||||
vClientFk INT)
|
||||
vClientFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Update the risk for a client with pending tickets
|
||||
* Update the risk for a client with pending tickets.
|
||||
*
|
||||
* @param vClientFk Id cliente
|
||||
*/
|
||||
DECLARE vHasDebt BOOL;
|
||||
DECLARE vStarted DATETIME;
|
||||
|
||||
SELECT COUNT(*) INTO vHasDebt
|
||||
FROM `client`
|
||||
WHERE id = vClientFk
|
||||
AND typeFk = 'normal';
|
||||
|
||||
IF vHasDebt THEN
|
||||
|
||||
SELECT util.VN_CURDATE() - INTERVAL riskScope MONTH INTO vStarted
|
||||
FROM clientConfig;
|
||||
|
||||
IF (SELECT COUNT(*) FROM client WHERE id = vClientFk AND typeFk = 'normal') THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTicketRisk
|
||||
(KEY (ticketFk))
|
||||
(PRIMARY KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
WITH ticket AS(
|
||||
SELECT id ticketFk,
|
||||
companyFk,
|
||||
DATE(shipped) dated,
|
||||
totalWithVat,
|
||||
ticket_isProblemCalcNeeded(id) isProblemCalcNeeded
|
||||
FROM vn.ticket
|
||||
WHERE clientFk = vClientFk
|
||||
AND refFk IS NULL
|
||||
AND NOT isDeleted
|
||||
AND IFNULL(totalWithVat, 0) <> 0
|
||||
AND shipped > vStarted
|
||||
), balance AS(
|
||||
SELECT SUM(amount)amount, companyFk
|
||||
FROM (
|
||||
SELECT amount, companyFk
|
||||
FROM vn.clientRisk
|
||||
WHERE clientFk = vClientFk
|
||||
UNION ALL
|
||||
SELECT -(SUM(amount) / 100) amount, tm.companyFk
|
||||
FROM hedera.tpvTransaction t
|
||||
JOIN hedera.tpvMerchant tm ON t.id = t.merchantFk
|
||||
WHERE clientFk = vClientFk
|
||||
AND receiptFk IS NULL
|
||||
AND status = 'ok'
|
||||
) sub
|
||||
WHERE companyFk
|
||||
GROUP BY companyFk
|
||||
), uninvoiced AS(
|
||||
WITH ticket AS (
|
||||
SELECT t.id ticketFk,
|
||||
t.companyFk,
|
||||
DATE(t.shipped) dated,
|
||||
t.totalWithVat,
|
||||
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
|
||||
FROM vn.ticket t
|
||||
JOIN vn.clientConfig cc
|
||||
WHERE t.clientFk = vClientFk
|
||||
AND t.refFk IS NULL
|
||||
AND NOT t.isDeleted
|
||||
AND IFNULL(t.totalWithVat, 0) <> 0
|
||||
AND t.shipped > (util.VN_CURDATE() - INTERVAL cc.riskScope MONTH)
|
||||
), uninvoiced AS (
|
||||
SELECT companyFk, dated, SUM(totalWithVat) amount
|
||||
FROM ticket
|
||||
GROUP BY companyFk, dated
|
||||
), receipt AS(
|
||||
SELECT companyFk, DATE(payed) dated, SUM(amountPaid) amount
|
||||
FROM vn.receipt
|
||||
WHERE clientFk = vClientFk
|
||||
AND payed > util.VN_CURDATE()
|
||||
GROUP BY companyFk, DATE(payed)
|
||||
), risk AS(
|
||||
), companies AS (
|
||||
SELECT DISTINCT companyFk FROM uninvoiced
|
||||
), balance AS (
|
||||
SELECT SUM(IFNULL(amount, 0))amount, companyFk
|
||||
FROM (
|
||||
SELECT cr.amount, c.companyFk
|
||||
FROM companies c
|
||||
LEFT JOIN vn.clientRisk cr ON cr.companyFk = c.companyFk
|
||||
AND cr.clientFk = vClientFk
|
||||
UNION ALL
|
||||
SELECT -(SUM(t.amount) / 100) amount, c.companyFk
|
||||
FROM companies c
|
||||
LEFT JOIN hedera.tpvMerchant tm ON tm.companyFk = c.companyFk
|
||||
LEFT JOIN hedera.tpvTransaction t ON t.merchantFk = tm.id
|
||||
AND t.clientFk = vClientFk
|
||||
AND t.receiptFk IS NULL
|
||||
AND t.`status` = 'ok'
|
||||
) sub
|
||||
WHERE companyFk
|
||||
GROUP BY companyFk
|
||||
), receipt AS (
|
||||
SELECT r.companyFk, DATE(r.payed) dated, SUM(r.amountPaid) amount
|
||||
FROM vn.receipt r
|
||||
JOIN companies c ON c.companyFk = r.companyFk
|
||||
WHERE r.clientFk = vClientFk
|
||||
AND r.payed > util.VN_CURDATE()
|
||||
GROUP BY r.companyFk, DATE(r.payed)
|
||||
), risk AS (
|
||||
SELECT b.companyFk,
|
||||
ui.dated,
|
||||
SUM(ui.amount) OVER (PARTITION BY b.companyFk ORDER BY ui.dated ) +
|
||||
SUM(ui.amount) OVER (PARTITION BY b.companyFk ORDER BY ui.dated) +
|
||||
b.amount +
|
||||
SUM(IFNULL(r.amount, 0)) amount
|
||||
FROM balance b
|
||||
JOIN uninvoiced ui ON ui.companyFk = b.companyFk
|
||||
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
|
||||
)
|
||||
SELECT ti.ticketFk, r.amount, ti.isProblemCalcNeeded
|
||||
FROM ticket ti
|
||||
JOIN risk r ON r.dated = ti.dated AND r.companyFk = ti.companyFk;
|
||||
)
|
||||
SELECT ti.ticketFk, r.amount, ti.isProblemCalcNeeded
|
||||
FROM ticket ti
|
||||
JOIN risk r ON r.dated = ti.dated
|
||||
AND r.companyFk = ti.companyFk;
|
||||
|
||||
UPDATE ticket t
|
||||
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
||||
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;
|
||||
SET t.risk = IF(tr.isProblemCalcNeeded, tr.amount, NULL);
|
||||
|
||||
DROP TEMPORARY TABLE tTicketRisk;
|
||||
END IF;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
|
||||
vSelf INT,
|
||||
vItemPackingTypeFk VARCHAR(1)
|
||||
vOriginalItemPackingTypeFk VARCHAR(1)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ BEGIN
|
|||
* Respeta el id inicial para el tipo propuesto.
|
||||
*
|
||||
* @param vSelf Id ticket
|
||||
* @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
*/
|
||||
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
|
||||
|
@ -23,7 +23,7 @@ BEGIN
|
|||
SELECT itemPackingTypeFk
|
||||
FROM tSaleGroup
|
||||
WHERE itemPackingTypeFk IS NOT NULL
|
||||
ORDER BY (itemPackingTypeFk = vItemPackingTypeFk) DESC;
|
||||
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
|
|
|
@ -1,55 +1,57 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getAddresses`(
|
||||
vSelf INT,
|
||||
vLanded DATE
|
||||
vShipped DATE,
|
||||
vDepartmentFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve un listado de todos los clientes activos
|
||||
* con consignatarios a los que se les puede
|
||||
* vender producto para esa zona y no tiene un ticket
|
||||
* para ese día.
|
||||
* vender producto para esa zona.
|
||||
*
|
||||
* @param vSelf Id de zona
|
||||
* @param vDated Fecha de entrega
|
||||
* @param vShipped Fecha de envio
|
||||
* @param vDepartmentFk Id de departamento
|
||||
* @return Un select
|
||||
*/
|
||||
CALL zone_getPostalCode(vSelf);
|
||||
|
||||
WITH notHasTicket AS (
|
||||
SELECT id
|
||||
FROM vn.client
|
||||
WHERE id NOT IN (
|
||||
SELECT clientFk
|
||||
FROM vn.ticket
|
||||
WHERE landed BETWEEN vLanded AND util.dayEnd(vLanded)
|
||||
)
|
||||
WITH clientWithTicket AS (
|
||||
SELECT clientFk
|
||||
FROM vn.ticket
|
||||
WHERE shipped BETWEEN vShipped AND util.dayEnd(vShipped)
|
||||
)
|
||||
SELECT c.id clientFk,
|
||||
c.name,
|
||||
c.phone,
|
||||
bt.description,
|
||||
c.salesPersonFk,
|
||||
u.name username,
|
||||
aai.invoiced,
|
||||
cnb.lastShipped
|
||||
FROM vn.client c
|
||||
JOIN notHasTicket ON notHasTicket.id = c.id
|
||||
LEFT JOIN account.`user` u ON u.id = c.salesPersonFk
|
||||
JOIN vn.`address` a ON a.clientFk = c.id
|
||||
JOIN vn.postCode pc ON pc.code = a.postalCode
|
||||
JOIN vn.town t ON t.id = pc.townFk AND t.provinceFk = a.provinceFk
|
||||
JOIN vn.zoneGeo zg ON zg.name = a.postalCode
|
||||
JOIN tmp.zoneNodes zn ON zn.geoFk = pc.geoFk
|
||||
LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = c.id
|
||||
LEFT JOIN vn.annualAverageInvoiced aai ON aai.clientFk = c.id
|
||||
JOIN vn.clientType ct ON ct.code = c.typeFk
|
||||
JOIN vn.businessType bt ON bt.code = c.businessTypeFk
|
||||
WHERE a.isActive
|
||||
AND c.isActive
|
||||
AND ct.code = 'normal'
|
||||
AND bt.code <> 'worker'
|
||||
GROUP BY c.id;
|
||||
SELECT c.id,
|
||||
c.name,
|
||||
c.phone,
|
||||
bt.description,
|
||||
c.salesPersonFk,
|
||||
u.name username,
|
||||
aai.invoiced,
|
||||
cnb.lastShipped,
|
||||
cwt.clientFk
|
||||
FROM vn.client c
|
||||
JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||
JOIN vn.workerDepartment wd ON wd.workerFk = w.id
|
||||
JOIN vn.department d ON d.id = wd.departmentFk
|
||||
LEFT JOIN clientWithTicket cwt ON cwt.clientFk = c.id
|
||||
LEFT JOIN account.`user` u ON u.id = c.salesPersonFk
|
||||
JOIN vn.`address` a ON a.clientFk = c.id
|
||||
JOIN vn.postCode pc ON pc.code = a.postalCode
|
||||
JOIN vn.town t ON t.id = pc.townFk AND t.provinceFk = a.provinceFk
|
||||
JOIN vn.zoneGeo zg ON zg.name = a.postalCode
|
||||
JOIN tmp.zoneNodes zn ON zn.geoFk = pc.geoFk
|
||||
LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = c.id
|
||||
LEFT JOIN vn.annualAverageInvoiced aai ON aai.clientFk = c.id
|
||||
JOIN vn.clientType ct ON ct.code = c.typeFk
|
||||
JOIN vn.businessType bt ON bt.code = c.businessTypeFk
|
||||
WHERE a.isActive
|
||||
AND c.isActive
|
||||
AND ct.code = 'normal'
|
||||
AND bt.code <> 'worker'
|
||||
AND (d.id = vDepartmentFk OR NOT vDepartmentFk)
|
||||
GROUP BY c.id;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneNodes;
|
||||
END$$
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_b
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
CALL itemMinimumQuantity_check(NEW.id, NEW.itemFk, NEW.started, NEW.ended, NEW.warehouseFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_b
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
CALL itemMinimumQuantity_check(NEW.id, NEW.itemFk, NEW.started, NEW.ended, NEW.warehouseFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -9,9 +9,5 @@ BEGIN
|
|||
SET NEW.userFk = account.myUser_getId();
|
||||
END IF;
|
||||
|
||||
IF (NEW.visible <> OLD.visible) THEN
|
||||
SET NEW.available = GREATEST(NEW.available + NEW.visible - OLD.visible, 0);
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,13 +8,16 @@ BEGIN
|
|||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NOT (NEW.routeFk <=> OLD.routeFk) THEN
|
||||
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
|
||||
SELECT r.id
|
||||
FROM vn.route r
|
||||
WHERE r.isOk = FALSE
|
||||
AND r.id IN (OLD.routeFk,NEW.routeFk)
|
||||
AND r.created >= util.VN_CURDATE()
|
||||
GROUP BY r.id;
|
||||
IF NEW.isSigned THEN
|
||||
CALL util.throw('A signed ticket cannot be rerouted');
|
||||
END IF;
|
||||
INSERT IGNORE INTO routeRecalc(routeFk)
|
||||
SELECT id
|
||||
FROM `route`
|
||||
WHERE NOT isOk
|
||||
AND id IN (OLD.routeFk, NEW.routeFk)
|
||||
AND created >= util.VN_CURDATE()
|
||||
GROUP BY id;
|
||||
END IF;
|
||||
|
||||
IF NOT (DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
ALTER TABLE bs.waste ADD buyerFk int(10) unsigned NOT NULL;
|
||||
USE vn;
|
||||
CREATE OR REPLACE TEMPORARY TABLE tBuyers
|
||||
ENGINE = MEMORY
|
||||
WITH tDistinctBuyers AS (
|
||||
SELECT DISTINCT buyer
|
||||
FROM bs.waste w
|
||||
)
|
||||
SELECT buyer, u.id
|
||||
FROM tDistinctBuyers tdb
|
||||
JOIN account.`user` u ON u.name = tdb.buyer COLLATE utf8mb3_unicode_ci;
|
||||
|
||||
UPDATE bs.waste w
|
||||
JOIN tBuyers tb ON tb.buyer = w.buyer
|
||||
SET w.buyerFk = tb.id;
|
||||
|
||||
DROP TEMPORARY TABLE tBuyers;
|
||||
|
||||
ALTER TABLE bs.waste
|
||||
DROP PRIMARY KEY,
|
||||
DROP COLUMN family,
|
||||
DROP COLUMN rate,
|
||||
DROP COLUMN buyer;
|
||||
|
||||
ALTER TABLE bs.waste CHANGE buyerFk buyerFk int(10) unsigned NOT NULL AFTER `week`;
|
||||
ALTER TABLE bs.waste ADD CONSTRAINT waste_user_FK FOREIGN KEY (buyerFk) REFERENCES account.user(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
|
||||
ALTER TABLE bs.waste ADD saleQuantity int(11) DEFAULT NULL NULL;
|
||||
ALTER TABLE bs.waste MODIFY COLUMN saleTotal decimal(10,2) DEFAULT NULL NULL;
|
||||
ALTER TABLE bs.waste MODIFY COLUMN saleWaste decimal(10,2) DEFAULT NULL NULL;
|
||||
ALTER TABLE bs.waste CHANGE saleWaste saleInternalWaste decimal(10,2) DEFAULT NULL NULL;
|
||||
ALTER TABLE bs.waste ADD saleExternalWaste decimal(10,2) DEFAULT NULL NULL;
|
||||
ALTER TABLE bs.waste CHANGE saleQuantity saleQuantity decimal(10,2) DEFAULT NULL NULL AFTER itemTypeFk;
|
||||
ALTER TABLE bs.waste CHANGE itemFk itemFk int(11) DEFAULT 0 NOT NULL AFTER itemTypeFk;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tWasteUnique
|
||||
SELECT *
|
||||
FROM bs.waste
|
||||
GROUP BY `year`, `week`, buyerFk, itemTypeFk, itemFk
|
||||
HAVING COUNT(*) > 1;
|
||||
|
||||
DELETE w.* FROM bs.waste w
|
||||
JOIN tWasteUnique twu ON twu.`year` = w.`year`
|
||||
AND twu.`week` = w.`week`
|
||||
AND twu.`buyerFk` = w.`buyerFk`
|
||||
AND twu.`itemTypeFk` = w.`itemTypeFk`
|
||||
AND twu.`itemFk` = w.`itemFk`;
|
||||
|
||||
INSERT INTO bs.waste
|
||||
SELECT * FROM tWasteUnique;
|
||||
|
||||
ALTER TABLE bs.waste ADD CONSTRAINT waste_pk PRIMARY KEY (`year`, `week`, buyerFk, itemTypeFk, itemFk);
|
||||
|
||||
DROP TEMPORARY TABLE tWasteUnique;
|
|
@ -16,6 +16,4 @@ INSERT IGNORE INTO account.roleInherit (`role`,`inheritsFrom`)
|
|||
|
||||
UPDATE salix.ACL
|
||||
SET principalId='$authenticated'
|
||||
WHERE id=264;
|
||||
|
||||
|
||||
WHERE id=(SELECT id FROM salix.ACL WHERE model='StarredModule' and property='*' and `accessType`='*');
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
RENAME TABLE hedera.shelfConfig TO hedera.shelfMultiConfig ;
|
||||
RENAME TABLE pbx.queueConfig TO pbx.queueMultiConfig ;
|
||||
RENAME TABLE salix.defaultViewConfig TO salix.defaultViewMultiConfig;
|
||||
RENAME TABLE edi.fileConfig TO edi.fileMultiConfig;
|
||||
RENAME TABLE edi.imapConfig TO edi.imapMultiConfig;
|
||||
RENAME TABLE edi.tableConfig TO edi.tableMultiConfig;
|
||||
RENAME TABLE vn.invoiceOutTaxConfig TO vn.invoiceOutTaxMultiConfig;
|
||||
RENAME TABLE vn.userConfig TO vn.userMultiConfig;
|
||||
RENAME TABLE vn.conveyorConfig TO vn.conveyorMultiConfig;
|
||||
|
||||
GRANT SELECT ON TABLE hedera.shelfMultiConfig TO employee;
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.ticketSms__ DROP FOREIGN KEY IF EXISTS ticketSms_FK;
|
||||
ALTER TABLE vn.ticketSms__ ADD CONSTRAINT ticketSms_FK FOREIGN KEY (smsFk) REFERENCES vn.sms(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.invoiceInConfig
|
||||
ADD dueDateMarginDays INT UNSIGNED DEFAULT 2 NULL;
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
ALTER TABLE IF EXISTS vn.sectorCollectionSaleGroup DROP FOREIGN KEY sectorCollectionSaleGroup_ibfk_3;
|
||||
ALTER TABLE IF EXISTS vn.sectorCollectionSaleGroup DROP FOREIGN KEY sectorCollectionSaleGroup_ibfk_2;
|
||||
ALTER TABLE IF EXISTS vn.sectorCollectionSaleGroup DROP KEY saleGroupFk;
|
||||
|
||||
|
||||
ALTER TABLE IF EXISTS vn.sectorCollectionSaleGroup ADD CONSTRAINT sectorCollectionSaleGroup_saleGroup_FK
|
||||
FOREIGN KEY (saleGroupFk) REFERENCES vn.saleGroup(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
||||
ALTER TABLE IF EXISTS vn.sectorCollectionSaleGroup ADD CONSTRAINT sectorCollectionSaleGroup_unique UNIQUE KEY (sectorCollectionFk,saleGroupFk);
|
|
@ -0,0 +1,11 @@
|
|||
-- Place your SQL code here
|
||||
|
||||
ALTER TABLE IF EXISTS vn.itemShelvingSaleReserve
|
||||
ADD IF NOT EXISTS sectorFk int(11) NULL;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.itemShelvingSaleReserve
|
||||
DROP FOREIGN KEY IF EXISTS itemShelvingSaleReserve_sector_FK;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.itemShelvingSaleReserve
|
||||
ADD CONSTRAINT itemShelvingSaleReserve_sector_FK FOREIGN KEY (id)
|
||||
REFERENCES vn.sector(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
ALTER TABLE vn.itemShelvingSale MODIFY COLUMN IF EXISTS isPicked tinyint(1) DEFAULT 1 NOT NULL;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.state DROP FOREIGN KEY state_ibfk_1;
|
||||
ALTER TABLE vn.state ADD CONSTRAINT state_ibfk_1 FOREIGN KEY (alertLevel) REFERENCES vn.alertLevel(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
ALTER TABLE dipole.expedition_PrintOut ADD isChecked BOOL DEFAULT FALSE NOT NULL COMMENT 'Indica si la expedición ha sido revisada por un revisor';
|
||||
|
||||
DELETE FROM salix.ACL
|
||||
WHERE model = 'Expedition_PrintOut';
|
||||
|
||||
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId)
|
||||
VALUES( 'Expedition_PrintOut', '*', '*', 'ALLOW', 'ROLE', 'production');
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.productionConfigLog ADD COLUMN IF NOT EXISTS summaryId varchar(30);
|
||||
ALTER TABLE vn.agencyLog ADD COLUMN IF NOT EXISTS summaryId varchar(30);
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.calendar
|
||||
ADD CONSTRAINT calendar_user_FK FOREIGN KEY (editorFk) REFERENCES account.`user`(id);
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE IF EXISTS vn.itemShelving
|
||||
MODIFY COLUMN IF EXISTS isSplit tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Este valor cambia al splitar un carro que se ha quedado en holanda';
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue