fix: item_getLack
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2025-02-17 11:33:07 +01:00
parent 2bed2d63bc
commit f7d953d392
2 changed files with 21 additions and 5 deletions

View File

@ -9,7 +9,9 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getLack`(
vSize INT,
vOrigen INT,
vLack INT,
vWarehouseFk INT
vWarehouseFk INT,
vCategoryFk INT,
vTypeFk INT
)
BEGIN
/**
@ -26,10 +28,12 @@ BEGIN
SELECT i.id itemFk,
i.longName,
i.name,
w.id warehouseFk,
p.`name` producer,
i.`size`,
i.category,
it.categoryFk,
w.name warehouse,
SUM(IFNULL(sub.amount,0)) lack,
i.inkFk,
@ -59,13 +63,15 @@ BEGIN
AND ic.display
AND it.code != 'GEN'
AND (vSelf IS NULL OR i.id = vSelf)
AND (vLongname IS NULL OR i.name = vLongname)
AND (vLongname IS NULL OR i.longName LIKE CONCAT('%', vLongname, '%'))
AND (vProducerName IS NULL OR p.`name` LIKE CONCAT('%', vProducerName, '%'))
AND (vColor IS NULL OR vColor = i.inkFk)
AND (vSize IS NULL OR vSize = i.`size`)
AND (vOrigen IS NULL OR vOrigen = w.id)
AND (vLack IS NULL OR vLack = sub.amount)
AND (vWarehouseFk IS NULL OR vWarehouseFk = w.id)
AND (vCategoryFk IS NULL OR vCategoryFk = it.categoryFk)
AND (vTypeFk IS NULL OR vTypeFk = i.typeFk)
GROUP BY i.id, w.id
HAVING lack < 0;

View File

@ -20,7 +20,7 @@ module.exports = Self => {
description: 'The item id',
},
{
arg: 'longname',
arg: 'longName',
type: 'string',
description: 'Article name',
},
@ -49,6 +49,16 @@ module.exports = Self => {
type: 'number',
description: 'The warehouse id',
},
{
arg: 'typeFk',
type: 'number',
description: 'The type id',
},
{
arg: 'categoryFk',
type: 'number',
description: 'The category id',
},
{
arg: 'lack',
type: 'number',
@ -80,9 +90,9 @@ module.exports = Self => {
Object.assign(myOptions, options);
const filterKeyOrder = [
'itemFk', 'force', 'days', 'longname', 'supplier',
'itemFk', 'force', 'days', 'longName', 'supplier',
'colour', 'size', 'originFk',
'lack', 'warehouseFk'
'lack', 'warehouseFk', 'categoryFk', 'typeFk'
];
delete ctx?.args?.ctx;