From 38ce87fb55496d7eb95d1a28f31eb4d2f528e3b8 Mon Sep 17 00:00:00 2001
From: 沈泽 <211959439@qq.com>
Date: 星期四, 04 十一月 2021 16:51:37 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs |  276 ++++++++++++++----------------------------------------
 1 files changed, 72 insertions(+), 204 deletions(-)

diff --git a/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
index ef0b978..858ca7d 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
@@ -16,6 +16,7 @@
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
+        public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         public DLL.ClsSc_MouldRepairOutBill BillNew0 = new DLL.ClsSc_MouldRepairOutBill();   //妯″叿鏀瑰埗鍑哄簱瀵瑰簲鍗曟嵁绫�
         public DLL.ClsSc_MouldRepairOutBill BillOld0 = new DLL.ClsSc_MouldRepairOutBill();   //妯″叿鏀瑰埗鍑哄簱瀵瑰簲鍗曟嵁绫�
 
@@ -35,7 +36,7 @@
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                        objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
@@ -196,7 +197,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -363,217 +364,84 @@
         }
         #endregion
 
-        #region [妯″叿鏀瑰埗鍑哄崟瀹℃牳銆佸弽瀹℃牳]
-        /// <summary>
-        /// 瀹℃牳
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
-        [Route("Sc_MouldRepairOutBill/set_CheckBill")]
+        #region 鍣ㄥ叿鏀瑰埗鍑哄簱鍗曞鏍�/鍙嶅鏍�
+        [Route("Sc_MouldRepairOutBill/AuditMouldRepairOutBill")]
         [HttpGet]
-        public object set_CheckBill(int HInterID, string CurUserName)
+        public object AuditMouldRepairOutBill(string HInterID, string user, int flag)
         {
-            string ModRightNameCheck = "Sc_MouldRepairOut_SingleBill_Check";
-            DBUtility.ClsPub.CurUserName = CurUserName;
-            DLL.ClsSc_MouldRepairOutBill oBill = new DLL.ClsSc_MouldRepairOutBill();
-            try
-            {
-                //瀹℃牳鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second(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)
+            //flag=1 瀹℃牳锛�  flag=2 鍙嶅鏍�
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Check", 1, true, user))
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.Message = "鏃犲鏍告潈闄愶紒";
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-        }
-        /// <summary>
-        /// 鍙嶅鏍�
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
-        [Route("Sc_MouldRepairOutBill/set_AbandonCheck")]
-        [HttpGet]
-        public object set_AbandonCheck(int HInterID, string CurUserName)
-        {
-            string ModRightNameCheck = "Sc_MouldRepairOut_SingleBill_Check";
-            DBUtility.ClsPub.CurUserName = CurUserName;
-            DLL.ClsSc_MouldRepairOutBill oBill = new DLL.ClsSc_MouldRepairOutBill();
-            try
-            {
-                //瀹℃牳鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second(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)
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + e.ToString();
+                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='3825' 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='3825' 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;
             }
@@ -610,7 +478,7 @@
                 {
                     ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
                                           鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust,
-                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID 
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
                                           FROM h_v_Sc_MouldRepairOutBillList"), "h_v_Sc_MouldRepairOutBillList");
 
                     objJsonResult.code = "0";
@@ -624,7 +492,7 @@
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub 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 
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
                                           FROM h_v_Sc_MouldRepairOutBillList where 1=1 ");
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairOutBillList");

--
Gitblit v1.9.1