refactor: refs #7690 unify workerTimeControlParams with workerTimeControlConfig #3191

Merged
ivanm merged 9 commits from 7690-renameConfigTables into dev 2024-11-21 09:13:53 +00:00
38 changed files with 401 additions and 82 deletions
Showing only changes of commit 715cea0670 - Show all commits

View File

@ -57,10 +57,10 @@ module.exports = Self => {
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving, ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving, COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
sh.code, sh.code,
p2.code parkingCode, p2.code parkingCodePrevia,
p2.pickingOrder pickingOrder, p2.pickingOrder pickingOrderPrevia,
p.code parkingCodePrevia, p.code parkingCode,
p.pickingOrder pickingOrderPrevia, p.pickingOrder pickingOrder,
iss.id itemShelvingSaleFk, iss.id itemShelvingSaleFk,
iss.isPicked, iss.isPicked,
iss.itemShelvingFk iss.itemShelvingFk

View File

@ -79,6 +79,9 @@
"ImageCollectionSize": { "ImageCollectionSize": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ImageConfig": {
"dataSource": "vn"
},
"ImageContainer": { "ImageContainer": {
"dataSource": "imageStorage" "dataSource": "imageStorage"
}, },

View File

@ -0,0 +1,22 @@
{
"name": "ImageConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "hedera.imageConfig"
}
},
"properties": {
"url": {
"type": "string"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

@ -4004,6 +4004,10 @@ INSERT IGNORE INTO pbx.queueMember
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk) INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), (1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),

View File

@ -14,9 +14,12 @@ BEGIN
SELECT p.geoFk INTO vGeoFk SELECT p.geoFk INTO vGeoFk
FROM address a FROM address a
JOIN town t ON t.provinceFk = a.provinceFk JOIN town t ON t.provinceFk = a.provinceFk
JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode JOIN postCode p ON p.townFk = t.id
AND (p.code = a.postalCode OR a.postalCode IS NULL)
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE a.id = vSelf WHERE a.id = vSelf
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC ORDER BY (a.city SOUNDS LIKE t.name) DESC,
(p.code = a.postalCode) DESC
LIMIT 1; LIMIT 1;
RETURN vGeoFk; RETURN vGeoFk;

View File

