7276_expeditionScanned #2559
|
@ -15,7 +15,8 @@ BEGIN
|
|||
t.addressFk,
|
||||
a.nickname,
|
||||
sub2.itemPackingTypeConcat,
|
||||
est.code
|
||||
est.code,
|
||||
es.isScanned
|
||||
FROM expedition e
|
||||
JOIN ticket t ON t.id = e.ticketFk
|
||||
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
||||
|
@ -33,6 +34,10 @@ BEGIN
|
|||
GROUP BY sub.ticketFk
|
||||
) sub2 ON sub2.ticketFk = t.id
|
||||
LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk
|
||||
LEFT JOIN expeditionState es ON es.id = (
|
||||
jgallego marked this conversation as resolved
Outdated
|
||||
SELECT MAX(id)
|
||||
FROM expeditionState es
|
||||
WHERE expeditionFk = e.id)
|
||||
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||
ORDER BY r.created, t.priority DESC;
|
||||
END$$
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
-- Place your SQL code here
|
||||
|
||||
USE vn;
|
||||
|
||||
ALTER TABLE vn.expeditionState ADD isScanned tinyint(1) DEFAULT false NOT NULL;
|
|
@ -44,11 +44,13 @@ module.exports = Self => {
|
|||
|
||||
const typeFk = expeditionStateType.id;
|
||||
expeditionId = expedition.expeditionFk;
|
||||
const isScannedExpedition = expedition.isScanned ?? false;
|
||||
|
||||
await models.ExpeditionState.create({
|
||||
expeditionFk: expedition.expeditionFk,
|
||||
typeFk,
|
||||
userFk: userId,
|
||||
isScanned: isScannedExpedition,
|
||||
}, myOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
},
|
||||
"userFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"isScanned": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
Loading…
Reference in New Issue
asegurat perque crec que no cal que anides 2, traus el max, i en la general ja pots gastarla
Modificat