feat: refs #7704 Major changes #2717

Merged
guillermo merged 18 commits from 7704-itemMinimalQuantity into dev 2024-07-12 07:43:46 +00:00
2 changed files with 12 additions and 20 deletions
Showing only changes of commit 823756d71a - Show all commits

View File

@ -59,11 +59,8 @@ BEGIN
SELECT quantity INTO vMinQuantity
FROM vn.itemMinimumQuantity
WHERE itemFk = vItem
AND (
util.VN_CURDATE() BETWEEN `started` AND `ended`
OR
(util.VN_CURDATE() >= `started` AND `ended` IS NULL)
)
AND (util.VN_CURDATE() >= `started`
guillermo marked this conversation as resolved Outdated

açò no serà per a hui sera per al dia del pedido, es a dir, si hui fan un pedido per a campanya ha d'agafar si hi ha un min en el futur vShipment

açò no serà per a hui sera per al dia del pedido, es a dir, si hui fan un pedido per a campanya ha d'agafar si hi ha un min en el futur vShipment
AND (util.VN_CURDATE() <= `ended` OR `ended` IS NULL))
AND (warehouseFk = vWarehouse OR warehouseFk IS NULL)
LIMIT 1;

View File

@ -83,8 +83,8 @@ module.exports = Self => {
const [itemInfo] = await models.Sale.rawSql(`SELECT available FROM tmp.ticketCalculateItem`, null, ctx.options);
const available = itemInfo?.available;
if ((!isReduction && !available) || available < quantityAdded)
throw new UserError(`This item is not available`);
// if ((!isReduction && !available) || available < quantityAdded)
// throw new UserError(`This item is not available`);
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
@ -93,21 +93,16 @@ module.exports = Self => {
fields: ['quantity'],
where: {
itemFk: itemId,
started: {lte: today},
guillermo marked this conversation as resolved Outdated

ticket .shipped

ticket .shipped
or: [
{
and: [
{started: {lte: today}},
{ended: {gte: today}}
]
},
{
and: [
{started: {lte: today}},
{ended: null}
]
}
{ended: {gte: today}},
{ended: null}
],
warehouseFk: {inq: [ticket.warehouseFk, null]}
// eslint-disable-next-line no-dupe-keys
or: [
{warehouseFk: ticket.warehouseFk},
{warehouseFk: null}
]
},
limit: 1
}, ctx.options);