cjy 3 weeks ago
commit a9e317d0fe

@ -122,5 +122,12 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 获取任务是否生成的配置列表 /// 获取任务是否生成的配置列表
/// </summary> /// </summary>
Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList(); Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList();
/// <summary>
/// 工作流设置任务对象属性(批量)
/// </summary>
/// <param name="bsnoList">主任务业务主键列表</param>
/// <param name="taskBaseTypeEnum">主任务业务类型</param>
/// <param name="columns">要修改的列</param>
Task<DataResult> SetTaskBaseInfoPropertyWithBsno(List<long> bsnoList, TaskBaseTypeEnum taskBaseTypeEnum, params Expression<Func<TaskBaseInfo, bool>>[] columns);
} }
} }

@ -33,6 +33,8 @@ using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using SqlSugar; using SqlSugar;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
@ -452,6 +454,54 @@ namespace DS.WMS.Core.TaskPlat.Method
return DataResult.Successed("操作成功"); return DataResult.Successed("操作成功");
} }
/// <summary>
/// 工作流设置任务对象属性(批量)
/// </summary>
/// <param name="bsnoList">主任务业务主键列表</param>
/// <param name="taskBaseTypeEnum">主任务业务类型</param>
/// <param name="columns">要修改的列</param>
public async Task<DataResult> SetTaskBaseInfoPropertyWithBsno(List<long> bsnoList, TaskBaseTypeEnum taskBaseTypeEnum, params Expression<Func<TaskBaseInfo, bool>>[] 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<TaskBaseInfo>().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<TaskBaseInfo>();
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 #endregion
@ -4423,7 +4473,13 @@ namespace DS.WMS.Core.TaskPlat.Method
{ {
//await serviceProvider.GetRequiredService<taskmana> //await serviceProvider.GetRequiredService<taskmana>
var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType); 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<long>() { 111, 222 }, taskTypeEnum, x => x.TASK_DESP == content);
break;
}
case 9:
{
break; break;
} }
} }

Loading…
Cancel
Save