############################## ##@author:gong.chengbo ## ##@createdate:2023-08-10 ## ##@for:用于每2小时同步一些数据 ## ############################## drop procedure if exists SyncMesData_every_2_hours; create definer = root@`%` procedure SyncMesData_every_2_hours() BEGIN ##从MES_ORIGIN插入到MES_SYNC库 REPLACE into mes_sync.mes_report_task SELECT * from mes_origin.mes_report_task where update_time >= date_sub(now(), interval 30 day);#报料任务表 REPLACE into mes_sync.mes_crystal_order SELECT * from mes_origin.mes_crystal_order where update_time >= date_sub(now(), interval 30 day);#工单排产表 REPLACE into mes_sync.mes_poi_formula SELECT * from mes_origin.mes_poi_formula where update_time >= date_sub(now(), interval 30 day);#配方表 REPLACE into mes_sync.mes_feeding_task SELECT * from mes_origin.mes_feeding_task where update_time >= date_sub(now(), interval 30 day);#投料任务表 REPLACE into mes_sync.mes_feeding_detail SELECT * from mes_origin.mes_feeding_detail where update_time >= date_sub(now(), interval 30 day);#投料明细表 REPLACE into mes_sync.mes_transport_task SELECT * from mes_origin.mes_transport_task where update_time >= date_sub(now(), interval 30 day);#运输任务表 REPLACE into mes_sync.mes_furnace_task SELECT * from mes_origin.mes_furnace_task where update_time >= date_sub(now(), interval 30 day);#投炉任务表 REPLACE into mes_sync.mes_furnace_detail SELECT * from mes_origin.mes_furnace_detail where update_time >= date_sub(now(), interval 30 day);#投炉明细表 REPLACE into mes_sync.mes_stick_task SELECT * from mes_origin.mes_stick_task where update_time >= date_sub(now(), interval 30 day);#取棒任务表 REPLACE into mes_sync.mes_production SELECT * from mes_origin.mes_production where update_time >= date_sub(now(), interval 30 day);#毛棒表 REPLACE into mes_sync.mes_round_bar SELECT * from mes_origin.mes_round_bar where update_time >= date_sub(now(), interval 30 day);#圆棒表 REPLACE into mes_sync.mes_round_bar_status SELECT * from mes_origin.mes_round_bar_status where update_time >= date_sub(now(), interval 30 day);#圆棒状态表 REPLACE into mes_sync.mes_roll_rub_quality_task SELECT * from mes_origin.mes_roll_rub_quality_task where update_time >= date_sub(now(), interval 30 day);#圆棒质检任务表 REPLACE into mes_sync.mes_square SELECT * from mes_origin.mes_square where update_time >= date_sub(now(), interval 30 day);#方棒表 REPLACE into mes_sync.mes_lifting_box_task SELECT * from mes_origin.mes_lifting_box_task where update_time >= date_sub(now(), interval 30 day);# REPLACE into mes_sync.mes_packing_task SELECT * from mes_origin.mes_packing_task where update_time >= date_sub(now(), interval 30 day);#打包任务表 REPLACE into mes_sync.erp_job_mtl_confirm SELECT * from mes_origin.erp_job_mtl_confirm where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.erp_job_mtl_send SELECT * from mes_origin.erp_job_mtl_send where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.mes_draw_line_task SELECT * from mes_origin.mes_draw_line_task where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.mes_disposable_qc_task SELECT * from mes_origin.mes_disposable_qc_task where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.mes_truncation_task SELECT * from mes_origin.mes_truncation_task where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.mes_square_task SELECT * from mes_origin.mes_square_task where update_time >= date_sub(now(), interval 30 day); REPLACE into mes_sync.mes_roll_rub_task SELECT * from mes_origin.mes_roll_rub_task where update_time >= date_sub(now(), interval 30 day); set global sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; END;