##############################
##@author:gong.chengbo      ##
##@createdate:2023-08-10    ##
##@for:每12小时同步一些数据    ##
##############################
drop procedure if exists SyncMesData_every_12_hours;
create
    definer = admin@`%` procedure SyncMesData_every_12_hours()
BEGIN
    #REPLACE into mes_sync.mes_job SELECT * from mes_origin.mes_job;
#REPLACE into mes_sync.erp_job_mtl_manage_task SELECT * from mes_origin.erp_job_mtl_manage_task;
#REPLACE into mes_sync.erp_job_mtl_manage_detail SELECT * from mes_origin.erp_job_mtl_manage_detail;
#REPLACE into mes_sync.erp_job_mtl SELECT * from mes_origin.erp_job_mtl;
#REPLACE into mes_sync.mes_job_recipe SELECT * from mes_origin.mes_job_recipe;
#REPLACE into mes_sync.mes_material SELECT * from mes_origin.mes_material;
#REPLACE into mes_sync.erp_job_opr SELECT * from mes_origin.erp_job_opr;
#REPLACE into mes_sync.mes_mother_alloy_task SELECT * from mes_origin.mes_mother_alloy_task;
#REPLACE into mes_sync.mes_mother_alloy SELECT * from mes_origin.mes_mother_alloy;
#REPLACE into mes_sync.mes_vehicle_feed_task SELECT * from mes_origin.mes_vehicle_feed_task;
#REPLACE into mes_sync.mes_task_send_erp SELECT * from mes_origin.mes_task_send_erp;
#REPLACE into mes_sync.mes_sub_chamber_task SELECT * from mes_origin.mes_sub_chamber_task;
#REPLACE into mes_sync.mes_seedcrystal_change SELECT * from mes_origin.mes_seedcrystal_change;
#REPLACE into mes_sync.mes_surplus_collect_task SELECT * from mes_origin.mes_surplus_collect_task;
#REPLACE into mes_sync.mes_surplus SELECT * from mes_origin.mes_surplus;
#REPLACE into mes_sync.mes_surplus_confirm_task SELECT * from mes_origin.mes_surplus_confirm_task;
#REPLACE into mes_sync.mes_vehicle_crystal SELECT * from mes_origin.mes_vehicle_crystal;
#REPLACE into mes_sync.mes_dismantle_task SELECT * from mes_origin.mes_dismantle_task;
#REPLACE into mes_sync.mes_dismantle_thermal SELECT * from mes_origin.mes_dismantle_thermal;
#REPLACE into mes_sync.mes_draw_line_task SELECT * from mes_origin.mes_draw_line_task;
#REPLACE into mes_sync.mes_round_bar_label SELECT * from mes_origin.mes_round_bar_label;
#REPLACE into mes_sync.mes_truncation_task SELECT * from mes_origin.mes_truncation_task;
#REPLACE into mes_sync.mes_resistance_gauging_task SELECT * from mes_origin.mes_resistance_gauging_task;
#REPLACE into mes_sync.mes_oxygen_carbon_detection_task SELECT * from mes_origin.mes_oxygen_carbon_detection_task;
#REPLACE into mes_sync.mes_specimen SELECT * from mes_origin.mes_specimen;
#REPLACE into mes_sync.mes_electrical_performance_task SELECT * from mes_origin.mes_electrical_performance_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;
#REPLACE into mes_sync.mes_multi_cut SELECT * from mes_origin.mes_multi_cut;
#REPLACE into mes_sync.mes_seed_crystal_machine_task SELECT * from mes_origin.mes_seed_crystal_machine_task;
#REPLACE into mes_sync.mes_seed_crystal SELECT * from mes_origin.mes_seed_crystal;
    REPLACE into mes_sync.mes_recycle_material_storage
    SELECT *
    from mes_origin.mes_recycle_material_storage
    where update_time >= date_sub(now(), interval 30 day);
    #更新循环料起托入库表
