Merge branch 'dev' into 7146-route.createdToDated
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
bf0daf90db
|
@ -24,12 +24,13 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.cancelShipment = async expeditionFk => {
|
Self.cancelShipment = async expeditionFk => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
const mrw = await models.MrwConfig.findOne();
|
const mrw = await models.MrwConfig.findOne();
|
||||||
const {externalId} = await models.Expedition.findById(expeditionFk);
|
const {externalId} = await models.Expedition.findById(expeditionFk);
|
||||||
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
||||||
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
||||||
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
||||||
|
|
||||||
|
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]);
|
||||||
const response = await axios.post(mrw.url, renderedXml, {
|
const response = await axios.post(mrw.url, renderedXml, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/soap+xml; charset=utf-8'
|
'Content-Type': 'application/soap+xml; charset=utf-8'
|
||||||
|
@ -37,12 +38,11 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const xmlString = response.data;
|
const xmlString = response.data;
|
||||||
|
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]);
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||||
|
|
||||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]);
|
|
||||||
|
|
||||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
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));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE;
|
||||||
|
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique;
|
||||||
|
ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique
|
||||||
|
UNIQUE KEY (invoiceInFk);
|
||||||
|
|
|
@ -51,7 +51,7 @@ module.exports = Self => {
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
WHERE sh.code = ? AND s.code = pc.sectorFromCode
|
WHERE sh.code = ? AND s.code = pc.sectorFromCode
|
||||||
), tItemInSector AS (
|
), tItemInSector AS (
|
||||||
SELECT is2.itemFk, is2.created, is2.shelvingFk
|
SELECT is2.itemFk, is2.created, sh.code
|
||||||
FROM vn.itemShelving is2
|
FROM vn.itemShelving is2
|
||||||
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
|
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
|
@ -59,7 +59,7 @@ module.exports = Self => {
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
WHERE sh.code <> ?
|
WHERE sh.code <> ?
|
||||||
AND s.code = pc.sectorFromCode)
|
AND s.code = pc.sectorFromCode)
|
||||||
SELECT ti.itemFK, tis.shelvingFk
|
SELECT ti.itemFK, tis.code shelvingFk
|
||||||
FROM tItemShelving ti
|
FROM tItemShelving ti
|
||||||
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
|
|
|
@ -52,7 +52,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
|
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
|
||||||
deletedExpeditions.push(deletedExpedition);
|
deletedExpeditions.push(deletedExpedition);
|
||||||
} catch (e) {
|
} catch (error) {
|
||||||
|
console.error('error: ', error);
|
||||||
notDeletedExpeditions.push(expeditionId);
|
notDeletedExpeditions.push(expeditionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
||||||
xmlDocument: document,
|
xmlDocument: document,
|
||||||
format: 'code128',
|
format: 'code128',
|
||||||
displayValue: false,
|
displayValue: false,
|
||||||
width: 3.8,
|
width: 3.5,
|
||||||
height: 75,
|
height: 75,
|
||||||
margin: 0
|
margin: 0
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue