From c48c3f41526504643ae4e73fef9a258178d1fc2d Mon Sep 17 00:00:00 2001 From: xiaochou164 Date: Thu, 10 Aug 2023 14:11:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=98=E5=82=A8=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E7=94=A8=E6=88=B7root=E4=B8=BAadmin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../存储过程/SyncMesData_every_2_hours.sql | 2 + .../存储过程/UpdateAllfeedingdetail.sql | 2 +- .../存储过程/UpdateMesMoDailyYield.sql | 42 +++++++++++++------ .../存储过程&定时任务/存储过程/UpdateMostatus.sql | 2 +- .../存储过程/UpdateRecyclematerialoutput.sql | 2 +- .../存储过程/UpdateSiteOnlineYield.sql | 2 +- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/SyncMesData_every_2_hours.sql b/数据库迁移sql/存储过程&定时任务/存储过程/SyncMesData_every_2_hours.sql index 1e203fd..c3f827f 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/SyncMesData_every_2_hours.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/SyncMesData_every_2_hours.sql @@ -23,5 +23,7 @@ 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; +set global sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + END; diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateAllfeedingdetail.sql b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateAllfeedingdetail.sql index 15b95a1..11560fc 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateAllfeedingdetail.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateAllfeedingdetail.sql @@ -1,5 +1,5 @@ create - definer = root@`%` procedure UpdateAllfeedingdetail() + definer = admin@`%` procedure UpdateAllfeedingdetail() BEGIN DELETE from reportdata.allfeedingdetail; replace into reportdata.allfeedingdetail(`month`,mfgdate,mesmoname,eqpid,moprodname,moproddesc, diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMesMoDailyYield.sql b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMesMoDailyYield.sql index 42ba3ec..f8258ed 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMesMoDailyYield.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMesMoDailyYield.sql @@ -1,11 +1,11 @@ ############################## -##@author:gong.chengbo ## +##@author:gong.chengbo ## ##@createdate:2023-08-10 ## ############################## #用于归档完结工单的产量时间等信息 ###建立临时表处理数据 -DROP TEMPORARY TABLE IF EXISTS mesmodailyyieldtemp; -CREATE TEMPORARY TABLE mesmodailyyieldtemp +DROP TABLE IF EXISTS mesmodailyyieldtemp; +CREATE TABLE mesmodailyyieldtemp ( mesmoname varchar(255) not null comment 'MES工单/炉次号', erpmoname varchar(255) null comment 'ERP工单号', @@ -50,7 +50,8 @@ set mmd.stovetime = mo.stovetime, mmd.moprod = mo.subprod, mmd.area = eq.area, mmd.area1 = eq.area1, - mmd.finishdate = mo.finish_time; + mmd.finishdate = mo.finish_time +where 1=1; ### 从投炉表中更新坩埚等信息 update mesmodailyyieldtemp mmd @@ -64,7 +65,8 @@ update mesmodailyyieldtemp mmd on (ft.feeding_task_id = fd.feeding_task_id and fd.material_type = '1')) cru on (mmd.mesmoname = cru.mesmoname) set mmd.cruciblesn = cru.cruciblesn, mmd.crucible = cru.crucible, - mmd.crusize = cru.crusize; + mmd.crusize = cru.crusize +where 1=1; ###更新工单运行时间 @@ -87,11 +89,13 @@ where mmd.adjustcrucible is null; ##根据坩埚 update mesmodailyyieldtemp mmd INNER JOIN reportdata.dict d on (mmd.adjustcrucible = d.dictkey and d.cate = 'cruccode') -set mmd.adjustcruciblecode = d.value; +set mmd.adjustcruciblecode = d.value +where 1=1; update mesmodailyyieldtemp mmd INNER JOIN reportdata.dict d on (mmd.crucible = d.dictkey and d.cate = 'crucname') set mmd.adjustcruciblecode = d.value, - mmd.adjustcrucible = d.value1; + mmd.adjustcrucible = d.value1 +where 1=1; ####修正部分佑鑫坩埚 update mesmodailyyieldtemp mmd @@ -117,16 +121,17 @@ update mesmodailyyieldtemp mmd right join mes_sync.mes_feeding_detail fd on (ft.feeding_task_id = fd.feeding_task_id and fd.material_type = '2') group by ft.order_no) d on (mmd.mesmoname = d.mesmoname) -set mmd.totalstoveweight = d.stoveweight; - +set mmd.totalstoveweight = d.stoveweight +where 1=1; update mesmodailyyieldtemp mmd left join - (select order_no mesmoname, sum(weight) outweight, sum(length) length + (select order_no mesmoname, sum(weight) outweight, sum(length) 'length' from mes_sync.mes_production group by order_no) t on (mmd.mesmoname = t.mesmoname) set mmd.totallength = t.length, - mmd.totaloutweight = t.outweight; + mmd.totaloutweight = t.outweight +where 1=1; ###更新圆棒有效长度 @@ -151,14 +156,25 @@ update mesmodailyyieldtemp mmd set mmd.rod = p.round where mmd.rod is null; +###WFSY技术实验规格 +update mesmodailyyieldtemp mmd +INNER JOIN +( +select distinct substring(moprodname, 1, 5) subprod, rod + from mesmodailyyieldtemp + where rod is not null +) p on (substring(mmd.moprodname,1,5) = p.subprod) +set mmd.rod = p.rod +where mmd.moprod = 'WFSY' and mmd.rod is null; + ###折算圆棒有效重量 update mesmodailyyieldtemp mmd set mmd.totalqcweight = mmd.totalqclength / mmd.rod where totalqcweight is null; - +replace into reportdata.mesmodailyyield select * from mesmodailyyieldtemp order by mfgdate desc; -#DROP TEMPORARY TABLE mesmodailyyieldtemp; \ No newline at end of file +DROP TABLE mesmodailyyieldtemp; diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMostatus.sql b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMostatus.sql index 51a3ea9..73a941d 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMostatus.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateMostatus.sql @@ -1,5 +1,5 @@ create - definer = root@`%` procedure UpdateMostatus() + definer = admin@`%` procedure UpdateMostatus() BEGIN REPLACE into reportdata.Mostatus(area1,MESmoname,ERPmoname,eqpid,prodname,proddesc,crusize,stovetime,feeding_task_id,crucible,subprod,mostatus,mostatusdesc,finish_time,runtime) diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateRecyclematerialoutput.sql b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateRecyclematerialoutput.sql index 584ca7c..5c4ee25 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateRecyclematerialoutput.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateRecyclematerialoutput.sql @@ -1,5 +1,5 @@ create - definer = root@`%` procedure UpdateRecyclematerialouput() + definer = admin@`%` procedure UpdateRecyclematerialouput() BEGIN replace into reportdata.recyclematerialouput(lotsn,prodname,proddesc,prodtype,level, resistivity,weight,cate1,type,cate2,cate3,update_time,mfgdate,month) diff --git a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateSiteOnlineYield.sql b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateSiteOnlineYield.sql index c43d7ee..3f248fe 100644 --- a/数据库迁移sql/存储过程&定时任务/存储过程/UpdateSiteOnlineYield.sql +++ b/数据库迁移sql/存储过程&定时任务/存储过程/UpdateSiteOnlineYield.sql @@ -1,5 +1,5 @@ create - definer = root@`%` procedure UpdateSiteOnlineYield() comment '更新产量表存储过称' + definer = admin@`%` procedure UpdateSiteOnlineYield() comment '更新产量表存储过称' BEGIN replace into reportdata.siteonlinecrucibleyield(crystalbarno,MESmoname,eqpid,actualprodname,actualproddesc,outweight,outlength,outtime) SELECT code,order_no,stove_no,product_no,product_name,weight,length,update_time