| | |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_Emp"); |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; |
| | | objjson.data = null; |
| | | return objjson; |
| | | // 如果 递入 部门没有维护人员列表 则降级使用老方案 |
| | | return GetEmployeeList_Json2(Employee, HGroupID); |
| | | } |
| | | else |
| | | { |
| | |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | string sql = "exec h_p_Gy_GetQCCheckItemByProject_Sec " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject_Sec"); |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | |
| | | public string HTranslationText_English { get; set; } |
| | | public string HTranslationText_Spain { get; set; } |
| | | public List<MenuLoad> childMenus { get; set; } |
| | | public DateTime HMakeDate { get; set; } |
| | | public string HMaker { get; set; } |
| | | } |
| | | |
| | | [Route("Web/MenuList")] |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构建路由嵌套对象 |
| | | [Route("Web/MenuList_1")] |
| | | [HttpGet] |
| | | public object MenuList_1(string HMakeName, string HType) |
| | | { |
| | | try |
| | | { |
| | | string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json"); |
| | | string directory = Path.GetDirectoryName(filePath); |
| | | if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) |
| | | { |
| | | Directory.CreateDirectory(directory); |
| | | } |
| | | DateTime lastWriteTime = File.GetLastWriteTime(filePath); |
| | | lastWriteTime = new DateTime(lastWriteTime.Year, lastWriteTime.Month, lastWriteTime.Day, lastWriteTime.Hour, 0, 0); |
| | | DataSet ds = oCN.RunProcReturn($"select top 1 HMakeDate from Gy_Menu_1_build ORDER BY HMakeDate desc ", "Gy_Menu_1_build"); |
| | | |
| | | DateTime dbTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["HMakeDate"]); |
| | | dbTime = new DateTime(dbTime.Year, dbTime.Month, dbTime.Day, dbTime.Hour, 0, 0); |
| | | |
| | | if (dbTime> lastWriteTime) |
| | | { |
| | | List<MenuLoad> mu = new List<MenuLoad>(); //以父子级结构存放菜单清单信息 |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //数据库操作工具 |
| | | string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition"; |
| | | ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet"); //查询当前用户的自定义菜单数据 |
| | | if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //判断当前用户是否有设置过自定义信息,若记录数为0,则没有设置过,加载所有的菜单信息 |
| | | { |
| | | string sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName=" + |
| | | "(select top 1 c.GroupName from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId " + |
| | | "left join System_UserGroup c on b.GroupId = c.GroupID where a.Czymc ='" + HMakeName + "' order by len(c.GroupName ))"; |
| | | ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //查询用户绑定的角色 是否设置菜单信息 取角色名称最短的一个 |
| | | if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) |
| | | { |
| | | sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition"; |
| | | ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //查询admin 是否设置菜单信息 |
| | | if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) |
| | | { |
| | | sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1_build where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID "; |
| | | ds = oCn.RunProcReturn(sql, "Gy_Menu_1_build"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //将菜单的根节点保存到列表menu中 |
| | | { |
| | | if (ds.Tables[0].Rows[i]["HPartentID"].ToString() == "0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString()) //判断是否最外层根节点 |
| | | { |
| | | MenuLoad tbj = new MenuLoad(); |
| | | tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString(); |
| | | tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString(); |
| | | tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString(); |
| | | tbj.HPartentID = ds.Tables[0].Rows[i]["HPartentID"].ToString(); |
| | | tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString()); |
| | | tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString(); |
| | | tbj.HShowMode = ds.Tables[0].Rows[i]["HShowMode"].ToString(); |
| | | tbj.HTranslationText_English = ds.Tables[0].Rows[i]["HTranslationText_English"].ToString(); |
| | | tbj.HTranslationText_Spain = ds.Tables[0].Rows[i]["HTranslationText_Spain"].ToString(); |
| | | if (ds.Tables[0].Rows[i]["HPicNum"] != null) |
| | | { |
| | | tbj.HPicNum = ds.Tables[0].Rows[i]["HPicNum"].ToString(); |
| | | } |
| | | mu.Add(tbj); |
| | | } |
| | | } |
| | | diguiLoad(ds.Tables[0], mu); //使用递归,将需要加载的数据以父子级的结构存放在mu中 |
| | | |
| | | |
| | | objJsonResult.code = "1";//信号参数 |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "查询成功!"; |
| | | objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(mu); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | string josncontext = File.ReadAllText(filePath); |
| | | objJsonResult.code = "2"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "查询成功!"; |
| | | objJsonResult.data = josncontext; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询失败!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | public class RequestDto |
| | | { |
| | | public string content { get; set; } |
| | | } |
| | | [Route("Web/buildRouteObj")] |
| | | [HttpPost] |
| | | public object buildRouteObj([FromBody] RequestDto request) |
| | | { |
| | | string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json"); |
| | | try |
| | | { |
| | | string jsonContent = request.content; |
| | | if (string.IsNullOrEmpty(jsonContent)) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "JSON 内容不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(filePath)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "文件路径不能为空。!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string directory = Path.GetDirectoryName(filePath); |
| | | if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) |
| | | { |
| | | Directory.CreateDirectory(directory); |
| | | } |
| | | string contentToWrite = jsonContent; |
| | | |
| | | File.WriteAllText(filePath, contentToWrite); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "文件保存成功,路径为"+filePath; |
| | | objJsonResult.data = null; |
| | | LogService.Write($"路径为{filePath}"); |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | LogService.Write("Exception!" + e.ToString()); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | #region [菜单目录自定义] |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 获取 设备绑定职员信息(带出模具职员信息) 华舟 |
| | | [Route("Web/getEquipBindingEmp")] |
| | | [HttpGet] |
| | | public object getEquipBindingEmp(string HEquipNumber) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_getEquipBindingEmp_huazhou {HEquipNumber}", "h_p_getEquipBindingEmp_huazhou"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前设备没有上模信息"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //添加列名 |
| | | 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.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region APP 获取异常反馈单 获取 检验单内容 通用方法 |
| | | [Route("Web/getCheckBillStatus")] |
| | | [HttpGet] |
| | | public object getCheckBillStatus(Int64 HInterID, string HBillType) |
| | | { |
| | | try { |
| | | string sql = ""; |
| | | List<object> columnNameList = new List<object>(); |
| | | if(HBillType == "7505") |
| | | { |
| | | // 首检 |
| | | sql = $@"SELECT |
| | | a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 日期, a.HBillNo AS 单据号, |
| | | a.HRemark AS 表头备注,s.HName 生产资源名称,s.HNumber 生产资源代码, m.HNumber AS 产品内码, m.HName AS 产品名称, m.HModel AS 产品型号,e.HNumber as 检验员代码, e.HName as 检验员名称, |
| | | a.HMaker AS 制单人, a.HMakeDate AS 制单日期, a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, |
| | | a.HUpDateDate AS 修改日期, a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期, |
| | | a.HBillType AS 单据类型,b.HEntryID hsubid, a.HCheckQty 检验数量, a.HSourceID HSourceID, |
| | | a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 工序流转卡号, |
| | | a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 生产订单号 |
| | | FROM |
| | | dbo.QC_FirstPieceCheckBillMain AS a INNER JOIN |
| | | dbo.QC_FirstPieceCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN |
| | | dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID "; |
| | | sql += $" where a.HInterID = {HInterID}"; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "QC_FirstPieceCheckBillMain"); |
| | | |
| | | } |
| | | else if (HBillType == "7520") |
| | | { |
| | | // 巡检 |
| | | sql = $@"SELECT |
| | | a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 日期, a.HBillNo AS 单据号, |
| | | a.HRemark AS 表头备注,s.HName 生产资源名称,s.HNumber 生产资源代码, m.HNumber AS 产品内码, m.HName AS 产品名称, m.HModel AS 产品型号,e.HNumber as 检验员代码, e.HName as 检验员名称, |
| | | a.HMaker AS 制单人, a.HMakeDate AS 制单日期, a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, |
| | | a.HUpDateDate AS 修改日期, a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期, |
| | | a.HBillType AS 单据类型,b.HEntryID hsubid, a.HCheckQty 检验数量, a.HSourceID HSourceID, |
| | | a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 工序流转卡号, |
| | | a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 生产订单号 |
| | | FROM |
| | | dbo.QC_PatrolProcCheckOtherBillMain AS a INNER JOIN |
| | | dbo.QC_PatrolProcCheckOtherBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN |
| | | dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID "; |
| | | sql += $" where a.HInterID = {HInterID}"; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "QC_PatrolProcCheckOtherBillMain"); |
| | | } |
| | | else if(HBillType == "7507") |
| | | { |
| | | // 末检 |
| | | sql = $@"SELECT |
| | | a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 日期, a.HBillNo AS 单据号, |
| | | a.HRemark AS 表头备注,s.HName 生产资源名称,s.HNumber 生产资源代码, m.HNumber AS 产品内码, m.HName AS 产品名称, m.HModel AS 产品型号,e.HNumber as 检验员代码, e.HName as 检验员名称, |
| | | a.HMaker AS 制单人, a.HMakeDate AS 制单日期, a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, |
| | | a.HUpDateDate AS 修改日期, a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期, |
| | | a.HBillType AS 单据类型,b.HEntryID hsubid, a.HCheckQty 检验数量, a.HSourceID HSourceID, |
| | | a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 工序流转卡号, |
| | | a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 生产订单号 |
| | | , HRemarkSN 条码 |
| | | FROM |
| | | dbo.QC_ProcessCheckBillMain AS a INNER JOIN |
| | | dbo.QC_ProcessCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN |
| | | dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN |
| | | dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID "; |
| | | sql += $" where a.HInterID = {HInterID}"; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "QC_ProcessCheckBillMain"); |
| | | } |
| | | if(ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询数据异常,无检验单!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //添加列名 |
| | | 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.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据设备id获取设备数采数据 |
| | | private class EquipTechParam |
| | | { |
| | | public string TechParamName { get; set; } |
| | | public DateTime CreateTime { get; set; } |
| | | public string Result { get; set; } |
| | | } |
| | | |
| | | [Route("Web/getSB_EquipTechParamBillListByEquipID")] |
| | | [HttpGet] |
| | | public object getSB_EquipTechParamBillListByEquipID(Int64 HEquipID) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | // 工艺参数分类列表 |
| | | List<string> categoryNames = new List<string>(); |
| | | ds = oCN.RunProcReturn($"exec h_p_SB_EquipTechParamBillListByEquipID {HEquipID}", "h_p_SB_EquipTechParamBillListByEquipID"); |
| | | var ds1 = oCN.RunProcReturn($"select * from h_v_Gy_Technology", "h_v_Gy_Technology"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前设备没有数采信息"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | // 遍历获取工艺参数分类列表 |
| | | if (ds1.Tables[0].Rows.Count > 0) |
| | | { |
| | | foreach (DataRow row in ds1.Tables[0].Rows) |
| | | { |
| | | string categoryName = row["工艺参数分类名称"].ToString().Trim(); |
| | | if (!string.IsNullOrEmpty(categoryName)) |
| | | { |
| | | categoryNames.Add(categoryName); |
| | | } |
| | | } |
| | | } |
| | | // 提取原始数据到模型列表 |
| | | var rawParams = new List<EquipTechParam>(); |
| | | foreach (DataRow row in ds.Tables[0].Rows) |
| | | { |
| | | rawParams.Add(new EquipTechParam |
| | | { |
| | | TechParamName = row["HTechParamName"].ToString().Trim(), |
| | | CreateTime = Convert.ToDateTime(row["HCreateTime"]), |
| | | Result = row["HResult"].ToString() |
| | | }); |
| | | } |
| | | |
| | | // 按工艺分类名称分组 |
| | | Dictionary<string, List<EquipTechParam>> groupedParams = new Dictionary<string, List<EquipTechParam>>(); |
| | | // 初始化所有工艺分类分组 |
| | | foreach (string category in categoryNames) |
| | | { |
| | | groupedParams[category] = new List<EquipTechParam>(); |
| | | } |
| | | // 新增“其他参数”兜底分组 |
| | | groupedParams["其他参数"] = new List<EquipTechParam>(); |
| | | |
| | | // 匹配参数到对应分组(按参数名包含分类名称子串) |
| | | foreach (var param in rawParams) |
| | | { |
| | | bool isMatched = false; |
| | | // 遍历所有工艺分类,判断参数名是否包含该分类名称 |
| | | foreach (string category in categoryNames) |
| | | { |
| | | if (param.TechParamName.Contains(category)) |
| | | { |
| | | groupedParams[category].Add(param); |
| | | isMatched = true; |
| | | break; // 匹配到第一个分类后停止(避免重复匹配) |
| | | } |
| | | } |
| | | // 无匹配分类则归为“其他参数” |
| | | if (!isMatched) |
| | | { |
| | | groupedParams["其他参数"].Add(param); |
| | | } |
| | | } |
| | | |
| | | // 转换为JArray格式(前端可直接解析) |
| | | JArray resultJArray = new JArray(); |
| | | foreach (var group in groupedParams) |
| | | { |
| | | // 过滤空分组(无数据的分类不返回) |
| | | if (group.Value.Count == 0) continue; |
| | | |
| | | JObject groupJObj = new JObject(); |
| | | groupJObj.Add("分组名称", group.Key); // 工艺参数分类名称(如中子、保压) |
| | | |
| | | JArray paramsJArray = new JArray(); |
| | | foreach (var param in group.Value.OrderBy(p => p.TechParamName)) |
| | | { |
| | | JObject paramJObj = new JObject(); |
| | | paramJObj.Add("HTechParamName", param.TechParamName); |
| | | paramJObj.Add("HCreateTime", param.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")); |
| | | paramJObj.Add("HResult", param.Result); |
| | | paramsJArray.Add(paramJObj); |
| | | } |
| | | groupJObj.Add("参数列表", paramsJArray); |
| | | resultJArray.Add(groupJObj); |
| | | } |
| | | |
| | | // 保留原有列名逻辑(兼容前端) |
| | | 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)); |
| | | } |
| | | |
| | | // 组装返回结果 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = resultJArray.Count; // 有效分组数量 |
| | | objJsonResult.Message = "Success!"; |
| | | objJsonResult.data = resultJArray; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |