Merge branch 'master' into 6404-sendMailOnDeadLine
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Pablo Natek 2024-06-27 07:12:40 +00:00
commit b6a72a1abb
12 changed files with 82 additions and 63 deletions

View File

@ -26,6 +26,7 @@ BEGIN
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk
JOIN bs.clientDiedPeriod cdp ON cdp.countryFk = co.id
WHERE cd.warning = 'third'
AND cp.clientFk IS NULL
AND sp.salesPersonFk IS NULL

View File

@ -1,5 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(vTicketFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN
/**
* Splita las lineas de ticket que no estan ubicadas
@ -50,7 +52,7 @@ BEGIN
SET s.ticketFk = vNewTicketFk;
END IF;
CALL ticketStateUpdate(vNewTicketFk, 'FIXING');
CALL ticket_setState(vNewTicketFk, 'FIXING');
DROP TEMPORARY TABLE tmp.SalesToSplit;
END$$

View File

@ -1,5 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(vDateFrom DATE, vDateTo DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE;
@ -41,7 +44,14 @@ BEGIN
DECLARE vMessage TEXT;
SET vIsDone = FALSE;
FETCH rsTicket INTO vTicketFk,vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk,vShipment;
FETCH rsTicket INTO
vTicketFk,
vClientFk,
vWarehouseFk,
vCompanyFk,
vAddressFk,
vAgencyModeFk,
vShipment;
IF vIsDone THEN
LEAVE myLoop;
@ -88,8 +98,14 @@ BEGIN
SET clonedFrom = vTicketFk
WHERE id = vNewTicket;
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price,
discount, priceFixed, isPriceFixed)
INSERT INTO sale (ticketFk,
itemFk,
concept,
quantity,
price,
discount,
priceFixed,
isPriceFixed)
SELECT vNewTicket,
saleOrig.itemFk,
saleOrig.concept,
@ -189,7 +205,7 @@ BEGIN
IF NOT vIsDuplicateMail THEN
CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage);
END IF;
CALL ticketStateUpdate (vNewTicket, 'FIXING');
CALL ticket_setState(vNewTicket, 'FIXING');
ELSE
CALL ticketCalculateClon(vNewTicket, vTicketFk);
END IF;

View File

@ -1,5 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
)
proc:BEGIN
/**
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
@ -17,45 +21,41 @@ proc:BEGIN
FROM tmp.salesToSplit
WHERE ticketFk = vTicketFk;
SELECT count(*) INTO vTotalLines
FROM vn.sale s
SELECT COUNT(*) INTO vTotalLines
FROM sale s
WHERE s.ticketFk = vTicketFk;
SET vHasFullProblem = (vTotalLines = vProblemLines);
-- Ticket completo
IF vHasFullProblem THEN
UPDATE vn.ticket
UPDATE ticket
SET landed = vDated + INTERVAL 1 DAY,
shipped = vDated,
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
WHERE id = vTicketFk;
SELECT "moved" message, NULL ticketFuture;
SELECT 'moved' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket a futuro existe
IF vTicketFutureFk THEN
UPDATE vn.sale s
UPDATE sale s
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept)
WHERE ss.ticketFk = vTicketFk;
SELECT "future" message, NULL ticketFuture;
SELECT 'future' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket nuevo
CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk);
CALL ticket_Clone(vTicketFk, vTicketFutureFk);
UPDATE vn.ticket t
JOIN vn.productionConfig pc
UPDATE ticket t
JOIN productionConfig pc
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
t.landed = vDated + INTERVAL 1 DAY,
t.shipped = vDated,
@ -63,14 +63,14 @@ proc:BEGIN
t.zoneFk = pc.defaultZone
WHERE t.id = vTicketFutureFk;
UPDATE vn.sale s
UPDATE sale s
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept)
WHERE sts.ticketFk = vTicketFk;
CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING');
CALL ticket_setState(vTicketFutureFk, 'FIXING');
SELECT "new" message,vTicketFutureFk ticketFuture;
SELECT 'new' message, vTicketFutureFk ticketFuture;
END$$
DELIMITER ;

View File

@ -27,7 +27,7 @@
vn-id="country"
ng-model="$ctrl.data.countryFk"
url="Countries"
fields="['id', 'country', 'code']"
fields="['id', 'name', 'code']"
show-field="name"
value-field="id"
label="Country">

View File

@ -50,7 +50,7 @@ module.exports = function(Self) {
{
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
},
{

View File

@ -54,7 +54,7 @@ module.exports = Self => {
{
relation: 'country',
scope: {
fields: ['country']
fields: ['name']
}
},
{

View File

@ -37,7 +37,7 @@ class Controller extends Section {
include: {
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
}
}

View File

@ -28,7 +28,7 @@ class Controller extends Section {
field: 'countryFk',
autocomplete: {
url: 'Countries',
showField: 'country',
showField: 'name',
}
},
{

View File

@ -59,7 +59,7 @@ module.exports = Self => {
include: [{
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
}, {
relation: 'taxClass',

View File

@ -55,7 +55,7 @@ module.exports = Self => {
{
relation: 'country',
scope: {
fields: ['id', 'country', 'code']
fields: ['id', 'name', 'code']
}
},
{

View File

@ -12,7 +12,7 @@ SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '
JOIN vn.sale s ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
)SELECT SUM(t.packages),
)SELECT SUM(t.packages) packages,
a.incotermsFk,
ic.name incotermsName,
MAX(t.weight) weight,