cjy 3 months ago
commit 9e512a1085

@ -14,10 +14,10 @@ namespace DS.Module.Core
public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo); public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo);
/// <summary> /// <summary>
/// 任务主表主键 /// 任务主表对象
/// </summary> /// </summary>
/// <remarks>类型:<see cref="long"/></remarks> /// <remarks>类型:DS.WMS.Core.TaskPlat.Entity.TaskBaseInfo</remarks>
public const string TaskBaseId = "TaskBaseId"; public const string TaskBaseInfo = "TaskBaseInfo";
/// <summary> /// <summary>
/// BC子任务主键 /// BC子任务主键

@ -18,7 +18,7 @@ namespace DS.WMS.Core.Info.Method
public class ClientParamService : ServiceBase, IClientParamService public class ClientParamService : ServiceBase, IClientParamService
{ {
/// <summary> /// <summary>
/// /// 初始化
/// </summary> /// </summary>
/// <param name="serviceProvider"></param> /// <param name="serviceProvider"></param>
public ClientParamService(IServiceProvider serviceProvider) : base(serviceProvider) public ClientParamService(IServiceProvider serviceProvider) : base(serviceProvider)
@ -33,19 +33,20 @@ namespace DS.WMS.Core.Info.Method
/// <param name="paramName">参数名</param> /// <param name="paramName">参数名</param>
/// <param name="joinExpression">客户类别连接条件</param> /// <param name="joinExpression">客户类别连接条件</param>
/// <returns></returns> /// <returns></returns>
public async Task<Param<T>> GetParamAsync<T>(long businessId, string paramName, public async Task<Param<T>> GetParamAsync<T>(long businessId, string paramName,
Expression<Func<InfoClientParam, SeaExport, bool>> joinExpression) Expression<Func<InfoClientParam, SeaExport, bool>> joinExpression)
{ {
Param<T?> param = new() { Name = paramName };
var model = await TenantDb.Queryable<InfoClientParam>() var model = await TenantDb.Queryable<InfoClientParam>()
.InnerJoin(joinExpression) .InnerJoin(joinExpression)
.Where((cp, s) => s.Id == businessId && cp.ParamCode == paramName) .Where((x, y) => y.Id == businessId && x.ParamCode == paramName)
.Select((cp, s) => new .Select((x, y) => new
{ {
cp.ItemCode, x.ItemCode,
cp.ItemName x.ItemName
}).FirstAsync(); }).FirstAsync();
var param = new Param<T?> { Name = paramName, DisplayValue = model?.ItemName }; param.DisplayValue = model?.ItemName;
if (model == null) if (model == null)
return param; return param;

@ -69,5 +69,11 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="additionalData">附加参数</param> /// <param name="additionalData">附加参数</param>
/// <returns></returns> /// <returns></returns>
Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary<string, object>? additionalData = null); Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary<string, object>? additionalData = null);
/// <summary>
/// 执行放舱任务(任务台使用)
/// </summary>
Task SpaceReleaseTask(TaskFlowDataContext dataContext);
} }
} }

@ -1,4 +1,5 @@
using DS.WMS.Core.Info.Interface; using DS.Module.Core;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
@ -7,6 +8,8 @@ using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -17,10 +20,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
/// </summary> /// </summary>
public class SpaceReleaseActionExecutor : DefaultActionExecutor public class SpaceReleaseActionExecutor : DefaultActionExecutor
{ {
///// <summary> /// <summary>
///// 任务服务 /// 任务服务
///// </summary> /// </summary>
//protected ISeaExportService OpService; protected ISeaExportService OpService;
/// <summary>
/// 任务BC服务
/// </summary>
protected ITaskManageBCService BCService;
/// <summary> /// <summary>
/// 日志服务 /// 日志服务
/// </summary> /// </summary>
@ -28,8 +35,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
public override async Task ExecuteAsync(ActionExecutionContext context) public override async Task ExecuteAsync(ActionExecutionContext context)
{ {
//OpService = context.ServiceProvider.GetRequiredService<ISeaExportService>(); OpService = context.ServiceProvider.GetRequiredService<ISeaExportService>();
BCService = context.ServiceProvider.GetRequiredService<ITaskManageBCService>();
LogService = context.ServiceProvider.GetRequiredService<ITaskLogService>(); LogService = context.ServiceProvider.GetRequiredService<ITaskLogService>();
var releaseTypeService = context.ServiceProvider.GetRequiredService<IReleaseTypeService>(); var releaseTypeService = context.ServiceProvider.GetRequiredService<IReleaseTypeService>();
var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType); var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType);
switch (typeValue) switch (typeValue)
@ -104,24 +113,21 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
//转发BC //转发BC
async Task RelayBCAsync(ActionExecutionContext context) async Task RelayBCAsync(ActionExecutionContext context)
{ {
var taskBase = context.AdditionalData[TaskFlowDataNameConst.TaskBaseInfo] as TaskBaseInfo;
if (taskBase != null)
await BCService.SyncBookingSlotChange(taskBase.Id);
} }
//下货纸 //下货纸
async Task SendShippingOrderAsync(ActionExecutionContext context) async Task SendShippingOrderAsync(ActionExecutionContext context)
{ {
//var isSend = await GetSendXHZAsync(context.TaskInfo.BusinessId); var result = await OpService.SendXHZ(context.TaskInfo.BusinessId.ToString());
//if (isSend.GetValueOrDefault()) if (!result.Succeeded)
//{ {
// var result = await OpService.SendXHZ(context.TaskInfo.BusinessId.ToString()); await LogService.WriteLogAsync(context.TaskInfo, "发送下货纸失败:" + result.Message);
// if (!result.Succeeded) }
// {
// await LogService.WriteLogAsync(context.TaskInfo, "发送下货纸失败:" + result.Message);
// }
//}
} }
} }
} }

