feat: 增加管芯托盘绑定基础能力(任务1-2)

This commit is contained in:
zhouz
2026-08-17 10:34:42 +08:00
parent 9fa231693c
commit 0331aca1a9
21 changed files with 941 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_strategy` (
`strategy_type` tinyint NOT NULL COMMENT '策略类型1备货2套管',
`strategy_mode` tinyint NOT NULL DEFAULT 1 COMMENT '策略模式1顺序2权重',
`cursor_daily_plan_id` bigint DEFAULT NULL COMMENT '当前游标日计划ID',
`cursor_executed_qty` int NOT NULL DEFAULT 0 COMMENT '当前权重轮转已执行数量',
`version` int NOT NULL DEFAULT 0 COMMENT '乐观锁版本号',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -59,6 +60,16 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_strategy` (
UNIQUE KEY `uk_strategy_type_tenant` (`strategy_type`, `tenant_id`)
) COMMENT='LMS日计划调度策略';
-- 兼容已执行过旧版脚本的数据库,幂等补充逐根权重轮转计数。
SET @lms_daily_plan_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
AND table_name = 'lms_daily_plan_strategy' AND column_name = 'cursor_executed_qty'),
'SELECT 1',
'ALTER TABLE lms_daily_plan_strategy ADD COLUMN cursor_executed_qty INT NOT NULL DEFAULT 0 COMMENT ''当前权重轮转已执行数量'' AFTER cursor_daily_plan_id');
PREPARE lms_daily_plan_stmt FROM @lms_daily_plan_ddl;
EXECUTE lms_daily_plan_stmt;
DEALLOCATE PREPARE lms_daily_plan_stmt;
CREATE TABLE IF NOT EXISTS `lms_daily_plan_claim` (
`claim_id` bigint NOT NULL COMMENT '领取ID',
`claim_token` varchar(64) NOT NULL COMMENT '对外领取标识',