test #3056

Merged
robert merged 18 commits from test into dev 2024-10-02 09:22:28 +00:00
8 changed files with 104 additions and 57 deletions

View File

@ -3184,7 +3184,7 @@ UPDATE vn.department
SET workerFk = null; SET workerFk = null;
INSERT INTO vn.packaging INSERT INTO vn.packaging
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0); VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1);
INSERT IGNORE INTO vn.intrastat INSERT IGNORE INTO vn.intrastat

View File

@ -41,9 +41,12 @@ BEGIN
AND (pd.originFk IS NULL OR pd.originFk = i.originFk) AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk) AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk) AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
LEFT JOIN zoneGeo zg2 ON zg2.id = address_getGeo(vAddressFk)
WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped) WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
AND (pd.toDated IS NULL OR pd.toDated >= vShipped) AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
GROUP BY i.id; AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt)
GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
(INDEX (itemFk)) (INDEX (itemFk))

View File

@ -52,13 +52,13 @@ BEGIN
FROM vn.sale s FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
WHERE t.shipped BETWEEN CURDATE() AND CURDATE() + INTERVAL vDaysInForward DAY WHERE t.shipped >= CURDATE() + INTERVAL vDaysInForward DAY
AND iss.saleFk IS NULL AND iss.saleFk IS NULL
AND t.warehouseFk = vWarehouseFk AND t.warehouseFk = vWarehouseFk
GROUP BY s.itemFk GROUP BY s.itemFk
) )
SELECT i.id itemFk, SELECT i.id itemFk,
CAST(sd.quantity AS INT) advanceable, LEAST(CAST(sd.quantity AS INT), sk.stock) advanceable,
i.longName, i.longName,
i.subName, i.subName,
i.tag5, i.tag5,

View File

@ -17,5 +17,6 @@ AS SELECT `p`.`id` AS `Id_Cubo`,
`p`.`upload` AS `Suben`, `p`.`upload` AS `Suben`,
`p`.`base` AS `Base`, `p`.`base` AS `Base`,
`p`.`isBox` AS `box`, `p`.`isBox` AS `box`,
`p`.`returnCost` AS `costeRetorno` `p`.`returnCost` AS `costeRetorno`,
`p`.`isActive` AS `isActive`
FROM `vn`.`packaging` `p` FROM `vn`.`packaging` `p`

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL;
ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk)
REFERENCES vn.zoneGeo (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL;
ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk)
REFERENCES vn.zoneGeo (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,24 @@
ALTER TABLE `vn`.`packaging`
ADD COLUMN IF NOT EXISTS `isActive` TINYINT(1) DEFAULT 1;
UPDATE vn.packaging
SET isActive = FALSE
WHERE id IN('06x04x06','07x04x03','1000','100SM','1031','104','105','1060','10x04x06','10x04x07','1100','118','119','1200','129','1300',
'134','146','147','148','158','159','17x01x02','17X01X03','17x01x04','17x01x05','18X01X04','198','199',
'20P','20x01x03','246','273','278','279','280','290','359','37247','382','40P','453','463','464','465','466',
'467','469','471','473','494','508','509','511','512','514','515','516','518','519-50B','575','598-3x6','604','605','606',
'607','609','647','67515','676','680','682','685','687','688','691','692','693','694','695','730','751','7808','790','7910',
'7920','79450','7950','7952','7960','7976','7982','7986','7988',
'7993','8000','8046','8049','8053','8057','8058','8065','8076','8085','8086','8088',
'8091','8095','8096','8097','8101','8106','8108','8110','8112','8124','8134','8140','8141','8143','8145','8149','8150',
'8170','8174','8192','8200','8210','8249','8270','8275','8288','8300','8350','8375','8399','8400','8420','845','847','8480','8500',
'855','858','8600','862','869','871','872','8720','878','879','880','8800','882','885','910','911','912','914','916','917','918','919',
'920','921','922','923','924','925','926','927','930','9300','932','934','935','936','938','942','948','9600','980','984','9920',
'B20x16','B43x13','Bande Rota','bb3','Bcesta','BcestaOVAL','BcestaRED','Bcirios','BciriosG','BjarronBLN','BjarronNGR',
'Btazon','Bvelas','cactus200','Caja040','CajaTGLF','CC Alza Pl','CC_falso',
'EB-RSMINA','EMB 1_4','EMB 2_5','espuma','FB-BENCH','granel','Grenex','guzma1200','guzma1400','guzma330','guzma400','guzma650','guzma900','HB-ALEX',
'HB-APOSENT','HB-MAGIC','HB-NATUF','HB-RSMINA','HB-TES-RSR','HB068','HB117','HB2-CIRCA','JB-AROMA','jumboX3','kalan330','kalan400',
'kalan577','kalan900','L12','L120','L14','L2-120','L200','L3-120','L4-120','L44','L6','L6-180','L8','L8-200','MB-BENCH','MBOLA','mc_11',
'mc_13','Msp','NO VALIDO','NO-002','PANIC','PBLG','PISOCC/3','PISOCC/4','PISOCC/5','PISOCC/6',
'procona','QB-CARDENA','QB-PANDERO','QB-TES-RSR','QB7-TOSCA','QB9-TOSCA','RB-BENCH','SemiEuroPa','spolette','t_flori11','T26x23',
'T26x25','T27x24','T27x30','T28x26','T30x24','T33x30','THA50','ti_13','Tumbado','UB-BENCH')

View File

@ -142,12 +142,19 @@ module.exports = Self => {
ctx.args.addressId = ticket.addressFk; ctx.args.addressId = ticket.addressFk;
const newTicket = await models.Ticket.new(ctx, myOptions); const newTicket = await models.Ticket.new(ctx, myOptions);
const existingRefund = await models.TicketRefund.findOne({
where: {
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
},
myOptions
});
if (!existingRefund) {
await models.TicketRefund.create({ await models.TicketRefund.create({
originalTicketFk: ticketId, originalTicketFk: ticketId,
refundTicketFk: newTicket.id refundTicketFk: newTicket.id
}, myOptions); }, myOptions);
}
return newTicket; return newTicket;
} }
}; };