diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 9efc72cb..cd98afe7 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -497,6 +497,329 @@ namespace Myshipping.Application return list; } + + /// + /// 分页查询订舱主表 + /// + /// + /// + [HttpPost("/BookingOrder/PageData")] + public async Task PageData(BookingOrderInput input) + { + List userlist = await _right.GetDataScopeList(351064299098181); + List pidlist = new List(); + if (!string.IsNullOrWhiteSpace(input.SEALNO) || !string.IsNullOrWhiteSpace(input.CNTRNO)) + { + pidlist = await _repCtn.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(input.SEALNO), x => x.SEALNO.StartsWith(input.SEALNO)).WhereIF(!string.IsNullOrWhiteSpace(input.CNTRNO), x => x.CNTRNO.StartsWith(input.CNTRNO)).Select(x => x.BILLID).ToListAsync(); + } + var ftoday = DateTime.Now.AddDays(-15); + var etoday = DateTime.Now.AddDays(15); + //List userlist = await DataFilterExtensions.GetDataScopeIdList(); + + //按部门查询 + List saleUserList = null; + List opUserList = null; + if (input.OrgSale.HasValue) + { + var tmpList = await _orgService.GetUserIdListInOrg(input.OrgSale.Value); + saleUserList = tmpList.Select(x => x.ToString()).ToList(); + } + + if (input.OrgOp.HasValue) + { + var tmpList = await _orgService.GetUserIdListInOrg(input.OrgOp.Value); + opUserList = tmpList.Select(x => x.ToString()).ToList(); + } + + #region + var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID) + .WhereIF(!input.ISDel, x => x.IsDeleted == false) + .WhereIF(input.ISDel, x => x.IsDeleted == true) + .WhereIF(input.firstFlag, x => x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null) + .Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!! + .WhereIF(pidlist != null && pidlist.Count > 0, x => pidlist.Contains(x.Id)) + .WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS) + .WhereIF(input.BBSDATE != null, u => u.BSDATE >= input.BBSDATE) + .WhereIF(input.EBSDATE != null, u => u.BSDATE <= input.EBSDATE) + .WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && !input.MBLNO.Contains(','), u => u.MBLNO.Contains(input.MBLNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.TMBLNO) && !input.TMBLNO.Contains(','), u => u.TMBLNO.Contains(input.TMBLNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && !input.HBLNO.Contains(','), u => u.HBLNO.Contains(input.HBLNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && input.MBLNO.Contains(','), u => input.MBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.MBLNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && input.HBLNO.Contains(','), u => input.HBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.HBLNO.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO.Contains(input.BOOKINGNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO.Contains(input.CONTRACTNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO.Contains(input.SERVICECONTRACTNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPER), u => u.SHIPPER.Contains(input.SHIPPER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEE), u => u.CONSIGNEE.Contains(input.CONSIGNEE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY), u => u.NOTIFYPARTY.Contains(input.NOTIFYPARTY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY2), u => u.NOTIFYPARTY2.Contains(input.NOTIFYPARTY2)) + .WhereIF(!string.IsNullOrWhiteSpace(input.YARDID), u => u.YARDID == input.YARDID) + .WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID.Contains(input.VESSELID)) + .WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL.ToLower().Contains(input.VESSEL.ToLower())) + .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER)) + .WhereIF(input.BETD != null, u => u.ETD >= input.BETD) + .WhereIF(input.EETD != null, u => u.ETD <= input.EETD) + .WhereIF(input.BATD != null, u => u.ATD >= input.BATD) + .WhereIF(input.EATD != null, u => u.ATD <= input.EATD) + .WhereIF(input.BCLOSINGDATE != null, u => u.CLOSINGDATE >= input.BCLOSINGDATE) + .WhereIF(input.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE) + .WhereIF(input.BCLOSEDOCDATE != null, u => u.CLOSEDOCDATE >= input.BCLOSEDOCDATE) + .WhereIF(input.ECLOSEDOCDATE != null, u => u.CLOSEDOCDATE <= input.ECLOSEDOCDATE) + .WhereIF(input.BCLOSEVGMDATE != null, u => u.CLOSEVGMDATE >= input.BCLOSEVGMDATE) + .WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE) + .WhereIF(input.BETA != null, u => u.ETA >= input.BETA) + .WhereIF(input.EETA != null, u => u.ETA <= input.EETA) + .WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT)) + .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) + .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID) + .WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGEID), u => u.PORTDISCHARGEID == input.PORTDISCHARGEID) + .WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY.Contains(input.PLACEDELIVERY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERYID), u => u.PLACEDELIVERYID == input.PLACEDELIVERYID) + .WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATION), u => u.DESTINATION.Contains(input.DESTINATION)) + .WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATIONID), u => u.DESTINATIONID == input.DESTINATIONID) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOBILL), u => u.NOBILL == input.NOBILL) + .WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILL == input.COPYNOBILLL) + .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE) + .WhereIF(input.BISSUEDATE != null, u => u.ISSUEDATE >= input.BISSUEDATE) + .WhereIF(input.EISSUEDATE != null, u => u.ISSUEDATE <= input.EISSUEDATE) + .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE.Contains(input.ISSUEPLACE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID) + .WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT) + .WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDATID), u => u.PREPARDATID == input.PREPARDATID) + .WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDAT), u => u.PREPARDAT == input.PREPARDAT) + .WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEAT), u => u.PAYABLEAT.Contains(input.PAYABLEAT)) + .WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID) + .WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE.Contains(input.SERVICE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS.Contains(input.MARKS)) + .WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION.Contains(input.DESCRIPTION)) + .WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS) + .WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL.StartsWith(input.CNTRTOTAL)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID == input.CARRIERID) + .WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CARGOID), u => u.CARGOID == input.CARGOID) + .WhereIF(!string.IsNullOrWhiteSpace(input.DCLASS), u => u.DCLASS == input.DCLASS) + .WhereIF(!string.IsNullOrWhiteSpace(input.DUNNO), u => u.DUNNO == input.DUNNO) + .WhereIF(!string.IsNullOrWhiteSpace(input.DPAGE), u => u.DPAGE == input.DPAGE) + .WhereIF(!string.IsNullOrWhiteSpace(input.DLABEL), u => u.DLABEL == input.DLABEL) + .WhereIF(!string.IsNullOrWhiteSpace(input.LINKMAN), u => u.LINKMAN == input.LINKMAN) + .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPID), u => u.TEMPID == input.TEMPID) + .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPSET), u => u.TEMPSET == input.TEMPSET) + .WhereIF(!string.IsNullOrWhiteSpace(input.REEFERF), u => u.REEFERF == input.REEFERF) + .WhereIF(!string.IsNullOrWhiteSpace(input.HUMIDITY), u => u.HUMIDITY == input.HUMIDITY) + .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMIN), u => u.TEMPMIN == input.TEMPMIN) + .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMAX), u => u.TEMPMAX == input.TEMPMAX) + .WhereIF(input.ISCONTAINERSOC != null, u => u.ISCONTAINERSOC == input.ISCONTAINERSOC) + .WhereIF(!string.IsNullOrWhiteSpace(input.SOREMARK), u => u.SOREMARK.Contains(input.SOREMARK)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK.Contains(input.SIREMARK)) + .WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK.Contains(input.YARDREMARK)) + .WhereIF(!string.IsNullOrWhiteSpace(input.COMPID), u => u.COMPID == input.COMPID) + .WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.Contains(input.COMPNAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME.Contains(input.SHIPPERNAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY.Contains(input.SHIPPERCITY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPROVINCE), u => u.SHIPPERPROVINCE == input.SHIPPERPROVINCE) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPOSTCODE), u => u.SHIPPERPOSTCODE == input.SHIPPERPOSTCODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCOUNTRY), u => u.SHIPPERCOUNTRY == input.SHIPPERCOUNTRY) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERATTN), u => u.SHIPPERATTN.Contains(input.SHIPPERATTN)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERTEL), u => u.SHIPPERTEL == input.SHIPPERTEL) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEENAME), u => u.CONSIGNEENAME.Contains(input.CONSIGNEENAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEECITY), u => u.CONSIGNEECITY.Contains(input.CONSIGNEECITY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPROVINCE), u => u.CONSIGNEEPROVINCE == input.CONSIGNEEPROVINCE) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPOSTCODE), u => u.CONSIGNEEPOSTCODE == input.CONSIGNEEPOSTCODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEERCOUNTRY), u => u.CONSIGNEERCOUNTRY == input.CONSIGNEERCOUNTRY) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEATTN), u => u.CONSIGNEEATTN.Contains(input.CONSIGNEEATTN)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEETEL), u => u.CONSIGNEETEL == input.CONSIGNEETEL) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYNAME), u => u.NOTIFYPARTYNAME.Contains(input.NOTIFYPARTYNAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCITY), u => u.NOTIFYPARTYCITY.Contains(input.NOTIFYPARTYCITY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPROVINCE), u => u.NOTIFYPARTYPROVINCE == input.NOTIFYPARTYPROVINCE) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPOSTCODE), u => u.NOTIFYPARTYPOSTCODE == input.NOTIFYPARTYPOSTCODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCOUNTRY), u => u.NOTIFYPARTYCOUNTRY == input.NOTIFYPARTYCOUNTRY) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYATTN), u => u.NOTIFYPARTYATTN.Contains(input.NOTIFYPARTYATTN)) + .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYTEL), u => u.NOTIFYPARTYTEL == input.NOTIFYPARTYTEL) + .WhereIF(!string.IsNullOrWhiteSpace(input.PONO), u => u.PONO == input.PONO) + .WhereIF(!string.IsNullOrWhiteSpace(input.OPID), u => u.OPID == input.OPID) + .WhereIF(!string.IsNullOrWhiteSpace(input.DOCID), u => u.DOCID == input.DOCID) + .WhereIF(!string.IsNullOrWhiteSpace(input.OP), u => u.OP == input.OP) + .WhereIF(!string.IsNullOrWhiteSpace(input.DOC), u => u.DOC == input.DOC) + .WhereIF(!string.IsNullOrWhiteSpace(input.SALEID), u => u.SALEID == input.SALEID) + .WhereIF(!string.IsNullOrWhiteSpace(input.SALE), u => u.SALE.Contains(input.SALE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME)) + .WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID) + .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID) + .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY.Contains(input.SHIPAGENCY)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCYID), u => u.SHIPAGENCYID == input.SHIPAGENCYID) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER.Contains(input.CUSTOMSER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSERID), u => u.CUSTOMSERID == input.CUSTOMSERID) + .WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER.Contains(input.TRUCKER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKERID), u => u.TRUCKERID == input.TRUCKERID) + .WhereIF(!string.IsNullOrWhiteSpace(input.AGENTNAME), u => u.AGENTNAME.Contains(input.AGENTNAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.WEITUO), u => u.WEITUO.Contains(input.WEITUO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.SCACCODE), u => u.SCACCODE == input.SCACCODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.ITNCODE), u => u.ITNCODE == input.ITNCODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTNO), u => u.CUSTNO.Contains(input.CUSTNO)) + .WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORTID), u => u.TRANSPORTID == input.TRANSPORTID) + .WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORT), u => u.TRANSPORT.Contains(input.TRANSPORT)) + .WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTTEL), u => u.YARDCONTRACTTEL == input.YARDCONTRACTTEL) + .WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL) + .WhereIF(!string.IsNullOrWhiteSpace(input.LANECODE), u => u.LANECODE == input.LANECODE) + .WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) + .WhereIF(!string.IsNullOrWhiteSpace(input.ROUTEID), u => u.ROUTEID == input.ROUTEID) + .WhereIF(!string.IsNullOrWhiteSpace(input.ROUTE), u => u.ROUTE.Contains(input.ROUTE)) + .WhereIF(!string.IsNullOrWhiteSpace(input.LineManageID), u => u.LineManageID == input.LineManageID) + .WhereIF(!string.IsNullOrWhiteSpace(input.LineManage), u => u.LineManage.Contains(input.LineManage)) + .WhereIF(!string.IsNullOrWhiteSpace(input.ShippingMethod), u => u.ShippingMethod.Contains(input.ShippingMethod)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName)) + .WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.DZRemark), u => u.DZRemark.Contains(input.DZRemark)) + .WhereIF(!string.IsNullOrWhiteSpace(input.CZRemark), u => u.CZRemark.Contains(input.CZRemark)) + .WhereIF(!string.IsNullOrWhiteSpace(input.ZhanCangFlag), u => u.ZhanCangFlag == input.ZhanCangFlag) + .WhereIF(saleUserList != null && saleUserList.Count > 0, o => saleUserList.Contains(o.SALEID)) + .WhereIF(opUserList != null && opUserList.Count > 0, o => opUserList.Contains(o.OPID)) + .WhereIF(userlist != null && userlist.Count() > 0, u => userlist.Contains((long)u.CreatedUserId) || UserManager.UserId.ToString() == u.ROUTEID || UserManager.Name.ToString() == u.ROUTE || UserManager.UserId.ToString() == u.SALEID || UserManager.Name.ToString() == u.SALE || UserManager.UserId.ToString() == u.OPID || UserManager.Name.ToString() == u.OP || UserManager.UserId.ToString() == u.DOCID || UserManager.Name.ToString() == u.DOC || UserManager.UserId.ToString() == u.CUSTSERVICEID || UserManager.Name.ToString() == u.CUSTSERVICE); + + if (!string.IsNullOrEmpty(input.SortField) || input.MultiSort == null || input.MultiSort.Count == 0) + { + query = query.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort)); + } + else + { + query = query.OrderBy(PageInputOrder.MultiOrderBuilder(input.MultiSort)); + } + + + #endregion + var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize); + var list = entities.Adapt>(); + + var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(), + (goods, config) => config.Id == goods.ConfigId). + OrderBy((goods, config) => config.Sort). + Select((goods, config) => new + { + bookingid = goods.bookingId, + ConfigId = goods.ConfigId, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = goods.FinishTime, + ExtData = goods.ExtData, + Remark = goods.Remark, + CreatedUserId = config.CreatedUserId, + Sort = config.Sort + }).ToList(); + + var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new + { + bookingid = "", + ConfigId = config.Id, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = "", + ExtData = "", + Remark = "", + CreatedUserId = config.CreatedUserId, + Sort = config.Sort + }).ToList(); + + foreach (var item in list.Items) + { + var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList(); + if (sta != null) + { + + item.bookstatus = sta; + } + var st = _bookingremark.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToList(); + if (st != null) + { + item.bookremark = st; + } + if (!string.IsNullOrWhiteSpace(item.ETD)) + { + item.ETD = Convert.ToDateTime(item.ETD).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.ETA)) + { + item.ETA = Convert.ToDateTime(item.ETA).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.YgtETD)) + { + item.YgtETD = Convert.ToDateTime(item.YgtETD).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.ATD)) + { + item.ATD = Convert.ToDateTime(item.ATD).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.StartETA)) + { + item.StartETA = Convert.ToDateTime(item.StartETA).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.StartATA)) + { + item.StartATA = Convert.ToDateTime(item.StartATA).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.MiddleETA)) + { + item.MiddleETA = Convert.ToDateTime(item.MiddleETA).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.MiddleETD)) + { + item.MiddleETD = Convert.ToDateTime(item.MiddleETD).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.MiddleATA)) + { + item.MiddleATA = Convert.ToDateTime(item.MiddleATA).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.MiddleATD)) + { + item.MiddleATD = Convert.ToDateTime(item.MiddleATD).ToString("yyyy-MM-dd"); + } + if (!string.IsNullOrWhiteSpace(item.ATA)) + { + item.ATA = Convert.ToDateTime(item.ATA).ToString("yyyy-MM-dd"); + } + var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort). + Select(x => new GoodsStatusList + { + ConfigId = x.ConfigId, + StatusName = x.StatusName, + SystemCode = x.SystemCode, + FinishTime = x.FinishTime, + ExtData = x.ExtData, + Remark = x.Remark, + Sort = x.Sort + }).ToList(); + + var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort). + Select(x => new GoodsStatusList + { + ConfigId = x.ConfigId, + StatusName = x.StatusName, + SystemCode = x.SystemCode, + FinishTime = null, + ExtData = x.ExtData, + Remark = x.Remark, + Sort = x.Sort + }).ToList(); + + foreach (var ii in itgoods) + { + itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId); + } + + item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); + + } + + return list; + } + /// /// 立即返回保存信息 /// diff --git a/Myshipping.Application/Service/DataSync/Dto/BookingOrderDto.cs b/Myshipping.Application/Service/DataSync/Dto/BookingOrderDto.cs index aa74f36f..f447b661 100644 --- a/Myshipping.Application/Service/DataSync/Dto/BookingOrderDto.cs +++ b/Myshipping.Application/Service/DataSync/Dto/BookingOrderDto.cs @@ -771,6 +771,10 @@ namespace Myshipping.Application.Service.DataSync.Dto #endregion + /// + /// 申请箱使 + /// + public string ShenQingXiangShi { get; set; } public List ctnInputs { get; set; } diff --git a/Myshipping.Core/Extension/InputBase.cs b/Myshipping.Core/Extension/InputBase.cs index 0518696a..4bc90283 100644 --- a/Myshipping.Core/Extension/InputBase.cs +++ b/Myshipping.Core/Extension/InputBase.cs @@ -63,5 +63,21 @@ public class PageInputBase /// public virtual bool DescSort { get; set; } = true; - + public List MultiSort { get; set; } +} + +/// +/// 查询排序 +/// +public class QuerySortModel +{ + /// + /// 字段名 + /// + public string SortField { get; set; } + + /// + /// 排序方法,默认降序 + /// + public virtual bool DescSort { get; set; } = true; } diff --git a/Myshipping.Core/Extension/PageInputOrder.cs b/Myshipping.Core/Extension/PageInputOrder.cs index ac41209b..6029a9ce 100644 --- a/Myshipping.Core/Extension/PageInputOrder.cs +++ b/Myshipping.Core/Extension/PageInputOrder.cs @@ -1,4 +1,7 @@ -namespace Myshipping.Core; +using System.Collections.Generic; +using System.Linq; + +namespace Myshipping.Core; /// /// 通用输入帮助类 @@ -9,7 +12,7 @@ public class PageInputOrder /// 排序方式(默认降序) /// /// - public static string OrderBuilder(string SortField,bool descSort = true) + public static string OrderBuilder(string SortField, bool descSort = true) { // 约定默认每张表都有Id排序 var orderStr = descSort ? "Id Desc" : "Id Asc"; @@ -21,4 +24,28 @@ public class PageInputOrder } return orderStr; } + + /// + /// 多列排序 + /// + /// + /// + public static string MultiOrderBuilder(List sortList) + { + string orderStr = null; + + // 约定默认每张表都有Id排序 + if (sortList == null || sortList.Count == 0) + { + orderStr = "Id Desc"; + } + else + { + var lst = sortList.Select(x => $"{x.SortField} {(x.DescSort ? "Desc" : "Asc")}").ToList(); + orderStr = string.Join(",", lst); + } + + + return orderStr; + } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 6408c78c..5d1a6bbe 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -5342,6 +5342,21 @@ 排序方法,默认降序 + + + 查询排序 + + + + + 字段名 + + + + + 排序方法,默认降序 + + 获取JObject @@ -5453,6 +5468,13 @@ + + + 多列排序 + + + + 小诺分页列表结果 @@ -9506,6 +9528,11 @@ 名称-对应字典值的value + + + 备注 + + 子节点集合 diff --git a/Myshipping.Core/Service/Dict/Dto/DictTreeOutput.cs b/Myshipping.Core/Service/Dict/Dto/DictTreeOutput.cs index 19ec0e86..d2bbbb17 100644 --- a/Myshipping.Core/Service/Dict/Dto/DictTreeOutput.cs +++ b/Myshipping.Core/Service/Dict/Dto/DictTreeOutput.cs @@ -27,6 +27,11 @@ public class DictTreeOutput /// public string Name { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + /// /// 子节点集合 /// diff --git a/Myshipping.Core/Service/Dict/SysDictTypeService.cs b/Myshipping.Core/Service/Dict/SysDictTypeService.cs index aa3eb64b..650eeca4 100644 --- a/Myshipping.Core/Service/Dict/SysDictTypeService.cs +++ b/Myshipping.Core/Service/Dict/SysDictTypeService.cs @@ -84,10 +84,11 @@ public class SysDictTypeService : ISysDictTypeService, IDynamicApiController, IT var dictType = input.Adapt(); var typeId = (await _sysDictTypeRep.InsertReturnEntityAsync(dictType)).Id; - if (input.DictDataList != null && input.DictDataList.Any()) { + if (input.DictDataList != null && input.DictDataList.Any()) + { foreach (var item in input.DictDataList) { - item.TypeId= typeId; + item.TypeId = typeId; await _sysDictDataService.AddDictData(item); } } @@ -176,12 +177,14 @@ public class SysDictTypeService : ISysDictTypeService, IDynamicApiController, IT Id = item.Id, Code = item.Code, Name = item.Name, + Remark = item.Remark, Children = dataList.Where(m => m.TypeId == item.Id).Select(m => new DictTreeOutput { Id = m.Id, Pid = m.TypeId, Code = m.Code, - Name = m.Value + Name = m.Value, + Remark = m.Remark, }).ToList() }); }