From 4ca4444ad33a2a1a51f5c06e78ee9365dfb1eed6 Mon Sep 17 00:00:00 2001 From: liu <2021943741@qq.com> Date: 星期四, 08 十月 2026 17:11:11 +0800 Subject: [PATCH] feat(mes): 种子二维码标签国标四要素合规改造 --- sql/mysql/sp_clean_business_data.sql | 435 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 435 insertions(+), 0 deletions(-) diff --git a/sql/mysql/sp_clean_business_data.sql b/sql/mysql/sp_clean_business_data.sql new file mode 100644 index 0000000..7fe5cc2 --- /dev/null +++ b/sql/mysql/sp_clean_business_data.sql @@ -0,0 +1,435 @@ +-- ============================================================ +-- 涓氬姟鏁版嵁娓呯悊瀛樺偍杩囩▼锛堢洰鏍囧簱锛歮om-thzy锛� +-- +-- 鐢ㄩ�旓細娓呯┖鍚勪笟鍔℃ā鍧楃殑娴佹按/浜嬪姟鏁版嵁锛屼繚鐣欑敤鎴枫�佽鑹层�佽彍鍗曘�� +-- 瀛楀吀銆佹祦绋嬪畾涔夈�佸熀纭�閰嶇疆涓庝富鏁版嵁妗f銆� +-- +-- 娉ㄦ剰锛� +-- 1. TRUNCATE 涓� DDL 闅愬紡鎻愪氦锛屾棤娉曞洖婊氾紝鎵ц鍓嶈鍏堝浠姐�� +-- 2. 鎵ц鏂瑰紡锛歮ysql -uroot -p mom-thzy < sp_clean_business_data.sql +-- 鎴栧湪瀹㈡埛绔腑鏁翠綋鎵ц鏈剼鏈紙鍚� DELIMITER锛夈�� +-- 3. 鎵ц娓呯悊锛欳ALL sp_clean_business_data(); +-- ============================================================ + +DROP PROCEDURE IF EXISTS `sp_clean_business_data`; + +DELIMITER $$ + +CREATE DEFINER=`root`@`%` PROCEDURE `sp_clean_business_data`() +BEGIN + SET FOREIGN_KEY_CHECKS = 0; + + -- ============================================================ + -- 1. 绯荤粺杩愯鏁版嵁锛堟棩蹇� / Token / 楠岃瘉鐮� / 绔欏唴淇� / 绀句氦缁戝畾锛� + -- ============================================================ + TRUNCATE TABLE system_login_log; + TRUNCATE TABLE system_operate_log; + TRUNCATE TABLE system_notify_message; + TRUNCATE TABLE system_oauth2_access_token; + TRUNCATE TABLE system_oauth2_refresh_token; + TRUNCATE TABLE system_oauth2_code; + TRUNCATE TABLE system_oauth2_approve; + TRUNCATE TABLE system_sms_code; + TRUNCATE TABLE system_sms_log; + TRUNCATE TABLE system_mail_log; + TRUNCATE TABLE system_social_user; + TRUNCATE TABLE system_social_user_bind; + TRUNCATE TABLE infra_api_access_log; + TRUNCATE TABLE infra_api_error_log; + TRUNCATE TABLE infra_job_log; + + -- 鍒犻櫎涓庢湰椤圭洰鏃犲叧鐨勬鏋惰嚜甯﹀畾鏃朵换鍔★紙pay/mall/iot/demo锛夛紝 + -- 淇濈暀鏃ュ織娓呯悊涓変欢濂楋細accessLogCleanJob / errorLogCleanJob / jobLogCleanJob + DELETE FROM infra_job + WHERE handler_name IN ( + 'payNotifyJob', 'payOrderSyncJob', 'payOrderExpireJob', + 'payRefundSyncJob', 'payTransferSyncJob', + 'tradeOrderAutoCancelJob', 'tradeOrderAutoReceiveJob', 'tradeOrderAutoCommentJob', + 'brokerageRecordUnfreezeJob', 'combinationRecordExpireJob', + 'couponExpireJob', 'productStatisticsJob', + 'iotDeviceOfflineCheckJob', 'iotOtaUpgradeJob', + 'demoJob' + ); + + -- Quartz 璋冨害杩愯鏃舵暟鎹紙qrtz_locks 淇濈暀閿佽锛屾竻绌轰細瀵艰嚧璋冨害鍣ㄥ姞閿佹姤閿欙級 + -- 娓呯悊鍚庡闇�鎭㈠淇濈暀浠诲姟鐨勮皟搴︽敞鍐岋紝鍦ㄣ�愬熀纭�璁炬柦-瀹氭椂浠诲姟銆戦〉闈㈢偣"鍚屾"鎴栬皟鐢� + -- POST /admin-api/infra/job/sync 浠� infra_job 閲嶅缓瑙﹀彂鍣� + TRUNCATE TABLE qrtz_blob_triggers; + TRUNCATE TABLE qrtz_calendars; + TRUNCATE TABLE qrtz_cron_triggers; + TRUNCATE TABLE qrtz_fired_triggers; + TRUNCATE TABLE qrtz_job_details; + TRUNCATE TABLE qrtz_paused_trigger_grps; + TRUNCATE TABLE qrtz_scheduler_state; + TRUNCATE TABLE qrtz_simple_triggers; + TRUNCATE TABLE qrtz_simprop_triggers; + TRUNCATE TABLE qrtz_triggers; + + -- ============================================================ + -- 2. 鏂囦欢涓庨檮浠� + -- ============================================================ + TRUNCATE TABLE system_storage_attachment; + TRUNCATE TABLE system_storage_blob; + TRUNCATE TABLE storage_attachment; + TRUNCATE TABLE storage_blob; + TRUNCATE TABLE infra_file; + TRUNCATE TABLE infra_file_content; + + -- ============================================================ + -- 3. BPM 娴佺▼瀹炰緥涓庡鎵瑰巻鍙� + -- 淇濈暀锛氭祦绋嬪畾涔�/琛ㄥ崟/鍒嗙被/琛ㄨ揪寮�/鐩戝惉鍣�/鐢ㄦ埛缁�/涓氬姟闄勪欢閰嶇疆 + -- 淇濈暀锛歛ct_re_* / act_ge_* / act_id_* / act_procdef_info锛堝畾涔変笌閮ㄧ讲璧勬簮锛� + -- ============================================================ + TRUNCATE TABLE bpm_oa_leave; + TRUNCATE TABLE bpm_process_instance_copy; + TRUNCATE TABLE act_hi_procinst; + TRUNCATE TABLE act_hi_taskinst; + TRUNCATE TABLE act_hi_actinst; + TRUNCATE TABLE act_hi_varinst; + TRUNCATE TABLE act_hi_identitylink; + TRUNCATE TABLE act_hi_comment; + TRUNCATE TABLE act_hi_detail; + TRUNCATE TABLE act_hi_attachment; + TRUNCATE TABLE act_hi_entitylink; + TRUNCATE TABLE act_hi_tsk_log; + TRUNCATE TABLE act_ru_task; + TRUNCATE TABLE act_ru_execution; + TRUNCATE TABLE act_ru_actinst; + TRUNCATE TABLE act_ru_variable; + TRUNCATE TABLE act_ru_identitylink; + TRUNCATE TABLE act_ru_job; + TRUNCATE TABLE act_ru_timer_job; + TRUNCATE TABLE act_ru_deadletter_job; + TRUNCATE TABLE act_ru_suspended_job; + TRUNCATE TABLE act_ru_external_job; + TRUNCATE TABLE act_ru_history_job; + TRUNCATE TABLE act_ru_event_subscr; + TRUNCATE TABLE act_ru_entitylink; + TRUNCATE TABLE act_evt_log; + -- Flowable 鎵规杩愯鏃讹紙multi-instance 鎵瑰鐞嗭紝鍘熻剼鏈仐婕忥級 + TRUNCATE TABLE flw_ru_batch; + TRUNCATE TABLE flw_ru_batch_part; + + -- ============================================================ + -- 4. MES 鐢熶骇妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歮es_pro_process / mes_pro_route*锛堝伐鑹轰笌璺嚎瀹氫箟锛� + -- ============================================================ + TRUNCATE TABLE mes_pro_work_order_param_record_detail; + TRUNCATE TABLE mes_pro_work_order_param_record; + TRUNCATE TABLE mes_pro_work_order_process; + TRUNCATE TABLE mes_pro_work_order_bom; + TRUNCATE TABLE mes_pro_work_order; + TRUNCATE TABLE mes_pro_task_issue; + TRUNCATE TABLE mes_pro_task; + TRUNCATE TABLE mes_pro_task_pause_record; -- 鐢熶骇浠诲姟鍋滃伐璁板綍锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_pro_feedback; + TRUNCATE TABLE mes_pro_mps_merge_item; + TRUNCATE TABLE mes_pro_mps; + TRUNCATE TABLE mes_pro_card_process; + TRUNCATE TABLE mes_pro_card; + TRUNCATE TABLE mes_pro_work_record_log; + TRUNCATE TABLE mes_pro_work_record; + TRUNCATE TABLE mes_pro_andon_record; + TRUNCATE TABLE mes_pro_scan_event; -- 琚嬬爜鎵爜鍏ュ簱浜嬩欢锛堝師鑴氭湰閬楁紡锛� + + -- ============================================================ + -- 5. MES 浠撳偍妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歮es_wm_warehouse / _area / _location / _barcode_config锛堜粨鍌ㄩ厤缃級 + -- ============================================================ + TRUNCATE TABLE mes_wm_transaction; + TRUNCATE TABLE mes_wm_stock_reserve; + TRUNCATE TABLE mes_wm_material_stock; + TRUNCATE TABLE mes_wm_material_stock_bag; -- 搴撳瓨琚嬬爜鏄庣粏锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_wm_stock_warning; -- 搴撳瓨棰勮璁板綍锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_wm_sn; + TRUNCATE TABLE mes_wm_batch; + TRUNCATE TABLE mes_wm_barcode; + TRUNCATE TABLE mes_wm_stock_taking_task_result; + TRUNCATE TABLE mes_wm_stock_taking_task_line; + TRUNCATE TABLE mes_wm_stock_taking_task; + TRUNCATE TABLE mes_wm_stock_taking_plan_param; + TRUNCATE TABLE mes_wm_stock_taking_plan; + TRUNCATE TABLE mes_wm_package_line; + TRUNCATE TABLE mes_wm_package; + TRUNCATE TABLE mes_wm_item_receipt_detail; + TRUNCATE TABLE mes_wm_item_receipt_line; + TRUNCATE TABLE mes_wm_item_receipt; + TRUNCATE TABLE mes_wm_item_consume_detail; + TRUNCATE TABLE mes_wm_item_consume_line; + TRUNCATE TABLE mes_wm_item_consume; + TRUNCATE TABLE mes_wm_product_produce_detail; + TRUNCATE TABLE mes_wm_product_produce_line; + TRUNCATE TABLE mes_wm_product_produce; + TRUNCATE TABLE mes_wm_product_issue_detail; + TRUNCATE TABLE mes_wm_product_issue_line; + TRUNCATE TABLE mes_wm_product_issue; + TRUNCATE TABLE mes_wm_product_receipt_detail; + TRUNCATE TABLE mes_wm_product_receipt_line; + TRUNCATE TABLE mes_wm_product_receipt; + TRUNCATE TABLE mes_wm_product_sales_detail; + TRUNCATE TABLE mes_wm_product_sales_line; + TRUNCATE TABLE mes_wm_product_sales; + TRUNCATE TABLE mes_wm_misc_receipt_detail; + TRUNCATE TABLE mes_wm_misc_receipt_line; + TRUNCATE TABLE mes_wm_misc_receipt; + TRUNCATE TABLE mes_wm_misc_issue_detail; + TRUNCATE TABLE mes_wm_misc_issue_line; + TRUNCATE TABLE mes_wm_misc_issue; + TRUNCATE TABLE mes_wm_outsource_receipt_detail; + TRUNCATE TABLE mes_wm_outsource_receipt_line; + TRUNCATE TABLE mes_wm_outsource_receipt; + TRUNCATE TABLE mes_wm_outsource_issue_detail; + TRUNCATE TABLE mes_wm_outsource_issue_line; + TRUNCATE TABLE mes_wm_outsource_issue; + TRUNCATE TABLE mes_wm_return_vendor_detail; + TRUNCATE TABLE mes_wm_return_vendor_line; + TRUNCATE TABLE mes_wm_return_vendor; + TRUNCATE TABLE mes_wm_return_issue_detail; + TRUNCATE TABLE mes_wm_return_issue_line; + TRUNCATE TABLE mes_wm_return_issue; + TRUNCATE TABLE mes_wm_return_sales_detail; + TRUNCATE TABLE mes_wm_return_sales_line; + TRUNCATE TABLE mes_wm_return_sales; + TRUNCATE TABLE mes_wm_sales_notice_line; + TRUNCATE TABLE mes_wm_sales_notice; + TRUNCATE TABLE mes_wm_transfer_detail; + TRUNCATE TABLE mes_wm_transfer_line; + TRUNCATE TABLE mes_wm_transfer; + TRUNCATE TABLE mes_wm_arrival_notice_line; + TRUNCATE TABLE mes_wm_arrival_notice; + + -- ============================================================ + -- 6. MES 璐ㄦ妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歮es_qc_template(_indicator/_item) / _indicator / _defect锛堣川妫�閰嶇疆涓庡瓧鍏革級 + -- ============================================================ + TRUNCATE TABLE mes_qc_indicator_result_detail; + TRUNCATE TABLE mes_qc_indicator_result; + TRUNCATE TABLE mes_qc_defect_record; + TRUNCATE TABLE mes_qc_ncr; + TRUNCATE TABLE mes_qc_iqc_line; + TRUNCATE TABLE mes_qc_iqc; + TRUNCATE TABLE mes_qc_ipqc_line; + TRUNCATE TABLE mes_qc_ipqc; + TRUNCATE TABLE mes_qc_oqc_line; + TRUNCATE TABLE mes_qc_oqc; + TRUNCATE TABLE mes_qc_rqc_line; + TRUNCATE TABLE mes_qc_rqc; + -- 绉嶅瓙璐ㄦ璁板綍锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_qc_seed_quality_indicator; + TRUNCATE TABLE mes_qc_seed_quality_source; + TRUNCATE TABLE mes_qc_seed_quality; + + -- ============================================================ + -- 7. MES 杩芥函妯″潡 鈥� 浜嬩欢涓庨璀﹁褰曪紙鍘熻剼鏈仐婕忥級 + -- 淇濈暀锛歮es_trace_anti_config锛堥槻浼獪閰嶇疆锛� + -- ============================================================ + TRUNCATE TABLE mes_trace_consumer_scan_event; + TRUNCATE TABLE mes_trace_cross_region_warning; + TRUNCATE TABLE mes_trace_integrity_record; + TRUNCATE TABLE mes_trace_event; + + -- ============================================================ + -- 8. MES 璁惧妯″潡 鈥� 鐐规/淇濆吇/缁翠慨/璁¢噺妫�娴嬭褰� + -- 淇濈暀锛歮es_dv_machinery(_type) / _check_plan* / _subject / _metering锛堝彴璐︿笌璁″垝锛� + -- ============================================================ + TRUNCATE TABLE mes_dv_check_record_line; + TRUNCATE TABLE mes_dv_check_record; + TRUNCATE TABLE mes_dv_mainten_record_line; + TRUNCATE TABLE mes_dv_mainten_record; + TRUNCATE TABLE mes_dv_repair_line; + TRUNCATE TABLE mes_dv_repair; + TRUNCATE TABLE mes_dv_metering_check; + + -- ============================================================ + -- 9. MES 宸ヨ壓/璁捐妯″潡 鈥� 涓氬姟鏁版嵁锛堢紪鐮佺敓鎴愯褰曚负娴佹按鏁版嵁锛� + -- 淇濈暀锛歮es_pd_process_param(_template/_detail)锛堝伐鑹哄弬鏁板畾涔夛級 + -- / mes_md_auto_code_rule / _part锛堢紪鐮佽鍒欙級 + -- ============================================================ + TRUNCATE TABLE mes_pd_archive; + TRUNCATE TABLE mes_pd_document_audit; + TRUNCATE TABLE mes_pd_document; + TRUNCATE TABLE mes_pd_project; + TRUNCATE TABLE mes_md_auto_code_record; + + -- ============================================================ + -- 10. CRM 妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歝rm_customer / crm_contact / crm_business_status(_type) + -- / crm_contract_config / crm_customer_limit_config / crm_customer_pool_config + -- ============================================================ + TRUNCATE TABLE crm_receivable_plan; + TRUNCATE TABLE crm_receivable; + TRUNCATE TABLE crm_contract_product; + TRUNCATE TABLE crm_contract; + TRUNCATE TABLE crm_sale_quotation_product; + TRUNCATE TABLE crm_sale_quotation; + TRUNCATE TABLE crm_business_product; + TRUNCATE TABLE crm_contact_business; + TRUNCATE TABLE crm_business; + TRUNCATE TABLE crm_clue; + TRUNCATE TABLE crm_follow_up_record; + TRUNCATE TABLE crm_invoice; + TRUNCATE TABLE crm_sales_target; + TRUNCATE TABLE crm_permission; + + -- ============================================================ + -- 11. 鍞悗妯″潡 鈥� 涓氬姟鏁版嵁 + -- ============================================================ + TRUNCATE TABLE after_sale_return_item; + TRUNCATE TABLE after_sale_return; + TRUNCATE TABLE after_sale_ticket_item; + TRUNCATE TABLE after_sale_ticket; + TRUNCATE TABLE after_sale_repair; + TRUNCATE TABLE after_sale_permission; + + -- ============================================================ + -- 12. ERP 妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歟rp_supplier / erp_account + -- ============================================================ + TRUNCATE TABLE erp_finance_payment_item; + TRUNCATE TABLE erp_finance_payment; + TRUNCATE TABLE erp_finance_receipt_item; + TRUNCATE TABLE erp_finance_receipt; + TRUNCATE TABLE erp_purchase_order_items; + TRUNCATE TABLE erp_purchase_order; + TRUNCATE TABLE erp_purchase_request_items; + TRUNCATE TABLE erp_purchase_request; + TRUNCATE TABLE erp_sale_order_items; + TRUNCATE TABLE erp_sale_order; + TRUNCATE TABLE erp_purchase_invoice; + + -- ============================================================ + -- 13. SRM 妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歴rm_supplier / srm_supplier_contact / srm_supplier_category + -- / srm_tender_config + -- ============================================================ + TRUNCATE TABLE srm_bid_award; + TRUNCATE TABLE srm_bid_evaluation; + TRUNCATE TABLE srm_bid_open; + TRUNCATE TABLE srm_tender_bid; + TRUNCATE TABLE srm_tender_material; + TRUNCATE TABLE srm_tender_project; + TRUNCATE TABLE srm_delivery_plan; + TRUNCATE TABLE srm_purchase_collaboration; + TRUNCATE TABLE srm_supplier_quote; + TRUNCATE TABLE srm_supplier_evaluation; + TRUNCATE TABLE srm_supplier_certificate; + TRUNCATE TABLE srm_supplier_apply; + + -- ============================================================ + -- 14. HRM 妯″潡 鈥� 涓氬姟鏁版嵁 + -- 淇濈暀锛歨rm_employee 鍙婃。妗堝瓙琛紙鏁欒偛/宸ヤ綔缁忓巻/绱ф�ヨ仈绯讳汉/ + -- 绀句繚鍏Н閲�/钖叕妗f/鍚堝悓锛夈�佽�冨嫟鑺傚亣鏃�/瑙勫垯銆佽鍋囩被鍨嬮厤缃�� + -- 钖叕缁撴瀯銆佺ぞ淇濆叕绉噾鏂规銆佷釜绋庣◣鐜囬厤缃� + -- ============================================================ + TRUNCATE TABLE hrm_salary_payment_detail; + TRUNCATE TABLE hrm_salary_payment; + TRUNCATE TABLE hrm_salary_calculation; + TRUNCATE TABLE hrm_attendance_summary; + TRUNCATE TABLE hrm_attendance_record; + TRUNCATE TABLE hrm_attendance_exception; + TRUNCATE TABLE hrm_leave_application; + TRUNCATE TABLE hrm_resignation_application; + TRUNCATE TABLE hrm_transfer_application; + + -- ============================================================ + -- 15. AI 妯″潡 鈥� 瀵硅瘽涓庣敓鎴愬唴瀹� + -- 淇濈暀锛歛i_api_key / ai_model / ai_tool / ai_chat_role + -- / ai_knowledge(_document/_segment) / ai_workflow + -- ============================================================ + TRUNCATE TABLE ai_chat_message; + TRUNCATE TABLE ai_chat_conversation; + TRUNCATE TABLE ai_image; + TRUNCATE TABLE ai_mind_map; + TRUNCATE TABLE ai_music; + TRUNCATE TABLE ai_write; + + -- ============================================================ + -- 16. IM 妯″潡 鈥� 浼氳瘽涓庢秷鎭� + -- 淇濈暀锛歩m_sensitive_word / im_face_pack / im_face_pack_item + -- ============================================================ + TRUNCATE TABLE im_group_message_receipt; + TRUNCATE TABLE im_group_message; + TRUNCATE TABLE im_private_message; + TRUNCATE TABLE im_message_file; + TRUNCATE TABLE im_group_request; + TRUNCATE TABLE im_group_member; + TRUNCATE TABLE im_group; + TRUNCATE TABLE im_friend_request; + TRUNCATE TABLE im_friend; + TRUNCATE TABLE im_conversation_read; + TRUNCATE TABLE im_conversation; + TRUNCATE TABLE im_channel_message; + TRUNCATE TABLE im_channel_material; + TRUNCATE TABLE im_channel; + TRUNCATE TABLE im_rtc_participant; + TRUNCATE TABLE im_rtc_call; + TRUNCATE TABLE im_user_online; + TRUNCATE TABLE im_face_user_item; + + -- ============================================================ + -- 17. OA 宸茶/鎸囧畾浜哄叧鑱旓紙淇濈暀閫氱煡鍏憡鍐呭 oa_notice / system_notice锛� + -- ============================================================ + TRUNCATE TABLE oa_notice_read; + TRUNCATE TABLE oa_notice_user; + + -- ============================================================ + -- 18. 绀轰緥鏁版嵁 + -- ============================================================ + TRUNCATE TABLE yudao_demo01_contact; + TRUNCATE TABLE yudao_demo02_category; + TRUNCATE TABLE yudao_demo03_course; + TRUNCATE TABLE yudao_demo03_grade; + TRUNCATE TABLE yudao_demo03_student; + + -- ============================================================ + -- 19. 鍩虹鏁版嵁涓庝竴琚嬩竴鐮佺鐞� + -- 鍩虹鏁版嵁锛氱墿鏂欑鐞� / 鐗╂枡鍒嗙被 / 璁¢噺鍗曚綅 / 鍝佺墝 / SKU + -- 涓�琚嬩竴鐮侊細浜х嚎缁存姢 / 鎵规鐢熶骇绠$悊 / 璧嬬爜绠$悊 / 鎵樼洏鐮佺鐞� + -- 鍝佺鏁版嵁婧愶細mes_md_item锛堜笌 mdm_item 鍚屾锛屾壒娆�/琚嬬爜閫夊搧绉嶄娇鐢級 + -- 淇濈暀锛歮es_md_vendor锛堜緵搴斿晢锛屼笌 erp_supplier 绛栫暐涓�鑷达級 + -- / mdm_warehouse锛堜粨搴擄紝涓� mes_wm_warehouse 绛栫暐涓�鑷达級 + -- / mes_md_workshop / mes_md_workstation*锛堣溅闂村伐浣滅珯閰嶇疆锛� + -- ============================================================ + -- 涓�琚嬩竴鐮侊細鍏堟竻寮曠敤鎵规鐨勬槑缁嗭紝鍐嶆竻鎵规涓庝骇绾� + TRUNCATE TABLE mes_pro_batch_worker; + TRUNCATE TABLE mes_pro_bag_code_replace; -- 琚嬬爜鏇挎崲璁板綍锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_pro_bag_code; + TRUNCATE TABLE mes_pro_pallet; + TRUNCATE TABLE mes_pro_batch; + TRUNCATE TABLE mes_pro_line; + -- 鍝佺鏁版嵁婧愶紙MES 鐗╂枡浜у搧鍏宠仈閰嶇疆锛� + TRUNCATE TABLE mes_md_product_bom; + TRUNCATE TABLE mes_md_product_sop; + TRUNCATE TABLE mes_md_product_sip; + TRUNCATE TABLE mes_md_item_batch_config; + TRUNCATE TABLE mes_md_unit_measure; -- MES 璁¢噺鍗曚綅锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_md_item; + -- 鍩虹鏁版嵁锛圡DM 鐗╂枡涓绘暟鎹� / 鍒嗙被 / 璁¢噺鍗曚綅 / 鍝佺墝 / SKU锛� + TRUNCATE TABLE mdm_item_batch_config; + TRUNCATE TABLE mdm_item_sku; -- 鐗╂枡 SKU锛坢dm_item 瀛愯〃锛屽師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mdm_item; + TRUNCATE TABLE mdm_item_category; -- 鐗╂枡鍒嗙被锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mdm_brand; -- 鍝佺墝锛堝師鑴氭湰閬楁紡锛� + TRUNCATE TABLE mes_md_item_type; + TRUNCATE TABLE mdm_unit_measure; + -- 鐗╂枡杩佺Щ鏄犲皠琛細濡傛竻鐞嗗悗闇�浠� ERP 閲嶆柊杩佺Щ鐗╂枡锛岃鏀惧紑涓嬮潰涓�琛� + -- TRUNCATE TABLE mdm_item_migration_map; + + SET FOREIGN_KEY_CHECKS = 1; + + -- ============================================================ + -- 娓呯悊缁撴灉鏍¢獙锛堜唬琛ㄨ〃琛屾暟搴斿叏閮ㄤ负 0锛� + -- ============================================================ + SELECT + (SELECT COUNT(*) FROM mes_pro_work_order) AS work_order_cnt, + (SELECT COUNT(*) FROM mes_wm_material_stock) AS stock_cnt, + (SELECT COUNT(*) FROM mes_qc_iqc) AS iqc_cnt, + (SELECT COUNT(*) FROM crm_contract) AS contract_cnt, + (SELECT COUNT(*) FROM erp_sale_order) AS sale_order_cnt, + (SELECT COUNT(*) FROM mdm_item) AS mdm_item_cnt, + (SELECT COUNT(*) FROM system_operate_log) AS operate_log_cnt; + + SELECT '涓氬姟鏁版嵁娓呯悊瀹屾垚' AS result; +END $$ + +DELIMITER ; -- Gitblit v1.9.3