This commit is contained in:
2026-09-23 18:26:04 +08:00
parent 6f36bf680f
commit 5a6bfb2a30
7 changed files with 49 additions and 8 deletions
@@ -213,9 +213,16 @@ async function createPlanTask(context, label) {
if (!Number.isInteger(confirmableVersion) || confirmable?.summary?.readiness?.canConfirm !== true) {
throw new Error(`${label} 计划尚未满足整计划确认门禁`)
}
const pdaOperatorsResponse = await context.request('GET',
`/api/platform/v1/iam/users/domestic-pda-operators?warehouseId=${encodeURIComponent(source.warehouseId)}`)
const pdaOperators = context.apiSuccess(MODULE, `${label} 查询国内头程 PDA 作业员候选`, pdaOperatorsResponse, '', OPTIONS)
const pdaOperator = (Array.isArray(pdaOperators) ? pdaOperators : pdaOperators?.records || [])[0]
context.assert(MODULE, `${label} 存在可用 PDA 作业员`, pdaOperatorsResponse,
Boolean(pdaOperator?.userId), `operatorId=${id(pdaOperator?.userId) || 'missing'}`, OPTIONS)
if (!pdaOperator?.userId) throw new Error(`${label} 缺少可用 PDA 作业员`)
const confirmPath = `${LOADING}/loading-plans/${planId}/confirm`
const confirmBody = Object.freeze({ expectedVersion: confirmableVersion })
const confirmBody = Object.freeze({ expectedVersion: confirmableVersion, assigneeId: Number(pdaOperator.userId) })
const confirmHeaders = Object.freeze({
'Idempotency-Key': operationId(context, `${label}-plan-confirm`),
})