Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e64f56cff1
|
@ -40,8 +40,7 @@ proc: BEGIN
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
SUM(quantity) quantity,
|
SUM(quantity) quantity
|
||||||
SUM(quantity) visible
|
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, - s.quantity quantity
|
SELECT s.itemFk, - s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -75,9 +74,17 @@ proc: BEGIN
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
|
UPDATE tmp.itemInventory ai
|
||||||
|
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||||
|
SET ai.inventory = iic.quantity,
|
||||||
|
ai.visible = iic.quantity,
|
||||||
|
ai.avalaible = iic.quantity,
|
||||||
|
ai.sd = iic.quantity;
|
||||||
|
|
||||||
-- Cálculo del visible
|
-- Cálculo del visible
|
||||||
UPDATE tItemInventoryCalc iic
|
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||||
JOIN (
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
SELECT itemFk, SUM(quantity) visible
|
SELECT itemFk, SUM(quantity) visible
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, s.quantity
|
SELECT s.itemFk, s.quantity
|
||||||
|
@ -114,16 +121,11 @@ proc: BEGIN
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
) sub2
|
) sub2
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk;
|
||||||
) sub ON sub.itemFk = iic.itemFk
|
|
||||||
SET iic.visible = iic.visible + sub.visible;
|
|
||||||
|
|
||||||
UPDATE tmp.itemInventory ai
|
UPDATE tmp.itemInventory ai
|
||||||
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
JOIN tItemVisibleCalc ivc ON ivc.itemFk = ai.id
|
||||||
SET ai.inventory = iic.quantity,
|
SET ai.visible = ai.visible + ivc.visible;
|
||||||
ai.visible = iic.visible,
|
|
||||||
ai.avalaible = iic.quantity,
|
|
||||||
ai.sd = iic.quantity;
|
|
||||||
|
|
||||||
-- Calculo del disponible
|
-- Calculo del disponible
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
|
@ -195,6 +197,7 @@ proc: BEGIN
|
||||||
tmp.itemTravel,
|
tmp.itemTravel,
|
||||||
tmp.itemCalc,
|
tmp.itemCalc,
|
||||||
tItemInventoryCalc,
|
tItemInventoryCalc,
|
||||||
|
tItemVisibleCalc,
|
||||||
tmp.itemAtp;
|
tmp.itemAtp;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -63,7 +63,7 @@ module.exports = Self => {
|
||||||
FROM tItemShelving ti
|
FROM tItemShelving ti
|
||||||
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
WHERE ti.created > tis.created + INTERVAL pc.itemOlderReviewHours HOUR;`,
|
WHERE ti.created + INTERVAL pc.itemOlderReviewHours HOUR < tis.created ;`,
|
||||||
[shelvingFk, shelvingFk], myOptions);
|
[shelvingFk, shelvingFk], myOptions);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,29 +3,16 @@ const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('itemShelving getListItemNewer()', () => {
|
describe('itemShelving getListItemNewer()', () => {
|
||||||
it('should return true because there is an older item', async() => {
|
it('should return true because there is an older item', async() => {
|
||||||
const shelving = 'NCC';
|
const shelving = 'NBB';
|
||||||
const parking = 'A-47-1';
|
const parking = '700-01';
|
||||||
|
|
||||||
const sectorCamHighCode = 'CAMARA SECTOR D';
|
const sectorCamHighCode = 'FIRST';
|
||||||
const sectorCamCode = 'NAVE ALGEMESI';
|
const sectorCamCode = 'NS';
|
||||||
|
|
||||||
const sectorCamCodeHighId = 1;
|
|
||||||
const sectorCamCodeId = 9991;
|
|
||||||
|
|
||||||
const tx = await models.Sector.beginTransaction({});
|
const tx = await models.Sector.beginTransaction({});
|
||||||
const myOptions = {transaction: tx};
|
const myOptions = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectorHighCam = await models.Sector.findById(sectorCamCodeHighId, null, myOptions);
|
|
||||||
await sectorHighCam.updateAttributes({
|
|
||||||
code: sectorCamHighCode
|
|
||||||
});
|
|
||||||
|
|
||||||
const sectorCam = await models.Sector.findById(sectorCamCodeId, null, myOptions);
|
|
||||||
await sectorCam.updateAttributes({
|
|
||||||
code: sectorCamCode
|
|
||||||
});
|
|
||||||
|
|
||||||
const config = await models.ProductionConfig.findOne();
|
const config = await models.ProductionConfig.findOne();
|
||||||
|
|
||||||
await config.updateAttributes({
|
await config.updateAttributes({
|
||||||
|
@ -35,7 +22,7 @@ describe('itemShelving getListItemNewer()', () => {
|
||||||
|
|
||||||
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
|
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(3);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
Loading…
Reference in New Issue