refs #6861 feat: obsrevation
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-05-27 11:33:04 +02:00
parent 2cd7133a8c
commit 74b71079f2
5 changed files with 45 additions and 31 deletions

View File

@ -60,7 +60,7 @@ module.exports = Self => {
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
for (let ticket of tickets) {
let observations = ticket.observation.split(' ');
let observations = ticket.observaciones.split(' ');
for (let observation of observations) {
const salesPerson = ticket.salesPersonFk;

View File

@ -26,8 +26,8 @@ describe('collection getTickets()', () => {
expect(collectionTickets.tickets[1].ticketFk).toEqual(2);
expect(collectionTickets.tickets[2].ticketFk).toEqual(23);
expect(collectionTickets.tickets[0].sales[0].ticketFk).toEqual(1);
expect(collectionTickets.tickets[0].sales[1].ticketFk).toEqual(1);
expect(collectionTickets.tickets[0].sales[2].ticketFk).toEqual(1);
expect(collectionTickets.tickets[1].sales.length).toEqual(0);
expect(collectionTickets.tickets[2].sales.length).toEqual(0);
expect(collectionTickets.tickets[0].sales[0].Barcodes.length).toBeTruthy();
await tx.rollback();

View File

@ -19,9 +19,9 @@ BEGIN
WITH observation AS (
SELECT tob.ticketFk, tob.description
FROM ticketObservation tob
JOIN ticketCollection tc ON tc.ticketFk = tob.ticketFk
LEFT JOIN observationType ot ON ot.id = tob.observationTypeFk
FROM vn.ticketObservation tob
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
WHERE ot.`code` = 'itemPicker'
AND tc.collectionFk = vParamFk
)
@ -30,19 +30,19 @@ BEGIN
am.name agencyName,
t.warehouseFk,
w.id salesPersonFk,
IFNULL(ob.description,'') observation,
IFNULL(ob.description,'') observaciones,
cc.rgb
FROM ticket t
LEFT JOIN ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN collection c2 ON c2.id = tc.collectionFk
LEFT JOIN collectionColors cc
FROM vn.ticket t
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc
ON cc.wagon = tc.wagon
AND cc.shelve = tc.`level`
AND cc.trainFk = c2.trainFk
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id
WHERE t.id = vParamFk
AND t.shipped >= vDated
@ -54,17 +54,17 @@ BEGIN
w.id salesPersonFk,
ob.description,
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`
FROM ticket t
JOIN ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN collection c2 ON c2.id = tc.collectionFk
LEFT JOIN collectionColors cc
FROM vn.ticket t
JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc
ON cc.wagon = tc.wagon
AND cc.shelve = tc.`level`
AND cc.trainFk = c2.trainFk
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker w ON w.id = c.salesPersonFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id
WHERE tc.collectionFk = vParamFk
UNION ALL
@ -75,14 +75,14 @@ BEGIN
c.salesPersonFk,
ob.description,
NULL `rgb`
FROM sectorCollection sc
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
JOIN ticket t ON t.id = sg.ticketFk
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN agencyMode am ON am.id = z.agencyModeFk
FROM vn.sectorCollection sc
JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk
JOIN vn.ticket t ON t.id = sg.ticketFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN vn.client c ON c.id = t.clientFk
WHERE sc.id = vParamFk
AND t.shipped >= vDated;
END$$

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterInsert`
AFTER INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
UPDATE sale s
JOIN operator o ON o.workerFk = account.myUser_getId()
SET isPicked = IF(o.isOnReservationMode, isPicked, TRUE)
WHERE id = NEW.saleFk;
END$$
DELIMITER ;

View File

@ -27,4 +27,6 @@ CREATE TABLE vn.itemShelvingSaleReserv (
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production');
('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production');
ALTER TABLE vn.operator ADD IF NOT EXISTS isOnReservationMode TINYINT(1) NOT NULL DEFAULT FALSE;