From e7438c176acf8d18c07e1a0946770e0f6cb6fadf Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 21 十一月 2022 15:09:29 +0800
Subject: [PATCH] 灵翔的登陆接口存redis加企业区分

---
 VueWebApi/obj/Release/VueWebApi.pdb                             |    0 
 VueWebApi/DLL/DAL/ProductModelDAL.cs                            |   35 ++++++++++-------
 VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.dll      |    0 
 VueWebApi/Logs/2022-11-21.TXT                                   |    0 
 .vs/VueWebApi/v16/.suo                                          |    0 
 VueWebApi/Web.config                                            |    2 +
 VueWebApi/bin/VueWebApi.dll                                     |    0 
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs                    |    4 +-
 VueWebApi/Properties/PublishProfiles/FolderProfile1.pubxml.user |   10 ++--
 VueWebApi/DLL/DAL/LoginDAL.cs                                   |    5 ++
 VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.pdb      |    0 
 VueWebApi/obj/Release/VueWebApi.dll                             |    0 
 VueWebApi/Logs/2022-11-19.TXT                                   |    0 
 VueWebApi/DLL/DAL/ReportManagerDAL.cs                           |    4 +-
 VueWebApi/bin/VueWebApi.pdb                                     |    0 
 VueWebApi/Controllers/LoginController.cs                        |   16 +++++---
 16 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/.vs/VueWebApi/v16/.suo b/.vs/VueWebApi/v16/.suo
index 9fb2d61..28c7375 100644
--- a/.vs/VueWebApi/v16/.suo
+++ b/.vs/VueWebApi/v16/.suo
Binary files differ
diff --git a/VueWebApi/Controllers/LoginController.cs b/VueWebApi/Controllers/LoginController.cs
index bfdd314..35f5cd8 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,9 @@
         //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
         ToMessage mes = new ToMessage();
         RedisHelper redis = new RedisHelper();
+        //鑾峰彇浼佷笟閰嶇疆Enterprise
+        private static readonly string Enterprise = ConfigurationManager.AppSettings["Enterprise"];
+
 
         #region[PC鐢ㄦ埛鐧诲綍]
         /// <summary>
@@ -46,18 +50,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 +73,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 +84,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 +133,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/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/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index 34123d3..054df89 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -1340,6 +1340,7 @@
                     mes.count = 0;
                     mes.Message = "宸ヨ壓璺嚎宸茶宸ュ崟寮曠敤锛屼笉鍏佽鍒犻櫎!";
                     mes.data = null;
+                    return mes;
                 }
                 else
                 {
@@ -1353,6 +1354,7 @@
                         mes.count = 0;
                         mes.Message = "宸ヨ壓璺嚎宸茶缃妭鎷嶅伐浠凤紝璇峰厛鍒犻櫎璁剧疆!";
                         mes.data = null;
+                        return mes;
                     }
                     else
                     {
@@ -1366,21 +1368,23 @@
                         sql = @"delete TMateriel_Route  where route_code=@routecode";
                         list.Add(new { str = sql, parm = new { routecode = routecode } });
                     }
-                }
-                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;
+                    bool aa = DapperHelper.DoTransaction(list);
+                    if (aa)
+                    {
+                        mes.code = "200";
+                        mes.count = 0;
+                        mes.Message = "鍒犻櫎鎴愬姛!";
+                        mes.data = null;
+                        return mes;
+                    }
+                    else
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "鍒犻櫎澶辫触!";
+                        mes.data = null;
+                        return mes;
+                    }
                 }
             }
             catch (Exception e)
@@ -1389,6 +1393,7 @@
                 mes.count = 0;
                 mes.Message = e.Message;
                 mes.data = null;
+                return mes;
             }
             return mes;
         }
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index fd8112f..9bcf340 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -2521,7 +2521,7 @@
 
                         }
                         //鏄惁鏈亾
