fix: 增加ERP质检版本事件幂等

This commit is contained in:
zhouz
2026-09-04 08:57:04 +08:00
parent 3667b749f7
commit 3c85d301d9
18 changed files with 157 additions and 24 deletions

View File

@@ -285,6 +285,23 @@ PREPARE lms_erp_ddl_stmt FROM @lms_erp_ddl;
EXECUTE lms_erp_ddl_stmt;
DEALLOCATE PREPARE lms_erp_ddl_stmt;
-- 分切子卷保存 ERP 质检事件版本,用于远端任务重试幂等。
SET @lms_erp_ddl = IF(
NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE()
AND table_name = 'lms_slittingproductionplan'),
'SELECT 1',
IF(NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
AND table_name = 'lms_slittingproductionplan' AND column_name = 'erp_quality_version'),
'ALTER TABLE lms_slittingproductionplan ADD COLUMN erp_quality_version int NOT NULL DEFAULT 0 COMMENT ''ERP质检结果变更版本''',
IF(EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE()
AND table_name = 'lms_slittingproductionplan' AND column_name = 'erp_quality_version'
AND LOWER(column_type) = 'int' AND is_nullable = 'NO' AND column_default = '0'),
'SELECT 1',
'ALTER TABLE lms_slittingproductionplan MODIFY COLUMN erp_quality_version int NOT NULL DEFAULT 0 COMMENT ''ERP质检结果变更版本''')));
PREPARE lms_erp_ddl_stmt FROM @lms_erp_ddl;
EXECUTE lms_erp_ddl_stmt;
DEALLOCATE PREPARE lms_erp_ddl_stmt;
-- 母卷号作为 ERP 首次推送的并发幂等键。
SET @lms_erp_ddl = IF(
NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE()