primer prototipo #2205
|
@ -1,8 +1,6 @@
|
|||
DROP PROCEDURE IF EXISTS vn.boxPicking_print;
|
||||
|
||||
DELIMITER $$
|
||||
pako marked this conversation as resolved
|
||||
$$
|
||||
CREATE PROCEDURE vn.boxPicking_print(
|
||||
CREATE OR REPLACE PROCEDURE vn.sale_boxPickingPrint(
|
||||
IN vPrinterFk INT,
|
||||
IN vSaleFk INT,
|
||||
pako marked this conversation as resolved
jgallego
commented
el nom del proc ha de fer referencia a la taula principal amb la que treballa jo mirant-ho veig que s'agafa una sale i es meneja a un altre ticket. CREATE OR REPLACE PROCEDURE vn.sale_splitAndPrint Encara que es molt probable que si en el futur alguna etiqueta no s'imprimeix necesitem separa la part d'imprimir, per a que ho valores. el nom del proc ha de fer referencia a la taula principal amb la que treballa
jo mirant-ho veig que s'agafa una sale i es meneja a un altre ticket.
CREATE OR REPLACE PROCEDURE vn.sale_splitAndPrint
Encara que es molt probable que si en el futur alguna etiqueta no s'imprimeix necesitem separa la part d'imprimir, per a que ho valores.
|
||||
IN vPacking INT,
|
||||
|
@ -12,10 +10,9 @@ CREATE PROCEDURE vn.boxPicking_print(
|
|||
IN vPackingSiteFk INT)
|
||||
BEGIN
|
||||
/** Splits a line of sale to a different ticket and prints the transport sticker
|
||||
*
|
||||
*/
|
||||
DECLARE vAgencyModeFk INT;
|
||||
DECLARE vConcept VARCHAR(20);
|
||||
DECLARE vConcept VARCHAR(30);
|
||||
DECLARE vExpeditionFk INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vItemShelvingFk INT;
|
||||
|
@ -64,7 +61,7 @@ BEGIN
|
|||
|
||||
w1: WHILE vQuantity >= vPacking DO
|
||||
|
||||
SET vItemShelvingFk = 0;
|
||||
SET vItemShelvingFk = NULL;
|
||||
|
||||
SELECT sub.id
|
||||
INTO vItemShelvingFk
|
||||
pako marked this conversation as resolved
jgallego
commented
vItemShelvingFk = NULL vItemShelvingFk = NULL
|
||||
|
@ -103,7 +100,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
LEAVE w1;
|
||||
END IF;
|
||||
|
||||
SET vNewTicketFk = 0;
|
||||
SET vNewTicketFk = NULL;
|
||||
|
||||
SELECT MAX(t.id) INTO vNewTicketFk
|
||||
FROM vn.ticket t
|
||||
|
@ -117,7 +114,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
AND t.warehouseFk = tt.warehouseFk
|
||||
WHERE tls.name = 'Encajado' ;
|
||||
|
||||
IF vNewTicketFk = 0 THEN
|
||||
IF ISNULL(vNewTicketFk) THEN
|
||||
INSERT INTO vn.ticket( clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
|
@ -163,7 +160,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
|
||||
UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
|
||||
|
||||
SET vNewSaleFk = 0;
|
||||
SET vNewSaleFk = NULL;
|
||||
|
||||
SELECT MAX(id) INTO vNewSaleFk
|
||||
FROM sale
|
||||
pako marked this conversation as resolved
jgallego
commented
millor gastar null per a dir que no hi ha un valor real millor gastar null per a dir que no hi ha un valor real
|
||||
|
@ -175,7 +172,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
SET quantity = quantity + vPacking
|
||||
WHERE id = vNewSaleFk;
|
||||
|
||||
SET vItemShelvingSaleFk_old = 0;
|
||||
SET vItemShelvingSaleFk_old = NULL;
|
||||
|
||||
SELECT MAX(id) INTO vItemShelvingSaleFk_old
|
||||
FROM vn.itemShelvingSale
|
||||
|
@ -245,8 +242,8 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
h.code,
|
||||
vPackingSiteFk,
|
||||
ps.monitorId,
|
||||
started = IFNULL(vLastExpeditionTimeStamp, Now()),
|
||||
ended = Now()
|
||||
IFNULL(vLastExpeditionTimeStamp, Now()),
|
||||
pako marked this conversation as resolved
Outdated
jgallego
commented
NOW NOW
|
||||
Now()
|
||||
FROM packingSite ps
|
||||
JOIN host h ON h.id = ps.hostFk
|
||||
JOIN item i ON i.name = 'Shipping cost'
|
||||
|
@ -266,15 +263,15 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
JOIN parking p ON p.id = sh.parkingFk
|
||||
WHERE ish.id = vItemShelvingFk;
|
||||
|
||||
UPDATE dipole.expedition_PrintOut SET
|
||||
isPrinted = FALSE,
|
||||
itemFk = vItemFk,
|
||||
quantity = vPacking,
|
||||
longName = vConcept,
|
||||
shelvingFk = vShelving,
|
||||
parkingCode = vParkingCode,
|
||||
phone = RIGHT(phone,vMaxPhoneLength),
|
||||
street = RIGHT(street, vMAxStreetLength)
|
||||
UPDATE dipole.expedition_PrintOut
|
||||
SET isPrinted = FALSE,
|
||||
itemFk = vItemFk,
|
||||
quantity = vPacking,
|
||||
pako marked this conversation as resolved
Outdated
jgallego
commented
SET en este cas votaria de linea SET en este cas votaria de linea
|
||||
longName = vConcept,
|
||||
shelvingFk = vShelving,
|
||||
parkingCode = vParkingCode,
|
||||
phone = RIGHT(phone,vMaxPhoneLength),
|
||||
street = RIGHT(street, vMAxStreetLength)
|
||||
WHERE expeditionFk = vExpeditionFk;
|
||||
|
||||
DELETE FROM vn.sale
|
||||
|
|
Loading…
Reference in New Issue
si es fa un drop es perden el privilegis, per això els procs a dia de hui tots tenen create or replace