From cab358d19ba44953b787e0ceee76a0921536cdb3 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 10 Jan 2024 17:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BC=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/BC/TaskBCShowBaseDto.cs | 23 +++ .../Interface/ITaskManageBCService.cs | 7 + .../TaskManagePlat/TaskManageBCService.cs | 165 +++++++++++++++++- 3 files changed, 193 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/BC/TaskBCShowBaseDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/BC/TaskBCShowBaseDto.cs index 25250b99..f881ac5f 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/BC/TaskBCShowBaseDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/BC/TaskBCShowBaseDto.cs @@ -351,5 +351,28 @@ namespace Myshipping.Application /// 二程ETA /// public Nullable SecondETA { get; set; } + + /// + /// 关键信息列表 + /// + public List Keywords { get; set; } + } + + public class TaskBCShowBaseKeywordDto + { + /// + /// 关键名称 + /// + public string Name { get; set; } + + /// + /// 关键背景色 + /// + public string Background { get; set; } + + /// + /// 图标KEY + /// + public string Icon { get; set; } } } diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs index e8b354f4..4ef4c40e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageBCService.cs @@ -68,5 +68,12 @@ namespace Myshipping.Application /// 返回回执 Task CancelTask(string taskPKId); + + /// + /// 获取服务项目列表 + /// + /// 返回回执 + Task> GetProjectList(); + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index f715f594..5abcf04e 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -8,6 +8,7 @@ using Myshipping.Application.ConfigOption; using Myshipping.Application.Entity; using Myshipping.Application.Enum; using Myshipping.Core; +using Myshipping.Core.Entity; using Myshipping.Core.Service; using NPOI.SS.Formula.Functions; using SqlSugar; @@ -37,13 +38,18 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskFileRepository; private readonly SqlSugarRepository _bookingOrderRepository; private readonly SqlSugarRepository _bookingCtnRepository; + private readonly SqlSugarRepository _sysUserRepository; + + private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService; public TaskManageBCService(SqlSugarRepository taskBCInfoRepository, SqlSugarRepository taskBaseRepository, SqlSugarRepository taskBCCTNInfoRepository, SqlSugarRepository taskFileRepository, SqlSugarRepository bookingOrderRepository, - SqlSugarRepository bookingCtnRepository) + SqlSugarRepository bookingCtnRepository, + SqlSugarRepository sysUserRepository, + IServiceWorkFlowBaseService serviceWorkFlowBaseService) { _taskBaseRepository = taskBaseRepository; _taskBCInfoRepository = taskBCInfoRepository; @@ -51,7 +57,9 @@ namespace Myshipping.Application _taskFileRepository = taskFileRepository; _bookingOrderRepository = bookingOrderRepository; _bookingCtnRepository = bookingCtnRepository; - } + _sysUserRepository = sysUserRepository; + _serviceWorkFlowBaseService = serviceWorkFlowBaseService; + } #region 获取BC详情 /// @@ -153,6 +161,28 @@ namespace Myshipping.Application if (fileList.Count > 0) model.FileList = fileList.Adapt>(); + //生成关键信息 + #region 生成关键信息 + model.Keywords = new List(); + + if(bcOrder.CARRIAGE_TYPE == "DIRECT_SHIP") + { + model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"承运方式:{bcOrder.CARRIAGE_TYPE_NAME}", Background = "#FFFF80",Icon= "icon-yunshu1" }); + } + else if (bcOrder.CARRIAGE_TYPE == "TRANSFER_SHIP") + { + model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"承运方式:{bcOrder.CARRIAGE_TYPE_NAME}", Background = "#CAF982", Icon = "icon-shuaxin" }); + } + + if (bcOrder.BOOKING_SLOT_TYPE == "CONTRACT_ORDER") + { + model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"订舱方式:{bcOrder.BOOKING_SLOT_TYPE_NAME}", Background = "#81D3F8", Icon = "icon-touzijilu" }); + } + else if (bcOrder.BOOKING_SLOT_TYPE == "SPOT_ORDER") + { + model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"订舱方式:{bcOrder.BOOKING_SLOT_TYPE_NAME}", Background = "#FACD91", Icon = "icon-beizhu1" }); + } + #endregion result.succ = true; result.ext = model; @@ -463,7 +493,67 @@ namespace Myshipping.Application try { + /* + 1、如果当前任务是公共任务,则更新为相关人后,变更任务为个人。 + */ + var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId); + if (bcTaskInfo == null) + { + throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); + } + + if(userId < 0) + throw Oops.Oh($"指定用户ID不能为空"); + + var targetUserId = _sysUserRepository.AsQueryable().First(u => u.Id == userId); + + if (targetUserId == null) + throw Oops.Oh($"指定用户不存在"); + + + if (bcTaskInfo.IS_PUBLIC == 1) + { + bcTaskInfo.IS_PUBLIC = 0; + + bcTaskInfo.CreatedUserId = targetUserId.Id; + bcTaskInfo.CreatedUserName = targetUserId.Name; + bcTaskInfo.UpdatedTime = DateTime.Now; + bcTaskInfo.UpdatedUserId = targetUserId.Id; + bcTaskInfo.UpdatedUserName = targetUserId.Name; + + await _taskBaseRepository.AsUpdateable(bcTaskInfo).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.IsDeleted, + it.TASK_NO, + it.TASK_TYPE, + it.TASK_SOURCE + }).ExecuteCommandAsync(); + } + else + { + bcTaskInfo.CreatedUserId = targetUserId.Id; + bcTaskInfo.CreatedUserName = targetUserId.Name; + + bcTaskInfo.UpdatedTime = DateTime.Now; + bcTaskInfo.UpdatedUserId = targetUserId.Id; + bcTaskInfo.UpdatedUserName = targetUserId.Name; + + await _taskBaseRepository.AsUpdateable(bcTaskInfo).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.IsDeleted, + it.TASK_NO, + it.TASK_TYPE, + it.TASK_SOURCE + }).ExecuteCommandAsync(); + } + + result.succ = true; + result.msg = "成功"; } catch (Exception ex) { @@ -488,7 +578,42 @@ namespace Myshipping.Application try { + /* + 1、推送舱位生成方法。 + 2、推送舱位暂存方法。 + 3、推送舱位分配方法。 + 4、更新任务状态位完成。 + */ + if(string.IsNullOrWhiteSpace(model.BCTaskId)) + throw Oops.Oh($"BC任务主键不能为空"); + + //生成方式(GEN_BOOKING_SLOT-生成舱位和订舱;GEN_BOOKING-只生成订舱;GEN_SLOT-只生成舱位;GEN_EXIST_BOOKING-匹配指定的订舱) + if (string.IsNullOrWhiteSpace(model.GenerateMethod)) + throw Oops.Oh($"生成方式不能为空,需要指定一种生成方式"); + + var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == model.BCTaskId); + if (bcTaskInfo == null) + { + throw Oops.Oh($"任务主键{model.BCTaskId}无法获取业务信息"); + } + + var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == bcTaskInfo.PK_ID); + + if (bcOrder == null) + throw Oops.Oh($"任务主键{model.BCTaskId}无法获取BC业务信息"); + + var bcCtnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == bcOrder.PK_ID).ToList(); + + if ((bcOrder.BOOKING_ORDER_ID.HasValue && bcOrder.BOOKING_ORDER_ID.Value>0) + || (bcOrder.BOOKING_SLOT_ID.HasValue && bcOrder.BOOKING_SLOT_ID.Value > 0)) + { + throw Oops.Oh($"当前BC任务已生成订舱或舱位,不能重复生成"); + } + + + result.succ = true; + result.msg = "成功"; } catch (Exception ex) { @@ -513,7 +638,31 @@ namespace Myshipping.Application try { + var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId); + if (bcTaskInfo == null) + { + throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); + } + + bcTaskInfo.IsDeleted = true; + bcTaskInfo.UpdatedTime = DateTime.Now; + bcTaskInfo.UpdatedUserId = UserManager.UserId; + bcTaskInfo.UpdatedUserName = UserManager.Name; + await _taskBaseRepository.AsUpdateable(bcTaskInfo).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.CreatedUserId, + it.CreatedUserName, + it.IsDeleted, + it.TASK_NO, + it.TASK_TYPE, + it.TASK_SOURCE + }).ExecuteCommandAsync(); + + result.succ = true; + result.msg = "成功"; } catch (Exception ex) { @@ -524,5 +673,17 @@ namespace Myshipping.Application return result; } #endregion + + /// + /// 获取服务项目列表 + /// + /// 返回回执 + [HttpGet("/TaskManageBC/GetProjectList")] + public async Task> GetProjectList() + { + List list = new List(); + + return await _serviceWorkFlowBaseService.GetEnableProjectList(UserManager.TENANT_ID.ToString()); + } } }