From 5464d2e694b430a2c7f36ff58ed0195c756748c3 Mon Sep 17 00:00:00 2001
From: 杨乐 <yang.le.192@qq.com>
Date: 星期五, 14 一月 2022 18:04:53 +0800
Subject: [PATCH] 生产用料申请  审核 反审核

---
 WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs      |  160 ++++++++++++++++++++++
 WebAPI/Controllers/Kf_ICStockBillMainController.cs     |  118 ++++++++++------
 WebAPI/WebAPI.csproj                                   |    1 
 WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs |  117 ++++++++++------
 4 files changed, 304 insertions(+), 92 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs b/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs
index 0b4731a..8e378ca 100644
--- a/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_PurchaseReturnController.cs
@@ -25,7 +25,7 @@
             {
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_Kf_PurchaseReturnList " , "h_v_Kf_PurchaseReturnList");
+                    ds = oCN.RunProcReturn("select * from h_v_Kf_PurchaseReturnList ", "h_v_Kf_PurchaseReturnList");
                 }
                 else
                 {
@@ -74,69 +74,96 @@
             //    objJsonResult.data = null;
             //    return objJsonResult;
             //}
-
-            Int64 lngBillKey = 0;
-            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
-            if (lngBillKey == 0)
+            try
             {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill();
-            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-            {
-                if (IsAudit == 1)
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+                if (lngBillKey == 0)
                 {
-                    if (oBill.omodel.HBillStatus == 2)
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill();
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HCloseMan != "")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "褰撳墠鍗曟嵁宸插鏍革紝鏃犻渶鍐嶆瀹℃牳";
+                        objJsonResult.Message = "褰撳墠鍗曟嵁宸插叧闂�,涓嶈兘瀹℃牳";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+
+                    if (oBill.omodel.HDeleteMan != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁宸蹭綔搴�,涓嶈兘瀹℃牳";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (IsAudit == 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 Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1239' and HInterID=" + HInterID);
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
                     else
                     {
-                        string HCheckDate = DateTime.Now.Date.ToString();
-                        oCN.RunProc(" Update Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1239' and HInterID=" + HInterID);
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "瀹℃牳鎴愬姛锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
+                        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 Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1239' 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 Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1239' and HInterID=" + HInterID);
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍告垚鍔燂紒";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
-
             }
-            else
+            catch (Exception e)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栧弽瀹℃牳澶辫触 " + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
diff --git a/WebAPI/Controllers/Kf_ICStockBillMainController.cs b/WebAPI/Controllers/Kf_ICStockBillMainController.cs
index 4a03746..de21de0 100644
--- a/WebAPI/Controllers/Kf_ICStockBillMainController.cs
+++ b/WebAPI/Controllers/Kf_ICStockBillMainController.cs
@@ -66,7 +66,7 @@
         [HttpGet]
         public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName)
         {
-            //flag=1 瀹℃牳锛�  flag=2 鍙嶅鏍�
+            //IsAudit=1 瀹℃牳锛�  IsAudit=2 鍙嶅鏍�
             //缂栬緫鏉冮檺
             //if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldProdMoveBill_Check", 1, true, CurUserName))
             //{
@@ -76,69 +76,97 @@
             //    objJsonResult.data = null;
             //    return objJsonResult;
             //}
-
-            Int64 lngBillKey = 0;
-            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
-            if (lngBillKey == 0)
+            try
             {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill();
-            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-            {
-                if (IsAudit == 1)
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+                if (lngBillKey == 0)
                 {
-                    if (oBill.omodel.HBillStatus == 2)
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill();
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HCloseMan != "")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "褰撳墠鍗曟嵁宸插鏍革紝鏃犻渶鍐嶆瀹℃牳";
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�,涓嶈兘杩涜瀹℃牳";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+
+                    if (oBill.omodel.HDeleteMan != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�,涓嶈兘杩涜瀹℃牳";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (IsAudit == 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 Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1247' and HInterID=" + HInterID);
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
                     else
                     {
-                        string HCheckDate = DateTime.Now.Date.ToString();
-                        oCN.RunProc(" Update Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1247' and HInterID=" + HInterID);
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "瀹℃牳鎴愬姛锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
+                        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 Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1247' 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 Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1247' and HInterID=" + HInterID);
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍告垚鍔燂紒";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
-
             }
-            else
+            catch (Exception e)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栧弽瀹℃牳澶辫触" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
diff --git a/WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs b/WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs
index 2241a1c..55ba567 100644
--- a/WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs
@@ -70,6 +70,164 @@
 
 
 
-        //
+        #region 鐢熶骇鐢ㄦ枡娓呭崟 瀹℃牳/鍙嶅鏍�
+        [Route("Sc_PPBomBill/DeOrAuditBill")]
+        [HttpGet]
+        public object DeOrAuditBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            //    string ModRightNameCheck = ""; 璇ユā鍧楃殑瀹℃牳鍔熻兘
+            DBUtility.ClsPub.CurUserName = CurUserName;//瀛樺偍鐢ㄦ埛鍚�
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //鍒ゆ柇id鏄惁灏忎簬0
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "ID灏忎簬0";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+
+                //鏌ヨ瀹℃牳鐨勮繖鏉℃暟鎹�
+                ds = oCN.RunProcReturn("select *  from  Sc_PPBomBillMain where HInterID=" + lngBillKey, "Sc_PPBomBillMain");
+                if (ds.Tables[0].Rows.Count != 0)
+                {
+                    var HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
+                    //瀹℃牳
+                    if (IsAudit == 0)
+                    {
+                        if (HChecker != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�,涓嶈兘鍐嶆瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+
+                    if (IsAudit == 1)
+                    {
+                        if (HChecker == "")
+                        {
+                            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 (IsAudit == 0)
+                {
+                    if (CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                //鍙嶅鏍�
+                if (IsAudit == 1)
+                {
+                    if (CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栧弽瀹℃牳澶辫触" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        //瀹℃牳
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;//鐢ㄦ埛鍚�
+                oCN.BeginTran();//鎵撳紑浜嬪姟
+                oCN.RunProc("update Sc_PPBomBillMain set HBillStatus=2,hchecker='" + HChecker + "',hcheckdate='" + DateTime.Now + "' where  HInterID='" + lngBillKey);
+                oCN.Commit();//鍏抽棴浜嬪姟
+                sReturn = "瀹℃牳鎴愬姛";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw(e);
+            }
+        }
+        //鍙嶅鏍�
+        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;//鐢ㄦ埛鍚�
+                oCN.BeginTran();//鎵撳紑浜嬪姟
+                oCN.RunProc("update Sc_PPBomBillMain set HBillStatus=1,hchecker='',hcheckdate=null where  HInterID='" + lngBillKey);
+                oCN.Commit();//鍏抽棴浜嬪姟
+                sReturn = "鍙嶅鏍告垚鍔�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index f52237e..e647530 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -703,7 +703,6 @@
     <Compile Include="Controllers\EntrustOutBackController.cs" />
     <Compile Include="Controllers\EntrustOutController.cs" />
     <Compile Include="Controllers\Kf_EntrustInBillController.cs" />
-    <Compile Include="Controllers\MateOutController.cs" />
     <Compile Include="Controllers\OtherOutBillController.cs" />
     <Compile Include="Controllers\OtherInStockController.cs" />
     <Compile Include="Controllers\POStockInBackBillController.cs" />

--
Gitblit v1.9.1