工作流设置任务对象属性

usertest
zhangxiaofeng 3 months ago
parent 4946820700
commit d097df586e

@ -1,7 +1,9 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.DjyServiceStatus; using DS.Module.DjyServiceStatus;
using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Linq.Expressions;
namespace DS.WMS.Core.TaskPlat.Interface namespace DS.WMS.Core.TaskPlat.Interface
{ {
@ -66,6 +68,12 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="userInfos">要转交的人员信息列表</param> /// <param name="userInfos">要转交的人员信息列表</param>
Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos); Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos);
/// <summary>
/// 工作流设置任务对象属性
/// </summary>
Task<DataResult> SetTaskBaseInfoPropertyWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, params Expression<Func<TaskBaseInfo, bool>>[] columns);
/// <summary> /// <summary>
/// 测试用 /// 测试用
/// </summary> /// </summary>

@ -14,7 +14,6 @@ using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Interface; using DS.WMS.Core.Map.Interface;
using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface; using DS.WMS.Core.TaskPlat.Interface;
@ -25,6 +24,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using SqlSugar; using SqlSugar;
using System.Linq.Expressions;
namespace DS.WMS.Core.TaskPlat.Method namespace DS.WMS.Core.TaskPlat.Method
@ -188,6 +188,42 @@ namespace DS.WMS.Core.TaskPlat.Method
throw; throw;
} }
} }
/// <summary>
/// 工作流设置任务对象属性
/// </summary>
public async Task<DataResult> SetTaskBaseInfoPropertyWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, params Expression<Func<TaskBaseInfo, bool>>[] columns)
{
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
long? taskInfoId = await tenantDb.Queryable<TaskBaseInfo>().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<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 => taskInfoId == x.Id)
.ExecuteCommandAsync();
return DataResult.Successed("操作成功");
}
#endregion #endregion
/// <summary> /// <summary>

Loading…
Cancel
Save