From eb29c7b524c0ffdd7f9132ce4d9e180e5163dfdc Mon Sep 17 00:00:00 2001 From: xuli Date: Thu, 22 Feb 2024 14:18:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E8=B4=A8=E9=87=8F=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=20=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/config/applicationhost.config | 2 +- NFine.Application/SRM/WatchPanelApp.cs | 243 +++++- .../WatchPanel/WatchPanelController.cs | 36 +- .../Areas/SRM/Views/WatchPanel/PanelCK.cshtml | 760 ++++++++++++++++++ NFine.Web/NFine.Web.csproj | 1 + NFine.Web/Views/Login/Index.cshtml | 11 +- 6 files changed, 1047 insertions(+), 6 deletions(-) create mode 100644 NFine.Web/Areas/SRM/Views/WatchPanel/PanelCK.cshtml diff --git a/.vs/config/applicationhost.config b/.vs/config/applicationhost.config index 9b651af..3b10c5a 100644 --- a/.vs/config/applicationhost.config +++ b/.vs/config/applicationhost.config @@ -171,7 +171,7 @@ - + diff --git a/NFine.Application/SRM/WatchPanelApp.cs b/NFine.Application/SRM/WatchPanelApp.cs index 9483f41..afd9021 100644 --- a/NFine.Application/SRM/WatchPanelApp.cs +++ b/NFine.Application/SRM/WatchPanelApp.cs @@ -1541,8 +1541,249 @@ ORDER BY 销售车号,物料编码,报工人 return dt; } - + public DataTable GetOtherData() + { + + string SqlText = ""; + + SqlText = @" + + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustttemp1')) + drop table #Tcustttemp1 + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcusttfilter')) + drop table #Tcusttfilter + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TcusttDJ')) + drop table #TcusttDJ + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustt_TOCKQty')) + drop table #Tcustt_TOCKQty + + + --用途程表关联wip表拼出所有的检验数据 + select a.ITEMCODE,a.ROUTECODE,a.OPCODE, a.OPType AS OPTIONALOP, a.OPControlSeq,b.LOTNO, + isnull(b.ACTIONRESULT,'~') as ACTIONRESULT,b.MOCODE,b.MOSEQ,d.molotcode into #Tcustttemp1 + from ICSITEMROUTE2OPLot a with(nolock) + left join icslotonwip b with(nolock) on a.ITEMCODE = b.ITEMCODE and a.ROUTECODE = b.ROUTECODE and a.OPCODE = b.OPCODE + inner join (SELECT distinct a.ITEMCODE,a.ROUTECODE + from ICSITEMROUTE2OPLot a with(nolock) + left join icslotonwip b with(nolock) on a.ITEMCODE = b.ITEMCODE and a.ROUTECODE = b.ROUTECODE and a.OPCODE = b.OPCODE + WHERE b.ACTIONRESULT is not null + ) c on a.ITEMCODE = c.ITEMCODE and a.ROUTECODE = c.ROUTECODE + + left join icsmo d with(nolock) on d.MOCODE = b.MOCODE and b.SEQ = d.MOSEQ + + order by ITEMCODE,OPControlSeq + --把wip表里有在开工的排除 + select ITEMCODE,ROUTECODE,ACTIONRESULT into #Tcusttfilter from icslotonwip with(nolock) + group by ITEMCODE,ROUTECODE,ACTIONRESULT HAVING COUNT(ITEMCODE) = 1 and COUNT(ROUTECODE)=1 + --找出待检的工序 + select ITEMCODE,a.ROUTECODE,OPCODE,c.MOCODE,c.MOSEQ,c.LOTNO into #TcusttDJ from #Tcustttemp1 a + inner join + (select min(OPControlSeq) OPControlSeq,ROUTECODE from #Tcustttemp1 where OPTIONALOP = '检验工序' and LOTNO is null--最小未检前一道结束的 + and ROUTECODE in + (select ROUTECODE from (select max(a.OPControlSeq) OPControlSeq,a.ROUTECODE from #Tcustttemp1 a + inner join (select min(OPControlSeq) OPControlSeq,ROUTECODE from #Tcustttemp1 where OPTIONALOP = '检验工序' and LOTNO is null group by ROUTECODE) b + on a.ROUTECODE = b.ROUTECODE and b.OPControlSeq >a.OPControlSeq and a.ACTIONRESULT = 'COLLECT_END' group by a.ROUTECODE) a ) + GROUP BY ROUTECODE) b + on a.ROUTECODE = b.ROUTECODE and a.OPControlSeq = b.OPControlSeq + inner join ( select distinct mocode,MOSEQ,ROUTECODE,LOTNO from icslotonwip with(nolock) ) c + on a.ROUTECODE =c.ROUTECODE + where + not EXISTS( select 1 from #Tcusttfilter f + where f.ITEMCODE=a.ITEMCODE and f.ROUTECODE =a.ROUTECODE ) + + --将数据拼接成在检和待检两部分 + + + --1、待检验数据 待检车辆 + select count(1) Qty into #Tcustt_TOCKQty + from ( + select b.molotCode [销售车号] , dj.LOTNO [产品跟踪单], dj.OPCODE [工序代码] + from #TcusttDJ dj + inner join #Tcustttemp1 a on dj.ROUTECODE = a.ROUTECODE and a.OPCODE = dj.OPCODE and optionalop ='检验工序' + inner join icsmo b with(nolock) on dj.MOCODE = b.MOCODE and dj.MOSEQ = b.MOSEQ + inner join ICSMO2user d with(nolock) on b.mocode = d.mocode and b.moseq = d.moseq and d.opcode = dj.OPCODE + + union All + select c.molotCode [销售车号] , d.LOTNO [产品跟踪单], d.OPCODE [工序代码] + from + (select * from ICSITEMROUTE2OP with(nolock) where optionalop ='检验工序' and routecode in( + select DISTINCT routecode from ICSITEMROUTE2OP with(nolock) GROUP BY routecode HAVING count(*) = 1 )) a --查询只有一道工序的工艺路线 + inner JOIN ICSMO2ROUTE b with(nolock) on a.routeid = b.routeid + inner join ICSMO c with(nolock) on c.id = b.moid + inner join ICSMO2user d with(nolock) on c.mocode = d.mocode and c.moseq = d.moseq + inner join ICSITEMROUTE2OPLot lot with(nolock) on lot.itemcode = a.ITEMCODE and b.ROUTECODE = lot.ROUTECODE and lot.OPCODE = d.opcode + + where not exists (select 1 from ICSLOTONWIP wip with(nolock) where wip.lotno = d.LOTNO and wip.opcode =d.OPCODE and wip.actionresult ='COLLECT_END') + ) jj + + + --1、已检验数据 已检车辆 + select count(1) Qty into #Tcustt_CKQty + from ( + SELECT distinct mm.molotcode 销售车号,b.LOTNO,a.OPCODE + from ICSQualityCKDATA a with(nolock) + LEFT JOIN ICSQualityCKDATADetail b with(nolock) on a.LOTNO=b.LOTNO and a.ID=b.DATAID + LEFT JOIN ICSLOTONWIP d with(nolock) on d.LotNo=a.LOTNO and d.opcode=a.OPCODE + LEFT JOIN icsmo mm with(nolock) on mm.MOCODE =d.MOCODE and mm.MOSEQ=d.MOSEQ + + LEFT JOIN ICSITEMROUTE2OPLot ll with(nolock) on ll.OPCODE=a.OPCODE and ll.LotNo=a.LOTNO + + + WHERE ll.OPType='检验工序' and b.MTIME>= CONVERT(varchar(7), dateadd(mm,-1,getdate()), 21) +'-01 00:00:00' + and b.CKRESULT is not null + ) jj + + + select isnull((select Qty from #Tcustt_TOCKQty ),0) 待检车辆, + isnull((select Qty from #Tcustt_CKQty ),0) 已检车辆, + isnull((select count(1) from ICSZXCheck with(nolock) where checked='0'),0) 待整改, + isnull((select count(1) from ICSZXCheck with(nolock) where checked='1' and month>= CONVERT(varchar(7), dateadd(mm,-1,getdate()), 21) +'-01' ),0) 已整改 + + + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustttemp1')) + drop table #Tcustttemp1 + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcusttfilter')) + drop table #Tcusttfilter + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TcusttDJ')) + drop table #TcusttDJ + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustt_TOCKQty')) + drop table #Tcustt_TOCKQty + + + + + "; + + + DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); + + + return dt; + } + + + public DataTable GetCKData() + { + + string SqlText = ""; + + SqlText = @" + SELECT TOP 100 mm.molotcode 销售车号,yy.INVNAME 部件名称, + b.MUSERName 人员, + pp.CKGROUPDESC 项目, + CONVERT(varchar(16), b.MTIME, 120) as 时间, + b.Type 类型 , + CASE when b.CKRESULT ='1' then '合格' when b.CKRESULT ='0' then '不合格' end as '结果' + from ICSQualityCKDATA a with(nolock) + LEFT JOIN ICSQualityCKDATADetail b with(nolock) on a.LOTNO=b.LOTNO and a.ID=b.DATAID + LEFT JOIN ICSLOTONWIP d with(nolock) on d.LotNo=a.LOTNO and d.opcode=a.OPCODE + LEFT JOIN ICSOQCCKLIST qq with(nolock) on qq.invcode= d.itemcode and qq.opcode=d.opcode and qq.ckgroupattr=b.Type and b.CKitemid=qq.id + LEFT JOIN icsmo mm with(nolock) on mm.MOCODE =d.MOCODE and mm.MOSEQ=d.MOSEQ + -- LEFT JOIN ICSMO2ROUTE tt on tt.mocode=mm.mocode and tt.EATTRIBUTE1=mm.MOSEQ + LEFT JOIN ICSINVENTORY yy with(nolock) on yy.INVCODE=mm.ITEMCODE + LEFT JOIN ICSITEMROUTE2OPLot ll with(nolock) on ll.OPCODE=a.OPCODE and ll.LotNo=a.LOTNO + LEFT JOIN ICSOQCCKGROUP pp with(nolock) on pp.CKGROUP=qq.CKGROUPCode + -- LEFT JOIN ICSECS sss on sss.ecscode=b.CKvalue + -- LEFT JOIN ICSECS s1 on s1.ecscode=b.CKvalue2 + -- LEFT JOIN ICSECS s2 on s2.ecscode=b.CKvalue3 + -- LEFT JOIN ICSECS s3 on s3.ecscode=b.CKvalue4 + -- LEFT JOIN ICSECS s4 on s4.ecscode=b.CKvalue5 + -- LEFT JOIN ICSECS s5 on s5.ecscode=b.CKvalue6 + WHERE ll.OPType='检验工序' and 1=1 + ORDER BY b.MTIME desc + + "; + + + DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); + + + return dt; + } + + public DataTable GetCKOKRate() + { + + string SqlText = ""; + + SqlText = @" + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustccff')) + drop table #Tcustccff + select convert(varchar(7),DATEADD(month,number*-1,getdate()) ,120) AS 月份,number + into #Tcustccff + from master.dbo.spt_values + where type='p' + AND number<=5 + and number>=0 + order by 1 + + select ff.月份, Convert(decimal(18,0),isnull(case when isnull(count(1),0)=0 then 0 else sum(合格)*100.0000/count(1) end,0)) Qty + from #Tcustccff ff + left join ( + SELECT distinct mm.molotcode 销售车号,b.LOTNO,a.OPCODE, + CASE when b.CKRESULT ='1' then 1 when b.CKRESULT ='0' then 0 end as 合格, + CONVERT(varchar(7), b.MTIME,21) 月份 + from ICSQualityCKDATA a with(nolock) + LEFT JOIN ICSQualityCKDATADetail b with(nolock) on a.LOTNO=b.LOTNO and a.ID=b.DATAID + LEFT JOIN ICSLOTONWIP d with(nolock) on d.LotNo=a.LOTNO and d.opcode=a.OPCODE + LEFT JOIN icsmo mm with(nolock) on mm.MOCODE =d.MOCODE and mm.MOSEQ=d.MOSEQ + + LEFT JOIN ICSITEMROUTE2OPLot ll with(nolock) on ll.OPCODE=a.OPCODE and ll.LotNo=a.LOTNO + + + WHERE ll.OPType='检验工序' and b.MTIME>= CONVERT(varchar(7), dateadd(mm,-6,getdate()), 21) +'-01 00:00:00' + and b.CKRESULT is not null + ) jj on ff.月份=jj.月份 + group by ff.月份,ff.number + order by ff.number desc + if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tcustccff')) + drop table #Tcustccff + "; + + + DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); + + + return dt; + } + + public DataTable GetCKOKRateALL() + { + + string SqlText = ""; + + SqlText = @" + + select Convert(decimal(18,0),isnull(case when isnull(count(1),0)=0 then 0 else sum(合格)*1.0000/count(1) end,0)) Qty + from ( + SELECT distinct mm.molotcode 销售车号,b.LOTNO,a.OPCODE, + CASE when b.CKRESULT ='1' then 1 when b.CKRESULT ='0' then 0 end as 合格, + CONVERT(varchar(7), b.MTIME,21) 月份 + from ICSQualityCKDATA a with(nolock) + LEFT JOIN ICSQualityCKDATADetail b with(nolock) on a.LOTNO=b.LOTNO and a.ID=b.DATAID + LEFT JOIN ICSLOTONWIP d with(nolock) on d.LotNo=a.LOTNO and d.opcode=a.OPCODE + LEFT JOIN icsmo mm with(nolock) on mm.MOCODE =d.MOCODE and mm.MOSEQ=d.MOSEQ + + LEFT JOIN ICSITEMROUTE2OPLot ll with(nolock) on ll.OPCODE=a.OPCODE and ll.LotNo=a.LOTNO + + + WHERE ll.OPType='检验工序' + and b.CKRESULT is not null + ) jj + + + "; + + + DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); + + + return dt; + } + + + } } diff --git a/NFine.Web/Areas/SRM/Controllers/WatchPanel/WatchPanelController.cs b/NFine.Web/Areas/SRM/Controllers/WatchPanel/WatchPanelController.cs index 6574431..186887a 100644 --- a/NFine.Web/Areas/SRM/Controllers/WatchPanel/WatchPanelController.cs +++ b/NFine.Web/Areas/SRM/Controllers/WatchPanel/WatchPanelController.cs @@ -334,8 +334,36 @@ namespace NFine.Web.Areas.SRM.Controllers var data = App.GetZhiXing_RCVUnInWare(); return Content(data.ToJson()); } - + [HttpGet] + [HandlerAjaxOnly] + public ActionResult GetOtherData(string XX) + { + var data = App.GetOtherData(); + return Content(data.ToJson()); + } + [HttpGet] + [HandlerAjaxOnly] + public ActionResult GetCKData(string XX) + { + var data = App.GetCKData(); + return Content(data.ToJson()); + } + [HttpGet] + [HandlerAjaxOnly] + public ActionResult GetCKOKRate(string XX) + { + var data = App.GetCKOKRate(); + return Content(data.ToJson()); + } + [HttpGet] + [HandlerAjaxOnly] + public ActionResult GetCKOKRateALL(string XX) + { + var data = App.GetCKOKRateALL(); + return Content(data.ToJson()); + } + public virtual ActionResult PanelWIP() { @@ -370,7 +398,11 @@ namespace NFine.Web.Areas.SRM.Controllers { return View(); } - + public virtual ActionResult PanelCK() + { + return View(); + } + [HttpGet] [HandlerAjaxOnly] public ActionResult GetSScode() { diff --git a/NFine.Web/Areas/SRM/Views/WatchPanel/PanelCK.cshtml b/NFine.Web/Areas/SRM/Views/WatchPanel/PanelCK.cshtml new file mode 100644 index 0000000..70ac8f9 --- /dev/null +++ b/NFine.Web/Areas/SRM/Views/WatchPanel/PanelCK.cshtml @@ -0,0 +1,760 @@ + + + + + + + + + + + + 产品质量控制 + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +
产品质量控制
+
+
+
+ + +
+
+
    +
  • + +
    +
    + +
      +
    • 待检车辆
    • +
    • 已检车辆
    • +
    • 待整改车辆
    • +
    • 已整改车辆
    • +
    +
      +
    • 0台
    • +
    • 0台
    • +
    • 0台
    • +
    • 0台
    • +
    +
    +
    +
    +
    +
    + + + + +
    +
    + @*
*@ + +
  • + +
    +
    +
    +
    +
    +
    + + + + +
    +
    + +
  • + + +
    +
    + + +
    +
    +
      +
    • + +
      +
      + @*

      SMT车间生产加工数据

      *@ +
      +
      +
        +
      • 销售车号
      • +
      • 部件
      • +
      • 人员
      • +
      • 项目
      • +
      • 时间
      • +
      • 类型
      • +
      • 结果
      • + +
      +
      +
      + +
      +
      +
      +
      + + + + +
      +
      + +
    • + + + +
    +
    +
    + + + +
    + + + + + + + + diff --git a/NFine.Web/NFine.Web.csproj b/NFine.Web/NFine.Web.csproj index f00e629..207817e 100644 --- a/NFine.Web/NFine.Web.csproj +++ b/NFine.Web/NFine.Web.csproj @@ -525,6 +525,7 @@ Designer + diff --git a/NFine.Web/Views/Login/Index.cshtml b/NFine.Web/Views/Login/Index.cshtml index fb1672e..b774d4c 100644 --- a/NFine.Web/Views/Login/Index.cshtml +++ b/NFine.Web/Views/Login/Index.cshtml @@ -45,7 +45,9 @@ - + @@ -81,8 +83,13 @@ function btn_WIP2() { window.open("/SRM/WatchPanel/PanelWIPZhiXingDa2?&" + Math.random()); } + + - PanelWareHouseNew + function btn_WIP3() { + var cc = window.location.href.replace("/Login/Index", ""); + window.open(cc + "SRM/WatchPanel/PanelCK?&" + Math.random()); + }