match PDA pending tasks by current container number
This commit is contained in:
@@ -58,6 +58,15 @@ export async function run(context) {
|
||||
const pendingRecords = Array.isArray(pendingTasks) ? pendingTasks
|
||||
: pendingTasks?.records || pendingTasks?.items || []
|
||||
let pendingTask = pendingRecords.find((item) => id(item?.taskId || item?.id) === taskId)
|
||||
if (!pendingTask) {
|
||||
const currentKeyword = id(taskDetail?.currentContainerNo)
|
||||
const currentPendingResponse = currentKeyword ? await request(context, 'GET',
|
||||
`/api/platform/v1/first-leg/pda-loading/tasks/pending?warehouseId=${encodeURIComponent(warehouseId)}&keyword=${encodeURIComponent(currentKeyword)}`) : null
|
||||
const currentPending = currentPendingResponse
|
||||
? context.apiSuccess(MODULE, '按任务当前真实柜号回查 PDA pending 列表', currentPendingResponse, '', OPTIONS) : []
|
||||
const currentRecords = Array.isArray(currentPending) ? currentPending : currentPending?.records || currentPending?.items || []
|
||||
pendingTask = currentRecords.find((item) => id(item?.taskId || item?.id) === taskId)
|
||||
}
|
||||
if (!pendingTask) {
|
||||
const broadPendingResponse = await request(context, 'GET',
|
||||
`/api/platform/v1/first-leg/pda-loading/tasks/pending?warehouseId=${encodeURIComponent(warehouseId)}`)
|
||||
|
||||
Reference in New Issue
Block a user