From a1c3a3d1b0b0b8c28a19e99177e4cee5a64949b7 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 25 二月 2025 11:20:17 +0800 Subject: [PATCH] 增加斯莫尔 性能检测散点图报表 --- WebAPI/Controllers/BaseSet/Gy_CustomerController.cs | 185 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 170 insertions(+), 15 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs index 61379b9..18b2239 100644 --- a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs @@ -9,6 +9,12 @@ using System.Web.Http; using WebAPI.Models; using System.Text.RegularExpressions; +using SyntacticSugar.constant; +using System.Web; +using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�; +//using WebAPI.WebBLL.JCJM.GYZL; +//using WebAPI.WebBLL.JCJM.IMPL; +using System.IO; namespace WebAPI.Controllers { public class Gy_CustomerController : ApiController @@ -19,9 +25,10 @@ private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //private Gy_CustomerService customerService = new Gy_CustomerImpl(); DataSet ds; - + #region 杩斿洖瀹㈡埛鍒楄〃 /// <summary> /// 杩斿洖瀹㈡埛鍒楄〃 ///鍙傛暟锛歴tring sql銆� @@ -93,6 +100,74 @@ return objJsonResult; } } + #endregion + + #region 瀹㈡埛鍒嗛〉鍒楄〃 + [Route("Gy_Customer/page")] + [HttpGet] + public json Gy_CustomerPage(string sWhere, string user, int page, int size, string Organization) + { + DataSet ds; + json res = new json(); + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Crm_CustomerFileList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //瀹㈡埛鍒跺畾 + string sErr = ""; + if (oSystemParameter.ShowBill(ref sErr)) + { + if (oSystemParameter.omodel.WMS_CampanyName != "涔斾竴") + { + sWhere += ("and 缁勭粐鍚嶇О = '" + Organization + "'"); + } + } + + + sWhere = sWhere.Replace("'", "''"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_Gy_CustomerList " + page + "," + size + ",''", "h_p_Gy_CustomerList"); + } + else + { + ds = oCN.RunProcReturn("exec h_p_Gy_CustomerList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_CustomerList"); + } + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + res.code = CodeConstant.SUCCEED; + res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + res.Message = "Sucess锛�"; + res.list = columnNameList; + res.data = ds.Tables[0]; + return res; + } + catch (Exception e) + { + res.code = CodeConstant.FAIL; + res.count = CountConstant.FAIL; + res.Message = "Exception锛�" + e.ToString(); + res.data = null; + return objJsonResult; + } + } + #endregion + #region 瀹㈡埛瀛愯〃[鍏宠仈鐢ㄦ埛] 鏌ヨ /// <summary> @@ -137,6 +212,7 @@ } #endregion + #region 瀹㈡埛鍒楄〃淇敼鎸夐挳鏂规硶 /// <summary> /// 瀹㈡埛鍒楄〃淇敼鎸夐挳鏂规硶 ///鍙傛暟锛歴tring sql銆� @@ -174,7 +250,7 @@ return objJsonResult; } } - + #endregion #region 鑾峰彇褰撳墠鏈�澶х殑瀹㈡埛浠g爜 [Route("Gy_Customer/getMaxCusNumber")] @@ -214,6 +290,7 @@ } #endregion + #region 鑾峰彇鏈�澶ц祫鏂橧D鍙傛暟 /// <summary> /// 鑾峰彇鏈�澶у熀纭�璧勬枡ID ///鍙傛暟锛歴tring sql銆� @@ -242,6 +319,7 @@ return objJsonResult; } } + #endregion #region 瀹㈡埛鏍规嵁鍒嗙被鑾峰彇鏈�澶у鎴风紪鐮� [Route("Gy_Customer/getMaxNum")] @@ -281,7 +359,7 @@ } string HNumber = ds.Tables[0].Rows[0]["瀹㈡埛浠g爜"].ToString(); // 浣跨敤姝e垯琛ㄨ揪寮忔壘鍒版暟瀛楅儴鍒� (?<=\D)鏄竴涓浂瀹芥柇瑷�锛岃〃绀哄墠闈㈢殑瀛楃涓嶆槸鏁板瓧 (\d+)$琛ㄧず鍚庨潰璺熺潃涓�杩炰覆瀛楃涓茬煡閬撴湯灏� - Match match = Regex.Match(HNumber, @"(?<=\D)(\d+)$"); + Match match = Regex.Match(HNumber, @"(\d+)$"); if (match.Success) { string prefix = HNumber.Substring(0, HNumber.Length - match.Length); // 鎻愬彇鍓嶇紑 @@ -320,7 +398,7 @@ } #endregion - + #region 瀹㈡埛鍒楄〃鏍戝舰缁撴瀯 /// <summary> /// 瀹㈡埛鍒楄〃鏍戝舰缁撴瀯 ///鍙傛暟锛歴tring sql銆� @@ -350,7 +428,9 @@ return objJsonResult; } } + #endregion + #region 鏂板鍗曟嵁 /// <summary> /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 ///鍙傛暟锛歴tring sql銆� @@ -506,9 +586,14 @@ return objJsonResult; } } + #endregion - - + #region 淇濆瓨瀹㈡埛鍒楄〃 + /// <summary> + /// 淇濆瓨瀹㈡埛鍒楄〃 + /// </summary> + /// <param name="oMain"></param> + /// <returns></returns> [Route("Gy_Customer/SaveGy_CustomerListApi")] [HttpPost] public object SaveGy_CustomerListApi([FromBody] JObject oMain) @@ -632,9 +717,9 @@ return objJsonResult; } } + #endregion - - + #region 淇敼鍗曟嵁-淇濆瓨鎸夐挳 /// <summary> /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 ///鍙傛暟锛歴tring sql銆� @@ -805,9 +890,9 @@ return objJsonResult; } } + #endregion - - + # region 瀹㈡埛鍒楄〃鍒犻櫎鎸夐挳 /// <summary> /// 瀹㈡埛鍒楄〃鍒犻櫎鎸夐挳 ///鍙傛暟锛歴tring sql銆� @@ -898,7 +983,7 @@ return objJsonResult; } } - + #endregion #region 瀹㈡埛瀹℃牳銆佸弽瀹℃牳 /// <summary> @@ -1090,7 +1175,6 @@ } #endregion - #region [鍚屾鍩虹璧勬枡] [Route("Gy_Customer/Gy_CustomerViewApi")] [HttpGet] @@ -1253,7 +1337,7 @@ } #endregion - #region 瀹㈡埛鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�) + #region 瀹㈡埛鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�) [Route("Gy_BadReason/Gy_CusrTypeTreeList")] [HttpGet] @@ -1309,7 +1393,7 @@ { try { - string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber"); + string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber "); ds = oCN.RunProcReturn(sql1, "Gy_CusType"); @@ -1349,7 +1433,77 @@ } #endregion + #region 瀹㈡埛鍒楄〃 鏂囦欢涓婁紶 + //[Route("Gy_Customer/Gy_Process_Excel")] + //[HttpPost] + //public json Gy_Department_Excel() + //{ + // json res = new json(); + // try + // { + // //鑾峰彇鏂囦欢鍚嶇О + // var file = HttpContext.Current.Request.Files[0]; + // //鑾峰彇鏂囦欢鐗╃悊璺緞 + // string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); + // //淇濆瓨鏂囦欢 + // file.SaveAs(ExcelPath); + // NpoiHelper np = new NpoiHelper(); + // DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0"); + // //鍒犻櫎鏂囦欢 + // File.Delete(ExcelPath); + // DataTable provisional = customerService.UploadExcel(ExcelDs); + + // res.code = CodeConstant.SUCCEED; + // res.count = CountConstant.SUCCEED; + // res.Message = "涓婁紶鎴愬姛"; + // res.data = provisional; + // return res; + // } + // catch (Exception e) + // { + // res.code = "0"; + // res.count = 0; + // res.Message = "Exception锛�" + e.ToString(); + // res.data = null; + // return res; + // } + //} + + /// <summary> + /// 鍒ゆ柇褰撳墠鑱屽憳鏄惁瀛樺湪 + /// </summary> + /// <param name="HEmpNumber"></param> + /// <param name="HEmpName"></param> + /// <returns></returns> + //private bool JudgeEmp(string HEmpNumber, string HEmpName) + //{ + // if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName)) + // { + // DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee"); + // return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false; + // } + // return false; + //} + + /// <summary> + /// 鍒ゆ柇鍒� + /// </summary> + /// <param name="provisional"></param> + /// <returns></returns> + private static string JudgmentColumns(DataTable provisional) + { + var error = ""; + + //鏌ヨ娌℃湁鐨勫垪 + if (!provisional.Columns.Contains("閮ㄩ棬浠g爜")) + error += "娌℃湁鎵惧埌銆愰儴闂ㄤ唬鐮併�戠殑鏍囬,"; + + if (!provisional.Columns.Contains("閮ㄩ棬鍚嶇О")) + error += "娌℃湁鎵惧埌銆愰儴闂ㄥ悕绉般�戠殑鏍囬,"; + return error; + } + #endregion #region 鐗╂枡鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�) @@ -1375,7 +1529,6 @@ getTreeByLevel(dt, tree[m].children, num + 1);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦 } } - } public class TreeModel { @@ -1386,6 +1539,7 @@ #endregion + #region 閫掑綊鍑芥暟 /// <summary> /// 閫掑綊鍑芥暟 /// </summary> @@ -1415,4 +1569,5 @@ } } + #endregion } \ No newline at end of file -- Gitblit v1.9.1