From 8affd199e02bd37f0dcb16447d1fbcaa34bfa2f8 Mon Sep 17 00:00:00 2001
From: lan <lan@DESKTOP-MG88OFJ>
Date: 星期四, 30 五月 2024 10:39:43 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs |  973 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 900 insertions(+), 73 deletions(-)

diff --git a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
index 1795532..718192f 100644
--- a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
+++ b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections.Generic;
@@ -22,6 +23,9 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill();   //瀵瑰簲鍗曟嵁绫�
         public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill();   //瀵瑰簲鍗曟嵁绫�
+        public DAL.ClsSb_EquipConkBookBill BillOld2 = new DAL.ClsSb_EquipConkBookBill();   //瀵瑰簲鍗曟嵁绫�
+        public DAL.ClsSb_EquipRepairWorkBill BillOld3 = new DAL.ClsSb_EquipRepairWorkBill();   //瀵瑰簲鍗曟嵁绫�
+        public DAL.ClsSb_EquipRepairCheckBill BillOld4 = new DAL.ClsSb_EquipRepairCheckBill();   //瀵瑰簲鍗曟嵁绫�
 
 
         #region 璁惧缁翠慨宸ュ崟鍒楄〃
@@ -31,21 +35,36 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/GetEqpRepairWorkBillList")]
         [HttpGet]