#REPLACE into mes_sync.mes_split_storage SELECT * from mes_origin.mes_split_storage;
#REPLACE into mes_sync.mes_pre_clean SELECT * from mes_origin.mes_pre_clean;
#REPLACE into mes_sync.mes_washable_silicon_qc_task SELECT * from mes_origin.mes_washable_silicon_qc_task;
#REPLACE into mes_sync.mes_recycle_material_storage_detail SELECT * from mes_origin.mes_recycle_material_storage_detail;
#REPLACE into mes_sync.mes_silicon_clean_task SELECT * from mes_origin.mes_silicon_clean_task;
#REPLACE into mes_sync.mes_silicon_clean_soak SELECT * from mes_origin.mes_silicon_clean_soak;
#REPLACE into mes_sync.mes_silicon_clean_soak_manage SELECT * from mes_origin.mes_silicon_clean_soak_manage;
#REPLACE into mes_sync.mes_silicon_clean_auto SELECT * from mes_origin.mes_silicon_clean_auto;
#REPLACE into mes_sync.mes_silicon_clean_fracture SELECT * from mes_origin.mes_silicon_clean_fracture;
#REPLACE into mes_sync.mes_magnet_choice SELECT * from mes_origin.mes_magnet_choice;
#REPLACE into mes_sync.mes_disposable_qc_task SELECT * from mes_origin.mes_disposable_qc_task;
#REPLACE into mes_sync.mes_crystal_flow SELECT * from mes_origin.mes_crystal_flow;
#REPLACE into mes_sync.mes_order_tracing SELECT * from mes_origin.mes_order_tracing;
#REPLACE into mes_sync.mes_device SELECT * from mes_origin.mes_device;
#REPLACE into mes_sync.mes_device_attribute SELECT * from mes_origin.mes_device_attribute;
#REPLACE into mes_sync.mes_turnover_container SELECT * from mes_origin.mes_turnover_container;
#REPLACE into mes_sync.mes_abnormal_feedback SELECT * from mes_origin.mes_abnormal_feedback;
#REPLACE into mes_sync.sys_package_version_manage SELECT * from mes_origin.sys_package_version_manage;
#REPLACE into mes_sync.mes_packing_detail SELECT * from mes_origin.mes_packing_detail;
#REPLACE into mes_sync.raipiot_log_error SELECT * from mes_origin.raipiot_log_error;
#REPLACE into mes_sync.mes_electrical_performance_task_log SELECT * from mes_origin.mes_electrical_performance_task_log;
#REPLACE into mes_sync.mes_work_order SELECT * from mes_origin.mes_work_order;
    REPLACE into mes_sync.yz_mes_spec
    SELECT *
    from mes_origin.yz_mes_spec;#规格表
    REPLACE into mes_sync.yz_mes_spec_value
    SELECT *
    from mes_origin.yz_mes_spec_value;
    #规格属性表
#REPLACE into mes_sync.raipiot_log_api SELECT * from mes_origin.raipiot_log_api;
#REPLACE into mes_sync.mes_work_order_job_detail SELECT * from mes_origin.mes_work_order_job_detail;
#REPLACE into mes_sync.mes_mother_alloy_bind SELECT * from mes_origin.mes_mother_alloy_bind;
#REPLACE into mes_sync.mes_schedule SELECT * from mes_origin.mes_schedule;
#REPLACE into mes_sync.mes_thermal_field_material SELECT * from mes_origin.mes_thermal_field_material;
#REPLACE into mes_sync.mes_work_order_job_half SELECT * from mes_origin.mes_work_order_job_half;
#REPLACE into mes_sync.mes_work_order_job SELECT * from mes_origin.mes_work_order_job;
#REPLACE into mes_sync.raipiot_log_usual SELECT * from mes_origin.raipiot_log_usual;
#REPLACE into mes_sync.sys_dict_type SELECT * from mes_origin.sys_dict_type;
#REPLACE into mes_sync.mes_dict SELECT * from mes_origin.mes_dict;
#REPLACE into mes_sync.sys_dict_data SELECT * from mes_origin.sys_dict_data;
    update reportdata.prod set rodtosquare = round / square; ##更新圆方比
END;

