YZ_MES/数据库迁移sql/存储过程/SyncMesData_every_2_hours.sql

108 lines
4.1 KiB
SQL

##############################
##@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;