Compare commits
6 Commits
dev
...
7731-clien
Author | SHA1 | Date |
---|---|---|
Robert Ferrús | b3539e6c6e | |
Robert Ferrús | 62e38eff23 | |
Robert Ferrús | 1a5e473656 | |
Robert Ferrús | 7b1362a9d5 | |
Robert Ferrús | 1def362a8f | |
Robert Ferrús | f7ff78ed96 |
|
@ -36,7 +36,3 @@ rules:
|
|||
jasmine/no-focused-tests: 0
|
||||
jasmine/prefer-toHaveBeenCalledWith: 0
|
||||
arrow-spacing: ["error", { "before": true, "after": true }]
|
||||
no-restricted-syntax:
|
||||
- "error"
|
||||
- selector: "NewExpression[callee.name='Date']"
|
||||
message: "Use Date.vnNew() instead of new Date()."
|
||||
|
|
|
@ -29,8 +29,10 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
||||
const models = Self.app.models;
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const myOptions = {userId};
|
||||
const $t = ctx.req.__;
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
@ -57,6 +59,22 @@ module.exports = Self => {
|
|||
|
||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||
|
||||
for (let ticket of tickets) {
|
||||
if (ticket.observaciones) {
|
||||
let observations = ticket.observaciones.split(' ');
|
||||
|
||||
for (let observation of observations) {
|
||||
const salesPerson = ticket.salesPersonFk;
|
||||
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||
await models.Chat.send(ctx,
|
||||
observation,
|
||||
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getCollection(id, tickets, sales, placements, myOptions);
|
||||
};
|
||||
|
||||
|
|
|
@ -57,10 +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,
|
||||
p2.code parkingCodePrevia,
|
||||
p2.pickingOrder pickingOrderPrevia,
|
||||
p.code parkingCode,
|
||||
p.pickingOrder pickingOrder,
|
||||
p2.code parkingCode,
|
||||
p2.pickingOrder pickingOrder,
|
||||
p.code parkingCodePrevia,
|
||||
p.pickingOrder pickingOrderPrevia,
|
||||
iss.id itemShelvingSaleFk,
|
||||
iss.isPicked,
|
||||
iss.itemShelvingFk
|
||||
|
@ -73,7 +73,7 @@ module.exports = Self => {
|
|||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
|
@ -114,7 +114,7 @@ module.exports = Self => {
|
|||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
|
|
|
@ -28,10 +28,9 @@ describe('ticket assign()', () => {
|
|||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should throw an error when there are no picking tickets', async() => {
|
||||
it('should throw an error when there is not picking tickets', async() => {
|
||||
try {
|
||||
await models.Collection.assign(ctx, options);
|
||||
fail('Expected an error to be thrown, but none was thrown.');
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('There are not picking tickets');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('machineWorker updateInTime()', () => {
|
||||
const itBoss = 104;
|
||||
const davidCharles = 1106;
|
||||
|
||||
beforeAll(async() => {
|
||||
ctx = {
|
||||
req: {
|
||||
accessToken: {},
|
||||
headers: {origin: 'http://localhost'},
|
||||
__: value => value
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
it('should throw an error if the plate does not exist', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const plate = 'RE-123';
|
||||
ctx.req.accessToken.userId = 1106;
|
||||
try {
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
const error = e;
|
||||
|
||||
expect(error.message).toContain('the plate does not exist');
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should grab a machine where is not in use', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const plate = 'RE-003';
|
||||
ctx.req.accessToken.userId = 1107;
|
||||
try {
|
||||
const totalBefore = await models.MachineWorker.find(null, options);
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
const totalAfter = await models.MachineWorker.find(null, options);
|
||||
|
||||
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
describe('less than 12h', () => {
|
||||
const plate = 'RE-001';
|
||||
it('should trow an error if it is not himself', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
ctx.req.accessToken.userId = davidCharles;
|
||||
|
||||
try {
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
const error = e;
|
||||
|
||||
expect(error.message).toContain('This machine is already in use');
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw an error if it is himself with a different machine', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
ctx.req.accessToken.userId = itBoss;
|
||||
const plate = 'RE-003';
|
||||
try {
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
const error = e;
|
||||
|
||||
expect(error.message).toEqual('You are already using a machine');
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should set the out time if it is himself', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
ctx.req.accessToken.userId = itBoss;
|
||||
|
||||
try {
|
||||
const isNotParked = await models.MachineWorker.findOne({
|
||||
where: {workerFk: itBoss}
|
||||
}, options);
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
const isParked = await models.MachineWorker.findOne({
|
||||
where: {workerFk: itBoss}
|
||||
}, options);
|
||||
|
||||
expect(isNotParked.outTime).toBeNull();
|
||||
expect(isParked.outTime).toBeDefined();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('equal or more than 12h', () => {
|
||||
const plate = 'RE-002';
|
||||
it('should set the out time and grab the machine', async() => {
|
||||
const tx = await models.MachineWorker.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
ctx.req.accessToken.userId = davidCharles;
|
||||
const filter = {
|
||||
where: {workerFk: davidCharles, machineFk: 2}
|
||||
};
|
||||
try {
|
||||
const isNotParked = await models.MachineWorker.findOne(filter, options);
|
||||
const totalBefore = await models.MachineWorker.find(null, options);
|
||||
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||
const isParked = await models.MachineWorker.findOne(filter, options);
|
||||
const totalAfter = await models.MachineWorker.find(null, options);
|
||||
|
||||
expect(isNotParked.outTime).toBeNull();
|
||||
expect(isParked.outTime).toBeDefined();
|
||||
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,77 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('updateInTime', {
|
||||
description: 'Updates the corresponding registry if the worker has been registered in the last few hours',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'plate',
|
||||
type: 'string',
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: `/updateInTime`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.updateInTime = async(ctx, plate, options) => {
|
||||
const models = Self.app.models;
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const $t = ctx.req.__;
|
||||
|
||||
let tx;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const machine = await models.Machine.findOne({
|
||||
fields: ['id', 'plate'],
|
||||
where: {plate}
|
||||
}, myOptions);
|
||||
|
||||
if (!machine)
|
||||
throw new UserError($t('the plate does not exist', {plate}));
|
||||
|
||||
const machineWorker = await Self.findOne({
|
||||
where: {
|
||||
or: [{machineFk: machine.id}, {workerFk: userId}],
|
||||
outTime: null,
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
|
||||
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
|
||||
|
||||
if (machineWorker) {
|
||||
const isHimself = userId == machineWorker.workerFk;
|
||||
const isSameMachine = machine.id == machineWorker.machineFk;
|
||||
|
||||
if (hoursDifference < maxHours && !isHimself)
|
||||
throw new UserError($t('This machine is already in use.'));
|
||||
|
||||
if (hoursDifference < maxHours && isHimself && !isSameMachine)
|
||||
throw new UserError($t('You are already using a machine'));
|
||||
|
||||
await machineWorker.updateAttributes({
|
||||
outTime: Date.vnNew()
|
||||
}, myOptions);
|
||||
}
|
||||
|
||||
if (!machineWorker || hoursDifference >= maxHours)
|
||||
await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -39,9 +39,6 @@ module.exports = Self => {
|
|||
const xmlString = response.data;
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
|
||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
|
||||
|
||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||
return result.toLowerCase().includes('se ha cancelado correctamente');
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = Self => {
|
|||
return await Self.rawSql(`
|
||||
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
|
||||
SELECT ?, ?, ?
|
||||
FROM workerTimeControlConfig wtcc
|
||||
FROM workerTimeControlParams wtcp
|
||||
LEFT JOIN (
|
||||
SELECT wa.workerFk,
|
||||
wa.created,
|
||||
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
|||
) sub ON TRUE
|
||||
WHERE sub.workerFk IS NULL
|
||||
OR sub.code <> ?
|
||||
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;`
|
||||
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcp.dayBreak;`
|
||||
, [userId, code, model, userId, code], myOptions);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -79,9 +79,6 @@
|
|||
"ImageCollectionSize": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ImageConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ImageContainer": {
|
||||
"dataSource": "imageStorage"
|
||||
},
|
||||
|
@ -91,6 +88,12 @@
|
|||
"Machine": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MachineWorker": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MachineWorkerConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MobileAppVersionControl": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -142,12 +145,6 @@
|
|||
"StarredModule": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SaySimpleCountry": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SaySimpleConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TempContainer": {
|
||||
"dataSource": "tempStorage"
|
||||
},
|
||||
|
|
|
@ -44,11 +44,6 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Continent",
|
||||
"foreignKey": "continentFk"
|
||||
},
|
||||
"saySimpleCountry": {
|
||||
"type": "hasOne",
|
||||
"model": "SaySimpleCountry",
|
||||
"foreignKey": "countryFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
@ -59,4 +54,4 @@
|
|||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
},
|
||||
"itemFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"isChecked": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "ImageConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "hedera.imageConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "MachineWorkerConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "vn.machineWorkerConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"maxHours": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/machine-worker/updateInTime')(Self);
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "MachineWorker",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "vn.machineWorker"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"machineFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"inTime": {
|
||||
"type": "date",
|
||||
"mysql": {
|
||||
"columnName": "inTimed"
|
||||
}
|
||||
},
|
||||
"outTime": {
|
||||
"type": "date",
|
||||
"mysql": {
|
||||
"columnName": "outTimed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"name": "SaySimpleConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "saySimpleConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"defaultChannel": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"name": "SaySimpleCountry",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "saySimpleCountry"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"countryFk": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"channel": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -4,7 +4,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','11311','315864403260623fede9f0471ef3d9036faf23b1','2024-11-12 08:00:59','11336');
|
||||
INSERT INTO `version` VALUES ('vn-database','11278','fe10f03459a153fc213bf64e352804c043f94590','2024-10-03 07:47:47','11281');
|
||||
|
||||
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);
|
||||
|
@ -988,7 +988,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','11194','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11195','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11196','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-18 07:28:14',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11197','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11198','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:49',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11201','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-08-27 13:04:26',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11204','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-03 08:58:01',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11205','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-04 13:54:55',NULL,NULL);
|
||||
|
@ -1014,7 +1013,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','11225','01-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11225','02-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11227','00-addWorkerTimeControlMailAcl.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:41',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11229','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-16 08:24:17',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11230','00-addClientObservationType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:52',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11234','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:42',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11235','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11236','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
|
@ -1023,53 +1021,18 @@ INSERT INTO `versionLog` VALUES ('vn-database','11237','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11239','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-17 12:57:06',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11240','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11241','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-20 09:08:25',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11242','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:42:52',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11246','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-18 12:39:53',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11247','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-19 12:10:08',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11248','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-23 11:12:17',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11249','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11251','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:43:38',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11251','01-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 07:57:30',NULL,'Connection lost: The server closed the connection.');
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11253','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-20 14:41:27',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11254','00-thermographTemperature.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:13',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11254','01-thermographFk.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11255','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11256','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-09-23 12:18:24',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11258','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11260','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11261','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11262','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11263','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-09-27 12:05:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11264','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11271','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11272','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:15',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11273','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 10:50:51',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:16',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript2.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:29',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript3.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript5.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript6.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:35',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11274','00-firstScript7.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11277','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11278','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-03 07:47:43',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11279','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-10-02 08:05:24',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11280','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-02 08:46:50',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11281','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11283','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11284','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:36',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11285','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11287','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11288','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-10 08:26:34',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11289','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-15 07:01:33',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11290','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11291','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-17 09:10:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11294','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11295','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-10 08:45:13',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11298','00-closure.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:37',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11300','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-18 08:27:05',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11302','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:57',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11308','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-10-23 12:41:55',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11311','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-12 08:00:57',NULL,NULL);
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
@ -1444,8 +1407,6 @@ INSERT INTO `roleInherit` VALUES (376,124,21,19336);
|
|||
INSERT INTO `roleInherit` VALUES (377,47,49,19295);
|
||||
INSERT INTO `roleInherit` VALUES (378,101,15,19294);
|
||||
INSERT INTO `roleInherit` VALUES (379,103,121,19294);
|
||||
INSERT INTO `roleInherit` VALUES (381,119,123,19295);
|
||||
INSERT INTO `roleInherit` VALUES (382,48,72,783);
|
||||
|
||||
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
|
||||
|
||||
|
@ -1762,6 +1723,7 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','
|
|||
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
|
||||
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
||||
INSERT INTO `ACL` VALUES (382,'Item','labelPdf','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
||||
|
@ -2084,7 +2046,7 @@ INSERT INTO `ACL` VALUES (756,'Route','findOne','READ','ALLOW','ROLE','employee'
|
|||
INSERT INTO `ACL` VALUES (757,'Route','getRoutesByWorker','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (758,'Route','canViewAllRoute','READ','ALLOW','ROLE','deliveryAssistant',NULL);
|
||||
INSERT INTO `ACL` VALUES (759,'Route','cmr','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (760,'Cmr','downloadZip','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (760,'Route','downloadCmrsZip','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee',NULL);
|
||||
|
@ -2213,6 +2175,7 @@ INSERT INTO `ACL` VALUES (892,'WorkerIncome','*','*','ALLOW','ROLE','hr',NULL);
|
|||
INSERT INTO `ACL` VALUES (893,'PayrollComponent','*','*','ALLOW','ROLE','hr',NULL);
|
||||
INSERT INTO `ACL` VALUES (894,'Worker','__get__incomes','*','ALLOW','ROLE','hr',NULL);
|
||||
INSERT INTO `ACL` VALUES (895,'ItemShelvingLog','*','READ','ALLOW','ROLE','production',NULL);
|
||||
INSERT INTO `ACL` VALUES (897,'WorkerLog','*','READ','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (901,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','system',NULL);
|
||||
INSERT INTO `ACL` VALUES (902,'Entry','filter','READ','ALLOW','ROLE','supplier',NULL);
|
||||
INSERT INTO `ACL` VALUES (903,'Entry','getBuys','READ','ALLOW','ROLE','supplier',NULL);
|
||||
|
@ -2228,6 +2191,7 @@ INSERT INTO `ACL` VALUES (912,'Worker','__get__medicalReview','*','ALLOW','ROLE'
|
|||
INSERT INTO `ACL` VALUES (913,'VnToken','*','READ','ALLOW','ROLE','developer',10578);
|
||||
INSERT INTO `ACL` VALUES (914,'VnToken','killSession','*','ALLOW','ROLE','developer',10578);
|
||||
INSERT INTO `ACL` VALUES (915,'ACL','*','WRITE','ALLOW','ROLE','developerBoss',10578);
|
||||
INSERT INTO `ACL` VALUES (916,'Entry','getBuysCsv','READ','ALLOW','ROLE','supplier',10578);
|
||||
INSERT INTO `ACL` VALUES (917,'InvoiceOut','refundAndInvoice','WRITE','ALLOW','ROLE','administrative',10578);
|
||||
INSERT INTO `ACL` VALUES (918,'Worker','__get__descriptor','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (919,'Worker','findById','READ','ALLOW','ROLE','employee',10578);
|
||||
|
@ -2249,7 +2213,6 @@ INSERT INTO `ACL` VALUES (935,'BankEntity','*','WRITE','ALLOW','ROLE','financial
|
|||
INSERT INTO `ACL` VALUES (936,'Device','handleUser','*','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (937,'WorkerTimeControlMail','count','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (938,'Worker','__get__mail','READ','ALLOW','ROLE','hr',10578);
|
||||
INSERT INTO `ACL` VALUES (939,'Machine','*','*','ALLOW','ROLE','productionBoss',10578);
|
||||
|
||||
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
|
||||
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
||||
|
@ -2445,8 +2408,6 @@ INSERT INTO `claimResponsible` VALUES (22,'Paletizadores',0,'pal');
|
|||
INSERT INTO `claimResponsible` VALUES (23,'Preparación Previa',0,'pre');
|
||||
INSERT INTO `claimResponsible` VALUES (24,'Almacén PCA',0,'war');
|
||||
INSERT INTO `claimResponsible` VALUES (25,'Huelga',0,'str');
|
||||
INSERT INTO `claimResponsible` VALUES (27,'Prep. por caja',0,'');
|
||||
INSERT INTO `claimResponsible` VALUES (45,'Negativo',0,'neg');
|
||||
|
||||
INSERT INTO `claimReason` VALUES (1,'Prisas',0);
|
||||
INSERT INTO `claimReason` VALUES (2,'Novato',0);
|
||||
|
@ -2489,9 +2450,6 @@ INSERT INTO `claimReason` VALUES (52,'Mala gestión comercial',0);
|
|||
INSERT INTO `claimReason` VALUES (53,'Mala gestión comprador',0);
|
||||
INSERT INTO `claimReason` VALUES (54,'A2',0);
|
||||
INSERT INTO `claimReason` VALUES (55,'Entrega 48h o más',0);
|
||||
INSERT INTO `claimReason` VALUES (56,'Error cliente',0);
|
||||
INSERT INTO `claimReason` VALUES (57,'A2/B1',0);
|
||||
INSERT INTO `claimReason` VALUES (58,'Seguro',0);
|
||||
|
||||
INSERT INTO `claimRedelivery` VALUES (1,'Cliente');
|
||||
INSERT INTO `claimRedelivery` VALUES (2,'No dev./No especif.');
|
||||
|
@ -2499,7 +2457,6 @@ INSERT INTO `claimRedelivery` VALUES (3,'Reparto');
|
|||
INSERT INTO `claimRedelivery` VALUES (4,'Agencia');
|
||||
INSERT INTO `claimRedelivery` VALUES (5,'Tour');
|
||||
INSERT INTO `claimRedelivery` VALUES (6,'Fuera Peninsula');
|
||||
INSERT INTO `claimRedelivery` VALUES (7,'Francia');
|
||||
|
||||
INSERT INTO `claimResult` VALUES (1,'Otros daños');
|
||||
INSERT INTO `claimResult` VALUES (2,'Roces');
|
||||
|
@ -2577,39 +2534,39 @@ 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,116,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,114,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,5,NULL,72,0,0,1,1,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (23,'CMA','CAMARA',15,16,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,'PREVIOUS');
|
||||
INSERT INTO `department` VALUES (31,'it','INFORMATICA',6,7,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (35,'finance','FINANZAS',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (36,'labor','LABORAL',12,13,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (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,1,0,1,NULL,NULL,NULL,'ON_PREPARATION');
|
||||
INSERT INTO `department` VALUES (38,'picking','SACADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_PREPARATION');
|
||||
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'PACKING');
|
||||
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',38,39,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (43,'VT','VENTAS',40,75,NULL,0,0,0,1,17,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (44,'management','GERENCIA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (46,'delivery','REPARTO',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'DELIVERY');
|
||||
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',82,83,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'STORAGE');
|
||||
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (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,73,NULL,0,0,0,1,16,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (44,'management','GERENCIA',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (46,'delivery','REPARTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'DELIVERY');
|
||||
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',80,81,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'STORAGE');
|
||||
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',21,22,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',23,24,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',90,93,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'FIELD');
|
||||
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',43,44,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,'CLAIM');
|
||||
INSERT INTO `department` VALUES (61,NULL,'VNH',96,99,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',100,101,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',88,91,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'FIELD');
|
||||
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',92,93,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',43,44,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,1,1,0,0,NULL,NULL,NULL,'CLAIM');
|
||||
INSERT INTO `department` VALUES (61,NULL,'VNH',94,97,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',25,26,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',102,103,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',100,101,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',45,46,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',104,105,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',106,107,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (90,NULL,'TRAILER',97,98,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',104,105,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (90,NULL,'TRAILER',95,96,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',27,28,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PREVIOUS');
|
||||
INSERT INTO `department` VALUES (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);
|
||||
|
@ -2617,24 +2574,23 @@ INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',51,52,24065,
|
|||
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',53,54,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (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',108,109,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',106,107,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PALLETIZING');
|
||||
INSERT INTO `department` VALUES (130,NULL,'REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_CHECKING');
|
||||
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',91,92,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',89,90,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (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',110,111,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',112,113,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (137,'sorter','SORTER',114,115,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',110,111,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (137,'sorter','SORTER',112,113,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (140,'internationalTeam','EQUIPO INTERNACIONAL',69,70,33320,0,0,0,2,0,43,'/1/43/','int_equipo',1,'international@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (141,NULL,'PREVIA',35,36,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'PREVIOUS');
|
||||
INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,22,'/1/22/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (147,'spainTeamAsia','EQUIPO ESPAÑA ASIA',71,72,40214,0,0,0,2,0,43,'/1/43/','esA_equipo',0,'esA@verdnatura.es',0,0,0,0,NULL,NULL,'5500',NULL);
|
||||
INSERT INTO `department` VALUES (148,NULL,'CAPTATION FRANCIA',73,74,NULL,0,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0,NULL,NULL,'6000',NULL);
|
||||
|
||||
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
|
||||
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
|
||||
|
|
|
@ -502,7 +502,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','receipt','alexm@%','0000-
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visitUser','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','referenceRate','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','report','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerAssistant','producer','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','cache','productionBoss','available','guillermo@10.5.1.2','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','time','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','role','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','config__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
|
@ -605,6 +605,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','project','jua
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','productionConfig','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','productionConfig','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditInsurance','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','cache','productionBoss','visible','guillermo@10.5.1.2','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','errorProduction__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','invoiceOut','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','coolerAssist','Tickets','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
|
@ -791,6 +792,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','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','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','link','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','delivery','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
|
@ -969,7 +971,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','officeBoss','ticketPackagingSt
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerRelatives','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketPackagingStartingStock','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierPackaging','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierContact','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorrection','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1469,31 +1471,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','tillSerial','
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','stockBuyed','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','alertLevel','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivityType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','priceDelta','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','priceDelta','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parkingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','travelLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierContact','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDms','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','user','juan@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimReason','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResponsible','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResult','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimRedelivery','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','producer','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStateTag','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','material','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','saleUnit','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','origin','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemType','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','delivery','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemFarmingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemWrappingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemLanguageTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStemTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBaseTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBreederTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||
|
@ -1873,6 +1853,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByE
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','stockbuyedbyworker','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getsplit','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','subordinategetlist','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_afterUpsert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
|
@ -2020,6 +2001,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','logshow','PROCEDURE','alex
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyerBoss','supplierpackaging_reportsource','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','supplierexpenses','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','firstdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','stockbuyed_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','mail_insert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaParcialMake','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','palletizerBoss','packingsite_startcollection','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
|
@ -2229,10 +2211,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','guest','ticketCalculatePurge','
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','bs','buyerBoss','waste_addSales','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','saletracking_sectorcollectionaddprevok','PROCEDURE','alexm@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','saleSplit','PROCEDURE','carlosap@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_deleteAdded','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','bs','grafana','waste_addSales','PROCEDURE','guillermo@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 */;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1128,28 +1128,6 @@ DELIMITER ;
|
|||
/*!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 `hedera`.`orderRow_afterInsert`
|
||||
AFTER INSERT ON `orderRow`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE `order`
|
||||
SET rowUpdated = util.VN_NOW()
|
||||
WHERE id = NEW.orderFk;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
|
||||
--
|
||||
-- Current Database: `pbx`
|
||||
|
@ -2454,21 +2432,11 @@ DELIMITER ;;
|
|||
AFTER UPDATE ON `business`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vIsActive BOOL;
|
||||
DECLARE vExtension VARCHAR(10);
|
||||
|
||||
CALL worker_updateBusiness(NEW.workerFk);
|
||||
|
||||
IF NOT (OLD.workerFk <=> NEW.workerFk) THEN
|
||||
CALL worker_updateBusiness(OLD.workerFk);
|
||||
END IF;
|
||||
|
||||
IF NOT (OLD.departmentFk <=> NEW.departmentFk) THEN
|
||||
SELECT COUNT(*) INTO vIsActive FROM worker WHERE businessFk = NEW.id;
|
||||
IF vIsActive THEN
|
||||
CALL queueMember_updateQueue(NEW.id);
|
||||
END IF;
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -6586,9 +6554,6 @@ BEGIN
|
|||
SET NEW.userFk = account.myUser_getId();
|
||||
END IF;
|
||||
|
||||
IF NEW.shelvingFk <> OLD.shelvingFk THEN
|
||||
SET NEW.movingState = NULL;
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -6689,11 +6654,11 @@ DELIMITER ;;
|
|||
AFTER INSERT ON `itemShelvingSale`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
UPDATE sale s
|
||||
JOIN operator o ON o.workerFk = account.myUser_getId()
|
||||
JOIN sector se ON se.id = o.sectorFk
|
||||
SET s.isPicked = IF(IFNULL(se.isOnReservationMode, o.isOnReservationMode), s.isPicked, TRUE)
|
||||
WHERE s.id = NEW.saleFk;
|
||||
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
|
||||
WHERE id = NEW.saleFk;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10023,8 +9988,6 @@ DELIMITER ;;
|
|||
BEFORE INSERT ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
|
@ -10045,8 +10008,6 @@ DELIMITER ;;
|
|||
BEFORE UPDATE ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
|
@ -10717,15 +10678,6 @@ DELIMITER ;;
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NEW.travelFk IS NULL AND
|
||||
(SELECT COUNT(*) FROM travelThermograph
|
||||
WHERE thermographFk = NEW.thermographFk
|
||||
AND travelFk IS NULL
|
||||
AND id <> NEW.id) > 0
|
||||
THEN
|
||||
CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10746,15 +10698,6 @@ DELIMITER ;;
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NEW.travelFk IS NULL AND
|
||||
(SELECT COUNT(*) FROM travelThermograph
|
||||
WHERE thermographFk = NEW.thermographFk
|
||||
AND travelFk IS NULL
|
||||
AND id <> NEW.id) > 0
|
||||
THEN
|
||||
CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -11526,4 +11469,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-11-12 7:06:44
|
||||
-- Dump completed on 2024-10-03 7:43:14
|
||||
|
|
|
@ -388,23 +388,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
|||
(4, 'GCN Channel'),
|
||||
(5, 'The Newspaper');
|
||||
|
||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`viesCode`,`businessTypeFk`,`typeFk`)
|
||||
VALUES
|
||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
|
||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
|
||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, 'florist','normal'),
|
||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, 'florist','normal'),
|
||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, 'florist','normal'),
|
||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, 'florist','normal'),
|
||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, NULL, 'florist','normal'),
|
||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, NULL, 'florist','normal'),
|
||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, NULL, 'florist','normal'),
|
||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, NULL, 'florist','normal'),
|
||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, NULL, 'florist','normal'),
|
||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 'ES', 'florist','normal'),
|
||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, NULL, 'others','loses'),
|
||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, NULL, 'others','loses');
|
||||
|
||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 0, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
||||
FROM `account`.`role` `r`
|
||||
WHERE `r`.`hasLogin` = 1;
|
||||
|
||||
|
@ -1254,9 +1254,9 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
|||
|
||||
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`)
|
||||
VALUES
|
||||
(2, 11, 1, 1, 1, 2,1106),
|
||||
(4, 12, 1, 1, 1, NULL,1106),
|
||||
(1, 13, 2, 12, 12, NULL,1106);
|
||||
(2, 'GVC', 1, 1, 1, 2,1106),
|
||||
(4, 'HEJ', 1, 1, 1, NULL,1106),
|
||||
(1, 'UXN', 2, 12, 12, NULL,1106);
|
||||
|
||||
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
|
||||
VALUES
|
||||
|
@ -1505,32 +1505,32 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
|||
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||
|
||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `isRaid`, `daysInForward`)
|
||||
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1, FALSE, NULL),
|
||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2, FALSE, NULL),
|
||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, FALSE, NULL),
|
||||
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, FALSE, NULL),
|
||||
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, FALSE, NULL),
|
||||
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, FALSE,NULL),
|
||||
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, TRUE, 2),
|
||||
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, FALSE, NULL),
|
||||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2),
|
||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL),
|
||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
|
||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
||||
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
|
||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2),
|
||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
|
||||
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
|
||||
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
|
||||
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
|
||||
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
|
||||
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
|
||||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10),
|
||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4),
|
||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4);
|
||||
|
||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
|
||||
VALUES
|
||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'),
|
||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'),
|
||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'),
|
||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'),
|
||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'),
|
||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'),
|
||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'),
|
||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'),
|
||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'),
|
||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'),
|
||||
(99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
|
||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
||||
VALUES
|
||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''),
|
||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'),
|
||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'),
|
||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'),
|
||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
|
||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
|
||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
|
||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
|
||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
|
||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, 1, ''),
|
||||
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, 0, '');
|
||||
|
||||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
||||
VALUES (2, 4, 1);
|
||||
|
@ -2454,7 +2454,7 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
|
|||
INSERT INTO `vn`.`dmsType`
|
||||
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||
VALUES
|
||||
(1, 'Facturas Recibidas', 1, 1, 'invoiceIn'),
|
||||
(1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
|
||||
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
||||
(3, 'Laboral', 37, 37, 'hhrrData'),
|
||||
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
||||
|
@ -2476,8 +2476,7 @@ INSERT INTO `vn`.`dmsType`
|
|||
(20, 'Reclamación', 1, 1, 'claim'),
|
||||
(21, 'Entrada', 1, 1, 'entry'),
|
||||
(22, 'Proveedor', 1, 1, 'supplier'),
|
||||
(23, 'Termografos', 35, 35, 'thermograph'),
|
||||
(24, 'Sello de calidad', 1, 1, 'qualitySeal');
|
||||
(23, 'Termografos', 35, 35, 'thermograph');
|
||||
|
||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||
VALUES
|
||||
|
@ -2521,6 +2520,10 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`)
|
|||
(2, 'Normal', 'normal'),
|
||||
(3, 'Baja', 'low');
|
||||
|
||||
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`)
|
||||
VALUES
|
||||
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
||||
|
||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||
|
||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||
|
@ -2839,6 +2842,12 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
|||
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
|
||||
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||
|
||||
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
|
||||
VALUES
|
||||
(1106, 1, util.VN_CURDATE(), util.VN_CURDATE()),
|
||||
(1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)),
|
||||
(1106, 2, util.VN_CURDATE(), NULL),
|
||||
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
|
||||
|
||||
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
||||
VALUES
|
||||
|
@ -2951,9 +2960,9 @@ INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
|||
VALUES
|
||||
(1, 9);
|
||||
|
||||
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`, `clientSelfConsumptionFk`, `addressSelfConsumptionFk`)
|
||||
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`)
|
||||
VALUES
|
||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600, 1112, 12);
|
||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
|
||||
|
||||
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||
VALUES
|
||||
|
@ -3421,7 +3430,7 @@ INSERT INTO vn.buy
|
|||
INSERT INTO vn.itemShelving
|
||||
SET id = 9931,
|
||||
itemFk = 999993,
|
||||
shelvingFk = 16,
|
||||
shelvingFk = 'NCC',
|
||||
visible = 10,
|
||||
`grouping` = 5,
|
||||
packing = 10;
|
||||
|
@ -3748,7 +3757,7 @@ INSERT vn.sale
|
|||
|
||||
USE vn;
|
||||
DELETE ish.* FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector s ON s.id = p.sectorFk
|
||||
JOIN vn.warehouse w ON w.id = s.warehouseFk
|
||||
|
@ -3757,22 +3766,22 @@ DELETE ish.* FROM vn.itemShelving ish
|
|||
INSERT INTO vn.itemShelving
|
||||
(itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked)
|
||||
VALUES
|
||||
(999991, 14, 8, '2023-09-20', 1, 20, NULL, 103, NULL),
|
||||
(999998, 14, 80, '2023-09-20', 10, 30, NULL, 103, NULL),
|
||||
(1000001, 14, 6, '2023-09-20', 3, 50, NULL, 103, NULL),
|
||||
(1000000, 15, 50, '2023-09-18', 25, 500, NULL, 103, NULL),
|
||||
(999993, 15, 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
|
||||
(999999, 15, 30, '2023-09-18', 10, 500, NULL, 103, NULL),
|
||||
(999993, 16, 25, '2023-09-20', 5, 10, NULL, 103, NULL),
|
||||
(999997, 16, 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
|
||||
(999999, 16, 40, '2023-09-20', 10, 500, NULL, 103, NULL),
|
||||
(999995, 17, 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
|
||||
(999994, 17, 48, '2023-09-19', 4, 20, NULL, 103, NULL),
|
||||
(1000001, 18, 6, '2023-09-21', 3, 50, NULL, 103, NULL),
|
||||
(999992, 18, 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
|
||||
(1000000, 18, 25, '2023-09-21', 25, 500, NULL, 103, NULL),
|
||||
(999996, 19, 5, '2023-09-27', 1, 5, NULL, 103, NULL),
|
||||
(999997, 21, 10, '2023-09-27', 5, 100, NULL, 103, NULL);
|
||||
(999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL),
|
||||
(999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL),
|
||||
(1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL),
|
||||
(1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL),
|
||||
(999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL),
|
||||
(999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL),
|
||||
(999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL),
|
||||
(999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL),
|
||||
(999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL),
|
||||
(999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL),
|
||||
(999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL),
|
||||
(1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL),
|
||||
(999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL),
|
||||
(1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL),
|
||||
(999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL),
|
||||
(999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL);
|
||||
|
||||
-- Previous for Bolas de madera
|
||||
INSERT IGNORE INTO vn.sectorCollection
|
||||
|
@ -3822,6 +3831,8 @@ UPDATE vn.collection
|
|||
UPDATE vn.sale
|
||||
SET isPicked =FALSE;
|
||||
|
||||
INSERT INTO vn.machineWorkerConfig(id, maxHours)
|
||||
VALUES(1, 12);
|
||||
|
||||
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
||||
|
||||
|
@ -3829,6 +3840,9 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
|||
VALUES
|
||||
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||
|
||||
|
||||
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
|
||||
|
||||
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
||||
|
||||
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
||||
|
@ -3937,9 +3951,9 @@ INSERT INTO vn.medicalReview
|
|||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
||||
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
||||
|
||||
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
||||
VALUES(35, 1.00, 1.00, '2001-01-01');
|
||||
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
||||
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
||||
VALUES(35, 1.00, 1.00, '2001-01-01');
|
||||
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
||||
VALUES (1,0.6,6);
|
||||
|
||||
INSERT INTO vn.payrollComponent
|
||||
|
@ -4004,32 +4018,4 @@ INSERT IGNORE INTO pbx.queueMember
|
|||
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
|
||||
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
|
||||
|
||||
INSERT INTO vn.workerRelatives (workerFk, isDescendant, disabilityGradeFk, birthed, adoptionYear, isDependend, isJointCustody, updated)
|
||||
VALUES
|
||||
(1106, 1, NULL, 0, NULL, 0, 0, '2024-10-29 08:42:44.000');
|
||||
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
|
||||
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
|
||||
|
||||
|
||||
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
|
||||
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(2, 0, 0, 450, 13000, 1, 0, 1, '01A', 1, 1, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(3, 1400, 0, 450, 13000, 1, 0, 1, '01B', 1, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(4, 0, 500, 500, 13000, 1, 4, 1, '02A', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
|
||||
(5, 1400, 500, 500, 13000, 1, 4, 1, '02B', 2, 1, NULL, NULL, NULL, NULL, 1, 4, 13, NULL),
|
||||
(6, 0, 1000, 500, 13000, 1, 1, 1, '03A', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(7, 1400, 1000, 500, 13000, 1, 1, 1, '03B', 3, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(8, 0, 1500, 500, 13000, 1, 0, 1, '04A', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(9, 1400, 1500, 500, 13000, 1, 1, 1, '04B', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||
(10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL);
|
||||
|
||||
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
||||
VALUES (19, '1169'),
|
||||
(8, '1183');
|
||||
|
||||
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||
VALUES ('saysimle-url-mock', 1320);
|
||||
|
||||
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
||||
VALUES (1106,'26493101E','2019-09-20');
|
||||
|
|
|
@ -7,7 +7,8 @@ AS SELECT `u`.`id` AS `id`,
|
|||
`u`.`email` AS `email`,
|
||||
`u`.`nickname` AS `nickname`,
|
||||
`u`.`lang` AS `lang`,
|
||||
`u`.`role` AS `role`
|
||||
`u`.`role` AS `role`,
|
||||
`u`.`recoverPass` AS `recoverPass`
|
||||
FROM `account`.`user` `u`
|
||||
WHERE `u`.`name` = `myUser_getName`()
|
||||
WITH CASCADED CHECK OPTION
|
||||
|
|
|
@ -32,7 +32,7 @@ BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
||||
SELECT itemFk, SUM(visible) totalVisible
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||
WHERE sc.warehouseFk = vWarehouseFk
|
||||
|
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
|||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||
AND t.warehouseInFk = vWarehouse
|
||||
AND s.name != 'INVENTARIO'
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
GROUP BY b.itemFk
|
||||
) c
|
||||
JOIN vn.item i ON i.id = c.itemFk
|
||||
|
|
|
@ -6,16 +6,16 @@ BEGIN
|
|||
|
||||
UPDATE vn.buy b
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
||||
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
||||
b.stickers = NEW.NumberOfUnits
|
||||
WHERE i.supplyResponseFk = NEW.ID
|
||||
AND am.name = 'LOGIFLORA'
|
||||
AND tr.isRaid
|
||||
AND e.isRaid
|
||||
AND tr.landed >= util.VN_CURDATE();
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
|||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
WHERE t.landed BETWEEN vDateInv AND vDate
|
||||
AND t.warehouseInFk = vWarehouse
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT b.itemFk, -b.quantity
|
||||
FROM vn.buy b
|
||||
|
@ -67,7 +67,7 @@ BEGIN
|
|||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
||||
AND t.warehouseOutFk = vWarehouse
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
AND t.isDelivered
|
||||
UNION ALL
|
||||
SELECT m.itemFk, -m.quantity
|
||||
|
|
|
@ -9,54 +9,45 @@ BEGIN
|
|||
* @param vOrder El identificador del pedido
|
||||
* @return tmp.orderTax Bases imponibles, IVA y recargo de equivalencia
|
||||
*/
|
||||
-- No poner create or replace, ya que da problemas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany;
|
||||
CREATE TEMPORARY TABLE tmp.addressCompany
|
||||
(INDEX (addressFk, companyFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT DISTINCT o.address_id addressFk, o.company_id companyFk
|
||||
FROM tmp.`order` tmpOrder
|
||||
JOIN `order` o ON o.id = tmpOrder.orderFk;
|
||||
JOIN hedera.`order` o ON o.id = tmpOrder.orderFk;
|
||||
|
||||
CALL vn.addressTaxArea();
|
||||
CALL vn.addressTaxArea;
|
||||
|
||||
-- Calcula el IVA y el recargo desglosado.
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.orderTax
|
||||
(PRIMARY KEY (orderFk, code, rate))
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.orderTax;
|
||||
CREATE TEMPORARY TABLE tmp.orderTax
|
||||
(INDEX (orderFk))
|
||||
ENGINE = MEMORY
|
||||
WITH orders AS (
|
||||
SELECT tor.orderFk,
|
||||
oro.amount * oro.price total,
|
||||
s.countryFk,
|
||||
ata.areaFk,
|
||||
itc.taxClassFk
|
||||
FROM hedera.orderRow oro
|
||||
JOIN tmp.order tor ON tor.orderFk = oro.orderFk
|
||||
JOIN hedera.`order` o ON o.id = tor.orderFk
|
||||
JOIN vn.item i ON i.id = oro.itemFk
|
||||
JOIN vn.`client` c ON c.id = o.customer_id
|
||||
JOIN vn.supplier s ON s.id = o.company_id
|
||||
JOIN tmp.addressTaxArea ata ON ata.addressFk = o.address_id
|
||||
AND ata.companyFk = o.company_id
|
||||
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s.countryFk
|
||||
HAVING total
|
||||
)
|
||||
SELECT o.orderFk,
|
||||
SELECT o.id orderFk,
|
||||
tc.code,
|
||||
SUM(o.total) taxableBase,
|
||||
SUM(m.amount * m.price) taxableBase,
|
||||
pgc.rate
|
||||
FROM orders o
|
||||
JOIN vn.bookingPlanner bp ON bp.countryFk = o.countryFk
|
||||
AND bp.taxAreaFk = o.areaFk
|
||||
AND bp.taxClassFk = o.taxClassFk
|
||||
JOIN vn.pgc ON pgc.code = bp.pgcFk
|
||||
FROM tmp.`order` tmpOrder
|
||||
JOIN `order` o ON o.id = tmpOrder.orderFk
|
||||
JOIN orderRow m ON m.orderFk = o.id
|
||||
JOIN vn.item i ON i.id = m.itemFk
|
||||
JOIN vn.`client` c ON c.id = o.customer_id
|
||||
JOIN vn.supplier s ON s.id = o.company_id
|
||||
JOIN tmp.addressTaxArea ata
|
||||
ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id
|
||||
JOIN vn.itemTaxCountry itc
|
||||
ON itc.itemFk = i.id AND itc.countryFk = s.countryFk
|
||||
JOIN vn.bookingPlanner bp
|
||||
ON bp.countryFk = s.countryFk
|
||||
AND bp.taxAreaFk = ata.areaFk
|
||||
AND bp.taxClassFk = itc.taxClassFk
|
||||
JOIN vn.pgc ON pgc.`code` = bp.pgcFk
|
||||
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
|
||||
GROUP BY o.orderFk, pgc.code, pgc.rate
|
||||
HAVING taxableBase
|
||||
ORDER BY bp.priority;
|
||||
GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate
|
||||
HAVING taxableBase != 0;
|
||||
|
||||
-- No poner create or replace, ya que da problemas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount;
|
||||
CREATE TEMPORARY TABLE tmp.orderAmount
|
||||
(INDEX (orderFk))
|
||||
|
|
|
@ -57,8 +57,8 @@ BEGIN
|
|||
c.socialName,
|
||||
IFNULL(c.street, ''),
|
||||
c.accountingAccount,
|
||||
@fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
||||
IF(c.isVies, CONCAT(IFNULL(cu.viesCode,cu.code), @fi ), TRIM(c.fi)),
|
||||
@fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.viesCode IS NOT NULL, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
||||
IF(c.viesCode IS NOT NULL, CONCAT(cu.code, @fi ), TRIM(c.fi)),
|
||||
IFNULL(c.postcode, ''),
|
||||
IFNULL(c.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
|
@ -68,7 +68,7 @@ BEGIN
|
|||
IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'),
|
||||
IF(cu.code = 'ES',
|
||||
1,
|
||||
IF((cu.isUeeMember AND c.isVies), 2, 4)),
|
||||
IF((cu.isUeeMember AND c.viesCode IS NOT NULL), 2, 4)),
|
||||
IFNULL(c.taxTypeSageFk,0),
|
||||
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
||||
IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)),
|
||||
|
@ -95,7 +95,7 @@ BEGIN
|
|||
IFNULL(s.street, ''),
|
||||
s.account,
|
||||
@nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)),
|
||||
IF(s.isVies, CONCAT(IFNULL(co.viesCode,co.code), @nif), TRIM(s.nif)),
|
||||
TRIM(CONCAT(IFNULL(s.viesCode,''), @nif)),
|
||||
IFNULL(s.postCode,''),
|
||||
IFNULL(s.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT it.taxableBase,
|
||||
CAST(SUM((( it.taxableBase / 100) * t.PorcentajeIva)) AS DECIMAL (10,2)),
|
||||
CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)),
|
||||
t.PorcentajeIva,
|
||||
it.transactionTypeSageFk,
|
||||
it.taxTypeSageFk,
|
||||
|
@ -39,8 +39,7 @@ BEGIN
|
|||
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
|
||||
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
|
||||
WHERE i.id = vInvoiceInFk
|
||||
AND d.id IS NULL
|
||||
GROUP BY it.taxTypeSageFk;
|
||||
AND d.id IS NULL;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
|
|
|
@ -4,8 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
IF NEW.`property` = '*' THEN
|
||||
CALL util.throw('The property field cannot be *');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -6,11 +6,12 @@ BEGIN
|
|||
DROP TEMPORARY TABLE IF EXISTS tValues;
|
||||
CREATE TEMPORARY TABLE tValues
|
||||
ENGINE = MEMORY
|
||||
SELECT b.id buyFk,
|
||||
SELECT
|
||||
b.id buyFk,
|
||||
e.id entryFk,
|
||||
t.id travelFk,
|
||||
b.itemFk,
|
||||
t.isRaid,
|
||||
e.isRaid,
|
||||
ADDTIME(t.shipped,
|
||||
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
||||
t.warehouseOutFk,
|
||||
|
@ -49,7 +50,7 @@ BEGIN
|
|||
itemFk,
|
||||
TIMESTAMPADD(DAY, life, @dated),
|
||||
quantity,
|
||||
IF(isIn, isReceived, isDelivered) AND NOT isRaid
|
||||
IF(isIn, isReceived, isDelivered) AND !isRaid
|
||||
FROM tValues
|
||||
WHERE isIn OR !lessThanInventory;
|
||||
|
||||
|
@ -64,7 +65,7 @@ BEGIN
|
|||
itemFk,
|
||||
created,
|
||||
quantity,
|
||||
IF(isIn, isDelivered, isReceived) AND NOT isRaid
|
||||
IF(isIn, isDelivered, isReceived) AND !isRaid
|
||||
FROM tValues
|
||||
WHERE !isIn OR !lessThanInventory;
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`itemCampaig_add`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2024-10-18 03:00:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO CALL itemCampaign_add()$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`raidUpdate`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2017-12-29 00:05:00.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO CALL raidUpdate$$
|
||||
DELIMITER ;
|
|
@ -14,12 +14,9 @@ BEGIN
|
|||
SELECT p.geoFk INTO vGeoFk
|
||||
FROM address a
|
||||
JOIN town t ON t.provinceFk = a.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
AND (p.code = a.postalCode OR a.postalCode IS NULL)
|
||||
JOIN zoneGeo zg ON zg.id = p.geoFk
|
||||
JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode
|
||||
WHERE a.id = vSelf
|
||||
ORDER BY (a.city SOUNDS LIKE t.name) DESC,
|
||||
(p.code = a.postalCode) DESC
|
||||
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk INT,
|
||||
vDated DATE
|
||||
)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula las últimas compras realizadas hasta una fecha.
|
||||
*
|
||||
* @param vItemFk Id del artículo
|
||||
* @param vWarehouseFk Id del almacén
|
||||
* @param vDated Compras hasta fecha
|
||||
* @return Id de compra
|
||||
*/
|
||||
DECLARE vBuyFk INT;
|
||||
|
||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
|
||||
|
||||
SELECT buyFk INTO vBuyFk
|
||||
FROM tmp.buyUltimate;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
tmp.buyUltimate,
|
||||
tmp.buyUltimateFromInterval;
|
||||
|
||||
RETURN vBuyFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,27 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getGeo`(vSelf INT)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Returns the geo for the passed client.
|
||||
*
|
||||
* @param vSelf The address id
|
||||
* @return The geo id
|
||||
*/
|
||||
DECLARE vGeoFk INT;
|
||||
|
||||
SELECT p.geoFk INTO vGeoFk
|
||||
FROM client c
|
||||
JOIN town t ON t.provinceFk = c.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
AND (p.code = c.postcode OR c.postcode IS NULL)
|
||||
JOIN zoneGeo zg ON zg.id = p.geoFk
|
||||
WHERE c.id = vSelf
|
||||
ORDER BY (c.city SOUNDS LIKE t.name) DESC,
|
||||
(p.code = c.postcode) DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,51 +1,58 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(vTravelFk INT,
|
||||
vCurrencyFk INT,
|
||||
vSupplierFk INT
|
||||
vCurrencyFk INT,
|
||||
vSupplierFk INT
|
||||
)
|
||||
RETURNS int(11)
|
||||
NOT DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
DECLARE vCommission INT;
|
||||
DECLARE vCurrentCommission INT;
|
||||
DECLARE vIsNotEUR INT;
|
||||
DECLARE vLastEntryFk INT;
|
||||
DECLARE vCommission INT;
|
||||
DECLARE vCurrentCommission INT;
|
||||
DECLARE vIsCurrencyUsd INT;
|
||||
DECLARE vLastEntryFk INT;
|
||||
|
||||
SELECT count(*) INTO vIsCurrencyUsd
|
||||
FROM currency c
|
||||
WHERE c.code = 'USD' AND id = vCurrencyFk;
|
||||
|
||||
IF NOT vIsCurrencyUsd THEN
|
||||
|
||||
SELECT e.id INTO vLastEntryFk
|
||||
FROM vn.entry e
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
WHERE e.supplierFk = vSupplierFk
|
||||
ORDER BY tr.landed DESC
|
||||
LIMIT 1;
|
||||
|
||||
IF vLastEntryFk THEN
|
||||
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM vn.entry
|
||||
WHERE id = vLastEntryFk;
|
||||
|
||||
ELSE
|
||||
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM supplier s
|
||||
WHERE s.id = vSupplierFk;
|
||||
|
||||
END IF;
|
||||
|
||||
RETURN vCurrentCommission;
|
||||
|
||||
ELSE
|
||||
|
||||
SELECT count(*) INTO vIsNotEUR
|
||||
FROM currency c
|
||||
WHERE c.code <> 'EUR' AND id = vCurrencyFk;
|
||||
|
||||
IF vIsNotEUR THEN
|
||||
SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission
|
||||
FROM travel t
|
||||
LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped
|
||||
WHERE t.id = vTravelFk
|
||||
ORDER BY r.`dated` DESC
|
||||
LIMIT 1;
|
||||
|
||||
|
||||
RETURN IFNULL(vCommission, 0);
|
||||
ELSE
|
||||
SELECT e.id INTO vLastEntryFk
|
||||
FROM `entry` e
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
WHERE e.supplierFk = vSupplierFk
|
||||
ORDER BY tr.landed DESC
|
||||
LIMIT 1;
|
||||
|
||||
IF vLastEntryFk THEN
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM `entry`
|
||||
WHERE id = vLastEntryFk;
|
||||
|
||||
ELSE
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM supplier s
|
||||
WHERE s.id = vSupplierFk;
|
||||
|
||||
END IF;
|
||||
|
||||
RETURN vCurrentCommission;
|
||||
END IF;
|
||||
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -9,7 +9,7 @@ BEGIN
|
|||
SELECT count(*) INTO vItemCount
|
||||
FROM vn.sale s
|
||||
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
WHERE s.ticketFk = vTicketFk
|
||||
AND p.sectorFk = vSectorFk;
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
|||
SELECT count(*) INTO vItemCount
|
||||
FROM vn.sale s
|
||||
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
WHERE s.ticketFk = vTicketFk
|
||||
AND p.sectorFk = vSectorFk;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`supplier_getGeo`(vSelf INT)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Returns the geo for the passed supplier.
|
||||
*
|
||||
* @param vSelf The address id
|
||||
* @return The geo id
|
||||
*/
|
||||
DECLARE vGeoFk INT;
|
||||
|
||||
SELECT p.geoFk INTO vGeoFk
|
||||
FROM supplier s
|
||||
JOIN town t ON t.provinceFk = s.provinceFk
|
||||
JOIN postCode p ON p.townFk = t.id
|
||||
AND (p.code = s.postCode OR s.postCode IS NULL)
|
||||
LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
|
||||
JOIN zoneGeo zg ON zg.id = p.geoFk
|
||||
WHERE s.id = vSelf
|
||||
ORDER BY (s.city SOUNDS LIKE t.name) DESC,
|
||||
(p.code = s.postCode) DESC,
|
||||
(p.code = sad.postalCode) DESC
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vGeoFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,65 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
|
||||
RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
|
||||
NOT DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Verifica la dirección de la fichada
|
||||
* @param vUserFk Identificador del trabajador
|
||||
* @param vTimed Hora de la fichada
|
||||
* @return Retorna sentido de la fichada 'in, out, middle'
|
||||
*/
|
||||
|
||||
DECLARE vPrevious DATETIME ;
|
||||
DECLARE vNext DATETIME ;
|
||||
DECLARE vPreviousDirection VARCHAR(3) ;
|
||||
DECLARE vNextDirection VARCHAR(3) ;
|
||||
DECLARE vDayStayMax INT;
|
||||
DECLARE vTimedSeconds INT;
|
||||
DECLARE vLastTimeIn INT;
|
||||
|
||||
SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds;
|
||||
|
||||
SELECT dayStayMax INTO vDayStayMax
|
||||
FROM vn.workerTimeControlParams;
|
||||
|
||||
SELECT timed, direction INTO vNext,vNextDirection
|
||||
FROM vn.workerTimeControl
|
||||
WHERE userFk = vUserFk
|
||||
AND direction IN ('in','out')
|
||||
AND timed > vTimed
|
||||
ORDER BY timed ASC
|
||||
LIMIT 1;
|
||||
|
||||
SELECT timed, direction INTO vPrevious, vPreviousDirection
|
||||
FROM vn.workerTimeControl
|
||||
WHERE userFk = vUserFk
|
||||
AND direction IN ('in','out')
|
||||
AND timed < vTimed
|
||||
ORDER BY timed DESC
|
||||
LIMIT 1;
|
||||
|
||||
IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN
|
||||
RETURN 'middle';
|
||||
END IF;
|
||||
|
||||
|
||||
IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN
|
||||
IF vPreviousDirection = 'in' THEN
|
||||
RETURN 'out';
|
||||
ELSE
|
||||
SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn
|
||||
FROM vn.workerTimeControl
|
||||
WHERE userFk = vUserFk
|
||||
AND direction ='in'
|
||||
AND timed < vPrevious;
|
||||
IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN
|
||||
RETURN 'out';
|
||||
END IF;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
RETURN 'in';
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,23 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`workerMachinery_isRegistered`(vWorkerFk VARCHAR(10))
|
||||
RETURNS tinyint(1)
|
||||
NOT DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo)
|
||||
*
|
||||
* @param vWorkerFk id del trabajador
|
||||
* @return Devuelve TRUE/FALSE en caso de que haya o no registros
|
||||
*/
|
||||
IF (SELECT COUNT(*)
|
||||
FROM machineWorker m
|
||||
WHERE m.workerFk = vWorkerFk
|
||||
AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed))
|
||||
THEN
|
||||
RETURN TRUE;
|
||||
ELSE
|
||||
RETURN FALSE;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -39,7 +39,7 @@ BEGIN
|
|||
AND vWarehouseFk IN (tr.warehouseInFk, 0)
|
||||
AND b.itemFk = vItemFk
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT tr.shipped,
|
||||
NULL,
|
||||
|
@ -58,7 +58,7 @@ BEGIN
|
|||
AND s.id <> (SELECT supplierFk FROM inventoryConfig)
|
||||
AND b.itemFk = vItemFk
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT t.shipped,
|
||||
NULL,
|
||||
|
@ -81,7 +81,7 @@ BEGIN
|
|||
FROM tHistoricalPast
|
||||
WHERE `date` < vDate;
|
||||
|
||||
SELECT p1.*, NULL v_virtual
|
||||
SELECT p1.*, NULL v_virtual
|
||||
FROM (
|
||||
SELECT vDate `date`,
|
||||
vCalculatedInventory input,
|
||||
|
@ -96,7 +96,7 @@ BEGIN
|
|||
FROM tHistoricalPast
|
||||
WHERE `date` >= vDate
|
||||
) p1;
|
||||
|
||||
|
||||
DROP TEMPORARY TABLE tHistoricalPast;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
|
@ -17,7 +17,7 @@ BEGIN
|
|||
WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember)
|
||||
AND NOT (auSupplier.id <=> auClient.id) THEN
|
||||
'WORLD'
|
||||
WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN
|
||||
WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.viesCode IS NOT NULL THEN
|
||||
'CEE'
|
||||
WHEN a.isEqualizated AND cClient.code = 'ES' THEN
|
||||
'EQU'
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`available_traslate`(
|
|||
vWarehouseShipment INT)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Calcular la disponibilidad dependiendo del almacen
|
||||
* Calcular la disponibilidad dependiendo del almacen
|
||||
* de origen y destino según la fecha.
|
||||
*
|
||||
* @param vWarehouseLanding Almacén de llegada
|
||||
|
@ -42,10 +42,10 @@ proc: BEGIN
|
|||
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
||||
AND t.warehouseInFk = vWarehouseLanding
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
GROUP BY c.itemFk;
|
||||
|
||||
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||
-- que hace un replace de la anterior.
|
||||
CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE());
|
||||
|
||||
|
@ -57,7 +57,7 @@ proc: BEGIN
|
|||
JOIN travel tr ON tr.id = e.travelFk
|
||||
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
||||
WHERE t.warehouseFk = vWarehouseShipment
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
||||
tr.landed);
|
||||
|
||||
|
@ -94,7 +94,7 @@ proc: BEGIN
|
|||
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
||||
WHERE NOT e.isExcludedFromAvailable
|
||||
AND b.quantity <> 0
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
AND t.warehouseInFk = vWarehouseLanding
|
||||
AND t.landed >= vDatedFrom
|
||||
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||
|
@ -135,4 +135,4 @@ proc: BEGIN
|
|||
|
||||
DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||
vItemFk INT,
|
||||
vWarehouseFk INT,
|
||||
vWarehouseFk SMALLINT,
|
||||
vDated DATE
|
||||
)
|
||||
BEGIN
|
||||
|
|
|
@ -56,7 +56,7 @@ BEGIN
|
|||
AND ts.id IS NULL;
|
||||
DELETE FROM claim WHERE ticketCreated < v4Years;
|
||||
-- Robert ubicacion anterior de travelLog comentario para debug
|
||||
DELETE FROM zoneEvent WHERE dated < v2Months OR ended < v2Months;
|
||||
DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Months;
|
||||
DELETE b FROM buy b
|
||||
JOIN entryConfig e ON e.defaultEntry = b.entryFk
|
||||
WHERE b.created < v2Months;
|
||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
|||
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
||||
WHERE NOT b.quantity
|
||||
AND am.code = 'logiflora'
|
||||
AND tr.daysInForward;
|
||||
AND e.isRaid;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ BEGIN
|
|||
AND s.semaphore = 1
|
||||
GROUP BY st.saleFk) st ON st.saleFk = ts.saleFk
|
||||
JOIN itemShelving ish ON ish.itemFk = ts.itemFk
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector sc ON sc.id = p.sectorFk
|
||||
JOIN sectorType st ON st.id = sc.typeFk
|
||||
|
|
|
@ -37,23 +37,23 @@ BEGIN
|
|||
WHERE t.id = vTicketFk;
|
||||
|
||||
CALL cache.available_refresh(
|
||||
vCacheAvailableFk,
|
||||
vCacheAvailableFk,
|
||||
FALSE,
|
||||
vWarehouseFk,
|
||||
vWarehouseFk,
|
||||
util.VN_CURDATE());
|
||||
|
||||
SELECT available INTO vAvailable
|
||||
FROM cache.available
|
||||
WHERE calc_id = vCacheAvailableFk
|
||||
WHERE calc_id = vCacheAvailableFk
|
||||
AND item_id = vItemFk;
|
||||
|
||||
|
||||
IF vAvailable < vQuantity THEN
|
||||
SET vHasThrow = TRUE;
|
||||
ELSE
|
||||
SELECT `name`,
|
||||
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
|
||||
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
|
||||
INTO vItemName, vConcept
|
||||
FROM item
|
||||
FROM item
|
||||
WHERE id = vItemFk;
|
||||
|
||||
START TRANSACTION;
|
||||
|
@ -69,7 +69,7 @@ BEGIN
|
|||
|
||||
CALL sale_calculateComponent(vSaleFk, NULL);
|
||||
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
||||
|
||||
|
||||
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
|
||||
SET vHasThrow = TRUE;
|
||||
END IF;
|
||||
|
@ -78,13 +78,13 @@ BEGIN
|
|||
IF vHasThrow THEN
|
||||
CALL util.throw("There is no available for the selected item");
|
||||
END IF;
|
||||
|
||||
|
||||
IF vSaleGroupFk THEN
|
||||
INSERT INTO saleGroupDetail
|
||||
SET saleFk = vSaleFk,
|
||||
saleGroupFk = vSaleGroupFk;
|
||||
END IF;
|
||||
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -30,9 +30,7 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
w.id salesPersonFk,
|
||||
IFNULL(ob.description,'') observaciones,
|
||||
cc.rgb,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
cc.rgb
|
||||
FROM vn.ticket t
|
||||
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
|
||||
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
|
||||
|
@ -44,10 +42,7 @@ BEGIN
|
|||
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
WHERE t.id = vParamFk
|
||||
AND t.shipped >= vYesterday
|
||||
UNION
|
||||
|
@ -57,9 +52,7 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
w.id salesPersonFk,
|
||||
ob.description,
|
||||
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`
|
||||
FROM vn.ticket t
|
||||
JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
|
||||
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
|
||||
|
@ -71,10 +64,7 @@ BEGIN
|
|||
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
WHERE tc.collectionFk = vParamFk
|
||||
UNION
|
||||
SELECT sg.ticketFk,
|
||||
|
@ -83,9 +73,7 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
c.salesPersonFk,
|
||||
ob.description,
|
||||
NULL `rgb`,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
NULL `rgb`
|
||||
FROM vn.sectorCollection sc
|
||||
JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
||||
JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk
|
||||
|
@ -93,10 +81,7 @@ BEGIN
|
|||
LEFT JOIN vn.zone z ON z.id = t.zoneFk
|
||||
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||
WHERE sc.id = vParamFk
|
||||
AND t.shipped >= vYesterday
|
||||
GROUP BY ticketFk;
|
||||
|
|
|
@ -146,6 +146,8 @@ BEGIN
|
|||
DELETE pb
|
||||
FROM tmp.productionBuffer pb
|
||||
JOIN state s ON s.id = pb.state
|
||||
JOIN agencyMode am ON am.id = pb.agencyModeFk
|
||||
JOIN agency a ON a.id = am.agencyFk
|
||||
LEFT JOIN (
|
||||
SELECT pb.ticketFk, MAX(i.`size`) maxSize
|
||||
FROM tmp.productionBuffer pb
|
||||
|
@ -156,7 +158,7 @@ BEGIN
|
|||
) sub ON sub.ticketFk = pb.ticketFk
|
||||
JOIN productionConfig pc
|
||||
WHERE pb.shipped <> util.VN_CURDATE()
|
||||
OR pb.ubicacion IS NULL
|
||||
OR (pb.ubicacion IS NULL AND a.isOwn)
|
||||
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
||||
OR pb.collectionH IS NOT NULL
|
||||
OR pb.collectionV IS NOT NULL
|
||||
|
|
|
@ -17,6 +17,7 @@ BEGIN
|
|||
supplierFk,
|
||||
dated,
|
||||
isExcludedFromAvailable,
|
||||
isRaid,
|
||||
commission,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
|
@ -27,6 +28,7 @@ BEGIN
|
|||
supplierFk,
|
||||
dated,
|
||||
isExcludedFromAvailable,
|
||||
isRaid,
|
||||
commission,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
|
|||
BEGIN
|
||||
/**
|
||||
* Retorna los artículos trasladables a partir de una entrada.
|
||||
*
|
||||
*
|
||||
* @param vSelf Id de entrada
|
||||
*/
|
||||
DECLARE vDateShipped DATE;
|
||||
|
@ -166,7 +166,7 @@ BEGIN
|
|||
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
|
||||
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
|
||||
WHERE ic.display
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
AND (ti.visible OR ti.available)
|
||||
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
||||
|
||||
|
|
|
@ -9,18 +9,16 @@ BEGIN
|
|||
*
|
||||
* @param vSelf Id de entrada
|
||||
*/
|
||||
DECLARE vIsNotEditable BOOL DEFAULT FALSE;
|
||||
DECLARE vIsEditable BOOL;
|
||||
|
||||
SELECT TRUE INTO vIsNotEditable
|
||||
SELECT e.isBooked INTO vIsEditable
|
||||
FROM `entry` e
|
||||
LEFT JOIN entryType et ON et.code = e.typeFk
|
||||
WHERE e.id = vSelf
|
||||
AND e.isBooked
|
||||
AND (e.typeFk IS NULL OR NOT et.isInformal);
|
||||
JOIN entryType et ON et.code = e.typeFk
|
||||
WHERE NOT et.isInformal
|
||||
AND e.id = vSelf;
|
||||
|
||||
IF vIsNotEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`(
|
||||
vShelvingCode VARCHAR(10),
|
||||
vFromEntryFk INT,
|
||||
vToEntryFk INT
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Divide las compras entre dos entradas de
|
||||
* acuerdo con lo ubicado en una matricula.
|
||||
* Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr<EFBFBD>cula
|
||||
*
|
||||
* @param vShelvingCode Código de vn.shelving
|
||||
* @param vShelvingFk Identificador de vn.shelving
|
||||
* @param vFromEntryFk Entrada origen
|
||||
* @param vToEntryFk Entrada destino
|
||||
*/
|
||||
|
@ -19,7 +14,7 @@ BEGIN
|
|||
DECLARE vDone BOOLEAN DEFAULT FALSE;
|
||||
|
||||
DECLARE cur CURSOR FOR
|
||||
SELECT bb.id buyFk,
|
||||
SELECT bb.id buyFk,
|
||||
LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers,
|
||||
bb.stickers buyStickers
|
||||
FROM itemShelving ish
|
||||
|
@ -28,7 +23,7 @@ BEGIN
|
|||
WHERE b.entryFk = vFromEntryFk
|
||||
ORDER BY b.stickers DESC
|
||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
||||
WHERE ish.shelvingFk = vShelvingCode COLLATE utf8_general_ci
|
||||
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
||||
AND NOT ish.isSplit
|
||||
GROUP BY ish.id;
|
||||
|
||||
|
@ -112,10 +107,9 @@ BEGIN
|
|||
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
||||
END IF;
|
||||
|
||||
UPDATE itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
SET ish.isSplit = TRUE
|
||||
WHERE sh.code = vShelvingCode COLLATE utf8_general_ci;
|
||||
UPDATE itemShelving
|
||||
SET isSplit = TRUE
|
||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci;
|
||||
END LOOP;
|
||||
CLOSE cur;
|
||||
END$$
|
||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
|||
FROM vn.entry e
|
||||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed >= util.VN_CURDATE()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND e.currencyFk = vCurrency
|
||||
AND NOT e.isBooked;
|
||||
|
||||
|
@ -33,7 +33,7 @@ BEGIN
|
|||
SET e.commission = vComission;
|
||||
|
||||
SELECT `name` INTO vCurrencyName
|
||||
FROM currency
|
||||
FROM currency
|
||||
WHERE id = vCurrency;
|
||||
|
||||
CALL entry_recalc();
|
||||
|
|
|
@ -4,12 +4,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Put`(
|
|||
vExpeditionFk INT
|
||||
)
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT id FROM expeditionPallet WHERE id = vPalletFk) THEN
|
||||
CALL util.throw('Pallet not exists');
|
||||
IF NOT (SELECT TRUE FROM expedition WHERE id = vExpeditionFk LIMIT 1) THEN
|
||||
CALL util.throw('Expedition not exists');
|
||||
END IF;
|
||||
|
||||
IF NOT EXISTS (SELECT id FROM expedition WHERE id = vExpeditionFk) THEN
|
||||
CALL util.throw('Expedition not exists');
|
||||
IF NOT (SELECT TRUE FROM expeditionPallet WHERE id = vPalletFk LIMIT 1) THEN
|
||||
CALL util.throw('Pallet not exists');
|
||||
END IF;
|
||||
|
||||
REPLACE expeditionScan(expeditionFk, palletFk)
|
||||
|
|
|
@ -16,8 +16,7 @@ BEGIN
|
|||
a.nickname,
|
||||
sub2.itemPackingTypeConcat,
|
||||
est.code,
|
||||
es2.isScanned,
|
||||
es2.scanOrder
|
||||
es.isScanned
|
||||
FROM expedition e
|
||||
JOIN ticket t ON t.id = e.ticketFk
|
||||
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
||||
|
@ -39,7 +38,6 @@ BEGIN
|
|||
SELECT MAX(id)
|
||||
FROM expeditionState es
|
||||
WHERE expeditionFk = e.id)
|
||||
LEFT JOIN expeditionState es2 ON es2.id = es.id
|
||||
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||
ORDER BY r.created, t.priority DESC;
|
||||
END$$
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_selfConsumptionPackaging`(
|
||||
vSelf INT,
|
||||
vAction ENUM('add', 'remove')
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Maneja el consumo de cajas para autoconsumo, permitiendo
|
||||
* añadir o quitar cajas utilizadas según la acción indicada.
|
||||
*
|
||||
* @param vSelf Id de expedición
|
||||
*/
|
||||
DECLARE vClientFk INT;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vItemName VARCHAR(50);
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vCreated DATE;
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vQuantity INT;
|
||||
|
||||
IF vAction NOT IN ('add', 'remove') THEN
|
||||
CALL util.throw('Action not supported');
|
||||
END IF;
|
||||
|
||||
SELECT pc.clientSelfConsumptionFk,
|
||||
pc.addressSelfConsumptionFk,
|
||||
i.id,
|
||||
i.name,
|
||||
t.warehouseFk,
|
||||
e.created
|
||||
INTO vClientFk,
|
||||
vAddressFk,
|
||||
vItemFk,
|
||||
vItemName,
|
||||
vWarehouseFk,
|
||||
vCreated
|
||||
FROM expedition e
|
||||
JOIN packaging p ON p.id = e.packagingFk
|
||||
JOIN item i ON i.id = p.itemFk
|
||||
JOIN ticket t ON t.id = e.ticketFk
|
||||
JOIN productionConfig pc
|
||||
WHERE e.id = vSelf;
|
||||
|
||||
IF vClientFk IS NULL OR vAddressFk IS NULL THEN
|
||||
CALL util.throw('Some config parameters are not set');
|
||||
END IF;
|
||||
|
||||
SET vCreated = DATE(vCreated);
|
||||
|
||||
SELECT id INTO vTicketFk
|
||||
FROM ticket
|
||||
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
||||
AND clientFk = vClientFk
|
||||
AND addressFk = vAddressFk
|
||||
AND warehouseFk = vWarehouseFk;
|
||||
|
||||
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
||||
VALUES (vClientFk, vWarehouseFk, vCreated, 'CAJAS AUTOCONSUMO', vAddressFk);
|
||||
|
||||
SET vTicketFk = LAST_INSERT_ID();
|
||||
END IF;
|
||||
|
||||
SELECT id, quantity INTO vSaleFk, vQuantity
|
||||
FROM sale
|
||||
WHERE itemFk = vItemFk
|
||||
AND ticketFk = vTicketFk
|
||||
LIMIT 1;
|
||||
|
||||
IF vAction = 'add' THEN
|
||||
IF vSaleFk IS NOT NULL THEN
|
||||
UPDATE sale
|
||||
SET quantity = quantity + 1
|
||||
WHERE id = vSaleFk;
|
||||
ELSE
|
||||
INSERT INTO sale(itemFk, ticketFk, concept, quantity)
|
||||
VALUES (vItemFk, vTicketFk, vItemName, 1);
|
||||
END IF;
|
||||
ELSE
|
||||
IF vSaleFk IS NOT NULL THEN
|
||||
IF vQuantity > 1 THEN
|
||||
UPDATE sale
|
||||
SET quantity = quantity - 1
|
||||
WHERE id = vSaleFk;
|
||||
ELSE
|
||||
DELETE FROM sale WHERE id = vSaleFk;
|
||||
END IF;
|
||||
END IF;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -137,7 +137,7 @@ BEGIN
|
|||
JOIN travel tr ON tr.id = e.travelFk
|
||||
WHERE tr.warehouseInFk = vWarehouseFk
|
||||
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
|
||||
AND NOT tr.isRaid
|
||||
AND NOT isRaid
|
||||
GROUP BY b.itemFk;
|
||||
|
||||
-- Transfers
|
||||
|
@ -150,7 +150,7 @@ BEGIN
|
|||
JOIN travel tr ON tr.id = e.travelFk
|
||||
WHERE tr.warehouseOutFk = vWarehouseFk
|
||||
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
|
||||
AND NOT tr.isRaid
|
||||
AND NOT isRaid
|
||||
GROUP BY b.itemFk
|
||||
) sub
|
||||
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
|
||||
|
|
|
@ -50,7 +50,7 @@ BEGIN
|
|||
s.account supplierAccount,
|
||||
s.name supplierName,
|
||||
s.nif,
|
||||
s.IsVies,
|
||||
s.viesCode,
|
||||
iit.taxTypeSageFk,
|
||||
tt.code taxCode,
|
||||
ti.Iva,
|
||||
|
@ -219,7 +219,7 @@ BEGIN
|
|||
) eWithheld ON TRUE
|
||||
WHERE tii.taxTypeSageFk IS NOT NULL
|
||||
AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21'))
|
||||
GROUP BY tii.CuentaIvaRepercutido;
|
||||
GROUP BY tii.PorcentajeIva, tii.expenseFk;
|
||||
|
||||
-- Línea iva inversor sujeto pasivo
|
||||
INSERT INTO XDiario(
|
||||
|
@ -281,10 +281,10 @@ BEGIN
|
|||
JOIN sage.config c
|
||||
WHERE tii.taxCode = 'ISP21' OR MID(tii.supplierAccount, 4, 1) = '1'
|
||||
AND tii.taxTypeSageFk IS NOT NULL
|
||||
AND NOT(tii.isVies
|
||||
AND NOT(tii.viesCode IS NOT NULL
|
||||
AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk
|
||||
AND tii.taxCode = 'nonTaxable')
|
||||
GROUP BY tii.CuentaIvaRepercutido;
|
||||
GROUP BY tii.PorcentajeIva, tii.expenseFk;
|
||||
|
||||
-- Actualización del registro original
|
||||
UPDATE invoiceIn ii
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemCampaign_add`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Añade registros a tabla itemCampaign.
|
||||
*
|
||||
* @param vDateFrom Fecha desde
|
||||
* @param vDateTo Fecha hasta
|
||||
* @param vCampaign Código de la campaña
|
||||
*/
|
||||
DECLARE vYesterday DATE;
|
||||
DECLARE vCampaign VARCHAR(100);
|
||||
DECLARE vScopeDays INT;
|
||||
DECLARE vPreviousDays INT;
|
||||
DECLARE vDateSumFrom DATE;
|
||||
DECLARE vDateSumTo DATE;
|
||||
|
||||
SET vYesterday = util.yesterday();
|
||||
|
||||
SELECT dated, code, scopeDays, previousDays
|
||||
INTO vDateSumTo, vCampaign, vScopeDays, vPreviousDays
|
||||
FROM campaign
|
||||
WHERE dated >= vYesterday
|
||||
ORDER BY dated
|
||||
LIMIT 1;
|
||||
|
||||
IF vCampaign IS NULL THEN
|
||||
CALL util.throw('Missing data in campaign table');
|
||||
END IF;
|
||||
|
||||
IF NOT vYesterday BETWEEN vDateSumTo - INTERVAL vPreviousDays DAY
|
||||
AND vDateSumTo THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
SET vDateSumFrom = vDateSumTo - INTERVAL vScopeDays DAY;
|
||||
SET vDateSumTo = vDateSumTo - INTERVAL 1 DAY;
|
||||
|
||||
INSERT INTO itemCampaign(dated, itemFk, quantity, total, campaign)
|
||||
SELECT vYesterday,
|
||||
s.itemFk,
|
||||
SUM(s.quantity) quantity,
|
||||
SUM((s.quantity * s.price) * (100 - s.discount) / 100) total,
|
||||
vCampaign
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.shipped BETWEEN vDateSumFrom AND util.dayEnd(vDateSumTo)
|
||||
AND c.typeFk = 'normal'
|
||||
AND NOT t.isDeleted
|
||||
GROUP BY s.itemFk
|
||||
HAVING quantity;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,9 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyAiming`(
|
||||
vShelvingCode VARCHAR(10),
|
||||
vQuantity INT,
|
||||
vItemFk INT
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT)
|
||||
BEGIN
|
||||
|
||||
SELECT ish.itemFk,
|
||||
|
@ -13,21 +9,21 @@ BEGIN
|
|||
ish.itemShelvingFk,
|
||||
ish.shelving,
|
||||
ish.stock,
|
||||
LEAST(ish.stock,vQuantity) total,
|
||||
LEAST(ish.stock,quantity) as total,
|
||||
CONCAT(
|
||||
CAST(FLOOR(LEAST(ish.stock, vQuantity) / ish.packing) AS DECIMAL(10,0)),
|
||||
CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)),
|
||||
' x ',
|
||||
ish.packing,
|
||||
IF (
|
||||
LEAST(ish.stock, vQuantity) MOD ish.packing,
|
||||
CONCAT(' + ',CAST(LEAST(ish.stock, vQuantity) MOD ish.packing AS DECIMAL(10,0))),
|
||||
LEAST(ish.stock,quantity) MOD ish.packing,
|
||||
CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))),
|
||||
''
|
||||
),
|
||||
' = ',
|
||||
LEAST(ish.stock, vQuantity)
|
||||
) proposal
|
||||
FROM itemShelvingPlacementSupplyStock ish
|
||||
WHERE ish.shelving = vShelvingCode COLLATE utf8_general_ci
|
||||
LEAST(ish.stock,quantity)
|
||||
) as proposal
|
||||
FROM vn.itemShelvingPlacementSupplyStock ish
|
||||
WHERE ish.shelving = vShelvingFk COLLATE utf8_general_ci
|
||||
AND ish.itemFk = vItemFk;
|
||||
|
||||
END$$
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyGetOrder`(
|
||||
vSectorFk INT
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyGetOrder`(vSector INT )
|
||||
BEGIN
|
||||
|
||||
DECLARE vId INT;
|
||||
|
@ -9,35 +7,31 @@ BEGIN
|
|||
DECLARE vNextParkingFk INT;
|
||||
|
||||
SELECT sh.parkingFk INTO vLastParkingFk
|
||||
FROM itemShelvingPlacementSupply isps
|
||||
JOIN itemShelving ish ON ish.id = isps.itemShelvingFk
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
FROM vn.itemShelvingPlacementSupply isps
|
||||
JOIN vn.itemShelving ish ON ish.id = isps.itemShelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
WHERE isps.userFk = getUser()
|
||||
ORDER BY isps.created DESC
|
||||
LIMIT 1;
|
||||
|
||||
SET vNextParkingFk = itemShelvingPlacementSupply_ClosestGet(vLastParkingFk);
|
||||
SET vNextParkingFk = vn.itemShelvingPlacementSupply_ClosestGet(vLastParkingFk);
|
||||
|
||||
SELECT ipsl.id INTO vId
|
||||
FROM itemPlacementSupplyList ipsl
|
||||
JOIN itemShelvingPlacementSupplyStock ispss ON ispss.itemFk = ipsl.itemFk
|
||||
FROM vn.itemPlacementSupplyList ipsl
|
||||
JOIN vn.itemShelvingPlacementSupplyStock ispss ON ispss.itemFk = ipsl.itemFk
|
||||
WHERE ipsl.saldo > 0
|
||||
AND (ipsl.repoUserFk is NULL OR ipsl.repoUserFk = getUser())
|
||||
AND ipsl.sectorFk = vSectorFk
|
||||
ORDER BY ipsl.repoUserFk DESC,
|
||||
ipsl.priority DESC,
|
||||
(ispss.parkingFk = vNextParkingFk) DESC,
|
||||
ispss.parking DESC,
|
||||
ipsl.created
|
||||
AND ipsl.sectorFk = vSector
|
||||
ORDER BY ipsl.repoUserFk DESC, ipsl.priority DESC, (ispss.parkingFk = vNextParkingFk) DESC, ispss.parking DESC, ipsl.created
|
||||
LIMIT 1;
|
||||
|
||||
UPDATE itemPlacementSupply
|
||||
UPDATE vn.itemPlacementSupply
|
||||
SET repoUserFk = getUser()
|
||||
WHERE id = vId;
|
||||
|
||||
SELECT * FROM itemPlacementSupplyList
|
||||
SELECT * FROM vn.itemPlacementSupplyList
|
||||
WHERE id = vId
|
||||
AND sectorFk = vSectorFk;
|
||||
AND sectorFk = vSector;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyStockGetTargetList`(
|
||||
vItemFk INT,
|
||||
vSectorFk INT
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa.
|
||||
|
@ -16,11 +13,11 @@ BEGIN
|
|||
SUM(ish.visible) stockTotal,
|
||||
ish.created,
|
||||
p.pickingOrder
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector sc ON sc.id = p.sectorFk
|
||||
JOIN warehouse w ON w.id = sc.warehouseFk
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
||||
WHERE ish.visible > 0
|
||||
AND ish.itemFk = vItemFk
|
||||
GROUP BY ish.id
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(
|
||||
vShelvingCode VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(vShelvingFk VARCHAR(10) )
|
||||
BEGIN
|
||||
|
||||
/**
|
||||
* Devuelve el log de los item en cada carro
|
||||
*
|
||||
* @param vShelvingCode Matrícula del carro
|
||||
* @param vShelvingFk Matrícula del carro
|
||||
*
|
||||
*/
|
||||
|
||||
SELECT isl.itemShelvingFk,
|
||||
isl.created,
|
||||
isl.accion,
|
||||
|
@ -28,9 +28,8 @@ BEGIN
|
|||
FROM item
|
||||
JOIN itemShelvingLog isl ON item.id = isl.itemFk
|
||||
JOIN worker ON isl.workerFk = worker.id
|
||||
JOIN shelving sh ON sh.id = isl.shelvingFk
|
||||
WHERE sh.code = vShelvingCode COLLATE utf8mb3_unicode_ci
|
||||
OR isl.itemFk = vShelvingCode -- ?? Respeto porque ya estaba
|
||||
ORDER BY isl.created DESC;
|
||||
WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk
|
||||
ORDER BY isl.created DESC;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -20,7 +20,7 @@ BEGIN
|
|||
LEFT JOIN (
|
||||
SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking pk ON pk.id = sh.parkingFk
|
||||
WHERE ish.created BETWEEN vFromTimed AND vToTimed
|
||||
GROUP BY itemFk
|
||||
|
|
|
@ -18,19 +18,18 @@ proc: BEGIN
|
|||
DECLARE vReservedQuantity INT;
|
||||
DECLARE vOutStanding INT;
|
||||
DECLARE vUserFk INT;
|
||||
DECLARE vTotalReservedQuantity INT;
|
||||
DECLARE vTotalReservedQuantity INT;
|
||||
DECLARE vSaleQuantity INT;
|
||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
||||
|
||||
DECLARE vItemShelvingAvailable CURSOR FOR
|
||||
SELECT ish.id itemShelvingFk,
|
||||
ish.available
|
||||
FROM sale s
|
||||
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector sc ON sc.id = p.sectorFk
|
||||
JOIN productionConfig pc
|
||||
JOIN productionConfig pc
|
||||
WHERE s.id = vSaleFk
|
||||
AND NOT sc.isHideForPickers
|
||||
AND (sc.id = vSectorFk OR vSectorFk IS NULL)
|
||||
|
@ -45,15 +44,15 @@ proc: BEGIN
|
|||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
CALL util.tx_rollback(vIsRequiredTx);
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
CALL util.tx_start(vIsRequiredTx);
|
||||
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT id INTO vSaleFk
|
||||
FROM sale
|
||||
WHERE id = vSaleFk
|
||||
WHERE id = vSaleFk
|
||||
FOR UPDATE;
|
||||
|
||||
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
|
||||
|
@ -61,12 +60,12 @@ proc: BEGIN
|
|||
FROM sale s
|
||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||
WHERE s.id = vSaleFk;
|
||||
|
||||
IF vOutStanding <= 0 THEN
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
COMMIT;
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
|
@ -86,7 +85,7 @@ proc: BEGIN
|
|||
IF vTotalReservedQuantity <> vSaleQuantity THEN
|
||||
CALL util.debugAdd('itemShelvingSale_addBySale',
|
||||
CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
|
||||
|
||||
|
||||
UPDATE sale
|
||||
SET quantity = vTotalReservedQuantity
|
||||
WHERE id = vSaleFk;
|
||||
|
@ -94,7 +93,7 @@ proc: BEGIN
|
|||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
SELECT id INTO vItemShelvingFk
|
||||
SELECT id INTO vItemShelvingFk
|
||||
FROM itemShelving
|
||||
WHERE id = vItemShelvingFk
|
||||
FOR UPDATE;
|
||||
|
@ -103,19 +102,19 @@ proc: BEGIN
|
|||
SET vOutStanding = vOutStanding - vReservedQuantity;
|
||||
|
||||
IF vReservedQuantity > 0 THEN
|
||||
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
|
||||
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
|
||||
INSERT INTO itemShelvingSale(
|
||||
itemShelvingFk,
|
||||
saleFk,
|
||||
quantity,
|
||||
userFk,
|
||||
isPicked)
|
||||
SELECT vItemShelvingFk,
|
||||
vSaleFk,
|
||||
vReservedQuantity,
|
||||
vUserFk,
|
||||
FALSE;
|
||||
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
|
||||
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
|
||||
INSERT INTO itemShelvingSale(
|
||||
itemShelvingFk,
|
||||
saleFk,
|
||||
quantity,
|
||||
userFk,
|
||||
isPicked)
|
||||
SELECT vItemShelvingFk,
|
||||
vSaleFk,
|
||||
vReservedQuantity,
|
||||
vUserFk,
|
||||
FALSE;
|
||||
|
||||
UPDATE itemShelving
|
||||
SET available = available - vReservedQuantity
|
||||
|
@ -124,6 +123,6 @@ proc: BEGIN
|
|||
END IF;
|
||||
END LOOP;
|
||||
CLOSE vItemShelvingAvailable;
|
||||
CALL util.tx_commit(vIsRequiredTx);
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -3,8 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ
|
|||
vItemShelvingSaleFk INT(10),
|
||||
vQuantity DECIMAL(10,0),
|
||||
vIsItemShelvingSaleEmpty BOOLEAN,
|
||||
vSectorFk INT,
|
||||
vShelvingFk VARCHAR(10)
|
||||
vSectorFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -25,7 +24,6 @@ BEGIN
|
|||
DECLARE vItemFk INT;
|
||||
DECLARE vTotalQuantity INT;
|
||||
DECLARE vStateCode VARCHAR(45);
|
||||
DECLARE vCurrentShelvingFk VARCHAR(10);
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
|
@ -47,26 +45,18 @@ BEGIN
|
|||
iss.saleFk,
|
||||
iss.itemShelvingFk,
|
||||
SUM(IFNULL(iss.quantity,0)),
|
||||
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'),
|
||||
sh.code
|
||||
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
|
||||
INTO vItemFk,
|
||||
vSaleFk,
|
||||
vItemShelvingFk,
|
||||
vReservedQuantity,
|
||||
vStateCode,
|
||||
vCurrentShelvingFk
|
||||
vStateCode
|
||||
FROM itemShelvingSale iss
|
||||
JOIN sale s ON s.id = iss.saleFk
|
||||
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
||||
WHERE iss.id = vItemShelvingSaleFk
|
||||
AND NOT iss.isPicked;
|
||||
|
||||
IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN
|
||||
CALL util.throw('The shelving can not be different from the shelving reserved');
|
||||
END IF;
|
||||
|
||||
IF vQuantity > vReservedQuantity
|
||||
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
||||
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_add`(
|
||||
vShelvingCode VARCHAR(10),
|
||||
vShelvingFk VARCHAR(8),
|
||||
vBarcode VARCHAR(22),
|
||||
vQuantity INT,
|
||||
vPackagingFk VARCHAR(10),
|
||||
|
@ -12,7 +12,7 @@ BEGIN
|
|||
/**
|
||||
* Añade registro o lo actualiza si ya existe.
|
||||
*
|
||||
* @param vShelvingCode matrícula del carro
|
||||
* @param vShelvingFk matrícula del carro
|
||||
* @param vBarcode el id del registro
|
||||
* @param vQuantity indica la cantidad del producto
|
||||
* @param vPackagingFk el packaging del producto en itemShelving, NULL para coger el de la ultima compra
|
||||
|
@ -23,15 +23,10 @@ BEGIN
|
|||
**/
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vBuyFk INT;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vBuyFk
|
||||
FROM buy WHERE id = vBarcode;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
SELECT barcodeToItem(vBarcode) INTO vItemFk;
|
||||
|
||||
IF vBuyFk IS NULL THEN
|
||||
|
@ -45,7 +40,7 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
IF (SELECT COUNT(*) FROM itemShelving
|
||||
WHERE shelvingFk = vShelvingFk
|
||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
||||
AND itemFk = vItemFk
|
||||
AND packing = vPacking
|
||||
AND buyFk = vBuyFk) THEN
|
||||
|
@ -53,9 +48,7 @@ BEGIN
|
|||
UPDATE itemShelving
|
||||
SET visible = visible + vQuantity,
|
||||
available = available + vQuantity
|
||||
WHERE shelvingFk = vShelvingFk
|
||||
AND itemFk = vItemFk
|
||||
AND packing = vPacking;
|
||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
|
||||
|
||||
ELSE
|
||||
|
||||
|
|
|
@ -1,38 +1,29 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_addByClaim`(
|
||||
vClaimFk INT,
|
||||
vShelvingCode VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3))
|
||||
BEGIN
|
||||
/**
|
||||
* Insert items of claim into itemShelving.
|
||||
*
|
||||
* @param vClaimFk The claim
|
||||
* @param vShelvingCode The shelving code
|
||||
* @param vShelvingFk The shelving
|
||||
* @table tmp.buyUltimate
|
||||
*/
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT t.warehouseFk INTO vWarehouseFk
|
||||
FROM claim c
|
||||
JOIN ticket t ON t.id = c.ticketFk
|
||||
WHERE c.id = vClaimFk;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
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 visible
|
||||
SELECT s.itemFk, vShelvingFk, b.packing, b.`grouping`, cb.quantity AS visible
|
||||
FROM claim c
|
||||
JOIN claimBeginning cb ON c.id = cb.claimFk
|
||||
JOIN sale s ON s.id = cb.saleFk
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
AND bu.warehouseFk = t.warehouseFk
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk AND bu.warehouseFk = t.warehouseFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
WHERE c.id = vClaimFk;
|
||||
END$$
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_addList`(
|
||||
vShelvingCode VARCHAR(10),
|
||||
vShelvingFk VARCHAR(3),
|
||||
vList TEXT,
|
||||
vIsChecking BOOL,
|
||||
vWarehouseFk INT
|
||||
|
@ -13,7 +13,7 @@ BEGIN
|
|||
* Cuando es TRUE sólo inserta los elementos de la colección que no están ya en
|
||||
* ese shelving, actualizando los valores del campo itemShelving.isChecked
|
||||
*
|
||||
* @param vShelvingCode Código de shelving
|
||||
* @param vShelvingFk Identificador de shelving
|
||||
* @param vList JSON array con esta estructura: '[value1, value2, ...]'
|
||||
* @param vIsChecking Define si hay que añadir o comprobar los items
|
||||
* @param vWarehouseFk Identificador de warehouse
|
||||
|
@ -24,11 +24,6 @@ BEGIN
|
|||
DECLARE vPath VARCHAR(6);
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vIsChecked BOOL;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
WHILE vCounter < vListLength DO
|
||||
SET vPath = CONCAT('$[', vCounter, ']');
|
||||
|
@ -39,17 +34,17 @@ BEGIN
|
|||
|
||||
SELECT IF(COUNT(*), TRUE, FALSE) INTO vIsChecked
|
||||
FROM itemShelving
|
||||
WHERE shelvingFk = vShelvingFk
|
||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
||||
AND itemFk = vItemFk;
|
||||
END IF;
|
||||
|
||||
IF NOT vIsChecking OR NOT vIsChecked THEN
|
||||
CALL itemShelving_add(vShelvingCode, vBarcode, 1, NULL, NULL, NULL, vWarehouseFk);
|
||||
CALL itemShelving_add(vShelvingFk, vBarcode, 1, NULL, NULL, NULL, vWarehouseFk);
|
||||
END IF;
|
||||
|
||||
UPDATE itemShelving
|
||||
SET isChecked = vIsChecked
|
||||
WHERE shelvingFk = vShelvingFk
|
||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
||||
AND itemFk = vItemFk
|
||||
AND isChecked IS NULL;
|
||||
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(
|
||||
vShelvingCode VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_get`(IN vSelf VARCHAR(8))
|
||||
BEGIN
|
||||
/**
|
||||
* Lista artículos de itemShelving.
|
||||
* Lista artículos de itemshelving
|
||||
*
|
||||
* @param vShelvingCode Matrícula del carro
|
||||
* @param vSelf matrícula del carro
|
||||
**/
|
||||
SELECT ish.itemFk item,
|
||||
i.name,
|
||||
i.longName,
|
||||
i.size,
|
||||
IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description,
|
||||
ish.visible,
|
||||
CEIL(ish.visible/ish.packing) stickers,
|
||||
ish.packing,
|
||||
ish.grouping,
|
||||
p.code,
|
||||
|
@ -20,14 +17,12 @@ BEGIN
|
|||
s.priority,
|
||||
ish.isChecked,
|
||||
ic.url,
|
||||
ish.available,
|
||||
ish.buyFk,
|
||||
ish.shelvingFk
|
||||
ish.available
|
||||
FROM itemShelving ish
|
||||
JOIN item i ON i.id = ish.itemFk
|
||||
JOIN shelving s ON s.id = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = s.parkingFk
|
||||
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci
|
||||
LEFT JOIN parking p ON s.parkingFk = p.id
|
||||
JOIN hedera.imageConfig ic
|
||||
WHERE s.code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,31 +1,21 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(
|
||||
vShelvingCode VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getAlternatives`(vShelvingFk VARCHAR(10))
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve un listado de posibles ubicaciones alternativas a ubicar
|
||||
* los item de la matricula del carro que se le ha pasado.
|
||||
* Devuelve un listado de posibles ubicaciones alternativas a ubicar los item de la matricula
|
||||
* del carro que se le ha pasado.
|
||||
*
|
||||
* @param vShelvingCode Matricula del carro
|
||||
* @param vShelvingFk matricula del carro
|
||||
*/
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
SELECT is2.id,is2.shelvingFk, p.code, is2.itemFk , is2.visible, p.pickingOrder
|
||||
SELECT is2.id,is2.shelvingFk , p.code, is2.itemFk , is2.visible, p.pickingOrder
|
||||
FROM itemShelving is2
|
||||
JOIN shelving sh ON sh.id = is2.shelvingFk
|
||||
JOIN shelving sh ON sh.code = is2.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector s ON s.id = p.sectorFk
|
||||
LEFT JOIN operator o ON o.sectorFk = s.id
|
||||
AND o.workerFk = account.myUser_getId()
|
||||
LEFT JOIN operator o ON o.sectorFk = s.id AND o.workerFk = account.myUser_getId()
|
||||
JOIN warehouse wh ON wh.id = s.warehouseFk
|
||||
JOIN itemShelving is3 ON is3.itemFk = is2.itemFk
|
||||
AND is3.shelvingFk = vShelvingFk
|
||||
WHERE is2.shelvingFk <> vShelvingFk
|
||||
JOIN itemShelving is3 ON is3.itemFk = is2.itemFk AND is3.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
|
||||
WHERE is2.shelvingFk <> vShelvingFk COLLATE utf8_unicode_ci
|
||||
GROUP BY is2.id
|
||||
ORDER BY p.pickingOrder DESC;
|
||||
END$$
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
ish.itemFk itemFk,
|
||||
sh.priority
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.`code` = ish.shelvingFk
|
||||
JOIN vn.parking pk ON pk.id = sh.parkingFk
|
||||
WHERE ish.itemFk = vItemFk
|
||||
ORDER BY sh.priority DESC, created ASC;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getItemDetails`(
|
||||
vBarcodeItem INT,
|
||||
vShelvingCode VARCHAR(10)
|
||||
vShelvingFK VARCHAR(10)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Obtiene el precio y visible de un item
|
||||
*
|
||||
* @param vBarcodeItem barcode de artículo
|
||||
* @param vShelvingCode Ubicación actual del artículo
|
||||
* @param vShelvingFK Ubicación actual del artículo
|
||||
*/
|
||||
DECLARE vIsItem BOOL;
|
||||
DECLARE vBuyFk INT;
|
||||
|
@ -38,19 +38,18 @@ BEGIN
|
|||
WITH visible AS(
|
||||
SELECT itemFk,
|
||||
IFNULL(buyingValue, 0) +
|
||||
IFNULL(freightValue, 0) +
|
||||
IFNULL(comissionValue, 0) +
|
||||
IFNULL(packageValue, 0) itemCost
|
||||
FROM vn.buy b
|
||||
IFNULL(freightValue, 0) +
|
||||
IFNULL(comissionValue, 0) +
|
||||
IFNULL(packageValue, 0) itemCost
|
||||
FROM vn.buy b
|
||||
WHERE b.id = vBuyFk
|
||||
) SELECT v.itemFk,
|
||||
vShelvingCode,
|
||||
vShelvingFK,
|
||||
v.itemCost,
|
||||
SUM(ish.visible) visible
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFK
|
||||
JOIN visible v
|
||||
WHERE sh.code = vShelvingCode COLLATE utf8mb3_general_ci
|
||||
AND ish.itemFk = v.itemFk;
|
||||
WHERE ish.shelvingFK = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
AND ish.itemFk = v.itemFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,20 +1,14 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getSaleDate`(
|
||||
vShelvingCode VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve la mínima fecha en que se necesita cada producto en esa matrícula.
|
||||
*
|
||||
* @param vShelvingCode Matrícula del carro o pallet
|
||||
*/
|
||||
|
||||
/* Devuelve la mínima fecha en que se necesita cada producto en esa matrícula.
|
||||
*
|
||||
* @param vShelvingFk Matrícula del carro o pallet
|
||||
*/
|
||||
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vStockScopeDays INT;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
SELECT s.warehouseFk, stockScopeDays
|
||||
INTO vWarehouseFk, vStockScopeDays
|
||||
|
@ -36,7 +30,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT itemFk, SUM(visible) visible
|
||||
FROM itemShelving
|
||||
WHERE shelvingFk = vShelvingFk
|
||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
|
||||
GROUP BY itemFk;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.tStockByDay
|
||||
|
@ -58,7 +52,7 @@ BEGIN
|
|||
SELECT ish.itemFk, - SUM(ish.visible), util.VN_CURDATE()
|
||||
FROM itemShelving ish
|
||||
JOIN tmp.tItems i ON i.itemFk = ish.itemFk
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON sh.parkingFk = p.id
|
||||
JOIN sector s ON s.id = p.sectorFk
|
||||
WHERE s.isReserve
|
||||
|
@ -116,7 +110,7 @@ BEGIN
|
|||
UPDATE tmp.tStockByDay sbd
|
||||
JOIN (SELECT ish.itemFK, SUM(ish.visible) amount
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector s ON s.id = p.sectorFk
|
||||
WHERE s.warehouseFk = vWarehouseFk
|
||||
|
@ -156,10 +150,10 @@ BEGIN
|
|||
p.sectorFk,
|
||||
ish.shelvingFk
|
||||
FROM itemShelving ish
|
||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = parkingFk
|
||||
LEFT JOIN vn.sector s ON s.id = p.sectorFk
|
||||
WHERE ish.shelvingFk = vShelvingFk
|
||||
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
|
||||
) sub4 ON sub4.itemFk = ts.itemFk
|
||||
LEFT JOIN sector s ON s.id = sub4.sectorFk
|
||||
LEFT JOIN item i ON i.id = ts.itemFk
|
||||
|
|
|
@ -42,7 +42,7 @@ BEGIN
|
|||
JOIN item i ON i.id = ish.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
LEFT JOIN (
|
||||
SELECT s.itemFk, sum(s.quantity) notPrepared
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_selfConsumption`(
|
||||
vShelvingCode VARCHAR(10) COLLATE utf8_general_ci,
|
||||
vShelvingFk VARCHAR(10) COLLATE utf8_general_ci,
|
||||
vItemFk INT,
|
||||
vQuantity INT
|
||||
)
|
||||
|
@ -9,9 +9,9 @@ BEGIN
|
|||
* Leave the indicated amount on the shelve
|
||||
* and create a ticket with the difference.
|
||||
*
|
||||
* @param vShelvingCode Code of the shelve where the item is located
|
||||
* @param vItemFk Item of which the self-consumption ticket is to be created
|
||||
* @param vQuantity Amount that will stay on the shelve
|
||||
* @param vShelvingFk id of the shelve where the item is located.
|
||||
* @param vItemFk article of which the self-consumption ticket is to be created.
|
||||
* @param vQuantity amount that will stay on the shelve
|
||||
*/
|
||||
DECLARE vVisible INT;
|
||||
DECLARE vClientFk INT;
|
||||
|
@ -21,11 +21,6 @@ BEGIN
|
|||
DECLARE vAgencyModeFk INT;
|
||||
DECLARE vItemShelvingFk INT;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code = vShelvingCode;
|
||||
|
||||
SELECT c.id,
|
||||
pc.clientSelfConsumptionFk,
|
||||
|
@ -42,7 +37,7 @@ BEGIN
|
|||
JOIN parking p ON p.sectorFk = s.id
|
||||
JOIN shelving s2 ON s2.parkingFk = p.id
|
||||
JOIN productionConfig pc
|
||||
WHERE s2.id = vShelvingFk;
|
||||
WHERE s2.code = vShelvingFk;
|
||||
|
||||
IF vClientFk IS NULL THEN
|
||||
CALL util.throw('The company does not have a customer assigned');
|
||||
|
@ -52,7 +47,7 @@ BEGIN
|
|||
CALL util.throw('The shelf cannot have NULL or negative quantities');
|
||||
END IF;
|
||||
|
||||
IF vShelvingCode IS NULL THEN
|
||||
IF vShelvingFk IS NULL THEN
|
||||
CALL util.throw('The shelf is necessary');
|
||||
END IF;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelving_transfer`(
|
||||
vItemShelvingFk INT,
|
||||
vShelvingCode VARCHAR(10)
|
||||
vShelvingFk VARCHAR(10)
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -9,14 +9,9 @@ BEGIN
|
|||
* fusionando si coincide el packing y la fecha.
|
||||
*
|
||||
* @param vItemShelvingFk Identificador de itemShelving
|
||||
* @param vShelvingCode Código de shelving
|
||||
* @param vShelvingFk Identificador de shelving
|
||||
*/
|
||||
DECLARE vNewItemShelvingFk INT;
|
||||
DECLARE vShelvingFk INT;
|
||||
|
||||
SELECT id INTO vShelvingFk
|
||||
FROM shelving
|
||||
WHERE code COLLATE utf8_unicode_ci = vShelvingCode;
|
||||
|
||||
SELECT MAX(ish.id) INTO vNewItemShelvingFk
|
||||
FROM itemShelving ish
|
||||
|
@ -31,7 +26,7 @@ BEGIN
|
|||
AND ish2.packing = ish.packing
|
||||
AND DATE(ish2.created) = DATE(ish.created)
|
||||
AND ish2.buyFk = ish.buyFk
|
||||
WHERE ish.shelvingFk = vShelvingFk;
|
||||
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
|
||||
|
||||
IF vNewItemShelvingFk THEN
|
||||
UPDATE itemShelving ish
|
||||
|
@ -43,7 +38,9 @@ BEGIN
|
|||
DELETE FROM itemShelving
|
||||
WHERE id = vItemShelvingFk;
|
||||
ELSE
|
||||
IF (SELECT EXISTS(SELECT id FROM shelving WHERE id = vShelvingFk)) THEN
|
||||
IF (SELECT EXISTS(SELECT id FROM shelving
|
||||
WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
|
||||
|
||||
UPDATE itemShelving
|
||||
SET shelvingFk = vShelvingFk
|
||||
WHERE id = vItemShelvingFk;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_devalueA2`(
|
||||
vSelf INT,
|
||||
vShelvingCode VARCHAR(10) COLLATE utf8mb3_general_ci,
|
||||
vShelvingFK VARCHAR(10),
|
||||
vBuyingValue DECIMAL(10,4),
|
||||
vQuantity INT
|
||||
)
|
||||
|
@ -12,7 +12,7 @@ BEGIN
|
|||
* de almacén y shelvings correspondientes
|
||||
*
|
||||
* @param vSelf Id de artículo a devaluar
|
||||
* @param vShelvingCode Código de shelving / ubicación
|
||||
* @param vShelvingFK Ubicación actual del artículo
|
||||
* @param vBuyingValue Nuevo precio de coste
|
||||
* @param vQuantity Cantidad del ítem a pasar a A2
|
||||
*/
|
||||
|
@ -109,11 +109,10 @@ BEGIN
|
|||
CALL util.throw ('The item has not a buy');
|
||||
END IF;
|
||||
|
||||
SELECT ish.id, ish.visible INTO vTargetItemShelvingFk, vCurrentVisible
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
WHERE sh.code = vShelvingCode
|
||||
AND ish.itemFk = vSelf
|
||||
SELECT id,visible INTO vTargetItemShelvingFk, vCurrentVisible
|
||||
FROM itemShelving
|
||||
WHERE shelvingFk = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
AND itemFk = vSelf
|
||||
LIMIT 1;
|
||||
|
||||
IF vCurrentVisible IS NULL THEN
|
||||
|
@ -389,17 +388,16 @@ BEGIN
|
|||
userFk,
|
||||
isChecked)
|
||||
SELECT vItemA2Fk,
|
||||
ish.shelvingFk,
|
||||
shelvingFk,
|
||||
vQuantity ,
|
||||
ish.`grouping`,
|
||||
ish.packing,
|
||||
ish.packagingFk,
|
||||
`grouping`,
|
||||
packing,
|
||||
packagingFk,
|
||||
account.myUser_getId(),
|
||||
ish.isChecked
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
WHERE ish.itemFK = vSelf
|
||||
AND sh.code = vShelvingCode
|
||||
isChecked
|
||||
FROM itemShelving
|
||||
WHERE itemFK = vSelf
|
||||
AND shelvingFk = vShelvingFK COLLATE utf8mb3_general_ci
|
||||
ON DUPLICATE KEY UPDATE
|
||||
visible = vQuantity + VALUES(visible);
|
||||
|
||||
|
|
|
@ -50,16 +50,16 @@ BEGIN
|
|||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
|
||||
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
|
||||
OR (util.VN_CURDATE() AND tr.isReceived),
|
||||
'DELIVERED',
|
||||
'FREE')
|
||||
WHERE tr.landed >= vDateInventory
|
||||
AND tr.warehouseInFk = vWarehouseFk
|
||||
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||
AND b.itemFk = vItemFk
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
),
|
||||
entriesOut AS (
|
||||
SELECT 'entry',
|
||||
|
@ -95,7 +95,7 @@ BEGIN
|
|||
AND b.itemFk = vItemFk
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT w.isFeedStock
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
),
|
||||
sales AS (
|
||||
WITH itemSales AS (
|
||||
|
@ -147,10 +147,10 @@ BEGIN
|
|||
NULL
|
||||
FROM itemSales s
|
||||
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
||||
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
||||
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
||||
AND stk.stateFk = stPrep.id
|
||||
GROUP BY s.saleFk
|
||||
),
|
||||
),
|
||||
orders AS (
|
||||
SELECT 'order' originType,
|
||||
o.id originId,
|
||||
|
@ -215,9 +215,9 @@ BEGIN
|
|||
t.`in` invalue,
|
||||
t.`out`,
|
||||
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
||||
@currentLineFk := IF (@shipped < util.VN_CURDATE()
|
||||
@currentLineFk := IF (@shipped < util.VN_CURDATE()
|
||||
OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')),
|
||||
t.lineFk,
|
||||
t.lineFk,
|
||||
@currentLineFk) lastPreparedLineFk,
|
||||
t.isTicket,
|
||||
t.lineFk,
|
||||
|
@ -254,21 +254,21 @@ BEGIN
|
|||
UNION ALL
|
||||
SELECT originType,
|
||||
originId,
|
||||
shipped,
|
||||
alertlevel,
|
||||
stateName,
|
||||
shipped,
|
||||
alertlevel,
|
||||
stateName,
|
||||
reference,
|
||||
entityType,
|
||||
entityId,
|
||||
entityId,
|
||||
entityName,
|
||||
`in`,
|
||||
`out`,
|
||||
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
||||
0,
|
||||
isTicket,
|
||||
lineFk,
|
||||
isPicked,
|
||||
clientType,
|
||||
`in`,
|
||||
`out`,
|
||||
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
||||
0,
|
||||
isTicket,
|
||||
lineFk,
|
||||
isPicked,
|
||||
clientType,
|
||||
claimFk,
|
||||
`order`
|
||||
FROM tItemDiary
|
||||
|
|
|
@ -42,6 +42,7 @@ BEGIN
|
|||
i.minimum `min`,
|
||||
p.name producer,
|
||||
o.code origin,
|
||||
v.visible - IFNULL(vVisibleItemShelving, 0) unlocated,
|
||||
a.available,
|
||||
vVisibleItemShelving,
|
||||
v.visible,
|
||||
|
|
|
@ -63,7 +63,7 @@ BEGIN
|
|||
AND NOT e.isExcludedFromAvailable
|
||||
AND b.quantity <> 0
|
||||
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT r.itemFk,
|
||||
r.shipment,
|
||||
|
|
|
@ -17,22 +17,22 @@ BEGIN
|
|||
|
||||
ALTER TABLE tmp.itemInventory
|
||||
ADD `buy_date` datetime NOT NULL;
|
||||
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE lastBuyScope
|
||||
SELECT i.id, MAX(t.landed) lastLanded
|
||||
FROM item i
|
||||
JOIN buy b ON b.itemFk = i.id
|
||||
FROM item i
|
||||
JOIN buy b ON b.itemFk = i.id
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN supplier s ON s.id = e.supplierFk
|
||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN (vDated + INTERVAL - vLastBuyScope DAY) AND vDated
|
||||
AND NOT s.name = 'INVENTARIO'
|
||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||
AND w.isComparative
|
||||
AND NOT t.isRaid
|
||||
AND NOT e.isRaid
|
||||
GROUP BY i.id;
|
||||
|
||||
|
||||
UPDATE tmp.itemInventory y
|
||||
JOIN lastBuyScope lbs ON lbs.id = y.id
|
||||
SET y.buy_date = lbs.lastLanded;
|
||||
|
|
|
@ -25,7 +25,7 @@ BEGIN
|
|||
LIMIT 1;
|
||||
|
||||
SET vHasNotInventory = (vInventoried IS NULL);
|
||||
|
||||
|
||||
IF vHasNotInventory THEN
|
||||
SELECT landed INTO vInventoryClone
|
||||
FROM travel tr
|
||||
|
@ -50,7 +50,7 @@ BEGIN
|
|||
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
|
||||
)
|
||||
ENGINE = MEMORY;
|
||||
|
||||
|
||||
-- Inventario inicial
|
||||
IF vHasNotInventory THEN
|
||||
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
||||
|
@ -109,7 +109,7 @@ BEGIN
|
|||
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)
|
||||
AND NOT tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND e.supplierFk <> vInventorySupplierFk
|
||||
|
@ -131,7 +131,7 @@ BEGIN
|
|||
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 tr.isRaid
|
||||
AND NOT e.isRaid
|
||||
AND w.valuatedInventory
|
||||
AND t.isInventory
|
||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||
|
@ -159,7 +159,7 @@ BEGIN
|
|||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1);
|
||||
|
||||
-- Volver a poner lo que esta aun en las estanterias
|
||||
IF vDated = util.VN_CURDATE() THEN
|
||||
IF vDated = util.VN_CURDATE() THEN
|
||||
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
||||
SELECT w.id,
|
||||
s.itemFk,
|
||||
|
@ -196,14 +196,14 @@ BEGIN
|
|||
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
||||
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
||||
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
||||
AND NOT tr.isRaid
|
||||
AND NOT isRaid
|
||||
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 buy_getUltimate (NULL, NULL, vDateDayEnd);
|
||||
|
||||
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
|
||||
|
@ -233,7 +233,7 @@ BEGIN
|
|||
JOIN warehouse w ON w.id = warehouseFk
|
||||
JOIN item i ON i.id = ti.itemFk
|
||||
JOIN itemType tp ON tp.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||
WHERE w.valuatedInventory
|
||||
AND ti.total > 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
|
||||
BEGIN
|
||||
|
||||
/**
|
||||
* Inserta registro si el vWorkerFk no ha registrado nada en las últimas 12 horas
|
||||
* @param vPlate número de matrícula
|
||||
* @param vWorkerFk id del worker
|
||||
*
|
||||
*/
|
||||
UPDATE vn.machineWorker mw
|
||||
JOIN vn.machine m ON m.id = mw.machineFk
|
||||
SET mw.outTimed = util.VN_NOW()
|
||||
WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate)
|
||||
AND ISNULL(mw.outTimed);
|
||||
|
||||
INSERT INTO machineWorker (machineFk, workerFk)
|
||||
SELECT m.id, vWorkerFk
|
||||
FROM machine m
|
||||
WHERE m.plate= vPlate;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,21 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea,
|
||||
* si es jefe de producción muestra el historial completo.
|
||||
*
|
||||
* @param vPlate número de matrícula
|
||||
* @param vWorkerFk id del trabajador
|
||||
*
|
||||
*/
|
||||
DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vWorkerFk);
|
||||
|
||||
SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed
|
||||
FROM machineWorker mw
|
||||
JOIN machine m ON m.plate = vPlate
|
||||
WHERE mw.machineFk = m.id
|
||||
AND mw.workerFk = IF(account.user_hasRole(vWorkerName, 'coolerAssist'), mw.workerFk, vWorkerFk)
|
||||
ORDER BY mw.inTimed DESC;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,38 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
|
||||
BEGIN
|
||||
|
||||
/**
|
||||
* Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate,
|
||||
*
|
||||
* @param vPlate número de matrícula
|
||||
* @param vWorkerFk id del trabajador
|
||||
*
|
||||
*/
|
||||
|
||||
DECLARE vMachineFk INT(10);
|
||||
DECLARE vMaxHours INT(10);
|
||||
|
||||
SELECT m.id INTO vMachineFk
|
||||
FROM machine m
|
||||
WHERE m.plate = vPlate;
|
||||
|
||||
SELECT maxHours INTO vMaxHours
|
||||
FROM machineWorkerConfig;
|
||||
|
||||
IF (SELECT COUNT(*)
|
||||
FROM machineWorker m
|
||||
WHERE m.workerFk = vWorkerFk
|
||||
AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN
|
||||
|
||||
UPDATE machineWorker m
|
||||
SET m.outTimed = CURRENT_TIMESTAMP()
|
||||
WHERE m.workerFk = vWorkerFk
|
||||
AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW())
|
||||
AND ISNULL(m.outTimed)
|
||||
AND m.machineFk = vMachineFk;
|
||||
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,16 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machine_getWorkerPlate`(vWorkerFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Selecciona la matrícula del vehículo del workerfk
|
||||
*
|
||||
* @param vWorkerFk el id del trabajador
|
||||
*/
|
||||
SELECT m.plate
|
||||
FROM machine m
|
||||
JOIN machineWorker mw ON mw.machineFk = m.id
|
||||
WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW())
|
||||
AND ISNULL(mw.outTimed)
|
||||
AND mw.workerFk = vWorkerFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,173 +1,173 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
|
||||
vDate DATE,
|
||||
vWarehouseFk TINYINT,
|
||||
vMaxDays TINYINT
|
||||
)
|
||||
proc: BEGIN
|
||||
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
|
||||
DECLARE vDateFrom DATE DEFAULT vDate;
|
||||
DECLARE vDateTo DATETIME;
|
||||
DECLARE vDateToTomorrow DATETIME;
|
||||
DECLARE vDefaultDayRange INT;
|
||||
DECLARE vCalcFk INT;
|
||||
|
||||
IF vDate < util.VN_CURDATE() THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vDate = util.VN_CURDATE() THEN
|
||||
SELECT inventoried INTO vDateFrom
|
||||
FROM config;
|
||||
END IF;
|
||||
|
||||
SELECT defaultDayRange INTO vDefaultDayRange
|
||||
FROM comparativeConfig;
|
||||
|
||||
SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
|
||||
SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
|
||||
|
||||
ALTER TABLE tmp.itemInventory
|
||||
ADD `avalaible` INT NOT NULL,
|
||||
ADD `sd` INT NOT NULL,
|
||||
ADD `rest` INT NOT NULL,
|
||||
ADD `expected` INT NOT NULL,
|
||||
ADD `inventory` INT NOT NULL,
|
||||
ADD `visible` INT NOT NULL,
|
||||
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
||||
|
||||
-- Calculo del inventario
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT itemFk,
|
||||
SUM(quantity) quantity
|
||||
FROM (
|
||||
SELECT s.itemFk, - s.quantity quantity
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT b.itemFk, b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT t.isRaid
|
||||
UNION ALL
|
||||
SELECT b.itemFk, - b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT t.isRaid
|
||||
) sub
|
||||
GROUP BY itemFk;
|
||||
|
||||
-- Cálculo del visible
|
||||
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id, visible
|
||||
FROM cache.visible
|
||||
WHERE calc_id = vCalcFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
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
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT sub.itemFk,
|
||||
vWarehouseFk warehouseFk,
|
||||
sub.dated,
|
||||
SUM(sub.quantity) quantity
|
||||
FROM (
|
||||
SELECT s.itemFk,
|
||||
DATE(t.shipped) dated,
|
||||
- s.quantity quantity
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT b.itemFk, t.landed, b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT t.isRaid
|
||||
UNION ALL
|
||||
SELECT b.itemFk, t.shipped, - b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT t.isRaid
|
||||
) sub
|
||||
GROUP BY sub.itemFk, sub.dated;
|
||||
|
||||
CALL item_getAtp(vDate);
|
||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||
|
||||
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,
|
||||
tItemAvailableCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
|
||||
vDate DATE,
|
||||
vWarehouseFk TINYINT,
|
||||
vMaxDays TINYINT
|
||||
)
|
||||
proc: BEGIN
|
||||
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
|
||||
DECLARE vDateFrom DATE DEFAULT vDate;
|
||||
DECLARE vDateTo DATETIME;
|
||||
DECLARE vDateToTomorrow DATETIME;
|
||||
DECLARE vDefaultDayRange INT;
|
||||
DECLARE vCalcFk INT;
|
||||
|
||||
IF vDate < util.VN_CURDATE() THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF vDate = util.VN_CURDATE() THEN
|
||||
SELECT inventoried INTO vDateFrom
|
||||
FROM config;
|
||||
END IF;
|
||||
|
||||
SELECT defaultDayRange INTO vDefaultDayRange
|
||||
FROM comparativeConfig;
|
||||
|
||||
SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
|
||||
SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
|
||||
|
||||
ALTER TABLE tmp.itemInventory
|
||||
ADD `avalaible` INT NOT NULL,
|
||||
ADD `sd` INT NOT NULL,
|
||||
ADD `rest` INT NOT NULL,
|
||||
ADD `expected` INT NOT NULL,
|
||||
ADD `inventory` INT NOT NULL,
|
||||
ADD `visible` INT NOT NULL,
|
||||
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
||||
|
||||
-- Calculo del inventario
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
|
||||
(PRIMARY KEY (itemFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT itemFk,
|
||||
SUM(quantity) quantity
|
||||
FROM (
|
||||
SELECT s.itemFk, - s.quantity quantity
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT b.itemFk, b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT b.itemFk, - b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT e.isRaid
|
||||
) sub
|
||||
GROUP BY itemFk;
|
||||
|
||||
-- Cálculo del visible
|
||||
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT item_id, visible
|
||||
FROM cache.visible
|
||||
WHERE calc_id = vCalcFk;
|
||||
|
||||
UPDATE tmp.itemInventory it
|
||||
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
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT sub.itemFk,
|
||||
vWarehouseFk warehouseFk,
|
||||
sub.dated,
|
||||
SUM(sub.quantity) quantity
|
||||
FROM (
|
||||
SELECT s.itemFk,
|
||||
DATE(t.shipped) dated,
|
||||
- s.quantity quantity
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||
AND w.isComparative
|
||||
UNION ALL
|
||||
SELECT b.itemFk, t.landed, b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||
WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT e.isRaid
|
||||
UNION ALL
|
||||
SELECT b.itemFk, t.shipped, - b.quantity
|
||||
FROM buy b
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||
AND w.isComparative
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT e.isRaid
|
||||
) sub
|
||||
GROUP BY sub.itemFk, sub.dated;
|
||||
|
||||
CALL item_getAtp(vDate);
|
||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||
|
||||
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,
|
||||
tItemAvailableCalc;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -217,7 +217,7 @@ proc: BEGIN
|
|||
st.code = 'previousPrepared' isPreviousPrepared,
|
||||
sc.itemPackingTypeFk
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector sc ON sc.id = p.sectorFk
|
||||
JOIN sectorType st ON st.id = sc.typeFk
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`raidUpdate`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el travel de las entradas de redadas
|
||||
*/
|
||||
UPDATE entry e
|
||||
JOIN entryVirtual ev ON ev.entryFk = e.id
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN (
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT t.id, t.landed, tt.warehouseInFk, tt.warehouseOutFk
|
||||
FROM travel t
|
||||
JOIN (
|
||||
SELECT t.warehouseInFk, t.warehouseOutFk
|
||||
FROM entryVirtual ev
|
||||
JOIN entry e ON e.id = ev.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
GROUP BY t.warehouseInFk, t.warehouseOutFk
|
||||
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
|
||||
WHERE shipped > util.VN_CURDATE() AND NOT isDelivered
|
||||
ORDER BY t.landed
|
||||
LIMIT 10000000000000000000
|
||||
) t
|
||||
GROUP BY t.warehouseInFk, t.warehouseOutFk
|
||||
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
|
||||
SET e.travelFk = t.id;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -11,8 +11,6 @@ BEGIN
|
|||
*/
|
||||
DECLARE vIsUpdatable, vIsFreelance BOOL DEFAULT 0;
|
||||
DECLARE vAgencyModePricePercentage DOUBLE;
|
||||
DECLARE vIsKmTruckRate BOOL;
|
||||
DECLARE vCountryFk INT;
|
||||
|
||||
SELECT r.created >= rc.cutoffDated INTO vIsUpdatable
|
||||
FROM route r
|
||||
|
@ -23,16 +21,10 @@ BEGIN
|
|||
DELETE FROM routeCommission
|
||||
WHERE routeFk = vSelf;
|
||||
|
||||
SELECT w.isFreelance, v.isKmTruckRate, c.countryFk INTO vIsFreelance, vIsKmTruckRate, vCountryFk
|
||||
SELECT w.isFreelance INTO vIsFreelance
|
||||
FROM route r
|
||||
JOIN worker w ON w.id = r.workerFk
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
LEFT JOIN ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
WHERE r.id = vSelf
|
||||
GROUP BY c.countryFk
|
||||
ORDER BY COUNT(*) DESC
|
||||
LIMIT 1;
|
||||
WHERE r.id = vSelf;
|
||||
|
||||
SELECT ampp.percentage INTO vAgencyModePricePercentage
|
||||
FROM route r
|
||||
|
@ -47,9 +39,7 @@ BEGIN
|
|||
workCenterFk,
|
||||
freelanceYearlyM3,
|
||||
cat4m3,
|
||||
cat5m3,
|
||||
isKmTruckRate,
|
||||
countryFk
|
||||
cat5m3
|
||||
)
|
||||
SELECT vSelf,
|
||||
r.commissionWorkCenterFk,
|
||||
|
@ -61,14 +51,11 @@ BEGIN
|
|||
IFNULL(r.m3, 0),
|
||||
0
|
||||
),
|
||||
IFNULL(wc.distributionCat4M3, rc.distributionCat4M3) * IFNULL(r.m3, 0),
|
||||
IFNULL(wc.distributionCat5M3, rc.distributionCat5M3) * IFNULL(r.m3, 0),
|
||||
vIsKmTruckRate,
|
||||
vCountryFk
|
||||
rc.distributionCat4M3 * IFNULL(r.m3, 0),
|
||||
rc.distributionCat5M3 * IFNULL(r.m3, 0)
|
||||
FROM route r
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
JOIN routeConfig rc
|
||||
LEFT JOIN workCenterCommission wc ON wc.workCenter = r.workCenterFk
|
||||
WHERE r.id = vSelf
|
||||
AND r.workerFk
|
||||
AND r.commissionWorkCenterFk;
|
||||
|
@ -81,9 +68,7 @@ BEGIN
|
|||
yearlyKm,
|
||||
yearlyM3,
|
||||
cat4m3,
|
||||
cat5m3,
|
||||
isKmTruckRate,
|
||||
countryFk
|
||||
cat5m3
|
||||
)
|
||||
SELECT vSelf,
|
||||
r.commissionWorkCenterFk,
|
||||
|
@ -93,14 +78,11 @@ BEGIN
|
|||
IF(v.isKmTruckRate, rc.deliveryM3Cat5, rc.deliveryM3Cat4),
|
||||
(r.kmEnd - r.kmStart) * rc.kmYearly,
|
||||
IFNULL(r.m3, 0) * rc.m3Yearly,
|
||||
IFNULL(wc.distributionCat4M3, rc.distributionCat4M3) * IFNULL(r.m3, 0),
|
||||
IFNULL(wc.distributionCat5M3, rc.distributionCat5M3) * IFNULL(r.m3, 0),
|
||||
vIsKmTruckRate,
|
||||
vCountryFk
|
||||
rc.distributionCat4M3 * IFNULL(r.m3, 0),
|
||||
rc.distributionCat5M3 * IFNULL(r.m3, 0)
|
||||
FROM route r
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
JOIN routeConfig rc
|
||||
LEFT JOIN workCenterCommission wc ON wc.workCenter = r.workCenterFk
|
||||
WHERE r.id = vSelf
|
||||
AND r.kmStart
|
||||
AND r.kmEnd
|
||||
|
|
|
@ -27,7 +27,7 @@ BEGIN
|
|||
DECLARE vQuantity INT;
|
||||
DECLARE vRemainder INT DEFAULT 0;
|
||||
DECLARE vRemainderSaleFk INT;
|
||||
DECLARE vShelvingFk VARCHAR(10);
|
||||
DECLARE vShelving VARCHAR(10);
|
||||
DECLARE vTicketFk INT;
|
||||
|
||||
SELECT s.quantity,
|
||||
|
@ -74,7 +74,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
p.pickingOrder,
|
||||
ish.created
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
LEFT JOIN itemShelvingSale iss
|
||||
ON iss.itemShelvingFk = ish.id
|
||||
|
@ -262,9 +262,9 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE);
|
||||
|
||||
SELECT shelvingFk, p.code
|
||||
INTO vShelvingFk, vParkingCode
|
||||
INTO vShelving, vParkingCode
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
WHERE ish.id = vItemShelvingFk;
|
||||
|
||||
|
@ -273,7 +273,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
itemFk = vItemFk,
|
||||
quantity = vPacking,
|
||||
longName = vConcept,
|
||||
shelvingFk = vShelvingFk,
|
||||
shelvingFk = vShelving,
|
||||
parkingCode = vParkingCode,
|
||||
phone = RIGHT(phone,vMaxPhoneLength),
|
||||
street = RIGHT(street, vMAxStreetLength)
|
||||
|
|
|
@ -41,7 +41,7 @@ BEGIN
|
|||
AND iss.created >= vDated
|
||||
GROUP BY iss.itemShelvingFk, s.itemFk) tISS
|
||||
ON tISS.itemFk = ish.itemFk AND tISS.itemShelvingFk = ish.id
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
|
||||
JOIN agencyMode am ON am.id = pb.agencyModeFk
|
||||
|
|
|
@ -87,7 +87,7 @@ BEGIN
|
|||
SUM(ish.visible) visible,
|
||||
s.warehouseFk warehouseFk
|
||||
FROM itemShelving ish
|
||||
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN sector s ON s.id = p.sectorFk
|
||||
GROUP BY ish.itemFk, s.warehouseFk;
|
||||
|
@ -127,7 +127,7 @@ BEGIN
|
|||
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
|
||||
AND issw.warehouseFk = t.warehouseFk
|
||||
WHERE IFNULL(v.visible, 0) < s.quantity
|
||||
AND IFNULL(av.available, 0) < 0
|
||||
AND IFNULL(av.available, 0) < s.quantity
|
||||
AND IFNULL(issw.visible, 0) < s.quantity
|
||||
AND NOT s.isPicked
|
||||
AND NOT s.reserved
|
||||
|
@ -190,7 +190,7 @@ BEGIN
|
|||
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
|
||||
AND issw.warehouseFk = t.warehouseFk
|
||||
WHERE IFNULL(v.visible, 0) < s.quantity
|
||||
AND IFNULL(av.available, 0) >= 0
|
||||
AND IFNULL(av.available, 0) >= s.quantity
|
||||
AND IFNULL(issw.visible, 0) < s.quantity
|
||||
AND s.quantity > 0
|
||||
AND NOT s.isPicked
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(
|
||||
`vShelvingO` VARCHAR(10),
|
||||
`vShelvingD` VARCHAR(10)
|
||||
)
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8))
|
||||
BEGIN
|
||||
UPDATE itemShelving ish
|
||||
JOIN shelving sh1 ON sh1.code = vShelvingD COLLATE utf8_unicode_ci
|
||||
JOIN shelving sh2 ON sh2.code = vShelvingO COLLATE utf8_unicode_ci
|
||||
SET ish.shelvingFk = sh1.id
|
||||
WHERE ish.shelvingFk = sh2.id;
|
||||
|
||||
UPDATE vn.itemShelving
|
||||
SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci
|
||||
WHERE shelvingFk = vShelvingO COLLATE utf8_unicode_ci;
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue