wet 1 year ago
commit 8ffc7d0dd3

@ -449,7 +449,19 @@ namespace Myshipping.Application
}
var bookingidlist = list.Items.Select(x => x.Id).ToList();
var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
//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(),
(goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)).
OrderBy((goods, config) => config.Sort).
Select((goods, config) => new
@ -464,20 +476,23 @@ namespace Myshipping.Application
CreatedUserId = config.CreatedUserId,
Sort = config.Sort
}).ToList();
var configID = itgoodsStatus.Select(x => x.ConfigId).Distinct().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 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();
if (traceTime)
{
@ -558,38 +573,41 @@ namespace Myshipping.Application
{
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.IsVGM = itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFVGM").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.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
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.IsVGM = itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFVGM").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.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>>();

@ -2468,6 +2468,8 @@ namespace Myshipping.Application
//查询所有服务服务项目和状态时,需要先获取订舱详情
if (model.QueryType == TrackingQueryTypeEnum.QUERY_SERVICE_ALL)
{
DateTime bDate = DateTime.Now;
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == model.BookingId);
@ -2482,6 +2484,12 @@ namespace Myshipping.Application
};
result = await _serviceWorkFlowManageService.GetEnableStatusListByBusiness(queryInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("测试读取服务状态-起始位置 耗时:{timeDiff}ms. ", timeDiff);
}
else
{

@ -138,6 +138,9 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// </summary>
public long? Sort { get; set; }
/// <summary>
/// 是否最新记录
/// </summary>
public bool IsLast { get; set; } = false;
}
}

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class ITGoodsStatusDto
{
/// <summary>
/// 订舱编号
/// </summary>
public Nullable<long> bookingid { get; set; }
/// <summary>
/// 状态配置主键
/// </summary>
public Nullable<long> ConfigId { get; set; }
/// <summary>
/// 状态代码
/// </summary>
public string SystemCode { get; set; }
/// <summary>
/// 状态名称
/// </summary>
public string StatusName { get; set; }
/// <summary>
/// 状态完成时间
/// </summary>
public Nullable<DateTime> FinishTime { get; set; }
/// <summary>
/// 状态值
/// </summary>
public string ExtData { get; set; }
/// <summary>
/// 状态备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 状态创建人
/// </summary>
public Nullable<long> CreatedUserId { get; set; }
/// <summary>
/// 状态排序值
/// </summary>
public int Sort { get; set; }
}
public class ITConfigsDto
{
public string bookingid { get; set; }
public long ConfigId { get; set; }
public string SystemCode { get; set; }
public string StatusName { get; set; }
public string FinishTime { get; set; }
public string ExtData { get; set; }
public string Remark { get; set; }
public Nullable<long> CreatedUserId { get; set; }
public int Sort { get; set; }
}
}

@ -963,5 +963,10 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// 是否订阅运踪 0 没有订阅 1 订阅起运港 2 订阅目的港
/// </summary>
public string IsBookingYZ { get; set; }
/// <summary>
/// 状态底色
/// </summary>
public string GoodsStatusColor { get; set; }
}
}

@ -31,4 +31,27 @@ namespace Myshipping.Application
/// </summary>
public long TenantId { get; set; }
}
public class QueryServiceProjectWithStatusBatch
{
/// <summary>
/// 订舱ID数组
/// </summary>
public long[] BookingIds { get; set; }
/// <summary>
/// 0-查服务项目 1-查服务项目下的状态
/// </summary>
public TrackingQueryTypeEnum QueryType { get; set; }
/// <summary>
/// 服务项目代码组
/// </summary>
public string[] ProjectCodes { get; set; }
/// <summary>
/// 租户ID
/// </summary>
public long TenantId { get; set; }
}
}

@ -183,5 +183,15 @@ namespace Myshipping.Application
/// 是否结束
/// </summary>
public bool IsEnd { get; set; }
/// <summary>
/// 业务系统代码
/// </summary>
public string BusiSystemCode { get; set; }
/// <summary>
/// 业务主键
/// </summary>
public string BusiId { get; set; }
}
}

@ -46,6 +46,16 @@ namespace Myshipping.Application
/// </summary>
public string WFPKId { get; set; }
/// <summary>
/// 业务系统代码
/// </summary>
public string BusiSystemCode { get; set; }
/// <summary>
/// 业务主键
/// </summary>
public string BusiId { get; set; }
/// <summary>
/// 状态列表
/// </summary>

