6404-adDeliveryAndCeroField #2530

Merged
pablone merged 2 commits from 6404-adDeliveryAndCeroField into master 2024-05-31 10:00:19 +00:00
4 changed files with 22 additions and 6 deletions
Showing only changes of commit 884b5f8475 - Show all commits

View File

@ -26,10 +26,11 @@
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
<mrw:Observaciones><%= expeditionData.deliveryObservation %></mrw:Observaciones>
</mrw:DatosEntrega>
<mrw:DatosServicio>
<mrw:Fecha><%= expeditionData.created %></mrw:Fecha>
<mrw:Referencia><%= expeditionData.expeditionId %></mrw:Referencia>
<mrw:Referencia><%= expeditionData.reference %></mrw:Referencia>
<mrw:CodigoServicio><%= expeditionData.serviceType %></mrw:CodigoServicio>
<mrw:NumeroBultos>1</mrw:NumeroBultos>
<mrw:EntregaSabado><%= expeditionData.weekDays %></mrw:EntregaSabado>

View File

@ -45,7 +45,7 @@ module.exports = Self => {
`SELECT
CASE co.code
WHEN 'ES' THEN a.postalCode
WHEN 'PT' THEN LEFT(a.postalCode, 4)
WHEN 'PT' THEN LEFT(a.postalCode, mc.portugalPostCodeTrim)
WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00')
END postalCode,
a.city,
@ -56,9 +56,10 @@ module.exports = Self => {
c.phone,
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
t.shipped,
e.id expeditionId,
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType,
IF(mw.weekdays, 'S', 'N') weekDays
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
IF(mw.weekdays, 'S', 'N') weekDays,
oa.description deliveryObservation
FROM expedition e
JOIN ticket t ON e.ticketFk = t.id
JOIN agencyMode am ON am.id = t.agencyModeFk
@ -66,8 +67,12 @@ module.exports = Self => {
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a')
JOIN client c ON t.clientFk = c.id
JOIN address a ON t.addressFk = a.id
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
LEFT JOIN observationType ot ON ot.id = oa.observationTypeFk
AND ot.code = 'delivery'
JOIN province p ON a.provinceFk = p.id
JOIN country co ON co.id = p.countryFk
JOIN mrwConfig mc
WHERE e.id = ?
LIMIT 1`;
@ -92,6 +97,7 @@ module.exports = Self => {
if (tx) await tx.commit();
console.log('file: ', file);
return {shipmentId, file};
};

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS counterWidth INT UNSIGNED NULL
Review

si hagueres posat el DEFAULT ja tindries el valor directament.

si hagueres posat el DEFAULT ja tindries el valor directament.
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS serviceTypeWidth INT UNSIGNED NULL
COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.';
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS portugalPostCodeTrim INT UNSIGNED NULL
COMMENT 'It will trim the last characters of the postal code';

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "24.22.6",
"version": "24.22.7",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",