-                        if (json[i].last_choke == "Y")
+                       else if (json[i].last_choke == "Y")
                         {
                             decimal this_reportqty = decimal.Parse(json[i].report_qty.ToString()); //鎶ュ伐鏁伴噺(鍚堟牸)
                             decimal this_ngqty = decimal.Parse(json[i].ng_qty.ToString()); //涓嶈壇鏁伴噺
@@ -3033,7 +3033,7 @@
                                 wo_code=json[i].wo_code.ToString(),
                                 step_seq=json[i].step_seq.ToString(),
                                 step_code=json[i].step_code.ToString(),
-                                repair_qty = decimal.Parse(json[i].report_qty),
+                                report_qty = decimal.Parse(json[i].report_qty),
                                 ng_qty = decimal.Parse(json[i].ng_qty),
                                 bad_qty = decimal.Parse(json[i].bad_qty),
                             }
diff --git a/VueWebApi/DLL/DAL/ReportManagerDAL.cs b/VueWebApi/DLL/DAL/ReportManagerDAL.cs
index 86d55b9..2a1633e 100644
--- a/VueWebApi/DLL/DAL/ReportManagerDAL.cs
+++ b/VueWebApi/DLL/DAL/ReportManagerDAL.cs
@@ -483,7 +483,7 @@
                              left  join TPrteEqp_Stad S on A.materiel_code=S.materiel_code and A.eqp_code=S.eqp_code and A.step_code=S.step_code and K.route_code=S.route_code and K.wkshp_code=S.wkspcode
                              left  join TMateriel_Info M on A.materiel_code=M.partcode
                              left  join TStep T on A.step_code=T.stepcode
-                             left  join TUser U on B.report_person=U.usercode" + search;
+                             left  join TUser U on B.report_person=U.usercode where" + search;
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -564,7 +564,7 @@
                              left  join TMateriel_Info M on A.materiel_code=M.partcode
                              left  join TStep T on A.step_code=T.stepcode
                              left  join TUser U on B.report_person=U.usercode
-                            where " + search;
+                             where " + search;
                 DataTable data = DapperHelper.selectdata(sql, dynamicParams);
                 data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
                 string msg = DownLoad.DataTableToExcel(data, "浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃");
diff --git a/VueWebApi/Logs/2022-11-19.TXT b/VueWebApi/Logs/2022-11-19.TXT
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/VueWebApi/Logs/2022-11-19.TXT
diff --git a/VueWebApi/Logs/2022-11-21.TXT b/VueWebApi/Logs/2022-11-21.TXT
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/VueWebApi/Logs/2022-11-21.TXT
diff --git a/VueWebApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/VueWebApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
index adad2cd..ca65a49 100644
--- a/VueWebApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
+++ b/VueWebApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
@@ -5,7 +5,7 @@
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <_PublishTargetUrl>D:\缃戠珯鍙戝竷\MES鐏电繑</_PublishTargetUrl>
-    <History>True|2022-11-18T08:03:51.0449470Z;False|2022-11-18T16:03:09.4203709+08:00;True|2022-11-18T16:01:39.4591963+08:00;True|2022-11-18T15:18:55.9443587+08:00;True|2022-11-18T15:18:44.4492390+08:00;True|2022-11-18T13:29:22.9601475+08:00;True|2022-11-18T13:29:05.4108151+08:00;True|2022-11-18T13:25:30.9305617+08:00;True|2022-11-17T10:13:35.2543186+08:00;True|2022-11-16T11:50:20.8332089+08:00;True|2022-11-16T10:30:15.8662476+08:00;True|2022-11-16T09:54:50.9630719+08:00;True|2022-11-11T13:23:20.3484151+08:00;True|2022-11-09T13:07:34.9422662+08:00;True|2022-11-09T10:59:58.4912849+08:00;True|2022-11-09T10:11:04.4851324+08:00;True|2022-11-09T10:10:46.8698985+08:00;</History>
+    <History>True|2022-11-21T03:02:59.6984011Z;True|2022-11-21T10:55:50.7022834+08:00;True|2022-11-18T16:03:51.0449470+08:00;False|2022-11-18T16:03:09.4203709+08:00;True|2022-11-18T16:01:39.4591963+08:00;True|2022-11-18T15:18:55.9443587+08:00;True|2022-11-18T15:18:44.4492390+08:00;True|2022-11-18T13:29:22.9601475+08:00;True|2022-11-18T13:29:05.4108151+08:00;True|2022-11-18T13:25:30.9305617+08:00;True|2022-11-17T10:13:35.2543186+08:00;True|2022-11-16T11:50:20.8332089+08:00;True|2022-11-16T10:30:15.8662476+08:00;True|2022-11-16T09:54:50.9630719+08:00;True|2022-11-11T13:23:20.3484151+08:00;True|2022-11-09T13:07:34.9422662+08:00;True|2022-11-09T10:59:58.4912849+08:00;True|2022-11-09T10:11:04.4851324+08:00;True|2022-11-09T10:10:46.8698985+08:00;</History>
   </PropertyGroup>
   <ItemGroup>
     <File Include="Areas/HelpPage/HelpPage.css">