@ -79,4 +79,65 @@ namespace Myshipping.Application
public bool IsReloadCache { get; set; } = false;
}
public class TrackingQueryBatchMessageInfo
{
/// <summary>
/// 表头
/// </summary>
public TrackingMessageHeadInfo Head { get; set; }
/// <summary>
/// 表体
/// </summary>
public TrackingMessageQueryBatchMainInfo Main { get; set; }
}
/// <summary>
/// 表体
/// </summary>
public class TrackingMessageQueryBatchMainInfo
{
/// <summary>
/// 服务项目代码
/// </summary>
public List<string> ServiceProjectCodeList { get; set; }
/// <summary>
/// 业务系统代码
/// </summary>
[Required(ErrorMessage = "必填")]
public string BusiSystemCode { get; set; }
/// <summary>
/// 业务主键
/// </summary>
public List<string> BusiIds { get; set; }
/// <summary>
/// 查询类型
/// </summary>
public TrackingQueryTypeEnum QueryType { get; set; }
/// <summary>
/// 查询服务项目代码
/// </summary>
public string[] QueryServiceProjectCode { get; set; }
/// <summary>
/// 租户ID
/// </summary>
public string TenantId { get; set; }
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; }
/// <summary>
/// 强制刷新缓存
/// </summary>
public bool IsReloadCache { get; set; } = false;
}
}

@ -91,5 +91,13 @@ namespace Myshipping.Application
/// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model);
/// <summary>
/// 批量检索服务项目下的状态列表
/// </summary>
/// <param name="model">批量查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableStatusListByBusinessBatch(QueryServiceProjectWithStatusBatch model);
}
}

