From b0688c1efd606284fd5bc31f2d60a1fec9aef968 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 08 四月 2025 11:20:50 +0800
Subject: [PATCH] 自定义菜单优化

---
 WebAPI/Controllers/基础资料/基础资料/Gy_MatePriceSupController.cs |  272 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 235 insertions(+), 37 deletions(-)

diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
index c2dd857..cee9193 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
@@ -27,15 +27,15 @@
             {
                 List<object> columnNameList = new List<object>();
                 //缂栬緫鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
-                string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList where 1 = 1 ");
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList_Sec where 1 = 1 ");
 
                 string sql = sql1 + sWhere;
                 ds = oCN.RunProcReturn(sql, "h_v_Gy_MatePriceSupList");
@@ -66,6 +66,45 @@
         }
         #endregion
 
+        #region  閲囪喘浠锋牸 缂栬緫鏌ョ湅淇℃伅
+        [Route("Gy_MatePriceSup/cx")]
+        [HttpGet]
+        public object cx(string HItemID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupEdit where HItemID = " + HItemID);
+
+                ds = oCN.RunProcReturn(sql1, "h_v_Gy_MatePriceSupEdit");
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region  閲囪喘浠锋牸 缂栬緫
         [Route("Gy_MatePriceSup/MatePriceSupEdit")]
         [HttpPost]
@@ -77,19 +116,16 @@
             string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg1 = sArray[0].ToString();
             string msg2 = sArray[1].ToString();
-            //string msg_HUSEORGID = sArray[2].ToString();
-            Int64 HItemID = 0;
-            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
             //缂栬緫鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
-            //{
-            //    objJsonResult.code = "0";
-            //    objJsonResult.count = 0;
-            //    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
-            //    objJsonResult.data = null;
-            //    return objJsonResult;
-            //}
+            if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
             //鑾峰彇鏈�澶D鍊艰祴鍊�
             //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate");
@@ -186,6 +222,16 @@
                 }
                 else
                 {
+                    //鏄惁宸茬粡瀹℃牳鍒ゆ柇
+                    DataSet Maxds = oCN.RunProcReturn("select * from h_v_Gy_MatePriceSupEdit where HItemID =  " + oBill.oModel.HItemID, "h_v_Gy_MatePriceSupEdit");
+                    if (Maxds != null && Maxds.Tables[0].Rows[0]["瀹℃牳浜�"].ToString()!="")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍告棤娉曠紪杈戯紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                 }
                 if (bResult)
@@ -227,14 +273,14 @@
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log("Gy_MatePriceSupList_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 if (string.IsNullOrWhiteSpace(HItemID))
                 {
                     objJsonResult.code = "0";
@@ -254,15 +300,15 @@
                     return objJsonResult; ;
                 }
                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
-                //if (HStopflag)
-                //{
-                //    oCN.RollBack();//鍥炴粴浜嬪姟
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (ds.Tables[0].Rows[0]["HChecker"].ToString()!="")
+                {
+                    
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏁版嵁宸插鏍告棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 oCN.RunProc("delete from Gy_MatePriceSup where HItemID=" + HItemID);
                 oCN.Commit();//鎻愪氦浜嬪姟
@@ -328,5 +374,157 @@
             }
         }
         #endregion
+
+        #region 瀹℃牳銆佸弽瀹℃牳
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_MatePriceSup/CheckGy_MatePriceSup")]
+        [HttpGet]
+        public object CheckGy_MatePriceSup(long HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_MatePriceSup where HItemID=" + HInterID, "Gy_MatePriceSup");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MatePriceSup set HChecker='" + CurUserName + "',HCheckDate=getdate() where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MatePriceSup set HChecker='',HCheckDate=null where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎵归噺瀹℃牳
+        /// <summary>
+        /// 鎵归噺瀹℃牳
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_MatePriceSup/CheckAll")]
+        [HttpGet]
+        public object CheckAll(string ids, int Type, string HMaker)
+        {
+            try
+            {
+                //澶勭悊瀛楃涓�
+                if (!string.IsNullOrEmpty(ids))
+                {
+                    long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse);
+                    // 澶勭悊idArray...
+                    for (int i = 0; i < idArray.Length; i++)
+                    {
+                        objJsonResult = (json)CheckGy_MatePriceSup(idArray[i], Type, HMaker);//瀹℃牳鎵ц
+                        if (objJsonResult.count == 0)
+                        {
+
+                            objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�";
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨姝g‘琛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1