##############################
##@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;#报料任务表
REPLACE into mes_sync.mes_crystal_order SELECT * from mes_origin.mes_crystal_order;#工单排产表
REPLACE into mes_sync.mes_poi_formula SELECT * from mes_origin.mes_poi_formula;#配方表
REPLACE into mes_sync.mes_feeding_task SELECT * from mes_origin.mes_feeding_task;#投料任务表
REPLACE into mes_sync.mes_feeding_detail SELECT * from mes_origin.mes_feeding_detail;#投料明细表
REPLACE into mes_sync.mes_transport_task SELECT * from mes_origin.mes_transport_task;#运输任务表
REPLACE into mes_sync.mes_furnace_task SELECT * from mes_origin.mes_furnace_task;#投炉任务表
REPLACE into mes_sync.mes_furnace_detail SELECT * from mes_origin.mes_furnace_detail;#投炉明细表
REPLACE into mes_sync.mes_stick_task SELECT * from mes_origin.mes_stick_task;#取棒任务表
REPLACE into mes_sync.mes_production SELECT * from mes_origin.mes_production;#毛棒表
REPLACE into mes_sync.mes_round_bar SELECT * from mes_origin.mes_round_bar;#圆棒表
REPLACE into mes_sync.mes_round_bar_status SELECT * from mes_origin.mes_round_bar_status;#圆棒状态表
REPLACE into mes_sync.mes_roll_rub_quality_task SELECT * from mes_origin.mes_roll_rub_quality_task;#圆棒质检任务表
REPLACE into mes_sync.mes_square SELECT * from mes_origin.mes_square;#方棒表
REPLACE into mes_sync.mes_lifting_box_task SELECT * from mes_origin.mes_lifting_box_task;#
REPLACE into mes_sync.mes_packing_task SELECT * from mes_origin.mes_packing_task;#打包任务表
REPLACE into mes_sync.erp_job_mtl_confirm SELECT * from mes_origin.erp_job_mtl_confirm;
REPLACE into mes_sync.erp_job_mtl_send SELECT * from mes_origin.erp_job_mtl_send;
REPLACE into mes_sync.mes_draw_line_task SELECT * from mes_origin.mes_draw_line_task;
REPLACE into mes_sync.mes_disposable_qc_task SELECT * from mes_origin.mes_disposable_qc_task;
REPLACE into mes_sync.mes_truncation_task SELECT * from mes_origin.mes_truncation_task;
REPLACE into mes_sync.mes_square_task SELECT * from mes_origin.mes_square_task;
REPLACE into mes_sync.mes_roll_rub_task SELECT * from mes_origin.mes_roll_rub_task;

set global sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

END;

