Compare commits

..

14 Commits

Author SHA1 Message Date
Guillermo Bonet 3453aa0f8c Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2024-11-29 11:40:22 +01:00
Guillermo Bonet 3b73ffbd8a Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2024-11-29 11:40:05 +01:00
Sergio De la torre 76b12e73b9 Merge pull request 'fix: refs #7920 refs#7920 itemShelvingLogs' (!3263) from 7920-itemShelvingsLog into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3263
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-11-29 10:38:30 +00:00
Sergio De la torre 009b4ab7b9 fix: refs #7920 refs#7920 itemShelvingLogs
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-29 11:31:31 +01:00
Alex Moreno 20b68b4b41 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-11-29 07:28:55 +01:00
Alex Moreno b48beaf4b3 Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details
2024-11-29 07:28:24 +01:00
Alex Moreno d6a849727e fix: fix result test
gitea/salix/pipeline/head This commit looks good Details
2024-11-28 13:11:43 +01:00
Alex Moreno 838296e744 fix: add expected message result
gitea/salix/pipeline/head This commit looks good Details
2024-11-28 13:02:58 +01:00
Alex Moreno 6785779fe5 fix: add console log
gitea/salix/pipeline/head This commit looks good Details
2024-11-28 12:26:03 +01:00
Alex Moreno e730b5d4a1 fix: add debugAdd response axios
gitea/salix/pipeline/head This commit looks good Details
2024-11-28 11:53:42 +01:00
Alex Moreno 5923916cda fix: change debugAdd to console.error
gitea/salix/pipeline/head This commit looks good Details
2024-11-28 11:31:38 +01:00
Pablo Natek c8b0874e95 Merge pull request 'fix: refs #7404 add debug logging for cancelShipment and deleteExpeditions methods' (!3258) from 7404-add-debug into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3258
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-28 10:24:57 +00:00
Alex Moreno 8ef78818db Merge branch 'master' into 7404-add-debug
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-28 10:19:32 +00:00
Pablo Natek 00e5f86020 fix: refs #7404 add debug logging for cancelShipment and deleteExpeditions methods
gitea/salix/pipeline/pr-master This commit looks good Details
2024-11-28 11:18:09 +01:00
4 changed files with 18 additions and 23 deletions

View File

@ -24,12 +24,13 @@ module.exports = Self => {
Self.cancelShipment = async expeditionFk => {
const models = Self.app.models;
const mrw = await models.MrwConfig.findOne();
const {externalId} = await models.Expedition.findById(expeditionFk);
const clientType = await models.MrwConfig.getClientType(expeditionFk);
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]);
const response = await axios.post(mrw.url, renderedXml, {
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
@ -37,12 +38,11 @@ module.exports = Self => {
});
const xmlString = response.data;
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]);
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente');
return ['no se ha encontrado', 'se ha cancelado correctamente'].some(res => result.toLowerCase().includes(res));
};
};

View File

@ -18,11 +18,6 @@ module.exports = Self => {
arg: 'search',
type: 'string',
description: `If it's and integer searchs by id, otherwise it searchs by name`
},
{
arg: 'sumAmount',
type: 'boolean',
description: `Indicates whether to calculate the total sum of amounts or to return detailed records`
}
],
returns: {
@ -33,7 +28,6 @@ module.exports = Self => {
path: `/filter`,
verb: 'GET'
}
});
Self.filter = async(ctx, filter, options) => {
@ -56,7 +50,14 @@ module.exports = Self => {
filter = mergeFilters(ctx.args.filter, {where});
const stmts = [];
const fields = ctx.args.sumAmount ? 'sum(d.amount) sumAmount' : ` DISTINCT c.id clientFk,
const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const stmt = new ParameterizedSQL(
`SELECT *
FROM (
SELECT
DISTINCT c.id clientFk,
c.name clientName,
c.salesPersonFk,
c.businessTypeFk = 'worker' isWorker,
@ -74,14 +75,7 @@ module.exports = Self => {
r.finished IS NULL hasRecovery,
dp.id departmentFk,
dp.name departmentName,
dp.notificationEmail departmentEmail`;
const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const stmt = new ParameterizedSQL(
`SELECT *
FROM (
SELECT
${fields}
dp.notificationEmail departmentEmail
FROM defaulter d
JOIN client c ON c.id = d.clientFk
JOIN country cn ON cn.id = c.countryFk
@ -108,7 +102,7 @@ module.exports = Self => {
, [date]);
stmt.merge(conn.makeWhere(filter.where));
!ctx.args.sumAmount && stmt.merge(`GROUP BY d.clientFk`);
stmt.merge(`GROUP BY d.clientFk`);
stmt.merge(conn.makeOrderBy(filter.order));
stmt.merge(conn.makeLimit(filter));

View File

@ -51,7 +51,7 @@ module.exports = Self => {
JOIN vn.productionConfig pc
WHERE sh.code = ? AND s.code = pc.sectorFromCode
), tItemInSector AS (
SELECT is2.itemFk, is2.created, is2.shelvingFk
SELECT is2.itemFk, is2.created, sh.code
FROM vn.itemShelving is2
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk
@ -59,7 +59,7 @@ module.exports = Self => {
JOIN vn.productionConfig pc
WHERE sh.code <> ?
AND s.code = pc.sectorFromCode)
SELECT ti.itemFK, tis.shelvingFk
SELECT ti.itemFK, tis.code shelvingFk
FROM tItemShelving ti
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
JOIN vn.productionConfig pc

View File

@ -52,7 +52,8 @@ module.exports = Self => {
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
deletedExpeditions.push(deletedExpedition);
} catch (e) {
} catch (error) {
console.error('error: ', error);
notDeletedExpeditions.push(expeditionId);
}
}