Compare commits

...

26 Commits

Author SHA1 Message Date
Sergio De la torre 8840d57041 Merge branch 'master' into 6861-ItemShelvingSalesgetTickets
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-19 05:55:54 +00:00
Alex Moreno 28ee32a411 Merge pull request 'fix: getSales' (!3213) from hotfix-gertSales into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3213
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-18 13:00:33 +00:00
Carlos Satorres 6619ec451c fix: getSales
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-18 13:46:56 +01:00
Jon Elias d2ea0a4bbd Merge pull request 'fix: redirect to invoice-out summary from salix' descriptor' (!3211) from Hotfix-DescriptorRedirectToLilium into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3211
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-15 13:26:28 +00:00
Jon Elias 7d7c66de89 Merge branch 'Hotfix-DescriptorRedirectToLilium' of https://gitea.verdnatura.es/verdnatura/salix into Hotfix-DescriptorRedirectToLilium
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-15 14:22:21 +01:00
Jon Elias 4783cc23ac refactor: deleted negative bases route due to not being used 2024-11-15 14:22:19 +01:00
Jon Elias af781d4c1a Merge branch 'master' into Hotfix-DescriptorRedirectToLilium
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-15 12:15:21 +00:00
Jon Elias 6ed521ae5e fix: redirect to invoice-out summary from salix' descriptor
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-15 13:10:19 +01:00
Pablo Natek b4406a69d8 Merge pull request 'feat: refs #6403 add debug on cancel shipment' (!3197) from 6403-add-debug-on-cancelShipment into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3197
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-11-14 09:16:08 +00:00
Ivan Mas 26be6c6920 Merge pull request 'feat: refs #7994 new version script fix' (!3202) from 7994-newVersionScriptFix into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3202
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-11-13 16:34:59 +00:00
Ivan Mas 21693cfd71 feat: refs #7994 new version script fix
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-13 14:33:52 +01:00
Pablo Natek 5f3b1ff601 Merge pull request 'fix: refs #7404 filter an rounding issues' (!3196) from 7404-fix-stockBoughtDetailFilter into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3196
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-13 11:24:18 +00:00
Guillermo Bonet aa1c017f22 fix: refs #7779 ticket_splitItemPackingType
gitea/salix/pipeline/head This commit looks good Details
2024-11-13 12:17:58 +01:00
Pablo Natek 274a365ec0 feat: refs #6403 add debug on cancel shipment
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-13 11:03:57 +01:00
Robert Ferrús 021bc03ecf Merge pull request 'feat: refs #8169 create table itemTextureTag' (!3155) from 8169-itemTextureTag into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3155
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-11-13 09:48:46 +00:00
Robert Ferrús 9b079a8bb2 Merge branch 'master' into 8169-itemTextureTag
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-13 09:45:23 +00:00
Guillermo Bonet 1086981b53 fix: refs #7779 ticket_splitItemPackingType
gitea/salix/pipeline/head This commit looks good Details
2024-11-13 09:35:06 +01:00
Pablo Natek b025a8b804 fix: refs #7404 filter an rounding issues
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-13 09:10:18 +01:00
Pablo Natek d06be8b5b6 Merge pull request 'fix: problem calculation updated' (!3193) from hotFix-sale_getProblems into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3193
Reviewed-by: Pablo Natek <pablone@verdnatura.es>
2024-11-13 05:56:30 +00:00
Pako Natek ebc0420531 fix: problem calculation updated
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-13 06:50:21 +01:00
Ivan Mas fbd59de3cd Merge pull request 'feat: refs #7994 remove comment script' (!3192) from 7994-removeCommentScript into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3192
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-11-12 18:29:05 +00:00
Ivan Mas 4add10f3dd feat: refs #7994 remove comment script
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-12 17:52:51 +01:00
Robert Ferrús d925a5d7fa Merge branch 'master' into 8169-itemTextureTag
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-12 11:55:50 +00:00
Robert Ferrús 55fced363e Merge branch 'master' into 8169-itemTextureTag
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-12 07:42:58 +00:00
Robert Ferrús 94ed23ca07 feat: refs #8169 modifica role
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-11 07:51:26 +01:00
Robert Ferrús 6031b1fe3f feat: refs #8169 create table itemTextureTag
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-28 12:17:56 +01:00
14 changed files with 208 additions and 74 deletions

