Merge branch 'dev' into 7531-Modify-zone_getAddresses
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-07-18 13:23:38 +00:00
commit c44bf909b2
7 changed files with 69 additions and 29 deletions

View File

@ -13,7 +13,7 @@ module.exports = Self => {
required: true required: true
}], }],
returns: { returns: {
type: ['object'], type: 'boolean',
root: true root: true
}, },
http: { http: {
@ -39,6 +39,7 @@ module.exports = Self => {
const xmlString = response.data; const xmlString = response.data;
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent; const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente');
}; };
}; };

View File

@ -10,19 +10,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_comparative`(
) )
proc: BEGIN proc: BEGIN
/** /**
* Genera una tabla de comparativa de artículos por itemType/comprador/fecha. * Generates a comparison table of items by itemType/buyer/date.
* Los datos se calculan en función de los parámetros proporcionados. * The data is calculated based on the provided parameters.
* *
* @param vDate La fecha para la cual se generará la comparativa. * @param vDate The date for which the comparison will be generated.
* @param vDayRange El rango de días a considerar para la comparativa. * @param vDayRange The range of days to consider for the comparison.
* @param vWarehouseFk El identificador del almacén para filtrar los artículos. * @param vWarehouseFk The warehouse identifier to filter the items.
* @param vAvailableSince La fecha de disponibilidad desde la cual se consideran los artículos disponibles. * @param vAvailableSince The availability date from which the items are considered available.
* @param vBuyerFk El identificador del comprador para filtrar los artículos. * @param vBuyerFk The buyer identifier to filter the items.
* @param vIsFloramondo Indica si se deben incluir solo los artículos de Floramondo (opcional). * @param vIsFloramondo Indicates whether only Floramondo items should be included (optional).
* @param vCountryFk El identificador del país. * @param vCountryFk The country identifier.
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT) * @param tmp.comparativeFilterType(filterFk INT, itemTypeFk INT)
* @return tmp.comparative * @return tmp.comparative
*/ */
DECLARE vDayRangeStart DATE; DECLARE vDayRangeStart DATE;
DECLARE vDayRangeEnd DATE; DECLARE vDayRangeEnd DATE;
DECLARE w1, w2, w3, w4, w5, w6, w7 INT; DECLARE w1, w2, w3, w4, w5, w6, w7 INT;

View File

@ -46,12 +46,18 @@ BEGIN
i.tag8 = JSON_VALUE(vTags, '$.8'), i.tag8 = JSON_VALUE(vTags, '$.8'),
i.tag9 = JSON_VALUE(vTags, '$.9'), i.tag9 = JSON_VALUE(vTags, '$.9'),
i.tag10 = JSON_VALUE(vTags, '$.10'), i.tag10 = JSON_VALUE(vTags, '$.10'),
i.tag11 = JSON_VALUE(vTags, '$.11'),
i.tag12 = JSON_VALUE(vTags, '$.12'),
i.tag13 = JSON_VALUE(vTags, '$.13'),
i.value5 = JSON_VALUE(vValues, '$.5'), i.value5 = JSON_VALUE(vValues, '$.5'),
i.value6 = JSON_VALUE(vValues, '$.6'), i.value6 = JSON_VALUE(vValues, '$.6'),
i.value7 = JSON_VALUE(vValues, '$.7'), i.value7 = JSON_VALUE(vValues, '$.7'),
i.value8 = JSON_VALUE(vValues, '$.8'), i.value8 = JSON_VALUE(vValues, '$.8'),
i.value9 = JSON_VALUE(vValues, '$.9'), i.value9 = JSON_VALUE(vValues, '$.9'),
i.value10 = JSON_VALUE(vValues, '$.10'), i.value10 = JSON_VALUE(vValues, '$.10'),
i.value11 = JSON_VALUE(vValues, '$.11'),
i.value12 = JSON_VALUE(vValues, '$.12'),
i.value13 = JSON_VALUE(vValues, '$.13'),
i.producerFk = p.id, i.producerFk = p.id,
i.inkFk = k.id, i.inkFk = k.id,
i.originFk = IFNULL(o.id, i.originFk) i.originFk = IFNULL(o.id, i.originFk)

View File

@ -0,0 +1,8 @@
ALTER TABLE vn.item ADD IF NOT EXISTS tag11 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value11 varchar(50) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS tag12 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value12 varchar(50) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS tag13 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value13 varchar(50) DEFAULT NULL NULL;

View File

@ -60,7 +60,7 @@ module.exports = Self => {
DISTINCT c.id clientFk, DISTINCT c.id clientFk,
c.name clientName, c.name clientName,
c.salesPersonFk, c.salesPersonFk,
c.businessTypeFk, c.businessTypeFk = 'worker' isWorker,
u.name salesPersonName, u.name salesPersonName,
d.amount, d.amount,
co.created, co.created,
@ -71,14 +71,23 @@ module.exports = Self => {
d.defaulterSinced, d.defaulterSinced,
cn.name country, cn.name country,
c.countryFk, c.countryFk,
pm.name payMethod pm.name payMethod,
FROM vn.defaulter d r.finished IS NULL hasRecovery,
JOIN vn.client c ON c.id = d.clientFk dp.id departmentFk,
JOIN vn.country cn ON cn.id = c.countryFk dp.name departmentName
JOIN vn.payMethod pm ON pm.id = c.payMethodFk FROM defaulter d
LEFT JOIN vn.clientObservation co ON co.clientFk = c.id JOIN client c ON c.id = d.clientFk
JOIN country cn ON cn.id = c.countryFk
JOIN payMethod pm ON pm.id = c.payMethodFk
LEFT JOIN clientObservation co ON co.clientFk = c.id
LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN account.user uw ON uw.id = co.workerFk LEFT JOIN account.user uw ON uw.id = co.workerFk
LEFT JOIN (
SELECT MAX(started), clientFk, finished
FROM recovery
) r ON r.clientFk = c.id
LEFT JOIN workerDepartment wd ON wd.workerFk = u.id
JOIN department dp ON dp.id = wd.departmentFk
WHERE WHERE
d.created = ? d.created = ?
AND d.amount > 0 AND d.amount > 0

View File

@ -44,15 +44,21 @@ module.exports = Self => {
const expedition = await models.Expedition.findOne(filter); const expedition = await models.Expedition.findOne(filter);
const {code} = expedition.agencyMode(); const {code} = expedition.agencyMode();
let isDeleted = true;
if (code && code.toLowerCase().substring(0, 10) == 'viaexpress') { if (code?.toLowerCase()?.includes('mrw')) {
const isDeleted = await models.ViaexpressConfig.deleteExpedition(expeditionId); const result = await models.MrwConfig.cancelShipment(expeditionId);
isDeleted = result;
}
if (isDeleted === 'true') { if (code?.toLowerCase()?.substring(0, 10) == 'viaexpress') {
const deletedExpedition = await models.Expedition.destroyById(expeditionId); const result = await models.ViaexpressConfig.deleteExpedition(expeditionId);
deletedExpeditions.push(deletedExpedition); if (result !== 'true') isDeleted = false;
} else notDeletedExpeditions.push(expeditionId); }
} else {
if (!isDeleted)
notDeletedExpeditions.push(expeditionId);
else {
const deletedExpedition = await models.Expedition.destroyById(expeditionId); const deletedExpedition = await models.Expedition.destroyById(expeditionId);
deletedExpeditions.push(deletedExpedition); deletedExpeditions.push(deletedExpedition);
} }

View File

@ -53,13 +53,22 @@ module.exports = Self => {
const stmts = []; const stmts = [];
const stmt = new ParameterizedSQL( const stmt = new ParameterizedSQL(
`SELECT t.id AS ticketFk, c.id AS clientFk, c.name AS clientName, tw.weekDay, `SELECT t.id AS ticketFk,
wh.name AS warehouseName, u.id AS workerFk, u.name AS userName, u.nickName, tw.agencyModeFk c.id AS clientFk,
c.name AS clientName,
tw.weekDay,
wh.name AS warehouseName,
u.id AS workerFk,
u.name AS userName,
u.nickName,
tw.agencyModeFk,
am.name agencyModeName
FROM ticketWeekly tw FROM ticketWeekly tw
JOIN ticket t ON t.id = tw.ticketFk JOIN ticket t ON t.id = tw.ticketFk
JOIN client c ON c.id = t.clientFk JOIN client c ON c.id = t.clientFk
JOIN account.user u ON u.id = c.salesPersonFk JOIN account.user u ON u.id = c.salesPersonFk
JOIN warehouse wh ON wh.id = t.warehouseFk` JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = tw.agencyModeFk`
); );
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeSuffix(filter));