From 481539fd8e589ad0300bb71fd1c1ef77b2be83ad Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 11 Aug 2023 15:49:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E8=88=B1=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=B9=E7=9B=AE=E5=8A=A0=E8=BD=BD=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 127 ++++++++++++------ 1 file changed, 89 insertions(+), 38 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 793e74ec..2e665aac 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -450,21 +450,32 @@ namespace Myshipping.Application var bookingidlist = list.Items.Select(x => x.Id).ToList(); - //if (App.Configuration["ServiceStatusOpenAuto"] == "1") - //{ - // QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch { - // BookingIds = bookingidlist.ToArray(), - // QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL - // }; - // var queryList = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery) - // .GetAwaiter().GetResult(); - //} - - var itgoodsStatus = - _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(), + var itgoodsStatus = new List(); + var itconfigs = new List(); + + List statusList = new List(); + if (App.Configuration["ServiceStatusOpenAuto"] == "1") + { + QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch + { + BookingIds = bookingidlist.ToArray(), + QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL, + TenantId = list.Items.FirstOrDefault().TenantId.Value + }; + var queryRlt = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery) + .GetAwaiter().GetResult(); + + if (queryRlt.succ) + { + statusList = JSON.Deserialize>(JSON.Serialize(queryRlt.ext)); + } + } + else + { + itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(), (goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)). OrderBy((goods, config) => config.Sort). - Select((goods, config) => new + Select((goods, config) => new ITGoodsStatusDto { bookingid = goods.bookingId, ConfigId = goods.ConfigId, @@ -476,22 +487,24 @@ namespace Myshipping.Application CreatedUserId = config.CreatedUserId, Sort = config.Sort }).ToList(); - var configID = itgoodsStatus.Select(x => x.ConfigId) - .Distinct().ToList(); - var itconfigs = _goodsStatusConfig.AsQueryable() - .Where(x => configID.Contains(x.Id)).Select(config => new - { - bookingid = "", - ConfigId = config.Id, - SystemCode = config.SystemCode, - StatusName = config.StatusName, - FinishTime = "", - ExtData = "", - Remark = "", - CreatedUserId = config.CreatedUserId, - Sort = config.Sort - }).ToList(); + var configID = itgoodsStatus.Select(x => x.ConfigId) + .Distinct().ToList(); + + itconfigs = _goodsStatusConfig.AsQueryable() + .Where(x => configID.Contains(x.Id)).Select(config => new ITConfigsDto + { + bookingid = "", + ConfigId = config.Id, + SystemCode = config.SystemCode, + StatusName = config.StatusName, + FinishTime = "", + ExtData = "", + Remark = "", + CreatedUserId = config.CreatedUserId, + Sort = config.Sort + }).ToList(); + } if (traceTime) @@ -518,6 +531,7 @@ namespace Myshipping.Application foreach (var item in list.Items) { + #region 查询条件 var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList(); if (sta != null) { @@ -573,19 +587,56 @@ namespace Myshipping.Application { item.ATA = Convert.ToDateTime(item.ATA).ToString("yyyy-MM-dd"); } + #endregion + if (App.Configuration["ServiceStatusOpenAuto"] == "1") + { + var currStatusList = statusList.Where(a => long.Parse(a.BusiId) == item.Id).ToList(); - var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort). - Select(x => new GoodsStatusList + if(currStatusList.Count > 0) + { + if(currStatusList.Any(a=>a.StatusSKUCode.Equals("YFVGM",StringComparison.OrdinalIgnoreCase) && a.IsYield)) { - ConfigId = x.ConfigId, - StatusName = x.StatusName, - SystemCode = x.SystemCode, - FinishTime = x.FinishTime, - ExtData = x.ExtData, - Remark = x.Remark, - Sort = x.Sort + item.IsVGM = currStatusList.FirstOrDefault(a => + a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value; + } + if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield)) + { + item.IsCanDan = currStatusList.FirstOrDefault(a => + a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value; + } + if (currStatusList.Any(a => a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield)) + { + item.IsZZFX = currStatusList.FirstOrDefault(a => + a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value; + } + + item.GoodsStatusList = currStatusList.OrderBy(a => a.CalcSortNo) + .Select(a => new GoodsStatusList + { + FinishTime = a.ActDate, + IsLast = a.IsEnd, + Sort = a.ActSortNo, + StatusName = a.ShowName, + SystemCode = a.StatusSKUCode, + ExtData = !string.IsNullOrWhiteSpace(a.ActVal)? a.ActVal:string.Empty, + Remark = !string.IsNullOrWhiteSpace(a.ActRemark)? a.ActRemark:string.Empty }).ToList(); + } + } + else + { + 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 @@ -607,7 +658,7 @@ namespace Myshipping.Application item.IsCanDan = itgoods.Where(x => x.SystemCode == "YFCD").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFCD").Select(x => x.FinishTime).FirstOrDefault(); item.IsZZFX = itgoods.Where(x => x.SystemCode == "ZZFX").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "ZZFX").Select(x => x.FinishTime).FirstOrDefault(); item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList(); - + } //获取提箱返场状态 //var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); //var dto = statuslog.Adapt>();