From 9eb6dc41797cbace32a65877067a9c9ac3154f7a Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期日, 09 十月 2022 19:41:15 +0800
Subject: [PATCH] 安灯呼叫、安灯响应接口开发
---
VueWebApi/DLL/DAL/AppDeviceManageDAL.cs | 145 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 126 insertions(+), 19 deletions(-)
diff --git a/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs b/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
index af0faf6..6fa3413 100644
--- a/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
+++ b/VueWebApi/DLL/DAL/AppDeviceManageDAL.cs
@@ -466,13 +466,13 @@
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
- string imgName = DateTime.Now.ToString("yyyyMMddhhmmss");
+ string imgName = DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
string imgPath = "/DeviceImage/image1/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕
string AbsolutePath = System.Web.HttpContext.Current.Server.MapPath(imgPath);
file.SaveAs(AbsolutePath); //灏嗕笂浼犵殑涓滆タ淇濆瓨
//寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
- sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1_url)
- values(@source_wo,@wo_type,@img1_url)";
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1url)
+ values(@source_wo,@wo_type,@img1url)";
list.Add(new
{
str = sql,
@@ -480,7 +480,7 @@
{
source_wo = wxwo,
wo_type = "REPA",
- img1_url = imgPath
+ img1url = imgPath
}
});
}
@@ -538,7 +538,7 @@
#region[璁惧缁翠慨鍒楄〃]
- public static ToMessage RepairScanDeviceQrCodeData()
+ public static ToMessage RepairScanDeviceQrCodeDataList()
{
string sql = "";
try
@@ -606,7 +606,7 @@
{
string imgPath1 = "", imgPath2 = "", AbsolutePath = "";
HttpPostedFile file = files[i];
- string imgName = DateTime.Now.ToString("yyyyMMddhhmmss");
+ string imgName = DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
string keyname = files.AllKeys[i].ToString();
if (keyname == "files1")
{
@@ -621,8 +621,8 @@
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)";
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1url,img2url)
+ values(@source_wo,@wo_type,@img1url,@img2url)";
list.Add(new
{
str = sql,
@@ -630,8 +630,8 @@
{
source_wo = wxwo,
wo_type = "COMP",
- img1_url = imgPath1,
- img2_url = imgPath2
+ img1url = imgPath1,
+ img2url = imgPath2
}
});
}
@@ -811,12 +811,12 @@
{
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
+ verify_result = result,
+ verify_person = username,
+ verify_date = DateTime.Now.ToString(),
+ repair_code = repairwo,
+ wksp_code = wkshpcode,
+ eqp_code = eqpcode
}
});
@@ -897,10 +897,14 @@
try
{
//鏍规嵁杞﹂棿浠g爜鏌ユ壘鍛煎彨绫诲瀷鏁版嵁
- sql = @"select A.id,B.code,B.name from TAnDon_Roul_ConFig A
+ sql = @"select A.id,B.code,B.name,(case when F.type is null then 'N' else 'Y' end) flag
+ from TAnDon_Roul_ConFig A
inner join TAnDonType B on A.andotype_code=B.code
- where A.wkshp_code=@wkshpcode and A.enable='N'";
+ inner join TEqpInfo E on A.wkshp_code=e.wksp_code
+ left join(select type,wkshp_code,eqp_code from TAnDon_Task_Info where eqp_code=@eqpcode and wkshp_code=@wkshpcode and status='START') F on A.wkshp_code=F.wkshp_code and E.code=F.eqp_code
+ where A.wkshp_code=@wkshpcode and E.code=@eqpcode and A.enable='N'";
dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
var data = DapperHelper.selectdata(sql, dynamicParams);
if (data.Rows.Count > 0)
{
@@ -909,6 +913,7 @@
AnDnDate mn = new AnDnDate();
mn.code = data.Rows[i]["CODE"].ToString();
mn.name = data.Rows[i]["NAME"].ToString();
+ mn.flag = data.Rows[i]["FLAG"].ToString();
mn.children = new List<AnDnDateSub>();
//鏍规嵁鍛煎彨绫诲瀷id鏌ユ壘缁戝畾浜哄憳
sql = @"select U.usercode,U.username
@@ -1005,7 +1010,7 @@
{
//鍐欏叆瀹夌伅璁板綍鎺ㄩ�佷汉鍛樿〃
sql = @"insert into TAnDnMessagePush(m_id,wkshp_code,eqp_code,type,resp_user,status)
- values(@m_id,@wkshp_code,@eqp_code,@type,@start_date,@start_user,@status)";
+ values(@m_id,@wkshp_code,@eqp_code,@type,@resp_user,@status)";
list.Add(new
{
str = sql,
@@ -1051,5 +1056,107 @@
#endregion
+
+ #region[瀹夌伅鍝嶅簲鎵弿宸ヤ綅/璁惧]
+ public static ToMessage AppDeviceAnDengLampResponseScanSearch(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂寸殑瀹夌伅鍛煎彨璁板綍
+ sql = @"select A.eqp_code,B.name as eqp_name,T.org_name,A.type as typecode,D.name as typename
+ from TAnDon_Task_Info A
+ left join TEqpInfo B on A.eqp_code=B.code
+ left join TOrganization T on B.wksp_code=T.org_code
+ left join TAnDonType D on A.type=D.code
+ where A.eqp_code=@eqpcode and A.status='START' and B.enable='Y' and T.description='W' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ 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 AppDeviceAnDengLampResponseSave(string username, string eqpcode, string wkshpcode, List<ObjectData> json)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ ChatHub chthub = new ChatHub();
+ try
+ {
+ list.Clear();
+ for (int i = 1; i <= json.Count; i++)
+ {
+ string code = json[i].code.ToString();
+ string name = json[i].name.ToString();
+ //鏇存柊瀹夌伅鍛煎彨琛�
+ sql = @"update TAnDon_Task_Info set resp_user=@resp_user,resp_date=@resp_date,status='CLOSED',taking=cast ( cast ( datediff ( ss, start_date, @resp_date) / ( 60 * 60 * 24 ) as int ) as varchar ) + '澶�' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 86400 / 3600 as int ) as varchar ) + '灏忔椂' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 3600 / 60 as int ) as varchar ) + '鍒�' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 60 as int ) as varchar ) + '绉�'
+ where wkshp_code=@wkshp_code and eqp_code=@eqp_code and type=@type and status='START'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshp_code = wkshpcode,
+ eqp_code = eqpcode,
+ type = code,
+ resp_date = DateTime.Now.ToString(),
+ resp_user = username,
+ status = "START"
+ }
+ });
+ }
+ 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
}
}
\ No newline at end of file
--
Gitblit v1.9.3