From 1d97bffe5449a6b3e29d619f5a45400483fb6748 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 01 十二月 2025 15:41:59 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/基础资料/基础资料/Gy_MateNumRelationController.cs |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 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_MateNumRelationController.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_MateNumRelationController.cs"
index 0551520..70e7ed4 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_MateNumRelationController.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_MateNumRelationController.cs"
@@ -468,14 +468,14 @@
                 var model = oMain["model"].ToString();
                 LogService.Write("1" + model);
                 //鍙嶅簭鍒楀寲
-                model = "[" + model + "]";
+                //model = "[" + model + "]";
                 List<Gy_MateNumRelation_Sec> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MateNumRelation_Sec>>(model);
                 string sql = string.Empty;              
                 oCN.BeginTran();
                 foreach (var item in lsmain)
                 {
                     // 浣跨敤褰撳墠item鐨凥ItemID鍒犻櫎
-                    sql = $"delete from  Gy_MateNumRelation_Sec where HItemID = {item.HItemID}";
+                    sql = $"delete from  Gy_MateNumRelation_Sec where HItemID = {item.HItemID} and HMaterID={item.HMaterID} ";
                     oCN.RunProc(sql);                  
                     // 寮�鍚痠dentity_insert
                     sql = "set identity_insert Gy_MateNumRelation_Sec on";
@@ -483,28 +483,29 @@
 
                     LogService.Write("瀹㈡埛鐗╂枡瀵瑰簲琛�" + @"Insert Into Gy_MateNumRelation_Sec " +
                           "(HItemID,HCusID,HCusRelationNumber,HCusRelationName,HMaterID" +
-                          ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker" +
+                          ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker,HShopID" +
                           ") " +
                           " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
-                          "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker +
+                          "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker + "','" + item.HShopID + 
                           "') ");
 
                     // 鎻掑叆褰撳墠item鐨勮褰�
                     sql = "Insert Into Gy_MateNumRelation_Sec " +
                           "(HItemID,HCusID,HCusRelationNumber,HCusRelationName,HMaterID" +
-                          ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker" +
+                          ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker,HShopID" +
                           ") " +
                           " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
-                          "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker +
+                          "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker + "','" + item.HShopID +
                          "') ";
                     oCN.RunProc(sql);                   
                     // 鍏抽棴identity_insert
                     sql = "set identity_insert Gy_MateNumRelation_Sec off";
                     oCN.RunProc(sql);
 
-                    // 鎻愪氦褰撳墠浜嬪姟
-                    oCN.Commit();
                 }
+
+                // 鎻愪氦褰撳墠浜嬪姟
+                oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";

--
Gitblit v1.9.1