From 967c01b8974e90b452f3737b21e142e13ee21cf3 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期三, 12 三月 2025 14:35:33 +0800 Subject: [PATCH] 增加作废、反作废通用方法 --- DBUtility/业务单据/ClsXt_BaseBill.cs | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" index c132dcc..9c0292e 100644 --- "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" +++ "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" @@ -112,6 +112,67 @@ throw (e); } } + //鍙嶄綔搴�(鍖呭惈浣滃簾鍚庢帶鍒躲�佸啓鍏ユ棩蹇�) 2025-03-10 + public bool AbandonCancelltion(Int64 lngBillKey, string HBillNo, string procName, string sUser, ref string sReturn) + { + string sql = ""; + + if (isUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + //寮�鍚簨鍔� + oCn.BeginTran(); + DataSet ds = oCn.RunProcReturn("select * from " + MvarItemKey + " where HInterID=" + lngBillKey.ToString(), MvarItemKey); + if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + oCn.RunProc(" Update " + MvarItemKey + " set HDeleteMan='',HDeleteDate=null,HBillStatus=3 Where HInterID=" + lngBillKey.ToString()); + } + else if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + oCn.RunProc(" Update " + MvarItemKey + " set HDeleteMan='',HDeleteDate=null,HBillStatus=2 Where HInterID=" + lngBillKey.ToString()); + } + else + { + oCn.RunProc(" Update " + MvarItemKey + " set HDeleteMan='',HDeleteDate=null,HBillStatus=1 Where HInterID=" + lngBillKey.ToString()); + } + + + //浣滃簾鍚庢帶鍒� + sql = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + sUser + "'"; + ds = oCn.RunProcReturn(sql, procName); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍙嶄綔搴熻繃绋嬩腑鍑洪敊锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + oCn.RollBack(); + return false; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); + oCn.RollBack(); + return false; + } + //鍐欏叆鏃ュ織 + string WorkList = "鍙嶄綔搴熷崟鎹紝鍗曟嵁鍙凤細" + HBillNo; + string SystemName = "LMES-" + MvarReportTitle + "妯″潡"; + oCn.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','鍙嶄綔搴�')" + ); + + sReturn = "鍙嶄綔搴熷崟鎹垚鍔燂紒"; ; + oCn.Commit(); + return true; + } + catch (Exception e) + { + oCn.RollBack(); + sReturn = e.Message; + throw (e); + } + } //鍙嶅叧闂� public bool CancelClose(Int64 lngBillKey, ref string sReturn) { @@ -1004,6 +1065,57 @@ throw (e); } } + //浣滃簾(鍖呭惈浣滃簾鍚庢帶鍒躲�佸啓鍏ユ棩蹇�) 2025-03-10 + public bool Cancelltion(Int64 lngBillKey, string HBillNo, string procName, string sUser, ref string sReturn) + { + string sql = ""; + DataSet ds; + + if (isUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + //寮�鍚簨鍔� + oCn.BeginTran(); + string HDeleteMan = sUser; + string HDeleteDate = ClsPub.GetServerDate(-1); + oCn.RunProc(" Update " + MvarItemKey + " set HDeleteMan='" + HDeleteMan + "',HDeleteDate='" + HDeleteDate + "',HBillStatus=4 Where HInterID=" + lngBillKey.ToString()); + + //浣滃簾鍚庢帶鍒� + sql = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + sUser + "'"; + ds = oCn.RunProcReturn(sql, procName); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + sReturn = "浣滃簾杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + oCn.RollBack(); + return false; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); + oCn.RollBack(); + return false; + } + //鍐欏叆鏃ュ織 + string WorkList = "浣滃簾鍗曟嵁锛屽崟鎹彿锛�" + HBillNo; + string SystemName = "LMES-" + MvarReportTitle + "妯″潡"; + oCn.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','浣滃簾')" + ); + + sReturn = "浣滃簾鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + oCn.RollBack(); + sReturn = e.Message; + throw (e); + } + } //淇濆吇璁″垝鍒犻櫎瀛愯〃1 public void DeleteBillSub(Int64 lngBillKey) { -- Gitblit v1.9.1