修改订舱台账,增加了新的服务项目加载方法

optimize
jianghaiqing 1 year ago
parent 83cd7ad550
commit 481539fd8e

@ -450,21 +450,32 @@ namespace Myshipping.Application
var bookingidlist = list.Items.Select(x => x.Id).ToList(); var bookingidlist = list.Items.Select(x => x.Id).ToList();
//if (App.Configuration["ServiceStatusOpenAuto"] == "1") var itgoodsStatus = new List<ITGoodsStatusDto>();
//{ var itconfigs = new List<ITConfigsDto>();
// QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch {
// BookingIds = bookingidlist.ToArray(), List <ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
// QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL if (App.Configuration["ServiceStatusOpenAuto"] == "1")
// }; {
// var queryList = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery) QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch
// .GetAwaiter().GetResult(); {
//} BookingIds = bookingidlist.ToArray(),
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL,
TenantId = list.Items.FirstOrDefault().TenantId.Value
};
var queryRlt = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery)
.GetAwaiter().GetResult();
var itgoodsStatus = if (queryRlt.succ)
_goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(), {
statusList = JSON.Deserialize<List<ServiceProjectStatusDto>>(JSON.Serialize(queryRlt.ext));
}
}
else
{
itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
(goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)). (goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)).
OrderBy((goods, config) => config.Sort). OrderBy((goods, config) => config.Sort).
Select((goods, config) => new Select((goods, config) => new ITGoodsStatusDto
{ {
bookingid = goods.bookingId, bookingid = goods.bookingId,
ConfigId = goods.ConfigId, ConfigId = goods.ConfigId,
@ -476,22 +487,24 @@ namespace Myshipping.Application
CreatedUserId = config.CreatedUserId, CreatedUserId = config.CreatedUserId,
Sort = config.Sort Sort = config.Sort
}).ToList(); }).ToList();
var configID = itgoodsStatus.Select(x => x.ConfigId)
.Distinct().ToList();
var itconfigs = _goodsStatusConfig.AsQueryable() var configID = itgoodsStatus.Select(x => x.ConfigId)
.Where(x => configID.Contains(x.Id)).Select(config => new .Distinct().ToList();
{
bookingid = "", itconfigs = _goodsStatusConfig.AsQueryable()
ConfigId = config.Id, .Where(x => configID.Contains(x.Id)).Select(config => new ITConfigsDto
SystemCode = config.SystemCode, {
StatusName = config.StatusName, bookingid = "",
FinishTime = "", ConfigId = config.Id,
ExtData = "", SystemCode = config.SystemCode,
Remark = "", StatusName = config.StatusName,
CreatedUserId = config.CreatedUserId, FinishTime = "",
Sort = config.Sort ExtData = "",
}).ToList(); Remark = "",
CreatedUserId = config.CreatedUserId,
Sort = config.Sort
}).ToList();
}
if (traceTime) if (traceTime)
@ -518,6 +531,7 @@ namespace Myshipping.Application
foreach (var item in list.Items) foreach (var item in list.Items)
{ {
#region 查询条件
var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList(); var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList();
if (sta != null) if (sta != null)
{ {
@ -573,19 +587,56 @@ namespace Myshipping.Application
{ {
item.ATA = Convert.ToDateTime(item.ATA).ToString("yyyy-MM-dd"); 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). if(currStatusList.Count > 0)
Select(x => new GoodsStatusList {
if(currStatusList.Any(a=>a.StatusSKUCode.Equals("YFVGM",StringComparison.OrdinalIgnoreCase) && a.IsYield))
{ {
ConfigId = x.ConfigId, item.IsVGM = currStatusList.FirstOrDefault(a =>
StatusName = x.StatusName, a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value;
SystemCode = x.SystemCode, }
FinishTime = x.FinishTime, if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield))
ExtData = x.ExtData, {
Remark = x.Remark, item.IsCanDan = currStatusList.FirstOrDefault(a =>
Sort = x.Sort 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(); }).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). var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort).
Select(x => new GoodsStatusList 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.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.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<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList(); item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
}
//获取提箱返场状态 //获取提箱返场状态
//var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList(); //var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList();
//var dto = statuslog.Adapt<List<BookingStatusLogDto>>(); //var dto = statuslog.Adapt<List<BookingStatusLogDto>>();

Loading…
Cancel
Save