From 92a765acc908b10affb08db65e3a0cefa9ae7efb Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 20 十月 2023 14:17:50 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs |  435 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 434 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index 37c65ea..d42c810 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -18,10 +18,12 @@
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
-
+        public DAL.ClsCg_POOrderBill BillOld = new DAL.ClsCg_POOrderBill();
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
+
+
 
 
         /// <summary>
@@ -1116,6 +1118,437 @@
             }
         }
 
+        #region 閲囪喘璁㈠崟 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Cg_POOrderBill/AuditCg_POOrderBill")]
+        [HttpGet]
+        public object AuditCg_POOrderBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBill_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;
+                BillOld.MvarItemKey = "Cg_POOrderBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿崟鎹�
+                        if (!BillOld.AbandonCheck(Int64.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("Cg_POOrderBill/CloseCg_POOrderBill")]
+        [HttpGet]
+        public object CloseCg_POOrderBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBill_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;
+                BillOld.MvarItemKey = "Cg_POOrderBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!BillOld.CancelClose(Int64.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("Cg_POOrderBill/DropCg_POOrderBill")]
+        [HttpGet]
+        public object DropCg_POOrderBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBill_Drop", 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;
+                BillOld.MvarItemKey = "Cg_POOrderBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!BillOld.AbandonCancelltion(Int64.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("Cg_POOrderBill/Cg_POOrderBillViewApi")]
         [HttpGet]

--
Gitblit v1.9.1