From c2a9a460e38c7c196fe98a94e29e6330eac3626f Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 03 三月 2023 14:30:06 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Models/Gy_UserProcess.cs                              |   14 +++
 WebAPI/ListModels.cs                                         |   12 +++
 Pub_Class/CustomerCls/ClsXt_SystemParameter.cs               |    7 +
 WebAPI/Controllers/BLL/Xt_UserController.cs                  |   82 ++++++++++++++++++++
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs |   72 +++++++++++++++++
 Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs           |    3 
 WebAPI/WebAPI.csproj                                         |    1 
 WebAPI/Controllers/PublicPageMethodController.cs             |   36 +++++++++
 8 files changed, 226 insertions(+), 1 deletions(-)

diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
index a24457e..b4ff72d 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
@@ -1493,6 +1493,13 @@
                     {
                         omodel.Sc_MESProceReportWorkBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
+
+                    //=========工序进站单
+                    //自动匹配流水号
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "MES_StationBill_ProcNo")
+                    {
+                        omodel.MES_StationBill_ProcNo = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
                 }
                 sReturn = "显示单据成功!";
                 return true;
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
index 565e056..3127d9a 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
@@ -428,6 +428,9 @@
         //工艺路线
         public string Gy_RoutingBill_SaveAutoLastProc; //保存到数据库时自动加上转工序
 
+        //工序进站单
+        public string MES_StationBill_ProcNo; //自动匹配流水号
+
     }
          
 }
diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index a00f4c3..0ce6b23 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -1137,5 +1137,87 @@
         }
         #endregion
 
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶅伐搴忓垪琛�
+        [Route("Xt_User/ProcessPlaylist")]
+        [HttpGet]
+        public object ProcessPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HProcID,宸ュ簭浠g爜 HProcNumber,宸ュ簭鍚嶇О HProcName from h_v_Gy_UserProcessList where HUserID='" + HUserID + "' ", "h_v_Gy_UserProcessList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲伐搴忎俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢ㄦ埛鍏宠仈宸ュ簭淇濆瓨
+        [Route("Xt_User/SaveUserProcess")]
+        [HttpPost]
+        public object SaveUserProcess([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserProcess> lsmain = new List<Models.Gy_UserProcess>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserProcess(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserByProcess  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserProcess oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserByProcess (HProcID,HUserID) values ('" + oItem.HProcID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 5418030..9f2f099 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -120,7 +120,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏈煡璇㈠埌娴佽浆鍗′俊鎭紒";
+                    objJsonResult.Message = "鏈煡璇㈠埌娴佹按鍙蜂俊鎭紒宸ュ簭鍙烽敊璇垨鑰呭綋鍓嶅伐搴忓彿涓嶅厑璁歌繘绔欙紝璇锋坊鍔狅紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -141,6 +141,76 @@
         }
         #endregion
 
+        #region 鏍规嵁鐧诲綍鐢ㄦ埛鑾峰彇宸ュ簭
+        [Route("Sc_StationInBill/autoGetProcNo")]
+        [HttpGet]
+        public object autoGetProcNo(string HUserName,string HInterID)
+        {
+            string sReturn = "";
+            if (oSystemParameter.ShowBill(ref sReturn) == true)
+            {
+                //绯荤粺鍙傛暟鏄惁涓鸿嚜鍔ㄥ尮閰嶆祦姘村彿,N涓烘墜鍔ㄨ緭鍏ワ紝Y涓鸿嚜鍔ㄥ尮閰�
+                if (oSystemParameter.omodel.MES_StationBill_ProcNo == "Y")
+                {
+                    try
+                    {
+                        if (HUserName == null || HUserName.Equals(""))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //寰楀埌淇℃伅
+                        ds = oCN.RunProcReturn("select  * from h_v_Sc_StationBill_autoGetProcNo  where HInterID = '" + HInterID + "' and 鐢ㄦ埛鍚嶇О ='" + HUserName + "'", "h_v_Sc_StationBill_autoGetProcNo");
+                        //鍐欏叆淇℃伅
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鏈煡璇㈠埌宸ュ簭淇℃伅锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "Sucess锛�";
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+                    catch (Exception e)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "Exception锛�" + e.ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵嬪姩杈撳叆妯″紡";
+                    objJsonResult.data = "";
+                    return objJsonResult;
+                }
+
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "绯荤粺鍙傛暟寮傚父";
+                objJsonResult.data = "";
+                return objJsonResult;
+            }
+
+            
+        }
+        #endregion
+
 
         #region 鍑虹珯姹囨姤鍗曟樉绀鸿〃浣撴槑缁�
         [Route("Cj_StationEntrustInBill/DisBillEntryList")]
diff --git a/WebAPI/Controllers/PublicPageMethodController.cs b/WebAPI/Controllers/PublicPageMethodController.cs
index b6f02c4..2c8564e 100644
--- a/WebAPI/Controllers/PublicPageMethodController.cs
+++ b/WebAPI/Controllers/PublicPageMethodController.cs
@@ -3686,5 +3686,41 @@
         }
         #endregion
 
+        #region 閫夋嫨宸ュ簭鍩虹璧勬枡
+        [Route("PublicPageMethod/ProcessList")]
+        [HttpGet]
+        public object ProcessList(string sWhere)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Process " + sWhere + " Order by HItemID", "Gy_Process");
+                //if (ds == null || ds.Tables[0].Rows.Count == 0)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "false锛�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //else
+                //{
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+                //}
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 3066b3a..5b08958 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -2198,6 +2198,18 @@
         }
 
         /// <summary>
+        /// 鐢ㄦ埛宸ュ簭鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserProcess> getObjectByJson_Gy_UserProcess(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserProcess> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserProcess>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 鐢ㄦ埛-鐢ㄦ埛鍏崇郴淇℃伅琛ㄧ殑json
         /// </summary>
         /// <param name="jsonString"></param>
diff --git a/WebAPI/Models/Gy_UserProcess.cs b/WebAPI/Models/Gy_UserProcess.cs
new file mode 100644
index 0000000..f53a3a1
--- /dev/null
+++ b/WebAPI/Models/Gy_UserProcess.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserProcess
+    {
+        public int HProcID { get; set; }
+        public string HProcNumber { get; set; }
+        public string HProcName { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index e57ce48..a34a10b 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -618,6 +618,7 @@
     <Compile Include="Models\Employee.cs" />
     <Compile Include="Models\Gy_UserCustomer.cs" />
     <Compile Include="Models\Gy_UserMater.cs" />
+    <Compile Include="Models\Gy_UserProcess.cs" />
     <Compile Include="Models\Gy_UserUser.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillMain.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillSub.cs" />

--
Gitblit v1.9.1