Files
SupplierSystem/migrations/20261034_picking_items_outbound_batches.sql
雨天 9726d25178
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
feat(分拣): 分拣完成可选出库批次并按区域分组
- 分拣「完成」按先进先出预分配批次,可手改顺序/数量并持久化到
  picking_items.outbound_batches;发车核货按选择扣库,未选回退纯 FIFO
- 小程序与 Web 分拣明细新增批次摘要与调整弹层;小程序按商品区域分组
- 发车扣库写 operation_logs(操作人/分拣员/品名/批次入库日/数量)
- 新增迁移 20261034、只读批次接口 /picking/outbound-batches 与设计文档
2026-10-11 13:36:33 +08:00

32 lines
1.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 分拣「完成」时选定的出库批次计划(默认 FIFO;发车核货时按它扣库)
-- 设计:docs/design/20261031-分拣出库可选批次与区域分组.md
--
-- `picking_items.outbound_batches`:形如 [{"batch_no":"STK...","qty":12.5}];
-- NULL / [] = 未手选 ⇒ 发车按纯 FIFO 扣库(与改前逐字一致)。
-- 只加列,不改表名单(picking_items 已在 public.tenant_business_tables())。
DO $$
DECLARE
sch text;
BEGIN
FOR sch IN
SELECT nspname
FROM pg_namespace
WHERE nspname IN ('public', 'legacy_public', 'tenant_template')
OR nspname LIKE 'tenant_%'
LOOP
IF to_regclass(format('%I.picking_items', sch)) IS NULL THEN
CONTINUE;
END IF;
EXECUTE format(
'ALTER TABLE %I.picking_items ADD COLUMN IF NOT EXISTS outbound_batches jsonb',
sch
);
EXECUTE format(
'COMMENT ON COLUMN %I.picking_items.outbound_batches IS %L',
sch,
'分拣完成时选定的出库批次计划 [{"batch_no","qty"}];空=默认 FIFO'
);
END LOOP;
END $$;