From 1a94e0e270668ef1cfbcd5043b72bc6591a50706 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期四, 07 八月 2025 15:18:46 +0800
Subject: [PATCH] 价目表新增审核按钮无效修理bug

---
 WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillListController.cs |  123 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 117 insertions(+), 6 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_SOPBillListController.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_SOPBillListController.cs"
index 9da1975..f646d64 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_SOPBillListController.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_SOPBillListController.cs"
@@ -10,6 +10,9 @@
 using System.Web.Http;
 using System.Windows.Forms;
 using WebAPI.Models;
+using Newtonsoft.Json;
+using System.Collections.Generic;
+
 //using Excel = Microsoft.Office.Interop.Excel;
 
 
@@ -24,6 +27,7 @@
         DataSet ds;
         DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill();
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
 
         public DataGridView grdMain = new System.Windows.Forms.DataGridView();
 
@@ -46,12 +50,12 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList order by hmainid ", "h_v_Gy_SOPBillList");
+                    ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList order by hmainid desc ", "h_v_Gy_SOPBillList");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_Gy_SOPBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by hmainid ";
+                    string sql = sql1 + sWhere + " order by hmainid desc";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_SOPBillList");
                 }
 
@@ -82,6 +86,71 @@
             }
         }
         #endregion
+
+        /// <summary>
+        /// 浣滀笟鎸囧涔﹀垹闄�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Gy_SOPBill/Del")]
+        [HttpGet]
+        public object Del(string hmainid, string hsubid, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_SOPBill_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(hmainid))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璧勬枡鍐呯爜涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+                ds = oCN.RunProcReturn("select * from Gy_SOPBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid, "Gy_SOPBillSub");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+
+                oCN.RunProc("delete Gy_SOPBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
+                oCN.RunProc("delete Gy_SOPBillSub2 where HInterID=" + hmainid + " and HEntryID=" + hsubid);
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                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;
+            }
+        }
+
         #region 寮曞嚭
         [Route("Gy_SOPBill/SetExcel")]
         [HttpGet]
@@ -208,7 +277,6 @@
         }
         #endregion
 
-
         //
         private Int32 Fun_GetCol(string sCol)
         {
@@ -251,7 +319,7 @@
             try
             {
                 ds = oCN.RunProcReturn(sWhere, "WindowPrint");
-
+                List<object> columnNameList = new List<object>();
                 //瀹㈡埛鍒跺畾
                 string sErr = "";
                 if (oSystemParameter.ShowBill(ref sErr))
@@ -264,16 +332,55 @@
                     }
                   
                 }
-               
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.Message = "[0000-1-037]Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
             }
             catch (Exception e)
             {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[0000-1-038]Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 瀵规暟鎹簱杩涜鎿嶄綔
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("Gy_SOPBillList/UpDelSQL")]
+        [HttpGet]
+        public object UpDelSQL(string sWhere)
+        {
+            try
+            {
+                oCN.BeginTran();
+                oCN.RunProc(sWhere);
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "Exception锛�" + e.ToString();
@@ -282,5 +389,9 @@
             }
         }
         #endregion
+
+
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1