Merge branch 'master' of https: refs #6404//gitea.verdnatura.es/verdnatura/salix into 6404-fixrefernce
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
81e1179ce0
|
@ -48,7 +48,7 @@ BEGIN
|
||||||
-- Marcamos para no repetir
|
-- Marcamos para no repetir
|
||||||
UPDATE vn.claimEnd ce
|
UPDATE vn.claimEnd ce
|
||||||
JOIN vn.claim c ON c.id = ce.claimFk
|
JOIN vn.claim c ON c.id = ce.claimFk
|
||||||
SET c.isChargedToMana = TRUE
|
SET ce.isGreuge = TRUE
|
||||||
WHERE ce.claimDestinationFk NOT IN (1,5)
|
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||||
AND NOT ce.isGreuge
|
AND NOT ce.isGreuge
|
||||||
AND c.claimStateFk = 3;
|
AND c.claimStateFk = 3;
|
||||||
|
|
|
@ -13,28 +13,12 @@ BEGIN
|
||||||
* @param vCollectionFk Id de colección
|
* @param vCollectionFk Id de colección
|
||||||
*/
|
*/
|
||||||
DECLARE vHasTooMuchCollections BOOL;
|
DECLARE vHasTooMuchCollections BOOL;
|
||||||
DECLARE vItemPackingTypeFk VARCHAR(1);
|
|
||||||
DECLARE vWarehouseFk INT;
|
|
||||||
DECLARE vLockName VARCHAR(215);
|
|
||||||
DECLARE vLockTime INT DEFAULT 30;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
IF vLockName IS NOT NULL THEN
|
|
||||||
DO RELEASE_LOCK(vLockName);
|
|
||||||
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
-- Si hay colecciones sin terminar, sale del proceso
|
-- Si hay colecciones sin terminar, sale del proceso
|
||||||
CALL collection_get(vUserFk);
|
CALL collection_get(vUserFk);
|
||||||
|
|
||||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
|
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||||
collection_assign_lockname
|
INTO vHasTooMuchCollections
|
||||||
INTO vHasTooMuchCollections,
|
|
||||||
vLockName
|
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tCollection ON TRUE;
|
||||||
|
|
||||||
|
@ -44,21 +28,6 @@ BEGIN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT warehouseFk, itemPackingTypeFk
|
|
||||||
INTO vWarehouseFk, vItemPackingTypeFk
|
|
||||||
FROM operator
|
|
||||||
WHERE workerFk = vUserFk;
|
|
||||||
|
|
||||||
SET vLockName = CONCAT_WS('/',
|
|
||||||
vLockName,
|
|
||||||
vWarehouseFk,
|
|
||||||
vItemPackingTypeFk
|
|
||||||
);
|
|
||||||
|
|
||||||
IF NOT GET_LOCK(vLockName, vLockTime) THEN
|
|
||||||
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Se eliminan las colecciones sin asignar que estan obsoletas
|
-- Se eliminan las colecciones sin asignar que estan obsoletas
|
||||||
INSERT INTO ticketTracking(stateFk, ticketFk)
|
INSERT INTO ticketTracking(stateFk, ticketFk)
|
||||||
SELECT s.id, tc.ticketFk
|
SELECT s.id, tc.ticketFk
|
||||||
|
@ -66,7 +35,7 @@ BEGIN
|
||||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||||
JOIN `state` s ON s.code = 'PRINTED_AUTO'
|
JOIN `state` s ON s.code = 'PRINTED_AUTO'
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE c.workerFk IS NULL
|
WHERE c.workerFk IS NULL
|
||||||
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
|
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
|
||||||
|
|
||||||
DELETE c.*
|
DELETE c.*
|
||||||
|
@ -80,8 +49,7 @@ BEGIN
|
||||||
VALUES(vUserFk);
|
VALUES(vUserFk);
|
||||||
|
|
||||||
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
|
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
|
||||||
SELECT MIN(c.id)
|
SELECT MIN(c.id) INTO vCollectionFk
|
||||||
INTO vCollectionFk
|
|
||||||
FROM `collection` c
|
FROM `collection` c
|
||||||
JOIN operator o
|
JOIN operator o
|
||||||
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
|
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
|
||||||
|
@ -107,7 +75,5 @@ BEGIN
|
||||||
UPDATE `collection`
|
UPDATE `collection`
|
||||||
SET workerFk = vUserFk
|
SET workerFk = vUserFk
|
||||||
WHERE id = vCollectionFk;
|
WHERE id = vCollectionFk;
|
||||||
|
|
||||||
DO RELEASE_LOCK(vLockName);
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -85,8 +85,12 @@ exports.translateValues = async(instance, changes, options = {}) => {
|
||||||
exports.getChanges = (original, changes) => {
|
exports.getChanges = (original, changes) => {
|
||||||
const oldChanges = {};
|
const oldChanges = {};
|
||||||
const newChanges = {};
|
const newChanges = {};
|
||||||
|
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
||||||
|
|
||||||
for (let property in changes) {
|
for (let property in changes) {
|
||||||
|
if (dateRegex.test(original[property]))
|
||||||
|
original[property] = new Date(Date.parse(original[property]));
|
||||||
|
|
||||||
const firstChar = property.substring(0, 1);
|
const firstChar = property.substring(0, 1);
|
||||||
const isPrivate = firstChar == '$';
|
const isPrivate = firstChar == '$';
|
||||||
if (isPrivate) return;
|
if (isPrivate) return;
|
||||||
|
|
|
@ -88,15 +88,17 @@ module.exports = Self => {
|
||||||
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
||||||
|
|
||||||
// When pickup has been changed
|
// When pickup has been changed
|
||||||
if (salesPerson && changedPickup && updatedClaim.pickup)
|
if (salesPerson) {
|
||||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
if (changedPickup && updatedClaim.pickup)
|
||||||
|
await notifyPickUp(ctx, salesPerson.id, claim);
|
||||||
|
|
||||||
// When claimState has been changed
|
// When claimState has been changed
|
||||||
if (args.claimStateFk) {
|
if (args.claimStateFk) {
|
||||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||||
if (newState.code == 'canceled')
|
if (newState.code == 'canceled')
|
||||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
Loading…
Reference in New Issue