diff --git a/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs b/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs index 3aba5277..39f7ad4b 100644 --- a/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs +++ b/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs @@ -22,5 +22,10 @@ namespace Myshipping.Application /// [Description("查询服务项目和状态")] QUERY_SERVICE_PROJECT_STATUS, + /// + /// 查询所有服务项目和关联状态 + /// + [Description("查询所有服务项目和关联状态")] + QUERY_SERVICE_ALL, } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs index 39c154f3..9057cc64 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingValueAddedService.cs @@ -2270,7 +2270,8 @@ namespace Myshipping.Application /// /// 查询服务项目和状态详情 /// 返回回执 - public async Task GetServiceStatusList(QueryServiceProjectWithStatus model) + [HttpPost("/BookingValueAdded/GetServiceStatusList")] + public async Task 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) { diff --git a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs index d6d1e498..6e65f3cf 100644 --- a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs @@ -70,5 +70,20 @@ namespace Myshipping.Application /// 查询服务项目和状态详情 /// 返回回执 Task GetEnableProjectList(QueryServiceProjectWithStatus model); + + + /// + /// 检索服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetEnableStatusListByProject(QueryServiceProjectWithStatus model); + + /// + /// 单票检索服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetEnableStatusListByBusiness(QueryServiceProjectWithStatus model); } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs index db9a58c6..49385185 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs @@ -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 /// /// 查询服务流程详情 /// 返回查询列表 - private List InnerGetRunListBySigleBusiness(TrackingQueryMessageInfo info) + private List 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 检索服务项目下的状态列表 + /// + /// 检索服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task 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 单票检索服务项目下的状态列表 + /// + /// 单票检索服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task 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 + } }