This commit is contained in:
parent
c265896224
commit
678eb2928f
|
@ -37,6 +37,11 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => {
|
Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => {
|
||||||
if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving');
|
if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving');
|
||||||
|
|
||||||
|
const myOptions = {};
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const result = await Self.rawSql(`
|
const result = await Self.rawSql(`
|
||||||
SELECT COUNT(ish.id) countItemOlder
|
SELECT COUNT(ish.id) countItemOlder
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
|
@ -53,7 +58,7 @@ module.exports = Self => {
|
||||||
AND (p.code <> ? OR ? IS NULL)
|
AND (p.code <> ? OR ? IS NULL)
|
||||||
AND (ish.shelvingFk <> ? OR ? IS NULL)
|
AND (ish.shelvingFk <> ? OR ? IS NULL)
|
||||||
AND (ish.itemFk <> ? OR ? IS NULL)`,
|
AND (ish.itemFk <> ? OR ? IS NULL)`,
|
||||||
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], options);
|
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions);
|
||||||
return result[0]['countItemOlder'] > 0;
|
return result[0]['countItemOlder'] > 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue