From 0484048734d67b9bde2cf69d47b4e169449382dc Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 22 五月 2024 17:32:23 +0800
Subject: [PATCH] 器具档案 增加 子表 和网格; Gy_MouldFileSub_SubMater 用来显示 这个 器具的 的 子配件(或子器具); (子表 非必录,允许为空)

---
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index 02ff4d3..a4843a3 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -1031,7 +1031,7 @@
                 return objJsonResult;
             }
             //淇濆瓨涓昏〃
-            objJsonResult = AddBillMain(msg2);
+            objJsonResult = AddBillMain(msg1);
             if (objJsonResult.code == "0")
             {
                 oCN.RollBack();
@@ -1048,8 +1048,13 @@
             return objJsonResult;
         }
 
-        public json AddBillMain(string msg2)
+        public json AddBillMain(string msg1)
         {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();//妯″潡鏉冮檺
+            string msg4 = sArray[2].ToString();//褰撳墠浜�
+            string msg5 = sArray[3].ToString();//瀛愯〃鏁版嵁
             try
             {
                 msg2 = "[" + msg2.ToString() + "]";
@@ -1130,7 +1135,6 @@
                 ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
                 ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ") ");
 
-
                 //瀛愯〃
                 oCN.RunProc("Insert into Gy_MouldFileSub " +
                     " (HInterID,HEntryID,HRemark" +
@@ -1139,6 +1143,8 @@
                 " values('" + HInterID + "',0,''" +
                 ",0,0,'','',0,0 " +
                 ") ");
+
+                objJsonResult = AddBillSub(msg5,HInterID, HBillNo);
 
                 if (objJsonResult.code == "0")
                 {
@@ -1181,6 +1187,7 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();//妯″潡鏉冮檺
             string msg4 = sArray[2].ToString();//褰撳墠浜�
+            string msg5 = sArray[3].ToString();//瀛愯〃鏁版嵁
             try
             {
                 if (!DBUtility.ClsPub.Security_Log(msg3, 1, false, msg4))
@@ -1311,7 +1318,11 @@
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                 //灏嗕笂绾� 涓洪潪鏈骇
                 // oCN.RunProc("Update Gy_Department set HEndflag=0 where HItemID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                //
+
+                oCN.RunProc("delete from Gy_MouldFileSub_SubMater where HInterID='" + HInterID + "'");
+
+                objJsonResult = AddBillSub(msg5, HInterID, HBillNo);
+
                 oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -1330,6 +1341,39 @@
             }
         }
 
+        public json AddBillSub(string msg5, long HInterID, string HBillNo)
+        {
+            List<Gy_MouldFileSub_SubMater> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MouldFileSub_SubMater>>(msg5);
+            int i = 0;                                          //浣滀负瀛愯〃鍐呯爜
+            foreach (Gy_MouldFileSub_SubMater oSub in DetailColl)
+            {
+                i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+                int HEntryID = i;
+                string HRemark = oSub.HRemark;
+                int HMouldFileID = oSub.HMouldFileID;
+                DateTime HUnionDate = oSub.HUnionDate;
+                            
+                string sql = "insert into Gy_MouldFileSub_SubMater" +
+                    "(HInterID,HBillNo_bak,HEntryID,HRemark,HMouldFileID,HUnionDate) " +
+                    "values(" +
+                    "" + HInterID +
+                    ",'" + HBillNo +
+                    "'," + HEntryID +
+                    ",'" + HRemark +
+                    "','" + HMouldFileID +
+                    "','" + HUnionDate +                   
+                    "')";
+
+                oCN.RunProc(sql);
+            }
+
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = null;
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
 
         /// <summary>
         /// 纾ㄥ叿妗f淇敼鎸夐挳鏂规硶-璁$畻涓嬫淇濆吇/鏍℃鏃ユ湡-鑾峰彇妗f鏈�杩戜竴娆$殑淇濆吇璁板綍

--
Gitblit v1.9.1