From 0aae85d3e241b2aa415c96f12e9f6ac415cffa49 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 28 九月 2022 13:38:47 +0800
Subject: [PATCH] 登录redis存储判断是否失效过滤器修改 设备维修、维修验证接口来发
---
VueWebApi/DLL/DAL/AppDeviceManageDAL.cs | 322 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 318 insertions(+), 4 deletions(-)
diff --git a/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs b/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
index 9af4163..af0faf6 100644
--- a/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
+++ b/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
@@ -467,7 +467,7 @@
{
HttpPostedFile file = files[i];
string imgName = DateTime.Now.ToString("yyyyMMddhhmmss");
- string imgPath = "/DeviceImage/image1/" + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕
+ string imgPath = "/DeviceImage/image1/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕
string AbsolutePath = System.Web.HttpContext.Current.Server.MapPath(imgPath);
file.SaveAs(AbsolutePath); //灏嗕笂浼犵殑涓滆タ淇濆瓨
//寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
@@ -486,7 +486,7 @@
}
}
- //鍐欏叆缁翠慨璁板綍琛�
+ //鍐欏叆缁翠慨鐢宠璁板綍琛�
sql = @"insert into TEqp_RepairRequest(docu_code,docu_date,status,wksp_code,eqp_code,request_person,request_date,failure_descript,source)
values(@docu_code,@docu_date,@status,@wksp_code,@eqp_code,@request_person,@request_date,@failure_descript,@source)";
list.Add(new
@@ -501,10 +501,14 @@
eqp_code = eqpcode,
request_person = username,
request_date = DateTime.Now.ToString(),
- failure_descript= faultdescr,
- source=faultsourcecode
+ failure_descript = faultdescr,
+ source = faultsourcecode
}
});
+ //鍥炲啓瀛楀吀琛�,鏇存柊褰撳墠娴佹按鍙�
+ sql = @"update T_CodeRules set value=@cunm2 where rightcode=@RightCode";
+ list.Add(new { str = sql, parm = new { cunm2 = numvalue, RightCode = "2042" } });
+
bool aa = DapperHelper.DoTransaction(list);
if (aa)
{
@@ -533,6 +537,316 @@
#endregion
+ #region[璁惧缁翠慨鍒楄〃]
+ public static ToMessage RepairScanDeviceQrCodeData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧缁翠慨鍒楄〃宸茬敵璇锋湭缁翠慨鐨勬暟鎹�
+ sql = @"select A.docu_code,B.code as eqpcode,B.name as eqpname,
+ T.org_code as wksp_code,T.org_name as wksp_name,
+ A.request_person,A.request_date,
+ (case when A.source='A' then '鐐规' when A.source='B' then '淇濆吇' when A.source='C' then '瀹夌伅' when A.source='D' then '鎵嬪伐' end) as source,
+ A.failure_descript
+ from TEqp_RepairRequest A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ inner join TOrganization T on A.wksp_code=T.org_code
+ where T.description='W'and A.status='REPA'";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ 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 RepairScanDeviceSave(string username, string eqpcode, string wkshpcode, string faultdescr, string is_stoprepair, string repaircontent, string replaceparts, HttpFileCollection files)
+ {
+ var sql = "";
+ string wxwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncode.EncodingSeach("2043"); //鐢熸垚鍗曞彿
+ if (mes.code == "300")
+ {
+ mes.Message = "鐢熸垚鍗曞彿澶辫触,璇疯缃紪鐮佷负銆�2043銆戠殑缂栫爜瑙勫垯";
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ wxwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ //楠岃瘉涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+ string imgPath1 = "", imgPath2 = "", AbsolutePath = "";
+ HttpPostedFile file = files[i];
+ string imgName = DateTime.Now.ToString("yyyyMMddhhmmss");
+ string keyname = files.AllKeys[i].ToString();
+ if (keyname == "files1")
+ {
+ imgPath1 = "/DeviceImage/image1/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕
+ AbsolutePath = System.Web.HttpContext.Current.Server.MapPath(imgPath1);
+ }
+ if (keyname == "files2")
+ {
+ imgPath2 = "/DeviceImage/image2/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕
+ AbsolutePath = System.Web.HttpContext.Current.Server.MapPath(imgPath2);
+ }
+
+ file.SaveAs(AbsolutePath); //灏嗕笂浼犵殑涓滆タ淇濆瓨
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1_url,img2_url)
+ values(@source_wo,@wo_type,@img1_url,@img2_url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = wxwo,
+ wo_type = "COMP",
+ img1_url = imgPath1,
+ img2_url = imgPath2
+ }
+ });
+ }
+ }
+ //鍐欏叆缁翠慨璁板綍琛�
+ sql = @"insert into TEqp_Repair(repair_code,docu_date,status,wksp_code,eqp_code,repair_person,repair_date,repair_content,repair_part,failure_descript,is_shutdown)
+ values(@repair_code,@docu_date,@status,@wksp_code,@eqp_code,@repair_person,@repair_date,@repair_content,@repair_part,@failure_descript,@is_shutdown)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_code = wxwo,
+ docu_date = DateTime.Now.ToString(),
+ status = "COMP",
+ wksp_code = wkshpcode,
+ eqp_code = eqpcode,
+ repair_person = username,
+ repair_date = DateTime.Now.ToString(),
+ repair_content = repaircontent,
+ repair_part = replaceparts,
+ failure_descript = faultdescr,
+ is_shutdown = is_stoprepair
+ }
+ });
+
+ //鍥炲啓瀛楀吀琛�,鏇存柊褰撳墠娴佹按鍙�
+ sql = @"update T_CodeRules set value=@cunm2 where rightcode=@RightCode";
+ list.Add(new { str = sql, parm = new { cunm2 = numvalue, RightCode = "2043" } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "缁翠慨鐢宠鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "缁翠慨鐢宠澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[缁翠慨楠岃瘉鍒楄〃]
+ public static ToMessage RepairVerificationScanDeviceData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧缁翠慨鍒楄〃宸茬淮淇殑鏁版嵁
+ sql = @"select A.repair_code,B.code as eqpcode,B.name as eqpname,
+ T.org_code as wksp_code,T.org_name as wksp_name,
+ A.repair_person,A.repair_date,A.is_shutdown,
+ A.failure_descript
+ from TEqp_Repair A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ inner join TOrganization T on A.wksp_code=T.org_code
+ where T.description='W'and A.status='COMP'";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ 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 RepairVerificationScanDeviceDataSub(string eqpcode, string wkshpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<string, object> dict = new Dictionary<string, object>();
+ try
+ {
+ //鏍规嵁璁惧缂栫爜\杞﹂棿缂栫爜鑾峰彇缁翠慨璇︽儏
+ sql = @"select repair_code,failure_descript,is_shutdown,repair_content,repair_part
+ from TEqp_Repair
+ where wksp_code=@wkshpcode and eqp_code=@eqpcode";
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ dict.Add("failure_descript", data.Rows[0]["failure_descript"].ToString()); //鏁呴殰鎻忚堪
+
+ //鑾峰彇鏁呴殰涓婁紶鍥剧墖
+ sql = @"select img1url from TEqp_RepairImage where source_wo=@source_wo and wo_type='COMP'";
+ dynamicParams.Add("@source_wo", data.Rows[0]["repair_code"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ dict.Add("failure_descriptimg", data0); //鏁呴殰涓婁紶鍥剧墖
+ }
+ if (data.Rows[0]["is_shutdown"].ToString() == "N") //鏄惁鍋滄満缁翠慨
+ {
+ dict.Add("repair_content", data.Rows[0]["repair_content"].ToString()); //缁翠慨鍐呭
+ dict.Add("repair_part", data.Rows[0]["repair_part"].ToString()); //鏇存崲澶囦欢
+
+ //鑾峰彇鏇存崲澶囦欢涓婁紶鍥剧墖
+ sql = @"select img1ur2 from TEqp_RepairImage where source_wo=@source_wo and wo_type='COMP'";
+ dynamicParams.Add("@source_wo", data.Rows[0]["repair_code"].ToString());
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ dict.Add("repair_partimage", data1); //鏁呴殰涓婁紶鍥剧墖
+ }
+ }
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = dict;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.Message = "鏆傛棤缁翠慨璁板綍!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉鎻愪氦]
+ public static ToMessage RepairVerificationScanDeviceSave(string username, string repairwo, string eqpcode, string wkshpcode, string result)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //鏇存柊璁惧缁翠慨璁板綍楠岃瘉浜哄憳銆侀獙璇佹椂闂淬�侀獙璇佺粨鏋溿�侀獙璇佺姸鎬�
+ sql = @"update TEqp_Repair set status=@status,is_verifi=@is_verifi,verify_result=@verify_result,verify_person=@verify_person,verify_date=@verify_date
+ where repair_code=@repair_code and wksp_code=@wksp_code and eqp_code=@eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = "CONFIR",
+ is_verifi = "Y",
+ verify_result=result,
+ verify_person=username,
+ verify_date= DateTime.Now.ToString(),
+ repair_code=repairwo,
+ wksp_code=wkshpcode,
+ eqp_code=eqpcode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "缁翠慨楠岃瘉鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "缁翠慨楠岃瘉澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
#region[瀹夌伅鍛煎彨鎵弿宸ヤ綅]
--
Gitblit v1.9.3