test → dev #1701

Merged
guillermo merged 10 commits from test into dev 2023-08-04 09:39:34 +00:00
1 changed files with 1 additions and 32 deletions
Showing only changes of commit aab0771e6e - Show all commits

View File

@ -120,38 +120,7 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
await Self.rawSql(`
INSERT INTO clientSample (clientFk, typeFk, companyFk) VALUES(?, ?, ?)
`, [ticket.clientFk, sample.id, ticket.companyFk], {userId});
}
await Self.rawSql(`
INSERT INTO cmr (ticketFk, companyFk, addressToFk, addressFromFk, supplierFk, ead)
SELECT t.id,
com.id,
a.id,
c2.defaultAddressFk,
su.id,
t.landed
FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state s ON s.id = ts.stateFk
JOIN alertLevel al ON al.id = s.alertLevel
JOIN client c ON c.id = t.clientFk
JOIN address a ON a.id = t.addressFk
JOIN province p ON p.id = a.provinceFk
JOIN country co ON co.id = p.countryFk
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
JOIN warehouse w ON w.id = t.warehouseFk
JOIN company com ON com.id = t.companyFk
JOIN client c2 ON c2.id = com.clientFk
JOIN supplierAccount sa ON sa.id = com.supplierAccountFk
JOIN supplier su ON su.id = sa.supplierFk
WHERE shipped BETWEEN util.yesterday() AND util.dayEnd(util.yesterday())
AND al.code IN ('PACKED', 'DELIVERED')
AND co.code <> 'ES'
AND am.name <> 'ABONO'
AND w.code = 'ALG'
AND dm.code = 'DELIVERY'
`);
};
} catch (error) {
// Domain not found
if (error.responseCode == 450)