feat: conversion art. A1 a A2 refs #4979
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-05-08 17:38:52 +02:00
parent 710841ba4a
commit d6451a94e3
3 changed files with 73 additions and 40 deletions

View File

@ -22,7 +22,6 @@ BEGIN
containerFk, containerFk,
comissionValue, comissionValue,
packageValue, packageValue,
packageFk,
price1, price1,
price2, price2,
price3, price3,
@ -45,7 +44,6 @@ BEGIN
b.containerFk, b.containerFk,
b.comissionValue, b.comissionValue,
b.packageValue, b.packageValue,
b.packageFk,
b.price1, b.price1,
b.price2, b.price2,
b.price3, b.price3,

View File

@ -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 ;

View File

@ -308,20 +308,78 @@ BEGIN
WHERE id = vTargetItemShelvingFk; WHERE id = vTargetItemShelvingFk;
END IF; END IF;
CALL buy_cloneByBuy(vA1BuyFk, vLastBuyFk, vTargetEntryFk); INSERT INTO buy(
UPDATE buy entryFk,
SET quantity = - LEAST(vQuantity,vCurrentVisible), itemFk,
isIgnored = TRUE, quantity,
buyingValue = vBuyingValue buyingValue,
WHERE id = vA1BuyFk; freightValue,
isIgnored,
CALL buy_cloneByBuy(vA2BuyFk, vLastBuyFk, vTargetEntryFk); stickers,
UPDATE buy packagingFk,
SET quantity = vQuantity, packing,
isIgnored = TRUE, `grouping`,
buyingValue = vBuyingValue, groupingMode,
itemFk = vItemA2Fk containerFk,
WHERE id = vA2BuyFk; 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 ( INSERT INTO itemShelving (
itemFk, itemFk,