This commit is contained in:
2026-10-20 15:48:38 +08:00
parent da6b4685d7
commit 0ff1eefff6
50 changed files with 3933 additions and 78 deletions
@@ -129,7 +129,12 @@ async function prepareDraft(context, io, candidates) {
const own = await candidatePage(io, candidates[0].warehouseId, { draftToken: draft.draftToken })
io.check('原草稿仅放行自己的可选来源', null, candidates.every(c => own.some(a => a.sourceKey === c.sourceKey && a.blockReasons?.length === 0)))
const hidden = await candidatePage(io, candidates[0].warehouseId)
io.check('无草稿身份不能选择活动占用', null, candidates.every(c => !hidden.some(a => a.sourceKey === c.sourceKey && a.blockReasons?.length === 0)))
io.check('草稿锁为软占用不阻断其他草稿候选', null,
candidates.every(c => hidden.some(a => a.sourceKey === c.sourceKey && a.blockReasons?.length === 0)),
`hidden=${JSON.stringify(candidates.map(c => ({ key: c.sourceKey, reasons: hidden.filter(a => a.sourceKey === c.sourceKey).map(a => a.blockReasons) }))).slice(0, 600)}`)
context.addCoverageGap?.(MODULE, 'dispatch-occupancy', '正式排车活动占用阻断',
'草稿锁是软占用,不阻断其他草稿;正式排车占用阻断由 grouped 正式整车转换与 removeControl 回查覆盖',
'not-implemented', { blocking: false })
return draft
}
async function createRelabel(context, io, proof) {
@@ -152,8 +157,10 @@ export async function run(context) {
const proof = context.createdResources.phase4OverseasDispatch = { marker: context.marker, status: 'CHECKING', dispatchNo: null, finalStatus: null, stage: null, requests: [] }
try {
const fixture = context.createdResources.phase4OverseasPda
const dispatchPlanIds = () => (context.createdResources?.phase4OverseasPda?.generatedPlanIds || []).map(String)
markerCandidates(context, [])
let io = dispatchIo(context, MODULE, proof, 'MAIN')
io.planIds = dispatchPlanIds()
const page = await candidatePage(io, fixture.overseasWarehouseId)
const routeFixture = selectDispatchRouteFixture(markerCandidates(context, page))
if (!routeFixture) throw new DispatchNotRun('本轮同客户仓需两个FBA目的地及同目的地双实托,不借历史样本')
@@ -161,6 +168,7 @@ export async function run(context) {
;[...selected, routeFixture.duplicate].forEach((c, n) => createBody(context.marker, `PRECHECK-${n}`, [c]))
context = await dispatchEvidenceContext(context)
io = dispatchIo(context, MODULE, proof, 'MAIN')
io.planIds = dispatchPlanIds()
proof.removalDispatchNo = await removeControl(context, io, selected[0])
const grouped = await verifyGroupedDispatch(context, MODULE, selected)
if (grouped.status !== 'GROUPED_DISPATCH_VERIFIED') throw new DispatchNotRun(grouped.reason)