|
|
|
@ -1875,8 +1875,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());
|
|
|
|
@ -2143,5 +2143,289 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 批量检索服务项目下的状态列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">批量查询服务项目和状态详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusinessBatch(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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|