View File

@ -39,6 +39,9 @@ module.exports = Self => {
const xmlString = response.data;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente');
};

View File

@ -127,7 +127,7 @@ BEGIN
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
AND issw.warehouseFk = t.warehouseFk
WHERE IFNULL(v.visible, 0) < s.quantity
AND IFNULL(av.available, 0) < s.quantity
AND IFNULL(av.available, 0) < 0
AND IFNULL(issw.visible, 0) < s.quantity
AND NOT s.isPicked
AND NOT s.reserved
@ -190,7 +190,7 @@ BEGIN
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
AND issw.warehouseFk = t.warehouseFk
WHERE IFNULL(v.visible, 0) < s.quantity
AND IFNULL(av.available, 0) >= s.quantity
AND IFNULL(av.available, 0) >= 0
AND IFNULL(issw.visible, 0) < s.quantity
AND s.quantity > 0
AND NOT s.isPicked

View File

@ -59,7 +59,7 @@ proc: BEGIN
INSERT INTO stockBought(workerFk, bought, dated)
SELECT tb.workerFk,
ROUND(GREATEST(tb.bought - IFNULL(ts.sold, 0), 0), 1),
ROUND(GREATEST(tb.bought - IFNULL(ts.sold, 0), 0), 2),
vDated
FROM tStockBought tb
LEFT JOIN tStockSold ts ON ts.workerFk = tb.workerFk;

View File