@ -1269,7 +1269,7 @@ namespace Myshipping.Application
}
#endregion
#region 取消状态
/// <summary>
/// 取消状态
/// </summary>
@ -1531,6 +1531,7 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 查询订舱表查询用户和租户信息
/// <summary>
@ -1595,6 +1596,7 @@ namespace Myshipping.Application
}
#endregion
#region 查询当前租户下可用服务项目与状态详情
/// <summary>
/// 查询当前租户下可用服务项目与状态详情
/// </summary>
@ -1658,6 +1660,7 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 校验取消状态
/// <summary>
@ -1677,14 +1680,14 @@ namespace Myshipping.Application
}
#endregion
#region 检索已选中并且可用的服务项目列表
/// <summary>
/// 检索已选中并且可用的服务项目列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableProjectList(QueryServiceProjectWithStatus model)
[HttpPost("/ServiceWorkFlowManage/GetEnableProjectList")]
public async Task<TaskManageOrderResultDto> GetEnableProjectList([FromBody] QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -1755,7 +1758,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableStatusListByProject(QueryServiceProjectWithStatus model)
[HttpPost("/ServiceWorkFlowManage/GetEnableStatusListByProject")]
public async Task<TaskManageOrderResultDto> GetEnableStatusListByProject([FromBody] QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -1800,7 +1804,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusiness(QueryServiceProjectWithStatus model)
[HttpPost("/ServiceWorkFlowManage/GetEnableStatusListByBusiness")]
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusiness([FromBody] QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -1830,9 +1835,16 @@ namespace Myshipping.Application
}
};
DateTime bDate = DateTime.Now;
//在获取运行表已有的记录
var runList = InnerGetRunListBySingleBusiness(messageInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("测试读取服务状态-读取数据库记录 耗时:{timeDiff}ms. ", timeDiff);
int lastWFSortNo = 0;
int calcNum = 1;
@ -1868,8 +1880,8 @@ namespace Myshipping.Application
ActSortNo = c.ActSortNo,
ShowName = c.ShowName,
IsYield = false,
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark,
StatusSKUCode = c.StatusSKUCode,
ActRemark = c.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m)
}).ToList());
@ -1955,12 +1967,14 @@ namespace Myshipping.Application
}
#endregion
#region 保存服务状态
/// <summary>
/// 保存服务状态
/// </summary>
/// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SaveServiceStatus(ModifyServiceProjectStatusDto model)
[HttpPost("/ServiceWorkFlowManage/SaveServiceStatus")]
public async Task<TaskManageOrderResultDto> SaveServiceStatus([FromBody] ModifyServiceProjectStatusDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -2045,13 +2059,16 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 取消服务状态
/// <summary>
/// 取消服务状态
/// </summary>
/// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model)
[HttpPost("/ServiceWorkFlowManage/CancelServiceStatus")]
public async Task<TaskManageOrderResultDto> CancelServiceStatus([FromBody] ModifyServiceProjectStatusDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -2136,5 +2153,292 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 批量检索服务项目下的状态列表
/// <summary>
/// 批量检索服务项目下的状态列表
/// </summary>
/// <param name="model">批量查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
[HttpPost("/ServiceWorkFlowManage/GetEnableStatusListByBusinessBatch")]
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusinessBatch([FromBody] QueryServiceProjectWithStatusBatch model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var statuList = await _serviceWorkFlowBaseService.GetEnableProjectWithStatusList(model.TenantId.ToString());
TrackingQueryBatchMessageInfo messageInfo = new TrackingQueryBatchMessageInfo
{
Head = new TrackingMessageHeadInfo
{
GID = IDGen.NextID().ToString(),
MessageType = "PROJECT",
ReceiverId = "ServiceProjectStatus",
ReceiverName = "服务项目和状态",
SenderId = "BookingOrder",
SenderName = "海运订舱",
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Version = "2.0",
RequestAction = "AddOrModify",
},
Main = new TrackingMessageQueryBatchMainInfo
{
BusiIds = model.BookingIds.Select(a=>a.ToString()).ToList(),
BusiSystemCode = "BOOKING_ORDER",
TenantId = model.TenantId.ToString(),
}
};
DateTime bDate = DateTime.Now;
//在获取运行表已有的记录
var runList = InnerGetRunListBySingleBusinessBatch(messageInfo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("测试读取服务状态-读取数据库记录 耗时:{timeDiff}ms. ", timeDiff);
int lastWFSortNo = 0;
int calcNum = 1;
var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId,
(l, r) => {
var runInfo = r;
var rltList = new List<ServiceProjectStatusDto>();
if (runInfo.IsYield == 1)
{
if (runInfo.ActivitiesList == null || (runInfo.ActivitiesList != null && runInfo.ActivitiesList.Count == 0))
{
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,
BusiSystemCode = runInfo.BusiSystemCode,
BusiId = runInfo.BusiId,
});
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 = b.StatusSKUCode,
ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m),
BusiSystemCode = runInfo.BusiSystemCode,
BusiId = runInfo.BusiId,
}).ToList());
}
});
}
else
{
runInfo.ActivitiesList.ForEach(b => {
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,
BusiSystemCode = runInfo.BusiSystemCode,
BusiId = runInfo.BusiId,
});
if (b.SubList != null && b.SubList.Count > 0)
{
rltList.AddRange(b.SubList.Select(c => 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,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ExecSortNo + (c.ExecSortNo * 0.001m),
BusiSystemCode = runInfo.BusiSystemCode,
BusiId = runInfo.BusiId,
}).ToList());
}
});
}
}
if (rltList != null && rltList.Count > 0)
{
var maxSort = rltList.Max(t => t.CalcSortNo);
rltList.FirstOrDefault(t => t.CalcSortNo == maxSort).IsEnd = true;
}
return rltList;
}).SelectMany(b => b).OrderBy(b => b.WFSortNo).Select(b => {
if (lastWFSortNo == 0)
{
b.GroupName = calcNum.ToString();
lastWFSortNo = b.WFSortNo;
}
else if (b.WFSortNo == lastWFSortNo)
{
b.GroupName = calcNum.ToString();
}
else
{
++calcNum;
lastWFSortNo = b.WFSortNo;
b.GroupName = calcNum.ToString();
}
return b;
}).OrderBy(b => b.WFSortNo).ThenBy(b => b.CalcSortNo).ToList();
result.succ = true;
result.ext = resultList;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索服务项目下的状态列表失败,原因:{ex.Message}";
}
return result;
}
#endregion
#region 获取单票业务相关的服务项目运行列表
/// <summary>
/// 获取单票业务相关的服务项目运行列表
/// </summary>
/// <param name="info">查询服务流程详情</param>
/// <returns>返回查询列表</returns>
private List<ServiceWorkFlowRunDto> InnerGetRunListBySingleBusinessBatch(TrackingQueryBatchMessageInfo info)
{
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable()
.Filter(null, true)
.LeftJoin<ServiceWorkFlowRunActivitiesInfo>((m, s) => m.PK_ID == s.RUN_ID)
.LeftJoin<ServiceWorkFlowProjectRelation>((m, s, rela) =>
m.SERVICE_WF_ID == rela.SERVICE_WORKFLOW_ID && m.RELEASE_VERSION == rela.WF_VERSION)
.InnerJoin<ServiceProjectBaseInfo>((m, s, rela, p) =>
rela.SERVICE_PROJECT_ID == p.PK_ID)
.Where((m, s, rela, p)
=> m.BUSI_SYSTEM_CODE == info.Main.BusiSystemCode && info.Main.BusiIds.Contains(m.BUSI_ID) &&
(info.Main.ServiceProjectCodeList == null || info.Main.ServiceProjectCodeList.Contains(p.SERVICE_PROJECT_CODE)))
.Select((m, s, rela, p) =>
new { Run = m, Sub = s }).ToList();
var resultList = runList.GroupBy(a => $"{a.Run.BUSI_ID}_{a.Run.PK_ID}")
.Select(a => {
var currList = a.ToList();
var runInfo = currList.FirstOrDefault().Run;
var showModel = new ServiceWorkFlowRunDto();
showModel.PKId = runInfo.PK_ID;
showModel.ServiceProjectId = runInfo.SERVICE_PROJECT_ID;
showModel.ServiceProjectCode = runInfo.SERVICE_PROJECT_CODE;
showModel.ServiceProjectName = runInfo.SERVICE_PROJECT_NAME;
showModel.IsYield = runInfo.IS_YIELD;
showModel.ActDate = runInfo.ACT_DATE;
showModel.WFPKId = runInfo.SERVICE_WF_ID;
showModel.BusiId = runInfo.BUSI_ID;
showModel.BusiSystemCode = runInfo.BUSI_SYSTEM_CODE;
showModel.ActivitiesList = currList.Where(t =>
!string.IsNullOrWhiteSpace(t.Sub.PK_ID) && t.Sub.IS_SUB == 0)
.Select(t =>
{
var runModel = new ServiceWorkFlowActivitiesRunDto
{
PKId = t.Sub.PK_ID,
ActDate = t.Sub.ACT_DATE,
ActId = t.Sub.ACT_ID,
ExecSortNo = t.Sub.EXEC_SORT_NO,
ActVal = t.Sub.ACT_VAL,
IsStart = t.Sub.IS_START,
IsEnd = t.Sub.IS_END,
IsYield = t.Sub.IS_YIELD,
RunId = t.Sub.RUN_ID,
ShowName = t.Sub.SHOW_NAME,
SourceType = t.Sub.SOURCE_TYPE,
StatusSKUCode = t.Sub.STATUS_SKU_CODE,
StatusSKUId = t.Sub.STATUS_SKU_ID,
ActRemark = t.Sub.ACT_REMARK,
};
return runModel;
}).ToList();
var subList =
currList.Where(t =>
!string.IsNullOrWhiteSpace(t.Sub.PK_ID) && t.Sub.IS_SUB == 1)
.Select(t => t.Sub).ToList();
showModel.ActivitiesList = showModel.ActivitiesList.GroupJoin(subList,
l => l.PKId, r => r.PARENT_ID,
(l, r) =>
{
var currList = r.ToList();
if (currList.Count > 0)
{
l.SubList = currList.Select(x => {
var subModel = new ServiceWorkFlowActivitiesRunSubDto
{
PKId = x.PK_ID,
ActDate = x.ACT_DATE,
ActId = x.ACT_ID,
ExecSortNo = x.EXEC_SORT_NO,
ActVal = x.ACT_VAL,
IsStart = x.IS_START,
IsEnd = x.IS_END,
IsYield = x.IS_YIELD,
RunId = x.RUN_ID,
ShowName = x.SHOW_NAME,
SourceType = x.SOURCE_TYPE,
StatusSKUCode = x.STATUS_SKU_CODE,
StatusSKUId = x.STATUS_SKU_ID,
ActRemark = x.ACT_REMARK
};
return subModel;
}).OrderBy(x => x.ExecSortNo).ToList();
}
return l;
}).OrderBy(t => t.ExecSortNo).ToList();
return showModel;
}).ToList();
return resultList;
}
#endregion
}
}

Loading…
Cancel
Save