From 437f8436bfd174b34a8ec4e48babf25ceb533ef3 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 26 八月 2022 16:05:05 +0800
Subject: [PATCH] MES工单新选源单、选单据类型(标准工单、报废补单) 开发工序检验报表(查询、导出)
---
VueWebApi/DLL/DAL/KanBanManagerentDAL.cs | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 208 insertions(+), 26 deletions(-)
diff --git a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
index d44eaaa..9f927ac 100644
--- a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
+++ b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -57,12 +57,12 @@
{
string sql = "";
string search = "";
+ List<ShopTopLeft> list = new List<ShopTopLeft>();
var dynamicParams = new DynamicParameters();
try
{
- if (json == null || json.Count <= 0) //浜х嚎缂栫爜涓嶄负绌�
+ if (json == null || json.Count>0) //浜х嚎缂栫爜涓嶄负绌�
{
- List<ShopTopLeft> list = new List<ShopTopLeft>();
//鑾峰彇浜х嚎淇℃伅
for (int i = 0; i < json.Count; i++)
{
@@ -81,14 +81,13 @@
{
line.lineworkcont=data.Rows[0]["CONT"].ToString(); //浜х嚎鎬诲崟閲�
line.children = new List<TreeOne>();
- //鏌ヨ浜х嚎涓嬪伐鍗曚俊鎭�
- sql = @"select distinct E.saleOrderCode,P.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname from TFlw_Rteqp A
- inner join TFlw_Rtdt B on A.step_code=B.step_code
- inner join TK_Wrk_Man P on B.rout_code=P.route_code
+ //鏌ヨ浜х嚎涓嬪凡寮�宸ョ殑鍔犲伐鍗曚俊鎭�
+ sql = @"select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname from TK_Wrk_Record A
+ inner join TK_Wrk_Man P on A.wo_code=P.wo_code
left join TMateriel_Info M on P.materiel_code=M.partcode
left join TUom T on M.uom_code=T.code
left join TKimp_Ewo E on P.m_po=E.wo
- where P.status<>'CLOSED' and P.status<>'NEW' and P.is_delete<>'1' and A.eqp_code=@linecode";
+ where P.status<>'CLOSED' and P.status<>'NEW' and A.eqp_code=@linecode and A.style='S' and A.step_seq='1'";
dynamicParams.Add("@linecode", json[i].code);
var data0 = DapperHelper.selectdata(sql, dynamicParams);
if (data0.Rows.Count > 0)
@@ -114,11 +113,11 @@
lineone.children = new List<TreeTwo>();
//鏌ユ柊宸ュ崟涓嬪伐搴忎俊鎭�
- sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.good_qty,A.ng_qty
+ sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.good_qty,A.ng_qty,A.status
from TK_Wrk_Step A
left join TStep T on A.step_code=T.stepcode
where A.wo_code=@wo_code";
- dynamicParams.Add("@linecode", wo_code);
+ dynamicParams.Add("@wo_code", wo_code);
var data1 = DapperHelper.selectdata(sql, dynamicParams);
for (int k = 0; k < data1.Rows.Count; k++)
{
@@ -128,6 +127,7 @@
string planqty = data1.Rows[k]["PLAN_QTY"].ToString();//浠诲姟鏁伴噺
string good_qty = data1.Rows[k]["GOOD_QTY"].ToString();//鎶ュ伐鏁伴噺
string ng_qty = data1.Rows[k]["NG_QTY"].ToString();//涓嶈壇鏁伴噺
+ string status = data1.Rows[k]["STATUS"].ToString();//鐘舵��
TreeTwo linetwo = new TreeTwo();
linetwo.stepseq = stepseq;
linetwo.stepcode = stepcode;
@@ -135,6 +135,7 @@
linetwo.planqty = planqty;
linetwo.goodqty = good_qty;
linetwo.ngqty = ng_qty;
+ linetwo.status = status;
lineone.children.Add(linetwo);
}
}
@@ -145,7 +146,8 @@
mes.code = "300";
mes.Message = "褰撳墠浜х嚎涓嬫棤鍦ㄧ敓浜т换鍔�!";
mes.data = null;
- return mes;
+ list.Add(line);
+ continue;
}
}
else
@@ -153,7 +155,9 @@
mes.code = "300";
mes.Message = "褰撳墠浜х嚎涓嬫棤鍦ㄧ敓浜т换鍔�!";
mes.data = null;
- return mes;
+ list.Add(line);
+ continue;
+
}
}
}
@@ -171,6 +175,9 @@
mes.Message = e.Message;
mes.data = null;
}
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
return mes;
}
#endregion\
@@ -208,7 +215,7 @@
}
#endregion
- #region[澶у矝杞﹂棿缁煎悎鐪嬫澘,鍙充笂top鎺掕鎺ュ彛]
+ #region[澶у矝杞﹂棿缁煎悎鐪嬫澘,鍙充笂top鎺掕鎺ュ彛,褰撴棩]
public static ToMessage LineSearchTopRightData()
{
string sql = "";
@@ -216,17 +223,20 @@
try
{
//鑾峰彇浜у搧鎶ュ伐top5淇℃伅
- sql = @"select top 5 A.partname,isnull(sum(A.good_qty),0) as good_qty from(
- select M.partname,A.good_qty from TK_Wrk_Record A
- inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
- inner join TMateriel_Info M on A.materiel_code=M.partcode
- where A.style='B' and S.isend='Y'
- union all
- select M.partname,A.sqty as good_qty from TK_Wrk_OutRecord A
- inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
- inner join TMateriel_Info M on A.materiel_code=M.partcode
- where A.style='S' and S.isend='Y'
- ) as A group by A.partname order by good_qty desc";
+ sql = @"select top 5 A.org_name as wkshname,A.name as linename,A.partname,isnull(sum(A.good_qty),0) as good_qty from(
+ select W.org_name,E.name,M.partname,A.good_qty from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info M on A.materiel_code=M.partcode
+ inner join TEqpInfo E on A.eqp_code=E.code
+ inner join TOrganization W on E.wksp_code=W.org_code and W.description='W'
+ where A.style='B' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
+ union all
+ select C.name as linename,'' as wkshname,M.partname,A.sqty as good_qty from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info M on A.materiel_code=M.partcode
+ inner join TCustomer C on A.wx_code=C.code and C.btype='WX'
+ where A.style='S' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
+ ) as A group by A.org_name,A.name,A.partname order by good_qty desc";
var data = DapperHelper.selecttable(sql);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
@@ -243,7 +253,7 @@
}
#endregion
- #region[澶у矝杞﹂棿缁煎悎鐪嬫澘,鍙充笅top鎺掕鎺ュ彛]
+ #region[澶у矝杞﹂棿缁煎悎鐪嬫澘,鍙充笅top鎺掕鎺ュ彛,褰撳墠鏃堕棿寰�鍓嶄竴鍛╙
public static ToMessage LineSearchBottomRightData()
{
string sql = "";
@@ -251,8 +261,180 @@
try
{
//鑾峰彇鎶ュ伐涓嶈壇top5淇℃伅
- sql = @"select isnull(COUNT(checkitem_name),0) cont,checkitem_name from TStepCheckRecordSub
- group by checkitem_name order by cont desc";
+ sql = @"select isnull(COUNT(B.name),0) cont,B.name
+ from CSR_WorkRecord_Defect A
+ inner join TDefect B on A.defect_code=B.code
+ where DateDiff(dd,A.lm_date,getdate())<=7
+ group by B.name order by cont desc";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,宸︿笂鏈湀閲囪喘璁㈠崟鏁般�佹湰鏈堥噰璐繘璐у崟鏁般�佹湰鏈堥噰璐叆搴撳崟鏁癩
+ public static ToMessage PurchaseLeftTop()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇鏈湀閲囪喘璁㈠崟鏁般�佹湰鏈堥噰璐繘璐у崟鏁般�佹湰鏈堥噰璐叆搴撳崟鏁�
+ sql = @"select * from h_v_DDKanBan_PurchaseLeftTop ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,宸︿笅閲囪喘璁㈠崟璺熻釜鍒楄〃]
+ public static ToMessage PurchaseLeftBottom()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇閲囪喘璁㈠崟璺熻釜鍒楄〃
+ sql = @"select * from h_v_DDKanBan_PurchaseLeftBottom ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,鍙充晶Top]
+ public static ToMessage PurchaseRight()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇閲囪喘璁㈠崟璺熻釜鍒楄〃
+ sql = @"select * from h_v_DDKanBan_PurchaseRight ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[澶у矝浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛╙
+ public static ToMessage WareHouseTopLeftData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+ sql = @"select * from h_v_DDKanBan_WareHouseTopLeft";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[澶у矝浠撳簱鐪嬫澘,宸︿笅浜у搧寰呭彂璐у垪琛╙
+ public static ToMessage WareHouseTopBottomData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+ sql = @"select * from h_v_DDKanBan_WareHouseTopBottom";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[澶у矝浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightTopData()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select * from h_v_DDKanBan_WareHouseRightTop";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[澶у矝浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightBottomData()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select * from h_v_DDKanBan_WareHouseRightBottom";
var data = DapperHelper.selecttable(sql);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
--
Gitblit v1.9.3