From 91af5a3241a31308746285c45e3ecb0729371899 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Mon, 19 Aug 2024 11:01:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4BC=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=94=BE=E8=88=B1=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/TaskFlowDataNameConst.cs | 6 ++--- .../TaskInteraction/IActionManagerService.cs | 5 ++++ .../TaskInteraction/ActionManagerService.cs | 24 ++++++++++++++++++- .../TaskPlat/Method/TaskManageBCService.cs | 8 +++---- .../TaskPlat/Method/TaskManageService.cs | 8 +++++-- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs index 449e0444..87de2130 100644 --- a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs @@ -14,10 +14,10 @@ namespace DS.Module.Core public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo); /// - /// 任务主表主键 + /// 任务主表对象 /// - /// 类型: - public const string TaskBaseId = "TaskBaseId"; + /// 类型:DS.WMS.Core.TaskPlat.Entity.TaskBaseInfo + public const string TaskBaseInfo = "TaskBaseInfo"; /// /// BC子任务主键 diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs index 2d6b86c0..8ef304ce 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs @@ -71,5 +71,10 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary? additionalData = null); Task TriggerTestAsync(TaskBaseTypeEnum taskType, long? id); + + /// + /// 执行放舱任务(任务台使用) + /// + Task SpaceReleaseTask(TaskFlowDataContext dataContext); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs index 03090cf4..fd297cd1 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs @@ -180,6 +180,29 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction await TriggerActionAsync(businessTask); } + /// + /// 执行放舱任务(任务台使用) + /// + 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(TaskFlowDataNameConst.BusinessId); + ArgumentNullException.ThrowIfNull(businessId, TaskFlowDataNameConst.BusinessId); + + //await TriggerActionAsync(businessId.Value, BusinessType.OceanShippingExport, TaskBaseTypeEnum.WAIT_SPACE_RELEASE); + + var businessTask = await TenantDb.Queryable().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(); + //await service.CreateSubTaskAsync(businessTask); + } + /// /// 触发任务执行动作 /// @@ -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]; diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs index cee6a422..42a1007c 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -2291,13 +2291,13 @@ namespace DS.WMS.Core.TaskPlat.Method /// 返回回执 public async Task SyncBookingSlotChangeTask(TaskFlowDataContext dataContext) { - var taskBaseId = dataContext.Get(TaskFlowDataNameConst.TaskBaseId); - if (taskBaseId == null) + var taskBaseInfo = dataContext.Get(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详情 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 1854d1dc..6f3ede26 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -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) ); From ebea641b4be78c48a54464e57c4ebf727f6a688e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 19 Aug 2024 11:13:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8F=90=E4=BA=A41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Info/Method/ClientParamService.cs | 2 +- .../SpaceReleaseActionExecutor.cs | 25 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs index 66934af2..ba6079cf 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs @@ -18,7 +18,7 @@ namespace DS.WMS.Core.Info.Method public class ClientParamService : ServiceBase, IClientParamService { /// - /// + /// 初始化 /// /// public ClientParamService(IServiceProvider serviceProvider) : base(serviceProvider) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs index e2e8f6c7..95a50a3c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs @@ -17,10 +17,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease /// public class SpaceReleaseActionExecutor : DefaultActionExecutor { - ///// - ///// 任务服务 - ///// - //protected ISeaExportService OpService; + /// + /// 任务服务 + /// + protected ISeaExportService OpService; /// /// 日志服务 /// @@ -28,7 +28,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease public override async Task ExecuteAsync(ActionExecutionContext context) { - //OpService = context.ServiceProvider.GetRequiredService(); + OpService = context.ServiceProvider.GetRequiredService(); LogService = context.ServiceProvider.GetRequiredService(); var releaseTypeService = context.ServiceProvider.GetRequiredService(); var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType); @@ -110,18 +110,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease //下货纸 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); + } } - } } From cb165ac2be55d8246632b727b2c50911af43b476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 19 Aug 2024 11:21:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=8F=82=E6=95=B0bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Info/Method/ClientParamService.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs index ba6079cf..c249a2d1 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs @@ -33,19 +33,20 @@ namespace DS.WMS.Core.Info.Method /// 参数名 /// 客户类别连接条件 /// - public async Task> GetParamAsync(long businessId, string paramName, + public async Task> GetParamAsync(long businessId, string paramName, Expression> joinExpression) { + Param param = new() { Name = paramName }; var model = await TenantDb.Queryable() - .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 { Name = paramName, DisplayValue = model?.ItemName }; + param.DisplayValue = model?.ItemName; if (model == null) return param; From 6a8f68cb2aaacd07348655d321d74e9313818743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 19 Aug 2024 11:38:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=BD=AC=E5=8F=91BC=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SpaceRelease/SpaceReleaseActionExecutor.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs index 95a50a3c..70bef106 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs @@ -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; @@ -22,6 +25,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease /// protected ISeaExportService OpService; /// + /// 任务BC服务 + /// + protected ITaskManageBCService BCService; + /// /// 日志服务 /// protected ITaskLogService LogService; @@ -29,7 +36,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease public override async Task ExecuteAsync(ActionExecutionContext context) { OpService = context.ServiceProvider.GetRequiredService(); + BCService = context.ServiceProvider.GetRequiredService(); LogService = context.ServiceProvider.GetRequiredService(); + var releaseTypeService = context.ServiceProvider.GetRequiredService(); var typeValue = await releaseTypeService.GetReleaseTypeAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType); switch (typeValue) @@ -104,7 +113,9 @@ 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); } //下货纸