From 8f9a7802ab854a82683cd58a06b499b623cca03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Tue, 17 Sep 2024 15:50:51 +0200 Subject: [PATCH] fix: refs #7760 tmp.ticketIPT --- .../vn/procedures/productionControl.sql | 21 ++++++++----------- .../ticket_splitItemPackingType.sql | 4 ++-- .../11241-grayPalmetto/00-firstScript.sql | 2 ++ 3 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 db/versions/11241-grayPalmetto/00-firstScript.sql diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index 5d97e3f55..ffc8040d5 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -99,7 +99,7 @@ proc: BEGIN LEFT JOIN `zone` z ON z.id = t.zoneFk LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk AND DATE(t.shipped) = zc.dated - LEFT JOIN ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN ticketParking tp ON tp.ticketFk = t.id LEFT JOIN parking pk ON pk.id = tp.parkingFk WHERE t.warehouseFk = vWarehouseFk AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP'); @@ -124,8 +124,8 @@ proc: BEGIN ADD COLUMN `collectionN` INT; UPDATE tmp.productionBuffer pb - JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk - SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage, ''), + JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk + SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage, ''), IFNULL(tp.itemDelay, ''), IFNULL(tp.itemLost, ''), IF(tp.isFreezed, ' CONGELADO',''), @@ -141,7 +141,7 @@ proc: BEGIN LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk JOIN productionConfig pc SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) - WHERE (cnb.clientFk IS NULL OR cnb.isRookie) + WHERE (cnb.clientFk IS NULL OR cnb.isRookie) AND pc.rookieDays; -- Líneas y volumen por ticket @@ -268,16 +268,13 @@ proc: BEGIN UPDATE tmp.productionBuffer pb JOIN sale s ON s.ticketFk = pb.ticketFk JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk AND lb.item_id = s.itemFk + JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk + AND lb.item_id = s.itemFk JOIN buy b ON b.id = lb.buy_id JOIN packaging p ON p.id = b.packagingFk - JOIN productionConfig pc - SET hasPlantTray = TRUE - WHERE ic.code = 'plant' - AND p.`depth` >= pc.minPlantTrayLength - AND pb.isOwn; + SET pb.hasPlantTray = TRUE + WHERE p.isPlantTray + AND pb.isOwn; DROP TEMPORARY TABLE tmp.productionTicket, diff --git a/db/routines/vn/procedures/ticket_splitItemPackingType.sql b/db/routines/vn/procedures/ticket_splitItemPackingType.sql index 407b8cdde..7839b0008 100644 --- a/db/routines/vn/procedures/ticket_splitItemPackingType.sql +++ b/db/routines/vn/procedures/ticket_splitItemPackingType.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitItemPacki vSelf INT, vOriginalItemPackingTypeFk VARCHAR(1) ) -BEGIN +proc: BEGIN /** * Clona y reparte las líneas de ventas de un ticket en funcion del tipo de empaquetado. * Respeta el id de ticket inicial para el tipo de empaquetado propuesto. @@ -31,7 +31,7 @@ BEGIN AND i.itemPackingTypeFk = vOriginalItemPackingTypeFk; IF NOT vHasItemPackingType THEN - CALL util.throw('The ticket has not sales with the itemPackingType'); + LEAVE proc; END IF; CREATE OR REPLACE TEMPORARY TABLE tSalesToMove ( diff --git a/db/versions/11241-grayPalmetto/00-firstScript.sql b/db/versions/11241-grayPalmetto/00-firstScript.sql new file mode 100644 index 000000000..b9ae692c6 --- /dev/null +++ b/db/versions/11241-grayPalmetto/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.packaging ADD IF NOT EXISTS isPlantTray BOOL DEFAULT FALSE NOT NULL + COMMENT 'The container is a plant tray. Used to restrict the picking of full plant trays, to make previous picking.'; \ No newline at end of file