From 2bc24245838af613a6101a1e835bedf29ad8b8cf Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期四, 11 十一月 2021 19:07:12 +0800
Subject: [PATCH] 1、器具档案新增编辑页面增加货主类型、预警寿命 2、新增器具保养规程单

---
 WebAPI/Controllers/Sc_CheckToolsRepairWorkBillListController.cs |  498 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 439 insertions(+), 59 deletions(-)

diff --git a/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillListController.cs b/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillListController.cs
index 31ccfda..53fa018 100644
--- a/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillListController.cs
+++ b/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillListController.cs
@@ -16,11 +16,14 @@
 
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
+        public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         public WebServer webserver = new WebServer();
 
         public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
         public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
 
+        public DLL.ClsSc_MouldRepairInBill BillNew01 = new DLL.ClsSc_MouldRepairInBill();   //妯″叿鏀瑰埗鍏ュ簱瀵瑰簲鍗曟嵁绫�
+        public DLL.ClsSc_MouldRepairInBill BillOld01 = new DLL.ClsSc_MouldRepairInBill();   //妯″叿鏀瑰埗鍏ュ簱瀵瑰簲鍗曟嵁绫�
 
         /// <summary>
         /// 鏍规嵁鍖呰鍗� 杩斿洖姝ゅ寘瑁呭崟鍐呯殑鐩稿叧淇℃伅
@@ -4209,14 +4212,23 @@
 
         #region 鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曟嵁缁存姢鍒楄〃
 
-        [Route("Sc_MouldRepairInBillList/GetMouldRepairInBillList")]
+        [Route("Sc_CheckToolsRepairWorkBillList/GetMouldRepairInBillList")]
         [HttpGet]
-        public object GetMouldRepairInBillList(string sWhere)
+        public object GetMouldRepairInBillList(string sWhere,string user, string Organization)
         {
             try
             {
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairIn_SingleBillList", 1, true, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-                ds = Sc_MouldRepairInBillList(sWhere);
+                ds = Sc_MouldRepairInBillList(sWhere,Organization);
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
@@ -4233,38 +4245,21 @@
             }
         }
 
-        public static DataSet Sc_MouldRepairInBillList(string sWhere)
+        public static DataSet Sc_MouldRepairInBillList(string sWhere,string Organization)
         {
+            string sql1 = string.Format(@"select * from h_v_Sc_MouldRepairInBillList where 搴撳瓨缁勭粐='" + Organization + "'");
             if (sWhere == null || sWhere.Equals(""))
             {
-                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldRepairInBillList ", "h_v_Sc_MouldRepairInBillList");
+                return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by 鏃ユ湡 desc", "h_v_Sc_MouldRepairInBillList");
             }
             else
             {
-                string sql1 = "select * from h_v_Sc_MouldRepairInBillList where 1 = 1 ";
-                string sql = sql1 + sWhere;
+                string sql = sql1 + sWhere+ "order by 鏃ユ湡 desc";
                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldRepairInBillList");
             }
 
         }
 
-        #endregion
-
-        #region[鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
-        [Route("Sc_MouldRepairInBill/Sc_MouldRepairInBillListCheckDetail")]
-        [HttpGet]
-        public ApiResult<DataSet> Sc_MouldRepairInBillListCheckDetail(string HID)
-        {
-            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_Sc_MouldRepairInBillList  where hmainid= " + HID + " ", "h_v_Sc_MouldRepairInBillList");
-            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 };
-        }
         #endregion
 
         #region[鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁]
