This commit is contained in:
parent
4a0b8f37cd
commit
aab0771e6e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue