修改服务状态加载方法

optimize
jianghaiqing 1 year ago
parent a9a0d7d6bb
commit 0092cb5382

@ -22,5 +22,10 @@ namespace Myshipping.Application
/// </summary>
[Description("查询服务项目和状态")]
QUERY_SERVICE_PROJECT_STATUS,
/// <summary>
/// 查询所有服务项目和关联状态
/// </summary>
[Description("查询所有服务项目和关联状态")]
QUERY_SERVICE_ALL,
}
}

@ -2270,7 +2270,8 @@ namespace Myshipping.Application
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetServiceStatusList(QueryServiceProjectWithStatus model)
[HttpPost("/BookingValueAdded/GetServiceStatusList")]
public async Task<TaskManageOrderResultDto> GetServiceStatusList([FromBody] QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -2278,7 +2279,29 @@ namespace Myshipping.Application
try
{
//查询所有服务服务项目和状态时,需要先获取订舱详情
if (model.QueryType == TrackingQueryTypeEnum.QUERY_SERVICE_ALL)
{
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == model.BookingId);
if (bookingOrder == null)
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus
{
BookingId = model.BookingId,
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
TenantId = bookingOrder.TenantId.Value
};
result = await _serviceWorkFlowManageService.GetEnableProjectList(queryInfo);
}
else
{
model.TenantId = UserManager.TENANT_ID;
result = await _serviceWorkFlowManageService.GetEnableStatusListByProject(model);
}
}
catch (Exception ex)
{

@ -70,5 +70,20 @@ namespace Myshipping.Application
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableProjectList(QueryServiceProjectWithStatus model);
/// <summary>
/// 检索服务项目下的状态列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableStatusListByProject(QueryServiceProjectWithStatus model);
/// <summary>
/// 单票检索服务项目下的状态列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetEnableStatusListByBusiness(QueryServiceProjectWithStatus model);
}
}

@ -506,7 +506,7 @@ namespace Myshipping.Application
try
{
result.succ = true;
result.ext = InnerGetRunListBySigleBusiness(info);
result.ext = InnerGetRunListBySingleBusiness(info);
}
catch (Exception ex)
{
@ -524,7 +524,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="info">查询服务流程详情</param>
/// <returns>返回查询列表</returns>
private List<ServiceWorkFlowRunDto> InnerGetRunListBySigleBusiness(TrackingQueryMessageInfo info)
private List<ServiceWorkFlowRunDto> InnerGetRunListBySingleBusiness(TrackingQueryMessageInfo info)
{
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable()
.Filter(null, true)
@ -1241,7 +1241,7 @@ namespace Myshipping.Application
}
};
//在获取运行表已有的记录
var runList = InnerGetRunListBySigleBusiness(messageInfo);
var runList = InnerGetRunListBySingleBusiness(messageInfo);
var resultList = projectList.GroupJoin(runList, l => l.PKId, r => r.ServiceProjectId, (l, r) => {
var currList = r.ToList();
@ -1254,7 +1254,6 @@ namespace Myshipping.Application
ProjectCode = l.ServiceProjectCode,
ProjectName = l.ServiceProjectName,
SortNo = l.SortNo
};
if(runInfo != null)
@ -1278,6 +1277,96 @@ namespace Myshipping.Application
return result;
}
#endregion
}
#region 检索服务项目下的状态列表
/// <summary>
/// 检索服务项目下的状态列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableStatusListByProject(QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var statuList = await _serviceWorkFlowBaseService.GetEnableProjectWithStatusList(model.TenantId.ToString());
var resultList = statuList.Where(a => model.ProjectCodes.Contains(a.ProjectCode))
.OrderBy(a => a.SortNo)
.SelectMany(a => a.StatusList.OrderBy(b=>b.SortNo))
.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="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetEnableStatusListByBusiness(QueryServiceProjectWithStatus model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var statuList = await _serviceWorkFlowBaseService.GetEnableProjectWithStatusList(model.TenantId.ToString());
var resultList = statuList.Where(a => model.ProjectCodes.Contains(a.ProjectCode))
.OrderBy(a => a.SortNo)
.SelectMany(a => a.StatusList.OrderBy(b => b.SortNo))
.ToList();
/*
TrackingQueryMessageInfo messageInfo = new TrackingQueryMessageInfo
{
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 TrackingMessageQueryMainInfo
{
BusiId = model.BookingId.ToString(),
BusiSystemCode = "BOOKING_ORDER",
TenantId = model.TenantId.ToString(),
}
};
//在获取运行表已有的记录
var runList = InnerGetRunListBySingleBusiness(messageInfo);
*/
result.succ = true;
result.ext = resultList;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"检索服务项目下的状态列表失败,原因:{ex.Message}";
}
return result;
}
#endregion
}
}

Loading…
Cancel
Save