From ac3fdc886f4f5f15f3e0a77c315ba0571beed94a Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 01 三月 2023 10:07:20 +0800
Subject: [PATCH] 用户关联工序;工序进出站自动匹配对应流水号

---
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs |   94 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 4fce0da..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")]
@@ -149,7 +219,7 @@
         {
             try
             {
-
+                List<object> columnNameList = new List<object>();
                 //寰楀埌淇℃伅
                 ds = oCN.RunProcReturn("exec h_p_Sc_ProcExchBilltransRelationQty " + HProcExchHinteID + "", "h_p_Sc_ProcExchBilltransRelationQty");
                 //鍐欏叆淇℃伅
@@ -161,10 +231,20 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
             }
             catch (Exception e)
@@ -202,7 +282,8 @@
                     return objJsonResult;
                 }
 
-                List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2); 
+                List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2);
+                DBUtility.ClsPub.CurUserName = user;
                 long HMainInterID = 0;
                 HMainInterID = list[0].HMainInterID;
                 string eventType = list[0].eventType;
@@ -233,7 +314,7 @@
                 double HMoney = list[0].HMoney;//閲戦
                 string HRemark = list[0].HRemark;//澶囨敞
                 double HTaxRate = list[0].HTaxRate;//绋庣巼
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
                 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
@@ -263,7 +344,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -365,6 +446,7 @@
                     ",HTaxRate=" + HTaxRate +
                     ",HMaterID=" + HMaterID +
                     ",HProcID=" + HProcID +
+                    ",HEmpID=" + HEmpID +
                     ",HProcNo=" + HProcNo +
                     ",HOrderProcNO='" + HOrderProcNO + "'" +
                     " where HInterID=" + HInterID);
@@ -423,7 +505,7 @@
                 }
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
-                objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+                objJsonResult.Message = "鎿嶄綔鍗曟嵁鎴愬姛锛�";
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
             }

--
Gitblit v1.9.1