From 1a94e0e270668ef1cfbcd5043b72bc6591a50706 Mon Sep 17 00:00:00 2001 From: llj <132905093+newwwwwwtree@users.noreply.github.com> Date: 星期四, 07 八月 2025 15:18:46 +0800 Subject: [PATCH] 价目表新增审核按钮无效修理bug --- WebAPI/DLL/ClsGy_Material_Ctl.cs | 68 +++++++++++++++++++++++++++++++++- 1 files changed, 66 insertions(+), 2 deletions(-) diff --git a/WebAPI/DLL/ClsGy_Material_Ctl.cs b/WebAPI/DLL/ClsGy_Material_Ctl.cs index d9a6196..17640f7 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 { @@ -30,7 +32,7 @@ ",HMaterRuleType,HColorNo,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost,HOnceRightRate" + ",HHeight_M,HInches_M,HAl1Long_M,HDensity_M,HTela_M,HUnderTela_M,HSizing_M,HQtyDec,HPriceDec,HMoneyDec,HTaxRate,HProfitRate" + ",HLotcardQty" + - ",HProjectBillMainID,HDivisionID" + + ",HProjectBillMainID,HDivisionID,HCubicleQty,HMakeEmp" + ") " + " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() + ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" + @@ -56,6 +58,8 @@ "," + oModel.HLotcardQty + ",'" + oModel.HProjectBillMainID + "','" + oModel.HDivisionID + + "','" + oModel.HCubicleQty + + "','" + oModel.HMakeEmp + "')", ref DBUtility.ClsPub.sExeReturnInfo); //淇敼涓婄骇涓洪潪鏈骇浠g爜 oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); @@ -227,7 +231,8 @@ ",HProfitRate=" + oModel.HProfitRate.ToString() + ",HProjectBillMainID='" + oModel.HProjectBillMainID + "'" + ",HDivisionID='" + oModel.HDivisionID + "'" + - ",HLotcardQty='" + oModel.HLotcardQty + "'" + + ",HLotcardQty='" + oModel.HLotcardQty + "'" + + ",HCubicleQty='" + oModel.HCubicleQty + "'" + " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); //淇敼瀛愰」鐩唬鐮� oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); @@ -243,6 +248,65 @@ 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, List<Models.ClsGy_Material_Model> models) + { + var sql = "Update " + MvarItemKey + " set "; + sql += paramStr; + sql += (" Where HItemID in " + HItemID_List); + // 杈撳嚭 淇敼璇彞鍒版棩蹇楁枃浠� + LogService.Write("Update: " + sql); + oCn.BeginTran(); + oCn.RunProc(sql, ref DBUtility.ClsPub.sExeReturnInfo); + foreach (var model in models) + { + // 杈撳嚭 淇敼鍓嶅璞� 鍒� 鏃ュ織鏂囦欢 + LogService.Write(model); + //淇敼瀛愰」鐩唬鐮� + oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + model.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + model.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCn.Commit(); + return true; + } + //鏍规嵁浠g爜鍒ゆ柇淇℃伅 public override bool HavParentCode(string sCode, Int64 sItemID) { -- Gitblit v1.9.1