8355-testToMaster #3336

Merged
alexm merged 241 commits from 8355-testToMaster into master 2025-01-07 06:44:57 +00:00
8 changed files with 47 additions and 9 deletions
Showing only changes of commit c270ec3723 - Show all commits

View File

@ -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));
}; };
}; };

View File

@ -133,6 +133,9 @@
"Postcode": { "Postcode": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Prefix": {
"dataSource": "vn"
},
"ReferenceRate": { "ReferenceRate": {
"dataSource": "vn" "dataSource": "vn"
}, },

27
back/models/prefix.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "Prefix",
"base": "VnModel",
"options": {
"mysql": {
"table": "pbx.prefix"
}
},
"properties": {
"country": {
"type": "string",
"id": true
},
"prefix": {
"type": "string"
}
},
"acls": [
{
"property": "*",
"accessType": "READ",
"principalType": "ROLE",
"principalId": "employee",
"permission": "ALLOW"
}
]
}

View File

@ -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);

View File

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

View File

@ -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);
} }
} }

View File

@ -33,7 +33,9 @@ td {
font-size: 26px; font-size: 26px;
} }
.lg-txt { .lg-txt {
font-size: 32px; font-size: 40px;
padding: 0px;
line-height: 1;
} }
.xl-txt { .xl-txt {
font-size: 50px; font-size: 50px;

View File

@ -36,12 +36,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="lg-txt xl-width bold center"> <td class="bold center lg-txt xl-width">
<div class="overflow-line"> <div class="overflow-line">
{{formatNumber(buy.itemFk)}} {{formatNumber(buy.itemFk)}}
</div> </div>
</td> </td>
<td colspan="2" class="md-txt md-width center"> <td colspan="2" class="center md-txt md-width">
<div class="overflow-line"> <div class="overflow-line">
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}} {{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
</div> </div>