This commit is contained in:
2026-09-24 08:54:26 +08:00
parent 66c2651be7
commit 49e63eca9f
10 changed files with 23 additions and 20 deletions
@@ -2917,7 +2917,6 @@ CREATE TABLE wh_location (
id bigint unsigned NOT NULL COMMENT '库位ID(雪花ID)',
customer_id bigint unsigned NOT NULL COMMENT '数据所属租户ID',
warehouse_id bigint unsigned NOT NULL COMMENT '所属仓库ID',
zone_code varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '仓库分区编码',
location_code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '仓库内唯一库位编码',
location_type varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '库位类型',
shared_overflow tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否系统共享溢出库位(A0)',
@@ -2932,9 +2931,15 @@ CREATE TABLE wh_location (
version int NOT NULL DEFAULT '0' COMMENT '乐观锁版本号',
PRIMARY KEY (id),
UNIQUE KEY uk_location_code (customer_id,warehouse_id,location_code,deleted),
KEY idx_location_query (customer_id,warehouse_id,zone_code,status,deleted)
KEY idx_location_query (customer_id,warehouse_id,status,deleted)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='仓库库位表:按租户和仓库维护库位及承重信息';
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='wh_location' AND index_name='idx_location_query'), 'ALTER TABLE wh_location DROP INDEX idx_location_query', 'SELECT 1'));
PREPARE location_zone_index_stmt FROM @ddl; EXECUTE location_zone_index_stmt; DEALLOCATE PREPARE location_zone_index_stmt;
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='wh_location' AND column_name='zone_code'), 'ALTER TABLE wh_location DROP COLUMN zone_code', 'SELECT 1'));
PREPARE location_zone_column_stmt FROM @ddl; EXECUTE location_zone_column_stmt; DEALLOCATE PREPARE location_zone_column_stmt;
CREATE TABLE wh_pallet (
id bigint unsigned NOT NULL COMMENT '托盘ID(雪花ID)',
customer_id bigint unsigned NOT NULL COMMENT '数据所属租户ID',