Files
baiyue-firstleg/warehouse/src/main/resources/db/phase3-pallet-location-release-idempotency.sql
T

20 lines
1.3 KiB
SQL
Raw Normal View History

2026-08-09 20:35:11 +08:00
-- PDA 已拣满库位/托盘精确释放的持久化幂等契约;可在二期库位表建表后重复执行。
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS wh_pallet_location_release_operation (
id BIGINT UNSIGNED NOT NULL COMMENT '精确释放幂等操作ID',
tenant_id BIGINT UNSIGNED NOT NULL COMMENT '仓储公共资源作用域,固定为0',
source_service VARCHAR(40) NOT NULL COMMENT '来源服务',
business_id BIGINT UNSIGNED NOT NULL COMMENT '入库单ID',
idempotency_key VARCHAR(128) NOT NULL COMMENT '调用方幂等键',
request_hash CHAR(64) NOT NULL COMMENT '规范化请求SHA-256摘要',
operation_status VARCHAR(20) NOT NULL DEFAULT 'PROCESSING' COMMENT 'PROCESSING处理中,COMPLETED已完成',
response_snapshot JSON NULL COMMENT '完成后的精确释放结果快照,用于重复请求重放',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
completed_at DATETIME(3) NULL COMMENT '完成时间',
PRIMARY KEY (id),
UNIQUE KEY uk_pallet_location_release_idempotency
(tenant_id, source_service, business_id, idempotency_key),
KEY idx_pallet_location_release_business (tenant_id, source_service, business_id, operation_status)
) ENGINE=InnoDB COMMENT='PDA已拣满托盘库位精确释放的持久化幂等操作记录';