fix(分拣): 停止自动修改本地计划并通知主系统
分拣只写本地实收 stage30;主系统追加修改等订单完结后人工发起。
This commit is contained in:
@@ -1841,37 +1841,12 @@ export async function confirmPickingComplete(input: {
|
||||
// ⚠️ 必须在主系统 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 || '') !== 'weight' ||
|
||||
!inventoryUnit ||
|
||||
!isPickingWeightUnit(inventoryUnit) ||
|
||||
isPickingWeightUnit(row.unit) ||
|
||||
!Number(row.picked_weight || 0) ||
|
||||
!row.order_item_id
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const { changeOrderItemPlan } = await import('./mainSystemPlanChangeService');
|
||||
await changeOrderItemPlan({
|
||||
orderCode: String(row.order_code || task.order_code || ''),
|
||||
itemId: String(row.order_item_id),
|
||||
afterQty: Number(row.picked_weight),
|
||||
afterUnit: inventoryUnit,
|
||||
actualReceivedQty: Number(row.picked_weight),
|
||||
reason: '分拣称重后按实际重量',
|
||||
requestId: `pick_${pickCode}_${row.id}_${String(Number(row.picked_weight) || 0).replace('.', '_')}`,
|
||||
operatorId: input.reviewerId || null,
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn('[picking] 分拣后修改本地计划失败(不阻断分拣)', pickCode, (error as Error)?.message || error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 2026-11-03 口径调整:分拣称重只写本地 received_qty/unit(stage=30),
|
||||
* 不自动改本地计划数量/单位,也不自动给主系统发计划变更。
|
||||
* 供应商订单完结后由人工确认,再走主系统「供应商追加修改价格」申请。
|
||||
* 订单完结时 freezeOrderSettlementQtyOnComplete 用 received 覆盖 quantity/unit。
|
||||
*/
|
||||
// 分拣完成即补上游/推进待配送(出库与装车核货合并,见 20260821-merge-outbound-with-loading)
|
||||
for (const orderCode of relatedOrderCodes) {
|
||||
await autoInboundFromPickingBeforeComplete({
|
||||
|
||||
Reference in New Issue
Block a user