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 ///