|
|
|
@ -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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|