From adce417074cc328e1d86cfc978c8eae01b628ce6 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Thu, 21 Jul 2022 09:16:07 +0800 Subject: [PATCH] 1 --- web/djy.Service/Ams/AmsService.cs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/web/djy.Service/Ams/AmsService.cs b/web/djy.Service/Ams/AmsService.cs index 3968c4b..ba06abc 100644 --- a/web/djy.Service/Ams/AmsService.cs +++ b/web/djy.Service/Ams/AmsService.cs @@ -40,7 +40,7 @@ namespace djy.Service.Ams public TableData Load(AMSQuery req, User user, UserAuthorityDto aut) { var result = new TableData(); - + int count = 0; string[] ReportStates = null; if (req.ReportState != null) { @@ -65,10 +65,11 @@ namespace djy.Service.Ams .WhereIf(hou != null, x => hou.Contains(x.GID)) .WhereIf(req.BDate != null, x => x.CreateTime >= req.BDate) .WhereIf(req.EDate != null, x => x.CreateTime <= req.EDate).OrderByDescending(x => x.CreateTime); - result.count = dto.ToList().Count(); + var list = dto.Page(req.Page, req.Limit).ToList(); if (list != null) { + foreach (var item in list) { var historyDto = DbBus.Get(DbList.AMSCenter).Select().Where(x => x.AM_ID == item.GID).OrderByDescending(x => x.SendTime).ToList(); @@ -76,9 +77,9 @@ namespace djy.Service.Ams var hodto = DbBus.Get(DbList.AMSCenter).Select().Where(x =>x.IsDel !=true && x.PID == item.GID) .WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim())) .WhereIf(req.ReportState == "0", x => x.ReportState == "未申报" || x.ReportState == "接收失败") - .WhereIf(req.ReportState == "1", x => !(x.ReportState == "未申报" || x.ReportState == "接收失败")) - .WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState)) - .ToList(); + .WhereIf(req.ReportState == "1", x => !(x.ReportState == "未申报" || x.ReportState == "接收失败")) + .WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState)) + .ToList(); item.HouseDto = hodto; if (hodto != null) { @@ -88,9 +89,20 @@ namespace djy.Service.Ams it.CntrnoDto = cnt; } } + count += hodto.Count(); } + + + } + result.data = list.Where(x=>x.HouseDto!=null && x.HouseDto.Count() > 0).ToList(); + if (req.ReportState == "0") + { + result.count = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList().Count(); + } + else { + result.count = count; } - result.data = list; + return result; } #endregion