From 6a12af2eb9f4d6a026c085a3b80cfb52c2b92427 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 14 Mar 2024 15:26:30 +0100 Subject: [PATCH] refs #6321 feat: add producerFk --- db/dump/fixtures.before.sql | 36 +++++++++--------- .../ticket/back/methods/ticket/itemDetail.sql | 38 +++++++++++++++++++ .../ticket/back/methods/ticket/itemLack.js | 1 + 3 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 modules/ticket/back/methods/ticket/itemDetail.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 646120462..3ce756c77 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -938,25 +938,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('VT', 'Sales'); INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`, - `comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `weightByPiece`) + `comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `weightByPiece`, `category`) VALUES - (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 3), - (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 2), - (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5), - (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL), - (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL), - (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL), - (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL), - (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL), - (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL), - (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL); + (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 3, 'SEL'), + (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 2, 'SEL'), + (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5, 'SEL'), + (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (6, 5, 1, 2, NULL, 1, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (7, 5, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL, 'SEL'), + (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'), + (13, 5, 1, 2, NULL, 1, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL, 'SEL'), + (14, 5, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL, 'SEL'), + (15, 4, NULL, 1, NULL, 1, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL, 'SEL'), + (16, 6, NULL, 1, NULL, 1, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL, 'SEL'), + (71, 6, NULL, 1, NULL, 2, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 'SEL'); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 diff --git a/modules/ticket/back/methods/ticket/itemDetail.sql b/modules/ticket/back/methods/ticket/itemDetail.sql new file mode 100644 index 000000000..8538378e7 --- /dev/null +++ b/modules/ticket/back/methods/ticket/itemDetail.sql @@ -0,0 +1,38 @@ + SELECT + s.id saleFk, + st.code, + t.id ticketFk, + t.nickname, + t.hour, + s.quantity, + ag.name, + ts.alertLevel alertLevel, + st.name stateName, + st.id stateId, + s.itemFk itemFk, + al.code alertLevelCode, + z.name, + z.hour theoreticalhour, + cn.isRookie, + sc.saleClonedFk turno, + tr.saleFk peticionCompra, + t.hour minTimed + FROM + vn.sale s + JOIN vn.ticket t ON t.id=s.ticketFk -- vn.ticket + LEFT JOIN vn.zone z ON z.id = t.zoneFk -- vn.zone + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk -- AND zc.dated = DateValue(t.Fecha) + JOIN vn.client c ON c.id=t.clientFk -- vn.client + LEFT JOIN bs.clientNewBorn cn ON cn.clientFk=c.id + JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk -- vn.agencyMode + JOIN vn.agency ag ON ag.id=agm.id -- vn.agencyMode + JOIN vn.ticketState ts ON ts.ticketFk=t.id -- vn.sale + LEFT JOIN vn.state st ON st.id=ts.state + LEFT JOIN vn.alertLevel al ON al.id = st.alertLevel + LEFT JOIN vn.saleCloned sc ON sc.saleClonedFk = s.id + LEFT JOIN vn.ticketRequest tr ON tr.saleFk = s.id + WHERE + s.itemFk = ? + AND t.landed >= util.VN_CURDATE() + AND t.landed < INTERVAL util.VN_CURDATE() + INTERVAL ? + 1 DAY + `, diff --git a/modules/ticket/back/methods/ticket/itemLack.js b/modules/ticket/back/methods/ticket/itemLack.js index b934d7b15..b38408400 100644 --- a/modules/ticket/back/methods/ticket/itemLack.js +++ b/modules/ticket/back/methods/ticket/itemLack.js @@ -105,6 +105,7 @@ module.exports = Self => { i.longName, w.id warehouseFk, p.name producer, + p.id producerFk, i.size, i.category, w.name warehouse,