优化
This commit is contained in:
@@ -12,7 +12,7 @@ BEGIN
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
CALL phase2_carton_label_add_column('label_version', 'INT UNSIGNED NOT NULL DEFAULT 1 COMMENT ''箱唛批次版本,从1递增'' AFTER carton_index');
|
||||
CALL phase2_carton_label_add_column('label_version', 'INT UNSIGNED NOT NULL DEFAULT 1 COMMENT ''内部兼容批次字段,固定为1且不进入箱码'' AFTER carton_index');
|
||||
CALL phase2_carton_label_add_column('batch_status', 'VARCHAR(16) NOT NULL DEFAULT ''ACTIVE'' COMMENT ''批次状态:ACTIVE有效、VOID已作废'' AFTER label_version');
|
||||
CALL phase2_carton_label_add_column('cargo_fingerprint', 'CHAR(64) NULL COMMENT ''影响标签字段的SHA-256指纹'' AFTER batch_status');
|
||||
CALL phase2_carton_label_add_column('voided_at', 'DATETIME(3) NULL COMMENT ''批次作废时间'' AFTER cargo_fingerprint');
|
||||
@@ -23,9 +23,12 @@ UPDATE fl_inbound_carton_label
|
||||
batch_status = 'ACTIVE'
|
||||
WHERE label_version IS NULL OR batch_status IS NULL;
|
||||
|
||||
DELETE FROM fl_inbound_carton_label WHERE batch_status = 'VOID';
|
||||
|
||||
UPDATE fl_inbound_carton_label
|
||||
SET box_code = CONCAT(inbound_code, '#V', label_version, '#', total_carton_count, '-', carton_index)
|
||||
WHERE box_code NOT LIKE CONCAT(inbound_code, '#V%#%');
|
||||
SET label_version = 1,
|
||||
box_code = CONCAT(inbound_code, '#', total_carton_count, '-', carton_index)
|
||||
WHERE batch_status = 'ACTIVE';
|
||||
|
||||
SET @has_old_index := (SELECT COUNT(*) FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE() AND table_name = 'fl_inbound_carton_label'
|
||||
|
||||
Reference in New Issue
Block a user