From d097df586eb57a3f68b43949044558bdbafcb0c6 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 30 Aug 2024 15:31:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AF=B9=E8=B1=A1=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Interface/ITaskManageService.cs | 8 ++++ .../TaskPlat/Method/TaskManageService.cs | 38 ++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs index b540ef50..f52e25a4 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -1,7 +1,9 @@ using DS.Module.Core; using DS.Module.DjyServiceStatus; using DS.WMS.Core.TaskPlat.Dtos; +using DS.WMS.Core.TaskPlat.Entity; using Microsoft.AspNetCore.Http; +using System.Linq.Expressions; namespace DS.WMS.Core.TaskPlat.Interface { @@ -66,6 +68,12 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 要转交的人员信息列表 Task TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List userInfos); + + /// + /// 工作流设置任务对象属性 + /// + Task SetTaskBaseInfoPropertyWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, params Expression>[] columns); + /// /// 测试用 /// 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 f4b14458..d7cba4ad 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -14,7 +14,6 @@ using DS.WMS.Core.Map.Dtos; using DS.WMS.Core.Map.Interface; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Entity; -using DS.WMS.Core.Op.Interface; using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Interface; @@ -25,6 +24,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using SqlSugar; +using System.Linq.Expressions; namespace DS.WMS.Core.TaskPlat.Method @@ -188,6 +188,42 @@ namespace DS.WMS.Core.TaskPlat.Method throw; } } + + /// + /// 工作流设置任务对象属性 + /// + public async Task SetTaskBaseInfoPropertyWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, params Expression>[] columns) + { + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + long? taskInfoId = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + .OrderByDescending(a => a.Id) + .Where(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString()) + .Select(t => t.Id) + .FirstAsync(); + if (taskInfoId == null || taskInfoId == 0) + { + logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum:【{taskBaseTypeEnum}】未查询到任务"); + return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData))); + } + else + { + logger.LogInformation($"根据bsno:【{bsno}】,查询出taskInfoId=【{taskInfoId}】"); + } + var updateable = tenantDb.Updateable(); + foreach (var item in columns) + { + updateable.SetColumns(item); + } + updateable.SetColumns(x => x.UpdateBy == long.Parse(user.UserId)) + .SetColumns(x => x.UpdateTime == DateTime.Now) + .SetColumns(x => x.UpdateUserName == user.UserName); + + await updateable.Where(x => taskInfoId == x.Id) + .ExecuteCommandAsync(); + + return DataResult.Successed("操作成功"); + } #endregion ///