Merge branch 'dev' of https: refs #7283//gitea.verdnatura.es/verdnatura/salix into 7283-itemsMigration3
This commit is contained in:
commit
155616e622
|
@ -1,132 +0,0 @@
|
|||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,77 +0,0 @@
|
|||
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;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -88,12 +88,6 @@
|
|||
"Machine": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MachineWorker": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MachineWorkerConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MobileAppVersionControl": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -145,6 +139,12 @@
|
|||
"StarredModule": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SaySimpleCountry": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SaySimpleConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TempContainer": {
|
||||
"dataSource": "tempStorage"
|
||||
},
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Continent",
|
||||
"foreignKey": "continentFk"
|
||||
},
|
||||
"saySimpleCountry": {
|
||||
"type": "hasOne",
|
||||
"model": "SaySimpleCountry",
|
||||
"foreignKey": "countryFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
@ -54,4 +59,4 @@
|
|||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "MachineWorkerConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "vn.machineWorkerConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"maxHours": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/machine-worker/updateInTime')(Self);
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "SaySimpleConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "saySimpleConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"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','11278','fe10f03459a153fc213bf64e352804c043f94590','2024-10-03 07:47:47','11281');
|
||||
INSERT INTO `version` VALUES ('vn-database','11311','315864403260623fede9f0471ef3d9036faf23b1','2024-11-12 08:00:59','11336');
|
||||
|
||||
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,6 +988,7 @@ 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);
|
||||
|
@ -1013,6 +1014,7 @@ 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);
|
||||
|
@ -1021,18 +1023,53 @@ 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 */;
|
||||
|
@ -1407,6 +1444,8 @@ 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);
|
||||
|
||||
|
@ -1723,7 +1762,6 @@ 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);
|
||||
|
@ -2175,7 +2213,6 @@ 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);
|
||||
|
@ -2191,7 +2228,6 @@ 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);
|
||||
|
@ -2213,6 +2249,7 @@ 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');
|
||||
|
@ -2408,6 +2445,8 @@ 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);
|
||||
|
@ -2450,6 +2489,9 @@ 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.');
|
||||
|
@ -2457,6 +2499,7 @@ 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');
|
||||
|
@ -2534,39 +2577,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,114,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,116,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,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 (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 (37,'PROD','PRODUCCION',14,37,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (38,'picking','SACADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_PREPARATION');
|
||||
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 (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,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 (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 (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',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 (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 (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',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 (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 (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',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 (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 (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);
|
||||
|
@ -2574,23 +2617,24 @@ 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',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 (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 (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',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 (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 (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',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 (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 (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (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 (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 ('','cache','productionBoss','available','guillermo@10.5.1.2','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 ('','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,7 +605,6 @@ 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','');
|
||||
|
@ -792,7 +791,6 @@ 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','');
|
||||
|
@ -971,7 +969,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','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert','');
|
||||
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','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','');
|
||||
|
@ -1471,9 +1469,31 @@ 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-proxy1.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-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parkingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','travelLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierContact','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDms','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','user','juan@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimReason','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResponsible','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimResult','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claimRedelivery','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','producer','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStateTag','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','material','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','saleUnit','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','origin','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemType','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','delivery','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemFarmingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemWrappingTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemLanguageTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemStemTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBaseTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBreederTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||
|
@ -1853,7 +1873,6 @@ 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');
|
||||
|
@ -2001,7 +2020,6 @@ 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');
|
||||
|
@ -2211,7 +2229,10 @@ 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 ('','bs','grafana','waste_addSales','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','saletracking_sectorcollectionaddprevok','PROCEDURE','alexm@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','saleSplit','PROCEDURE','carlosap@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_deleteAdded','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1128,6 +1128,28 @@ 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`
|
||||
|
@ -2432,11 +2454,21 @@ 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 */ ;
|
||||
|
@ -6554,6 +6586,9 @@ 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 */ ;
|
||||
|
@ -6654,11 +6689,11 @@ DELIMITER ;;
|
|||
AFTER INSERT ON `itemShelvingSale`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
|
||||
UPDATE sale s
|
||||
JOIN operator o ON o.workerFk = account.myUser_getId()
|
||||
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
|
||||
WHERE id = NEW.saleFk;
|
||||
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;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -9988,6 +10023,8 @@ DELIMITER ;;
|
|||
BEFORE INSERT ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
|
@ -10008,6 +10045,8 @@ DELIMITER ;;
|
|||
BEFORE UPDATE ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
|
@ -10678,6 +10717,15 @@ 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 */ ;
|
||||
|
@ -10698,6 +10746,15 @@ 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 */ ;
|
||||
|
@ -11469,4 +11526,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-10-03 7:43:14
|
||||
-- Dump completed on 2024-11-12 7:06:44
|
||||
|
|
|
@ -400,11 +400,11 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city
|
|||
(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, 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, 0, 'others','loses'),
|
||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 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');
|
||||
|
||||
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, 1, 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'), 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
|
||||
FROM `account`.`role` `r`
|
||||
WHERE `r`.`hasLogin` = 1;
|
||||
|
||||
|
@ -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`)
|
||||
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`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `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, 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, NULL),
|
||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, 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, 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, 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, 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, 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, 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, 2),
|
||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL),
|
||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL);
|
||||
|
||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `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, '');
|
||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, ''),
|
||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two'),
|
||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three'),
|
||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four'),
|
||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five'),
|
||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six'),
|
||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven'),
|
||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1,''),
|
||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, ''),
|
||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, ''),
|
||||
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 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', NULL, NULL, 'invoiceIn'),
|
||||
(1, 'Facturas Recibidas', 1, 1, 'invoiceIn'),
|
||||
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
||||
(3, 'Laboral', 37, 37, 'hhrrData'),
|
||||
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
||||
|
@ -2476,7 +2476,8 @@ 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');
|
||||
(23, 'Termografos', 35, 35, 'thermograph'),
|
||||
(24, 'Sello de calidad', 1, 1, 'qualitySeal');
|
||||
|
||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||
VALUES
|
||||
|
@ -2842,12 +2843,6 @@ 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
|
||||
|
@ -2960,9 +2955,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`)
|
||||
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`, `clientSelfConsumptionFk`, `addressSelfConsumptionFk`)
|
||||
VALUES
|
||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
|
||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600, 1112, 12);
|
||||
|
||||
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||
VALUES
|
||||
|
@ -3831,8 +3826,6 @@ 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);
|
||||
|
||||
|
@ -3840,9 +3833,6 @@ 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;
|
||||
|
@ -4018,4 +4008,24 @@ 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 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),
|
||||
(NULL, 1320);
|
||||
|
||||
INSERT IGNORE INTO vn.saySimpleConfig (url)
|
||||
VALUES ('saysimle-url-mock');
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
|||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||
AND t.warehouseInFk = vWarehouse
|
||||
AND s.name != 'INVENTARIO'
|
||||
AND NOT e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 e.isRaid
|
||||
AND tr.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
AND t.isDelivered
|
||||
UNION ALL
|
||||
SELECT m.itemFk, -m.quantity
|
||||
|
|
|
@ -9,45 +9,54 @@ 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 hedera.`order` o ON o.id = tmpOrder.orderFk;
|
||||
JOIN `order` o ON o.id = tmpOrder.orderFk;
|
||||
|
||||
CALL vn.addressTaxArea;
|
||||
CALL vn.addressTaxArea();
|
||||
|
||||
-- Calcula el IVA y el recargo desglosado.
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.orderTax;
|
||||
CREATE TEMPORARY TABLE tmp.orderTax
|
||||
(INDEX (orderFk))
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.orderTax
|
||||
(PRIMARY KEY (orderFk, code, rate))
|
||||
ENGINE = MEMORY
|
||||
SELECT o.id orderFk,
|
||||
WITH orders AS (
|
||||
SELECT tor.orderFk,
|
||||
oro.amount * oro.price total,
|
||||
s.countryFk,
|
||||
ata.areaFk,
|
||||
itc.taxClassFk
|
||||
FROM hedera.orderRow oro
|
||||
JOIN tmp.order tor ON tor.orderFk = oro.orderFk
|
||||
JOIN hedera.`order` o ON o.id = tor.orderFk
|
||||
JOIN vn.item i ON i.id = oro.itemFk
|
||||
JOIN vn.`client` c ON c.id = o.customer_id
|
||||
JOIN vn.supplier s ON s.id = o.company_id
|
||||
JOIN tmp.addressTaxArea ata ON ata.addressFk = o.address_id
|
||||
AND ata.companyFk = o.company_id
|
||||
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s.countryFk
|
||||
HAVING total
|
||||
)
|
||||
SELECT o.orderFk,
|
||||
tc.code,
|
||||
SUM(m.amount * m.price) taxableBase,
|
||||
SUM(o.total) taxableBase,
|
||||
pgc.rate
|
||||
FROM tmp.`order` tmpOrder
|
||||
JOIN `order` o ON o.id = tmpOrder.orderFk
|
||||
JOIN orderRow m ON m.orderFk = o.id
|
||||
JOIN vn.item i ON i.id = m.itemFk
|
||||
JOIN vn.`client` c ON c.id = o.customer_id
|
||||
JOIN vn.supplier s ON s.id = o.company_id
|
||||
JOIN tmp.addressTaxArea ata
|
||||
ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id
|
||||
JOIN vn.itemTaxCountry itc
|
||||
ON itc.itemFk = i.id AND itc.countryFk = s.countryFk
|
||||
JOIN vn.bookingPlanner bp
|
||||
ON bp.countryFk = s.countryFk
|
||||
AND bp.taxAreaFk = ata.areaFk
|
||||
AND bp.taxClassFk = itc.taxClassFk
|
||||
JOIN vn.pgc ON pgc.`code` = bp.pgcFk
|
||||
FROM orders o
|
||||
JOIN vn.bookingPlanner bp ON bp.countryFk = o.countryFk
|
||||
AND bp.taxAreaFk = o.areaFk
|
||||
AND bp.taxClassFk = o.taxClassFk
|
||||
JOIN vn.pgc ON pgc.code = bp.pgcFk
|
||||
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
|
||||
GROUP BY tmpOrder.orderFk, pgc.`code`, pgc.rate
|
||||
HAVING taxableBase != 0;
|
||||
GROUP BY o.orderFk, pgc.code, pgc.rate
|
||||
HAVING taxableBase
|
||||
ORDER BY bp.priority;
|
||||
|
||||
-- No poner create or replace, ya que da problemas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount;
|
||||
CREATE TEMPORARY TABLE tmp.orderAmount
|
||||
(INDEX (orderFk))
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
e.id entryFk,
|
||||
t.id travelFk,
|
||||
b.itemFk,
|
||||
e.isRaid,
|
||||
t.daysInForward,
|
||||
ADDTIME(t.shipped,
|
||||
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
||||
t.warehouseOutFk,
|
||||
|
@ -50,7 +50,7 @@ BEGIN
|
|||
itemFk,
|
||||
TIMESTAMPADD(DAY, life, @dated),
|
||||
quantity,
|
||||
IF(isIn, isReceived, isDelivered) AND !isRaid
|
||||
IF(isIn, isReceived, isDelivered) AND NOT daysInForward
|
||||
FROM tValues
|
||||
WHERE isIn OR !lessThanInventory;
|
||||
|
||||
|
@ -65,7 +65,7 @@ BEGIN
|
|||
itemFk,
|
||||
created,
|
||||
quantity,
|
||||
IF(isIn, isDelivered, isReceived) AND !isRaid
|
||||
IF(isIn, isDelivered, isReceived) AND NOT daysInForward
|
||||
FROM tValues
|
||||
WHERE !isIn OR !lessThanInventory;
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
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 ;
|
|
@ -1,8 +0,0 @@
|
|||
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 ;
|
|
@ -0,0 +1,31 @@
|
|||
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,23 +0,0 @@
|
|||
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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 ;
|
||||
|
|
|
@ -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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 SMALLINT,
|
||||
vWarehouseFk INT,
|
||||
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 `type` = 'day' AND dated < v3Months;
|
||||
DELETE FROM zoneEvent WHERE dated < v2Months OR ended < v2Months;
|
||||
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 e.isRaid;
|
||||
AND tr.daysInForward;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
|
|
|
@ -30,7 +30,9 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
w.id salesPersonFk,
|
||||
IFNULL(ob.description,'') observaciones,
|
||||
cc.rgb
|
||||
cc.rgb,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
FROM vn.ticket t
|
||||
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
|
||||
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
|
||||
|
@ -42,7 +44,10 @@ 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 observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
WHERE t.id = vParamFk
|
||||
AND t.shipped >= vYesterday
|
||||
UNION
|
||||
|
@ -52,7 +57,9 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
w.id salesPersonFk,
|
||||
ob.description,
|
||||
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`
|
||||
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
FROM vn.ticket t
|
||||
JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
|
||||
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
|
||||
|
@ -64,7 +71,10 @@ 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 observation ob ON ob.ticketFk = t.id
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
WHERE tc.collectionFk = vParamFk
|
||||
UNION
|
||||
SELECT sg.ticketFk,
|
||||
|
@ -73,7 +83,9 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
c.salesPersonFk,
|
||||
ob.description,
|
||||
NULL `rgb`
|
||||
NULL `rgb`,
|
||||
p.code parkingCode,
|
||||
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
|
||||
FROM vn.sectorCollection sc
|
||||
JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
||||
JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk
|
||||
|
@ -81,7 +93,10 @@ 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.client c ON c.id = t.clientFk
|
||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
|
||||
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
|
||||
WHERE sc.id = vParamFk
|
||||
AND t.shipped >= vYesterday
|
||||
GROUP BY ticketFk;
|
||||
|
|
|
@ -146,8 +146,6 @@ 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
|
||||
|
@ -158,7 +156,7 @@ BEGIN
|
|||
) sub ON sub.ticketFk = pb.ticketFk
|
||||
JOIN productionConfig pc
|
||||
WHERE pb.shipped <> util.VN_CURDATE()
|
||||
OR (pb.ubicacion IS NULL AND a.isOwn)
|
||||
OR pb.ubicacion IS NULL
|
||||
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
||||
OR pb.collectionH IS NOT NULL
|
||||
OR pb.collectionV IS NOT NULL
|
||||
|
|
|
@ -17,7 +17,6 @@ BEGIN
|
|||
supplierFk,
|
||||
dated,
|
||||
isExcludedFromAvailable,
|
||||
isRaid,
|
||||
commission,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
|
@ -28,7 +27,6 @@ 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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
AND (ti.visible OR ti.available)
|
||||
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ BEGIN
|
|||
a.nickname,
|
||||
sub2.itemPackingTypeConcat,
|
||||
est.code,
|
||||
es.isScanned
|
||||
es2.isScanned,
|
||||
es2.scanOrder
|
||||
FROM expedition e
|
||||
JOIN ticket t ON t.id = e.ticketFk
|
||||
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
||||
|
@ -38,6 +39,7 @@ 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$$
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
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 isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 isRaid
|
||||
AND NOT tr.daysInForward
|
||||
GROUP BY b.itemFk
|
||||
) sub
|
||||
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
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 ;
|
|
@ -7,9 +7,10 @@ BEGIN
|
|||
* @param vSelf matrícula del carro
|
||||
**/
|
||||
SELECT ish.itemFk item,
|
||||
IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description,
|
||||
i.name,
|
||||
i.longName,
|
||||
i.size,
|
||||
ish.visible,
|
||||
CEIL(ish.visible/ish.packing) stickers,
|
||||
ish.packing,
|
||||
ish.grouping,
|
||||
p.code,
|
||||
|
@ -17,7 +18,8 @@ BEGIN
|
|||
s.priority,
|
||||
ish.isChecked,
|
||||
ic.url,
|
||||
ish.available
|
||||
ish.available,
|
||||
ish.buyFk
|
||||
FROM itemShelving ish
|
||||
JOIN item i ON i.id = ish.itemFk
|
||||
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci
|
||||
|
|
|
@ -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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
),
|
||||
entriesOut AS (
|
||||
SELECT 'entry',
|
||||
|
@ -95,7 +95,7 @@ BEGIN
|
|||
AND b.itemFk = vItemFk
|
||||
AND NOT e.isExcludedFromAvailable
|
||||
AND NOT w.isFeedStock
|
||||
AND NOT e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
),
|
||||
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,7 +42,6 @@ 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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT t.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 e.isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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 isRaid
|
||||
AND NOT tr.daysInForward
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
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 ;
|
|
@ -1,21 +0,0 @@
|
|||
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 ;
|
|
@ -1,38 +0,0 @@
|
|||
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 ;
|
|
@ -1,16 +0,0 @@
|
|||
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 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 ;
|
||||
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.daysInForward
|
||||
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.daysInForward
|
||||
) 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.daysInForward
|
||||
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.daysInForward
|
||||
) 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 ;
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
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 ;
|
|
@ -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) < s.quantity
|
||||
AND IFNULL(av.available, 0) < 0
|
||||
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) >= s.quantity
|
||||
AND IFNULL(av.available, 0) >= 0
|
||||
AND IFNULL(issw.visible, 0) < s.quantity
|
||||
AND s.quantity > 0
|
||||
AND NOT s.isPicked
|
||||
|
|
|
@ -7,13 +7,13 @@ proc: BEGIN
|
|||
* Calculate the stock of the auction warehouse from the inventory date to vDated
|
||||
* without taking into account the outputs of the same day vDated
|
||||
*
|
||||
* @param vDated Date to calculate the stock.
|
||||
* @param vDated Date to calculate the stock
|
||||
*/
|
||||
IF vDated < util.VN_CURDATE() THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tStockBought
|
||||
CREATE OR REPLACE TEMPORARY TABLE tCurrentData
|
||||
SELECT workerFk, reserve
|
||||
FROM stockBought
|
||||
WHERE dated = vDated
|
||||
|
@ -21,15 +21,28 @@ proc: BEGIN
|
|||
|
||||
DELETE FROM stockBought WHERE dated = vDated;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tStockSold
|
||||
SELECT it.workerFk,
|
||||
SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000) sold
|
||||
FROM itemTicketOut ito
|
||||
JOIN item i ON i.id = ito.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN ticket t ON t.id = ito.ticketFk
|
||||
JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
JOIN itemCost ic ON ic.itemFk = ito.itemFk
|
||||
AND ic.warehouseFk = t.warehouseFk
|
||||
JOIN volumeConfig vc
|
||||
WHERE ito.shipped BETWEEN vDated AND util.dayEnd(vDated)
|
||||
AND wh.code = 'VNH'
|
||||
GROUP BY it.workerFk;
|
||||
|
||||
CALL item_calculateStock(vDated);
|
||||
|
||||
INSERT INTO stockBought(workerFk, bought, dated)
|
||||
CREATE OR REPLACE TEMPORARY TABLE tStockBought
|
||||
SELECT it.workerFk,
|
||||
ROUND(SUM(
|
||||
(ti.quantity / b.packing) *
|
||||
buy_getVolume(b.id)
|
||||
) / vc.palletM3 / 1000000, 1) bought,
|
||||
vDated
|
||||
SUM((ti.quantity / b.packing) *
|
||||
buy_getVolume(b.id)
|
||||
) / vc.palletM3 / 1000000 bought
|
||||
FROM itemType it
|
||||
JOIN item i ON i.typeFk = it.id
|
||||
LEFT JOIN tmp.item ti ON ti.itemFk = i.id
|
||||
|
@ -43,20 +56,33 @@ proc: BEGIN
|
|||
GROUP BY it.workerFk
|
||||
HAVING bought;
|
||||
|
||||
|
||||
INSERT INTO stockBought(workerFk, bought, dated)
|
||||
SELECT tb.workerFk,
|
||||
ROUND(GREATEST(tb.bought - IFNULL(ts.sold, 0), 0), 1),
|
||||
vDated
|
||||
FROM tStockBought tb
|
||||
LEFT JOIN tStockSold ts ON ts.workerFk = tb.workerFk;
|
||||
|
||||
UPDATE stockBought s
|
||||
JOIN tStockBought ts ON ts.workerFk = s.workerFk
|
||||
JOIN tCurrentData ts ON ts.workerFk = s.workerFk
|
||||
SET s.reserve = ts.reserve
|
||||
WHERE s.dated = vDated;
|
||||
|
||||
INSERT INTO stockBought (workerFk, reserve, dated)
|
||||
SELECT ts.workerFk, ts.reserve, vDated
|
||||
FROM tStockBought ts
|
||||
FROM tCurrentData ts
|
||||
WHERE ts.workerFk NOT IN (
|
||||
SELECT workerFk
|
||||
FROM stockBought
|
||||
WHERE dated = vDated
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE tStockBought, tmp.item, tmp.buyUltimate;
|
||||
UPDATE stockBought s
|
||||
JOIN tStockSold ts ON ts.workerFk = s.workerFk
|
||||
SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0)
|
||||
WHERE s.dated = vDated;
|
||||
|
||||
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBuyedByWorker`(
|
||||
vDated DATE,
|
||||
vWorker INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Inserta el volumen de compra de un comprador
|
||||
* en stockBuyed de acuerdo con la fecha.
|
||||
*
|
||||
* @param vDated Fecha de compra
|
||||
* @param vWorker Id de trabajador
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
|
||||
(INDEX (userFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT requested, reserved, userFk
|
||||
FROM stockBuyed
|
||||
WHERE dated = vDated
|
||||
AND userFk = vWorker;
|
||||
|
||||
DELETE FROM stockBuyed
|
||||
WHERE dated = vDated
|
||||
AND userFk = vWorker;
|
||||
|
||||
CALL item_calculateStock(vDated);
|
||||
|
||||
INSERT INTO stockBuyed(userFk, buyed, `dated`, reserved, requested, description)
|
||||
SELECT it.workerFk,
|
||||
SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
|
||||
vDated,
|
||||
sb.reserved,
|
||||
sb.requested,
|
||||
u.name
|
||||
FROM itemType it
|
||||
JOIN item i ON i.typeFk = it.id
|
||||
LEFT JOIN tmp.item ti ON ti.itemFk = i.id
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
JOIN warehouse wh ON wh.code = 'VNH'
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||
AND bu.warehouseFk = wh.id
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
JOIN volumeConfig vc
|
||||
JOIN account.`user` u ON u.id = it.workerFk
|
||||
LEFT JOIN tStockBuyed sb ON sb.userFk = it.workerFk
|
||||
WHERE ic.display
|
||||
AND it.workerFk = vWorker;
|
||||
|
||||
SELECT b.entryFk Id_Entrada,
|
||||
i.id Id_Article,
|
||||
i.name Article,
|
||||
ti.quantity Cantidad,
|
||||
(ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
|
||||
/ (vc.trolleyM3 * 1000000) buyed,
|
||||
b.packagingFk id_cubo,
|
||||
b.packing
|
||||
FROM tmp.item ti
|
||||
JOIN item i ON i.id = ti.itemFk
|
||||
JOIN itemType it ON i.typeFk = it.id
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
JOIN worker w ON w.id = it.workerFk
|
||||
JOIN auctionConfig ac
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||
AND bu.warehouseFk = ac.warehouseFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
JOIN volumeConfig vc
|
||||
WHERE ic.display
|
||||
AND w.id = vWorker;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate,
|
||||
tmp.item,
|
||||
tStockBuyed;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,70 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBuyed_add`(
|
||||
vDated DATE
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Inserta el volumen de compra por comprador
|
||||
* en stockBuyed de acuerdo con la fecha.
|
||||
*
|
||||
* @param vDated Fecha de compra
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
|
||||
(INDEX (userFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT requested, reserved, userFk
|
||||
FROM stockBuyed
|
||||
WHERE dated = vDated;
|
||||
|
||||
DELETE FROM stockBuyed WHERE dated = vDated;
|
||||
|
||||
CALL item_calculateStock(vDated);
|
||||
|
||||
INSERT INTO stockBuyed(userFk, buyed, `dated`, description)
|
||||
SELECT it.workerFk,
|
||||
SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
|
||||
vDated,
|
||||
u.name
|
||||
FROM itemType it
|
||||
JOIN item i ON i.typeFk = it.id
|
||||
LEFT JOIN tmp.item ti ON ti.itemFk = i.id
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
JOIN warehouse wh ON wh.code = 'VNH'
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
JOIN volumeConfig vc
|
||||
JOIN account.`user` u ON u.id = it.workerFk
|
||||
JOIN workerDepartment wd ON wd.workerFk = u.id
|
||||
JOIN department d ON d.id = wd.departmentFk
|
||||
WHERE ic.display
|
||||
AND d.code IN ('shopping', 'logistic', 'franceTeam')
|
||||
GROUP BY it.workerFk;
|
||||
|
||||
INSERT INTO stockBuyed(buyed, dated, description)
|
||||
SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
|
||||
vDated,
|
||||
IF(c.code = 'ES', p.name, c.name) destiny
|
||||
FROM itemTicketOut ito
|
||||
JOIN ticket t ON t.id = ito.ticketFk
|
||||
JOIN `address` a ON a.id = t.addressFk
|
||||
JOIN province p ON p.id = a.provinceFk
|
||||
JOIN country c ON c.id = p.countryFk
|
||||
JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
JOIN itemCost ic ON ic.itemFk = ito.itemFk
|
||||
AND ic.warehouseFk = t.warehouseFk
|
||||
JOIN volumeConfig vc
|
||||
WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated)
|
||||
AND wh.code = 'VNH'
|
||||
GROUP BY destiny;
|
||||
|
||||
UPDATE stockBuyed s
|
||||
JOIN tStockBuyed ts ON ts.userFk = s.userFk
|
||||
SET s.requested = ts.requested,
|
||||
s.reserved = ts.reserved
|
||||
WHERE s.dated = vDated;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate,
|
||||
tmp.item,
|
||||
tStockBuyed;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -3,87 +3,124 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitItemPacki
|
|||
vSelf INT,
|
||||
vOriginalItemPackingTypeFk VARCHAR(1)
|
||||
)
|
||||
proc:BEGIN
|
||||
BEGIN
|
||||
/**
|
||||
* Clona y reparte las líneas de ventas de un ticket en funcion del tipo de empaquetado.
|
||||
* Respeta el id de ticket original para el tipo de empaquetado propuesto.
|
||||
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado.
|
||||
* Respeta el id inicial para el tipo propuesto.
|
||||
*
|
||||
* @param vSelf Id ticket
|
||||
* @param vOriginalItemPackingTypeFk Tipo empaquetado que se mantiene el ticket original
|
||||
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
|
||||
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
*/
|
||||
DECLARE vDone INT DEFAULT FALSE;
|
||||
DECLARE vHasItemPackingType BOOL;
|
||||
DECLARE vItemPackingTypeFk INT;
|
||||
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
|
||||
DECLARE vNewTicketFk INT;
|
||||
DECLARE vPackingTypesToSplit INT;
|
||||
DECLARE vDone INT DEFAULT FALSE;
|
||||
|
||||
DECLARE vItemPackingTypes CURSOR FOR
|
||||
SELECT DISTINCT itemPackingTypeFk
|
||||
FROM tSalesToMove;
|
||||
DECLARE vSaleGroup CURSOR FOR
|
||||
SELECT itemPackingTypeFk
|
||||
FROM tSaleGroup
|
||||
WHERE itemPackingTypeFk IS NOT NULL
|
||||
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT COUNT(*) INTO vHasItemPackingType
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
WHERE t.id = vSelf
|
||||
AND i.itemPackingTypeFk = vOriginalItemPackingTypeFk;
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT id
|
||||
FROM sale
|
||||
WHERE ticketFk = vSelf
|
||||
AND NOT quantity
|
||||
FOR UPDATE;
|
||||
|
||||
DELETE FROM sale
|
||||
WHERE NOT quantity
|
||||
AND ticketFk = vSelf;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tSale
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT s.id, i.itemPackingTypeFk, IFNULL(sv.litros, 0) litros
|
||||
FROM sale s
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
LEFT JOIN saleVolume sv ON sv.saleFk = s.id
|
||||
WHERE s.ticketFk = vSelf;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tSaleGroup
|
||||
ENGINE = MEMORY
|
||||
SELECT itemPackingTypeFk, SUM(litros) totalLitros
|
||||
FROM tSale
|
||||
GROUP BY itemPackingTypeFk;
|
||||
|
||||
SELECT COUNT(*) INTO vPackingTypesToSplit
|
||||
FROM tSaleGroup
|
||||
WHERE itemPackingTypeFk IS NOT NULL;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
|
||||
ticketFk INT,
|
||||
itemPackingTypeFk VARCHAR(1)
|
||||
) ENGINE=MEMORY
|
||||
SELECT vSelf ticketFk, vOriginalItemPackingTypeFk itemPackingTypeFk;
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
IF NOT vHasItemPackingType THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
CASE vPackingTypesToSplit
|
||||
WHEN 0 THEN
|
||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
VALUES(vSelf, vItemPackingTypeFk);
|
||||
WHEN 1 THEN
|
||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
SELECT vSelf, itemPackingTypeFk
|
||||
FROM tSaleGroup
|
||||
WHERE itemPackingTypeFk IS NOT NULL;
|
||||
ELSE
|
||||
OPEN vSaleGroup;
|
||||
FETCH vSaleGroup INTO vItemPackingTypeFk;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tSalesToMove (
|
||||
ticketFk INT,
|
||||
saleFk INT,
|
||||
itemPackingTypeFk INT
|
||||
) ENGINE=MEMORY;
|
||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
VALUES(vSelf, vItemPackingTypeFk);
|
||||
|
||||
INSERT INTO tSalesToMove (saleFk, itemPackingTypeFk)
|
||||
SELECT s.id, i.itemPackingTypeFk
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
WHERE t.id = vSelf
|
||||
AND i.itemPackingTypeFk <> vOriginalItemPackingTypeFk;
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vSaleGroup INTO vItemPackingTypeFk;
|
||||
|
||||
OPEN vItemPackingTypes;
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vItemPackingTypes INTO vItemPackingTypeFk;
|
||||
CALL ticket_Clone(vSelf, vNewTicketFk);
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
|
||||
VALUES(vNewTicketFk, vItemPackingTypeFk);
|
||||
END LOOP;
|
||||
|
||||
CALL ticket_Clone(vSelf, vNewTicketFk);
|
||||
CLOSE vSaleGroup;
|
||||
|
||||
UPDATE tSalesToMove
|
||||
SET ticketFk = vNewTicketFk
|
||||
WHERE itemPackingTypeFk = vItemPackingTypeFk;
|
||||
SELECT s.id
|
||||
FROM sale s
|
||||
JOIN tSale ts ON ts.id = s.id
|
||||
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
|
||||
FOR UPDATE;
|
||||
|
||||
END LOOP;
|
||||
UPDATE sale s
|
||||
JOIN tSale ts ON ts.id = s.id
|
||||
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
|
||||
SET s.ticketFk = t.ticketFk;
|
||||
|
||||
CLOSE vItemPackingTypes;
|
||||
SELECT itemPackingTypeFk INTO vItemPackingTypeFk
|
||||
FROM tSaleGroup sg
|
||||
WHERE sg.itemPackingTypeFk IS NOT NULL
|
||||
ORDER BY sg.itemPackingTypeFk
|
||||
LIMIT 1;
|
||||
|
||||
UPDATE sale s
|
||||
JOIN tSalesToMove stm ON stm.saleFk = s.id
|
||||
SET s.ticketFk = stm.ticketFk
|
||||
WHERE stm.ticketFk;
|
||||
UPDATE sale s
|
||||
JOIN tSale ts ON ts.id = s.id
|
||||
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
|
||||
SET s.ticketFk = t.ticketFk
|
||||
WHERE ts.itemPackingTypeFk IS NULL;
|
||||
END CASE;
|
||||
|
||||
INSERT INTO tmp.ticketIPT (ticketFk, itemPackingTypeFk)
|
||||
SELECT ticketFk, itemPackingTypeFk
|
||||
FROM tSalesToMove
|
||||
GROUP BY ticketFk;
|
||||
COMMIT;
|
||||
|
||||
DROP TEMPORARY TABLE tSalesToMove;
|
||||
DROP TEMPORARY TABLE
|
||||
tSale,
|
||||
tSaleGroup;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
|||
JOIN vn.entry e ON e.travelFk = tr.id
|
||||
JOIN vn.buy b ON b.entryFk = e.id
|
||||
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
||||
AND e.isRaid = FALSE
|
||||
AND NOT tr.daysInForward
|
||||
AND tr.warehouseInFk = vWarehouseFk
|
||||
GROUP BY tr.landed , a.name ;
|
||||
END$$
|
||||
|
|
|
@ -62,7 +62,7 @@ BEGIN
|
|||
END IF;
|
||||
|
||||
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||
|
||||
SELECT evaNotes INTO vEvaNotes
|
||||
FROM entry
|
||||
|
@ -71,6 +71,8 @@ BEGIN
|
|||
UPDATE entry
|
||||
SET evaNotes = vEvaNotes
|
||||
WHERE id = vNewEntryFk;
|
||||
|
||||
CALL buy_recalcPricesByEntry(vNewEntryFk);
|
||||
END LOOP;
|
||||
|
||||
SET @isModeInventory = FALSE;
|
||||
|
|
|
@ -1,72 +1,68 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
|
||||
BEGIN
|
||||
|
||||
/*
|
||||
* Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores
|
||||
/**
|
||||
* Desplaza los travels en el futuro y avisa a los compradores
|
||||
*
|
||||
*/
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vWorkerName VARCHAR(50);
|
||||
DECLARE vRaid TEXT;
|
||||
DECLARE vWorker VARCHAR(50) DEFAULT '';
|
||||
DECLARE vBuyerEmail VARCHAR(40);
|
||||
DECLARE vTravelLink TEXT;
|
||||
DECLARE vMailBody TEXT DEFAULT '';
|
||||
|
||||
DECLARE vCur CURSOR FOR
|
||||
SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'),
|
||||
u.name
|
||||
FROM tmp.travel ttr
|
||||
JOIN entry e ON e.travelFk = ttr.id
|
||||
SELECT GROUP_CONCAT(DISTINCT
|
||||
CONCAT('https://salix.verdnatura.es/#!/travel/',
|
||||
ttm.travelFk,
|
||||
'/summary ')
|
||||
ORDER BY ttm.travelFk SEPARATOR '\n\r') travelLink,
|
||||
CONCAT(u.name, '@verdnatura.es') buyerEmail
|
||||
FROM tTravelToMove ttm
|
||||
JOIN entry e ON e.travelFk = ttm.travelFk
|
||||
JOIN buy b ON b.entryFk = e.id
|
||||
JOIN item i ON i.id = b.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN account.user u ON u.id = it.workerFk
|
||||
GROUP BY u.name;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.travel;
|
||||
CREATE TEMPORARY TABLE tmp.travel
|
||||
SELECT tr.id,tr.landed
|
||||
FROM travel tr
|
||||
JOIN entry e ON e.travelFk = tr.id
|
||||
WHERE tr.landed = util.tomorrow()
|
||||
AND e.isRaid
|
||||
GROUP BY tr.id;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTravelToMove
|
||||
SELECT id travelFk,
|
||||
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
||||
FROM travel
|
||||
WHERE daysInForward;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
UPDATE travel tr
|
||||
JOIN tmp.travel ttr ON ttr.id = tr.id
|
||||
SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed);
|
||||
JOIN tTravelToMove ttm ON ttm.travelFk = tr.id
|
||||
SET tr.landed = ttm.newLanded;
|
||||
|
||||
OPEN vCur;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vCur INTO vRaid, vWorkerName;
|
||||
FETCH vCur INTO vTravelLink, vBuyerEmail;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'),
|
||||
'noreply@verdnatura.es',
|
||||
'Cambio de fecha en Redadas',
|
||||
CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid)
|
||||
);
|
||||
|
||||
CALL `vn`.`mail_insert`(
|
||||
vBuyerEmail,
|
||||
'noreply@verdnatura.es',
|
||||
'Cambio de fecha en Redadas',
|
||||
CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink));
|
||||
END LOOP;
|
||||
CLOSE vCur;
|
||||
COMMIT;
|
||||
DROP TEMPORARY TABLE tmp.travel;
|
||||
|
||||
DROP TEMPORARY TABLE tTravelToMove;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
|
|||
BEFORE UPDATE ON `entry`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vIsVirtual BOOL;
|
||||
DECLARE vDaysInForward INT;
|
||||
DECLARE vPrintedCount INT;
|
||||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
DECLARE vTotalBuy INT;
|
||||
|
@ -37,18 +37,20 @@ BEGIN
|
|||
IF NEW.travelFk IS NOT NULL THEN
|
||||
CALL travel_throwAwb(NEW.travelFk);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vIsVirtual
|
||||
FROM entryVirtual WHERE entryFk = NEW.id;
|
||||
|
||||
SELECT daysInForward INTO vDaysInForward
|
||||
FROM travel t
|
||||
JOIN entry e ON e.travelFk = t.id
|
||||
WHERE entryFk = NEW.id;
|
||||
|
||||
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
||||
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
||||
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
||||
INTO vHasDistinctWarehouses
|
||||
FROM travel o, travel n
|
||||
WHERE o.id = OLD.travelFk
|
||||
AND n.id = NEW.travelFk;
|
||||
|
||||
IF vIsVirtual AND vHasDistinctWarehouses THEN
|
||||
IF vDaysInForward AND vHasDistinctWarehouses THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
|
||||
END IF;
|
||||
|
@ -71,7 +73,7 @@ BEGIN
|
|||
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk)
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk)
|
||||
OR NOT (NEW.currencyFk <=> OLD.currencyFk)
|
||||
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ BEGIN
|
|||
SET packages = (SELECT COUNT(counter)-1
|
||||
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk)
|
||||
WHERE t.id = OLD.ticketFk;
|
||||
|
||||
|
||||
CALL expedition_selfConsumptionPackaging(OLD.id, 'remove');
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_afterDelete`
|
||||
AFTER DELETE ON `itemType`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO itemTypeLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'ItemType',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeInsert`
|
||||
BEFORE INSERT ON `itemType`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeUpdate`
|
|||
BEFORE UPDATE ON `itemType`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
IF NEW.itemPackingTypeFk = '' THEN
|
||||
|
||||
SET NEW.itemPackingTypeFk = NULL;
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_afterD
|
|||
AFTER DELETE ON `productionConfig`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO productionConfig
|
||||
INSERT INTO productionConfigLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'ProductionConfig',
|
||||
`changedModelId` = OLD.id,
|
||||
|
|
|
@ -6,7 +6,7 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
|
|||
`b`.`itemFk` AS `itemFk`,
|
||||
`b`.`quantity` AS `quantity`,
|
||||
`t`.`isReceived` AS `isReceived`,
|
||||
`e`.`isRaid` AS `isVirtualStock`,
|
||||
`t`.`daysInForward` AS `isVirtualStock`,
|
||||
`e`.`id` AS `entryFk`
|
||||
FROM (
|
||||
(
|
||||
|
|
|
@ -15,5 +15,5 @@ FROM (
|
|||
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
|
||||
)
|
||||
WHERE `e`.`isExcludedFromAvailable` = 0
|
||||
AND `e`.`isRaid` = 0
|
||||
AND NOT `t`.`daysInForward`
|
||||
AND `b`.`quantity` <> 0
|
||||
|
|
|
@ -31,5 +31,5 @@ FROM (
|
|||
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
|
||||
)
|
||||
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
|
||||
AND `e`.`isRaid` = 0
|
||||
AND NOT `tr`.`daysInForward`
|
||||
AND `b`.`stickers` > 0
|
||||
|
|
|
@ -10,11 +10,10 @@ FROM (
|
|||
`vn`.`collection` `c`
|
||||
JOIN `vn`.`client` `cl` ON(`cl`.`id` = `c`.`workerFk`)
|
||||
)
|
||||
LEFT JOIN `vn`.`machineWorker` `mw` ON(
|
||||
`mw`.`workerFk` = `c`.`workerFk`
|
||||
AND `mw`.`inTimed` > `util`.`VN_CURDATE`()
|
||||
JOIN `vn`.`operator` `o` ON(
|
||||
`o`.`workerFk` = `c`.`workerFk`
|
||||
)
|
||||
)
|
||||
WHERE `c`.`created` > `util`.`VN_CURDATE`()
|
||||
AND `mw`.`workerFk` IS NULL
|
||||
AND `o`.`machineFk` IS NULL
|
||||
GROUP BY `c`.`workerFk`
|
||||
|
|
|
@ -8,7 +8,6 @@ AS SELECT `e`.`id` AS `Id_Entrada`,
|
|||
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
||||
`e`.`isConfirmed` AS `Confirmada`,
|
||||
`e`.`isOrdered` AS `Pedida`,
|
||||
`e`.`isRaid` AS `Redada`,
|
||||
`e`.`commission` AS `comision`,
|
||||
`e`.`created` AS `odbc_date`,
|
||||
`e`.`evaNotes` AS `Notas_Eva`,
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn2008`.`Entradas_Auto`
|
||||
AS SELECT `ev`.`entryFk` AS `Id_Entrada`
|
||||
FROM `vn`.`entryVirtual` `ev`
|
|
@ -8,7 +8,7 @@ AS SELECT `e`.`gestDocFk` AS `gestdoc_id`,
|
|||
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
||||
`e`.`isConfirmed` AS `Confirmada`,
|
||||
`e`.`isOrdered` AS `Pedida`,
|
||||
`e`.`isRaid` AS `Redada`,
|
||||
`tr`.`daysInForward` AS `daysInForward`,
|
||||
`e`.`evaNotes` AS `notas`,
|
||||
`e`.`supplierFk` AS `Id_Proveedor`,
|
||||
`tr`.`shipped` AS `shipment`,
|
||||
|
|
|
@ -17,5 +17,6 @@ AS SELECT `t`.`id` AS `id`,
|
|||
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
||||
`t`.`totalEntries` AS `totalEntries`,
|
||||
`t`.`appointment` AS `appointment`,
|
||||
`t`.`awbFk` AS `awbFk`
|
||||
`t`.`awbFk` AS `awbFk`,
|
||||
`t`.`daysInForward` AS `daysInForward`
|
||||
FROM `vn`.`travel` `t`
|
||||
|
|
|
@ -28,7 +28,6 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`,
|
|||
`E`.`Id_Proveedor` AS `Id_Proveedor`,
|
||||
`E`.`Fecha` AS `Fecha`,
|
||||
`E`.`Confirmada` AS `Confirmada`,
|
||||
`E`.`Redada` AS `Redada`,
|
||||
`E`.`empresa_id` AS `empresa_id`,
|
||||
`E`.`travel_id` AS `travel_id`,
|
||||
`E`.`Pedida` AS `Pedida`,
|
||||
|
@ -85,6 +84,6 @@ FROM (
|
|||
)
|
||||
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
|
||||
)
|
||||
WHERE `W_IN`.`isFeedStock` = 0
|
||||
AND `E`.`Inventario` = 0
|
||||
AND `E`.`Redada` = 0
|
||||
WHERE NOT `W_IN`.`isFeedStock`
|
||||
AND NOT `E`.`Inventario`
|
||||
AND NOT `TR`.`daysInForward`
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE vn.autonomy MODIFY COLUMN isUeeMember tinyint(1) DEFAULT FALSE NOT NULL;
|
|
@ -0,0 +1,27 @@
|
|||
ALTER TABLE vn.itemType
|
||||
ADD editorFk int(10) unsigned DEFAULT NULL NULL,
|
||||
ADD CONSTRAINT itemType_user_FK FOREIGN KEY (editorFk) REFERENCES account.`user`(id);
|
||||
|
||||
CREATE TABLE `vn`.`itemTypeLog` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`originFk` int(11) DEFAULT NULL,
|
||||
`userFk` int(10) unsigned DEFAULT NULL,
|
||||
`action` set('insert','update','delete') NOT NULL,
|
||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`changedModel` enum('ItemType') NOT NULL DEFAULT 'ItemType',
|
||||
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||
`changedModelId` int(11) NOT NULL,
|
||||
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||
`summaryId` varchar(30) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `itemTypeLogUserFk_idx` (`userFk`),
|
||||
KEY `itemTypeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||
KEY `itemTypeLog_originFk` (`originFk`,`creationDate`),
|
||||
KEY `itemTypeLog_creationDate_IDX` (`creationDate` DESC) USING BTREE,
|
||||
CONSTRAINT `itemTypeLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
|
||||
|
||||
INSERT IGNORE INTO salix.ACL (model,property,principalId)
|
||||
VALUES ('ItemTypeLog','find','employee');
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE vn.itemType
|
||||
ADD CONSTRAINT itemType_itemPackingType_FK FOREIGN KEY (itemPackingTypeFk)
|
||||
REFERENCES vn.itemPackingType(code) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,25 @@
|
|||
CREATE TABLE IF NOT EXISTS `vn`.`itemCampaign` (
|
||||
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
dated date NOT NULL,
|
||||
itemFk int(11) NOT NULL,
|
||||
quantity decimal(10,2) NOT NULL,
|
||||
total decimal(10,2) NOT NULL,
|
||||
campaign varchar(100) NOT NULL,
|
||||
UNIQUE KEY `itemCampaign_UNIQUE` (`dated`,`itemFk`),
|
||||
CONSTRAINT itemCampaign_item_FK FOREIGN KEY (itemFk) REFERENCES vn.item(id) ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
)
|
||||
ENGINE=InnoDB
|
||||
DEFAULT CHARSET=utf8mb3
|
||||
COLLATE=utf8mb3_unicode_ci
|
||||
COMMENT='Tallos confirmados por día en los días de más producción de una campaña. La tabla está pensada para que sea una foto.';
|
||||
|
||||
ALTER TABLE vn.campaign
|
||||
ADD previousDays int(10) unsigned DEFAULT 30 NOT NULL COMMENT 'Días previos para calcular e insertar en la tabla itemCampaign';
|
||||
|
||||
UPDATE vn.campaign
|
||||
SET previousDays = 90
|
||||
WHERE code = 'allSaints';
|
||||
|
||||
UPDATE vn.campaign
|
||||
SET previousDays = 60
|
||||
WHERE code IN ('valentinesDay', 'mothersDay');
|
|
@ -0,0 +1,3 @@
|
|||
DELETE FROM salix.ACL
|
||||
WHERE property = 'labelPdf'
|
||||
AND model = 'Item';
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE vn.travel ADD IF NOT EXISTS daysInForward INT UNSIGNED DEFAULT 0 NOT NULL
|
||||
COMMENT 'Indica que sus entradas son redadas: 0 significa que no es un travel de redadas, y un valor distinto a 0 indica el número de días para el landed respecto a hoy';
|
||||
|
||||
ALTER TABLE vn.entry CHANGE isRaid isRaid_ tinyint(1) DEFAULT 0 NOT NULL COMMENT '@deprecated 2024-11-05';
|
||||
|
||||
RENAME TABLE vn.entryVirtual TO vn.entryVirtual__;
|
||||
ALTER TABLE vn.entryVirtual__ COMMENT='@deprecated 2024-11-05';
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
USE vn;
|
||||
RENAME TABLE machineWorker TO machineWorker__;
|
||||
ALTER TABLE machineWorker__ COMMENT = '@deprecated 2024-10-23 not used';
|
||||
|
||||
RENAME TABLE machineWorkerConfig TO machineWorkerConfig__;
|
||||
ALTER TABLE machineWorkerConfig__ COMMENT = '@deprecated 2024-10-23 not used';
|
||||
|
||||
DELETE FROM salix.ACL WHERE model = 'MachineWorker';
|
|
@ -0,0 +1,3 @@
|
|||
USE vn;
|
||||
|
||||
ALTER TABLE vn.expeditionState ADD scanOrder int(11) DEFAULT NULL NULL COMMENT 'Indica la posición al cargar la furgoneta';
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO vn.report (name, `method`)
|
||||
VALUES ('LabelItemBarcode','Items/{id}/label-barcode-pdf'),
|
||||
('LabelItemQr','Items/{id}/label-qr-pdf');
|
|
@ -0,0 +1,71 @@
|
|||
CREATE TABLE IF NOT EXISTS `vn`.`itemTextureTag` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name_UNIQUE` (`name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
|
||||
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y encerado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y esponjoso');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y foam');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y látex');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Arenosa');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Aterciopelado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Engomado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Flocado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Foam');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Gasa');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Goma');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Látex');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Latón');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Mate');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Metálico');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y engomado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado y engomado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado y rugoso');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Pluma');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plástico');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plástico engomado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Poliéster');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Poliéster texturizado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Rugoso');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Rígido');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Seminatural');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Silicona');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Suave');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela con brillo');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela con texturas');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela dura');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela engomada');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela escarchada');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela flocada');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela flocada engomada');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela foam');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela micro peach');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela plastificada');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela plástico engomado');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela poliéster');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela PVC');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela ratan');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rigida');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rugosa');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rústica');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela sintética');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y cristal');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y foam');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y goma');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y látex');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y madera');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y plástico');
|
||||
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y seco');
|
||||
|
||||
UPDATE vn.tag
|
||||
SET isFree=0,
|
||||
sourceTable='itemTextureTag'
|
||||
WHERE name= 'Textura';
|
||||
|
||||
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemTextureTag TO logisticAssist;
|
|
@ -0,0 +1,7 @@
|
|||
UPDATE salix.ACL
|
||||
SET property='buyLabelSupplier'
|
||||
WHERE property = 'buyLabel'
|
||||
AND model = 'Entry';
|
||||
|
||||
INSERT IGNORE INTO salix.ACL (model,property,principalId)
|
||||
VALUES ('Entry','buyLabel','employee');
|
|
@ -0,0 +1,7 @@
|
|||
DELETE FROM vn.report
|
||||
WHERE `name` = 'LabelItemQr';
|
||||
|
||||
UPDATE vn.report
|
||||
SET `method` = 'Entries/{id}/{labelType}/buy-label',
|
||||
`name` = 'LabelBuy'
|
||||
WHERE `name` = 'LabelItemBarcode';
|
|
@ -0,0 +1,16 @@
|
|||
CREATE TABLE IF NOT EXISTS vn.saySimpleCountry(
|
||||
countryFk MEDIUMINT(8) UNSIGNED,
|
||||
channel INT(4) COMMENT 'channel de whatsapp de saySimple',
|
||||
PRIMARY KEY (countryFk),
|
||||
CONSTRAINT `saySimpleCountry_FK` FOREIGN KEY (`countryFk`) REFERENCES vn.country (`id`) ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vn.saySimpleConfig(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
url VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
||||
VALUES (19, 1169),
|
||||
(8, 1183),
|
||||
(NULL, 1320);
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.supplier ADD companySize ENUM('small', 'medium', 'big') NULL;
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.productionConfig DROP COLUMN hasNewLabelMrwMethod;
|
|
@ -0,0 +1,2 @@
|
|||
-- Place your SQL code here
|
||||
RENAME TABLE vn.stockBuyed__ TO vn.stockBuyed;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.dua ADD comment TEXT DEFAULT NULL NULL;
|
|
@ -70,10 +70,18 @@ export default class App {
|
|||
|
||||
if (this.logger.$params.q) {
|
||||
let tableValue = this.logger.$params.q;
|
||||
const q = JSON.parse(tableValue);
|
||||
if (typeof q === 'number')
|
||||
tableValue = JSON.stringify({id: tableValue});
|
||||
newRoute = newRoute.concat(`?table=${tableValue}`);
|
||||
if (Array.isArray(tableValue)) {
|
||||
const [key, param1, param2] = tableValue;
|
||||
const payload = key === 'createForm'
|
||||
? {[param1]: param2}
|
||||
: {[key]: param1};
|
||||
newRoute += `?${key}=${JSON.stringify(payload)}`;
|
||||
} else {
|
||||
const q = JSON.parse(tableValue);
|
||||
if (typeof q === 'number')
|
||||
tableValue = JSON.stringify({id: tableValue});
|
||||
newRoute = newRoute.concat(`?table=${tableValue}`);
|
||||
}
|
||||
} else if (!hasId && this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
|
||||
newRoute = newRoute.concat(`${this.logger.$params.id}`);
|
||||
|
||||
|
|
|
@ -241,7 +241,8 @@
|
|||
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
||||
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
||||
"null": "null",
|
||||
"Invalid or expired verification code": "Invalid or expired verification code",
|
||||
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
|
||||
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
|
||||
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
||||
"Payment method is required": "Payment method is required"
|
||||
}
|
||||
|
|
|
@ -384,5 +384,8 @@
|
|||
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
||||
"type cannot be blank": "Se debe rellenar el tipo",
|
||||
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero"
|
||||
}
|
||||
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
||||
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
|
||||
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
||||
"The web user's email already exists": "El correo del usuario web ya existe"
|
||||
}
|
|
@ -123,8 +123,8 @@
|
|||
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
||||
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",,
|
||||
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
||||
"State": "État",
|
||||
"regular": "normal",
|
||||
|
@ -362,6 +362,8 @@
|
|||
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
||||
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
||||
"Cannot send mail": "Impossible d'envoyer le mail",
|
||||
"Original invoice not found": "Facture originale introuvable",
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
|
||||
}
|
||||
"Original invoice not found": "Facture originale introuvable",
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne",
|
||||
"ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}",
|
||||
"The web user's email already exists": "L'email de l'internaute existe déjà"
|
||||
}
|
|
@ -124,7 +124,7 @@
|
|||
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
||||
"State": "Estado",
|
||||
"regular": "normal",
|
||||
|
@ -361,7 +361,9 @@
|
|||
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
||||
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
||||
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
||||
"Original invoice not found": "Fatura original não encontrada",
|
||||
"Original invoice not found": "Fatura original não encontrada",
|
||||
"Cannot send mail": "Não é possível enviar o email",
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
|
||||
}
|
||||
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha",
|
||||
"ticketLostExpedition": "O ticket [{{ticketId}}]({{{ticketUrl}}}) tem a seguinte expedição perdida: {{expeditionId}}",
|
||||
"The web user's email already exists": "O e-mail do utilizador da web já existe."
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = function(Self) {
|
||||
|
@ -98,6 +99,8 @@ module.exports = function(Self) {
|
|||
return client;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`The web user's email already exists`);
|
||||
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
|
|
|
@ -54,7 +54,10 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
fields: ['id', 'name'],
|
||||
include: {
|
||||
relation: 'saySimpleCountry',
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<div ng-transclude="btnThree">
|
||||
<vn-quick-link
|
||||
tooltip="New order"
|
||||
state="['order.create', {clientFk: $ctrl.id}]"
|
||||
state="['order.index', {q: ['createForm', 'clientFk', $ctrl.id]}]"
|
||||
icon="icon-basketadd">
|
||||
</vn-quick-link>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,6 @@ columns:
|
|||
notes: notes
|
||||
isConfirmed: confirmed
|
||||
isVirtual: virtual
|
||||
isRaid: raid
|
||||
commission: commission
|
||||
isOrdered: price3
|
||||
created: created
|
||||
|
|
|
@ -9,7 +9,6 @@ columns:
|
|||
notes: notas
|
||||
isConfirmed: confirmado
|
||||
isVirtual: virtual
|
||||
isRaid: redada
|
||||
commission: comisión
|
||||
isOrdered: pedida
|
||||
created: creado
|
||||
|
|
|
@ -1,14 +1,28 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('buyLabel', {
|
||||
description: 'Returns the entry buy labels',
|
||||
description: 'Returns the buy label',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The entry id',
|
||||
description: 'The buy id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'labelType',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The label type',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'packing',
|
||||
type: 'number',
|
||||
required: false
|
||||
}, {
|
||||
arg: 'copies',
|
||||
type: 'number',
|
||||
required: false
|
||||
}
|
||||
],
|
||||
returns: [
|
||||
|
@ -27,11 +41,16 @@ module.exports = Self => {
|
|||
}
|
||||
],
|
||||
http: {
|
||||
path: '/:id/buy-label',
|
||||
path: '/:id/:labelType/buy-label',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||
});
|
||||
|
||||
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
|
||||
Self.buyLabel = (ctx, id, labelType) => {
|
||||
if (labelType == 'qr')
|
||||
return Self.printReport(ctx, id, 'buy-label-qr');
|
||||
else
|
||||
return Self.printReport(ctx, id, 'buy-label-barcode');
|
||||
};
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue