Merge pull request 'test' (!2815) from test into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2815
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Sergio De la torre 2024-07-30 16:13:13 +00:00
commit eec7790a02
3 changed files with 68 additions and 58 deletions

View File

@ -57,8 +57,10 @@ module.exports = Self => {
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving, ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving, COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
sh.code, sh.code,
IFNULL(p2.code, p.code) parkingCode, p2.code parkingCode,
IFNULL(p2.pickingOrder, p.pickingOrder) pickingOrder, p2.pickingOrder pickingOrder,
p.code parkingCodePrevia,
p.pickingOrder pickingOrderPrevia,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
iss.isPicked iss.isPicked
FROM ticketCollection tc FROM ticketCollection tc
@ -95,8 +97,10 @@ module.exports = Self => {
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder), ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder),
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) , COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) ,
sh.code, sh.code,
IFNULL(p2.code, p.code), p2.code,
IFNULL(p2.pickingOrder, p.pickingOrder), p2.pickingOrder,
p.code,
p.pickingOrder,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
iss.isPicked iss.isPicked
FROM sectorCollection sc FROM sectorCollection sc

View File

@ -30,12 +30,12 @@ BEGIN
FROM itemShelvingSale iss FROM itemShelvingSale iss
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
WHERE iss.itemShelvingFk = vItemShelvingFk WHERE iss.itemShelvingFk = vItemShelvingFk
AND iss.itemFk = vItemFk AND ish.itemFk = vItemFk
AND NOT iss.isPicked AND NOT iss.isPicked
FOR UPDATE; FOR UPDATE;
INSERT INTO itemShelvingSaleReserve (saleFk, vSectorFk) INSERT INTO itemShelvingSaleReserve (saleFk, sectorFk)
SELECT DISTINCT iss.saleFk SELECT DISTINCT iss.saleFk, vSectorFk
FROM itemShelvingSale iss FROM itemShelvingSale iss
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
WHERE iss.itemShelvingFk = vItemShelvingFk WHERE iss.itemShelvingFk = vItemShelvingFk

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE vn.itemShelvingSaleReserve DROP FOREIGN KEY IF EXISTS itemShelvingSaleReserve_sector_FK;
ALTER TABLE vn.itemShelvingSaleReserve ADD CONSTRAINT itemShelvingSaleReserve_sector_FK
FOREIGN KEY IF NOT EXISTS (sectorFk) REFERENCES vn.sector(id) ON DELETE RESTRICT ON UPDATE CASCADE;