-        public object GetEqpRepairWorkBillList(string sWhere)
+        public object GetEqpRepairWorkBillList(string sWhere,string user)
         {
             try
             {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBillList", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 ds = Sb_EquipRepairWorkBill_s(sWhere);
-               
-                   
-              
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                
+
+                //娣诲姞鍒楀悕
+                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 = "杩斿洖璁板綍鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
             }
             catch (Exception ex)
             {
@@ -58,17 +77,71 @@
         }
         #endregion
 
+        #region 璁惧缁翠慨璁板綍缁熻鍒嗘瀽 
+        /// <summary>
+        /// 杩斿洖璁惧缁翠慨璁板綍缁熻鍒嗘瀽 鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sb_EquipRepairWorkReport/Statistics")]
+        [HttpGet]
+        public object Statistics(string DateYear, string HType, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (DateYear == null || DateYear.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤";
+                    return objJsonResult;
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sb_EquipRepairWorkBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipRepairWorkBillReport");
+                }
+
+                //娣诲姞鍒楀悕
+                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)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+      
+
         #region 璁惧缁翠慨宸ュ崟鍒楄〃sql璇彞
         public static DataSet Sb_EquipRepairWorkBill_s(string sWhere)
         {
             if (sWhere == null || sWhere.Equals(""))
             {
-                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairWorkBillList "+sWhere+ "order by hmainid desc", "h_v_Sb_EquipRepairWorkBillList");
+                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairWorkBillList "+sWhere+ " order by hmainid desc", "h_v_Sb_EquipRepairWorkBillList");
             }
             else
             {
                 string sql1 = "select * from h_v_Sb_EquipRepairWorkBillList where 1 = 1 ";
-                string sql = sql1 + sWhere+ "order by hmainid desc";
+                string sql = sql1 + sWhere+ " order by hmainid desc";
                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairWorkBillList");
             }
             
@@ -84,18 +157,26 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/GetEqpRepairCheckWorkBillList")]
         [HttpGet]
-        public object GetEqpRepairCheckWorkBillList(string sWhere)
+        public object GetEqpRepairCheckWorkBillList(string sWhere,string user)
         {
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBillList", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 ds = Sb_EquipRepairCheckWorkBill_s(sWhere);
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
-
             }
             catch (Exception ex)
             {
@@ -118,7 +199,7 @@
             else
             {
                 string sql1 = "select * from h_v_Sb_EquipRepairCheckBillList where 1 = 1 ";
-                string sql = sql1 + sWhere+ "order by hmainid desc";
+                string sql = sql1 + sWhere+ " order by hmainid desc";
                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairCheckBillList");
             }
             
@@ -134,16 +215,35 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/GetEqpConkBookBillList")]
         [HttpGet]
-        public object GetEqpConkBookBillList(string sWhere)
+        public object GetEqpConkBookBillList(string sWhere,string user)
         {
             try
             {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBillList", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 ds = Sb_EqpConkBookBillList_s(sWhere);
+
+                //娣诲姞鍒楀悕
+                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 = "杩斿洖璁板綍鎴愬姛锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
 
             }
@@ -158,17 +258,70 @@
         }
         #endregion
 
+
+        #region 璁惧鏁呴殰璁板綍缁熻鍒嗘瀽 
+        /// <summary>
+        /// 杩斿洖璁惧鏁呴殰璁板綍缁熻鍒嗘瀽 鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sb_EquipConkBookReport/Statistics")]
+        [HttpGet]
+        public object Statistics_Conk(string DateYear, string HType, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                if (DateYear == null || DateYear.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤";
+                    return objJsonResult;
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sb_EquipConkBookBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipConkBookBillReport");
+                }
+
+                //娣诲姞鍒楀悕
+                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)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 璁惧鏁呴殰鐧昏鍗曞垪琛╯ql璇彞
         public static DataSet Sb_EqpConkBookBillList_s(string sWhere)
         {
             if (sWhere == null || sWhere.Equals(""))
             {
-                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipConkBookBillList order by hmainid desc" + sWhere, "h_v_Sb_EquipConkBookBillList");
+                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipConkBookBillList order by hmainid desc" , "h_v_Sb_EquipConkBookBillList");
             }
             else
             {
                 string sql1 = "select * from h_v_Sb_EquipConkBookBillList where 1 = 1 ";
-                string sql = sql1 + sWhere+ "order by hmainid desc";
+                string sql = sql1 + sWhere+ " order by hmainid desc";
                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipConkBookBillList");
             }
         }
@@ -193,12 +346,22 @@
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
+            string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
 
 
             //string UserName = "";
             ListModels oListModels = new ListModels();
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBill_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 DLL.ClsSb_EquipRepairWorkBill oBill = new DLL.ClsSb_EquipRepairWorkBill();
                 List<Models.ClsSb_EquipRepairWorkBillMain> lsmain = new List<Models.ClsSb_EquipRepairWorkBillMain>();
                 msg2 = msg2.Replace("\\", "");
@@ -278,6 +441,30 @@
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+
+                //閰嶄欢琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                //msg5 = msg5.Substring(1, msg5.Length - 2);
+                msg5 = msg5.Replace("\\", "");
+                msg5 = msg5.Replace("\n", "");  //\n
+                                                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSb_EquipRepairWorkBillSub_Mater> ls1 = new List<Model.ClsSb_EquipRepairWorkBillSub_Mater>();
+                ls1 = JsonConvert.DeserializeObject<List<Model.ClsSb_EquipRepairWorkBillSub_Mater>>(msg5);
+                int j = 0;
+                foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oItemSub in ls1)
+                {
+
+                    j++;
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷                   
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�    
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailColl_Mater.Add(oItemSub);
+
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -334,35 +521,37 @@
         }
         #endregion
 
-        #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝
+        #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹�(缁翠慨鍒楄〃銆侀厤浠跺垪琛�)]
         [Route("Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListProjectDetai")]
         [HttpGet]
-        public object Sb_EqpRepairWorkBillListProjectDetai(string sqlWhere)
+        public object Sb_EqpRepairWorkBillListProjectDetai(string HInterID)
         {
-            DataSet ds;
+            DataSet ds, ds1;
+            List<object> list = new List<object>();
+            string sqlWhere = "";
             try
             {
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
+                if (HInterID != "" || HInterID != null)
                 {
-                    //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark   from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub");
-                    ds = oCN.RunProcReturn("select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit", "h_v_Sc_EquipRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    sqlWhere = " and hmainid='" + HInterID + "'";
                 }
                 else
                 {
-                    //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark  from Sc_MouldRepairWorkBillSub where 1 = 1 ";
-                    string sql1 = "select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark ,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_EquipRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    sqlWhere = HInterID;
                 }
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+              
+                ds = oCN.RunProcReturn("select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 " + sqlWhere , "h_v_Sc_EquipRepairWorkBillList_Edit");
+                string sql1 = "select * from h_v_Sb_EquipRepairWorkBillSub_Mater where 1 = 1 " + sqlWhere;
+                ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipRepairWorkBillSub_Mater");
+                list.Add(ds.Tables[0]);
+                list.Add(ds1.Tables[0]);
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.list = list;
+
             }
             catch (Exception e)
             {
@@ -408,17 +597,17 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/DeltetEqpRepairWorkBill")]
         [HttpGet]
-        public object DeltetEqpRepairWorkBill(string HInterID)
+        public object DeltetEqpRepairWorkBill(string HInterID,string user)
         {
             //缂栬緫鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    objJsonResult.code = "0";
-            //    objJsonResult.count = 0;
-            //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-            //    objJsonResult.data = null;
-            //    return objJsonResult;
-            //}
+            if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBill_Delete", 1, false, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
 
             Int64 lngBillKey = 0;
@@ -451,7 +640,30 @@
                     return objJsonResult;
                 }
 
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                //鍒犻櫎鍓嶆帶鍒�
+                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Sb_EquipRepairWorkBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Sb_EquipRepairWorkBill_BeforeDelCtrl");
+                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sb_EquipRepairWorkBill_AfterDelCtrl ", user, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
@@ -499,12 +711,21 @@
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
+            string msg4 = sArray[2].ToString();
 
 
             //string UserName = "";
             ListModels oListModels = new ListModels();
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 DLL.ClsSb_EquipRepairCheckBill oBill = new DLL.ClsSb_EquipRepairCheckBill();
                 List<Model.ClsSb_EquipRepairCheckBillMain> lsmain = new List<Model.ClsSb_EquipRepairCheckBillMain>();
                 msg2 = msg2.Replace("\\", "");
@@ -688,17 +909,17 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/DeltetEqpRepairCheckBill")]
         [HttpGet]
-        public object DeltetEqpRepairCheckBill(string HInterID)
+        public object DeltetEqpRepairCheckBill(string HInterID,string user)
         {
             //缂栬緫鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    objJsonResult.code = "0";
-            //    objJsonResult.count = 0;
-            //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-            //    objJsonResult.data = null;
-            //    return objJsonResult;
-            //}
+            if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Delete", 1, false, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
 
             Int64 lngBillKey = 0;
@@ -780,11 +1001,21 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
 
+            string msg4 = sArray[2].ToString();
 
             //string UserName = "";
             ListModels oListModels = new ListModels();
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 DLL.ClsSb_EquipConkBookBill oBill = new DLL.ClsSb_EquipConkBookBill();
                 List<Model.ClsSb_EquipConkBookBillMain> lsmain = new List<Model.ClsSb_EquipConkBookBillMain>();
                 msg2 = msg2.Replace("\\", "");
@@ -968,17 +1199,17 @@
         /// <returns></returns>
         [Route("Sb_EqpRepairWorkBill/DeltetEqpConkBookBill")]
         [HttpGet]
-        public object DeltetEqpConkBookBill(string HInterID)
+        public object DeltetEqpConkBookBill(string HInterID,string user)
         {
             //缂栬緫鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    objJsonResult.code = "0";
-            //    objJsonResult.count = 0;
-            //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-            //    objJsonResult.data = null;
-            //    return objJsonResult;
-            //}
+            if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_Delete", 1, false, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
 
             Int64 lngBillKey = 0;
@@ -1011,7 +1242,30 @@
                     return objJsonResult;
                 }
 
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                //鍒犻櫎鍓嶆帶鍒�
+                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Sb_EquipConkBookBill_BeforeDelCtrl   " + HInterID.ToString() + ",'" + user + "'", "h_p_Sb_EquipConkBookBill_BeforeDelCtrl  ");
+                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sb_EquipConkBookBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
@@ -1061,13 +1315,13 @@
                     return objJsonResult;
                 }
                 //寰楀埌淇℃伅
-                ds = oCN.RunProcReturn("select top 1 * from Gy_EquipMent  where HNumber= '" + HBarCode + "'", "Gy_EquipMent");
+                ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_EquipFileBillList where HEquipFileNumber= '" + HBarCode + "'", "Gy_EquipFileBillMain");
                 //鍐欏叆淇℃伅
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏈煡璇㈠埌璁惧淇℃伅锛�";
+                    objJsonResult.Message = "1.鏈煡璇㈠埌璁惧淇℃伅锛� 2.璁惧娌℃湁缁存姢鏁呴殰鐧昏鍗�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -1098,6 +1352,7 @@
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
 
             string UserName = "";
 
@@ -1154,9 +1409,12 @@
                     oBill.omodel = oItem;
                 }
                 //瀛愯〃浣撴暟鎹�
-
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
                 List<Models.ClsSb_EquipRepairWorkBillSub> ls = new List<Models.ClsSb_EquipRepairWorkBillSub>();
-                ls = oListModels.getObjectByJson_Sb_EquipRepairWorkBillSubPDA(msg2);
+                ls = oListModels.getObjectByJson_Sb_EquipRepairWorkBillSubPDA(msg3);
                 int i = 0;
                 foreach (Models.ClsSb_EquipRepairWorkBillSub oItemSub in ls)
                 {
@@ -1171,8 +1429,8 @@
                     oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                     oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
                     //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    //oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    //oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
                     //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
                     //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
                     //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
@@ -1224,6 +1482,575 @@
         }
         #endregion
 
+        #region 璁惧鏁呴殰鐧昏鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sb_EqpConkBookBill/CheckSb_EqpConkBookBill")]
+        [HttpGet]
+        public object CheckSb_EqpConkBookBill(string HInterID, int Type, string user)
+        {
+            string sql = "";
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_Check", 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;
+                ds = oCN.RunProcReturn("select * from Sb_EquipConkBookBillMain where HInterID = " + int.Parse(HInterID), "Sb_EquipConkBookBillMain");
+                string HBillNo = "";
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //瀹℃牳鍓嶆帶鍒�
+                    sql = "exec h_p_Sb_EquipConkBookBill_BeforeCheckCtrl   " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipConkBookBill_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;
+                        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 (!BillOld2.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Sb_EquipConkBookBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    //鍙嶅鏍稿墠鎺у埗
+                    sql = "exec  h_p_Sb_EquipConkBookBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipConkBookBill_BeforeUnCheckCtrl");
+                    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;
+                    }
+
+
+                    if (BillOld2.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Sb_EquipConkBookBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                    }
+                    else
+                    {
+                        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 璁惧鏁呴殰鐧昏鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Sb_EqpConkBookBill/CloseSb_EqpConkBookBill")]
+        [HttpGet]
+        public object CloseSb_EqpConkBookBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_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 (!BillOld2.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld2.CancelClose(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 璁惧缁翠慨璁板綍鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sb_EquipRepairWorkBill/CheckSb_EquipRepairWorkBill")]
+        [HttpGet]
+        public object CheckSb_EquipRepairWorkBill(string HInterID, int Type, string user)
+        {
+            string sql = "";
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBill_Check", 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;
+                ds = oCN.RunProcReturn("select * from Sb_EquipRepairWorkBillMain where HInterID = " + int.Parse(HInterID), "Sb_EquipRepairWorkBillMain");
+                string HBillNo = "";
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //瀹℃牳鍓嶆帶鍒�
+                    sql = "exec h_p_Sb_EquipRepairWorkBill_BeforeCheckCtrl   " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairWorkBill_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;
+                        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 (!BillOld3.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Sb_EquipRepairWorkBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    //鍙嶅鏍稿墠鎺у埗
+                    sql = "exec  h_p_Sb_EquipRepairWorkBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairWorkBill_BeforeUnCheckCtrl");
+                    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;
+                    }
+
+                    if (BillOld3.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Sb_EquipRepairWorkBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                    }
+                    else
+                    {
+                        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 璁惧缁翠慨璁板綍鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Sb_EquipRepairWorkBill/CloseSb_EquipRepairWorkBill")]
+        [HttpGet]
+        public object CloseSb_EquipRepairWorkBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBill_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 (!BillOld3.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld3.CancelClose(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 璁惧缁翠慨楠屾敹鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sb_EquipRepairCheckBill/CheckSb_EquipRepairCheckBill")]
+        [HttpGet]
+        public object CheckSb_EquipRepairCheckBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Check", 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 (!BillOld4.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (BillOld4.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                    }
+                    else
+                    {
+                        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 璁惧缁翠慨楠屾敹鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Sb_EquipRepairCheckBill/CloseSb_EquipRepairCheckBill")]
+        [HttpGet]
+        public object CloseSb_EquipRepairCheckBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_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 (!BillOld4.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld4.CancelClose(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
+
         #endregion
     }
 }

--
Gitblit v1.9.1