refactor: Replaced isBox with freightItemFk

This commit is contained in:
Pau 2022-10-04 09:27:31 +02:00
parent ae2bc91cb5
commit 3caf89bddb
6 changed files with 21 additions and 21 deletions

View File

@ -914,7 +914,7 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
(3, 'Perdida', 'LOST');
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
VALUES
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1),
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1),

View File

@ -27518,7 +27518,7 @@ CREATE TABLE `expedition` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`agencyModeFk` int(11) NOT NULL,
`ticketFk` int(10) NOT NULL,
`isBox` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk',
`freightItemFk` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk',
`created` timestamp NULL DEFAULT current_timestamp(),
`isRefund__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
`isPickUp__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
@ -27534,7 +27534,7 @@ CREATE TABLE `expedition` (
`hasNewRoute` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`id`),
KEY `index1` (`agencyModeFk`),
KEY `index2` (`isBox`),
KEY `index2` (`freightItemFk`),
KEY `index3` (`created`),
KEY `index4` (`ticketFk`),
KEY `expedition_fk3_idx` (`packagingFk`),
@ -27567,7 +27567,7 @@ BEGIN
DECLARE vShipFk INT;
IF NEW.isBox > 0 THEN
IF NEW.freightItemFk > 0 THEN
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
@ -27638,7 +27638,7 @@ DELIMITER ;;
BEGIN
UPDATE ticket t
SET packages = (SELECT COUNT(counter)-1
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.isBox)
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk)
WHERE t.id = OLD.ticketFk;
END */;;
@ -32261,7 +32261,7 @@ CREATE TABLE `packaging` (
`base` decimal(10,2) DEFAULT NULL,
`itemFk` int(11) DEFAULT NULL,
`price` decimal(10,2) NOT NULL,
`isBox` tinyint(1) NOT NULL DEFAULT 0,
`freightItemFk` tinyint(1) NOT NULL DEFAULT 0,
`cubicPackage` decimal(10,2) DEFAULT NULL,
`returnCost` decimal(10,2) NOT NULL DEFAULT 0.00,
`cmrName` varchar(45) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
@ -36287,7 +36287,7 @@ CREATE TABLE `sorter` (
`created` datetime NOT NULL,
`routeFk` int(10) unsigned NOT NULL,
`ticketFk` int(10) NOT NULL,
`isBox` int(11) DEFAULT 1,
`freightItemFk` int(11) DEFAULT 1,
`itemFk` int(11) DEFAULT NULL,
`width` decimal(10,2) DEFAULT 0.00,
`depth` decimal(10,2) DEFAULT 0.00,
@ -37147,7 +37147,7 @@ CREATE TABLE `ticket` (
`companyFk` smallint(5) unsigned NOT NULL DEFAULT 442,
`agencyModeFk` int(11) DEFAULT NULL,
`landed` date DEFAULT NULL,
`isBoxed` tinyint(2) NOT NULL DEFAULT 0,
`freightItemFked` tinyint(2) NOT NULL DEFAULT 0,
`isDeleted` tinyint(2) NOT NULL DEFAULT 0,
`zoneFk` int(11) DEFAULT NULL,
`collectionFk__` int(11) DEFAULT NULL,
@ -44956,7 +44956,7 @@ BEGIN
SELECT SUM((t.zonePrice - t.zoneBonus) * ebv.ratio) INTO deliveryPrice
FROM vn.ticket t
LEFT JOIN expedition e ON e.ticketFk = t.id
JOIN expeditionBoxVol ebv ON ebv.boxFk = e.isBox
JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk
WHERE t.id = vTicketFk;
END IF;
@ -46492,7 +46492,7 @@ BEGIN
LEFT JOIN item i ON i.id = b.itemFk
LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox
LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.freightItemFk
JOIN volumeConfig vc ON TRUE
WHERE b.id = vSelf;
@ -53229,7 +53229,7 @@ BEGIN
INNER JOIN vn.ticketState ts ON ts.ticketFk = exp.ticketFk
LEFT JOIN vn.address a ON t.addressFk = a.id
LEFT JOIN vn.warehouse w ON t.warehouseFk = w.id
WHERE t.routeFk = vRouteFk AND exp.isBox > 0;
WHERE t.routeFk = vRouteFk AND exp.freightItemFk > 0;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -53760,7 +53760,7 @@ BEGIN
GROUP BY sub.ticketFk
) sub2 ON sub2.ticketFk = t.id
LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk
WHERE t.routeFk = vRouteFk AND e.isBox <> FALSE
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC;
END ;;
DELIMITER ;
@ -62506,7 +62506,7 @@ proc: BEGIN
p.id provinceFk,
tls.productionOrder,
IFNULL(tls.alertLevel,0) alertLevel,
t.isBoxed palletized,
t.freightItemFked palletized,
IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion,
tlu.lastUpdated,
ifnull(st.graphCategory,0) graphCategory,
@ -64036,7 +64036,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk
JOIN vn.time tm ON tm.dated = r.created
JOIN vn.expedition e ON e.ticketFk = t.id
JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.isBox
JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk
JOIN vn.address ad ON ad.id = t.addressFk
JOIN vn.client c ON c.id = ad.clientFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
@ -67067,7 +67067,7 @@ BEGIN
JOIN packaging p on p.id = b.packageFk
WHERE s.quantity >= b.packing
AND t.id = vTicketFk
AND p.isBox
AND p.freightItemFk
GROUP BY s.itemFk;

View File

@ -89,7 +89,7 @@
url="Packagings"
show-field="id"
value-field="id"
where="{isBox: true}"
where="{freightItemFk: true}"
ng-model="buy.packageFk">
</vn-autocomplete>
</td>

View File

@ -91,7 +91,7 @@
url="Packagings"
show-field="id"
value-field="id"
where="{isBox: true}"
where="{freightItemFk: true}"
ng-model="buy.packageFk"
on-change="$ctrl.saveBuy(buy)">
</vn-autocomplete>

View File

@ -32,7 +32,7 @@ module.exports = Self => {
`SELECT
e.id,
e.ticketFk,
e.isBox,
e.freightItemFk,
e.workerFk,
i1.name packageItemName,
e.counter,
@ -51,7 +51,7 @@ module.exports = Self => {
FROM vn.expedition e
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
LEFT JOIN vn.item i2 ON i2.id = e.itemFk
INNER JOIN vn.item i1 ON i1.id = e.isBox
INNER JOIN vn.item i1 ON i1.id = e.freightItemFk
LEFT JOIN vn.packaging p ON p.id = e.packagingFk
LEFT JOIN vn.item i3 ON i3.id = p.itemFk
LEFT JOIN account.user u ON u.id = e.workerFk

View File

@ -16,7 +16,7 @@
"type": "number",
"description": "Identifier"
},
"isBox": {
"freightItemFk": {
"type": "number"
},
"created": {
@ -55,7 +55,7 @@
"freightItem": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "isBox"
"foreignKey": "freightItemFk"
},
"packaging": {
"type": "belongsTo",