@@ -705,13 +705,13 @@
       <publishTime>12/24/2021 15:38:29</publishTime>
     </File>
     <File Include="bin/VueWebApi.dll">
-      <publishTime>11/18/2022 16:03:45</publishTime>
+      <publishTime>11/21/2022 11:02:53</publishTime>
     </File>
     <File Include="bin/VueWebApi.pdb">
-      <publishTime>11/18/2022 16:03:45</publishTime>
+      <publishTime>11/21/2022 11:02:53</publishTime>
     </File>
     <File Include="bin/VueWebApi.xml">
-      <publishTime>11/18/2022 16:03:45</publishTime>
+      <publishTime>11/21/2022 11:02:53</publishTime>
     </File>
     <File Include="bin/WebActivatorEx.dll">
       <publishTime>02/08/2013 16:42:28</publishTime>
@@ -1074,7 +1074,7 @@
       <publishTime>06/16/2022 13:39:23</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>11/18/2022 16:03:50</publishTime>
+      <publishTime>11/21/2022 11:02:59</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/VueWebApi/Web.config b/VueWebApi/Web.config
index 6271d16..f63f699 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_lx;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="LX" />
 		<!--redis鏁版嵁搴撻摼鎺ラ厤缃甶p-->
 		<add key="RedisConnIp" value="127.0.0.1" />
 		<!--redis鏁版嵁搴撻摼鎺ラ厤缃鍙e彿-->
diff --git a/VueWebApi/bin/VueWebApi.dll b/VueWebApi/bin/VueWebApi.dll
index 7cd1d2a..4b43339 100644
--- a/VueWebApi/bin/VueWebApi.dll
+++ b/VueWebApi/bin/VueWebApi.dll
Binary files differ
diff --git a/VueWebApi/bin/VueWebApi.pdb b/VueWebApi/bin/VueWebApi.pdb
index 35a1514..5c90e18 100644
--- a/VueWebApi/bin/VueWebApi.pdb
+++ b/VueWebApi/bin/VueWebApi.pdb
Binary files differ
diff --git a/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.dll b/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.dll
index 7cd1d2a..4b43339 100644
--- a/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.dll
+++ b/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.dll
Binary files differ
diff --git a/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.pdb b/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.pdb
index 35a1514..5c90e18 100644
--- a/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.pdb
+++ b/VueWebApi/obj/Release/Package/PackageTmp/bin/VueWebApi.pdb
Binary files differ
diff --git a/VueWebApi/obj/Release/VueWebApi.dll b/VueWebApi/obj/Release/VueWebApi.dll
index 7cd1d2a..4b43339 100644
--- a/VueWebApi/obj/Release/VueWebApi.dll
+++ b/VueWebApi/obj/Release/VueWebApi.dll
Binary files differ
diff --git a/VueWebApi/obj/Release/VueWebApi.pdb b/VueWebApi/obj/Release/VueWebApi.pdb
index 35a1514..5c90e18 100644
--- a/VueWebApi/obj/Release/VueWebApi.pdb
+++ b/VueWebApi/obj/Release/VueWebApi.pdb
Binary files differ

--
Gitblit v1.9.3