feat: refs #7686 Added new alertLevel APPROVED and changes in vn.state.alertLevel #2890

Open
guillermo wants to merge 2 commits from 7686-onPrevious into dev
14 changed files with 41 additions and 15 deletions

View File

@ -65,15 +65,14 @@ BEGIN
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.alertLevel al ON al.id = ts.alertLevel
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
AND s.isPicked = FALSE
AND al.code = 'FREE'
AND NOT s.isPicked
AND al.code IN ('FREE', 'APPROVED')
AND t.warehouseFk = vWarehouseFk
GROUP BY s.itemFk
HAVING notPicked
) s ON s.itemFk = v.item_id
WHERE v.calc_id = vCalc
AND NOT v.visible <=> tv.totalVisible;
END LOOP;
CLOSE cWarehouses;

View File

@ -134,7 +134,7 @@ BEGIN
)
SELECT t.id INTO vTicketFk
FROM vn.ticket t
JOIN vn.alertLevel al ON al.code = 'FREE'
JOIN vn.alertLevel al ON al.code IN ('FREE', 'APPROVED')
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
JOIN hedera.`order` o ON o.address_id = t.addressFk

View File

@ -106,7 +106,7 @@ BEGIN
JOIN alertLevel al ON al.id = tst.alertLevel
JOIN sale s ON s.ticketFk = t.id
WHERE t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND al.code IN ('FREE', 'APPROVED')
GROUP BY s.itemFk
) sub ON sub.itemFk = ishr.itemFk
ORDER BY i.typeFk, i.longName;

View File

@ -82,7 +82,7 @@ proc: BEGIN
rm.bufferFk
FROM tmp.productionTicket tt
JOIN ticket t ON tt.ticketFk = t.id
JOIN alertLevel al ON al.code = 'FREE'
JOIN alertLevel al ON al.code = 'APPROVED'
LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id
LEFT JOIN `state` st ON st.id = tst.state
LEFT JOIN client c ON c.id = t.clientFk

View File

@ -13,7 +13,7 @@ BEGIN
JOIN vn.parking p ON p.id = sh.parkingFk
WHERE p.sectorFk = vSectorFk
) sub ON sub.id = td.ticketFk
JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE'
JOIN vn.ticketDown_SelectionType tdst ON tdst.description IN ('FREE', 'APPROVED')
JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED'
SET td.selected = tdst2.id
WHERE td.selected = tdst.id;

View File

@ -12,7 +12,7 @@ BEGIN
SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id
INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree
FROM ticket t
JOIN alertLevel al ON al.code = 'FREE'
JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED')
LEFT JOIN ticketState ts ON ts.ticketFk = vTicket
WHERE t.id = vTicket;

View File

@ -13,7 +13,7 @@ BEGIN
CREATE TEMPORARY TABLE tTicket
SELECT ticketFk
FROM tmp.productionBuffer
JOIN alertLevel al ON al.code = 'FREE'
JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED')
WHERE shipped = util.VN_CURDATE()
AND problem LIKE '%I:%'
AND (HH <= vHour OR HH = vHour AND mm < vMinute)

View File

@ -48,14 +48,14 @@ BEGIN
WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated)
AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated))
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND al.code IN ('FREE', 'APPROVED')
GROUP BY t.id
) sub
GROUP BY sub.addressFk
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
WHERE t.shipped BETWEEN vDated AND util.dayend(vDated)
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND al.code IN ('FREE', 'APPROVED')
AND tp.ticketFk IS NULL
GROUP BY sv.ticketFk
HAVING liters <= vLitersMax

View File

@ -65,7 +65,7 @@ BEGIN
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND al.code IN ('FREE', 'APPROVED')
AND tp.ticketFk IS NULL
GROUP BY sv.ticketFk
HAVING futureId;

View File

@ -0,0 +1,6 @@
UPDATE vn.alertLevel SET id = 5 WHERE id = 4;
UPDATE vn.alertLevel SET id = 4 WHERE id = 3;
UPDATE vn.alertLevel SET id = 3 WHERE id = 2;
UPDATE vn.alertLevel SET id = 2 WHERE id = 1;
INSERT INTO vn.alertLevel (code, id, hasToRecalcPrice)
VALUES ('APPROVED', 1, 1)

View File

@ -0,0 +1,21 @@
UPDATE vn.state
SET alertLevel = 1 -- APPROVED
WHERE id IN (
3, -- Ok
4 -- Impreso
);
UPDATE vn.state
SET alertLevel = 2 -- ON_PREVIOUS
WHERE id IN (
36, -- Previa Revisando
37, -- Previa Revisado
26, -- Prep Previa
28, -- Previa OK
29, -- Previa Impreso
31, -- Polizon Impreso
32, -- Polizon OK
20, -- Asignado
23, -- URGENTE
33 -- Auto_Impreso
);

View File

@ -288,7 +288,7 @@ module.exports = Self => {
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
FROM tmp.filter f
LEFT JOIN alertLevel al ON al.id = f.alertLevel
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL)
AND f.shipped >= ?`, [date]);
stmts.push(stmt);

View File

@ -299,7 +299,7 @@ module.exports = Self => {
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
FROM tmp.filter f
LEFT JOIN alertLevel al ON al.id = f.alertLevel
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL)
AND f.shipped >= ?
`, [date]);

View File

@ -152,7 +152,7 @@ module.exports = Self => {
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters
FROM tmp.filter f
LEFT JOIN alertLevel al ON al.id = f.alertLevel
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL)
`);
stmts.push(stmt);