This commit is contained in:
2026-09-15 10:37:34 +08:00
parent 4f13ee2ec3
commit 88e2fb0eb1
49 changed files with 465 additions and 236 deletions
@@ -11,6 +11,7 @@ import { run as completeCustoms } from './phase3-customs.mjs'
import { run as verifyCarrierQuery } from './phase3-carrier-schedule-queries.mjs'
import { runUntilPickupReady } from './phase4-carrier-nodes.mjs'
import { resolvePickerAccess, createPicker, disablePicker, uploadPhotos } from './phase4-overseas-pda.mjs'
import { outboundCreationGuards, outboundTaskGuards, probePartialPick } from './dropship-outbound-edge-cases.mjs'
const MODULE = 'dropship-pallet-matrix'
const BASE = '/api/platform/v1/first-leg/pda-dropship'
@@ -49,6 +50,9 @@ export async function run(context) {
context.context.orderFulfillmentType = 'ONE_CLICK_DROPSHIP'
context.context.orderProfile = { taxMode: 'BUY_DECLARATION', pickupMethod: 'SELF_EXPRESS', containerMode: 'LCL' }
context.context.waitSplitVariant = { skuCount: 1, packageCountPerSku: 4, packageCounts: [4], palletCount }
if (label.startsWith('MULTI-MERGE-')) {
context.context.waitSplitVariant.skuCodes = [`SKU-SHARED-${marker}`.slice(0, 64)]
}
context.options.prepareDropshipManualCount = true
const start = context.steps.length
await context.executeModule(`${MODULE}-${label}-order`, () => createOrder(context))
@@ -111,7 +115,7 @@ export async function run(context) {
const summary = group[0].summary
const cabinet = await command('创建本场景模拟柜', 'POST', '/api/platform/v1/containers', {
channelGroupCode: channelGroup(summary.channelCode), warehouseId: String(summary.warehouseId),
containerType: '40HC', capacityCbm: 76, maxWeightKg: 28000,
containerType: '40HQ', capacityCbm: 68, maxWeightKg: 19500,
})
let plan = await command('读取自动生成装柜计划', 'GET', `${smart}/plans/by-booking/${cabinet.id}`)
const path = `${smart}/plans/${plan.id}`
@@ -422,10 +426,13 @@ export async function run(context) {
.reduce((sum, item) => sum + Number(item.availablePackages), 0) === record.expectedCartonMarks.length))
const body = { recipient: `HTTP acceptance ${context.marker}`, items: inputs,
remark: context.marker, idempotencyKey: `${context.marker}-outbound-create` }
const edge = { context, group, token, customerId, warehouseId, candidatePath, body, label, check, call }
await outboundCreationGuards(edge)
const task = await call('创建一件代发专用出库', 'POST', `${base}/one-click-dropship?customerId=${customerId}`, body)
for (const record of group) record.outbound = { task, selected, completed: false }
const replay = await call('专用出库创建同键重放', 'POST', `${base}/one-click-dropship?customerId=${customerId}`, body)
check(`${label}专用出库重放不重复建单`, null, sameOutboundTask(replay, task))
await outboundTaskGuards({ ...edge, task })
const pdaPath = `/api/pda/v1/last-leg/outbound-tasks/${task.taskNo}`
const detail = await call('PDA读取专用出库任务', 'GET', pdaPath, undefined, true)
check(`${label}PDA出库明细完整`, null, detail.items?.length === inputs.length)
@@ -438,6 +445,11 @@ export async function run(context) {
const pick = { outboundPalletItemId: item.outboundPalletItemId,
inventoryPositionId: candidate.inventoryPositionId, packages: inputs[index].packages,
cartonMarks: inputs[index].cartonMarks, idempotencyKey: `${context.marker}-outbound-pick-${index}` }
if (label === 'SINGLE-SINGLE' && index === 0) {
const count = await probePartialPick({ ...edge, task, pick })
pick.packages -= count
pick.cartonMarks = pick.cartonMarks.slice(count)
}
const picked = await call('PDA专用出库拣货', 'POST', `${pdaPath}/pick`, pick, true)
const repeated = await call('PDA出库拣货同键重放', 'POST', `${pdaPath}/pick`, pick, true)
check(`${label}PDA出库拣货重放不重复扣减`, null, sameOutboundTask(repeated, picked))