Files
baiyue-firstleg/firstleg/src/main/resources/db/phase3-inbounded-status-unification.sql
T

22 lines
979 B
SQL
Raw Normal View History

2026-08-13 09:49:55 +08:00
-- 新完成入库记录使用 WAIT_SPLIT,存量 INBOUNDED 继续作为可分柜兼容状态。
2026-08-09 20:35:11 +08:00
-- 本脚本不改写业务主表或历史状态,避免影响既有审计记录。
2026-08-07 19:40:42 +08:00
USE baiyue_firstleg;
2026-08-09 20:35:11 +08:00
DROP PROCEDURE IF EXISTS assert_inbounded_compatibility;
2026-08-08 12:01:45 +08:00
DELIMITER $$
2026-08-09 20:35:11 +08:00
CREATE PROCEDURE assert_inbounded_compatibility()
2026-08-08 12:01:45 +08:00
BEGIN
IF (SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = 'baiyue_firstleg' AND table_name = 'fl_inbound_order'
AND column_name = 'process_status') <> 1
OR (SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = 'baiyue_firstleg' AND table_name = 'fl_inbound_status_history'
AND column_name IN ('from_status', 'to_status')) <> 2 THEN
SIGNAL SQLSTATE '45000'
2026-08-13 09:49:55 +08:00
SET MESSAGE_TEXT = 'WAIT_SPLIT/INBOUNDED 兼容校验失败:入库状态字段不完整';
2026-08-08 12:01:45 +08:00
END IF;
END$$
DELIMITER ;
2026-08-09 20:35:11 +08:00
CALL assert_inbounded_compatibility();
DROP PROCEDURE assert_inbounded_compatibility;