From 8fc53d9ba92f32a78146d56a7cd481d65a056556 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 01 十二月 2025 13:33:41 +0800
Subject: [PATCH] 档案状态变更单优化

---
 DAL/销售管理/ClsXs_SeOrderChangeBill.cs |   74 +++++++++++++++++++++++++++++++-----
 1 files changed, 63 insertions(+), 11 deletions(-)

diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderChangeBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderChangeBill.cs"
index 0b29e2e..ab80bc3 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderChangeBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderChangeBill.cs"
@@ -37,6 +37,21 @@
         {
             try
             {
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
                 oCn.BeginTran();
                 //鏇存柊涓昏〃
                 string mainSql = "update Xs_SeOrderChangeBillMain set " +
@@ -72,7 +87,7 @@
                 {
                     string subSql = "insert into Xs_SeOrderChangeBillSub" +
                         "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
+                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                         " values(" +
                         "" + omodel.HInterID.ToString() +
                         "," + oSub.HEntryID.ToString() +
@@ -91,6 +106,8 @@
                         "," + oSub.HUnitID +
                         "," + oSub.HQty_Old +
                         "," + oSub.HQty_New +
+                        "," + oSub.HTaxRate_Old +
+                        "," + oSub.HTaxRate_New +
                         "," + oSub.HTaxPrice_Old +
                         "," + oSub.HTaxPrice_New +
                         ",'" + oSub.HDate_Old + "'" +
@@ -98,7 +115,23 @@
                         ")";
                     oCn.RunProc(subSql);
                 }
-                
+
+                //淇濆瓨鍚庢帶鍒�=========================================
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //=========================================================
+
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -123,6 +156,21 @@
                     omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 }
 
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
 
                 oCn.BeginTran();
                 //鎻掑叆涓昏〃
@@ -165,7 +213,7 @@
                 {
                     string subSql = "insert into Xs_SeOrderChangeBillSub" +
                         "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
+                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                         " values(" +
                         "" + omodel.HInterID.ToString() +
                         "," + oSub.HEntryID.ToString() +
@@ -184,6 +232,8 @@
                         "," + oSub.HUnitID +
                         "," + oSub.HQty_Old +
                         "," + oSub.HQty_New +
+                        "," + oSub.HTaxRate_Old +
+                        "," + oSub.HTaxRate_New +
                         "," + oSub.HTaxPrice_Old +
                         "," + oSub.HTaxPrice_New +
                         ",'" + oSub.HDate_Old + "'" +
@@ -193,15 +243,17 @@
                 }
 
                 //淇濆瓨鍚庢帶鍒�=========================================
-                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl");
-                if (ds == null)
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl");
+                if (ds2 == null)
                 {
                     sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                    oCn.RollBack();
                     return false;
                 }
-                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                 {
-                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
                     return false;
                 }
                 //=========================================================
@@ -307,10 +359,10 @@
                     //===================================================
                     oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                     oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
-                    oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_Old"]);
-                    oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_New"]);
-                    oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_Old"]);
-                    oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_New"]);
+                    oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_Old"]);
+                    oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_New"]);
+                    oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_Old"]);
+                    oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_New"]);
                     oSub.HDate_Old = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_Old"]);
                     oSub.HDate_New = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_New"]);
 

--
Gitblit v1.9.1