From 6708f9f2ddc7471924aed87cae617bb042eaa9f8 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 21 十一月 2022 15:11:19 +0800
Subject: [PATCH] 富尔达的登陆接口存redis加企业区分,车间生产数字化看板接口开发
---
VueWebApi/DLL/BLL/KanBanManagerentBLL.cs | 7 +++
VueWebApi/DLL/DAL/LoginDAL.cs | 5 ++
VueWebApi/DLL/DAL/KanBanManagerentDAL.cs | 30 +++++++++++++++
VueWebApi/Controllers/KanBanManagerentController.cs | 14 +++++++
.vs/VueWebApi/v16/.suo | 0
VueWebApi/Web.config | 2 +
VueWebApi/Controllers/LoginController.cs | 17 +++++---
7 files changed, 68 insertions(+), 7 deletions(-)
diff --git a/.vs/VueWebApi/v16/.suo b/.vs/VueWebApi/v16/.suo
index 098a97b..5cbb710 100644
--- a/.vs/VueWebApi/v16/.suo
+++ b/.vs/VueWebApi/v16/.suo
Binary files differ
diff --git a/VueWebApi/Controllers/KanBanManagerentController.cs b/VueWebApi/Controllers/KanBanManagerentController.cs
index abe3837..93409e1 100644
--- a/VueWebApi/Controllers/KanBanManagerentController.cs
+++ b/VueWebApi/Controllers/KanBanManagerentController.cs
@@ -226,5 +226,19 @@
return TJson.toJson(mes);
}
#endregion
+
+ #region[瀵屽皵杈捐溅闂寸敓浜ф暟瀛楀寲鐪嬫澘锛岀敓浜т俊鎭痌
+ /// <summary>
+ /// 瀵屽皵杈捐溅闂寸敓浜ф暟瀛楀寲鐪嬫澘锛岀敓浜т俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WkshpContentData")]
+ [HttpGet]
+ public HttpResponseMessage WkshpContentData()
+ {
+ mes = KanBanManagerentBLL.WkshpContentData();
+ return TJson.toJson(mes);
+ }
+ #endregion
}
}
diff --git a/VueWebApi/Controllers/LoginController.cs b/VueWebApi/Controllers/LoginController.cs
index bfdd314..a47ecfe 100644
--- a/VueWebApi/Controllers/LoginController.cs
+++ b/VueWebApi/Controllers/LoginController.cs
@@ -1,6 +1,7 @@
锘縰sing Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
@@ -20,6 +21,10 @@
//瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
ToMessage mes = new ToMessage();
RedisHelper redis = new RedisHelper();
+
+ //鑾峰彇浼佷笟閰嶇疆Enterprise
+ private static readonly string Enterprise = ConfigurationManager.AppSettings["Enterprise"];
+
#region[PC鐢ㄦ埛鐧诲綍]
/// <summary>
@@ -46,18 +51,18 @@
ms.username = dt.Rows[0]["USERNAME"].ToString();
ms.password = dt.Rows[0]["PASSWORD"].ToString();
ms.usertype = usertype;
- ms.rediskey = "LoginUserID" + ms.usertype + ms.userid;
+ ms.rediskey = Enterprise+"LoginUserID" + ms.usertype + ms.userid;
mss.Add(ms);
HttpContext.Current.Session.Clear(); //浠庝細璇濈姸鎬侀泦鍚堜腑鍒犻櫎鎵�鏈夌殑閿��
//HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
//User loginUser = JsonConvert.DeserializeObject<User>(HttpContext.Current.Session["User"].ToString());
User loginUser = JsonConvert.DeserializeObject<User>(JsonConvert.SerializeObject(ms));
//濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
- if (redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 0) == null)
+ if (redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 0) == null)
{
//redis.Remove("LoginUserID" + ms.userid, 0);
//鍐欏叆redis(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
- redis.Set<User>("LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 0);
+ redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, ms, redis.secondsTimeOut, 0);
//鐧诲綍淇℃伅鍐欏叆session
HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
//鍐欏叆鐧诲綍鎿嶄綔璁板綍
@@ -69,7 +74,7 @@
else //濡傛灉瀛樺湪
{
//鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
- User r_loginUser = redis.Get<User>("LoginUserID" + ms.usertype + ms.userid, 0);
+ User r_loginUser = redis.Get<User>(Enterprise+"LoginUserID" + ms.usertype + ms.userid, 0);
//濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
if ((r_loginUser.usercode + r_loginUser.usertype).Equals(loginUser.usercode + loginUser.usertype))
{
@@ -80,7 +85,7 @@
else
{
//閲嶇疆杩囨湡鏃堕棿(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
- redis.Set<User>("LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 0);
+ redis.Set<User>(Enterprise+"LoginUserID" + ms.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 0);
//鐧诲綍淇℃伅鍐欏叆session
HttpContext.Current.Session["User"] = JsonConvert.SerializeObject(ms);
//鍐欏叆鐧诲綍鎿嶄綔璁板綍
@@ -129,7 +134,7 @@
{
try
{
- redis.Remove("LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
+ redis.Remove(Enterprise+"LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
mes.code = "200";
mes.count = 0;
mes.Message = "寮哄埗涓嬬嚎鎴愬姛!";
diff --git a/VueWebApi/DLL/BLL/KanBanManagerentBLL.cs b/VueWebApi/DLL/BLL/KanBanManagerentBLL.cs
index 862beb4..c645d9a 100644
--- a/VueWebApi/DLL/BLL/KanBanManagerentBLL.cs
+++ b/VueWebApi/DLL/BLL/KanBanManagerentBLL.cs
@@ -113,5 +113,12 @@
return KanBanManagerentDAL.WkshpLineData(lineCode);
}
#endregion
+
+ #region[瀵屽皵杈捐溅闂寸敓浜ф暟瀛楀寲鐪嬫澘锛岀敓浜т俊鎭痌
+ public static ToMessage WkshpContentData()
+ {
+ return KanBanManagerentDAL.WkshpContentData();
+ }
+ #endregion
}
}
\ No newline at end of file
diff --git a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
index b2fa817..aa240b5 100644
--- a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
+++ b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -487,6 +487,36 @@
return mes;
}
#endregion
+
+ #region[瀵屽皵杈捐溅闂寸敓浜ф暟瀛楀寲鐪嬫澘锛岀敓浜т俊鎭痌
+ public static ToMessage WkshpContentData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇宸ュ崟鎶ュ伐淇℃伅,鎶ュ伐鏁伴噺>0 涓斿伐鍗曠姸鎬佷负闈炲叧闂姸鎬�
+ sql = @"select A.wo_code,M.partname,B.seq,T.stepname,B.plan_qty,B.good_qty,B.ng_qty,B.bad_qty from TK_Wrk_Man A
+ inner join TK_Wrk_Step B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on A.materiel_code=M.partcode
+ left join TStep T on B.step_code=T.stepcode
+ where A.status<>'CLOSED'
+ order by A.wo_code,B.seq";
+ 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
+
}
}
diff --git a/VueWebApi/DLL/DAL/LoginDAL.cs b/VueWebApi/DLL/DAL/LoginDAL.cs
index ce627d3..234f067 100644
--- a/VueWebApi/DLL/DAL/LoginDAL.cs
+++ b/VueWebApi/DLL/DAL/LoginDAL.cs
@@ -1,6 +1,7 @@
锘縰sing Dapper;
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
@@ -19,6 +20,8 @@
public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
public static string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
+ //鑾峰彇浼佷笟閰嶇疆Enterprise
+ private static readonly string Enterprise = ConfigurationManager.AppSettings["Enterprise"];
#region [鐧诲綍鏌ヨ]
public static DataTable LoginSearch(string username, string password)
@@ -239,7 +242,7 @@
cont = DapperHelper.SQL(sql, dynamicParams);
if (cont > 0)
{
- redis.Remove("LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
+ redis.Remove(Enterprise+"LoginUserID" + usertype + userid, 0); //鍒犻櫎redis
mes.code = "200";
mes.count = 0;
mes.Message = "鐧诲嚭鎴愬姛!";
diff --git a/VueWebApi/Web.config b/VueWebApi/Web.config
index db1cd82..1818056 100644
--- a/VueWebApi/Web.config
+++ b/VueWebApi/Web.config
@@ -18,6 +18,8 @@
<add key="DBServer" value="Data Source=121.196.36.24,1533;Initial Catalog=vmes_dd;User ID=sa;Password=xkd@20220602;pooling=false" />
<!--澶у矝鏈嶅姟鍣ㄧ幆澧�-->
<!--<add key="DBServer" value="Data Source=192.168.2.138;Initial Catalog=vmes;User ID=sa;Password=Dd@20220727;pooling=false" />-->
+ <!--redis浼佷笟閰嶇疆-->
+ <add key="Enterprise" value="FED" />
<!--redis鏁版嵁搴撻摼鎺ラ厤缃甶p-->
<add key="RedisConnIp" value="127.0.0.1" />
<!--redis鏁版嵁搴撻摼鎺ラ厤缃鍙e彿-->
--
Gitblit v1.9.3