From e0a09aadbffc422dc1387237e9c3b41442c3beae Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 7 Nov 2024 20:28:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BB=BB=E5=8A=A1=E5=AF=B9=E8=B1=A1=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=EF=BC=88=E6=89=B9=E9=87=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Interface/ITaskManageService.cs | 1 + .../TaskPlat/Method/TaskManageService.cs | 58 ++++++++++++++++++- 2 files changed, 58 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 e21ee3c1..2888489c 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -122,5 +122,6 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 获取任务是否生成的配置列表 /// Task>> GetCreateTaskConfigList(); + Task SetTaskBaseInfoPropertyWithBsno(List bsnoList, 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 96f1dc25..335e5a4f 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -33,6 +33,8 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SqlSugar; +using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; @@ -452,6 +454,54 @@ namespace DS.WMS.Core.TaskPlat.Method return DataResult.Successed("操作成功"); } + + /// + /// 工作流设置任务对象属性(批量) + /// + /// 主任务业务主键列表 + /// 主任务业务类型 + /// 要修改的列 + public async Task SetTaskBaseInfoPropertyWithBsno(List bsnoList, TaskBaseTypeEnum taskBaseTypeEnum, params Expression>[] columns) + { + bsnoList = bsnoList ?? []; + + var bsnoStr = string.Join(',', bsnoList ?? []); + + logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno 批量 bsno={bsnoStr};taskBaseTypeEnum={taskBaseTypeEnum};"); + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + var taskTypeStr = taskBaseTypeEnum.ToString(); + + var taskInfoIdList = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + .OrderByDescending(a => a.Id) + .Where(t => bsnoList.Contains((long)t.OUT_BS_NO!) && t.TASK_TYPE == taskTypeStr) + .Select(t => t.Id) + .ToListAsync(); + + if (taskInfoIdList == null || taskInfoIdList.Count == 0) + { + logger.LogInformation($"根据bsno列表:【{string.Join(',', bsnoList ?? [])}】,TaskBaseTypeEnum:【{taskBaseTypeEnum}】未查询到任务"); + return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData))); + } + else + { + logger.LogInformation($"根据bsno列表:【{bsnoStr}】,查询出taskInfoId=【{(string.Join(',', taskInfoIdList))}】"); + } + + 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 => taskInfoIdList.Contains(x.Id)) + .ExecuteCommandAsync(); + + return DataResult.Successed("操作成功"); + } #endregion @@ -4423,7 +4473,13 @@ namespace DS.WMS.Core.TaskPlat.Method { //await serviceProvider.GetRequiredService var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType); - await SetTaskBaseInfoPropertyWithBsno(taskId, taskTypeEnum, null, null, x => x.TASK_DESP == content); + //await SetTaskBaseInfoPropertyWithBsno(taskId, taskTypeEnum, null, null, x => x.TASK_DESP == content); + await SetTaskBaseInfoPropertyWithBsno(new List() { 111, 222 }, taskTypeEnum, x => x.TASK_DESP == content); + break; + } + case 9: + { + break; } } From dbbbc224b25942c8e5293ede1e7b835a69488e94 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 7 Nov 2024 20:28:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs | 6 ++++++ 1 file changed, 6 insertions(+) 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 2888489c..a9c38ee5 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -122,6 +122,12 @@ namespace DS.WMS.Core.TaskPlat.Interface /// 获取任务是否生成的配置列表 /// Task>> GetCreateTaskConfigList(); + /// + /// 工作流设置任务对象属性(批量) + /// + /// 主任务业务主键列表 + /// 主任务业务类型 + /// 要修改的列 Task SetTaskBaseInfoPropertyWithBsno(List bsnoList, TaskBaseTypeEnum taskBaseTypeEnum, params Expression>[] columns); } }