8144-devToTest_2448 #3216
|
@ -2476,7 +2476,8 @@ INSERT INTO `vn`.`dmsType`
|
||||||
(20, 'Reclamación', 1, 1, 'claim'),
|
(20, 'Reclamación', 1, 1, 'claim'),
|
||||||
(21, 'Entrada', 1, 1, 'entry'),
|
(21, 'Entrada', 1, 1, 'entry'),
|
||||||
(22, 'Proveedor', 1, 1, 'supplier'),
|
(22, 'Proveedor', 1, 1, 'supplier'),
|
||||||
(23, 'Termografos', 35, 35, 'thermograph');
|
(23, 'Termografos', 35, 35, 'thermograph'),
|
||||||
|
(24, 'Sello de calidad', 1, 1, 'qualitySeal');
|
||||||
|
|
||||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2954,9 +2955,9 @@ INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9);
|
(1, 9);
|
||||||
|
|
||||||
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`)
|
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`, `backupPrinterNotificationDelay`, `clientSelfConsumptionFk`, `addressSelfConsumptionFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600);
|
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6, 3600, 1112, 12);
|
||||||
|
|
||||||
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -56,7 +56,7 @@ BEGIN
|
||||||
AND ts.id IS NULL;
|
AND ts.id IS NULL;
|
||||||
DELETE FROM claim WHERE ticketCreated < v4Years;
|
DELETE FROM claim WHERE ticketCreated < v4Years;
|
||||||
-- Robert ubicacion anterior de travelLog comentario para debug
|
-- Robert ubicacion anterior de travelLog comentario para debug
|
||||||
DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Months;
|
DELETE FROM zoneEvent WHERE dated < v2Months OR ended < v2Months;
|
||||||
DELETE b FROM buy b
|
DELETE b FROM buy b
|
||||||
JOIN entryConfig e ON e.defaultEntry = b.entryFk
|
JOIN entryConfig e ON e.defaultEntry = b.entryFk
|
||||||
WHERE b.created < v2Months;
|
WHERE b.created < v2Months;
|
||||||
|
|
|
@ -146,8 +146,6 @@ BEGIN
|
||||||
DELETE pb
|
DELETE pb
|
||||||
FROM tmp.productionBuffer pb
|
FROM tmp.productionBuffer pb
|
||||||
JOIN state s ON s.id = pb.state
|
JOIN state s ON s.id = pb.state
|
||||||
JOIN agencyMode am ON am.id = pb.agencyModeFk
|
|
||||||
JOIN agency a ON a.id = am.agencyFk
|
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT pb.ticketFk, MAX(i.`size`) maxSize
|
SELECT pb.ticketFk, MAX(i.`size`) maxSize
|
||||||
FROM tmp.productionBuffer pb
|
FROM tmp.productionBuffer pb
|
||||||
|
@ -158,7 +156,7 @@ BEGIN
|
||||||
) sub ON sub.ticketFk = pb.ticketFk
|
) sub ON sub.ticketFk = pb.ticketFk
|
||||||
JOIN productionConfig pc
|
JOIN productionConfig pc
|
||||||
WHERE pb.shipped <> util.VN_CURDATE()
|
WHERE pb.shipped <> util.VN_CURDATE()
|
||||||
OR (pb.ubicacion IS NULL AND a.isOwn)
|
OR pb.ubicacion IS NULL
|
||||||
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
||||||
OR pb.collectionH IS NOT NULL
|
OR pb.collectionH IS NOT NULL
|
||||||
OR pb.collectionV IS NOT NULL
|
OR pb.collectionV IS NOT NULL
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_selfConsumptionPackaging`(
|
||||||
|
vSelf INT,
|
||||||
|
vAction ENUM('add', 'remove')
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Maneja el consumo de cajas para autoconsumo, permitiendo
|
||||||
|
* añadir o quitar cajas utilizadas según la acción indicada.
|
||||||
|
*
|
||||||
|
* @param vSelf Id de expedición
|
||||||
|
*/
|
||||||
|
DECLARE vClientFk INT;
|
||||||
|
DECLARE vAddressFk INT;
|
||||||
|
DECLARE vItemFk INT;
|
||||||
|
DECLARE vItemName VARCHAR(50);
|
||||||
|
DECLARE vWarehouseFk INT;
|
||||||
|
DECLARE vCreated DATE;
|
||||||
|
DECLARE vTicketFk INT;
|
||||||
|
DECLARE vSaleFk INT;
|
||||||
|
DECLARE vQuantity INT;
|
||||||
|
|
||||||
|
IF vAction NOT IN ('add', 'remove') THEN
|
||||||
|
CALL util.throw('Action not supported');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT pc.clientSelfConsumptionFk,
|
||||||
|
pc.addressSelfConsumptionFk,
|
||||||
|
i.id,
|
||||||
|
i.name,
|
||||||
|
t.warehouseFk,
|
||||||
|
e.created
|
||||||
|
INTO vClientFk,
|
||||||
|
vAddressFk,
|
||||||
|
vItemFk,
|
||||||
|
vItemName,
|
||||||
|
vWarehouseFk,
|
||||||
|
vCreated
|
||||||
|
FROM expedition e
|
||||||
|
JOIN packaging p ON p.id = e.packagingFk
|
||||||
|
JOIN item i ON i.id = p.itemFk
|
||||||
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
|
JOIN productionConfig pc
|
||||||
|
WHERE e.id = vSelf;
|
||||||
|
|
||||||
|
IF vClientFk IS NULL OR vAddressFk IS NULL THEN
|
||||||
|
CALL util.throw('Some config parameters are not set');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SET vCreated = DATE(vCreated);
|
||||||
|
|
||||||
|
SELECT id INTO vTicketFk
|
||||||
|
FROM ticket
|
||||||
|
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
||||||
|
AND clientFk = vClientFk
|
||||||
|
AND addressFk = vAddressFk
|
||||||
|
AND warehouseFk = vWarehouseFk;
|
||||||
|
|
||||||
|
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||||
|
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
||||||
|
VALUES (vClientFk, vWarehouseFk, vCreated, 'CAJAS AUTOCONSUMO', vAddressFk);
|
||||||
|
|
||||||
|
SET vTicketFk = LAST_INSERT_ID();
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT id, quantity INTO vSaleFk, vQuantity
|
||||||
|
FROM sale
|
||||||
|
WHERE itemFk = vItemFk
|
||||||
|
AND ticketFk = vTicketFk
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vAction = 'add' THEN
|
||||||
|
IF vSaleFk IS NOT NULL THEN
|
||||||
|
UPDATE sale
|
||||||
|
SET quantity = quantity + 1
|
||||||
|
WHERE id = vSaleFk;
|
||||||
|
ELSE
|
||||||
|
INSERT INTO sale(itemFk, ticketFk, concept, quantity)
|
||||||
|
VALUES (vItemFk, vTicketFk, vItemName, 1);
|
||||||
|
END IF;
|
||||||
|
ELSE
|
||||||
|
IF vSaleFk IS NOT NULL THEN
|
||||||
|
IF vQuantity > 1 THEN
|
||||||
|
UPDATE sale
|
||||||
|
SET quantity = quantity - 1
|
||||||
|
WHERE id = vSaleFk;
|
||||||
|
ELSE
|
||||||
|
DELETE FROM sale WHERE id = vSaleFk;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -8,5 +8,6 @@ BEGIN
|
||||||
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk)
|
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk)
|
||||||
WHERE t.id = OLD.ticketFk;
|
WHERE t.id = OLD.ticketFk;
|
||||||
|
|
||||||
|
CALL expedition_selfConsumptionPackaging(OLD.id, 'remove');
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.supplier ADD companySize ENUM('small', 'medium', 'big') NULL;
|
||||||
|
|
|
@ -43,7 +43,8 @@ module.exports = Self => {
|
||||||
'sageWithholdingFk',
|
'sageWithholdingFk',
|
||||||
'workerFk',
|
'workerFk',
|
||||||
'supplierActivityFk',
|
'supplierActivityFk',
|
||||||
'healthRegister'
|
'healthRegister',
|
||||||
|
'companySize'
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,6 +113,9 @@
|
||||||
},
|
},
|
||||||
"isVies": {
|
"isVies": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"companySize": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
Loading…
Reference in New Issue