From 4390648d77c2c9d0558e25a41d4ca4c24e5433de Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 17 四月 2025 08:06:11 +0800
Subject: [PATCH] 要料信息导入、提料信息导入:调整

---
 WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs |  321 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 308 insertions(+), 13 deletions(-)

diff --git a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
index 395d944..7ae87df 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -33,6 +33,8 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileBill_Query", 1, false, user))
                 {
                     objJsonResult.code = "0";
@@ -51,12 +53,19 @@
                     string sql = sql1 + sWhere + " order by hmainid desc";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipFileMainList");
                 }
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
 
-              
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
             }
             catch (Exception e)
@@ -123,7 +132,7 @@
         [HttpGet]
         public object Delete_EquipFile(string HItemID, string user)
         {
-            if (!DBUtility.ClsPub.Security_Log("Gy_EquipFile_Delete", 1, false, user))
+            if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileBill_Delete", 1, false, user))
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
@@ -157,9 +166,57 @@
                     return objJsonResult;
                 }
 
+                //鍒犻櫎鍓嶆帶鍒�=========================================
+                ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_BeforeDelCtrl");
+
+                if (ds == null)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
+
+
+
                 oCN.RunProc("Delete From Gy_EquipFileBillMain  where HInterID=" + lngBillKey);
                 oCN.RunProc("Delete From Gy_EquipFileBillSub_MaintainRule  where HInterID=" + lngBillKey);
                 oCN.RunProc("Delete From Gy_EquipFileBillSub_DotCheckRule  where HInterID=" + lngBillKey);
