From dfe8c5343eefa07dffe6b07981c179cb72c6b9cb Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期四, 23 三月 2023 15:55:59 +0800
Subject: [PATCH] nothing
---
VueWebApi/DLL/DAL/ProductionManagementDAL.cs | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 354 insertions(+), 1 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index a4718c2..47dda89 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -391,6 +391,83 @@
}
#endregion
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ public static ToMessage MesBadOrderSearch(string mesordercode, string sourceorder, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (createdate != "" && createdate != null)
+ {
+ search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+ dynamicParams.Add("@createdate", createdate);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
+ A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,U.username as lm_user,A.lm_date,S.bad_qty
+ from TK_Wrk_Man A
+ left join (select wo_code,sum(bad_qty) as bad_qty from TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.org_code
+ left join T_Sec_Stck D on A.stck_code=D.code
+ left join TFlw_Rout E on A.route_code=E.code
+ left join T_Sec_Stck F on A.stck_code=F.code
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' and A.status='START' and A.wotype='PO' and S.bad_qty>0 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
#region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺鎺ュ彛]
public static ToMessage PartSelectRoute(string partcode)
{
@@ -496,6 +573,73 @@
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 SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ mes.code = "200";
+ mes.Message = "";
+ mes.data = null;
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鏄惁閮芥湁鍏宠仈宸ヤ綔绔�
+ sql = @"select B.step_code,C.eqp_code from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ where A.code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var dtck = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtck.Rows.Count; i++)
+ {
+ if (dtck.Rows[i].IsNull("eqp_code"))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�"+dtck.Rows[i]["step_code"].ToString()+"銆戯紝鏈叧鑱旇澶囷紝璇峰叧鑱旀墍鏈夊伐搴忓搴旇澶�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
+ sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice from (
+ select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ left join TStep S on B.step_code=S.stepcode
+ where A.code=@route_code
+ ) as AA
+ left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@route_code) as S on
+ AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@route_code", routecode);
+ var dtc = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtc.Rows.Count; i++)
+ {
+ if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
+ {
+ if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
}
catch (Exception e)
{
@@ -614,7 +758,23 @@
CreateDate = DateTime.Now.ToString()
}
});
-
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
bool aa = DapperHelper.DoTransaction(list);
if (aa)
@@ -708,6 +868,34 @@
CreateDate = DateTime.Now.ToString()
}
});
+ //鍒犻櫎宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"delete TWoPrteEqp_Stad where wo=@mesordercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode
+ }
+ });
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
+
bool aa = DapperHelper.DoTransaction(list);
if (aa)
{
@@ -889,6 +1077,171 @@
#endregion
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勮澶�(鑷埗)]
+ public static ToMessage MesOrderStepEqpSearch(string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭璁惧(鑷埗宸ュ簭)
+ sql = @"select B.eqp_code,E.name as eqp_name from TK_Wrk_Step A
+ inner join TFlw_Rteqp B on A.step_code=B.step_code
+ left join TEqpInfo E on B.eqp_code=E.code
+ where B.style='E' and A.wo_code=@ordercode and A.step_code=@stepcode
+ order by B.eqp_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ュ簭浠诲姟鏃犲彲鎵ц璁惧!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勪緵鏂�(澶栧崗)]
+ public static ToMessage MesOrderWxStepEqpSearch(string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭澶栧崗渚涙柟(澶栧崗宸ュ簭)
+ sql = @"select B.eqp_code as customercode,C.name as customername from TK_Wrk_Step A
+ inner join TFlw_Rteqp B on A.step_code=B.step_code
+ left join TCustomer C on B.eqp_code=C.code
+ where B.style='W' and A.wo_code=@ordercode and A.step_code=@stepcode
+ order by B.eqp_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ュ簭鏃犲彲鎵ц澶栧崗渚涙柟!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
#region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
public static ToMessage MesOrderStepSearch(string orderstepqrcode, int startNum, int endNum, string prop, string order)
--
Gitblit v1.9.3