From 280355ab2affa1b779212a28bbb711d479b98c9d 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 16:00:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=BE=E8=88=B1=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E5=AE=8C=E6=88=90=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Booking/BookingActionExecutor.cs | 35 +----------- .../Booking/EDIActionExecutor.cs | 9 +-- .../Booking/MailActionExecutor.cs | 7 ++- .../ActionExecutor/DefaultActionExecutor.cs | 55 +++++++++++++++++++ .../SpaceReleaseActionExecutor.cs | 15 ++++- 5 files changed, 79 insertions(+), 42 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs index f09647ce..029b6bdb 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs @@ -29,39 +29,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking return Task.CompletedTask; } - protected async Task CreateTaskIfNotExistAsync(ActionExecutionContext context) - { - if (!context.TaskInfo.NextType.HasValue) - return DataResult.Success; - - var result = await TaskService.ExistsAsync(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType, context.TaskInfo.NextType.Value); - //任务已存在,跳过创建步骤 - if (result.Data) - return DataResult.Success; - - return await TaskService.CreateTaskAsync(new TaskCreationRequest - { - BusinessId = context.TaskInfo.BusinessId, - BusinessType = context.TaskInfo.BusinessType, - TaskTypeName = context.TaskInfo.NextType.Value.ToString() - }); - } - - protected async Task SetTaskCompleteAsync(ActionExecutionContext context) - { - if (!context.TaskInfo.NextType.HasValue) - return; - - var result = await TaskService.SetTaskStatusAsync(new TaskUpdateRequest - { - BusinessId = context.TaskInfo.BusinessId, - BusinessType = context.TaskInfo.BusinessType, - TaskTypeName = context.TaskInfo.NextType.Value.ToString(), - TaskStatus = TaskStatusEnum.Complete, - AutoCreateNext = true - }); - if (!result.Succeeded) - await LogService.WriteLogAsync(context.TaskInfo, $"未能设置任务【{context.TaskInfo.NextType.Value.GetDescription()}】完成,返回结果:{result.Message}"); - } + } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs index 2a649040..b29e9f17 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs @@ -1,7 +1,7 @@ -using DS.WMS.Core.Op.Dtos; +using DS.Module.Core; +using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Interface; -using Masuit.Tools.Systems; using Microsoft.Extensions.DependencyInjection; namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking @@ -11,7 +11,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking /// public class EDIActionExecutor : BookingActionExecutor { - public async override Task ExecuteAsync(ActionExecutionContext context) { await base.ExecuteAsync(context); @@ -41,7 +40,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking return; } - await SetTaskCompleteAsync(context); + var task = context.TaskInfo; + task.TaskType = TaskBaseTypeEnum.WAIT_BOOKING; + await SetTaskCompleteAsync(task, TaskService, LogService); } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs index a18135d3..2ae9183e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs @@ -1,4 +1,5 @@ -using DS.WMS.Core.Op.Dtos; +using DS.Module.Core; +using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.TaskInteraction; @@ -79,7 +80,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking return; } - await SetTaskCompleteAsync(context); + var task = context.TaskInfo; + task.TaskType = TaskBaseTypeEnum.WAIT_BOOKING; + await SetTaskCompleteAsync(task, TaskService, LogService); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs index 565aa1b2..5d4ce511 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs @@ -1,6 +1,9 @@ using DS.Module.Core; using DS.WMS.Core.Op.Dtos.TaskInteraction; +using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction; +using Masuit.Tools.Systems; namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor { @@ -25,5 +28,57 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor { return Task.CompletedTask; } + + /// + /// 如果指定类型的任务不存在则创建 + /// + /// 业务ID + /// 业务类型 + /// 任务类型 + /// 任务服务 + /// 任务日志服务 + /// + protected async Task CreateTaskIfNotExistAsync(long bsId, BusinessType type, TaskBaseTypeEnum taskType, + ITaskService taskService, ITaskLogService? logService = null) + { + ArgumentNullException.ThrowIfNull(taskService, nameof(taskService)); + + var result = await taskService.ExistsAsync(bsId, type, taskType); + //任务已存在,跳过创建步骤 + if (result.Data) + return DataResult.Success; + + return await taskService.CreateTaskAsync(new TaskCreationRequest + { + BusinessId = bsId, + BusinessType = type, + TaskTypeName = taskType.ToString() + }); + } + + /// + /// 设置任务状态为完成 + /// + /// 任务对象 + /// 任务服务 + /// 任务日志服务 + /// + protected virtual async Task SetTaskCompleteAsync(BusinessTask task, ITaskService taskService, ITaskLogService? logService = null) + { + ArgumentNullException.ThrowIfNull(task, nameof(task)); + ArgumentNullException.ThrowIfNull(taskService, nameof(taskService)); + + var result = await taskService.SetTaskStatusAsync(new TaskUpdateRequest + { + BusinessId = task.BusinessId, + BusinessType = task.BusinessType, + TaskTypeName = task.TaskType.ToString(), + TaskStatus = TaskStatusEnum.Complete, + AutoCreateNext = true + }); + if (!result.Succeeded && logService != null) + await logService.WriteLogAsync(task, $"未能设置任务【{task.NextType?.GetDescription()}】完成,返回结果:{result.Message}"); + } + } } 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 70bef106..9bad3f1e 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 @@ -108,16 +108,27 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease await LogService.WriteLogAsync(context.TaskInfo, result.Message); return; } + + await SetTaskCompleteAsync(context.TaskInfo, + context.ServiceProvider.GetRequiredService(), LogService); } //转发BC async Task RelayBCAsync(ActionExecutionContext context) { var taskBase = context.AdditionalData[TaskFlowDataNameConst.TaskBaseInfo] as TaskBaseInfo; - if (taskBase != null) - await BCService.SyncBookingSlotChange(taskBase.Id); + if (taskBase == null) + return; + + var result = await BCService.SyncBookingSlotChange(taskBase.Id); + if (!result.Succeeded) + return; + + await SetTaskCompleteAsync(context.TaskInfo, + context.ServiceProvider.GetRequiredService(), LogService); } + //下货纸 async Task SendShippingOrderAsync(ActionExecutionContext context) { From 501c30d06d13557e816ef0a56c4d1984cc148ce9 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 16:04:59 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=9B=B4=E6=96=B0=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E4=B8=8B=E4=B8=80=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 99ca1684..92f68ec5 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -627,7 +627,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction BusinessType = callback.BusinessType.Value, TaskTypeName = taskType.ToString(), TaskStatus = callback.FlowStatus == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending, - AutoCreateNext = false //审批完成后需根据业务需要自定义任务类型,因此设置为不自动创建下一任务 + AutoCreateNext = true }; //根据审批结果更新任务状态 await SetTaskStatusAsync(req); From 5be1acfebaeb56f8857c9be8ffce375ec3c7a6fc 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 16:07:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Revert=20"=E5=AE=A1=E6=A0=B8=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=9C=80=E8=A6=81=E6=A0=A1=E9=AA=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=A7=84=E5=88=99"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 75fbdd4f4cafbd9df0eaa8ada7fc674d0c2b3652. --- .../RuleEngineService.cs | 3 +- .../Op/Method/TaskInteraction/TaskService.cs | 99 +++++++------------ 2 files changed, 40 insertions(+), 62 deletions(-) diff --git a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs index 8e910563..ad8bd3d1 100644 --- a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs +++ b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs @@ -81,7 +81,8 @@ namespace DS.Module.DjyRulesEngine Port = port, Path = sendUrl }; - var result = await api.PostAsync(uriBuilder.ToString(), req); + string url = uriBuilder.ToString(); + var result = await api.PostAsync(url, req); if (!result.Succeeded || result.Data == null) return RuleEngineResult.Failed("请求失败,请联系管理员"); diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 92f68ec5..82f06120 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -99,6 +99,22 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction TenantDb.QueryFilter.Clear(); } + /// + /// 获取给定任务的下一任务类型 + /// + /// 当前任务对象 + /// + protected async Task GetNextTypeAsync(BusinessTask current) + { + var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType); + TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider); + var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, + new TaskFlowDataContext( + (TaskFlowDataNameConst.Business, order) + ), current.TaskType); + + return taskType; + } /// /// 创建关联任务 @@ -115,14 +131,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (task != null && task.TaskStatus != TaskStatusEnum.Cancel) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists)); - //审核任务需要校验订单规则 - if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) - { - var result = await CheckOrderRulesAsync(request.BusinessId); - if (!result.Succeeded) - return result; - } - long tenatId = long.Parse(User.TenantId); string tenatName = Db.Queryable().Where(x => x.Id == tenatId).Select(x => x.Name).First(); var info = new TaskManageOrderMessageInfo @@ -216,6 +224,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction //审核任务需创建工作流 if (AuditTaskTypes.Contains(request.TaskType)) { + if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) + { + var rulesReq = new RuleEngineReq(); + rulesReq.Head.MessageType = "BUSI_RULE"; + rulesReq.Head.SenderId = "NewOceanBooking"; + rulesReq.Head.RequestAction = "CheckRule"; + rulesReq.Main.ProjectCode = ["COMMON_OCEAN_BOOKING"]; + + var order = await TenantDb.Queryable().Where(x => x.Id == request.BusinessId).FirstAsync(); + rulesReq.Main.BusinessInfo = info.Adapt(); + + var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq); + if (ruleResult?.Extra.DetailList?.Count > 0) + { + StringBuilder sb = new StringBuilder(); + foreach (var item in ruleResult?.Extra.DetailList) + sb.Append(item.ResultName); + + return DataResult.Failed(sb.ToString()); + } + } + result = await CreateAndStartWorkflow(task); if (!result.Succeeded) return result; @@ -461,14 +491,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (task.TaskStatus == TaskStatusEnum.Pending || task.TaskStatus == TaskStatusEnum.Create) { - //审核任务需要校验订单规则 - if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) - { - var result = await CheckOrderRulesAsync(request.BusinessId); - if (!result.Succeeded) - return result; - } - await TenantDb.Ado.BeginTranAsync(); try { @@ -668,51 +690,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction }); } - async Task CheckOrderRulesAsync(long businessId) - { - var rulesReq = new RuleEngineReq(); - rulesReq.Head.MessageType = "BUSI_RULE"; - rulesReq.Head.SenderId = "NewOceanBooking"; - rulesReq.Head.RequestAction = "CheckRule"; - rulesReq.Main.ProjectCode = ["COMMON_OCEAN_BOOKING"]; - - var order = await TenantDb.Queryable().Where(x => x.Id == businessId).FirstAsync(); - if (order == null) - return DataResult.FailedWithDesc(MultiLanguageConst.EmptyData); - - rulesReq.Main.BusinessInfo = order.Adapt(); - - var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq); - if (ruleResult?.Extra.DetailList?.Count > 0) - { - StringBuilder sb = new StringBuilder(); - foreach (var item in ruleResult?.Extra.DetailList) - sb.Append(" " + item.ResultName); - - sb.Remove(0, 1); - return DataResult.Failed(sb.ToString()); - } - - return DataResult.Success; - } - - /// - /// 获取给定任务的下一任务类型 - /// - /// 当前任务对象 - /// - protected async Task GetNextTypeAsync(BusinessTask current) - { - var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType); - TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider); - var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, - new TaskFlowDataContext( - (TaskFlowDataNameConst.Business, order) - ), current.TaskType); - - return taskType; - } - /// /// 获取指定类型的业务关联任务 /// From 5430161cf5071354a6cb0353a464a60235020993 Mon Sep 17 00:00:00 2001 From: cjy Date: Mon, 19 Aug 2024 16:09:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E8=88=B9?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E4=B8=8B=E6=8B=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CommonController.cs | 18 +++++- .../Sys/Interface/IServerCommonService.cs | 23 ++++++++ .../Sys/Method/ClientCommonService.cs | 8 --- .../Sys/Method/ServerCommonService.cs | 58 +++++++++++++++++++ 4 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs diff --git a/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs b/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs index 80dcbf49..0e798baa 100644 --- a/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs +++ b/ds-wms-service/DS.WMS.AdminApi/Controllers/CommonController.cs @@ -16,16 +16,30 @@ namespace DS.WMS.AdminApi.Controllers; public class CommonController : ApiController { private readonly ICommonService _invokeService; - + private readonly IServerCommonService _serverService; /// /// 构造函数 /// /// - public CommonController(ICommonService invokeService) + public CommonController(ICommonService invokeService, IServerCommonService serverService) { _invokeService = invokeService; + _serverService = serverService; } + + /// + /// 获取船公司下拉列表 + /// + /// 船公司代码或中文名称 + /// + [HttpGet] + [Route("GetCarrierSelectList")] + public async Task>> GetCarrierSelectList([FromQuery] string queryKey) + { + var res = await _serverService.GetCodeCarrierSelectList(queryKey); + return res; + } /// /// 用户登录-管理端 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs new file mode 100644 index 00000000..e434d1ba --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IServerCommonService.cs @@ -0,0 +1,23 @@ +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Info.Dtos; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Sys.Dtos; +using DS.WMS.Core.Sys.Entity; +using SqlSugar; + +namespace DS.WMS.Core.Sys.Interface; +/// +/// +/// +public interface IServerCommonService +{ + /// + /// 获取船公司下拉列表-管理端 + /// + /// + public Task>> GetCodeCarrierSelectList(string queryKey = ""); + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index 30428a72..0352f10a 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -1,6 +1,5 @@ using DS.Module.Core; using DS.Module.Core.Constants; -using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.Module.Core.Log; using DS.Module.SqlSugar; @@ -11,21 +10,14 @@ using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Info.Entity; -using DS.WMS.Core.Invoice.Dtos; using DS.WMS.Core.Op.Dtos; -using DS.WMS.Core.Op.EDI; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Dtos; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; using Mapster; -using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.Extensions.DependencyInjection; -using NPOI.POIFS.Crypt.Dsig; using SqlSugar; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace DS.WMS.Core.Sys.Method; diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs new file mode 100644 index 00000000..fcbb3abb --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ServerCommonService.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DS.Module.Core; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Sys.Interface; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +using DS.Module.Core; +using DS.Module.Core.Constants; +using DS.Module.Core.Extensions; +using DS.Module.Core.Log; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.Code.Entity; + +namespace DS.WMS.Core.Sys.Method +{ + public class ServerCommonService : IServerCommonService + { + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + + /// + /// + /// + /// + public ServerCommonService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + } + + /// + /// + /// + /// + /// + public async Task>> GetCodeCarrierSelectList(string queryKey = "") + { + var list = await db.Queryable() + .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey)) + .Select(a => new CodeCarrierRes() + { + PinYinCode = a.CnName + "(" + a.Code + ")", + }, + true) + .Take(20) + .ToListAsync(); + return await Task.FromResult(DataResult>.Success("获取数据成功!", list)); + } + } +} From 76ee52976b3b29ca3baf04a66c16b0dbd2631526 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 16:18:59 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Method/TaskInteraction/TaskService.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 82f06120..c27464fb 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -99,22 +99,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction TenantDb.QueryFilter.Clear(); } - /// - /// 获取给定任务的下一任务类型 - /// - /// 当前任务对象 - /// - protected async Task GetNextTypeAsync(BusinessTask current) - { - var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType); - TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider); - var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, - new TaskFlowDataContext( - (TaskFlowDataNameConst.Business, order) - ), current.TaskType); - - return taskType; - } /// /// 创建关联任务 @@ -376,8 +360,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction { BusinessId = request.BusinessId, BusinessType = request.BusinessType, - TaskTypeName = task.NextType.Value.ToString(), - RecvUserIdList = task.RecvUserIdArray + TaskTypeName = task.NextType.Value.ToString() }; result = await CreateTaskAsync(req, false); if (!result.Succeeded) @@ -393,7 +376,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (task.TaskStatus == TaskStatusEnum.Complete)//目前限制任务完成才触发 { Dictionary? dic = null; - if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) + if (task.NextType == TaskBaseTypeEnum.WAIT_BOOKING) { dic = new Dictionary(); var param = await ClientParamService.GetParamAsync(task.BusinessId, BookingSelector.Booking_Route, @@ -690,6 +673,23 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction }); } + /// + /// 获取给定任务的下一任务类型 + /// + /// 当前任务对象 + /// + protected async Task GetNextTypeAsync(BusinessTask current) + { + var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType); + TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider); + var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, + new TaskFlowDataContext( + (TaskFlowDataNameConst.Business, order) + ), current.TaskType); + + return taskType; + } + /// /// 获取指定类型的业务关联任务 ///