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
|
||||
UPDATE vn.claimEnd ce
|
||||
JOIN vn.claim c ON c.id = ce.claimFk
|
||||
SET c.isChargedToMana = TRUE
|
||||
SET ce.isGreuge = TRUE
|
||||
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||
AND NOT ce.isGreuge
|
||||
AND c.claimStateFk = 3;
|
||||
|
|
|
@ -13,28 +13,12 @@ BEGIN
|
|||
* @param vCollectionFk Id de colección
|
||||
*/
|
||||
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
|
||||
CALL collection_get(vUserFk);
|
||||
|
||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
|
||||
collection_assign_lockname
|
||||
INTO vHasTooMuchCollections,
|
||||
vLockName
|
||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||
INTO vHasTooMuchCollections
|
||||
FROM productionConfig pc
|
||||
LEFT JOIN tCollection ON TRUE;
|
||||
|
||||
|
@ -44,21 +28,6 @@ BEGIN
|
|||
CALL util.throw('Hay colecciones pendientes');
|
||||
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
|
||||
INSERT INTO ticketTracking(stateFk, ticketFk)
|
||||
SELECT s.id, tc.ticketFk
|
||||
|
@ -66,7 +35,7 @@ BEGIN
|
|||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||
JOIN `state` s ON s.code = 'PRINTED_AUTO'
|
||||
JOIN productionConfig pc
|
||||
WHERE c.workerFk IS NULL
|
||||
WHERE c.workerFk IS NULL
|
||||
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
|
||||
|
||||
DELETE c.*
|
||||
|
@ -80,8 +49,7 @@ BEGIN
|
|||
VALUES(vUserFk);
|
||||
|
||||
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
|
||||
SELECT MIN(c.id)
|
||||
INTO vCollectionFk
|
||||
SELECT MIN(c.id) INTO vCollectionFk
|
||||
FROM `collection` c
|
||||
JOIN operator o
|
||||
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
|
||||
|
@ -107,7 +75,5 @@ BEGIN
|
|||
UPDATE `collection`
|
||||
SET workerFk = vUserFk
|
||||
WHERE id = vCollectionFk;
|
||||
|
||||
DO RELEASE_LOCK(vLockName);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -85,8 +85,12 @@ exports.translateValues = async(instance, changes, options = {}) => {
|
|||
exports.getChanges = (original, changes) => {
|
||||
const oldChanges = {};
|
||||
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) {
|
||||
if (dateRegex.test(original[property]))
|
||||
original[property] = new Date(Date.parse(original[property]));
|
||||
|
||||
const firstChar = property.substring(0, 1);
|
||||
const isPrivate = firstChar == '$';
|
||||
if (isPrivate) return;
|
||||
|
|
|
@ -88,15 +88,17 @@ module.exports = Self => {
|
|||
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
||||
|
||||
// When pickup has been changed
|
||||
if (salesPerson && changedPickup && updatedClaim.pickup)
|
||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
||||
if (salesPerson) {
|
||||
if (changedPickup && updatedClaim.pickup)
|
||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
||||
|
||||
// When claimState has been changed
|
||||
if (args.claimStateFk) {
|
||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||
if (newState.code == 'canceled')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
// When claimState has been changed
|
||||
if (args.claimStateFk) {
|
||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||
if (newState.code == 'canceled')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
}
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
|
Loading…
Reference in New Issue