-- 批次码状态增加「待装中」:新建=待装中,生产入库后=仓库中 -- 3待装中 -> 0仓库中 -> 1合格 -> 2已发货 ALTER TABLE `mes_batch_sn` MODIFY COLUMN `batch_status` char(1) DEFAULT '3' COMMENT '状态:3待装中 0仓库中 1合格 2已发货'; -- 未生产入库、仍为仓库中(0) 的历史数据改为待装中 UPDATE `mes_batch_sn` SET `batch_status` = '3' WHERE (`batch_status` = '0' OR `batch_status` IS NULL OR `batch_status` = '') AND (`instock_status` IS NULL OR `instock_status` = '' OR `instock_status` = '0'); -- 已生产入库但仍为空的,补为仓库中 UPDATE `mes_batch_sn` SET `batch_status` = '0' WHERE (`batch_status` IS NULL OR `batch_status` = '') AND `instock_status` = '1'; UPDATE `js_sys_dict_type` SET `remarks` = '3待装中 0仓库中 1合格 2已发货' WHERE `dict_type` = 'mes_batch_sn_status'; -- 字典项:3 待装中(排在最前) INSERT INTO `js_sys_dict_data` ( `dict_code`, `parent_code`, `parent_codes`, `tree_sort`, `tree_sorts`, `tree_leaf`, `tree_level`, `tree_names`, `dict_label`, `dict_value`, `dict_icon`, `dict_type`, `is_sys`, `description`, `css_style`, `css_class`, `status`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `corp_code`, `corp_name` ) SELECT '1999000000000000113', '0', '0,', 20, '0000000020,', '1', 0, '待装中', '待装中', '3', '', 'mes_batch_sn_status', '1', '新建批次码,尚未生产入库', '', 'tag gray', '0', 'system', NOW(), 'system', NOW(), '', '0', 'JeeSite' FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM `js_sys_dict_data` WHERE `dict_type` = 'mes_batch_sn_status' AND `dict_value` = '3' ); -- 0 仓库中:改为生产入库后,不再表示新建 UPDATE `js_sys_dict_data` SET `description` = '生产入库后', `remarks` = '生产入库后' WHERE `dict_type` = 'mes_batch_sn_status' AND `dict_value` = '0';