primer prototipo #2205
|
@ -1,8 +1,6 @@
|
||||||
DROP PROCEDURE IF EXISTS vn.boxPicking_print;
|
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
pako marked this conversation as resolved
|
|||||||
$$
|
$$
|
||||||
CREATE PROCEDURE vn.boxPicking_print(
|
CREATE OR REPLACE PROCEDURE vn.sale_boxPickingPrint(
|
||||||
IN vPrinterFk INT,
|
IN vPrinterFk INT,
|
||||||
IN vSaleFk 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,
|
IN vPacking INT,
|
||||||
|
@ -12,10 +10,9 @@ CREATE PROCEDURE vn.boxPicking_print(
|
||||||
IN vPackingSiteFk INT)
|
IN vPackingSiteFk INT)
|
||||||
BEGIN
|
BEGIN
|
||||||
/** Splits a line of sale to a different ticket and prints the transport sticker
|
/** Splits a line of sale to a different ticket and prints the transport sticker
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
DECLARE vAgencyModeFk INT;
|
DECLARE vAgencyModeFk INT;
|
||||||
DECLARE vConcept VARCHAR(20);
|
DECLARE vConcept VARCHAR(30);
|
||||||
DECLARE vExpeditionFk INT;
|
DECLARE vExpeditionFk INT;
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vItemShelvingFk INT;
|
DECLARE vItemShelvingFk INT;
|
||||||
|
@ -64,7 +61,7 @@ BEGIN
|
||||||
|
|
||||||
w1: WHILE vQuantity >= vPacking DO
|
w1: WHILE vQuantity >= vPacking DO
|
||||||
|
|
||||||
SET vItemShelvingFk = 0;
|
SET vItemShelvingFk = NULL;
|
||||||
|
|
||||||
SELECT sub.id
|
SELECT sub.id
|
||||||
INTO vItemShelvingFk
|
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;
|
LEAVE w1;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SET vNewTicketFk = 0;
|
SET vNewTicketFk = NULL;
|
||||||
|
|
||||||
SELECT MAX(t.id) INTO vNewTicketFk
|
SELECT MAX(t.id) INTO vNewTicketFk
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
|
@ -117,7 +114,7 @@ w1: WHILE vQuantity >= vPacking DO
|
||||||
AND t.warehouseFk = tt.warehouseFk
|
AND t.warehouseFk = tt.warehouseFk
|
||||||
WHERE tls.name = 'Encajado' ;
|
WHERE tls.name = 'Encajado' ;
|
||||||
|
|
||||||
IF vNewTicketFk = 0 THEN
|
IF ISNULL(vNewTicketFk) THEN
|
||||||
INSERT INTO vn.ticket( clientFk,
|
INSERT INTO vn.ticket( clientFk,
|
||||||
shipped,
|
shipped,
|
||||||
addressFk,
|
addressFk,
|
||||||
|
@ -163,7 +160,7 @@ w1: WHILE vQuantity >= vPacking DO
|
||||||
|
|
||||||
UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
|
UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
|
||||||
|
|
||||||
SET vNewSaleFk = 0;
|
SET vNewSaleFk = NULL;
|
||||||
|
|
||||||
SELECT MAX(id) INTO vNewSaleFk
|
SELECT MAX(id) INTO vNewSaleFk
|
||||||
FROM sale
|
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
|
SET quantity = quantity + vPacking
|
||||||
WHERE id = vNewSaleFk;
|
WHERE id = vNewSaleFk;
|
||||||
|
|
||||||
SET vItemShelvingSaleFk_old = 0;
|
SET vItemShelvingSaleFk_old = NULL;
|
||||||
|
|
||||||
SELECT MAX(id) INTO vItemShelvingSaleFk_old
|
SELECT MAX(id) INTO vItemShelvingSaleFk_old
|
||||||
FROM vn.itemShelvingSale
|
FROM vn.itemShelvingSale
|
||||||
|
@ -245,8 +242,8 @@ w1: WHILE vQuantity >= vPacking DO
|
||||||
h.code,
|
h.code,
|
||||||
vPackingSiteFk,
|
vPackingSiteFk,
|
||||||
ps.monitorId,
|
ps.monitorId,
|
||||||
started = IFNULL(vLastExpeditionTimeStamp, Now()),
|
IFNULL(vLastExpeditionTimeStamp, Now()),
|
||||||
pako marked this conversation as resolved
Outdated
jgallego
commented
NOW NOW
|
|||||||
ended = Now()
|
Now()
|
||||||
FROM packingSite ps
|
FROM packingSite ps
|
||||||
JOIN host h ON h.id = ps.hostFk
|
JOIN host h ON h.id = ps.hostFk
|
||||||
JOIN item i ON i.name = 'Shipping cost'
|
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
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
WHERE ish.id = vItemShelvingFk;
|
WHERE ish.id = vItemShelvingFk;
|
||||||
|
|
||||||
UPDATE dipole.expedition_PrintOut SET
|
UPDATE dipole.expedition_PrintOut
|
||||||
isPrinted = FALSE,
|
SET isPrinted = FALSE,
|
||||||
itemFk = vItemFk,
|
itemFk = vItemFk,
|
||||||
quantity = vPacking,
|
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,
|
longName = vConcept,
|
||||||
shelvingFk = vShelving,
|
shelvingFk = vShelving,
|
||||||
parkingCode = vParkingCode,
|
parkingCode = vParkingCode,
|
||||||
phone = RIGHT(phone,vMaxPhoneLength),
|
phone = RIGHT(phone,vMaxPhoneLength),
|
||||||
street = RIGHT(street, vMAxStreetLength)
|
street = RIGHT(street, vMAxStreetLength)
|
||||||
WHERE expeditionFk = vExpeditionFk;
|
WHERE expeditionFk = vExpeditionFk;
|
||||||
|
|
||||||
DELETE FROM vn.sale
|
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