@ -0,0 +1,27 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getGeo`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Returns the geo for the passed client.
*
* @param vSelf The address id
* @return The geo id
*/
DECLARE vGeoFk INT;
SELECT p.geoFk INTO vGeoFk
FROM client c
JOIN town t ON t.provinceFk = c.provinceFk
JOIN postCode p ON p.townFk = t.id
AND (p.code = c.postcode OR c.postcode IS NULL)
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE c.id = vSelf
ORDER BY (c.city SOUNDS LIKE t.name) DESC,
(p.code = c.postcode) DESC
LIMIT 1;
RETURN vGeoFk;
END$$
DELIMITER ;

View File

@ -9,40 +9,14 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_getCommission`(v
BEGIN BEGIN
DECLARE vCommission INT; DECLARE vCommission INT;
DECLARE vCurrentCommission INT; DECLARE vCurrentCommission INT;
DECLARE vIsCurrencyUsd INT; DECLARE vIsNotEUR INT;
DECLARE vLastEntryFk INT; DECLARE vLastEntryFk INT;
SELECT count(*) INTO vIsCurrencyUsd SELECT count(*) INTO vIsNotEUR
FROM currency c FROM currency c
WHERE c.code = 'USD' AND id = vCurrencyFk; WHERE c.code <> 'EUR' AND id = vCurrencyFk;
IF NOT vIsCurrencyUsd THEN
SELECT e.id INTO vLastEntryFk
FROM vn.entry e
JOIN vn.travel tr ON tr.id = e.travelFk
WHERE e.supplierFk = vSupplierFk
ORDER BY tr.landed DESC
LIMIT 1;
IF vLastEntryFk THEN
SELECT commission INTO vCurrentCommission
FROM vn.entry
WHERE id = vLastEntryFk;
ELSE
SELECT commission INTO vCurrentCommission
FROM supplier s
WHERE s.id = vSupplierFk;
END IF;
RETURN vCurrentCommission;
ELSE
IF vIsNotEUR THEN
SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission
FROM travel t FROM travel t
LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped
@ -51,8 +25,27 @@ BEGIN
LIMIT 1; LIMIT 1;
RETURN IFNULL(vCommission, 0); RETURN IFNULL(vCommission, 0);
ELSE
SELECT e.id INTO vLastEntryFk
FROM `entry` e
JOIN travel tr ON tr.id = e.travelFk
WHERE e.supplierFk = vSupplierFk
ORDER BY tr.landed DESC
LIMIT 1;
IF vLastEntryFk THEN
SELECT commission INTO vCurrentCommission
FROM `entry`
WHERE id = vLastEntryFk;
ELSE
SELECT commission INTO vCurrentCommission
FROM supplier s
WHERE s.id = vSupplierFk;
END IF; END IF;
RETURN vCurrentCommission;
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,29 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`supplier_getGeo`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Returns the geo for the passed supplier.
*
* @param vSelf The address id
* @return The geo id
*/
DECLARE vGeoFk INT;
SELECT p.geoFk INTO vGeoFk
FROM supplier s
JOIN town t ON t.provinceFk = s.provinceFk
JOIN postCode p ON p.townFk = t.id
AND (p.code = s.postCode OR s.postCode IS NULL)
LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
JOIN zoneGeo zg ON zg.id = p.geoFk
WHERE s.id = vSelf
ORDER BY (s.city SOUNDS LIKE t.name) DESC,
(p.code = s.postCode) DESC,
(p.code = sad.postalCode) DESC
LIMIT 1;
RETURN vGeoFk;
END$$
DELIMITER ;

View File

@ -22,7 +22,7 @@ BEGIN
FROM vn.entry e FROM vn.entry e
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
JOIN vn.warehouse w ON w.id = t.warehouseInFk JOIN vn.warehouse w ON w.id = t.warehouseInFk
WHERE t.shipped >= util.VN_CURDATE() WHERE t.landed >= util.VN_CURDATE()
AND e.currencyFk = vCurrency AND e.currencyFk = vCurrency
AND NOT e.isBooked; AND NOT e.isBooked;

View File

@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ
vItemShelvingSaleFk INT(10), vItemShelvingSaleFk INT(10),
vQuantity DECIMAL(10,0), vQuantity DECIMAL(10,0),
vIsItemShelvingSaleEmpty BOOLEAN, vIsItemShelvingSaleEmpty BOOLEAN,
vSectorFk INT vSectorFk INT,
vShelvingFk VARCHAR(10)
) )
BEGIN BEGIN
/** /**
@ -24,6 +25,7 @@ BEGIN
DECLARE vItemFk INT; DECLARE vItemFk INT;
DECLARE vTotalQuantity INT; DECLARE vTotalQuantity INT;
DECLARE vStateCode VARCHAR(45); DECLARE vStateCode VARCHAR(45);
DECLARE vCurrentShelvingFk VARCHAR(10);
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
@ -45,18 +47,25 @@ BEGIN
iss.saleFk, iss.saleFk,
iss.itemShelvingFk, iss.itemShelvingFk,
SUM(IFNULL(iss.quantity,0)), SUM(IFNULL(iss.quantity,0)),
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED') IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'),
ish.shelvingFk
INTO vItemFk, INTO vItemFk,
vSaleFk, vSaleFk,
vItemShelvingFk, vItemShelvingFk,
vReservedQuantity, vReservedQuantity,
vStateCode vStateCode,
vCurrentShelvingFk
FROM itemShelvingSale iss FROM itemShelvingSale iss
JOIN sale s ON s.id = iss.saleFk JOIN sale s ON s.id = iss.saleFk
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
WHERE iss.id = vItemShelvingSaleFk WHERE iss.id = vItemShelvingSaleFk
AND NOT iss.isPicked; AND NOT iss.isPicked;
IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN
CALL util.throw('The shelving can not be different from the shelving reserved');
END IF;
IF vQuantity > vReservedQuantity IF vQuantity > vReservedQuantity
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty) OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN

View File

@ -80,7 +80,7 @@ proc: BEGIN
UPDATE stockBought s UPDATE stockBought s
JOIN tStockSold ts ON ts.workerFk = s.workerFk JOIN tStockSold ts ON ts.workerFk = s.workerFk
SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0) SET s.bought = IF(s.bought < ABS(ts.sold), 0, ROUND(s.bought - ABS(ts.sold), 1))
WHERE s.dated = vDated; WHERE s.dated = vDated;
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold; DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;

View File

@ -6,6 +6,7 @@ BEGIN
DECLARE vIsEqualizated BOOL; DECLARE vIsEqualizated BOOL;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SET NEW.geoFk = address_getGeo(NEW.id);
IF (NEW.phone <> '') THEN IF (NEW.phone <> '') THEN
CALL pbx.phone_isValid(NEW.phone); CALL pbx.phone_isValid(NEW.phone);

View File

@ -3,7 +3,6 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`address_beforeUpdate`
BEFORE UPDATE ON `address` BEFORE UPDATE ON `address`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN
@ -14,5 +13,10 @@ BEGIN
CALL pbx.phone_isValid(NEW.mobile); CALL pbx.phone_isValid(NEW.mobile);
END IF; END IF;
IF NOT (NEW.provinceFk <=> OLD.provinceFk)
OR (NEW.postalCode <=> OLD.postalCode) THEN
SET NEW.geoFk = address_getGeo(NEW.id);
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -3,8 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`client_beforeInsert`
BEFORE INSERT ON `client` BEFORE INSERT ON `client`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SET NEW.accountingAccount = 4300000000 + NEW.id;
SET NEW.lastSalesPersonFk = NEW.salesPersonFk;
SET NEW.geoFk = client_getGeo(NEW.id);
IF (NEW.phone <> '') THEN IF (NEW.phone <> '') THEN
CALL pbx.phone_isValid(NEW.phone); CALL pbx.phone_isValid(NEW.phone);
@ -13,9 +15,5 @@ BEGIN
IF (NEW.mobile <> '') THEN IF (NEW.mobile <> '') THEN
CALL pbx.phone_isValid(NEW.mobile); CALL pbx.phone_isValid(NEW.mobile);
END IF; END IF;
SET NEW.accountingAccount = 4300000000 + NEW.id;
SET NEW.lastSalesPersonFk = NEW.salesPersonFk;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -72,5 +72,11 @@ BEGIN
IF NOT (NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN IF NOT (NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN
SET NEW.isTaxDataChecked = 0; SET NEW.isTaxDataChecked = 0;
END IF; END IF;
IF NOT (NEW.provinceFk <=> OLD.provinceFk)
OR (NEW.postcode <=> OLD.postcode) THEN
SET NEW.geoFk = client_getGeo(NEW.id);
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -21,7 +21,8 @@ BEGIN
OR !(NEW.kmEnd <=> OLD.kmEnd) OR !(NEW.kmEnd <=> OLD.kmEnd)
OR !(NEW.workerFk <=> OLD.workerFk) OR !(NEW.workerFk <=> OLD.workerFk)
OR !(NEW.m3 <=> OLD.m3) OR !(NEW.m3 <=> OLD.m3)
OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)THEN OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)
OR !(NEW.vehicleFk <=> OLD.vehicleFk)THEN
CALL route_calcCommission(NEW.id); CALL route_calcCommission(NEW.id);
END IF; END IF;

View File

@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`supplier_beforeInsert`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SET NEW.geoFk = supplier_getGeo(NEW.id);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -40,5 +40,10 @@ BEGIN
SET NEW.isPayMethodChecked = FALSE; SET NEW.isPayMethodChecked = FALSE;
END IF; END IF;
IF NOT (NEW.provinceFk <=> OLD.provinceFk)
OR (NEW.postCode <=> OLD.postCode) THEN
SET NEW.geoFk = supplier_getGeo(NEW.id);
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,23 @@
ALTER TABLE vn.address
ADD geoFk int(11) DEFAULT NULL NULL AFTER isLogifloraAllowed,
ADD CONSTRAINT address_zoneGeo_FK FOREIGN KEY (geoFk)
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
CREATE OR REPLACE TEMPORARY TABLE tmp.tAddressGeo
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT a.id, p.geoFk
FROM vn.address a
JOIN vn.town t ON t.provinceFk = a.provinceFk
JOIN vn.postCode p ON p.townFk = t.id
AND (p.code = a.postalCode OR a.postalCode IS NULL)
JOIN vn.zoneGeo zg ON zg.id = p.geoFk
GROUP BY a.id
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC,
(p.code = a.postalCode) DESC;
UPDATE vn.address a
JOIN tmp.tAddressGeo tag ON tag.id = a.id
SET a.geoFk = tag.geoFk;
DROP TEMPORARY TABLE tmp.tAddressGeo;

View File

@ -0,0 +1,26 @@
ALTER TABLE vn.client
CHANGE hasDailyInvoice hasDailyInvoice tinyint(1) DEFAULT 0 NOT NULL
COMMENT 'Indica si el cliente requiere facturación diaria por defecto se copiará lo que tenga country.hasDailyInvoice'
AFTER recommendedCredit,
ADD geoFk int(11) DEFAULT NULL NULL AFTER hasDailyInvoice,
ADD CONSTRAINT client_zoneGeo_FK FOREIGN KEY (geoFk)
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
CREATE OR REPLACE TEMPORARY TABLE tmp.tClientGeo
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT c.id, p.geoFk
FROM vn.client c
JOIN vn.town t ON t.provinceFk = c.provinceFk
JOIN vn.postCode p ON p.townFk = t.id
AND (p.code = c.postcode OR c.postcode IS NULL)
JOIN vn.zoneGeo zg ON zg.id = p.geoFk
GROUP BY c.id
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC,
(p.code = c.postcode) DESC;
UPDATE vn.client c
JOIN tmp.tClientGeo tcg ON tcg.id = c.id
SET c.geoFk = tcg.geoFk;
DROP TEMPORARY TABLE tmp.tClientGeo;

View File

@ -0,0 +1,27 @@
ALTER TABLE vn.supplier
CHANGE companySize companySize enum('small','medium','big') CHARACTER SET utf8mb3
COLLATE utf8mb3_general_ci DEFAULT NULL NULL AFTER stamp,
ADD geoFk int(11) DEFAULT NULL NULL AFTER companySize,
ADD CONSTRAINT supplier_zoneGeo_FK FOREIGN KEY (geoFk)
REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
CREATE OR REPLACE TEMPORARY TABLE tmp.tSupplierGeo
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT s.id, p.geoFk
FROM vn.supplier s
JOIN vn.town t ON t.provinceFk = s.provinceFk
JOIN vn.postCode p ON p.townFk = t.id
AND (p.code = s.postCode OR s.postCode IS NULL)
LEFT JOIN vn.supplierAddress sad ON sad.supplierFk = s.id
JOIN vn.zoneGeo zg ON zg.id = p.geoFk
GROUP BY s.id
ORDER BY (s.city SOUNDS LIKE t.`name`) DESC,
(p.code = s.postCode) DESC,
(p.code = sad.postalCode) DESC;
UPDATE vn.supplier s
JOIN tmp.tSupplierGeo tsg ON tsg.id = s.id
SET s.geoFk = tsg.geoFk;
DROP TEMPORARY TABLE tmp.tSupplierGeo;

View File

@ -0,0 +1,7 @@
UPDATE salix.ACL
SET principalId = 'deliveryAssistant'
WHERE model = 'Ticket'
AND property = 'updateAttributes'
AND principalId = "delivery";

View File

@ -0,0 +1,15 @@
USE vn;
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('RouteAction', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('RouteComplement', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('RouteComplement', 'create', 'WRITE', 'ALLOW', 'ROLE', 'delivery');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('RouteComplement', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'delivery');

View File

@ -244,5 +244,7 @@
"Invalid or expired verification code": "Invalid or expired verification code", "Invalid or expired verification code": "Invalid or expired verification code",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first", "There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}", "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
"Payment method is required": "Payment method is required" "Payment method is required": "Payment method is required",
"Sales already moved": "Sales already moved"
} }

View File

@ -387,5 +387,6 @@
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
"The web user's email already exists": "El correo del usuario web ya existe" "The web user's email already exists": "El correo del usuario web ya existe",
"Sales already moved": "Ya han sido transferidas"
} }

View File

@ -50,8 +50,11 @@ module.exports = Self => {
i.id itemFk, i.id itemFk,
i.name itemName, i.name itemName,
ti.quantity, ti.quantity,
ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id)) ROUND((ac.conversionCoefficient *
/ (vc.trolleyM3 * 1000000),1) volume, (ti.quantity / b.packing) *
buy_getVolume(b.id)
) / (vc.trolleyM3 * 1000000),
2) volume,
b.packagingFk packagingFk, b.packagingFk packagingFk,
b.packing b.packing
FROM tmp.item ti FROM tmp.item ti

View File

@ -1,7 +1,7 @@
export * from './module'; export * from './module';
import './main'; import './main';
import './summary';
import './descriptor'; import './descriptor';
import './descriptor-popover'; import './descriptor-popover';
import './descriptor-menu'; import './descriptor-menu';
import './summary';

View File

@ -34,6 +34,12 @@
"params": { "params": {
"invoice-out": "$ctrl.invoiceOut" "invoice-out": "$ctrl.invoiceOut"
} }
},
{
"url": "/:id",
"state": "invoiceOut.card",
"abstract": true,
"component": "vn-invoice-out-card"
} }
] ]
} }

View File

@ -41,6 +41,9 @@
}, },
"available": { "available": {
"type": "number" "type": "number"
},
"buyFk": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -22,7 +22,7 @@ module.exports = Self => {
}, { }, {
arg: 'from', arg: 'from',
type: 'date', type: 'date',
description: 'The from date' description: 'The from date',
}, { }, {
arg: 'to', arg: 'to',
type: 'date', type: 'date',
@ -84,7 +84,6 @@ module.exports = Self => {
Object.assign(myOptions, options); Object.assign(myOptions, options);
const args = ctx.args; const args = ctx.args;
// Apply filter by team // Apply filter by team
const teamMembersId = []; const teamMembersId = [];
if (args.myTeam != null) { if (args.myTeam != null) {
@ -101,9 +100,12 @@ module.exports = Self => {
teamMembersId.push(userId); teamMembersId.push(userId);
} }
if (args && args.myTeam) if (args?.myTeam)
args.teamIds = teamIds; args.teamIds = teamIds;
if (args?.to)
args.to.setHours(23, 59, 0, 0);
const where = buildFilter(args, (param, value) => { const where = buildFilter(args, (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
@ -151,7 +153,12 @@ module.exports = Self => {
CREATE OR REPLACE TEMPORARY TABLE tmp.filter CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id)) (INDEX (id))
ENGINE = MEMORY ENGINE = MEMORY
SELECT o.id, WITH wOrderTicket AS(
SELECT orderFk,
ticketFk
FROM orderTicket
GROUP BY orderFk
)SELECT o.id,
o.total, o.total,
o.date_send landed, o.date_send landed,
o.date_make created, o.date_make created,
@ -199,7 +206,6 @@ module.exports = Self => {
`); `);
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(`GROUP BY id`);
stmt.merge(conn.makePagination(filter)); stmt.merge(conn.makePagination(filter));
stmts.push(stmt); stmts.push(stmt);
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`); stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);
@ -212,7 +218,6 @@ module.exports = Self => {
const sql = ParameterizedSQL.join(stmts, ';'); const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions); const result = await conn.executeStmt(sql, myOptions);
return result[ordersIndex]; return result[ordersIndex];
}; };
}; };

View File

@ -23,6 +23,12 @@
"Route": { "Route": {
"dataSource": "vn" "dataSource": "vn"
}, },
"RouteAction": {
"dataSource": "vn"
},
"RouteComplement": {
"dataSource": "vn"
},
"RouteLog": { "RouteLog": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,30 @@
{
"name": "RouteAction",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "routeAction"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": true
},
"price": {
"type": "number"
},
"isMainlineDelivered": {
"type": "boolean",
"required": true
}
}
}

View File

@ -0,0 +1,37 @@
{
"name": "RouteComplement",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "routeComplement"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"dated": {
"type": "date"
},
"price": {
"type": "number"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"routeAction": {
"type": "belongsTo",
"model": "RouteAction",
"foreignKey": "routeActionFk"
}
}
}

View File

@ -44,6 +44,11 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Worker", "model": "Worker",
"foreignKey": "id" "foreignKey": "id"
},
"itemShelving": {
"type": "hasMany",
"model": "ItemShelving",
"foreignKey": "shelvingFk"
} }
} }
} }

View File

@ -37,6 +37,7 @@ module.exports = Self => {
'name', 'name',
'subName', 'subName',
'itemPackingTypeFk', 'itemPackingTypeFk',
'size',
'tag5', 'tag5',
'value5', 'value5',
'tag6', 'tag6',

View File

@ -81,6 +81,10 @@ module.exports = Self => {
if (ticketId != id && hasClaimedSales) if (ticketId != id && hasClaimedSales)
throw new UserError(`Can't transfer claimed sales`); throw new UserError(`Can't transfer claimed sales`);
const missingSales = sales.some(({id}) => !map.has(id));
if (missingSales)
throw new UserError($t('Sales already moved'));
for (const sale of sales) { for (const sale of sales) {
const originalSale = map.get(sale.id); const originalSale = map.get(sale.id);
if (sale.quantity == originalSale?.quantity) { if (sale.quantity == originalSale?.quantity) {

View File

@ -301,7 +301,19 @@
"birth", "birth",
"educationLevelFk", "educationLevelFk",
"originCountryFk", "originCountryFk",
"maritalStatus" "maritalStatus",
"SSN"
],
"include": [
{
"relation": "client",
"scope": {
"fields": [
"id",
"phone"
]
}
}
] ]
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "24.44.0", "version": "24.50.0",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "Salix backend", "description": "Salix backend",
"license": "GPL-3.0", "license": "GPL-3.0",