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

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();
//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 = new List<ITGoodsStatusDto>();
var itconfigs = new List<ITConfigsDto>();
List <ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
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();
var itgoodsStatus =
_goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
if (queryRlt.succ)
{
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)).
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<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
}
//获取提箱返场状态
//var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList();
//var dto = statuslog.Adapt<List<BookingStatusLogDto>>();

Loading…
Cancel
Save