refactor: refs #6453 order_confirmWithUser
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
b75bdc07c2
commit
a8d0345073
|
@ -17,7 +17,7 @@ BEGIN
|
||||||
DECLARE vShipment DATE;
|
DECLARE vShipment DATE;
|
||||||
DECLARE vTicketFk INT;
|
DECLARE vTicketFk INT;
|
||||||
DECLARE vNotes VARCHAR(255);
|
DECLARE vNotes VARCHAR(255);
|
||||||
DECLARE vItem INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vConcept VARCHAR(30);
|
DECLARE vConcept VARCHAR(30);
|
||||||
DECLARE vAmount INT;
|
DECLARE vAmount INT;
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
DECLARE vPrice DECIMAL(10,2);
|
||||||
|
@ -46,12 +46,12 @@ BEGIN
|
||||||
GROUP BY r.warehouse_id;
|
GROUP BY r.warehouse_id;
|
||||||
|
|
||||||
DECLARE cRows CURSOR FOR
|
DECLARE cRows CURSOR FOR
|
||||||
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
|
SELECT r.id, r.itemFk, i.name, r.amount, r.price, r.rate, i.isFloramondo
|
||||||
FROM order_row r
|
FROM orderRow r
|
||||||
JOIN vn.item i ON i.id = r.item_id
|
JOIN vn.item i ON i.id = r.itemFk
|
||||||
WHERE r.amount
|
WHERE r.amount
|
||||||
AND r.warehouse_id = vWarehouseFk
|
AND r.warehouseFk = vWarehouseFk
|
||||||
AND r.order_id = vSelf
|
AND r.orderFk = vSelf
|
||||||
ORDER BY r.rate DESC;
|
ORDER BY r.rate DESC;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
@ -185,7 +185,7 @@ BEGIN
|
||||||
OPEN cRows;
|
OPEN cRows;
|
||||||
lRows: LOOP
|
lRows: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH cRows INTO vRowFk, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
|
FETCH cRows INTO vRowFk, vItemFk, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE lRows;
|
LEAVE lRows;
|
||||||
|
@ -197,7 +197,7 @@ BEGIN
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
WHERE ticketFk = vTicketFk
|
WHERE ticketFk = vTicketFk
|
||||||
AND price = vPrice
|
AND price = vPrice
|
||||||
AND itemFk = vItem
|
AND itemFk = vItemFk
|
||||||
AND discount = 0
|
AND discount = 0
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ BEGIN
|
||||||
WHERE rc.rowFk = vRowFk;
|
WHERE rc.rowFk = vRowFk;
|
||||||
|
|
||||||
INSERT INTO vn.sale
|
INSERT INTO vn.sale
|
||||||
SET itemFk = vItem,
|
SET itemFk = vItemFk,
|
||||||
ticketFk = vTicketFk,
|
ticketFk = vTicketFk,
|
||||||
concept = vConcept,
|
concept = vConcept,
|
||||||
quantity = vAmount,
|
quantity = vAmount,
|
||||||
|
@ -244,11 +244,11 @@ BEGIN
|
||||||
SELECT GREATEST(0, available) INTO vAvailable
|
SELECT GREATEST(0, available) INTO vAvailable
|
||||||
FROM cache.availableNoRaids
|
FROM cache.availableNoRaids
|
||||||
WHERE calc_id = vCalcFk
|
WHERE calc_id = vCalcFk
|
||||||
AND item_id = vItem;
|
AND item_id = vItemFk;
|
||||||
|
|
||||||
UPDATE cache.availableNoRaids
|
UPDATE cache.availableNoRaids
|
||||||
SET available = GREATEST(0, available - vAmount)
|
SET available = GREATEST(0, available - vAmount)
|
||||||
WHERE item_id = vItem
|
WHERE item_id = vItemFk
|
||||||
AND calc_id = vCalcFk;
|
AND calc_id = vCalcFk;
|
||||||
|
|
||||||
INSERT INTO edi.putOrder (
|
INSERT INTO edi.putOrder (
|
||||||
|
@ -273,7 +273,7 @@ BEGIN
|
||||||
LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientFk
|
LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientFk
|
||||||
JOIN edi.floraHollandConfig fhc
|
JOIN edi.floraHollandConfig fhc
|
||||||
JOIN `order` o ON o.id = vSelf
|
JOIN `order` o ON o.id = vSelf
|
||||||
WHERE i.id = vItem
|
WHERE i.id = vItemFk
|
||||||
AND di.LatestOrderDateTime > util.VN_NOW()
|
AND di.LatestOrderDateTime > util.VN_NOW()
|
||||||
AND vAmount > vAvailable
|
AND vAmount > vAvailable
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
Loading…
Reference in New Issue