@@ -4273,35 +4268,43 @@
         public object Sc_MouldRepairInBillListCheckDetai(string sqlWhere)
         {
             DataSet ds;
+            DataSet ds1;
+            List<object> list = new List<object>();
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID 妯″叿浠g爜,璁捐瀵垮懡,鍓╀綑瀵垮懡,绱Н浣跨敤瀵垮懡,HWHID 浠撳簱,
-                                                  HSPID 浠撲綅浠g爜,妯″叿鏂拌鏍�,鏈�鍚庣敓浜т骇鍝�,閫�搴撶被鍨�,
-                                                  琛ㄥご澶囨敞  FROM h_v_Sc_MouldRepairInBillList"), "h_v_Sc_MouldRepairInBillList");
+                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
+                                          鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust,
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
+                                          FROM h_v_Sc_MouldRepairInBillList"), "h_v_Sc_MouldRepairInBillList");
 
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+          
                 }
                 else
                 {
 
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
-                    string sql1 = string.Format(@"SELECT HMaterID 妯″叿浠g爜,璁捐瀵垮懡,鍓╀綑瀵垮懡,绱Н浣跨敤瀵垮懡,HWHID 浠撳簱,
-                                                  HSPID 浠撲綅浠g爜,妯″叿鏂拌鏍�,鏈�鍚庣敓浜т骇鍝�,閫�搴撶被鍨�,
-                                                  琛ㄥご澶囨敞  FROM h_v_Sc_MouldRepairInBillList where 1 = 1 ");
+                    string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
+                                          鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust,
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
+                                          FROM h_v_Sc_MouldRepairInBillList where 1=1 ");
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairInBillList");
 
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
                 }
+                //鏌ユ眹鎬�
+                ds1 = oCN.RunProcReturn(string.Format(@"select  鐗╂枡浠g爜,max(鐗╂枡鍚嶇О)鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,max(鍗曟嵁鍙�)鍗曟嵁鍙�,鎵规,sum(瀹炴敹鏁伴噺)瀹炴敹鏁伴噺,
+                                            hwhid,max(浠撳簱浠g爜)浠撳簱浠g爜,max(浠撳簱)浠撳簱,瀛愬娉� from h_v_Sc_MouldRepairInBillList 
+                                            where 1=1 " + sqlWhere + " group by 鐗╂枡浠g爜,瑙勬牸鍨嬪彿,hwhid,鎵规,瀛愬娉�"), "h_v_Sc_MouldRepairInBillList");
+
+                list.Add(ds.Tables[0]);
+                list.Add(ds1.Tables[0]);
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.list = list;
             }
             catch (Exception e)
             {
@@ -4329,23 +4332,83 @@
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
-
+            string refSav = sArray[2].ToString();
+            string msg4 = sArray[3].ToString();
 
             string UserName = "";
+            string s = "";
             ListModels oListModels = new ListModels();
             try
             {
-                DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill();
-                List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairIn_SingleBill_Edit", 1, true, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DLL.ClsSc_MouldRepairInBill oBill = new DLL.ClsSc_MouldRepairInBill();
+                List<Models.ClsSc_MouldRepairInBillMain> lsmain = new List<Models.ClsSc_MouldRepairInBillMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2);
-                foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain)
+                lsmain = oListModels.getObjectByJson_Gy_MouldRepairInHouseBillMain(msg2);
+                foreach (Models.ClsSc_MouldRepairInBillMain oItem in lsmain)
                 {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew01.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (BillOld01.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld0.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "3803";
-                    oItem.HBillSubType = "3803";
+                    oItem.HBillType = "3826";
+                    oItem.HBillSubType = "3826";
                     //oItem.HBillNo = "";    //鍗曟嵁鍙�
                     //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
                     //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
@@ -4380,10 +4443,10 @@
                 msg3 = msg3.Replace("\\", "");
                 msg3 = msg3.Replace("\n", "");  //\n
                 //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>();
-                ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3);
+                List<Models.ClsSc_MouldRepairInBillSub> ls = new List<Models.ClsSc_MouldRepairInBillSub>();
+                ls = oListModels.getObjectByJson_Gy_MouldRepairInHouseBillSub(msg3);
                 int i = 0;
-                foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls)
+                foreach (Models.ClsSc_MouldRepairInBillSub oItemSub in ls)
                 {
 
                     i++;
@@ -4449,6 +4512,223 @@
         }
         #endregion
 
+        #region [鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曞鏍搞�佸弽瀹℃牳]
+        /// <summary>
+        /// 瀹℃牳
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Sc_MouldRepairInBill/set_CheckBill")]
+        [HttpGet]
+        public object set_CheckBill(int HInterID, string CurUserName)
+        {
+            string ModRightNameCheck = "Sc_MouldRepairInBill_Check";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            DLL.ClsSc_MouldRepairInBill oBill = new DLL.ClsSc_MouldRepairInBill();
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //瀹℃牳鍓嶅垽鏂槸鍚﹀厑璁�
+                string s = "";
+                if (!DBUtility.Xt_BaseBillFun.Fun_AllowCheckBill(oBill, ref s))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = s + "锛屼笉鍏佽瀹℃牳";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HCloseMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //瀹℃牳鎻愪氦
+                if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        /// <summary>
+        /// 鍙嶅鏍�
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Sc_MouldRepairInBill/set_AbandonCheck")]
+        [HttpGet]
+        public object set_AbandonCheck(int HInterID, string CurUserName)
+        {
+            string ModRightNameCheck = "Sc_MouldRepairInBill_Check";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            DLL.ClsSc_MouldRepairInBill oBill = new DLL.ClsSc_MouldRepairInBill();
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒鏃犳潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //鍙嶅鏍稿墠鍒ゆ柇
+                string s = "";
+                if (!DBUtility.Xt_BaseBillFun.Fun_AllowCheckBill(oBill, ref s))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = s + "锛屼笉鍏佽鍙嶅鏍�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HCloseMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍙嶅鏍革紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆鍙嶅鏍革紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //鍙嶅鏍告彁浜bandonCheck
+                if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    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 [鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曞垹闄ゅ姛鑳絔
         /// <summary>
         /// 鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曞垹闄ゅ姛鑳�
@@ -4456,17 +4736,17 @@
         /// <returns></returns>
         [Route("Sc_MouldRepairInBill/DeltetMouldRepairInBill")]
         [HttpGet]
-        public object DeltetMouldRepairInBill(string HInterID)
+        public object DeltetMouldRepairInBill(string HInterID,string user)
         {
             //缂栬緫鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    objJsonResult.code = "0";
-            //    objJsonResult.count = 0;
-            //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-            //    objJsonResult.data = null;
-            //    return objJsonResult;
-            //}
+            if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairIn_SingleBill_Delete", 1, true, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
 
             Int64 lngBillKey = 0;
@@ -4529,6 +4809,106 @@
         }
         #endregion
 
+        #region[妯″叿鏀瑰埗鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
+        [Route("Sc_CheckToolsRepairWorkBillList/Sc_MouldRepairInHouseBillListCheckDetai")]
+        [HttpGet]
+        public ApiResult<DataSet> Sc_MouldRepairInHouseBillListCheckDetai(string HID)
+        {
+            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_Sc_MouldRepairInBillList  where hmainid= " + HID + " ", "h_v_Sc_MouldRepairInBillList");
+            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 };
+        }
+        #endregion
+
+        #region 鍣ㄥ叿鏀瑰埗鍏ュ簱鍗曞鏍�/鍙嶅鏍�
+        [Route("Sc_MouldRepairInBill/AuditMouldRepairInBill")]
+        [HttpGet]
+        public object AuditMouldRepairInBill(string HInterID, string user, int flag)
+        {
+            //flag=1 瀹℃牳锛�  flag=2 鍙嶅鏍�
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairIn_SingleBill_Check", 1, true, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲鏍告潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill();
+            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+            {
+                if (flag == 1)
+                {
+                    if (oBill.omodel.HBillStatus == 2)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁宸插鏍革紝鏃犻渶鍐嶆瀹℃牳";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        string HCheckDate = DateTime.Now.Date.ToString();
+                        oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker ='" + user + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='3826' and HInterID=" + HInterID);
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (oBill.omodel.HBillStatus == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁鏈鏍革紝鏃犻渶鍙嶅鏍�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        string HCheckDate = DateTime.Now.Date.ToString();
+                        oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker=' ',HCheckDate=' ',HBillStatus=1 Where HBillType='3826' and HInterID=" + HInterID);
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍告垚鍔燂紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                }
+
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
         #endregion
 
         //#region 妯″叿棰嗙敤鍗�
@@ -4936,7 +5316,7 @@
         //                                                   HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅 HSecUnitName,鎹㈢畻鐜� HSecUnitRate,
         //                                                   HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,
         //                                                   璁捐瀵垮懡 HDesignLife, 鍘熷墿浣欏鍛� HLeaveLife, 鏂板墿浣欏鍛� HNewLife,琛ㄤ綋澶囨敞 HRemark 
-	       //                                                FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit");
+        //                                                FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit");
 
         //            objJsonResult.code = "0";
         //            objJsonResult.count = 1;
@@ -4951,7 +5331,7 @@
         //                                          HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅 HSecUnitName,鎹㈢畻鐜� HSecUnitRate,
         //                                          HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,
         //                                          璁捐瀵垮懡 HDesignLife, 鍘熷墿浣欏鍛� HLeaveLife, 鏂板墿浣欏鍛� HNewLife,琛ㄤ綋澶囨敞 HRemark 
-	       //                                       FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 ");
+        //                                       FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 ");
         //            string sql = sql1 + sqlWhere;
         //            ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList_Edit");
 

--
Gitblit v1.9.1