llj
2025-08-07 1a94e0e270668ef1cfbcd5043b72bc6591a50706
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/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");
                }
@@ -315,7 +319,7 @@
            try
            {
                ds = oCN.RunProcReturn(sWhere, "WindowPrint");
                List<object> columnNameList = new List<object>();
                //客户制定
                string sErr = "";
                if (oSystemParameter.ShowBill(ref sErr))
@@ -328,19 +332,26 @@
                    }
                  
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -378,5 +389,9 @@
            }
        }
        #endregion
    }
}