fix: 收敛LMS日计划初始化基线
This commit is contained in:
@@ -41,37 +41,6 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan` (
|
||||
UNIQUE KEY `uk_erp_order_code_tenant` (`erp_order_code`, `tenant_id`)
|
||||
) COMMENT='LMS日计划';
|
||||
|
||||
-- 兼容已经执行过旧版脚本的环境,幂等迁移字段规格和完成时间字段名称。
|
||||
SET @rename_stocking_complete_time = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'lms_daily_plan' AND column_name = 'stocking_end_time'),
|
||||
'ALTER TABLE lms_daily_plan CHANGE COLUMN stocking_end_time stocking_complete_time datetime DEFAULT NULL COMMENT ''备货完成时间''',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE rename_stocking_complete_time_stmt FROM @rename_stocking_complete_time;
|
||||
EXECUTE rename_stocking_complete_time_stmt;
|
||||
DEALLOCATE PREPARE rename_stocking_complete_time_stmt;
|
||||
|
||||
SET @rename_sleeving_complete_time = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'lms_daily_plan' AND column_name = 'sleeving_end_time'),
|
||||
'ALTER TABLE lms_daily_plan CHANGE COLUMN sleeving_end_time sleeving_complete_time datetime DEFAULT NULL COMMENT ''套管完成时间''',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE rename_sleeving_complete_time_stmt FROM @rename_sleeving_complete_time;
|
||||
EXECUTE rename_sleeving_complete_time_stmt;
|
||||
DEALLOCATE PREPARE rename_sleeving_complete_time_stmt;
|
||||
|
||||
ALTER TABLE lms_daily_plan
|
||||
MODIFY COLUMN material_spec varchar(128) DEFAULT NULL COMMENT '物料规格',
|
||||
MODIFY COLUMN plan_qty int NOT NULL DEFAULT 0 COMMENT '计划数量',
|
||||
MODIFY COLUMN append_qty int NOT NULL DEFAULT 0 COMMENT '追加数量',
|
||||
MODIFY COLUMN stocked_qty int NOT NULL DEFAULT 0 COMMENT '已备货数量',
|
||||
MODIFY COLUMN sleeved_qty int NOT NULL DEFAULT 0 COMMENT '已套管数量',
|
||||
MODIFY COLUMN packing_info text COMMENT '包装信息',
|
||||
MODIFY COLUMN sort_seq int NOT NULL COMMENT '排序序号',
|
||||
MODIFY COLUMN weight int NOT NULL DEFAULT 1 COMMENT '调度权重',
|
||||
MODIFY COLUMN stocking_status tinyint NOT NULL DEFAULT 0 COMMENT '备货状态:0未开始,1进行中,2已完成,3已取消',
|
||||
MODIFY COLUMN sleeving_status tinyint NOT NULL DEFAULT 0 COMMENT '套管状态:0未开始,1进行中,2已完成,3已取消';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `lms_daily_plan_strategy` (
|
||||
`strategy_id` bigint NOT NULL COMMENT '策略ID',
|
||||
`strategy_type` tinyint NOT NULL COMMENT '策略类型:1备货,2套管',
|
||||
@@ -104,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `lms_daily_plan_operation_log` (
|
||||
PRIMARY KEY (`operation_log_id`)
|
||||
) COMMENT='LMS日计划操作日志';
|
||||
|
||||
-- 编码格式:DP + yyyyMMdd + 4位日流水。
|
||||
-- 2093号段用于 LMS 日计划固定基础数据;编码格式:DP + yyyyMMdd + 4位日流水。
|
||||
INSERT INTO base_code_rule
|
||||
(id, rule_name, rule_code, segment_config, code_separator, letter_case, total_length,
|
||||
seq_strategy, status, remark, creator, create_time, updater, update_time, deleted)
|
||||
@@ -160,7 +129,7 @@ WHERE NOT EXISTS (SELECT 1 FROM system_dict_data WHERE dict_type='lms_daily_plan
|
||||
-- 为全部有效租户分别初始化备货、套管顺序策略。
|
||||
INSERT INTO lms_daily_plan_strategy
|
||||
(strategy_id, strategy_type, strategy_mode, cursor_daily_plan_id, version, creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
SELECT 2093100000000000000 + tenant.id * 10 + strategy.strategy_type,
|
||||
SELECT UUID_SHORT(),
|
||||
strategy.strategy_type, 1, NULL, 0, '1', NOW(), '1', NOW(), b'0', tenant.id
|
||||
FROM system_tenant tenant
|
||||
CROSS JOIN (SELECT 1 strategy_type UNION ALL SELECT 2) strategy
|
||||
|
||||
Reference in New Issue
Block a user