feat(transfer): persist receipt resource intents in schema baseline

This commit is contained in:
2026-10-05 03:13:31 +08:00
parent 8e46ba6985
commit 3f8ac23aba
5 changed files with 98 additions and 7 deletions
@@ -2191,6 +2191,31 @@ CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_receipt (
KEY idx_ll_wh_transfer_receipt_list(customer_id,transfer_order_id,received_at)
) ENGINE=InnoDB COMMENT='转仓来源仓位的目标库存收货记录';
CREATE TABLE IF NOT EXISTS ll_warehouse_transfer_receipt_command (
id BIGINT NOT NULL COMMENT '收货命令主键',
customer_id VARCHAR(128) NOT NULL COMMENT '客户标识',
transfer_order_id BIGINT NOT NULL COMMENT '转运单标识',
source_inventory_position_id BIGINT NOT NULL COMMENT '本次收货来源库存位置',
idempotency_key VARCHAR(255) NOT NULL COMMENT '原始收货幂等键',
request_hash CHAR(64) NOT NULL COMMENT '完整原始收货请求摘要',
request_json JSON NOT NULL COMMENT '完整原始收货请求快照',
target_warehouse_id BIGINT NOT NULL COMMENT '实际目标海外收货仓',
target_pallet_id BIGINT NOT NULL COMMENT '目标实物托盘',
target_location_id BIGINT NOT NULL COMMENT '目标实际库位',
target_hash CHAR(64) NOT NULL COMMENT '共享目标资源绑定摘要',
target_json JSON NOT NULL COMMENT '权威目标仓托盘库位及目的仓快照',
reservation_key VARCHAR(128) NOT NULL COMMENT '同转运同目标托盘共享资源占用键',
resource_lock_id BIGINT NULL COMMENT '已确认有效的海外资源锁标识',
status VARCHAR(32) NOT NULL COMMENT '命令状态PREPARED准备完成RESERVED资源占用COMPLETED收货完成',
created_at DATETIME(3) NOT NULL COMMENT '命令创建时间',
updated_at DATETIME(3) NOT NULL COMMENT '命令最后更新时间',
PRIMARY KEY (id),
UNIQUE KEY uk_ll_wh_receipt_cmd_source (transfer_order_id, source_inventory_position_id),
UNIQUE KEY uk_ll_wh_receipt_cmd_key (customer_id, idempotency_key),
KEY idx_ll_wh_receipt_cmd_target (customer_id, transfer_order_id, target_pallet_id),
CONSTRAINT ck_ll_wh_receipt_cmd_status CHECK (status IN ('PREPARED','RESERVED','COMPLETED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='转运逐来源收货原请求与共享目标资源占用命令';
-- Customer relabel application: header, item snapshots, and immutable process history.
CREATE TABLE IF NOT EXISTS ll_relabel_application (
id BIGINT NOT NULL COMMENT '主键ID',