@ -3,87 +3,124 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitItemPacki
vSelf INT,
vOriginalItemPackingTypeFk VARCHAR(1)
)
proc:BEGIN
BEGIN
/**
* Clona y reparte las líneas de ventas de un ticket en funcion del tipo de empaquetado.
* Respeta el id de ticket original para el tipo de empaquetado propuesto.
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado.
* Respeta el id inicial para el tipo propuesto.
*
* @param vSelf Id ticket
* @param vOriginalItemPackingTypeFk Tipo empaquetado que se mantiene el ticket original
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/
DECLARE vDone INT DEFAULT FALSE;
DECLARE vHasItemPackingType BOOL;
DECLARE vItemPackingTypeFk INT;
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
DECLARE vNewTicketFk INT;
DECLARE vPackingTypesToSplit INT;
DECLARE vDone INT DEFAULT FALSE;
DECLARE vItemPackingTypes CURSOR FOR
SELECT DISTINCT itemPackingTypeFk
FROM tSalesToMove;
DECLARE vSaleGroup CURSOR FOR
SELECT itemPackingTypeFk
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
SELECT COUNT(*) INTO vHasItemPackingType
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
WHERE t.id = vSelf
AND i.itemPackingTypeFk = vOriginalItemPackingTypeFk;
START TRANSACTION;
SELECT id
FROM sale
WHERE ticketFk = vSelf
AND NOT quantity
FOR UPDATE;
DELETE FROM sale
WHERE NOT quantity
AND ticketFk = vSelf;
CREATE OR REPLACE TEMPORARY TABLE tSale
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT s.id, i.itemPackingTypeFk, IFNULL(sv.litros, 0) litros
FROM sale s
JOIN item i ON i.id = s.itemFk
LEFT JOIN saleVolume sv ON sv.saleFk = s.id
WHERE s.ticketFk = vSelf;
CREATE OR REPLACE TEMPORARY TABLE tSaleGroup
ENGINE = MEMORY
SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tSale
GROUP BY itemPackingTypeFk;
SELECT COUNT(*) INTO vPackingTypesToSplit
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
ticketFk INT,
itemPackingTypeFk VARCHAR(1)
) ENGINE=MEMORY
SELECT vSelf ticketFk, vOriginalItemPackingTypeFk itemPackingTypeFk;
) ENGINE = MEMORY;
IF NOT vHasItemPackingType THEN
LEAVE proc;
END IF;
CASE vPackingTypesToSplit
WHEN 0 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk);
WHEN 1 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
SELECT vSelf, itemPackingTypeFk
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL;
ELSE
OPEN vSaleGroup;
FETCH vSaleGroup INTO vItemPackingTypeFk;
CREATE OR REPLACE TEMPORARY TABLE tSalesToMove (
ticketFk INT,
saleFk INT,
itemPackingTypeFk INT
) ENGINE=MEMORY;
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk);
INSERT INTO tSalesToMove (saleFk, itemPackingTypeFk)
SELECT s.id, i.itemPackingTypeFk
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
WHERE t.id = vSelf
AND i.itemPackingTypeFk <> vOriginalItemPackingTypeFk;
l: LOOP
SET vDone = FALSE;
FETCH vSaleGroup INTO vItemPackingTypeFk;
OPEN vItemPackingTypes;
IF vDone THEN
LEAVE l;
END IF;
l: LOOP
SET vDone = FALSE;
FETCH vItemPackingTypes INTO vItemPackingTypeFk;
CALL ticket_Clone(vSelf, vNewTicketFk);
IF vDone THEN
LEAVE l;
END IF;
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vNewTicketFk, vItemPackingTypeFk);
END LOOP;
CALL ticket_Clone(vSelf, vNewTicketFk);
CLOSE vSaleGroup;
UPDATE tSalesToMove
SET ticketFk = vNewTicketFk
WHERE itemPackingTypeFk = vItemPackingTypeFk;
SELECT s.id
FROM sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
FOR UPDATE;
END LOOP;
UPDATE sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
SET s.ticketFk = t.ticketFk;
CLOSE vItemPackingTypes;
SELECT itemPackingTypeFk INTO vItemPackingTypeFk
FROM tSaleGroup sg
WHERE sg.itemPackingTypeFk IS NOT NULL
ORDER BY sg.itemPackingTypeFk
LIMIT 1;
UPDATE sale s
JOIN tSalesToMove stm ON stm.saleFk = s.id
SET s.ticketFk = stm.ticketFk
WHERE stm.ticketFk;
UPDATE sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
SET s.ticketFk = t.ticketFk
WHERE ts.itemPackingTypeFk IS NULL;
END CASE;
INSERT INTO tmp.ticketIPT (ticketFk, itemPackingTypeFk)
SELECT ticketFk, itemPackingTypeFk
FROM tSalesToMove
GROUP BY ticketFk;
COMMIT;
DROP TEMPORARY TABLE tSalesToMove;
DROP TEMPORARY TABLE
tSale,
tSaleGroup;
END$$
DELIMITER ;

View File

@ -1,3 +1,2 @@
UPDATE vn.sale
SET originalQuantity = quantity
WHERE originalQuantity IS NULL
-- Debido a que tardaba mucho en la subida a master, se ha creado una nueva versión para que el proceso no se vea afectado y se ejecute por la noche.
-- Se crea de nuevo en la versión 11344-grayBamboo

View File

@ -1 +0,0 @@
-- ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity';

View File

@ -0,0 +1,71 @@
CREATE TABLE IF NOT EXISTS `vn`.`itemTextureTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y encerado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y esponjoso');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y foam');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y látex');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Arenosa');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Aterciopelado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Engomado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Flocado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Foam');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Gasa');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Goma');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Látex');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Latón');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Mate');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Metálico');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Natural y engomado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado y engomado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plastificado y rugoso');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Pluma');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Plástico engomado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Poliéster');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Poliéster texturizado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Rugoso');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Rígido');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Seminatural');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Silicona');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Suave');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela con brillo');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela con texturas');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela dura');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela engomada');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela escarchada');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela flocada');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela flocada engomada');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela foam');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela micro peach');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela plastificada');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela plástico engomado');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela poliéster');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela PVC');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela ratan');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rigida');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rugosa');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela rústica');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela sintética');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y cristal');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y foam');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y goma');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y látex');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y madera');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y plástico');
INSERT IGNORE INTO `vn`.`itemTextureTag` (`name`) VALUES ('Tela y seco');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemTextureTag'
WHERE name= 'Textura';
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemTextureTag TO logisticAssist;

View File

@ -0,0 +1,3 @@
UPDATE vn.sale
SET originalQuantity = quantity
WHERE originalQuantity IS NULL

View File

@ -0,0 +1 @@
ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity';

View File

@ -6,6 +6,9 @@ module.exports = Self => {
arg: 'workerFk',
type: 'number',
description: 'The id for a buyer',
}, {
arg: 'filter',
type: 'object',
},
{
arg: 'dated',
@ -23,7 +26,7 @@ module.exports = Self => {
}
});
Self.getStockBought = async(workerFk, dated = Date.vnNew()) => {
Self.getStockBought = async(workerFk, filter, dated = Date.vnNew()) => {
const models = Self.app.models;
const today = Date.vnNew();
dated.setHours(0, 0, 0, 0);
@ -31,7 +34,7 @@ module.exports = Self => {
await models.StockBought.rawSql(`CALL vn.stockBought_calculate(?)`, [dated]);
const filter = {
const defaultFilter = {
where: {dated},
include: [
{
@ -53,6 +56,6 @@ module.exports = Self => {
if (workerFk) filter.where.workerFk = workerFk;
return models.StockBought.find(filter);
return models.StockBought.find({...filter, ...defaultFilter});
};
};

View File

@ -1,3 +1,4 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => {
Self.remoteMethod('getStockBoughtDetail', {
description: 'Returns the detail of stock bought for a given date and a worker',
@ -12,6 +13,9 @@ module.exports = Self => {
type: 'string',
description: 'The date to filter',
required: true,
}, {
arg: 'filter',
type: 'object',
}
],
returns: {
@ -24,11 +28,10 @@ module.exports = Self => {
}
});
Self.getStockBoughtDetail = async(workerFk, dated) => {
const models = Self.app.models;
Self.getStockBoughtDetail = async(workerFk, dated, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
let tx;
let result;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -39,8 +42,10 @@ module.exports = Self => {
}
try {
await models.StockBought.rawSql(`CALL vn.item_calculateStock(?)`, [dated], myOptions);
result = await Self.rawSql(
const stmts = [];
stmts.push(new ParameterizedSQL(`CALL vn.item_calculateStock(?)`, [dated]));
const query = new ParameterizedSQL(
`SELECT b.entryFk entryFk,
i.id itemFk,
i.name itemName,
@ -61,11 +66,17 @@ module.exports = Self => {
JOIN volumeConfig vc
WHERE ic.display
AND w.id = ?`,
[workerFk], myOptions
[workerFk]
);
await Self.rawSql(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate;`, [], myOptions);
stmts.push(query.merge(conn.makeSuffix(filter)));
stmts.push(new ParameterizedSQL(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate`));
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
if (tx) await tx.commit();
return result;
return result[1];
} catch (e) {
await tx.rollback();
throw e;

View File

@ -1,7 +1,7 @@
export * from './module';
import './main';
import './summary';
import './descriptor';
import './descriptor-popover';
import './descriptor-menu';
import './summary';

View File

@ -34,6 +34,12 @@
"params": {
"invoice-out": "$ctrl.invoiceOut"
}
},
{
"url": "/:id",
"state": "invoiceOut.card",
"abstract": true,
"component": "vn-invoice-out-card"
}
]
}

View File

@ -37,6 +37,7 @@ module.exports = Self => {
'name',
'subName',
'itemPackingTypeFk',
'size',
'tag5',
'value5',
'tag6',