From 7583af9c032a7805a41222db300fbfd3f49d505a Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 08 四月 2025 10:28:20 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs |  210 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 193 insertions(+), 17 deletions(-)

diff --git a/WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs
index f5917f9..fd8e9c5 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs
@@ -39,14 +39,14 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                string sql = "select * from  h_v_Sb_EquipRepairSendWorkBillList where 1=1 ";
+                string sql = "select * from  h_v_Sb_EquipRepairSendWorkBill_Edit where 1=1 ";
                 if (sWhere == "" || sWhere == null)
                 {
-                    ds = oCN.RunProcReturn(sql+ " order by hmainid desc ", "h_v_Sb_EquipRepairSendWorkBillList");
+                    ds = oCN.RunProcReturn(sql+ " order by hmainid desc ", "h_v_Sb_EquipRepairSendWorkBill_Edit");
                 }
                 else
                 {
-                    ds = oCN.RunProcReturn(sql + sWhere+ " order by hmainid desc ", "h_v_Sb_EquipRepairSendWorkBillList");
+                    ds = oCN.RunProcReturn(sql + sWhere+ " order by hmainid desc ", "h_v_Sb_EquipRepairSendWorkBill_Edit");
                 }
 
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
@@ -181,6 +181,26 @@
                 omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSb_EquipRepairSendWorkBillMain>(msg2);
                 string BillType = "3909";
 
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                DataSet ds = oCN.RunProcReturn("Exec h_p_Sb_EquipRepairSendWorkBill_BeforeSaveCtrl " + omodel.HInterID + ",'" + omodel.HBillNo + "','',1", "h_p_Sb_EquipRepairSendWorkBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
+
 
                 if (OperationType == 1)//鏂板
                 {
@@ -274,6 +294,26 @@
                 i++;
             }
 
+            //淇濆瓨鍓嶆帶鍒�=========================================
+            DataSet ds = oCN.RunProcReturn("Exec h_p_Sb_EquipRepairSendWorkBill_AfterSaveCtrl " + omodel.HInterID + ",'" + omodel.HBillNo + "','',1", "h_p_Sb_EquipRepairSendWorkBill_AfterSaveCtrl");
+            if (ds == null)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            //=========================================================
+
             objJsonResult.code = "1";
             objJsonResult.count = 1;
             objJsonResult.Message = null;
@@ -308,7 +348,32 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Sb_EquipRepairSendWorkBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + User + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairSendWorkBill_BeforeDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //==================================================================================  
+
+                bool IsDete = oBill.DeleteBill(Convert.ToInt32(HInterID), oBill.omodel.HBillNo, "h_p_Sb_EquipRepairSendWorkBill_AfterDelCtrl", User, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                if (IsDete)
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -323,7 +388,7 @@
                     objJsonResult.Message = "鍒犻櫎澶辫触";
                     objJsonResult.data = null;
                     return objJsonResult;
-                }
+                }              
             }
             catch (Exception e)
             {
@@ -596,8 +661,33 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //瀹℃牳鍗曟嵁
-                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+
+                        //瀹℃牳鍓嶆帶鍒�=========================================      
+                        string sql1 = "exec h_p_Sb_EquipRepairSendWorkBill_BeforeCheckCtrl " + HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                        ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairSendWorkBill_BeforeCheckCtrl");
+                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+
+                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+                        //==================================================================================  
+
+                        if (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipRepairSendWorkBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -639,12 +729,34 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //鍙嶅鏍稿崟鎹�
-                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+                        //鍙嶅鏍稿墠鎺у埗=========================================        
+                        string sql1 = "exec h_p_Sb_EquipRepairSendWorkBill_BeforeUnCheckCtrl " + HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                        ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairSendWorkBill_BeforeUnCheckCtrl");
+                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+
+                        }
+                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //===========================================================         
+
+                        if (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipRepairSendWorkBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
@@ -743,12 +855,44 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //鍏抽棴鍗曟嵁
-                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+                        string sql2 = "";
+                        //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+                        sql2 = "exec h_p_Sb_EquipRepairSendWorkBill_BeforeCloseCtrl " + HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                        ds = oCN.RunProcReturn(sql2, "h_p_Sb_EquipRepairSendWorkBill_BeforeCloseCtrl");
+                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+
+                        }
+                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+                        //鍏抽棴鎻愪氦
+                        if (BillOld.CloseBill(Convert.ToInt32(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipRepairSendWorkBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.Message = "鍏抽棴鎴愬姛";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
@@ -786,15 +930,47 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //鍙嶅叧闂崟鎹�
-                        if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+                        string sql2 = "";
+                        //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+                        sql2 = "exec h_p_Sb_EquipRepairSendWorkBill_BeforeUnCloseCtrl " + HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                        ds = oCN.RunProcReturn(sql2, "h_p_Sb_EquipRepairSendWorkBill_BeforeUnCloseCtrl");
+                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+
+                        }
+                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+                        //鍙嶅叧闂彁浜�
+                        if (BillOld.CancelClose(Convert.ToInt32(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipRepairSendWorkBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }                       
                     }
                 }
 

--
Gitblit v1.9.1