This commit is contained in:
parent
710841ba4a
commit
d6451a94e3
|
@ -22,7 +22,6 @@ BEGIN
|
|||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
packageFk,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
|
@ -45,7 +44,6 @@ BEGIN
|
|||
b.containerFk,
|
||||
b.comissionValue,
|
||||
b.packageValue,
|
||||
b.packageFk,
|
||||
b.price1,
|
||||
b.price2,
|
||||
b.price3,
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_cloneByBuy`(
|
||||
OUT vBuyClonedFk INT,
|
||||
IN vSelf INT,
|
||||
IN vEntryFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Clone a buy to an entry
|
||||
*
|
||||
* @param OUT vBuyClonedFk The new cloned buy id
|
||||
* @param vSelf The buy id to clone
|
||||
* @param vEntryFk The destination entry id
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buy
|
||||
SELECT vSelf id;
|
||||
|
||||
CALL buy_clone(vEntryFk);
|
||||
SET vBuyClonedFk = LAST_INSERT_ID();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buy;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -308,20 +308,78 @@ BEGIN
|
|||
WHERE id = vTargetItemShelvingFk;
|
||||
END IF;
|
||||
|
||||
CALL buy_cloneByBuy(vA1BuyFk, vLastBuyFk, vTargetEntryFk);
|
||||
UPDATE buy
|
||||
SET quantity = - LEAST(vQuantity,vCurrentVisible),
|
||||
isIgnored = TRUE,
|
||||
buyingValue = vBuyingValue
|
||||
WHERE id = vA1BuyFk;
|
||||
|
||||
CALL buy_cloneByBuy(vA2BuyFk, vLastBuyFk, vTargetEntryFk);
|
||||
UPDATE buy
|
||||
SET quantity = vQuantity,
|
||||
isIgnored = TRUE,
|
||||
buyingValue = vBuyingValue,
|
||||
itemFk = vItemA2Fk
|
||||
WHERE id = vA2BuyFk;
|
||||
INSERT INTO buy(
|
||||
entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
freightValue,
|
||||
isIgnored,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk)
|
||||
SELECT vTargetEntryFk,
|
||||
itemFk,
|
||||
- LEAST(vQuantity, vCurrentVisible),
|
||||
vBuyingValue,
|
||||
freightValue,
|
||||
TRUE,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
FROM vn.buy
|
||||
WHERE id = vLastBuyFk
|
||||
UNION
|
||||
SELECT vTargetEntryFk,
|
||||
vItemA2Fk,
|
||||
vQuantity,
|
||||
vBuyingValue,
|
||||
freightValue,
|
||||
TRUE,
|
||||
stickers,
|
||||
packagingFk,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
containerFk,
|
||||
comissionValue,
|
||||
packageValue,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
isChecked,
|
||||
location,
|
||||
weight,
|
||||
itemOriginalFk
|
||||
FROM vn.buy
|
||||
WHERE id = vLastBuyFk;
|
||||
|
||||
INSERT INTO itemShelving (
|
||||
itemFk,
|
||||
|
|
Loading…
Reference in New Issue