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

避免 auto/同单位商品逐行触发主系统计划变更;单位一致、按数量或未选择重量模式不写 outbox。
This commit is contained in:
Ubuntu
2026-11-03 11:24:47 +08:00
parent 00cd9dd424
commit 106b5d56cd
+3 -1
View File
@@ -1791,12 +1791,14 @@ export async function confirmPickingComplete(input: {
// 订单单位与库存单位不一致(如订单 70 个 / 库存斤):分拣称重后,
// ⚠️ 必须在主系统 prep 回写 status=30 之前:主系统只允许备货中(<30)改计划。
// 只有**明确选择按重量结算**的异常行才触发;同单位/按数量/auto 老数据不触发,
// 避免把普通商品每一行都同步成一次计划变更。
// 先按实际重量调整本地计划数量/单位/实收,再写主系统同步 outbox。
// 库存扣减已由出库服务按 SKU 库存单位完成,这里不重复扣库。
for (const row of items.rows) {
const inventoryUnit = String(row.inventory_unit || '').trim();
if (
String(row.settlement_mode || '') === 'count' ||
String(row.settlement_mode || '') !== 'weight' ||
!inventoryUnit ||
!isPickingWeightUnit(inventoryUnit) ||
isPickingWeightUnit(row.unit) ||