cjy 3 months ago
commit d300826158

@ -1,6 +1,9 @@
using DS.Module.Core.Data;
using System.Linq.Expressions;
using DS.Module.Core.Data;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.TaskInteraction;
using SqlSugar;
namespace DS.WMS.Core.Op.Interface.TaskInteraction
{
@ -29,5 +32,12 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="dataContext"></param>
/// <returns></returns>
Task GenerateSubTaskAsync(TaskFlowDataContext dataContext);
/// <summary>
/// 获取海运出口查询对象
/// </summary>
/// <param name="expression">查询条件</param>
/// <returns></returns>
ISugarQueryable<SeaExport> AsQueryable(Expression<Func<SeaExport, bool>>? expression = null);
}
}

@ -1,8 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking

@ -1,8 +1,10 @@
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor;
using DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking;
using Masuit.Tools;
using Microsoft.Extensions.DependencyInjection;
namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector
@ -16,16 +18,25 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector
public async Task<IActionExecutor> GetActionExecutor(ActionExecutionContext context)
{
//var taskService = context.ServiceProvider.GetRequiredService<ITaskService>();
var clientParamService = context.ServiceProvider.GetRequiredService<IClientParamService>();
switch (context.TaskInfo.BusinessType)
{
case BusinessType.OceanShippingExport:
var seTaskService = context.ServiceProvider.GetService<ISeaExportTaskService>();
var order = await seTaskService.AsQueryable(x => x.Id == context.TaskInfo.BusinessId).Select(x => new
{
x.BookingNo,
x.MBLNO
}).FirstAsync();
//订单已有订舱编号或提单号,则跳过订舱动作执行
if (order != null && (!order.BookingNo.IsNullOrEmpty() || !order.MBLNO.IsNullOrEmpty()))
return new DefaultActionExecutor();
//if (await taskService.ExistsAsync(x => x.TaskType == TaskBaseTypeEnum.WAIT_BC &&
// x.BusinessId == context.TaskInfo.BusinessId && x.BusinessType == context.TaskInfo.BusinessType))
//{
// //存在订舱确认,跳过订舱环节
// return new DefaultActionExecutor();
//}
break;
case BusinessType.OceanShippingImport:
break;
}
var clientParamService = context.ServiceProvider.GetRequiredService<IClientParamService>();
var param = await clientParamService.GetParamAsync<string>(context.TaskInfo.BusinessId, Booking_Route,
(x, y) => x.CustomerId == y.ForwarderId);
if (string.IsNullOrEmpty(param.Value))

@ -1,4 +1,5 @@
using DS.Module.Core;
using System.Linq.Expressions;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.DjyServiceStatus;
@ -11,6 +12,7 @@ using DS.WMS.Core.TaskPlat.Dtos;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
using SqlSugar;
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
@ -155,6 +157,42 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
await CreateSubTaskAsync(task);
}
/// <summary>
/// 获取海运出口查询对象
/// </summary>
/// <param name="expression">查询条件</param>
/// <returns></returns>
public ISugarQueryable<SeaExport> AsQueryable(Expression<Func<SeaExport, bool>>? expression = null)
{
return TenantDb.Queryable<SeaExport>().WhereIF(expression != null, expression);
}
protected override async Task<DataResult> OnTaskCreated(BusinessTask task)
{
if (task.TaskType == TaskBaseTypeEnum.WAIT_BOOKING)
{
var order = await AsQueryable(x => x.Id == task.BusinessId).Select(x => new
{
x.BookingNo,
x.MBLNO
}).FirstAsync();
//订单已有订舱编号或提单号,当前任务直接完成
if (order != null && (!order.BookingNo.IsNullOrEmpty() || !order.MBLNO.IsNullOrEmpty()))
{
await SetTaskStatusAsync(new TaskUpdateRequest
{
BusinessId = task.BusinessId,
BusinessType = task.BusinessType,
TaskTypeName = task.TaskType.ToString(),
TaskStatus = TaskStatusEnum.Complete
}, false);
}
}
return DataResult.Success;
}
///// <summary>
///// 当任务状态发生变化时调用
///// </summary>

Loading…
Cancel
Save