fix(lastleg): complete stock transfer through linked relabel

This commit is contained in:
2026-10-04 20:21:16 +08:00
parent 7319fba35a
commit 76f02d8d45
17 changed files with 740 additions and 31 deletions
@@ -0,0 +1,14 @@
-- Region: OVERSEAS
-- Schema: baiyue_lastleg
-- Purpose: bind_stock_transfer_relabel_sources
-- Preconditions: existing transfer allocation/binding tables and original position unique index.
-- Postconditions: exact source SKU and relabel links; active ownership remains unique, history is retained.
-- No business-row backfill, relabel completion fabrication, or inventory mutation.
ALTER TABLE ll_warehouse_transfer_inventory_allocation
ADD COLUMN sku_code VARCHAR(128) NULL COMMENT '本次来源分配的实际SKU快照' AFTER package_count,
DROP INDEX uk_ll_wh_transfer_allocation_position,
ADD KEY idx_ll_wh_transfer_allocation_position (transfer_order_id, inventory_position_id);
ALTER TABLE ll_warehouse_transfer_relabel_binding
ADD COLUMN source_allocation_id BIGINT NULL COMMENT '已有库存转运的原始来源分配ID' AFTER remark,
ADD COLUMN relabel_item_id BIGINT NULL COMMENT '本票关联换标明细ID' AFTER source_allocation_id;