diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index a2940eb3..dd06eb02 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -8470,11 +8470,41 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 } var dto = item.Adapt(); - //箱使 - var CtnDayNumlist = await GetGoodsStatusList(item.Id); - if (CtnDayNumlist != null) + + List statusList = new List(); + + if (App.Configuration["ServiceStatusOpenAuto"] == "1") { - dto.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault(); + QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus + { + BookingId = item.Id, + QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT, + TenantId = item.TenantId.Value + }; + + var queryRlt = await _serviceWorkFlowManageService.GetEnableStatusListByBusiness(queryInfo); + + if (queryRlt.succ) + { + statusList = JSON.Deserialize>(JSON.Serialize(queryRlt.ext)); + } + } + + if (App.Configuration["ServiceStatusOpenAuto"] == "1") + { + if (statusList != null && statusList.Any(x => x.StatusSKUCode == "SQXS" && x.IsYield)) + { + dto.CtnDayNum = statusList.FirstOrDefault(x => x.StatusSKUCode == "SQXS" && x.IsYield)?.ActVal; + } + } + else + { + //箱使 + var CtnDayNumlist = await GetGoodsStatusList(item.Id); + if (CtnDayNumlist != null) + { + dto.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault(); + } } var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync(); @@ -8490,14 +8520,36 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 { dto.BookingEDIExt = BookingEDIExt.Adapt(); } - //货物状态 - dto.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto + + if (App.Configuration["ServiceStatusOpenAuto"] == "1") + { + if (statusList != null && statusList.Any(x => x.IsYield)) + { + dto.GoodsStatus = statusList.Where(x => x.IsYield).OrderBy(x => x.SortNo).Select(x => new BookingGoodsStatusDto + { + StatusName = x.ShowName, + FinishTime = x.ActDate, + Remark = x.ActRemark, + ExtData = x.ActVal + }).ToList(); + } + else + { + dto.GoodsStatus = new List(); + } + } + else { - StatusName = d.StatusName, - FinishTime = t.FinishTime, - Remark = t.Remark, - ExtData = t.ExtData - }).Distinct().ToListAsync(); + //货物状态 + dto.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto + { + StatusName = d.StatusName, + FinishTime = t.FinishTime, + Remark = t.Remark, + ExtData = t.ExtData + }).Distinct().ToListAsync(); + } + var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); dto.childrens = childrens.Adapt>(); diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index ac90cb99..a02bdfc1 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -2003,29 +2003,84 @@ namespace Myshipping.Application int lastWFSortNo = 0; int calcNum = 1; - var allStatus = statuList.SelectMany(b => { - var curArg = b.StatusList.SelectMany(x => x.SubStatusList).ToList(); + //var allStatus = statuList.SelectMany(b => { + // var curArg = b.StatusList.SelectMany(x => x.SubStatusList).ToList(); - if (curArg == null) - curArg = new List(); + // if (curArg == null) + // curArg = new List(); - curArg.AddRange(b.StatusList); + // curArg.AddRange(b.StatusList); - return curArg; - }).ToList(); + // return curArg; + //}).ToList(); - var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId, + var resultList = statuList.Join(runList, l => l.WFPKId, + r => r.WFPKId, (l, r) => { var runInfo = r; var rltList = new List(); - if (runInfo.IsYield == 1) + if (runInfo.ActivitiesList == null || (runInfo.ActivitiesList != null && runInfo.ActivitiesList.Count == 0)) { - if(runInfo.ActivitiesList == null ||(runInfo.ActivitiesList != null && runInfo.ActivitiesList.Count == 0)) - { - l.StatusList.ForEach(b => { + l.StatusList.ForEach(b => { + rltList.Add(new ServiceProjectStatusDto + { + ActPKId = b.ActPKId, + ActSortNo = b.ActSortNo, + ShowName = b.ShowName, + IsYield = false, + StatusSKUCode = b.StatusSKUCode, + ActRemark = b.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ActSortNo, + SortNo = b.SortNo + }); + + if (b.SubStatusList != null && b.SubStatusList.Count > 0) + { + rltList.AddRange(b.SubStatusList.Select(c => new ServiceProjectStatusDto + { + ActPKId = c.ActPKId, + ActSortNo = c.ActSortNo, + ShowName = c.ShowName, + IsYield = false, + StatusSKUCode = c.StatusSKUCode, + ActRemark = c.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m), + SortNo = c.SortNo + }).ToList()); + } + }); + } + else + { + l.StatusList.ForEach(b => { + + var eRunInfo = runInfo.ActivitiesList + .FirstOrDefault(p => p.ActId == b.ActPKId); + + if(eRunInfo != null) + { + rltList.Add(new ServiceProjectStatusDto + { + ActPKId = eRunInfo.ActId, + ActSortNo = eRunInfo.ExecSortNo, + ShowName = eRunInfo.ShowName, + IsYield = eRunInfo.IsYield == 1 ? true : false, + StatusSKUCode = eRunInfo.StatusSKUCode, + ActDate = eRunInfo.ActDate, + ActVal = eRunInfo.ActVal, + ActRemark = eRunInfo.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)eRunInfo.ExecSortNo, + SortNo = b.SortNo + }); + } + else + { rltList.Add(new ServiceProjectStatusDto { ActPKId = b.ActPKId, @@ -2038,69 +2093,49 @@ namespace Myshipping.Application CalcSortNo = (decimal)b.ActSortNo, SortNo = b.SortNo }); + } - if(b.SubStatusList != null && b.SubStatusList.Count > 0) - { - rltList.AddRange(b.SubStatusList.Select(c => new ServiceProjectStatusDto - { - ActPKId = c.ActPKId, - ActSortNo = c.ActSortNo, - ShowName = c.ShowName, - IsYield = false, - StatusSKUCode = c.StatusSKUCode, - ActRemark = c.ActRemark, - WFSortNo = l.SortNo, - CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m), - SortNo = c.SortNo - }).ToList()); - } - }); - } - else - { - runInfo.ActivitiesList.ForEach(b => { - var pSkuInfo = allStatus.FirstOrDefault(x => x.SkuPKId == b.StatusSKUId); - - rltList.Add(new ServiceProjectStatusDto - { - ActPKId = b.ActId, - ActSortNo = b.ExecSortNo, - ShowName = b.ShowName, - IsYield = b.IsYield == 1 ? true : false, - ActDate = b.ActDate, - ActVal = b.ActVal, - StatusSKUCode = b.StatusSKUCode, - ActRemark = b.ActRemark, - WFSortNo = l.SortNo, - CalcSortNo = (decimal)b.ExecSortNo, - SortNo = pSkuInfo != null? pSkuInfo.SortNo:0, - }); + if (b.SubStatusList != null && b.SubStatusList.Count > 0) + { + b.SubStatusList.ForEach(sb => { + var eSubRunInfo = runInfo.ActivitiesList + .FirstOrDefault(p => p.ActId == sb.ActPKId); - if (b.SubList != null && b.SubList.Count > 0) - { - b.SubList.ForEach(c => + if(eSubRunInfo != null) { - var subSkuInfo = allStatus.FirstOrDefault(x => x.SkuPKId == c.StatusSKUId); - rltList.Add(new ServiceProjectStatusDto { - ActPKId = c.ActId, - ActSortNo = c.ExecSortNo, - ShowName = c.ShowName, - IsYield = c.IsYield == 1 ? true : false, - ActDate = c.ActDate, - ActVal = c.ActVal, - StatusSKUCode = c.StatusSKUCode, - ActRemark = c.ActRemark, + ActPKId = eSubRunInfo.ActId, + ActSortNo = eSubRunInfo.ExecSortNo, + ShowName = eSubRunInfo.ShowName, + IsYield = eSubRunInfo.IsYield == 1 ? true : false, + StatusSKUCode = eSubRunInfo.StatusSKUCode, + ActDate = eSubRunInfo.ActDate, + ActVal = eSubRunInfo.ActVal, + ActRemark = eSubRunInfo.ActRemark, WFSortNo = l.SortNo, - CalcSortNo = (decimal)b.ExecSortNo + (c.ExecSortNo * 0.001m), - SortNo = subSkuInfo.SortNo + CalcSortNo = (decimal)eSubRunInfo.ExecSortNo, + SortNo = sb.SortNo }); - }); - - } - }); - } + } + else + { + rltList.Add(new ServiceProjectStatusDto + { + ActPKId = sb.ActPKId, + ActSortNo = sb.ActSortNo, + ShowName = sb.ShowName, + IsYield = false, + StatusSKUCode = sb.StatusSKUCode, + ActRemark = sb.ActRemark, + WFSortNo = l.SortNo, + CalcSortNo = (decimal)b.ActSortNo + (sb.ActSortNo * 0.001m), + SortNo = sb.SortNo + }); + } + }); + } + }); } if (rltList != null && rltList.Count > 0)