feat: refs #7686 Added new alertLevel APPROVED and changes in vn.state.alertLevel #2890
|
@ -65,15 +65,14 @@ BEGIN
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND s.isPicked = FALSE
|
AND NOT s.isPicked
|
||||||
AND al.code = 'FREE'
|
AND al.code IN ('FREE', 'APPROVED')
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
HAVING notPicked
|
HAVING notPicked
|
||||||
) s ON s.itemFk = v.item_id
|
) s ON s.itemFk = v.item_id
|
||||||
WHERE v.calc_id = vCalc
|
WHERE v.calc_id = vCalc
|
||||||
AND NOT v.visible <=> tv.totalVisible;
|
AND NOT v.visible <=> tv.totalVisible;
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE cWarehouses;
|
CLOSE cWarehouses;
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ BEGIN
|
||||||
)
|
)
|
||||||
SELECT t.id INTO vTicketFk
|
SELECT t.id INTO vTicketFk
|
||||||
FROM vn.ticket t
|
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 tPrevia tp ON tp.ticketFk = t.id
|
||||||
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
|
||||||
JOIN hedera.`order` o ON o.address_id = t.addressFk
|
JOIN hedera.`order` o ON o.address_id = t.addressFk
|
||||||
|
|
|
@ -106,7 +106,7 @@ BEGIN
|
||||||
JOIN alertLevel al ON al.id = tst.alertLevel
|
JOIN alertLevel al ON al.id = tst.alertLevel
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
WHERE t.warehouseFk = vWarehouseFk
|
WHERE t.warehouseFk = vWarehouseFk
|
||||||
AND al.code = 'FREE'
|
AND al.code IN ('FREE', 'APPROVED')
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
) sub ON sub.itemFk = ishr.itemFk
|
) sub ON sub.itemFk = ishr.itemFk
|
||||||
ORDER BY i.typeFk, i.longName;
|
ORDER BY i.typeFk, i.longName;
|
||||||
|
|
|
@ -82,7 +82,7 @@ proc: BEGIN
|
||||||
rm.bufferFk
|
rm.bufferFk
|
||||||
FROM tmp.productionTicket tt
|
FROM tmp.productionTicket tt
|
||||||
JOIN ticket t ON tt.ticketFk = t.id
|
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 ticketStateToday tst ON tst.ticketFk = t.id
|
||||||
LEFT JOIN `state` st ON st.id = tst.state
|
LEFT JOIN `state` st ON st.id = tst.state
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
WHERE p.sectorFk = vSectorFk
|
WHERE p.sectorFk = vSectorFk
|
||||||
) sub ON sub.id = td.ticketFk
|
) 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'
|
JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED'
|
||||||
SET td.selected = tdst2.id
|
SET td.selected = tdst2.id
|
||||||
WHERE td.selected = tdst.id;
|
WHERE td.selected = tdst.id;
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN
|
||||||
SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id
|
SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id
|
||||||
INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree
|
INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree
|
||||||
FROM ticket t
|
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
|
LEFT JOIN ticketState ts ON ts.ticketFk = vTicket
|
||||||
WHERE t.id = vTicket;
|
WHERE t.id = vTicket;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
||||||
CREATE TEMPORARY TABLE tTicket
|
CREATE TEMPORARY TABLE tTicket
|
||||||
SELECT ticketFk
|
SELECT ticketFk
|
||||||
FROM tmp.productionBuffer
|
FROM tmp.productionBuffer
|
||||||
JOIN alertLevel al ON al.code = 'FREE'
|
JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED')
|
||||||
WHERE shipped = util.VN_CURDATE()
|
WHERE shipped = util.VN_CURDATE()
|
||||||
AND problem LIKE '%I:%'
|
AND problem LIKE '%I:%'
|
||||||
AND (HH <= vHour OR HH = vHour AND mm < vMinute)
|
AND (HH <= vHour OR HH = vHour AND mm < vMinute)
|
||||||
|
|
|
@ -48,14 +48,14 @@ BEGIN
|
||||||
WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated)
|
WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated)
|
||||||
AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated))
|
AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated))
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
AND al.code = 'FREE'
|
AND al.code IN ('FREE', 'APPROVED')
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
) sub
|
) sub
|
||||||
GROUP BY sub.addressFk
|
GROUP BY sub.addressFk
|
||||||
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
||||||
WHERE t.shipped BETWEEN vDated AND util.dayend(vDated)
|
WHERE t.shipped BETWEEN vDated AND util.dayend(vDated)
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
AND al.code = 'FREE'
|
AND al.code IN ('FREE', 'APPROVED')
|
||||||
AND tp.ticketFk IS NULL
|
AND tp.ticketFk IS NULL
|
||||||
GROUP BY sv.ticketFk
|
GROUP BY sv.ticketFk
|
||||||
HAVING liters <= vLitersMax
|
HAVING liters <= vLitersMax
|
||||||
|
|
|
@ -65,7 +65,7 @@ BEGIN
|
||||||
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
||||||
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
|
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
AND al.code = 'FREE'
|
AND al.code IN ('FREE', 'APPROVED')
|
||||||
AND tp.ticketFk IS NULL
|
AND tp.ticketFk IS NULL
|
||||||
GROUP BY sv.ticketFk
|
GROUP BY sv.ticketFk
|
||||||
HAVING futureId;
|
HAVING futureId;
|
||||||
|
|
|
@ -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)
|
|
@ -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
|
||||||
|
);
|
|
@ -288,7 +288,7 @@ module.exports = Self => {
|
||||||
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
||||||
FROM tmp.filter f
|
FROM tmp.filter f
|
||||||
LEFT JOIN alertLevel al ON al.id = f.alertLevel
|
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]);
|
AND f.shipped >= ?`, [date]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ module.exports = Self => {
|
||||||
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
||||||
FROM tmp.filter f
|
FROM tmp.filter f
|
||||||
LEFT JOIN alertLevel al ON al.id = f.alertLevel
|
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 >= ?
|
AND f.shipped >= ?
|
||||||
`, [date]);
|
`, [date]);
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ module.exports = Self => {
|
||||||
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters
|
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters
|
||||||
FROM tmp.filter f
|
FROM tmp.filter f
|
||||||
LEFT JOIN alertLevel al ON al.id = f.alertLevel
|
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);
|
stmts.push(stmt);
|
||||||
|
|
Loading…
Reference in New Issue