From 291fdb29daf239a13fcfb3f5e08a2f5bf9167534 Mon Sep 17 00:00:00 2001
From: chenhaozhe <gaozhechen26@gmail.com>
Date: 星期六, 07 三月 2026 17:37:07 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/基础资料/基础资料/Gy_WorkStationBillController.cs |  138 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 103 insertions(+), 35 deletions(-)

diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
index fc0da8a..eff4dab 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
@@ -79,11 +79,14 @@
                 string msg1 = _value.ToString();
                 string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string msg2 = sArray[0].ToString();
-                string msg3 = sArray[1].ToString();
+                string msg3 = sArray[2].ToString();
+                string msg4 = sArray[1].ToString();//瀛愯〃
 
                 //鍙嶅簭鍒楀寲
                 msg2 = "[" + msg2.ToString() + "]";
                 List<WorkStation> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WorkStation>>(msg2);
+                List<WorkStationSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WorkStationSub>>(msg4);
+
 
                 long HItemID = list[0].HItemID;
                 string HNumber = list[0].HNumber;
@@ -98,40 +101,42 @@
                 long HUSEORGID = list[0].HUSEORGID;
                 long HCREATEORGID = list[0].HCREATEORGID;
 
+                
 
-                #region [娉ㄩ噴浠g爜]
-                ////鍒ゆ柇鏉冮檺
-                //if (!ClsPub.Security_Log("Gy_Warehouse_Edit", 1, false, msg3))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
 
-                //if (!DBUtility.ClsPub.AllowNumber(HNumber))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                    #region [娉ㄩ噴浠g爜]
+                    ////鍒ゆ柇鏉冮檺
+                    //if (!ClsPub.Security_Log("Gy_Warehouse_Edit", 1, false, msg3))
+                    //{
+                    //    objJsonResult.code = "0";
+                    //    objJsonResult.count = 0;
+                    //    objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+                    //    objJsonResult.data = null;
+                    //    return objJsonResult;
+                    //}
 
-                //if (oDept.HavSameNumber(HItemID, HNumber))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "浠g爜閲嶅锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
-                #endregion
+                    //if (!DBUtility.ClsPub.AllowNumber(HNumber))
+                    //{
+                    //    objJsonResult.code = "0";
+                    //    objJsonResult.count = 0;
+                    //    objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                    //    objJsonResult.data = null;
+                    //    return objJsonResult;
+                    //}
 
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
-                if (HItemID == 0)
+                    //if (oDept.HavSameNumber(HItemID, HNumber))
+                    //{
+                    //    objJsonResult.code = "0";
+                    //    objJsonResult.count = 0;
+                    //    objJsonResult.Message = "浠g爜閲嶅锛�";
+                    //    objJsonResult.data = null;
+                    //    return objJsonResult;
+                    //}
+                    #endregion
+
+                    //淇濆瓨
+                    //淇濆瓨瀹屾瘯鍚庡鐞�
+                    if (HItemID == 0)
                 {
                     oCN.BeginTran();
                     //鍒ゆ柇浠g爜鏄惁閲嶅
@@ -146,14 +151,46 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-                    oCN.RunProc("Insert into Gy_WorkStation  " +
+                    DataSet ds = oCN.RunProcReturn("Insert into Gy_WorkStation  " +
                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                         ",HLevel,HEndFlag,HStopflag,HRemark," +
-                        "HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime) " +
+                        "HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime) output inserted.HItemID" +//鑾峰彇鍒氭墠鎻掑叆鐨勮嚜澧濱D
                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
-                        "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',"  + HUSEORGID + ",'" + HCREATEORGID + "','" + msg3 + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
+                        "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',"  + HUSEORGID + ",'" + HCREATEORGID + "','" + msg3 + "',getdate())", "Gy_WorkStation");
+                    int HInterID = Convert.ToInt32(ds.Tables[0].Rows[0]["HItemID"]);//鑷ID
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_WorkStation set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    //鍒犻櫎瀛愯〃
+                    oCN.RunProc("Delete From " + "Gy_WorkStationSub" + "  where HInterID=" + HInterID);
+
+                    //鎻掑叆瀛愯〃
+                    if (subList != null && subList.Count > 0)
+                    {
+                        int i = 0;
+                        foreach (Models.WorkStationSub oSub in subList)
+                        {
+
+                            if (oSub == null)
+                                continue;
+                            i++;
+                            string subSql = "insert into Gy_WorkStationSub" +
+                                   "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                                   ",HMaterID" + ")" +
+                                   " values(" +
+                                   HInterID + "," +
+                                   (i) + "," +
+                                   (oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+                                   ( oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+                                   (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+                                   (oSub.HMaterID != 0 ? oSub.HMaterID.ToString() : "0") +
+                                   ")";
+
+                            oCN.RunProc(subSql);
+                        }
+                    }
+
+
+
                     oCN.Commit();
                 }
                 else
@@ -188,6 +225,37 @@
                     //灏嗕笂绾� 涓洪潪鏈骇
                     oCN.RunProc("Update Gy_WorkStation set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                     //
+                    //鍒犻櫎瀛愯〃
+                    oCN.RunProc("Delete From " + "Gy_WorkStationSub" + "  where HInterID=" + HItemID);
+
+                    //鎻掑叆瀛愯〃
+                    if (subList != null && subList.Count > 0)
+                    {
+                        int i = 0;
+                        foreach (Models.WorkStationSub oSub in subList)
+                        {
+
+                            if (oSub == null)
+                                continue;
+                            i++;
+                            string subSql = "insert into Gy_WorkStationSub" +
+                                   "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                                   ",HMaterID" + ")" +
+                                   " values(" +
+                                   HItemID + "," +
+                                   (i) + "," +
+                                   (oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+                                   (oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+                                   (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+                                   (oSub.HMaterID != 0 ? oSub.HMaterID.ToString() : "0") +
+                                   ")";
+
+                            oCN.RunProc(subSql);
+                        }
+                    }
+
+
+
                     oCN.Commit();
                 }
                 objJsonResult.code = "0";
@@ -411,7 +479,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_Gy_WorkStationList where HitemID=" + HInterID, "h_v_Gy_WorkStationList");
+                ds = oCN.RunProcReturn("select * from h_v_Gy_WorkStationEdit where HitemID=" + HInterID, "h_v_Gy_WorkStationList");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";

--
Gitblit v1.9.1