cjy 3 months ago
commit 9e512a1085

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

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

@ -69,5 +69,11 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="additionalData">附加参数</param>
/// <returns></returns>
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.TaskInteraction;
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.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
@ -17,10 +20,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
/// </summary>
public class SpaceReleaseActionExecutor : DefaultActionExecutor
{
///// <summary>
///// 任务服务
///// </summary>
//protected ISeaExportService OpService;
/// <summary>
/// 任务服务
/// </summary>
protected ISeaExportService OpService;
/// <summary>
/// 任务BC服务
/// </summary>
protected ITaskManageBCService BCService;
/// <summary>
/// 日志服务
/// </summary>
@ -28,8 +35,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
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>();
var releaseTypeService = context.ServiceProvider.GetRequiredService<IReleaseTypeService>();
var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType);
switch (typeValue)
@ -104,24 +113,21 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
//转发BC
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)
{
//var isSend = await GetSendXHZAsync(context.TaskInfo.BusinessId);
//if (isSend.GetValueOrDefault())
//{
// var result = await OpService.SendXHZ(context.TaskInfo.BusinessId.ToString());
// if (!result.Succeeded)
// {
// await LogService.WriteLogAsync(context.TaskInfo, "发送下货纸失败:" + result.Message);
// }
//}
var result = await OpService.SendXHZ(context.TaskInfo.BusinessId.ToString());
if (!result.Succeeded)
{
await LogService.WriteLogAsync(context.TaskInfo, "发送下货纸失败:" + result.Message);
}
}
}
}

@ -180,6 +180,29 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
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>
@ -227,7 +250,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ServiceProvider = ServiceProvider
};
//dataContext.Set("TypeName", "DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease.SpaceReleaseActionExecutor,DS.WMS.Core");
foreach (var key in dataContext.Keys)
context.AdditionalData[key] = dataContext[key];

@ -2291,13 +2291,13 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <returns>返回回执</returns>
public async Task<DataResult> SyncBookingSlotChangeTask(TaskFlowDataContext dataContext)
{
var taskBaseId = dataContext.Get<long?>(TaskFlowDataNameConst.TaskBaseId);
if (taskBaseId == null)
var taskBaseInfo = dataContext.Get<TaskBaseInfo?>(TaskFlowDataNameConst.TaskBCInfo);
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详情

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

Loading…
Cancel
Save