Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6452-useIdAsSip
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b42b6db27c
|
@ -32,8 +32,7 @@ RUN apt-get update \
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
samba-common-bin samba-dsdb-modules\
|
samba-common-bin samba-dsdb-modules\
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
&& npm -g install pm2
|
|
||||||
|
|
||||||
# Salix
|
# Salix
|
||||||
|
|
||||||
|
@ -55,7 +54,4 @@ COPY \
|
||||||
README.md \
|
README.md \
|
||||||
./
|
./
|
||||||
|
|
||||||
CMD ["pm2-runtime", "./back/process.yml"]
|
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]
|
||||||
|
|
||||||
HEALTHCHECK --interval=15s --timeout=10s \
|
|
||||||
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
|
|
@ -62,7 +62,8 @@ module.exports = Self => {
|
||||||
p.code parkingCodePrevia,
|
p.code parkingCodePrevia,
|
||||||
p.pickingOrder pickingOrderPrevia,
|
p.pickingOrder pickingOrderPrevia,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked
|
iss.isPicked,
|
||||||
|
iss.itemShelvingFk
|
||||||
FROM ticketCollection tc
|
FROM ticketCollection tc
|
||||||
LEFT JOIN collection c ON c.id = tc.collectionFk
|
LEFT JOIN collection c ON c.id = tc.collectionFk
|
||||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
|
@ -102,7 +103,8 @@ module.exports = Self => {
|
||||||
p.code,
|
p.code,
|
||||||
p.pickingOrder,
|
p.pickingOrder,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked
|
iss.isPicked,
|
||||||
|
iss.itemShelvingFk
|
||||||
FROM sectorCollection sc
|
FROM sectorCollection sc
|
||||||
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
||||||
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
||||||
|
|
|
@ -4,21 +4,45 @@ module.exports = Self => {
|
||||||
/**
|
/**
|
||||||
* Returns basic headers
|
* Returns basic headers
|
||||||
*
|
*
|
||||||
* @param {string} cookie - The docuware cookie
|
|
||||||
* @return {object} - The headers
|
* @return {object} - The headers
|
||||||
*/
|
*/
|
||||||
Self.getOptions = async() => {
|
Self.getOptions = async() => {
|
||||||
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
||||||
|
const now = Date.vnNow();
|
||||||
|
let {url, username, password, token, expired} = docuwareConfig;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV && (!expired || expired < now + 60)) {
|
||||||
|
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
|
||||||
|
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
|
||||||
|
const {data} = await axios.post(token_endpoint, {
|
||||||
|
grant_type: 'password',
|
||||||
|
scope: 'docuware.platform',
|
||||||
|
client_id: 'docuware.platform.net.client',
|
||||||
|
username,
|
||||||
|
password
|
||||||
|
}, {headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
}});
|
||||||
|
|
||||||
|
const newToken = data.access_token;
|
||||||
|
token = data.token_type + ' ' + newToken;
|
||||||
|
await docuwareConfig.updateAttributes({
|
||||||
|
token,
|
||||||
|
expired: now + data.expires_in
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Cookie': docuwareConfig.cookie
|
'Authorization': token
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: docuwareConfig.url,
|
url,
|
||||||
headers
|
headers
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,87 +2,54 @@ const axios = require('axios');
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Docuware core', () => {
|
describe('Docuware core', () => {
|
||||||
beforeAll(() => {
|
const fileCabinetCode = 'deliveryNote';
|
||||||
|
beforeAll(async() => {
|
||||||
process.env.NODE_ENV = 'testing';
|
process.env.NODE_ENV = 'testing';
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
const docuwareInfo = await models.Docuware.findOne({
|
||||||
delete process.env.NODE_ENV;
|
where: {
|
||||||
});
|
code: fileCabinetCode
|
||||||
|
}
|
||||||
describe('getOptions()', () => {
|
|
||||||
it('should return url and headers', async() => {
|
|
||||||
const result = await models.Docuware.getOptions();
|
|
||||||
|
|
||||||
expect(result.url).toBeDefined();
|
|
||||||
expect(result.headers).toBeDefined();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('getDialog()', () => {
|
spyOn(axios, 'get').and.callFake(url => {
|
||||||
it('should return dialogId', async() => {
|
if (url.includes('IdentityServiceInfo')) return {data: {IdentityServiceUrl: 'IdentityServiceUrl'}};
|
||||||
const dialogs = {
|
if (url.includes('IdentityServiceUrl')) return {data: {token_endpoint: 'token_endpoint'}};
|
||||||
data: {
|
if (url.includes('dialogs')) {
|
||||||
Dialog: [
|
return {
|
||||||
{
|
data: {
|
||||||
DisplayName: 'find',
|
Dialog: [
|
||||||
Id: 'getDialogTest'
|
{
|
||||||
}
|
DisplayName: 'find',
|
||||||
]
|
Id: 'getDialogTest'
|
||||||
}
|
}
|
||||||
};
|
]
|
||||||
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
}
|
||||||
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
};
|
||||||
|
}
|
||||||
|
|
||||||
expect(result).toEqual('getDialogTest');
|
if (url.includes('FileCabinets')) {
|
||||||
});
|
return {data: {
|
||||||
});
|
|
||||||
|
|
||||||
describe('getFileCabinet()', () => {
|
|
||||||
it('should return fileCabinetId', async() => {
|
|
||||||
const code = 'deliveryNote';
|
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
|
||||||
where: {
|
|
||||||
code
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const dialogs = {
|
|
||||||
data: {
|
|
||||||
FileCabinet: [
|
FileCabinet: [
|
||||||
{
|
{
|
||||||
Name: docuwareInfo.fileCabinetName,
|
Name: docuwareInfo.fileCabinetName,
|
||||||
Id: 'getFileCabinetTest'
|
Id: 'getFileCabinetTest'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}};
|
||||||
};
|
}
|
||||||
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
|
||||||
const result = await models.Docuware.getFileCabinet(code);
|
|
||||||
|
|
||||||
expect(result).toEqual('getFileCabinetTest');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('get()', () => {
|
|
||||||
it('should return data without parse', async() => {
|
|
||||||
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
|
||||||
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
|
||||||
const data = {
|
|
||||||
data: {
|
|
||||||
id: 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
|
||||||
const result = await models.Docuware.get('deliveryNote');
|
|
||||||
|
|
||||||
expect(result.id).toEqual(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return data with parse', async() => {
|
spyOn(axios, 'post').and.callFake(url => {
|
||||||
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
if (url.includes('token_endpoint')) {
|
||||||
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
return {data: {
|
||||||
const data = {
|
access_token: 'access_token',
|
||||||
data: {
|
token_type: 'bearer',
|
||||||
|
expires_in: 10000
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
if (url.includes('DialogExpression')) {
|
||||||
|
return {data: {
|
||||||
Items: [{
|
Items: [{
|
||||||
Fields: [
|
Fields: [
|
||||||
{
|
{
|
||||||
|
@ -103,12 +70,52 @@ describe('Docuware core', () => {
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
delete process.env.NODE_ENV;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getOptions()', () => {
|
||||||
|
it('should return url and headers', async() => {
|
||||||
|
const result = await models.Docuware.getOptions();
|
||||||
|
|
||||||
|
expect(result.url).toBeDefined();
|
||||||
|
expect(result.headers).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Dialog()', () => {
|
||||||
|
it('should return dialogId', async() => {
|
||||||
|
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
||||||
|
|
||||||
|
expect(result).toEqual('getDialogTest');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getFileCabinet()', () => {
|
||||||
|
it('should return fileCabinetId', async() => {
|
||||||
|
const result = await models.Docuware.getFileCabinet(fileCabinetCode);
|
||||||
|
|
||||||
|
expect(result).toEqual('getFileCabinetTest');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('get()', () => {
|
||||||
|
it('should return data without parse', async() => {
|
||||||
|
const [result] = await models.Docuware.get('deliveryNote');
|
||||||
|
|
||||||
|
expect(result.firstRequiredField).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return data with parse', async() => {
|
||||||
const parse = {
|
const parse = {
|
||||||
'firstRequiredField': 'id',
|
'firstRequiredField': 'id',
|
||||||
'secondRequiredField': 'name',
|
'secondRequiredField': 'name',
|
||||||
};
|
};
|
||||||
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
|
||||||
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
||||||
|
|
||||||
expect(result.id).toEqual(1);
|
expect(result.id).toEqual(1);
|
||||||
|
@ -119,17 +126,14 @@ describe('Docuware core', () => {
|
||||||
|
|
||||||
describe('getById()', () => {
|
describe('getById()', () => {
|
||||||
it('should return data', async() => {
|
it('should return data', async() => {
|
||||||
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
spyOn(models.Docuware, 'get');
|
||||||
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
await models.Docuware.getById('deliveryNote', 1);
|
||||||
const data = {
|
|
||||||
data: {
|
|
||||||
id: 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
|
||||||
const result = await models.Docuware.getById('deliveryNote', 1);
|
|
||||||
|
|
||||||
expect(result.id).toEqual(1);
|
expect(models.Docuware.get).toHaveBeenCalledWith(
|
||||||
|
'deliveryNote',
|
||||||
|
{condition: [Object({DBName: 'N__ALBAR_N', Value: [1]})]},
|
||||||
|
undefined
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -143,7 +143,7 @@ module.exports = Self => {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
'X-File-ModifiedDate': Date.vnNew(),
|
'X-File-ModifiedDate': Date.vnNew(),
|
||||||
'Cookie': docuwareOptions.headers.headers.Cookie,
|
'Authorization': docuwareOptions.headers.headers.Authorization,
|
||||||
...data.getHeaders()
|
...data.getHeaders()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -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": {
|
"Machine": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"MachineWorker": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"MachineWorkerConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"MobileAppVersionControl": {
|
"MobileAppVersionControl": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
"hasDailyInvoice": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Indicates if the autonomy has daily invoice enabled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -40,4 +44,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
},
|
},
|
||||||
"continentFk": {
|
"continentFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"hasDailyInvoice": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Indicates if the autonomy has daily invoice enabled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cookie": {
|
"token": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"expired":{
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"property": "*",
|
|
||||||
"accessType": "*",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$everyone",
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,6 +16,9 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
"autonomyFk": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -55,4 +58,4 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
apps:
|
|
||||||
- script: ./loopback/server/server.js
|
|
||||||
name: salix-back
|
|
||||||
instances: 1
|
|
||||||
max_restarts: 0
|
|
||||||
autorestart: false
|
|
||||||
node_args: --tls-min-v1.0 --openssl-legacy-provider
|
|
|
@ -1723,7 +1723,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 (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
|
||||||
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
||||||
INSERT INTO `ACL` VALUES (382,'Item','labelPdf','READ','ALLOW','ROLE','employee',NULL);
|
|
||||||
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
||||||
|
|
|
@ -388,23 +388,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
|
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 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, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
|
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 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, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
|
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 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, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
(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');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
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'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
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
|
||||||
FROM `account`.`role` `r`
|
FROM `account`.`role` `r`
|
||||||
WHERE `r`.`hasLogin` = 1;
|
WHERE `r`.`hasLogin` = 1;
|
||||||
|
|
||||||
|
@ -632,14 +632,21 @@ INSERT INTO vn.invoiceOutConfig
|
||||||
SET id = 1,
|
SET id = 1,
|
||||||
parallelism = 8;
|
parallelism = 8;
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
|
INSERT INTO `vn`.`invoiceOutSerial`
|
||||||
|
(`code`,`description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
|
||||||
VALUES
|
VALUES
|
||||||
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
|
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
|
||||||
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
||||||
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
||||||
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
|
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
|
||||||
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
|
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
|
||||||
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
|
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick'),
|
||||||
|
('H', 'Intracomunitaria rápida', 0, 'CEE', 1, 'quick'),
|
||||||
|
('P', 'Factura simplificada', 1, 'NATIONAL', 0, NULL),
|
||||||
|
('PE', 'COOPERATIE FLORAHOLLAND UA', 0, 'CEE', 1, NULL),
|
||||||
|
('S', 'Simplificada', 1, 'NATIONAL', 0, NULL),
|
||||||
|
('X', 'Exportación global', 0, 'WORLD', 0, 'global'),
|
||||||
|
('N', 'Múltiple Intracomunitaria', 0, 'CEE', 1, 'multiple');
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1498,32 +1505,32 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
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),
|
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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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);
|
(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
|
VALUES
|
||||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 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, 0, 'observation two'),
|
(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, 0, 'observation three'),
|
(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, 0, 'observation four'),
|
(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, 0, 'observation five'),
|
(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, 0, 'observation six'),
|
(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, 0, 'observation seven'),
|
(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, 1, ''),
|
(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, 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, 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, 0, '');
|
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, '');
|
||||||
|
|
||||||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
||||||
VALUES (2, 4, 1);
|
VALUES (2, 4, 1);
|
||||||
|
@ -2440,7 +2447,7 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
|
||||||
INSERT INTO `vn`.`dmsType`
|
INSERT INTO `vn`.`dmsType`
|
||||||
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
|
(1, 'Facturas Recibidas', 1, 1, 'invoiceIn'),
|
||||||
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
|
||||||
(3, 'Laboral', 37, 37, 'hhrrData'),
|
(3, 'Laboral', 37, 37, 'hhrrData'),
|
||||||
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
|
||||||
|
@ -2828,12 +2835,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-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
|
||||||
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||||
|
|
||||||
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
|
|
||||||
VALUES
|
|
||||||
(1106, 1, util.VN_CURDATE(), util.VN_CURDATE()),
|
|
||||||
(1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)),
|
|
||||||
(1106, 2, util.VN_CURDATE(), NULL),
|
|
||||||
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2904,7 +2905,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||||
(6, 'book-entry-deleted', 'accounting entries deleted'),
|
(6, 'book-entry-deleted', 'accounting entries deleted'),
|
||||||
(7, 'zone-included','An email to notify zoneCollisions'),
|
(7, 'zone-included','An email to notify zoneCollisions'),
|
||||||
(8, 'backup-printer-selected','A backup printer has been selected'),
|
(8, 'backup-printer-selected','A backup printer has been selected'),
|
||||||
(9, 'mrw-deadline','The MRW deadline has passed');
|
(9, 'mrw-deadline','The MRW deadline has passed'),
|
||||||
|
(10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process');
|
||||||
|
|
||||||
TRUNCATE `util`.`notificationAcl`;
|
TRUNCATE `util`.`notificationAcl`;
|
||||||
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||||
|
@ -3816,8 +3818,6 @@ UPDATE vn.collection
|
||||||
UPDATE vn.sale
|
UPDATE vn.sale
|
||||||
SET isPicked =FALSE;
|
SET isPicked =FALSE;
|
||||||
|
|
||||||
INSERT INTO vn.machineWorkerConfig(id, maxHours)
|
|
||||||
VALUES(1, 12);
|
|
||||||
|
|
||||||
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
||||||
|
|
||||||
|
@ -3825,9 +3825,6 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
|
||||||
VALUES
|
VALUES
|
||||||
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
|
|
||||||
|
|
||||||
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
||||||
|
|
||||||
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
||||||
|
@ -3936,9 +3933,9 @@ INSERT INTO vn.medicalReview
|
||||||
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
|
||||||
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
|
||||||
VALUES(35, 1.00, 1.00, '2001-01-01');
|
VALUES(35, 1.00, 1.00, '2001-01-01');
|
||||||
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
|
||||||
VALUES (1,0.6,6);
|
VALUES (1,0.6,6);
|
||||||
|
|
||||||
INSERT INTO vn.payrollComponent
|
INSERT INTO vn.payrollComponent
|
||||||
|
|
|
@ -6,25 +6,27 @@ BLOCK1: BEGIN
|
||||||
DECLARE vShipped DATE;
|
DECLARE vShipped DATE;
|
||||||
DECLARE vPreviousShipped DATE;
|
DECLARE vPreviousShipped DATE;
|
||||||
DECLARE vDone boolean;
|
DECLARE vDone boolean;
|
||||||
DECLARE cur cursor for
|
|
||||||
|
DECLARE cur CURSOR FOR
|
||||||
SELECT clientFk, firstShipped
|
SELECT clientFk, firstShipped
|
||||||
FROM bs.clientNewBorn;
|
FROM bs.clientNewBorn;
|
||||||
|
|
||||||
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
|
|
||||||
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
||||||
|
|
||||||
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
||||||
SELECT c.id, MAX(t.shipped), MAX(t.shipped)
|
SELECT c.id, DATE(MAX(t.shipped)), DATE(MAX(t.shipped))
|
||||||
FROM vn.client c
|
FROM vn.client c
|
||||||
JOIN vn.ticket t on t.clientFk = c.id
|
JOIN vn.ticket t ON t.clientFk = c.id
|
||||||
LEFT JOIN clientNewBorn cb on cb.clientFk = c.id
|
LEFT JOIN clientNewBorn cb ON cb.clientFk = c.id
|
||||||
WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null
|
WHERE t.shipped BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR
|
||||||
GROUP BY c.id;
|
AND util.VN_CURDATE()
|
||||||
|
AND cb.isModified IS NULL
|
||||||
|
GROUP BY c.id;
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
LOOP1: LOOP
|
LOOP1: LOOP
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
FETCH cur INTO vClientFk, vShipped;
|
FETCH cur INTO vClientFk, vShipped;
|
||||||
|
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND s.name != 'INVENTARIO'
|
AND s.name != 'INVENTARIO'
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) c
|
) c
|
||||||
JOIN vn.item i ON i.id = c.itemFk
|
JOIN vn.item i ON i.id = c.itemFk
|
||||||
|
|
|
@ -6,16 +6,16 @@ BEGIN
|
||||||
|
|
||||||
UPDATE vn.buy b
|
UPDATE vn.buy b
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
|
||||||
JOIN vn.item i ON i.id = b.itemFk
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
|
||||||
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
|
||||||
b.stickers = NEW.NumberOfUnits
|
b.stickers = NEW.NumberOfUnits
|
||||||
WHERE i.supplyResponseFk = NEW.ID
|
WHERE i.supplyResponseFk = NEW.ID
|
||||||
AND am.name = 'LOGIFLORA'
|
AND am.name = 'LOGIFLORA'
|
||||||
AND e.isRaid
|
AND tr.daysInForward
|
||||||
AND tr.landed >= util.VN_CURDATE();
|
AND tr.landed >= util.VN_CURDATE();
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.landed BETWEEN vDateInv AND vDate
|
WHERE t.landed BETWEEN vDateInv AND vDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, -b.quantity
|
SELECT b.itemFk, -b.quantity
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
|
@ -67,7 +67,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
||||||
AND t.warehouseOutFk = vWarehouse
|
AND t.warehouseOutFk = vWarehouse
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
AND t.isDelivered
|
AND t.isDelivered
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT m.itemFk, -m.quantity
|
SELECT m.itemFk, -m.quantity
|
||||||
|
|
|
@ -4,5 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
IF NEW.`property` = '*' THEN
|
||||||
|
CALL util.throw('The property field cannot be *');
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
e.id entryFk,
|
e.id entryFk,
|
||||||
t.id travelFk,
|
t.id travelFk,
|
||||||
b.itemFk,
|
b.itemFk,
|
||||||
e.isRaid,
|
t.daysInForward,
|
||||||
ADDTIME(t.shipped,
|
ADDTIME(t.shipped,
|
||||||
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
||||||
t.warehouseOutFk,
|
t.warehouseOutFk,
|
||||||
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
TIMESTAMPADD(DAY, life, @dated),
|
TIMESTAMPADD(DAY, life, @dated),
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isReceived, isDelivered) AND !isRaid
|
IF(isIn, isReceived, isDelivered) AND NOT daysInForward
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE isIn OR !lessThanInventory;
|
WHERE isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
created,
|
created,
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isDelivered, isReceived) AND !isRaid
|
IF(isIn, isDelivered, isReceived) AND NOT daysInForward
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE !isIn OR !lessThanInventory;
|
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 vWarehouseFk IN (tr.warehouseInFk, 0)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT tr.shipped,
|
SELECT tr.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -58,7 +58,7 @@ BEGIN
|
||||||
AND s.id <> (SELECT supplierFk FROM inventoryConfig)
|
AND s.id <> (SELECT supplierFk FROM inventoryConfig)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT t.shipped,
|
SELECT t.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -81,7 +81,7 @@ BEGIN
|
||||||
FROM tHistoricalPast
|
FROM tHistoricalPast
|
||||||
WHERE `date` < vDate;
|
WHERE `date` < vDate;
|
||||||
|
|
||||||
SELECT p1.*, NULL v_virtual
|
SELECT p1.*, NULL v_virtual
|
||||||
FROM (
|
FROM (
|
||||||
SELECT vDate `date`,
|
SELECT vDate `date`,
|
||||||
vCalculatedInventory input,
|
vCalculatedInventory input,
|
||||||
|
@ -96,7 +96,7 @@ BEGIN
|
||||||
FROM tHistoricalPast
|
FROM tHistoricalPast
|
||||||
WHERE `date` >= vDate
|
WHERE `date` >= vDate
|
||||||
) p1;
|
) p1;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tHistoricalPast;
|
DROP TEMPORARY TABLE tHistoricalPast;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`available_traslate`(
|
||||||
vWarehouseShipment INT)
|
vWarehouseShipment INT)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcular la disponibilidad dependiendo del almacen
|
* Calcular la disponibilidad dependiendo del almacen
|
||||||
* de origen y destino según la fecha.
|
* de origen y destino según la fecha.
|
||||||
*
|
*
|
||||||
* @param vWarehouseLanding Almacén de llegada
|
* @param vWarehouseLanding Almacén de llegada
|
||||||
|
@ -42,10 +42,10 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
||||||
AND t.warehouseInFk = vWarehouseLanding
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY c.itemFk;
|
GROUP BY c.itemFk;
|
||||||
|
|
||||||
-- Tabla con el ultimo dia de last_buy para cada producto
|
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||||
-- que hace un replace de la anterior.
|
-- que hace un replace de la anterior.
|
||||||
CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE());
|
CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE());
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ proc: BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
||||||
WHERE t.warehouseFk = vWarehouseShipment
|
WHERE t.warehouseFk = vWarehouseShipment
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
||||||
tr.landed);
|
tr.landed);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ proc: BEGIN
|
||||||
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
||||||
WHERE NOT e.isExcludedFromAvailable
|
WHERE NOT e.isExcludedFromAvailable
|
||||||
AND b.quantity <> 0
|
AND b.quantity <> 0
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
AND t.warehouseInFk = vWarehouseLanding
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
AND t.landed >= vDatedFrom
|
AND t.landed >= vDatedFrom
|
||||||
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||||
|
@ -135,4 +135,4 @@ proc: BEGIN
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive;
|
DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vWarehouseFk SMALLINT,
|
vWarehouseFk INT,
|
||||||
vDated DATE
|
vDated DATE
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
||||||
WHERE NOT b.quantity
|
WHERE NOT b.quantity
|
||||||
AND am.code = 'logiflora'
|
AND am.code = 'logiflora'
|
||||||
AND e.isRaid;
|
AND tr.daysInForward;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
|
|
@ -34,22 +34,19 @@ BEGIN
|
||||||
DECLARE vIsTaxDataChecked TINYINT(1);
|
DECLARE vIsTaxDataChecked TINYINT(1);
|
||||||
DECLARE vHasCoreVnl BOOLEAN;
|
DECLARE vHasCoreVnl BOOLEAN;
|
||||||
DECLARE vMandateTypeFk INT;
|
DECLARE vMandateTypeFk INT;
|
||||||
DECLARE vHasDailyInvoice BOOLEAN;
|
|
||||||
|
|
||||||
SELECT cc.defaultPayMethodFk,
|
SELECT cc.defaultPayMethodFk,
|
||||||
cc.defaultDueDay,
|
cc.defaultDueDay,
|
||||||
cc.defaultCredit,
|
cc.defaultCredit,
|
||||||
cc.defaultIsTaxDataChecked,
|
cc.defaultIsTaxDataChecked,
|
||||||
cc.defaultHasCoreVnl,
|
cc.defaultHasCoreVnl,
|
||||||
cc.defaultMandateTypeFk,
|
cc.defaultMandateTypeFk
|
||||||
c.hasDailyInvoice
|
|
||||||
INTO vPayMethodFk,
|
INTO vPayMethodFk,
|
||||||
vDueDay,
|
vDueDay,
|
||||||
vDefaultCredit,
|
vDefaultCredit,
|
||||||
vIsTaxDataChecked,
|
vIsTaxDataChecked,
|
||||||
vHasCoreVnl,
|
vHasCoreVnl,
|
||||||
vMandateTypeFk,
|
vMandateTypeFk
|
||||||
vHasDailyInvoice
|
|
||||||
FROM clientConfig cc
|
FROM clientConfig cc
|
||||||
LEFT JOIN province p ON p.id = vProvinceFk
|
LEFT JOIN province p ON p.id = vProvinceFk
|
||||||
LEFT JOIN country c ON c.id = p.countryFk;
|
LEFT JOIN country c ON c.id = p.countryFk;
|
||||||
|
@ -70,8 +67,7 @@ BEGIN
|
||||||
credit = vDefaultCredit,
|
credit = vDefaultCredit,
|
||||||
isTaxDataChecked = vIsTaxDataChecked,
|
isTaxDataChecked = vIsTaxDataChecked,
|
||||||
hasCoreVnl = vHasCoreVnl,
|
hasCoreVnl = vHasCoreVnl,
|
||||||
isEqualizated = FALSE,
|
isEqualizated = FALSE
|
||||||
hasDailyInvoice = vHasDailyInvoice
|
|
||||||
ON duplicate KEY UPDATE
|
ON duplicate KEY UPDATE
|
||||||
payMethodFk = vPayMethodFk,
|
payMethodFk = vPayMethodFk,
|
||||||
dueDay = vDueDay,
|
dueDay = vDueDay,
|
||||||
|
|
|
@ -37,23 +37,23 @@ BEGIN
|
||||||
WHERE t.id = vTicketFk;
|
WHERE t.id = vTicketFk;
|
||||||
|
|
||||||
CALL cache.available_refresh(
|
CALL cache.available_refresh(
|
||||||
vCacheAvailableFk,
|
vCacheAvailableFk,
|
||||||
FALSE,
|
FALSE,
|
||||||
vWarehouseFk,
|
vWarehouseFk,
|
||||||
util.VN_CURDATE());
|
util.VN_CURDATE());
|
||||||
|
|
||||||
SELECT available INTO vAvailable
|
SELECT available INTO vAvailable
|
||||||
FROM cache.available
|
FROM cache.available
|
||||||
WHERE calc_id = vCacheAvailableFk
|
WHERE calc_id = vCacheAvailableFk
|
||||||
AND item_id = vItemFk;
|
AND item_id = vItemFk;
|
||||||
|
|
||||||
IF vAvailable < vQuantity THEN
|
IF vAvailable < vQuantity THEN
|
||||||
SET vHasThrow = TRUE;
|
SET vHasThrow = TRUE;
|
||||||
ELSE
|
ELSE
|
||||||
SELECT `name`,
|
SELECT `name`,
|
||||||
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
|
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
|
||||||
INTO vItemName, vConcept
|
INTO vItemName, vConcept
|
||||||
FROM item
|
FROM item
|
||||||
WHERE id = vItemFk;
|
WHERE id = vItemFk;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
@ -69,7 +69,7 @@ BEGIN
|
||||||
|
|
||||||
CALL sale_calculateComponent(vSaleFk, NULL);
|
CALL sale_calculateComponent(vSaleFk, NULL);
|
||||||
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
|
||||||
|
|
||||||
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
|
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
|
||||||
SET vHasThrow = TRUE;
|
SET vHasThrow = TRUE;
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -78,13 +78,13 @@ BEGIN
|
||||||
IF vHasThrow THEN
|
IF vHasThrow THEN
|
||||||
CALL util.throw("There is no available for the selected item");
|
CALL util.throw("There is no available for the selected item");
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vSaleGroupFk THEN
|
IF vSaleGroupFk THEN
|
||||||
INSERT INTO saleGroupDetail
|
INSERT INTO saleGroupDetail
|
||||||
SET saleFk = vSaleFk,
|
SET saleFk = vSaleFk,
|
||||||
saleGroupFk = vSaleGroupFk;
|
saleGroupFk = vSaleGroupFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -17,7 +17,6 @@ BEGIN
|
||||||
supplierFk,
|
supplierFk,
|
||||||
dated,
|
dated,
|
||||||
isExcludedFromAvailable,
|
isExcludedFromAvailable,
|
||||||
isRaid,
|
|
||||||
commission,
|
commission,
|
||||||
currencyFk,
|
currencyFk,
|
||||||
companyFk,
|
companyFk,
|
||||||
|
@ -28,7 +27,6 @@ BEGIN
|
||||||
supplierFk,
|
supplierFk,
|
||||||
dated,
|
dated,
|
||||||
isExcludedFromAvailable,
|
isExcludedFromAvailable,
|
||||||
isRaid,
|
|
||||||
commission,
|
commission,
|
||||||
currencyFk,
|
currencyFk,
|
||||||
companyFk,
|
companyFk,
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Retorna los artículos trasladables a partir de una entrada.
|
* Retorna los artículos trasladables a partir de una entrada.
|
||||||
*
|
*
|
||||||
* @param vSelf Id de entrada
|
* @param vSelf Id de entrada
|
||||||
*/
|
*/
|
||||||
DECLARE vDateShipped DATE;
|
DECLARE vDateShipped DATE;
|
||||||
|
@ -166,7 +166,7 @@ BEGIN
|
||||||
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
|
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
|
||||||
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
|
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
|
||||||
WHERE ic.display
|
WHERE ic.display
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND (ti.visible OR ti.available)
|
AND (ti.visible OR ti.available)
|
||||||
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ BEGIN
|
||||||
a.nickname,
|
a.nickname,
|
||||||
sub2.itemPackingTypeConcat,
|
sub2.itemPackingTypeConcat,
|
||||||
est.code,
|
est.code,
|
||||||
es.isScanned
|
es2.isScanned,
|
||||||
|
es2.scanOrder
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN ticket t ON t.id = e.ticketFk
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
||||||
|
@ -38,6 +39,7 @@ BEGIN
|
||||||
SELECT MAX(id)
|
SELECT MAX(id)
|
||||||
FROM expeditionState es
|
FROM expeditionState es
|
||||||
WHERE expeditionFk = e.id)
|
WHERE expeditionFk = e.id)
|
||||||
|
LEFT JOIN expeditionState es2 ON es2.id = es.id
|
||||||
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||||
ORDER BY r.created, t.priority DESC;
|
ORDER BY r.created, t.priority DESC;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -137,7 +137,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
WHERE tr.warehouseInFk = vWarehouseFk
|
WHERE tr.warehouseInFk = vWarehouseFk
|
||||||
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
|
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
GROUP BY b.itemFk;
|
GROUP BY b.itemFk;
|
||||||
|
|
||||||
-- Transfers
|
-- Transfers
|
||||||
|
@ -150,7 +150,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
WHERE tr.warehouseOutFk = vWarehouseFk
|
WHERE tr.warehouseOutFk = vWarehouseFk
|
||||||
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
|
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) sub
|
) sub
|
||||||
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
|
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 ;
|
|
@ -18,8 +18,9 @@ proc: BEGIN
|
||||||
DECLARE vReservedQuantity INT;
|
DECLARE vReservedQuantity INT;
|
||||||
DECLARE vOutStanding INT;
|
DECLARE vOutStanding INT;
|
||||||
DECLARE vUserFk INT;
|
DECLARE vUserFk INT;
|
||||||
DECLARE vTotalReservedQuantity INT;
|
DECLARE vTotalReservedQuantity INT;
|
||||||
DECLARE vSaleQuantity INT;
|
DECLARE vSaleQuantity INT;
|
||||||
|
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
||||||
|
|
||||||
DECLARE vItemShelvingAvailable CURSOR FOR
|
DECLARE vItemShelvingAvailable CURSOR FOR
|
||||||
SELECT ish.id itemShelvingFk,
|
SELECT ish.id itemShelvingFk,
|
||||||
|
@ -29,7 +30,7 @@ proc: BEGIN
|
||||||
JOIN shelving sh ON sh.code = ish.shelvingFk
|
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN parking p ON p.id = sh.parkingFk
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
JOIN sector sc ON sc.id = p.sectorFk
|
JOIN sector sc ON sc.id = p.sectorFk
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE s.id = vSaleFk
|
WHERE s.id = vSaleFk
|
||||||
AND NOT sc.isHideForPickers
|
AND NOT sc.isHideForPickers
|
||||||
AND (sc.id = vSectorFk OR vSectorFk IS NULL)
|
AND (sc.id = vSectorFk OR vSectorFk IS NULL)
|
||||||
|
@ -44,15 +45,15 @@ proc: BEGIN
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
ROLLBACK;
|
CALL util.tx_rollback(vIsRequiredTx);
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
START TRANSACTION;
|
CALL util.tx_start(vIsRequiredTx);
|
||||||
|
|
||||||
SELECT id INTO vSaleFk
|
SELECT id INTO vSaleFk
|
||||||
FROM sale
|
FROM sale
|
||||||
WHERE id = vSaleFk
|
WHERE id = vSaleFk
|
||||||
FOR UPDATE;
|
FOR UPDATE;
|
||||||
|
|
||||||
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
|
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
|
||||||
|
@ -65,7 +66,7 @@ proc: BEGIN
|
||||||
WHERE s.id = vSaleFk;
|
WHERE s.id = vSaleFk;
|
||||||
|
|
||||||
IF vOutStanding <= 0 THEN
|
IF vOutStanding <= 0 THEN
|
||||||
COMMIT;
|
CALL util.tx_commit(vIsRequiredTx);
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ proc: BEGIN
|
||||||
IF vTotalReservedQuantity <> vSaleQuantity THEN
|
IF vTotalReservedQuantity <> vSaleQuantity THEN
|
||||||
CALL util.debugAdd('itemShelvingSale_addBySale',
|
CALL util.debugAdd('itemShelvingSale_addBySale',
|
||||||
CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
|
CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
|
||||||
|
|
||||||
UPDATE sale
|
UPDATE sale
|
||||||
SET quantity = vTotalReservedQuantity
|
SET quantity = vTotalReservedQuantity
|
||||||
WHERE id = vSaleFk;
|
WHERE id = vSaleFk;
|
||||||
|
@ -93,7 +94,7 @@ proc: BEGIN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT id INTO vItemShelvingFk
|
SELECT id INTO vItemShelvingFk
|
||||||
FROM itemShelving
|
FROM itemShelving
|
||||||
WHERE id = vItemShelvingFk
|
WHERE id = vItemShelvingFk
|
||||||
FOR UPDATE;
|
FOR UPDATE;
|
||||||
|
@ -102,19 +103,19 @@ proc: BEGIN
|
||||||
SET vOutStanding = vOutStanding - vReservedQuantity;
|
SET vOutStanding = vOutStanding - vReservedQuantity;
|
||||||
|
|
||||||
IF vReservedQuantity > 0 THEN
|
IF vReservedQuantity > 0 THEN
|
||||||
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
|
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
|
||||||
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
|
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
|
||||||
INSERT INTO itemShelvingSale(
|
INSERT INTO itemShelvingSale(
|
||||||
itemShelvingFk,
|
itemShelvingFk,
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity,
|
quantity,
|
||||||
userFk,
|
userFk,
|
||||||
isPicked)
|
isPicked)
|
||||||
SELECT vItemShelvingFk,
|
SELECT vItemShelvingFk,
|
||||||
vSaleFk,
|
vSaleFk,
|
||||||
vReservedQuantity,
|
vReservedQuantity,
|
||||||
vUserFk,
|
vUserFk,
|
||||||
FALSE;
|
FALSE;
|
||||||
|
|
||||||
UPDATE itemShelving
|
UPDATE itemShelving
|
||||||
SET available = available - vReservedQuantity
|
SET available = available - vReservedQuantity
|
||||||
|
@ -123,6 +124,6 @@ proc: BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vItemShelvingAvailable;
|
CLOSE vItemShelvingAvailable;
|
||||||
COMMIT;
|
CALL util.tx_commit(vIsRequiredTx);
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -50,16 +50,16 @@ BEGIN
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN vn.supplier s ON s.id = e.supplierFk
|
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||||
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
|
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
|
||||||
OR (util.VN_CURDATE() AND tr.isReceived),
|
OR (util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
WHERE tr.landed >= vDateInventory
|
WHERE tr.landed >= vDateInventory
|
||||||
AND tr.warehouseInFk = vWarehouseFk
|
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 b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
),
|
),
|
||||||
entriesOut AS (
|
entriesOut AS (
|
||||||
SELECT 'entry',
|
SELECT 'entry',
|
||||||
|
@ -95,7 +95,7 @@ BEGIN
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT w.isFeedStock
|
AND NOT w.isFeedStock
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
),
|
),
|
||||||
sales AS (
|
sales AS (
|
||||||
WITH itemSales AS (
|
WITH itemSales AS (
|
||||||
|
@ -147,10 +147,10 @@ BEGIN
|
||||||
NULL
|
NULL
|
||||||
FROM itemSales s
|
FROM itemSales s
|
||||||
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
||||||
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
||||||
AND stk.stateFk = stPrep.id
|
AND stk.stateFk = stPrep.id
|
||||||
GROUP BY s.saleFk
|
GROUP BY s.saleFk
|
||||||
),
|
),
|
||||||
orders AS (
|
orders AS (
|
||||||
SELECT 'order' originType,
|
SELECT 'order' originType,
|
||||||
o.id originId,
|
o.id originId,
|
||||||
|
@ -215,9 +215,9 @@ BEGIN
|
||||||
t.`in` invalue,
|
t.`in` invalue,
|
||||||
t.`out`,
|
t.`out`,
|
||||||
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
||||||
@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')),
|
OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')),
|
||||||
t.lineFk,
|
t.lineFk,
|
||||||
@currentLineFk) lastPreparedLineFk,
|
@currentLineFk) lastPreparedLineFk,
|
||||||
t.isTicket,
|
t.isTicket,
|
||||||
t.lineFk,
|
t.lineFk,
|
||||||
|
@ -254,21 +254,21 @@ BEGIN
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT originType,
|
SELECT originType,
|
||||||
originId,
|
originId,
|
||||||
shipped,
|
shipped,
|
||||||
alertlevel,
|
alertlevel,
|
||||||
stateName,
|
stateName,
|
||||||
reference,
|
reference,
|
||||||
entityType,
|
entityType,
|
||||||
entityId,
|
entityId,
|
||||||
entityName,
|
entityName,
|
||||||
`in`,
|
`in`,
|
||||||
`out`,
|
`out`,
|
||||||
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
|
||||||
0,
|
0,
|
||||||
isTicket,
|
isTicket,
|
||||||
lineFk,
|
lineFk,
|
||||||
isPicked,
|
isPicked,
|
||||||
clientType,
|
clientType,
|
||||||
claimFk,
|
claimFk,
|
||||||
`order`
|
`order`
|
||||||
FROM tItemDiary
|
FROM tItemDiary
|
||||||
|
|
|
@ -63,7 +63,7 @@ BEGIN
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND b.quantity <> 0
|
AND b.quantity <> 0
|
||||||
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT r.itemFk,
|
SELECT r.itemFk,
|
||||||
r.shipment,
|
r.shipment,
|
||||||
|
|
|
@ -24,6 +24,7 @@ BEGIN
|
||||||
|
|
||||||
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
|
||||||
|
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
|
@ -74,14 +75,13 @@ BEGIN
|
||||||
AND a.calc_id = vAvailableCalcFk
|
AND a.calc_id = vAvailableCalcFk
|
||||||
LEFT JOIN cache.visible v ON v.item_id = i.id
|
LEFT JOIN cache.visible v ON v.item_id = i.id
|
||||||
AND v.calc_id = vVisibleCalcFk
|
AND v.calc_id = vVisibleCalcFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
|
||||||
AND lb.warehouse_id = vWarehouseFk
|
|
||||||
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
|
||||||
AND ip.itemFk = vSelf
|
AND ip.itemFk = vSelf
|
||||||
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
|
||||||
AND it.priority = vPriority
|
AND it.priority = vPriority
|
||||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
LEFT JOIN vn.buy b ON b.id = bu.buyFk
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
|
@ -98,5 +98,7 @@ BEGIN
|
||||||
(i.tag8 = its.tag8) DESC,
|
(i.tag8 = its.tag8) DESC,
|
||||||
match8 DESC
|
match8 DESC
|
||||||
LIMIT 100;
|
LIMIT 100;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -17,22 +17,22 @@ BEGIN
|
||||||
|
|
||||||
ALTER TABLE tmp.itemInventory
|
ALTER TABLE tmp.itemInventory
|
||||||
ADD `buy_date` datetime NOT NULL;
|
ADD `buy_date` datetime NOT NULL;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE lastBuyScope
|
CREATE OR REPLACE TEMPORARY TABLE lastBuyScope
|
||||||
SELECT i.id, MAX(t.landed) lastLanded
|
SELECT i.id, MAX(t.landed) lastLanded
|
||||||
FROM item i
|
FROM item i
|
||||||
JOIN buy b ON b.itemFk = i.id
|
JOIN buy b ON b.itemFk = i.id
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
JOIN supplier s ON s.id = e.supplierFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
WHERE t.landed BETWEEN (vDated + INTERVAL - vLastBuyScope DAY) AND vDated
|
WHERE t.landed BETWEEN (vDated + INTERVAL - vLastBuyScope DAY) AND vDated
|
||||||
AND NOT s.name = 'INVENTARIO'
|
AND NOT s.name = 'INVENTARIO'
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY i.id;
|
GROUP BY i.id;
|
||||||
|
|
||||||
UPDATE tmp.itemInventory y
|
UPDATE tmp.itemInventory y
|
||||||
JOIN lastBuyScope lbs ON lbs.id = y.id
|
JOIN lastBuyScope lbs ON lbs.id = y.id
|
||||||
SET y.buy_date = lbs.lastLanded;
|
SET y.buy_date = lbs.lastLanded;
|
||||||
|
|
|
@ -25,7 +25,7 @@ BEGIN
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
SET vHasNotInventory = (vInventoried IS NULL);
|
SET vHasNotInventory = (vInventoried IS NULL);
|
||||||
|
|
||||||
IF vHasNotInventory THEN
|
IF vHasNotInventory THEN
|
||||||
SELECT landed INTO vInventoryClone
|
SELECT landed INTO vInventoryClone
|
||||||
FROM travel tr
|
FROM travel tr
|
||||||
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
|
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
|
||||||
)
|
)
|
||||||
ENGINE = MEMORY;
|
ENGINE = MEMORY;
|
||||||
|
|
||||||
-- Inventario inicial
|
-- Inventario inicial
|
||||||
IF vHasNotInventory THEN
|
IF vHasNotInventory THEN
|
||||||
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
||||||
|
@ -109,7 +109,7 @@ BEGIN
|
||||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||||
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
||||||
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND w.valuatedInventory
|
AND w.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND e.supplierFk <> vInventorySupplierFk
|
AND e.supplierFk <> vInventorySupplierFk
|
||||||
|
@ -131,7 +131,7 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
||||||
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
|
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND w.valuatedInventory
|
AND w.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
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);
|
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1);
|
||||||
|
|
||||||
-- Volver a poner lo que esta aun en las estanterias
|
-- 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)
|
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
|
||||||
SELECT w.id,
|
SELECT w.id,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
|
@ -196,14 +196,14 @@ BEGIN
|
||||||
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
||||||
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
||||||
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
AND wIn.valuatedInventory
|
AND wIn.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND e.isConfirmed
|
AND e.isConfirmed
|
||||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||||
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
|
||||||
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
|
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
|
||||||
|
|
||||||
CALL buy_getUltimate (NULL, NULL, vDateDayEnd);
|
CALL buy_getUltimate (NULL, NULL, vDateDayEnd);
|
||||||
|
|
||||||
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
|
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
|
||||||
|
@ -233,7 +233,7 @@ BEGIN
|
||||||
JOIN warehouse w ON w.id = warehouseFk
|
JOIN warehouse w ON w.id = warehouseFk
|
||||||
JOIN item i ON i.id = ti.itemFk
|
JOIN item i ON i.id = ti.itemFk
|
||||||
JOIN itemType tp ON tp.id = i.typeFk
|
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
|
WHERE w.valuatedInventory
|
||||||
AND ti.total > 0;
|
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 $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
|
||||||
vDate DATE,
|
vDate DATE,
|
||||||
vWarehouseFk TINYINT,
|
vWarehouseFk TINYINT,
|
||||||
vMaxDays TINYINT
|
vMaxDays TINYINT
|
||||||
)
|
)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
|
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
|
||||||
DECLARE vDateFrom DATE DEFAULT vDate;
|
DECLARE vDateFrom DATE DEFAULT vDate;
|
||||||
DECLARE vDateTo DATETIME;
|
DECLARE vDateTo DATETIME;
|
||||||
DECLARE vDateToTomorrow DATETIME;
|
DECLARE vDateToTomorrow DATETIME;
|
||||||
DECLARE vDefaultDayRange INT;
|
DECLARE vDefaultDayRange INT;
|
||||||
DECLARE vCalcFk INT;
|
DECLARE vCalcFk INT;
|
||||||
|
|
||||||
IF vDate < util.VN_CURDATE() THEN
|
IF vDate < util.VN_CURDATE() THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vDate = util.VN_CURDATE() THEN
|
IF vDate = util.VN_CURDATE() THEN
|
||||||
SELECT inventoried INTO vDateFrom
|
SELECT inventoried INTO vDateFrom
|
||||||
FROM config;
|
FROM config;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT defaultDayRange INTO vDefaultDayRange
|
SELECT defaultDayRange INTO vDefaultDayRange
|
||||||
FROM comparativeConfig;
|
FROM comparativeConfig;
|
||||||
|
|
||||||
SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
|
SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
|
||||||
SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
|
SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
|
||||||
|
|
||||||
ALTER TABLE tmp.itemInventory
|
ALTER TABLE tmp.itemInventory
|
||||||
ADD `avalaible` INT NOT NULL,
|
ADD `avalaible` INT NOT NULL,
|
||||||
ADD `sd` INT NOT NULL,
|
ADD `sd` INT NOT NULL,
|
||||||
ADD `rest` INT NOT NULL,
|
ADD `rest` INT NOT NULL,
|
||||||
ADD `expected` INT NOT NULL,
|
ADD `expected` INT NOT NULL,
|
||||||
ADD `inventory` INT NOT NULL,
|
ADD `inventory` INT NOT NULL,
|
||||||
ADD `visible` INT NOT NULL,
|
ADD `visible` INT NOT NULL,
|
||||||
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
ADD `life` TINYINT NOT NULL DEFAULT '0';
|
||||||
|
|
||||||
-- Calculo del inventario
|
-- Calculo del inventario
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
|
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
SUM(quantity) quantity
|
SUM(quantity) quantity
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, - s.quantity quantity
|
SELECT s.itemFk, - s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, b.quantity
|
SELECT b.itemFk, b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
|
WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, - b.quantity
|
SELECT b.itemFk, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
-- Cálculo del visible
|
-- Cálculo del visible
|
||||||
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||||
(PRIMARY KEY (item_id))
|
(PRIMARY KEY (item_id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT item_id, visible
|
SELECT item_id, visible
|
||||||
FROM cache.visible
|
FROM cache.visible
|
||||||
WHERE calc_id = vCalcFk;
|
WHERE calc_id = vCalcFk;
|
||||||
|
|
||||||
UPDATE tmp.itemInventory it
|
UPDATE tmp.itemInventory it
|
||||||
LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
|
LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
|
||||||
LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
|
||||||
SET it.inventory = iic.quantity,
|
SET it.inventory = iic.quantity,
|
||||||
it.visible = ivc.visible,
|
it.visible = ivc.visible,
|
||||||
it.avalaible = iic.quantity,
|
it.avalaible = iic.quantity,
|
||||||
it.sd = iic.quantity;
|
it.sd = iic.quantity;
|
||||||
|
|
||||||
-- Calculo del disponible
|
-- Calculo del disponible
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
(INDEX (itemFk, warehouseFk))
|
(INDEX (itemFk, warehouseFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT sub.itemFk,
|
SELECT sub.itemFk,
|
||||||
vWarehouseFk warehouseFk,
|
vWarehouseFk warehouseFk,
|
||||||
sub.dated,
|
sub.dated,
|
||||||
SUM(sub.quantity) quantity
|
SUM(sub.quantity) quantity
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk,
|
SELECT s.itemFk,
|
||||||
DATE(t.shipped) dated,
|
DATE(t.shipped) dated,
|
||||||
- s.quantity quantity
|
- s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, t.landed, b.quantity
|
SELECT b.itemFk, t.landed, b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
|
WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, t.shipped, - b.quantity
|
SELECT b.itemFk, t.shipped, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN entry e ON e.id = b.entryFk
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||||
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
) sub
|
) sub
|
||||||
GROUP BY sub.itemFk, sub.dated;
|
GROUP BY sub.itemFk, sub.dated;
|
||||||
|
|
||||||
CALL item_getAtp(vDate);
|
CALL item_getAtp(vDate);
|
||||||
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
CALL travel_upcomingArrivals(vWarehouseFk, vDate);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
|
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT it.itemFk,
|
SELECT it.itemFk,
|
||||||
SUM(it.quantity) quantity,
|
SUM(it.quantity) quantity,
|
||||||
im.quantity minQuantity
|
im.quantity minQuantity
|
||||||
FROM tmp.itemCalc it
|
FROM tmp.itemCalc it
|
||||||
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
|
||||||
JOIN item i ON i.id = it.itemFk
|
JOIN item i ON i.id = it.itemFk
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
|
||||||
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
|
||||||
t.landing,
|
t.landing,
|
||||||
vDateToTomorrow)
|
vDateToTomorrow)
|
||||||
GROUP BY it.itemFk;
|
GROUP BY it.itemFk;
|
||||||
|
|
||||||
UPDATE tmp.itemInventory it
|
UPDATE tmp.itemInventory it
|
||||||
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
|
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
|
||||||
SET it.avalaible = IF(iac.minQuantity > 0,
|
SET it.avalaible = IF(iac.minQuantity > 0,
|
||||||
it.avalaible,
|
it.avalaible,
|
||||||
it.avalaible + iac.minQuantity),
|
it.avalaible + iac.minQuantity),
|
||||||
it.sd = it.inventory + iac.quantity;
|
it.sd = it.inventory + iac.quantity;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.itemTravel,
|
tmp.itemTravel,
|
||||||
tmp.itemCalc,
|
tmp.itemCalc,
|
||||||
tmp.itemAtp,
|
tmp.itemAtp,
|
||||||
tItemInventoryCalc,
|
tItemInventoryCalc,
|
||||||
tItemVisibleCalc,
|
tItemVisibleCalc,
|
||||||
tItemAvailableCalc;
|
tItemAvailableCalc;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
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 ;
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_sectorCollectionAddPrevOK`(
|
||||||
|
vSectorCollectionFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Inserta los registros de sectorCollection con el estado PREVIA OK si la reserva está picked
|
||||||
|
*
|
||||||
|
* @param vSectorCollectionFk Identificador de vn.sectorCollection
|
||||||
|
*/
|
||||||
|
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
|
||||||
|
SELECT sgd.saleFk, TRUE, sc.userFk, s.id
|
||||||
|
FROM sectorCollection sc
|
||||||
|
JOIN sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||||
|
JOIN saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||||
|
JOIN state s ON s.code = 'OK PREVIOUS'
|
||||||
|
JOIN itemShelvingSale iss ON iss.saleFk = sgd.saleFk
|
||||||
|
WHERE sc.id = vSectorCollectionFk AND iss.isPicked;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -51,7 +51,8 @@ BEGIN
|
||||||
origin.companyFk futureCompanyFk,
|
origin.companyFk futureCompanyFk,
|
||||||
IFNULL(dest.nickname, origin.nickname) nickname,
|
IFNULL(dest.nickname, origin.nickname) nickname,
|
||||||
dest.landed,
|
dest.landed,
|
||||||
dest.preparation
|
dest.preparation,
|
||||||
|
origin.departmentFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.ticketFk,
|
SELECT s.ticketFk,
|
||||||
c.salesPersonFk workerFk,
|
c.salesPersonFk workerFk,
|
||||||
|
@ -71,9 +72,11 @@ BEGIN
|
||||||
t.addressFk,
|
t.addressFk,
|
||||||
t.warehouseFk,
|
t.warehouseFk,
|
||||||
t.companyFk,
|
t.companyFk,
|
||||||
t.agencyModeFk
|
t.agencyModeFk,
|
||||||
|
wd.departmentFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
|
JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN saleVolume sv ON sv.saleFk = s.id
|
JOIN saleVolume sv ON sv.saleFk = s.id
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
|
|
@ -43,7 +43,7 @@ BEGIN
|
||||||
c.isTaxDataChecked,
|
c.isTaxDataChecked,
|
||||||
t.companyFk,
|
t.companyFk,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
|
c.hasDailyInvoice,
|
||||||
w.isManaged,
|
w.isManaged,
|
||||||
c.hasToInvoice
|
c.hasToInvoice
|
||||||
INTO vClientFk,
|
INTO vClientFk,
|
||||||
|
@ -55,9 +55,6 @@ BEGIN
|
||||||
vHasToInvoice
|
vHasToInvoice
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN `client` c ON c.id = t.clientFk
|
JOIN `client` c ON c.id = t.clientFk
|
||||||
JOIN province p ON p.id = c.provinceFk
|
|
||||||
LEFT JOIN autonomy a ON a.id = p.autonomyFk
|
|
||||||
JOIN country co ON co.id = p.countryFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
WHERE t.id = vCurTicketFk;
|
WHERE t.id = vCurTicketFk;
|
||||||
|
|
||||||
|
@ -85,7 +82,7 @@ BEGIN
|
||||||
|
|
||||||
IF(vHasDailyInvoice) AND vHasToInvoice THEN
|
IF(vHasDailyInvoice) AND vHasToInvoice THEN
|
||||||
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
|
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
|
||||||
IF vSerial IS NULL THEN
|
IF vSerial IS NULL THEN
|
||||||
CALL util.throw('Cannot booking without a serial');
|
CALL util.throw('Cannot booking without a serial');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getTax`(IN vTaxArea VARCHAR(25))
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getTax`(
|
||||||
|
vTaxArea VARCHAR(25)
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula la base imponible, el IVA y el recargo de equivalencia para
|
* Calcula la base imponible, el IVA y el recargo de equivalencia para
|
||||||
|
@ -33,30 +35,39 @@ BEGIN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketTax
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketTax
|
||||||
(PRIMARY KEY (ticketFk, code, rate))
|
(PRIMARY KEY (ticketFk, code, rate))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT * FROM (
|
WITH sales AS (
|
||||||
SELECT tmpTicket.ticketFk,
|
SELECT s.ticketFk,
|
||||||
bp.pgcFk,
|
s.itemFk,
|
||||||
SUM(s.quantity * s.price * (100 - s.discount) / 100 ) taxableBase,
|
s.quantity * s.price * (100 - s.discount) / 100 total,
|
||||||
pgc.rate,
|
t.companyFk,
|
||||||
tc.code,
|
t.addressFk,
|
||||||
bp.priority
|
su.countryFk,
|
||||||
FROM tmp.ticket tmpTicket
|
ata.areaFk,
|
||||||
JOIN sale s ON s.ticketFk = tmpTicket.ticketFk
|
itc.taxClassFk
|
||||||
JOIN item i ON i.id = s.itemFk
|
FROM vn.sale s
|
||||||
JOIN ticket t ON t.id = tmpTicket.ticketFk
|
JOIN tmp.ticket tmp ON tmp.ticketFk = s.ticketFk
|
||||||
JOIN supplier su ON su.id = t.companyFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN vn.supplier su ON su.id = t.companyFk
|
||||||
JOIN tmp.addressTaxArea ata ON ata.addressFk = t.addressFk
|
JOIN tmp.addressTaxArea ata ON ata.addressFk = t.addressFk
|
||||||
AND ata.companyFk = t.companyFk
|
AND ata.companyFk = t.companyFk
|
||||||
JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
JOIN vn.itemTaxCountry itc ON itc.itemFk = s.itemFk
|
||||||
AND itc.countryFk = su.countryFk
|
AND itc.countryFk = su.countryFk
|
||||||
JOIN bookingPlanner bp ON bp.countryFk = su.countryFk
|
HAVING total
|
||||||
AND bp.taxAreaFk = ata.areaFk
|
)
|
||||||
AND bp.taxClassFk = itc.taxClassFk
|
SELECT s.ticketFk,
|
||||||
JOIN pgc ON pgc.code = bp.pgcFk
|
bp.pgcFk,
|
||||||
JOIN taxClass tc ON tc.id = bp.taxClassFk
|
SUM(s.total) taxableBase,
|
||||||
GROUP BY tmpTicket.ticketFk, pgc.code, pgc.rate
|
pgc.rate,
|
||||||
HAVING taxableBase
|
tc.code,
|
||||||
) t3
|
bp.priority
|
||||||
|
FROM sales s
|
||||||
|
JOIN vn.bookingPlanner bp ON bp.countryFk = s.countryFk
|
||||||
|
AND bp.taxAreaFk = s.areaFk
|
||||||
|
AND bp.taxClassFk = s.taxClassFk
|
||||||
|
JOIN vn.pgc ON pgc.code = bp.pgcFk
|
||||||
|
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
|
||||||
|
GROUP BY s.ticketFk, pgc.code, pgc.rate
|
||||||
|
HAVING taxableBase
|
||||||
ORDER BY priority;
|
ORDER BY priority;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketServiceTax
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketServiceTax
|
||||||
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
||||||
JOIN vn.entry e ON e.travelFk = tr.id
|
JOIN vn.entry e ON e.travelFk = tr.id
|
||||||
JOIN vn.buy b ON b.entryFk = e.id
|
JOIN vn.buy b ON b.entryFk = e.id
|
||||||
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
||||||
AND e.isRaid = FALSE
|
AND NOT tr.daysInForward
|
||||||
AND tr.warehouseInFk = vWarehouseFk
|
AND tr.warehouseInFk = vWarehouseFk
|
||||||
GROUP BY tr.landed , a.name ;
|
GROUP BY tr.landed , a.name ;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -62,7 +62,7 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
||||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||||
|
|
||||||
SELECT evaNotes INTO vEvaNotes
|
SELECT evaNotes INTO vEvaNotes
|
||||||
FROM entry
|
FROM entry
|
||||||
|
@ -71,6 +71,8 @@ BEGIN
|
||||||
UPDATE entry
|
UPDATE entry
|
||||||
SET evaNotes = vEvaNotes
|
SET evaNotes = vEvaNotes
|
||||||
WHERE id = vNewEntryFk;
|
WHERE id = vNewEntryFk;
|
||||||
|
|
||||||
|
CALL buy_recalcPricesByEntry(vNewEntryFk);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
SET @isModeInventory = FALSE;
|
SET @isModeInventory = FALSE;
|
||||||
|
|
|
@ -1,72 +1,68 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
|
||||||
BEGIN
|
BEGIN
|
||||||
|
/**
|
||||||
/*
|
* Desplaza los travels en el futuro y avisa a los compradores
|
||||||
* Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DECLARE vDone BOOL DEFAULT FALSE;
|
DECLARE vDone BOOL DEFAULT FALSE;
|
||||||
DECLARE vWorkerName VARCHAR(50);
|
DECLARE vBuyerEmail VARCHAR(40);
|
||||||
DECLARE vRaid TEXT;
|
DECLARE vTravelLink TEXT;
|
||||||
DECLARE vWorker VARCHAR(50) DEFAULT '';
|
|
||||||
DECLARE vMailBody TEXT DEFAULT '';
|
DECLARE vMailBody TEXT DEFAULT '';
|
||||||
|
|
||||||
DECLARE vCur CURSOR FOR
|
DECLARE vCur CURSOR FOR
|
||||||
SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'),
|
SELECT GROUP_CONCAT(DISTINCT
|
||||||
u.name
|
CONCAT('https://salix.verdnatura.es/#!/travel/',
|
||||||
FROM tmp.travel ttr
|
ttm.travelFk,
|
||||||
JOIN entry e ON e.travelFk = ttr.id
|
'/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 buy b ON b.entryFk = e.id
|
||||||
JOIN item i ON i.id = b.itemFk
|
JOIN item i ON i.id = b.itemFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
JOIN account.user u ON u.id = it.workerFk
|
JOIN account.user u ON u.id = it.workerFk
|
||||||
GROUP BY u.name;
|
GROUP BY u.name;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.travel;
|
CREATE OR REPLACE TEMPORARY TABLE tTravelToMove
|
||||||
CREATE TEMPORARY TABLE tmp.travel
|
SELECT id travelFk,
|
||||||
SELECT tr.id,tr.landed
|
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
||||||
FROM travel tr
|
FROM travel
|
||||||
JOIN entry e ON e.travelFk = tr.id
|
WHERE daysInForward;
|
||||||
WHERE tr.landed = util.tomorrow()
|
|
||||||
AND e.isRaid
|
|
||||||
GROUP BY tr.id;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
UPDATE travel tr
|
UPDATE travel tr
|
||||||
JOIN tmp.travel ttr ON ttr.id = tr.id
|
JOIN tTravelToMove ttm ON ttm.travelFk = tr.id
|
||||||
SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed);
|
SET tr.landed = ttm.newLanded;
|
||||||
|
|
||||||
OPEN vCur;
|
OPEN vCur;
|
||||||
|
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH vCur INTO vRaid, vWorkerName;
|
FETCH vCur INTO vTravelLink, vBuyerEmail;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'),
|
CALL `vn`.`mail_insert`(
|
||||||
'noreply@verdnatura.es',
|
vBuyerEmail,
|
||||||
'Cambio de fecha en Redadas',
|
'noreply@verdnatura.es',
|
||||||
CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid)
|
'Cambio de fecha en Redadas',
|
||||||
);
|
CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink));
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vCur;
|
CLOSE vCur;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
DROP TEMPORARY TABLE tmp.travel;
|
DROP TEMPORARY TABLE tTravelToMove;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
|
||||||
BEFORE UPDATE ON `entry`
|
BEFORE UPDATE ON `entry`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vIsVirtual BOOL;
|
DECLARE vDaysInForward INT;
|
||||||
DECLARE vPrintedCount INT;
|
DECLARE vPrintedCount INT;
|
||||||
DECLARE vHasDistinctWarehouses BOOL;
|
DECLARE vHasDistinctWarehouses BOOL;
|
||||||
DECLARE vTotalBuy INT;
|
DECLARE vTotalBuy INT;
|
||||||
|
@ -37,18 +37,20 @@ BEGIN
|
||||||
IF NEW.travelFk IS NOT NULL THEN
|
IF NEW.travelFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.travelFk);
|
CALL travel_throwAwb(NEW.travelFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT COUNT(*) > 0 INTO vIsVirtual
|
SELECT daysInForward INTO vDaysInForward
|
||||||
FROM entryVirtual WHERE entryFk = NEW.id;
|
FROM travel t
|
||||||
|
JOIN entry e ON e.travelFk = t.id
|
||||||
|
WHERE entryFk = NEW.id;
|
||||||
|
|
||||||
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
||||||
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
||||||
INTO vHasDistinctWarehouses
|
INTO vHasDistinctWarehouses
|
||||||
FROM travel o, travel n
|
FROM travel o, travel n
|
||||||
WHERE o.id = OLD.travelFk
|
WHERE o.id = OLD.travelFk
|
||||||
AND n.id = NEW.travelFk;
|
AND n.id = NEW.travelFk;
|
||||||
|
|
||||||
IF vIsVirtual AND vHasDistinctWarehouses THEN
|
IF vDaysInForward AND vHasDistinctWarehouses THEN
|
||||||
SIGNAL SQLSTATE '45000'
|
SIGNAL SQLSTATE '45000'
|
||||||
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
|
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -71,7 +73,7 @@ BEGIN
|
||||||
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
|
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NOT (NEW.travelFk <=> OLD.travelFk)
|
IF NOT (NEW.travelFk <=> OLD.travelFk)
|
||||||
OR NOT (NEW.currencyFk <=> OLD.currencyFk)
|
OR NOT (NEW.currencyFk <=> OLD.currencyFk)
|
||||||
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
|
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelvingSale_afterI
|
||||||
AFTER INSERT ON `itemShelvingSale`
|
AFTER INSERT ON `itemShelvingSale`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
JOIN operator o ON o.workerFk = account.myUser_getId()
|
JOIN operator o ON o.workerFk = account.myUser_getId()
|
||||||
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
|
JOIN sector se ON se.id = o.sectorFk
|
||||||
WHERE id = NEW.saleFk;
|
SET s.isPicked = IF(IFNULL(se.isOnReservationMode, o.isOnReservationMode), s.isPicked, TRUE)
|
||||||
|
WHERE s.id = NEW.saleFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
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`
|
BEFORE UPDATE ON `itemType`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
IF NEW.itemPackingTypeFk = '' THEN
|
IF NEW.itemPackingTypeFk = '' THEN
|
||||||
|
|
||||||
SET NEW.itemPackingTypeFk = NULL;
|
SET NEW.itemPackingTypeFk = NULL;
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_afterD
|
||||||
AFTER DELETE ON `productionConfig`
|
AFTER DELETE ON `productionConfig`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO productionConfig
|
INSERT INTO productionConfigLog
|
||||||
SET `action` = 'delete',
|
SET `action` = 'delete',
|
||||||
`changedModel` = 'ProductionConfig',
|
`changedModel` = 'ProductionConfig',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
|
|
|
@ -6,7 +6,7 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
|
||||||
`b`.`itemFk` AS `itemFk`,
|
`b`.`itemFk` AS `itemFk`,
|
||||||
`b`.`quantity` AS `quantity`,
|
`b`.`quantity` AS `quantity`,
|
||||||
`t`.`isReceived` AS `isReceived`,
|
`t`.`isReceived` AS `isReceived`,
|
||||||
`e`.`isRaid` AS `isVirtualStock`,
|
`t`.`daysInForward` AS `isVirtualStock`,
|
||||||
`e`.`id` AS `entryFk`
|
`e`.`id` AS `entryFk`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
|
|
|
@ -15,5 +15,5 @@ FROM (
|
||||||
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
|
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
|
||||||
)
|
)
|
||||||
WHERE `e`.`isExcludedFromAvailable` = 0
|
WHERE `e`.`isExcludedFromAvailable` = 0
|
||||||
AND `e`.`isRaid` = 0
|
AND NOT `t`.`daysInForward`
|
||||||
AND `b`.`quantity` <> 0
|
AND `b`.`quantity` <> 0
|
||||||
|
|
|
@ -31,5 +31,5 @@ FROM (
|
||||||
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
|
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
|
||||||
)
|
)
|
||||||
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
|
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
|
||||||
AND `e`.`isRaid` = 0
|
AND NOT `tr`.`daysInForward`
|
||||||
AND `b`.`stickers` > 0
|
AND `b`.`stickers` > 0
|
||||||
|
|
|
@ -10,11 +10,10 @@ FROM (
|
||||||
`vn`.`collection` `c`
|
`vn`.`collection` `c`
|
||||||
JOIN `vn`.`client` `cl` ON(`cl`.`id` = `c`.`workerFk`)
|
JOIN `vn`.`client` `cl` ON(`cl`.`id` = `c`.`workerFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`machineWorker` `mw` ON(
|
JOIN `vn`.`operator` `o` ON(
|
||||||
`mw`.`workerFk` = `c`.`workerFk`
|
`o`.`workerFk` = `c`.`workerFk`
|
||||||
AND `mw`.`inTimed` > `util`.`VN_CURDATE`()
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
WHERE `c`.`created` > `util`.`VN_CURDATE`()
|
WHERE `c`.`created` > `util`.`VN_CURDATE`()
|
||||||
AND `mw`.`workerFk` IS NULL
|
AND `o`.`machineFk` IS NULL
|
||||||
GROUP BY `c`.`workerFk`
|
GROUP BY `c`.`workerFk`
|
||||||
|
|
|
@ -22,7 +22,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
|
||||||
`c`.`credit` AS `credito`,
|
`c`.`credit` AS `credito`,
|
||||||
`c`.`countryFk` AS `Id_Pais`,
|
`c`.`countryFk` AS `Id_Pais`,
|
||||||
`c`.`isActive` AS `activo`,
|
`c`.`isActive` AS `activo`,
|
||||||
`c`.`gestdocFk` AS `gestdoc_id`,
|
|
||||||
`c`.`quality` AS `calidad`,
|
`c`.`quality` AS `calidad`,
|
||||||
`c`.`payMethodFk` AS `pay_met_id`,
|
`c`.`payMethodFk` AS `pay_met_id`,
|
||||||
`c`.`created` AS `created`,
|
`c`.`created` AS `created`,
|
||||||
|
|
|
@ -8,7 +8,6 @@ AS SELECT `e`.`id` AS `Id_Entrada`,
|
||||||
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
||||||
`e`.`isConfirmed` AS `Confirmada`,
|
`e`.`isConfirmed` AS `Confirmada`,
|
||||||
`e`.`isOrdered` AS `Pedida`,
|
`e`.`isOrdered` AS `Pedida`,
|
||||||
`e`.`isRaid` AS `Redada`,
|
|
||||||
`e`.`commission` AS `comision`,
|
`e`.`commission` AS `comision`,
|
||||||
`e`.`created` AS `odbc_date`,
|
`e`.`created` AS `odbc_date`,
|
||||||
`e`.`evaNotes` AS `Notas_Eva`,
|
`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`.`isExcludedFromAvailable` AS `Inventario`,
|
||||||
`e`.`isConfirmed` AS `Confirmada`,
|
`e`.`isConfirmed` AS `Confirmada`,
|
||||||
`e`.`isOrdered` AS `Pedida`,
|
`e`.`isOrdered` AS `Pedida`,
|
||||||
`e`.`isRaid` AS `Redada`,
|
`tr`.`daysInForward` AS `daysInForward`,
|
||||||
`e`.`evaNotes` AS `notas`,
|
`e`.`evaNotes` AS `notas`,
|
||||||
`e`.`supplierFk` AS `Id_Proveedor`,
|
`e`.`supplierFk` AS `Id_Proveedor`,
|
||||||
`tr`.`shipped` AS `shipment`,
|
`tr`.`shipped` AS `shipment`,
|
||||||
|
|
|
@ -17,5 +17,6 @@ AS SELECT `t`.`id` AS `id`,
|
||||||
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
||||||
`t`.`totalEntries` AS `totalEntries`,
|
`t`.`totalEntries` AS `totalEntries`,
|
||||||
`t`.`appointment` AS `appointment`,
|
`t`.`appointment` AS `appointment`,
|
||||||
`t`.`awbFk` AS `awbFk`
|
`t`.`awbFk` AS `awbFk`,
|
||||||
|
`t`.`daysInForward` AS `daysInForward`
|
||||||
FROM `vn`.`travel` `t`
|
FROM `vn`.`travel` `t`
|
||||||
|
|
|
@ -28,7 +28,6 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`,
|
||||||
`E`.`Id_Proveedor` AS `Id_Proveedor`,
|
`E`.`Id_Proveedor` AS `Id_Proveedor`,
|
||||||
`E`.`Fecha` AS `Fecha`,
|
`E`.`Fecha` AS `Fecha`,
|
||||||
`E`.`Confirmada` AS `Confirmada`,
|
`E`.`Confirmada` AS `Confirmada`,
|
||||||
`E`.`Redada` AS `Redada`,
|
|
||||||
`E`.`empresa_id` AS `empresa_id`,
|
`E`.`empresa_id` AS `empresa_id`,
|
||||||
`E`.`travel_id` AS `travel_id`,
|
`E`.`travel_id` AS `travel_id`,
|
||||||
`E`.`Pedida` AS `Pedida`,
|
`E`.`Pedida` AS `Pedida`,
|
||||||
|
@ -85,6 +84,6 @@ FROM (
|
||||||
)
|
)
|
||||||
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
|
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
|
||||||
)
|
)
|
||||||
WHERE `W_IN`.`isFeedStock` = 0
|
WHERE NOT `W_IN`.`isFeedStock`
|
||||||
AND `E`.`Inventario` = 0
|
AND NOT `E`.`Inventario`
|
||||||
AND `E`.`Redada` = 0
|
AND NOT `TR`.`daysInForward`
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE `vn`.`operator`
|
||||||
|
ADD COLUMN `machineFk` int(11) DEFAULT NULL,
|
||||||
|
ADD CONSTRAINT `operator_machine_FK` FOREIGN KEY (`machineFk`) REFERENCES `vn`.`machine` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Machine','*','*','ALLOW','ROLE','productionBoss');
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS username varchar(100) NULL;
|
||||||
|
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS password varchar(100) NULL;
|
||||||
|
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS token text NULL;
|
||||||
|
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS expired int(11) 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,137 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemFarmingTag` (
|
||||||
|
`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`.`itemFarmingTag` (`name`) VALUES ('Enraizado');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemFarmingTag'
|
||||||
|
WHERE name= 'cultivo';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemWrappingTag` (
|
||||||
|
`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`.`itemWrappingTag` (`name`) VALUES ('Bolsa');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja cartón');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja decorativa');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Celofán');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Papel kraft');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Plástico');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Variable');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemWrappingTag'
|
||||||
|
WHERE name= 'Envoltorio';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemLanguageTag` (
|
||||||
|
`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`.`itemLanguageTag` (`name`) VALUES ('Castellano');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Catalán');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Euskera');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Francés');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Gallego');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Inglés');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Portugués');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemLanguageTag'
|
||||||
|
WHERE name= 'Idioma';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemStemTag` (
|
||||||
|
`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`.`itemStemTag` (`name`) VALUES ('Natural');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Seminatural');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Sintético');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemStemTag'
|
||||||
|
WHERE name= 'Tronco';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemBreederTag` (
|
||||||
|
`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`.`itemBreederTag` (`name`) VALUES ('David Austin');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemBreederTag'
|
||||||
|
WHERE name= 'Obtentor';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemBaseTag` (
|
||||||
|
`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`.`itemBaseTag` (`name`) VALUES ('Biodegradable');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Caballete');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cerámica');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cristal');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico por inyección');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Madera');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Rígido');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Ruedas');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Sin soporte rígido');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemBaseTag'
|
||||||
|
WHERE name= 'Soporte';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`itemVatRateTag` (
|
||||||
|
`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`.`itemVatRateTag` (`name`) VALUES ('General');
|
||||||
|
INSERT IGNORE INTO `vn`.`itemVatRateTag` (`name`) VALUES ('Reducido');
|
||||||
|
|
||||||
|
UPDATE vn.tag
|
||||||
|
SET isFree=0,
|
||||||
|
sourceTable='itemVatRateTag'
|
||||||
|
WHERE name= 'Tipo de IVA';
|
||||||
|
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemFarmingTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemLanguageTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemStemTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBaseTag TO logisticAssist;
|
||||||
|
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBreederTag TO logisticAssist;
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
UPDATE `vn`.`client` c
|
||||||
|
JOIN `vn`.`country` co ON co.id=c.countryFk
|
||||||
|
SET c.hasDailyInvoice = co.hasDailyInvoice
|
||||||
|
WHERE co.hasDailyInvoice IS NOT NULL
|
||||||
|
AND c.hasDailyInvoice = FALSE;
|
||||||
|
|
||||||
|
UPDATE `vn`.`client` c
|
||||||
|
JOIN `vn`.`province` p ON p.id=c.provinceFk
|
||||||
|
JOIN `vn`.`autonomy` a ON a.id = p.autonomyFk
|
||||||
|
SET c.hasDailyInvoice = a.hasDailyInvoice
|
||||||
|
WHERE a.hasDailyInvoice IS NOT NULL
|
||||||
|
AND c.hasDailyInvoice = FALSE;
|
|
@ -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 @@
|
||||||
|
ALTER TABLE vn.client CHANGE gestdocFk gestdocFk__ int(11) DEFAULT NULL NULL COMMENT '@deprecated 2024-10-17';
|
|
@ -0,0 +1,3 @@
|
||||||
|
DELETE FROM `salix`.`ACL`
|
||||||
|
WHERE `model` = 'Worker'
|
||||||
|
AND `property` IN ('find', 'findById', 'findOne');
|
|
@ -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,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';
|
|
@ -240,5 +240,10 @@
|
||||||
"There is already a tray with the same height": "There is already a tray with the same height",
|
"There is already a tray with the same height": "There is already a tray with the same height",
|
||||||
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
"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 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"
|
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
||||||
}
|
"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 }}",
|
||||||
|
"null": "null",
|
||||||
|
"Invalid or expired verification code": "Invalid or expired verification code",
|
||||||
|
"Payment method is required": "Payment method is required"
|
||||||
|
}
|
|
@ -350,6 +350,7 @@
|
||||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||||
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
||||||
|
"No invoice series found for these parameters": "No se encontró una serie para estos parámetros",
|
||||||
"The line could not be marked": "La linea no puede ser marcada",
|
"The line could not be marked": "La linea no puede ser marcada",
|
||||||
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
|
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
|
||||||
"They're not your subordinate": "No es tu subordinado/a.",
|
"They're not your subordinate": "No es tu subordinado/a.",
|
||||||
|
@ -382,5 +383,9 @@
|
||||||
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
|
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
|
||||||
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
"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",
|
"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"
|
"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 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}}}",
|
"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}}}",
|
"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}}}",
|
"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 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 quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
||||||
"State": "État",
|
"State": "État",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -350,6 +350,7 @@
|
||||||
"Cmr file does not exist": "Le fichier cmr n'existe pas",
|
"Cmr file does not exist": "Le fichier cmr n'existe pas",
|
||||||
"You are not allowed to modify the alias": "Vous n'êtes pas autorisé à modifier l'alias",
|
"You are not allowed to modify the alias": "Vous n'êtes pas autorisé à modifier l'alias",
|
||||||
"The address of the customer must have information about Incoterms and Customs Agent": "L'adresse du client doit contenir des informations sur les Incoterms et l'agent des douanes",
|
"The address of the customer must have information about Incoterms and Customs Agent": "L'adresse du client doit contenir des informations sur les Incoterms et l'agent des douanes",
|
||||||
|
"No invoice series found for these parameters": "Aucune série de facture trouvée pour ces paramètres",
|
||||||
"The line could not be marked": "La ligne ne peut pas être marquée",
|
"The line could not be marked": "La ligne ne peut pas être marquée",
|
||||||
"This password can only be changed by the user themselves": "Ce mot de passe ne peut être modifié que par l'utilisateur lui-même",
|
"This password can only be changed by the user themselves": "Ce mot de passe ne peut être modifié que par l'utilisateur lui-même",
|
||||||
"They're not your subordinate": "Ce n'est pas votre subordonné.",
|
"They're not your subordinate": "Ce n'est pas votre subordonné.",
|
||||||
|
@ -361,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é",
|
"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é",
|
"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",
|
"Cannot send mail": "Impossible d'envoyer le mail",
|
||||||
"Original invoice not found": "Facture originale introuvable",
|
"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"
|
"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}}}",
|
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) 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 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}}* ",
|
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
||||||
"State": "Estado",
|
"State": "Estado",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -350,6 +350,7 @@
|
||||||
"Cmr file does not exist": "O arquivo CMR não existe",
|
"Cmr file does not exist": "O arquivo CMR não existe",
|
||||||
"You are not allowed to modify the alias": "Você não tem permissão para modificar o alias",
|
"You are not allowed to modify the alias": "Você não tem permissão para modificar o alias",
|
||||||
"The address of the customer must have information about Incoterms and Customs Agent": "O endereço do cliente deve ter informações sobre Incoterms e Agente Aduaneiro",
|
"The address of the customer must have information about Incoterms and Customs Agent": "O endereço do cliente deve ter informações sobre Incoterms e Agente Aduaneiro",
|
||||||
|
"No invoice series found for these parameters": "Nenhuma série de fatura encontrada para esses parâmetros",
|
||||||
"The line could not be marked": "A linha não pôde ser marcada",
|
"The line could not be marked": "A linha não pôde ser marcada",
|
||||||
"This password can only be changed by the user themselves": "Esta senha só pode ser alterada pelo próprio usuário",
|
"This password can only be changed by the user themselves": "Esta senha só pode ser alterada pelo próprio usuário",
|
||||||
"They're not your subordinate": "Eles não são seus subordinados.",
|
"They're not your subordinate": "Eles não são seus subordinados.",
|
||||||
|
@ -360,7 +361,9 @@
|
||||||
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
"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",
|
"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",
|
"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",
|
"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."
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue