From 7e739308d74dd7255316aeb20f6d1e75a996bad3 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 22 五月 2025 20:46:08 +0800
Subject: [PATCH] 1

---
 WebAPI/DLL/ClsGy_Material_Ctl.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/WebAPI/DLL/ClsGy_Material_Ctl.cs b/WebAPI/DLL/ClsGy_Material_Ctl.cs
index 2731cf4..a150dc8 100644
--- a/WebAPI/DLL/ClsGy_Material_Ctl.cs
+++ b/WebAPI/DLL/ClsGy_Material_Ctl.cs
@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Data;
+using System.Reflection;
+using System.Linq;
 
 namespace WebAPI.DLL
 {
@@ -246,6 +248,60 @@
                 throw (e);
             }
         }
+
+        /// <summary>
+        /// 鏍规嵁瀛楁鍊煎姩鎬佹洿鏂版暟鎹簱
+        /// </summary>
+        /// <param name="sItemID"></param>
+        /// <returns></returns>
+        public bool ModifyByIDDynamic(Int64 sItemID)
+        {
+            var sql = "Update " + MvarItemKey + " set ";
+            string[] excludeNames = { "HErpclsID", "HEntryID", "HInterID", "HReadonly", "HItemID", "HModifyEmp"};
+            foreach (var fInfo in oModel.GetType().GetFields()
+                .Where(field => !excludeNames.Contains(field.Name))
+                .ToArray())
+            {
+                string fieldName = fInfo.Name;
+                var fieldValue = fInfo.GetValue(oModel);
+                
+                if (fieldValue != null)
+                {
+                    sql += (fieldName + "='" + fieldValue.ToString() + "',");
+                }
+            }
+            sql = sql.Substring(0, sql.Length - 1);
+            sql+= (" Where HItemID = " + sItemID);
+            LogService.Write(sql);
+
+            oCn.BeginTran();
+            oCn.RunProc(sql, ref DBUtility.ClsPub.sExeReturnInfo);
+            //淇敼瀛愰」鐩唬鐮�
+            oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
+            //灏嗕笂绾� 涓洪潪鏈骇
+            oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+            //
+            oCn.Commit();
+            return true;
+        }
+
+        public bool ModifyByIDListDynamic(string HItemID_List, string paramStr)
+        {
+            var sql = "Update " + MvarItemKey + " set ";
+            sql += paramStr;
+            sql += (" Where HItemID in " + HItemID_List);
+
+            oCn.BeginTran();
+            oCn.RunProc(sql, ref DBUtility.ClsPub.sExeReturnInfo);
+            //淇敼瀛愰」鐩唬鐮�
+            oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
+            //灏嗕笂绾� 涓洪潪鏈骇
+            oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+            //
+            oCn.Commit();
+            return true;
+        }
+
         //鏍规嵁浠g爜鍒ゆ柇淇℃伅
         public override bool HavParentCode(string sCode, Int64 sItemID)
         {

--
Gitblit v1.9.1