From 1dd8b9fcfa3eff52843ceeb2e01d6f430a8f5885 Mon Sep 17 00:00:00 2001 From: 云 <2163098428@qq.com> Date: 星期五, 03 七月 2026 13:13:10 +0800 Subject: [PATCH] 1.编码生成规则 --- sql/mysql/mes_auto_code_rule_init.sql | 523 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .claude/rules/sql-script.md | 6 2 files changed, 529 insertions(+), 0 deletions(-) diff --git a/.claude/rules/sql-script.md b/.claude/rules/sql-script.md new file mode 100644 index 0000000..19b1ccb --- /dev/null +++ b/.claude/rules/sql-script.md @@ -0,0 +1,6 @@ +# SQL 鑴氭湰瑙勮寖 + +## 瑙勫垯 + +- SQL 鑴氭湰涓笉瑕佸寘鍚� tenant_id 瀛楁锛岄」鐩笉浣跨敤澶氱鎴锋ā寮忋�� +- INSERT 璇彞鍙寘鍚繀瑕佺殑涓氬姟瀛楁锛屼笉闇�瑕� tenant_id銆� \ No newline at end of file diff --git a/sql/mysql/mes_auto_code_rule_init.sql b/sql/mysql/mes_auto_code_rule_init.sql new file mode 100644 index 0000000..0fe4242 --- /dev/null +++ b/sql/mysql/mes_auto_code_rule_init.sql @@ -0,0 +1,523 @@ +-- ============================================= +-- MES 缂栫爜瑙勫垯鍒濆鍖栬剼鏈� +-- 鎵ц鍓嶈纭繚 mes_md_auto_code_rule 鍜� mes_md_auto_code_part 琛ㄥ凡瀛樺湪 +-- ============================================= + +-- 娓呯┖鐜版湁鏁版嵁锛堥噸鏂板垵濮嬪寲鏃舵墽琛岋級 +DELETE FROM mes_md_auto_code_part; +DELETE FROM mes_md_auto_code_rule; + +-- ============================================= +-- 1. 鍩虹涓绘暟鎹紪鐮佽鍒� +-- ============================================= + +-- 1.1 鐗╂枡鍒嗙被缂栫爜瑙勫垯 (MD_ITEM_TYPE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (1, 'MD_ITEM_TYPE_CODE', '鐗╂枡鍒嗙被缂栫爜', '鐢ㄤ簬鐢熸垚鐗╂枡鍒嗙被缂栫爜', 10, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (1, 1, 3, 3, 'ITC', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (1, 2, 4, 4, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.2 鐗╂枡缂栫爜瑙勫垯 (MD_ITEM_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (2, 'MD_ITEM_CODE', '鐗╂枡缂栫爜', '鐢ㄤ簬鐢熸垚鐗╂枡缂栫爜', 20, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (2, 1, 3, 5, 'ITEM_', NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (2, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (2, 3, 4, 4, NULL, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.3 渚涘簲鍟嗙紪鐮佽鍒� (MD_VENDOR_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (3, 'MD_VENDOR_CODE', '渚涘簲鍟嗙紪鐮�', '鐢ㄤ簬鐢熸垚渚涘簲鍟嗙紪鐮�', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (3, 1, 3, 3, 'VDR', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (3, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.4 瀹㈡埛缂栫爜瑙勫垯 (MD_CLIENT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (4, 'MD_CLIENT_CODE', '瀹㈡埛缂栫爜', '鐢ㄤ簬鐢熸垚瀹㈡埛缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (4, 1, 3, 3, 'CLT', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (4, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.5 宸ヤ綔绔欑紪鐮佽鍒� (MD_WORKSTATION_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (5, 'MD_WORKSTATION_CODE', '宸ヤ綔绔欑紪鐮�', '鐢ㄤ簬鐢熸垚宸ヤ綔绔欑紪鐮�', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (5, 1, 3, 3, 'WKS', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (5, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.6 杞﹂棿缂栫爜瑙勫垯 (MD_WORKSHOP_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (6, 'MD_WORKSHOP_CODE', '杞﹂棿缂栫爜', '鐢ㄤ簬鐢熸垚杞﹂棿缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (6, 1, 3, 3, 'WSP', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (6, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 1.7 宸ュ叿绫诲瀷缂栫爜瑙勫垯 (TM_TOOL_TYPE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (7, 'TM_TOOL_TYPE_CODE', '宸ュ叿绫诲瀷缂栫爜', '鐢ㄤ簬鐢熸垚宸ュ叿绫诲瀷缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (7, 1, 3, 3, 'TTL', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (7, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- ============================================= +-- 2. 浠撳簱绠$悊缂栫爜瑙勫垯 +-- ============================================= + +-- 2.1 浠撳簱缂栫爜 (WM_WAREHOUSE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (8, 'WM_WAREHOUSE_CODE', '浠撳簱缂栫爜', '鐢ㄤ簬鐢熸垚浠撳簱缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (8, 1, 3, 3, 'WHS', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (8, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 2.2 搴撳尯缂栫爜 (WM_LOCATION_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (9, 'WM_LOCATION_CODE', '搴撳尯缂栫爜', '鐢ㄤ簬鐢熸垚搴撳尯缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (9, 1, 3, 3, 'LOC', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (9, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 2.3 搴撲綅缂栫爜 (WM_AREA_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (10, 'WM_AREA_CODE', '搴撲綅缂栫爜', '鐢ㄤ簬鐢熸垚搴撲綅缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (10, 1, 3, 3, 'ARA', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (10, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 2.4 鎵规缂栫爜 (WM_BATCH_CODE) - 鎸夊ぉ寰幆 +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (11, 'WM_BATCH_CODE', '鎵规缂栫爜', '鐢ㄤ簬鐢熸垚鎵规缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (11, 1, 3, 1, 'B', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (11, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (11, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.5 SN鐮� (WM_SN_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (12, 'WM_SN_CODE', 'SN鐮�', '鐢ㄤ簬鐢熸垚SN鐮�', 20, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (12, 1, 3, 3, 'SN_', NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (12, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (12, 3, 4, 6, NULL, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 2.6 瑁呯鍗曠紪鐮� (WM_PACKAGE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (13, 'WM_PACKAGE_CODE', '瑁呯鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚瑁呯鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, remark, creator, create_time, updater, update_time, deleted) +VALUES (13, 1, 3, 4, 'PKG_', NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, remark, creator, create_time, updater, update_time, deleted) +VALUES (13, 2, 2, 8, NULL, 'yyyyMMdd', '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +-- 2.7 鍒拌揣閫氱煡鍗曠紪鐮� (WM_ARRIVAL_NOTICE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (14, 'WM_ARRIVAL_NOTICE_CODE', '鍒拌揣閫氱煡鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚鍒拌揣閫氱煡鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (14, 1, 3, 3, 'AN_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (14, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (14, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.8 閲囪喘鍏ュ簱鍗曠紪鐮� (WM_ITEM_RECEIPT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (15, 'WM_ITEM_RECEIPT_CODE', '閲囪喘鍏ュ簱鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚閲囪喘鍏ュ簱鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (15, 1, 3, 3, 'IR_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (15, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (15, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.9 閲囪喘閫�璐у崟缂栫爜 (WM_RETURN_VENDOR_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (16, 'WM_RETURN_VENDOR_CODE', '閲囪喘閫�璐у崟缂栫爜', '鐢ㄤ簬鐢熸垚閲囪喘閫�璐у崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (16, 1, 3, 3, 'RV_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (16, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (16, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.10 鐢熶骇閫�鏂欏崟缂栫爜 (WM_RETURN_ISSUE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (17, 'WM_RETURN_ISSUE_CODE', '鐢熶骇閫�鏂欏崟缂栫爜', '鐢ㄤ簬鐢熸垚鐢熶骇閫�鏂欏崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (17, 1, 3, 3, 'RI_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (17, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (17, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.11 閿�鍞嚭搴撳崟缂栫爜 (WM_PRODUCT_SALES_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (18, 'WM_PRODUCT_SALES_CODE', '閿�鍞嚭搴撳崟缂栫爜', '鐢ㄤ簬鐢熸垚閿�鍞嚭搴撳崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (18, 1, 3, 3, 'SO_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (18, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (18, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.12 鍙戣揣閫氱煡鍗曠紪鐮� (WM_SALES_NOTICE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (19, 'WM_SALES_NOTICE_CODE', '鍙戣揣閫氱煡鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚鍙戣揣閫氱煡鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (19, 1, 3, 3, 'SN_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (19, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (19, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.13 閿�鍞��璐у崟缂栫爜 (WM_RETURN_SALES_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (20, 'WM_RETURN_SALES_CODE', '閿�鍞��璐у崟缂栫爜', '鐢ㄤ簬鐢熸垚閿�鍞��璐у崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (20, 1, 3, 3, 'RS_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (20, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (20, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.14 鏉傞」鍏ュ簱鍗曠紪鐮� (WM_MISC_RECEIPT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (21, 'WM_MISC_RECEIPT_CODE', '鏉傞」鍏ュ簱鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚鏉傞」鍏ュ簱鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (21, 1, 3, 3, 'MR_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (21, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (21, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.15 鏉傞」鍑哄簱鍗曠紪鐮� (WM_MISC_ISSUE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (22, 'WM_MISC_ISSUE_CODE', '鏉傞」鍑哄簱鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚鏉傞」鍑哄簱鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (22, 1, 3, 3, 'MI_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (22, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (22, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.16 鐩樼偣鏂规缂栫爜 (WM_STOCK_TAKING_PLAN_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (23, 'WM_STOCK_TAKING_PLAN_CODE', '鐩樼偣鏂规缂栫爜', '鐢ㄤ簬鐢熸垚鐩樼偣鏂规缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (23, 1, 3, 3, 'SP_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (23, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (23, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.17 鐩樼偣浠诲姟缂栫爜 (WM_STOCK_TAKING_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (24, 'WM_STOCK_TAKING_CODE', '鐩樼偣浠诲姟缂栫爜', '鐢ㄤ簬鐢熸垚鐩樼偣浠诲姟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (24, 1, 3, 3, 'ST_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (24, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (24, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.18 杞Щ璋冩嫧鍗曠紪鐮� (TRANSFER_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (25, 'TRANSFER_CODE', '杞Щ璋冩嫧鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚杞Щ璋冩嫧鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (25, 1, 3, 3, 'TR_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (25, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (25, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.19 澶栧崗鍙戞枡鍗曠紪鐮� (WM_OUTSOURCE_ISSUE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (26, 'WM_OUTSOURCE_ISSUE_CODE', '澶栧崗鍙戞枡鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚澶栧崗鍙戞枡鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (26, 1, 3, 3, 'OI_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (26, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (26, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 2.20 澶栧崗鍏ュ簱鍗曠紪鐮� (WM_OUTSOURCE_RECEIPT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (27, 'WM_OUTSOURCE_RECEIPT_CODE', '澶栧崗鍏ュ簱鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚澶栧崗鍏ュ簱鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (27, 1, 3, 3, 'OR_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (27, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (27, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- ============================================= +-- 3. 鐢熶骇绠$悊缂栫爜瑙勫垯 +-- ============================================= + +-- 3.1 鐢熶骇宸ュ崟缂栫爜 (PRO_WORK_ORDER_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (28, 'PRO_WORK_ORDER_CODE', '鐢熶骇宸ュ崟缂栫爜', '鐢ㄤ簬鐢熸垚鐢熶骇宸ュ崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (28, 1, 3, 3, 'WO_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (28, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (28, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 3.2 鐢熶骇浠诲姟缂栫爜 (PRO_TASK_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (29, 'PRO_TASK_CODE', '鐢熶骇浠诲姟缂栫爜', '鐢ㄤ簬鐢熸垚鐢熶骇浠诲姟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (29, 1, 3, 3, 'TK_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (29, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (29, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 3.3 鐢熶骇鎶ュ伐鍗曠紪鐮� (PRO_FEEDBACK_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (30, 'PRO_FEEDBACK_CODE', '鐢熶骇鎶ュ伐鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚鐢熶骇鎶ュ伐鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (30, 1, 3, 3, 'FB_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (30, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (30, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 3.4 宸ヨ壓璺嚎缂栫爜 (PRO_ROUTE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (31, 'PRO_ROUTE_CODE', '宸ヨ壓璺嚎缂栫爜', '鐢ㄤ簬鐢熸垚宸ヨ壓璺嚎缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (31, 1, 3, 3, 'RT_', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (31, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- ============================================= +-- 4. 璐ㄩ噺绠$悊缂栫爜瑙勫垯 +-- ============================================= + +-- 4.1 鏉ユ枡妫�楠屽崟缂栫爜 (QC_IQC_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (32, 'QC_IQC_CODE', '鏉ユ枡妫�楠屽崟缂栫爜', '鐢ㄤ簬鐢熸垚鏉ユ枡妫�楠屽崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (32, 1, 3, 4, 'IQC_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (32, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (32, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 4.2 杩囩▼妫�楠屽崟缂栫爜 (QC_IPQC_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (33, 'QC_IPQC_CODE', '杩囩▼妫�楠屽崟缂栫爜', '鐢ㄤ簬鐢熸垚杩囩▼妫�楠屽崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (33, 1, 3, 5, 'IPQC_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (33, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (33, 3, 4, 3, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 4.3 鍑鸿揣妫�楠屽崟缂栫爜 (QC_OQC_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (34, 'QC_OQC_CODE', '鍑鸿揣妫�楠屽崟缂栫爜', '鐢ㄤ簬鐢熸垚鍑鸿揣妫�楠屽崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (34, 1, 3, 5, 'OQC_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (34, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (34, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 4.4 閫�璐ф楠屽崟缂栫爜 (QC_RQC_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (35, 'QC_RQC_CODE', '閫�璐ф楠屽崟缂栫爜', '鐢ㄤ簬鐢熸垚閫�璐ф楠屽崟缂栫爜', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (35, 1, 3, 4, 'RQC_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (35, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (35, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- 4.5 缂洪櫡绫诲瀷缂栫爜 (QC_DEFECT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (36, 'QC_DEFECT_CODE', '缂洪櫡绫诲瀷缂栫爜', '鐢ㄤ簬鐢熸垚缂洪櫡绫诲瀷缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (36, 1, 3, 3, 'DFC', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (36, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 4.6 鏍峰搧妫�楠岀粨鏋滅紪鐮� (QC_INDICATOR_RESULT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (37, 'QC_INDICATOR_RESULT_CODE', '鏍峰搧妫�楠岀粨鏋滅紪鐮�', '鐢ㄤ簬鐢熸垚鏍峰搧妫�楠岀粨鏋滅紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (37, 1, 3, 4, 'QIR_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (37, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (37, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- ============================================= +-- 5. 璁惧绠$悊缂栫爜瑙勫垯 +-- ============================================= + +-- 5.1 璁惧缂栫爜 (DV_MACHINERY_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (38, 'DV_MACHINERY_CODE', '璁惧缂栫爜', '鐢ㄤ簬鐢熸垚璁惧缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (38, 1, 3, 3, 'MC_', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (38, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 5.2 璁惧绫诲瀷缂栫爜 (DV_MACHINERY_TYPE_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (39, 'DV_MACHINERY_TYPE_CODE', '璁惧绫诲瀷缂栫爜', '鐢ㄤ簬鐢熸垚璁惧绫诲瀷缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (39, 1, 3, 3, 'MCT', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (39, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 5.3 鐐规淇濆吇椤圭洰缂栫爜 (DV_SUBJECT_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (40, 'DV_SUBJECT_CODE', '鐐规淇濆吇椤圭洰缂栫爜', '鐢ㄤ簬鐢熸垚鐐规淇濆吇椤圭洰缂栫爜', 12, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (40, 1, 3, 3, 'SBJ', NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, serial_start_no, serial_step, cycle_flag, remark, creator, create_time, updater, update_time, deleted) +VALUES (40, 2, 4, 6, NULL, 1, 1, b'0', '娴佹按鍙�', '1', NOW(), '1', NOW(), b'0'); + +-- 5.4 缁翠慨鍗曠紪鐮� (DV_REPAIR_CODE) +INSERT INTO mes_md_auto_code_rule (id, code, name, description, max_length, padded, status, creator, create_time, updater, update_time, deleted) +VALUES (41, 'DV_REPAIR_CODE', '缁翠慨鍗曠紪鐮�', '鐢ㄤ簬鐢熸垚缁翠慨鍗曠紪鐮�', 16, b'0', 0, '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (41, 1, 3, 3, 'RP_', NULL, NULL, NULL, NULL, NULL, '鍥哄畾鍓嶇紑', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (41, 2, 2, 8, NULL, 'yyyyMMdd', NULL, NULL, NULL, NULL, '鏃ユ湡', '1', NOW(), '1', NOW(), b'0'); + +INSERT INTO mes_md_auto_code_part (rule_id, sort, type, length, fix_character, date_format, serial_start_no, serial_step, cycle_flag, cycle_method, remark, creator, create_time, updater, update_time, deleted) +VALUES (41, 3, 4, 4, NULL, NULL, 1, 1, b'1', 3, '娴佹按鍙�-鎸夊ぉ寰幆', '1', NOW(), '1', NOW(), b'0'); + +-- ============================================= +-- 鎵ц瀹屾垚鎻愮ず +-- ============================================= +SELECT 'MES 缂栫爜瑙勫垯鍒濆鍖栧畬鎴愶紒' AS result; +SELECT COUNT(*) AS rule_count FROM mes_md_auto_code_rule WHERE deleted = 0; +SELECT COUNT(*) AS part_count FROM mes_md_auto_code_part WHERE deleted = 0; \ No newline at end of file -- Gitblit v1.9.3