fixes #5513 Crear back para añadir funcionalidad de Embalajes de la app #1504

Merged
alexandre merged 16 commits from 5513-backs-embalajes into dev 2023-06-06 06:21:16 +00:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 9760e50212 - Show all commits

View File

@ -1,6 +1,6 @@
CREATE TABLE `vn`.`buyConfig` ( CREATE TABLE `vn`.`buyConfig` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`showLastBuy` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la última compra', `monthsAgo` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la última compra',
alexandre marked this conversation as resolved Outdated

jo li posaria de nou mirant el codi con el gastes monthsAgo

jo li posaria de nou mirant el codi con el gastes monthsAgo
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

View File

@ -2863,10 +2863,10 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
(2, 1, 50, 2), (2, 1, 50, 2),
(3, 1, 0, 3); (3, 1, 0, 3);
INSERT INTO `vn`.`travelConfig` (id, warehouseInFk, warehouseOutFk, agencyFk, companyFk) INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
VALUES VALUES
(1, 1, 1, 1, 442); (1, 1, 1, 1, 442);
INSERT INTO `vn`.`buyConfig` (id, showLastBuy) INSERT INTO `vn`.`buyConfig` (`id`, `monthsAgo`)
VALUES VALUES
(1, 6); (1, 6);

View File

@ -38,12 +38,12 @@ module.exports = Self => {
JOIN vn.item i ON i.id = b.itemFk JOIN vn.item i ON i.id = b.itemFk
JOIN vn.entry e ON e.id = b.entryFk JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.buyConfig bc ON bc.showLastBuy JOIN vn.buyConfig bc ON bc.monthsAgo
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
LEFT JOIN entryTmp et ON et.id = i.id LEFT JOIN entryTmp et ON et.id = i.id
WHERE e.supplierFk = ? WHERE e.supplierFk = ?
AND (i.family ='EMB' OR i.family = 'CONT') AND i.family IN ('EMB', 'CONT')
alexandre marked this conversation as resolved Outdated

es lo mateix pero açò es mes curt i este mes familiarizats

AND i.family IN ('EMB', 'CONT')

es lo mateix pero açò es mes curt i este mes familiarizats AND i.family IN ('EMB', 'CONT')
AND b.created > (util.VN_CURDATE() - INTERVAL bc.showLastBuy MONTH) AND b.created > (util.VN_CURDATE() - INTERVAL bc.monthsAgo MONTH)
GROUP BY b.itemFk GROUP BY b.itemFk
ORDER BY et.quantity DESC, quantityTotal DESC`, [entry, id, id]); ORDER BY et.quantity DESC, quantityTotal DESC`, [entry, id, id]);
return result; return result;