add_mes_batch_sn_status_packing.sql 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. -- 批次码状态增加「待装中」:新建=待装中,生产入库后=仓库中
  2. -- 3待装中 -> 0仓库中 -> 1合格 -> 2已发货
  3. ALTER TABLE `mes_batch_sn`
  4. MODIFY COLUMN `batch_status` char(1) DEFAULT '3' COMMENT '状态:3待装中 0仓库中 1合格 2已发货';
  5. -- 未生产入库、仍为仓库中(0) 的历史数据改为待装中
  6. UPDATE `mes_batch_sn`
  7. SET `batch_status` = '3'
  8. WHERE (`batch_status` = '0' OR `batch_status` IS NULL OR `batch_status` = '')
  9. AND (`instock_status` IS NULL OR `instock_status` = '' OR `instock_status` = '0');
  10. -- 已生产入库但仍为空的,补为仓库中
  11. UPDATE `mes_batch_sn`
  12. SET `batch_status` = '0'
  13. WHERE (`batch_status` IS NULL OR `batch_status` = '')
  14. AND `instock_status` = '1';
  15. UPDATE `js_sys_dict_type`
  16. SET `remarks` = '3待装中 0仓库中 1合格 2已发货'
  17. WHERE `dict_type` = 'mes_batch_sn_status';
  18. -- 字典项:3 待装中(排在最前)
  19. INSERT INTO `js_sys_dict_data` (
  20. `dict_code`, `parent_code`, `parent_codes`, `tree_sort`, `tree_sorts`,
  21. `tree_leaf`, `tree_level`, `tree_names`, `dict_label`, `dict_value`,
  22. `dict_icon`, `dict_type`, `is_sys`, `description`, `css_style`, `css_class`,
  23. `status`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`,
  24. `corp_code`, `corp_name`
  25. )
  26. SELECT
  27. '1999000000000000113', '0', '0,', 20, '0000000020,',
  28. '1', 0, '待装中', '待装中', '3',
  29. '', 'mes_batch_sn_status', '1', '新建批次码,尚未生产入库', '', 'tag gray',
  30. '0', 'system', NOW(), 'system', NOW(), '',
  31. '0', 'JeeSite'
  32. FROM DUAL
  33. WHERE NOT EXISTS (
  34. SELECT 1 FROM `js_sys_dict_data` WHERE `dict_type` = 'mes_batch_sn_status' AND `dict_value` = '3'
  35. );
  36. -- 0 仓库中:改为生产入库后,不再表示新建
  37. UPDATE `js_sys_dict_data`
  38. SET `description` = '生产入库后',
  39. `remarks` = '生产入库后'
  40. WHERE `dict_type` = 'mes_batch_sn_status' AND `dict_value` = '0';