fix(主系统回写): 分拣到待配送时也回写备货完成
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s

待取货/免配送单不经过发车,原回写只在 50→60;分拣强制到 50 时补回写,避免主系统停在待备货。
This commit is contained in:
Ubuntu
2026-10-27 12:30:22 +08:00
parent 0b999f75f0
commit 8084d36cb0
2 changed files with 11 additions and 0 deletions
+3
View File
@@ -1498,6 +1498,9 @@ async function forceOrderReadyForDeliveryAfterPicking(
);
if (!updated.rowCount) return false;
await ensureDeliveryTaskForOrder(code, branchCode || null).catch(() => undefined);
// 到 50(待配送/待取货)即通知主系统「备货完成」;不能只在发车路径回写,
// 否则待取货/免配送单永远停在主系统待备货。非阻塞、失败由对账兜底。
enqueueMainSystemWritebackForReadyOrder({ branchCode: branchCode || null, orderCode: code });
return true;
}
@@ -11,6 +11,7 @@ const registration = read('../../migrations/20261074_standalone_processing_outpu
const ledger = read('../src/services/mainSystemPrepLedger.ts');
const visibility = read('../src/services/supplierSkipInbound.ts');
const outbound = read('../src/services/inventoryOutboundService.ts');
const pickingSrc = read('../src/services/pickingService.ts');
const atomicDoc = read('../../../.team/early-pickup-delivery/t3-atomicity.md');
const print = read('../src/services/deliveryPrintLineService.ts');
const routing = read('../src/services/deliveryRoutingService.ts');
@@ -137,4 +138,11 @@ describe('T3 早期任务核货/发车/补录', () => {
expect(backfill).toContain('shouldBackfillInbound = false');
expect(backfill).not.toContain('throw error; // backfill_inspection_missing');
});
it('分拣完成强制到 50 时也触发主系统备货完成回写', () => {
const idx = pickingSrc.indexOf('async function forceOrderReadyForDeliveryAfterPicking');
const fn = pickingSrc.slice(idx, pickingSrc.indexOf('export async function recoverOrdersReadyForDeliveryAfterPicking', idx));
expect(fn).toContain('enqueueMainSystemWritebackForReadyOrder');
expect(fn).toContain('orderCode: code');
});
});