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_EquipMaintainBillController.cs |   77 +++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
index 74adc1b..8941308 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
@@ -518,7 +518,7 @@
             if (string.IsNullOrEmpty(HID))
                 return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainBillList  where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainBillList");
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainBill_Edit  where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainBill_Edit");
             if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                 return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ澶囦繚鍏昏褰曡〃" };
             return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
@@ -591,8 +591,8 @@
                 string sql = "select 淇濆吇椤圭洰ID HMaintainItemID, 淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰鍚嶇О HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark,淇濆吇缁撴灉 HMaintainResult  from h_v_Sb_EquipMaintainBillSub_Item where 1 = 1 " + Swhere + "";
                 ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainBillSub_Item");
                 //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁
-                string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,瀹為檯鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName  from h_v_Sb_EquipMaintainBillList where 1 = 1 " + Swhere + "";
-                ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainBillList");
+                string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,瀹為檯鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName  from h_v_Sb_EquipMaintainBill_Edit where 1 = 1 " + Swhere + "";
+                ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainBill_Edit");
 
                 list.Add(ds.Tables[0]);
                 list.Add(ds1.Tables[0]);
@@ -955,22 +955,85 @@
                 //Type 1 鍏抽棴  2  鍙嶅叧闂�
                 if (Type == 1)
                 {
-                    if (!BillOld2.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    string sql = "";
+                    //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+                    sql = "exec h_p_Sb_EquipMaintainBill_BeforeCloseCtrl " + HInterID + ",'" + BillOld2.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipMaintainBill_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 (BillOld2.CloseBill(Convert.ToInt32(HInterID), BillOld2.omodel.HBillNo, "h_p_Sb_EquipMaintainBill_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;
                     }
                 }
                 else
                 {
-                    if (!BillOld2.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    string sql = "";
+                    //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+                    sql = "exec h_p_Sb_EquipMaintainBill_BeforeUnCloseCtrl " + HInterID + ",'" + BillOld2.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipMaintainBill_BeforeUnCloseCtrl");
+                    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 (BillOld2.CancelClose(Convert.ToInt32(HInterID), BillOld2.omodel.HBillNo, "h_p_Sb_EquipMaintainBill_AfterUnCloseCtrl", 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;
                     }

--
Gitblit v1.9.1