修改BC任务

optimize
jianghaiqing 11 months ago
parent 44894c802b
commit cab358d19b

@ -351,5 +351,28 @@ namespace Myshipping.Application
/// 二程ETA
/// </summary>
public Nullable<DateTime> SecondETA { get; set; }
/// <summary>
/// 关键信息列表
/// </summary>
public List<TaskBCShowBaseKeywordDto> Keywords { get; set; }
}
public class TaskBCShowBaseKeywordDto
{
/// <summary>
/// 关键名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 关键背景色
/// </summary>
public string Background { get; set; }
/// <summary>
/// 图标KEY
/// </summary>
public string Icon { get; set; }
}
}

@ -68,5 +68,12 @@ namespace Myshipping.Application
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelTask(string taskPKId);
/// <summary>
/// 获取服务项目列表
/// </summary>
/// <returns>返回回执</returns>
Task<List<ServiceProjectBaseDto>> GetProjectList();
}
}

@ -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<TaskFileInfo> _taskFileRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
public TaskManageBCService(SqlSugarRepository<TaskBCInfo> taskBCInfoRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<TaskBCCTNInfo> taskBCCTNInfoRepository,
SqlSugarRepository<TaskFileInfo> taskFileRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingCtnRepository)
SqlSugarRepository<BookingCtn> bookingCtnRepository,
SqlSugarRepository<SysUser> 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详情
/// <summary>
@ -153,6 +161,28 @@ namespace Myshipping.Application
if (fileList.Count > 0)
model.FileList = fileList.Adapt<List<TaskFileDto>>();
//生成关键信息
#region 生成关键信息
model.Keywords = new List<TaskBCShowBaseKeywordDto>();
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
/// <summary>
/// 获取服务项目列表
/// </summary>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageBC/GetProjectList")]
public async Task<List<ServiceProjectBaseDto>> GetProjectList()
{
List<ServiceProjectBaseDto> list = new List<ServiceProjectBaseDto>();
return await _serviceWorkFlowBaseService.GetEnableProjectList(UserManager.TENANT_ID.ToString());
}
}
}

Loading…
Cancel
Save