#6321 - Negative tickets #1945
|
@ -20,9 +20,13 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const [, , [{collectionFk}]] =
|
const result = await Self.rawSql(`
|
||||||
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
|
CALL vn.collection_assign(?, @vCollectionFk);
|
||||||
[userId], myOptions);
|
SELECT @vCollectionFk collectionFk
|
||||||
|
`, [userId], myOptions);
|
||||||
|
|
||||||
|
// Por si entra en el SELECT FOR UPDATE y retorna un array más
|
||||||
|
const collectionFk = result[2][0]?.collectionFk || result[3][0]?.collectionFk;
|
||||||
|
|
||||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
},
|
},
|
||||||
"itemFk": {
|
"itemFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isChecked": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,30 +13,16 @@ BEGIN
|
||||||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||||
*/
|
*/
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
DECLARE vDistinctTransactions INT;
|
|
||||||
DECLARE vHasRepeatedTransactions BOOL;
|
DECLARE vHasRepeatedTransactions BOOL;
|
||||||
|
|
||||||
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
|
||||||
FROM invoiceIn ii
|
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
|
||||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
|
||||||
WHERE iit.invoiceInFk = vSelf
|
|
||||||
AND iis.taxAreaFk = 'CEE'
|
|
||||||
AND iit.transactionTypeSageFk;
|
|
||||||
|
|
||||||
IF vDistinctTransactions > 1 THEN
|
|
||||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT TRUE INTO vHasRepeatedTransactions
|
SELECT TRUE INTO vHasRepeatedTransactions
|
||||||
FROM invoiceInTax
|
FROM invoiceInTax
|
||||||
WHERE invoiceInFk = vSelf
|
WHERE invoiceInFk = vSelf
|
||||||
GROUP BY transactionTypeSageFk
|
HAVING COUNT(DISTINCT transactionTypeSageFk) > 1
|
||||||
HAVING COUNT(transactionTypeSageFk) > 1
|
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
IF vHasRepeatedTransactions THEN
|
IF vHasRepeatedTransactions THEN
|
||||||
CALL util.throw ('This invoice contains repeated types of transactions');
|
CALL util.throw ('This invoice contains different types of transactions');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||||
|
|
|
@ -98,11 +98,12 @@ proc: BEGIN
|
||||||
itemShelvingFk,
|
itemShelvingFk,
|
||||||
saleFk,
|
saleFk,
|
||||||
quantity,
|
quantity,
|
||||||
userFk)
|
isPicked)
|
||||||
SELECT vItemShelvingFk,
|
SELECT vItemShelvingFk,
|
||||||
vSaleFk,
|
vSaleFk,
|
||||||
vReservedQuantity,
|
vReservedQuantity,
|
||||||
vUserFk;
|
vUserFk,
|
||||||
|
FALSE;
|
||||||
|
|
||||||
UPDATE itemShelving
|
UPDATE itemShelving
|
||||||
SET available = available - vReservedQuantity
|
SET available = available - vReservedQuantity
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
ALTER TABLE dipole.expedition_PrintOut ADD isChecked BOOL DEFAULT FALSE NOT NULL COMMENT 'Indica si la expedición ha sido revisada por un revisor';
|
||||||
|
|
||||||
|
DELETE FROM salix.ACL
|
||||||
|
WHERE model = 'Expedition_PrintOut';
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES( 'Expedition_PrintOut', '*', '*', 'ALLOW', 'ROLE', 'production');
|
|
@ -91,11 +91,13 @@ module.exports = Self => {
|
||||||
SELECT t.cmrFk,
|
SELECT t.cmrFk,
|
||||||
t.id ticketFk,
|
t.id ticketFk,
|
||||||
t.routeFk,
|
t.routeFk,
|
||||||
co.name country,
|
co.id countryFk,
|
||||||
|
co.name countryName,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
IF(sub.id, TRUE, FALSE) hasCmrDms,
|
IF(sub.id, TRUE, FALSE) hasCmrDms,
|
||||||
DATE(t.shipped) shipped,
|
DATE(t.shipped) shipped,
|
||||||
t.warehouseFk
|
t.warehouseFk,
|
||||||
|
w.name warehouseName
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN state s ON s.id = ts.stateFk
|
JOIN state s ON s.id = ts.stateFk
|
||||||
|
|
|
@ -91,25 +91,20 @@ module.exports = Self => {
|
||||||
let where = buildFilter(ctx.args, (param, value) => {
|
let where = buildFilter(ctx.args, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return {'r.id': value};
|
return {'id': value};
|
||||||
case 'from':
|
case 'from':
|
||||||
return {'r.created': {gte: value}};
|
return {'created': {gte: value}};
|
||||||
case 'to':
|
case 'to':
|
||||||
return {'r.created': {lte: value}};
|
return {'created': {lte: value}};
|
||||||
case 'm3':
|
|
||||||
return {'r.m3': value};
|
|
||||||
case 'description':
|
case 'description':
|
||||||
return {'r.description': {like: `%${value}%`}};
|
return {'description': {like: `%${value}%`}};
|
||||||
|
case 'isOk':
|
||||||
|
case 'm3':
|
||||||
case 'warehouseFk':
|
case 'warehouseFk':
|
||||||
param = `v.${param}`;
|
|
||||||
return {[param]: value};
|
|
||||||
case 'workerFk':
|
case 'workerFk':
|
||||||
case 'vehicleFk':
|
case 'vehicleFk':
|
||||||
case 'agencyModeFk':
|
case 'agencyModeFk':
|
||||||
param = `r.${param}`;
|
|
||||||
return {[param]: value};
|
return {[param]: value};
|
||||||
case 'isOk':
|
|
||||||
return {'r.isOk': value};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -119,7 +114,9 @@ module.exports = Self => {
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
`SELECT
|
`SELECT *
|
||||||
|
FROM(
|
||||||
|
SELECT
|
||||||
r.id,
|
r.id,
|
||||||
r.workerFk,
|
r.workerFk,
|
||||||
r.created,
|
r.created,
|
||||||
|
@ -136,17 +133,19 @@ module.exports = Self => {
|
||||||
r.m3,
|
r.m3,
|
||||||
r.description,
|
r.description,
|
||||||
am.name agencyName,
|
am.name agencyName,
|
||||||
u.name AS workerUserName,
|
u.name workerUserName,
|
||||||
v.numberPlate AS vehiclePlateNumber,
|
v.numberPlate vehiclePlateNumber,
|
||||||
Date_format(r.time, '%H:%i') hour,
|
Date_format(r.time, '%H:%i') hour,
|
||||||
eu.email
|
eu.email,
|
||||||
|
v.warehouseFk
|
||||||
FROM route r
|
FROM route r
|
||||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN agency a ON a.id = am.agencyFk
|
LEFT JOIN agency a ON a.id = am.agencyFk
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN worker w ON w.id = r.workerFk
|
LEFT JOIN worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.id
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
LEFT JOIN account.emailUser eu ON eu.userFk = r.workerFk`
|
LEFT JOIN account.emailUser eu ON eu.userFk = r.workerFk
|
||||||
|
) sub`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
|
@ -28,11 +28,11 @@ module.exports = Self => {
|
||||||
if (canViewAll) {
|
if (canViewAll) {
|
||||||
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
||||||
filterGrant = {
|
filterGrant = {
|
||||||
where: {'a.warehouseFk': userConfig.warehouseFk}
|
where: {'warehouseFk': userConfig.warehouseFk}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
filterGrant = {
|
filterGrant = {
|
||||||
where: {'r.workerFk': userId}
|
where: {'workerFk': userId}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,16 +46,16 @@ module.exports = Self => {
|
||||||
and: [
|
and: [
|
||||||
{
|
{
|
||||||
or: [
|
or: [
|
||||||
{'r.created': currentDate},
|
{'created': currentDate},
|
||||||
{'r.created': nextDay}
|
{'created': nextDay}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
order: [
|
order: [
|
||||||
'r.created ASC',
|
'created ASC',
|
||||||
'r.time ASC',
|
'time ASC',
|
||||||
'am.name ASC'
|
'agencyName ASC'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue