From 70799329dc591e8f07682e40cf4dd464ffa22bdf Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 09 二月 2026 08:58:01 +0800
Subject: [PATCH] 1

---
 WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs |  111 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 98 insertions(+), 13 deletions(-)

diff --git a/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
index 9597e8d..6fa4673 100644
--- a/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
@@ -37,6 +37,21 @@
         {
             try
             {
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Sb_EquipRepairWorkBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sb_EquipRepairWorkBill_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();
                 //鏇存柊涓昏〃
@@ -60,6 +75,10 @@
                 ",HPlanTimes=" + omodel.HPlanTimes.ToString() +
                 ",HDeptID=" + omodel.HDeptID.ToString() +
                 ",HExplanation='" + omodel.HExplanation + "'" +
+                ",HRepairCategory='" + omodel.HRepairCategory + "'" +
+                ",HUrgenLevel='" + omodel.HUrgenLevel + "'" +
+                ",HRepairer='" + omodel.HRepairer + "'" +
+                ",HIsCapacityImpact='" + omodel.HIsCapacityImpact + "'" +
                 ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                 ",HRepairContent='" + omodel.HRepairContent + "'" +
                 ",HMainSourceBillType='"+ omodel.HMainSourceBillType+"'"+
@@ -116,6 +135,25 @@
                 //        return false;
                 //    }
                 //}
+
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sb_EquipRepairWorkBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sb_EquipRepairWorkBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -134,6 +172,23 @@
             {
                 //寰楀埌mainid
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Sb_EquipRepairWorkBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sb_EquipRepairWorkBill_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;
+                }
+                //=========================================================
+
+
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCn.BeginTran();
                
@@ -143,16 +198,19 @@
                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                 ",HEquipID,HRepairID,HPlanTimes,HEmpID,HManagerID,HTimes" +
                 ",HDeptID,HExplanation,HInnerBillNo,HRepairBeginDate,HRepairEndDate,HRepairContent,HCycleUnit,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID" +
+                ",HRepairCategory,HUrgenLevel,HRepairer,HIsCapacityImpact" +
                 ") " +
                 " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                 ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" +
                 ", " + omodel.HEquipID.ToString() + "," + omodel.HRepairID.ToString() + "," + omodel.HPlanTimes.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HTimes.ToString() +
                 ", " + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "','" + omodel.HRepairBeginDate + "','" + omodel.HRepairEndDate + "','" + omodel.HRepairContent + "','" + omodel.HCycleUnit + "','" +
                  omodel.HMainSourceBillType+"',"+ omodel.HMainSourceInterID.ToString()+","+ omodel.HMainSourceEntryID.ToString() +
-                ") ");
+                ",'"+ omodel.HRepairCategory + "','" + omodel.HUrgenLevel + "','" + omodel.HRepairer + "','" + omodel.HIsCapacityImpact + "') ");
                 //鎻掑叆瀛愯〃
+                
                 foreach (Models.ClsSb_EquipRepairWorkBillSub oSub in DetailColl)
                 {
+                    
                     string sql1 = string.Format(@"Insert into Sb_EquipRepairWorkBillSub " +
                        " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
@@ -160,22 +218,27 @@
                        ") values("
                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                        "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                      "," + oSub.HRepairID.ToString() + ",'" + oSub.HManagerID.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() +
+                      "," + oSub.HRepairID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() +
                        ")");
-                    oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub " +
-                       " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
-                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                       ",HRepairID,HManagerID,HRepairExplanation,HEmpID" +
-                       ") values("
-                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
-                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                      "," + oSub.HRepairID.ToString() + ",'"+ oSub.HManagerID.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() +
-                       ") ");
+                    //oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub " +
+                    //   " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                    //   ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    //   ",HRepairID,HManagerID,HRepairExplanation,HEmpID" +
+                    //   ") values("
+                    //   + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                    //   "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                    //  "," + oSub.HRepairID.ToString() + ",'" + oSub.HManagerID.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() +
+                    //   ") ");
+                    oCn.RunProc(sql1);
+
                 }
+
+
 
                 foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oSub in DetailColl_Mater)
                 {
-                    oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub_Mater " +
+                
+                    string sql = String.Format(@"Insert into Sb_EquipRepairWorkBillSub_Mater " +
                       " (HInterID,HEntryID," +
                       "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                       "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
@@ -185,8 +248,13 @@
                       ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
-                      "," + oSub.HManagerID.ToString() + ") ");
+                      "," + oSub.HManagerID.ToString() + ")");
+                    oCn.RunProc(sql);
+                 
+                
+                
                 }
+
                 //
                 //foreach (Model.ClsSb_EquipRepairWorkBillSub oSub in DetailColl)
                 //{
@@ -200,6 +268,23 @@
                 //    }
                 //}
                 //
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sb_EquipRepairWorkBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + $"',1", "h_p_Sb_EquipRepairWorkBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;

--
Gitblit v1.9.1