+
+                //鍒犻櫎鍚庢帶鍒�=========================================
+                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_AfterDelCtrl");
+                if (ds2 == null)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍚庡垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
+
                 oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -187,7 +244,7 @@
         {
             try
             {
-                ds = oCN.RunProcReturn("select * from h_v_Gy_EquipFileMainList where hmainid=" + HInterID, "h_v_Gy_EquipFileMainList");
+                ds = oCN.RunProcReturn("select * from h_v_Gy_EquipFileMain_Edit where hmainid=" + HInterID, "h_v_Gy_EquipFileMain_Edit");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -341,14 +398,21 @@
                 string HLogo = list[0].HLogo;                //鈭�		varchar(50)	//鍝佺墝
                 int HSellSupID = list[0].HSellSupID;              // 鈭�	int		//渚涘簲鍟�(Gy_Supplier)
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier) 
-                string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
+            
                 string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                string HIPAddress = list[0].HIPAddress;   // varchar(50) //鏁伴噰IP鍦板潃
+                string HLinkNETMode = list[0].HLinkNETMode;   // varchar(50) //鑱旂綉鏂瑰紡
+                string HCollectMode = list[0].HCollectMode;   // varchar(50) //閲囬泦鏂瑰紡
+                string HCollectClass = list[0].HCollectClass;   // varchar(50) //閲囬泦绫诲瀷
+                string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
                 int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HMaker = msg5;
-                string HMakeDate = DateTime.Now.Date.ToString();
+                //string HMakeDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
                 int HEquipMaintainRuleInterID = list[0].HEquipMaintainRuleInterID;
                 int HSourceID = list[0].HSourceID;
+                int HCREATEORGID = list[0].HCREATEORGID;
+                int HUSEORGID = list[0].HUSEORGID;
 
                 if (!DBUtility.ClsPub.AllowNumber(HEquipFileNumber))
                 {
@@ -372,9 +436,10 @@
                 oCN.BeginTran();
                 //淇濆瓨鍓嶆帶鍒�=========================================
                 string HBillNote = "";
-                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBillMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBillMain_BeforeSaveCtrl");
+                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_BeforeSaveCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
@@ -384,6 +449,7 @@
 
                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                 {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
@@ -395,18 +461,21 @@
                 oCN.RunProc("Insert into Gy_EquipFileBillMain " +
                    " (HInterID,hbillno,HEquipFileNumber,HEquipFileNo,HName,HModel,HModel2,HMaterID,HUnitID,HOutComDate" +
                    ",HOutComNo,HDeptID,HUseEmpID,HRepairEmpID,HAddress,HSetupDate,HStartupDate,HStatus," +
-"HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID) " +
+                    "HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID," +
+                    "HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID,HIPAddress,HLinkNETMode,HCollectMode,HCollectClass,HCREATEORGID,HUSEORGID) " +
                    " Values("+ HInterID+",'" + hbillno + "','" + HEquipFileNumber + "','" + HEquipFileNo + "','" + HName + "','" + HModel + "','" + HModel2 + "'," + HMaterID + "," + HUnitID +
                    ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HUseEmpID + "," + HRepairEmpID + ",'" + HAddress +
                    "','" + HSetupDate + "','" + HStartupDate + "','" + HStatus + "'," + HEquipFileTypeID + ",'" + HProNum +
-                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "',GETDATE(),'" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'" +
+                   "," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "','" + HIPAddress + "','" + HLinkNETMode + "','" + HCollectMode + "','" + HCollectClass + "',"+ HCREATEORGID + ","+ HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 objJsonResult = AddBillSub(msg3, msg4, HInterID, hbillno, 1);
 
                 //淇濆瓨鍚庢帶鍒�=========================================
-                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBillMain_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBillMain_AfterSaveCtrl");
+                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_AfterSaveCtrl");
                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                 {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
@@ -415,7 +484,8 @@
                 }
 
                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
-                {                  
+                {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
@@ -473,6 +543,7 @@
 
                 long HInterID = list[0].HInterID;
                 string HEquipFileNumber = list[0].HEquipFileNumber;
+                string hbillno = list[0].HBillNo;
                 string HEquipFileNo = list[0].HEquipFileNo;         //	varchar(50)	//璁惧缂栫爜(鍞竴)
                 string HName = list[0].HName;                //    鈭�	varchar(100)     	//璁惧鍚嶇О
                 string HModel = list[0].HModel;               //   鈭� 	varchar(100)     	//璁惧瑙勬牸
@@ -497,12 +568,17 @@
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier)
                 string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
                 string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                string HIPAddress = list[0].HIPAddress;   // varchar(50) //鏁伴噰IP鍦板潃
+                string HLinkNETMode = list[0].HLinkNETMode;   // varchar(50) //鑱旂綉鏂瑰紡
+                string HCollectMode = list[0].HCollectMode;   // varchar(50) //閲囬泦鏂瑰紡
+                string HCollectClass = list[0].HCollectClass;   // varchar(50) //閲囬泦绫诲瀷
                 int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HUpDater = msg5;
-                string HUpDateDate = DateTime.Now.Date.ToString();
+                //string HUpDateDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
                 int HEquipMaintainRuleInterID = list[0].HEquipMaintainRuleInterID;
                 int HSourceID = list[0].HSourceID;
+                int HUSEORGID = list[0].HUSEORGID;
 
 
                 if (!DBUtility.ClsPub.AllowNumber(HEquipFileNumber))
@@ -528,6 +604,31 @@
 
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_BeforeSaveCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //=========================================================
+
                 //涓昏〃
                 oCN.RunProc("Update Gy_EquipFileBillMain set " +
                     " HEquipFileNumber='" + HEquipFileNumber + "'" +
@@ -553,19 +654,50 @@
                     ",HLogo='" + HLogo + "'" +
                     ",HSellSupID=" + HSellSupID +
                     ",HMakeSupID= " + HMakeSupID +
-                    ",HUpDater= '" + HUpDater + "'" +                    
-                    ",HUpDateDate= '" + HUpDateDate + "'" +
+                    ",HUSEORGID= " + HUSEORGID +
+                    ",HUpDater= '" + HUpDater + "'" +
+                    ",HUpDateDate= GETDATE()" +
                     ",HEquipDotCheckRuleInterID='" + HEquipDotCheckRuleInterID + "'" +
                     ",HEquipMaintainRuleInterID='" + HEquipMaintainRuleInterID + "'" +
                     ",HSourceID='" + HSourceID + "'" +
                     ",HMainSourceFlag= '" + HMainSourceFlag + "'" +
                     ",HMacAddress= '" + HMacAddress + "'" +
                     ",HMainSourceID = '" + HMainSourceID + "'" +
+                    ",HIPAddress='" + HIPAddress + "'" +
+                    ",HLinkNETMode='" + HLinkNETMode + "'" +
+                    ",HCollectMode='" + HCollectMode + "'" +
+                    ",HCollectClass='" + HCollectClass + "'" +
                     " Where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                 //
                 objJsonResult = AddBillSub(msg3, msg4, HInterID, list[0].HBillNo, 2);
+
+
+                //淇濆瓨鍚庢帶鍒�=========================================
+                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_AfterSaveCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //=========================================================
+
                 oCN.Commit();
                 //objJsonResult.data = null;
                 return objJsonResult;
@@ -828,6 +960,28 @@
                 //Type 1 瀹℃牳  2  鍙嶅鏍�
                 if (Type == 1)
                 {
+                    //瀹℃牳鍓嶆帶鍒�=========================================
+                    ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_BeforeDelCtrl");
+                    if (ds == null)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+
                     if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
@@ -836,9 +990,53 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+
+                    //瀹℃牳鍚庢帶鍒�=========================================
+                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_AfterDelCtrl");
+                    if (ds2 == null)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳鍚庡垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
                 }
                 else
                 {
+                    //鍙嶅鏍稿墠鎺у埗=========================================
+                    ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_BeforeUnCheckCtrl");
+                    if (ds == null)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+
                     if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                     {
                         SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -851,6 +1049,29 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+
+                    //鍙嶅鏍稿悗鎺у埗=========================================
+                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_AfterUnCheckCtrl");
+                    if (ds2 == null)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳鍚庡垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+
                 }
 
                 oCN.Commit();//鎻愪氦浜嬪姟
@@ -947,6 +1168,80 @@
         }
         #endregion
 
+        #region 璁惧妗f浣滃簾/鍙嶄綔搴熷姛鑳�
+        [Route("Gy_EquipFileBill/DeleteGy_EquipFileBill")]
+        [HttpGet]
+        public object DeleteGy_EquipFileBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileBill_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 璁惧妗f鍒楄〃 鏍戠姸鍥� 璁惧鍒嗙被鏌ヨ
         public class TreeModel
         {

--
Gitblit v1.9.1