@ -180,6 +180,29 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
await TriggerActionAsync(businessTask); await TriggerActionAsync(businessTask);
} }
/// <summary>
/// 执行放舱任务(任务台使用)
/// </summary>
public async Task SpaceReleaseTask(TaskFlowDataContext dataContext)
{
dataContext.Set("TypeName", "DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease.SpaceReleaseActionExecutor,DS.WMS.Core");
var businessId = dataContext.Get<long?>(TaskFlowDataNameConst.BusinessId);
ArgumentNullException.ThrowIfNull(businessId, TaskFlowDataNameConst.BusinessId);
//await TriggerActionAsync(businessId.Value, BusinessType.OceanShippingExport, TaskBaseTypeEnum.WAIT_SPACE_RELEASE);
var businessTask = await TenantDb.Queryable<BusinessTask>().Where(
x => x.BusinessId == businessId && x.BusinessType == BusinessType.OceanShippingExport && x.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE).FirstAsync();
dataContext.Set(TaskFlowDataNameConst.BusinessTask, businessTask);
await ExecuteAsync(dataContext);
//var service = ServiceProvider.GetRequiredService<ISeaExportTaskService>();
//await service.CreateSubTaskAsync(businessTask);
}
/// <summary> /// <summary>
/// 触发任务执行动作 /// 触发任务执行动作
/// </summary> /// </summary>
@ -227,7 +250,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ServiceProvider = ServiceProvider ServiceProvider = ServiceProvider
}; };
//dataContext.Set("TypeName", "DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease.SpaceReleaseActionExecutor,DS.WMS.Core");
foreach (var key in dataContext.Keys) foreach (var key in dataContext.Keys)
context.AdditionalData[key] = dataContext[key]; context.AdditionalData[key] = dataContext[key];

@ -2291,13 +2291,13 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<DataResult> SyncBookingSlotChangeTask(TaskFlowDataContext dataContext) public async Task<DataResult> SyncBookingSlotChangeTask(TaskFlowDataContext dataContext)
{ {
var taskBaseId = dataContext.Get<long?>(TaskFlowDataNameConst.TaskBaseId); var taskBaseInfo = dataContext.Get<TaskBaseInfo?>(TaskFlowDataNameConst.TaskBCInfo);
if (taskBaseId == null) if (taskBaseInfo == null)
{ {
Logger.Log(NLog.LogLevel.Info, $"执行ApiReceiveTask时未获取到{TaskFlowDataNameConst.TaskBaseId}"); logger.LogInformation($"执行ApiReceiveTask时未获取到{TaskFlowDataNameConst.TaskBaseInfo}");
} }
return await SyncBookingSlotChange(taskBaseId.Value); return await SyncBookingSlotChange(taskBaseInfo.Id);
} }
#region 读取BC详情 #region 读取BC详情

@ -950,11 +950,15 @@ namespace DS.WMS.Core.TaskPlat.Method
// 执行自动化操作 // 执行自动化操作
TaskFlowDataContext dataContext = new( TaskFlowDataContext dataContext = new(
// 固定
(TaskFlowDataNameConst.TaskBaseInfo, taskInfo),
// 邮件接收任务特有
(TaskFlowDataNameConst.TaskManageOrderMessageInfo, info), (TaskFlowDataNameConst.TaskManageOrderMessageInfo, info),
// BC子任务特有
(TaskFlowDataNameConst.BCFile, file), (TaskFlowDataNameConst.BCFile, file),
(TaskFlowDataNameConst.AmendmentFile, modifyFile), (TaskFlowDataNameConst.AmendmentFile, modifyFile),
(TaskFlowDataNameConst.TaskBaseId, taskInfo.Id),
//(TaskFlowDataNameConst.TaskBCId, bcInfo.Id),
(TaskFlowDataNameConst.TaskBCInfo, bcInfo), (TaskFlowDataNameConst.TaskBCInfo, bcInfo),
(TaskFlowDataNameConst.TaskBCCtnList, ctnList) (TaskFlowDataNameConst.TaskBCCtnList, ctnList)
); );

Loading…
Cancel
Save