From 871bc633a7daf1893acc98a84c64c93c9a30aaff Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 10 十二月 2024 15:28:13 +0800
Subject: [PATCH] 器具保养规程、器具点检规程、设备点检规程导出添加

---
 WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs |  193 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 128 insertions(+), 65 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs b/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs
index ed00983..1631778 100644
--- a/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs
@@ -32,7 +32,7 @@
         /// </summary>
         [Route("Xs_CusBalanceReport/list")]
         [HttpGet]
-        public object getXs_CusBalanceReport(string sWhere, string user)
+        public object getXs_CusBalanceReport(string sWhere, string user, string userid)
         {
             try
             {
@@ -47,77 +47,21 @@
                     return objJsonResult;
                 }
 
-                //鑾峰彇瀹㈡埛
+
+                //鏌ヨ
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    string sql = "select a.HItemID HCusID,a.HNumber HCusNumber,a.HName HCusName,b.HItemID HCurID,b.HName HCurName " +
-                        " from Gy_Customer as a " +
-                        " left join Gy_Currency as b on a.HCurID = b.HItemID " +
-                        " order by a.HNumber ";
-                    ds = oCN.RunProcReturn(sql, "Gy_Customer");
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
                 }
                 else
                 {
-                    string sql1 = "select a.HItemID HCusID,a.HNumber HCusNumber,a.HName HCusName,b.HItemID HCurID,b.HName HCurName " +
-                        " from Gy_Customer as a " +
-                        " inner join Gy_Currency as b on a.HCurID = b.HItemID " +
-                        " where 1=1  ";
-                    string sql = sql1 + sWhere + " order by a.HNumber ";
-                    ds = oCN.RunProcReturn(sql, "Gy_Customer");
-                }
-
-                //鍒涘缓涓存椂琛�
-                DataTable tb2 = new DataTable("dt2");
-                //妯℃澘缂哄皯鍒� 浣嗛渶瑕佷粠鏁版嵁搴撲腑鏌ヨ鍑烘潵鏄剧ず鍦ㄩ〉闈㈢殑瀛楁
-                tb2.Columns.Add("瀹㈡埛鍐呯爜", typeof(string));
-                tb2.Columns.Add("瀹㈡埛浠g爜", typeof(string));
-                tb2.Columns.Add("瀹㈡埛鍚嶇О", typeof(string));
-                tb2.Columns.Add("甯佸埆鍐呯爜", typeof(string));
-                tb2.Columns.Add("甯佸埆鍚嶇О", typeof(string));
-                tb2.Columns.Add("瀹㈡埛浣欓", typeof(string));
-                tb2.Columns.Add("鍗犵敤棰濆害", typeof(string));
-                tb2.Columns.Add("鍙敤棰濆害", typeof(string));
-
-                for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
-                {
-                    string HCusID = ds.Tables[0].Rows[i]["HCusID"].ToString();
-                    string HCusNumber = ds.Tables[0].Rows[i]["HCusNumber"].ToString();
-                    string HCusName = ds.Tables[0].Rows[i]["HCusName"].ToString();
-                    string HCurID = ds.Tables[0].Rows[i]["HCurID"].ToString();
-                    string HCurName = ds.Tables[0].Rows[i]["HCurName"].ToString();
-
-                    //鑾峰彇瀵瑰簲瀹㈡埛鐨勫鎴蜂綑棰濄�佷俊鐢ㄩ搴︺�佸彲鐢ㄤ綑棰�
-                    string sql = "exec Xs_CusBalanceReport_Query " + HCusID;
-                    DataSet ds2 = oCN.RunProcReturn(sql, "Xs_CusBalanceReport_Query");
-                    if (ds2 == null||ds2.Tables.Count==0)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "Exception锛佹湭鑾峰彇鍒板搴斿鎴穂" + HCusNumber + "][" + HCusName + "]鐨勪綑棰濅俊鎭紒锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-
-                    if (Double.Parse(ds2.Tables[0].Rows[0]["HCusBalance"].ToString()) <= 0)
-                    {
-                        continue;
-                    }
-
-                    //鍚戜复鏃惰〃鎻掑叆鏁版嵁
-                    DataRow row = tb2.NewRow();
-                    row[0] = HCusID;
-                    row[1] = HCusNumber;
-                    row[2] = HCusName;
-                    row[3] = HCurID;
-                    row[4] = HCurName;
-                    row[5] = ds2.Tables[0].Rows[0]["HCusBalance"].ToString();
-                    row[6] = Double.Parse(ds2.Tables[0].Rows[0]["HCusBalance"].ToString()) + Double.Parse(ds2.Tables[0].Rows[0]["HCreditRating_Now"].ToString()) - Double.Parse(ds2.Tables[0].Rows[0]["HAvailableBalance"].ToString());
-                    row[7] = ds2.Tables[0].Rows[0]["HAvailableBalance"].ToString();
-                    tb2.Rows.Add(row);
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '" + sWhere + "','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
                 }
 
                 //娣诲姞鍒楀悕
-                foreach (DataColumn col in tb2.Columns)
+                foreach (DataColumn col in ds.Tables[0].Columns)
                 {
                     Type dataType = col.DataType;
                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
@@ -127,7 +71,126 @@
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = tb2;
+                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.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 瀹㈡埛浣欓鏌ヨ鎶ヨ〃 鍗犵敤棰濆害鏄庣粏
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xs_CusBalanceReport/getHIsUsingBalanceEntry")]
+        [HttpGet]
+        public object getHIsUsingBalanceEntry(string sWhere,Int64 HCusID, string user, string userid)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //////鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Xs_CusBalanceReport_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //鏌ヨ
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_HIsUsingBalanceEntry_Query '','" + userid + "'," + HCusID;
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+                else
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_HIsUsingBalanceEntry_Query '" + sWhere +"','" + userid + "'," + HCusID;
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                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.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍑哄簱鏉$爜鏄庣粏鎶ヨ〃 鏌ヨ
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xs_SellOutCompareToProductReport/list")]
+        [HttpGet]
+        public object getXs_SellOutCompareToProductReport(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Xs_SellOutCompareToProductReport", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Xs_SellOutCompareToProductReport order by 鏃ユ湡 desc", "h_v_Xs_SellOutCompareToProductReport");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Xs_SellOutCompareToProductReport where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鏃ユ湡 desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Xs_SellOutCompareToProductReport");
+                }
+
+                //娣诲姞鍒楀悕
+                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.data = ds.Tables[0];
                 objJsonResult.list = columnNameList;
                 return objJsonResult;
             }

--
Gitblit v1.9.1