7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
4 changed files with 69 additions and 66 deletions
Showing only changes of commit 45573fed41 - Show all commits

View File

@ -15,14 +15,13 @@ BEGIN
* @param vDated Fecha
* @param vShowType Mostrar tipos
*/
DECLARE vCalcFk INT;
DECLARE vAvailableCalcFk INT;
DECLARE vVisibleCalcFk INT;
DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
WITH itemTags AS (
SELECT i.id,
@ -65,21 +64,21 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1
END AS minQuantity,
iss.visible located,
v.visible located,
b.price2
FROM vn.item i
JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vCalcFk
AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
AND iss.warehouseFk = vWarehouseFk
JOIN itemTags its
WHERE a.available > 0
AND (i.typeFk = its.typeFk OR NOT vShowType)

View File

@ -22,40 +22,42 @@ proc: BEGIN
CALL util.throw('parkingNotExist');
LEAVE proc;
END IF;
IF vParam REGEXP '^[0-9]+$' THEN
-- Se comprueba si es una preparación previa
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
-- Se comprueba si es una preparación previa
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
IF vIsSaleGroup THEN
CALL vn.saleGroup_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
IF vIsSaleGroup THEN
CALL vn.saleGroup_setParking(vParam, vParkingFk);
LEAVE proc;
-- Se comprueba si es un ticket
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
ELSE
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END IF;
-- Se comprueba si es un ticket
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END$$
DELIMITER ;

View File

@ -44,7 +44,6 @@ BEGIN
WHERE s.ticketFk = vTicketFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
(PRIMARY KEY (itemPackingTypeFk))
ENGINE = MEMORY
SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tmp.sale
@ -56,8 +55,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
ticketFk INT,
itemPackingTypeFk VARCHAR(1),
PRIMARY KEY (ticketFk)
itemPackingTypeFk VARCHAR(1)
) ENGINE = MEMORY;
CASE vPackingTypesToSplit

View File

@ -26,29 +26,33 @@
},
"labelerFk": {
"type": "number"
},
"isOnReservationMode": {
"type": "boolean",
"required": true
}
},
},
"relations": {
"sector": {
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
},
"sector": {
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
},
"train": {
"type": "belongsTo",
"model": "Train",
"foreignKey": "trainFk"
},
"type": "belongsTo",
"model": "Train",
"foreignKey": "trainFk"
},
"printer": {
"type": "belongsTo",
"model": "Printer",
"foreignKey": "labelerFk"
},
"type": "belongsTo",
"model": "Printer",
"foreignKey": "labelerFk"
},
"itemPackingType": {
"type": "belongsTo",
"model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk",
"type": "belongsTo",
"model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk",
"primaryKey": "code"
}
}
}
}
}
}