更新任务状态增加使用事务开关参数

usertest
嵇文龙 4 months ago
parent c2c3b9cf57
commit aeaff5e203

@ -66,7 +66,7 @@ namespace DS.WMS.Core.Fee.Method
if (!request.QueryCondition.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var whereList = request.GetConditionalModels(Db);
queryList = queryList.Where(whereList);
}

@ -42,7 +42,7 @@ namespace DS.WMS.Core.Fee.Method
{
long UserId = long.Parse(User.UserId);
//序列化查询条件
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var whereList = request.GetConditionalModels(Db);
var data = await TenantDb.Queryable<FeeRecord>()
.Where(x => x.IsOpen || (!x.IsOpen && x.CreateBy == UserId))
.Where(whereList)

@ -1,10 +1,18 @@
namespace DS.WMS.Core.Op.Interface.TaskInteraction
using DS.Module.Core;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
namespace DS.WMS.Core.Op.Interface.TaskInteraction
{
/// <summary>
/// 海运出口交互任务
/// </summary>
public interface ISeaExportTaskService : ITaskService
{
/// <summary>
/// 创建关联子任务
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult> CreateSubTaskAsync(IEnumerable<TaskCreationRequest> request);
}
}

@ -21,8 +21,9 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// 设置任务状态
/// </summary>
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns>
Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request);
Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true);
/// <summary>
/// 审批完成回调更新

@ -172,13 +172,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// 设置任务状态
/// </summary>
/// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns>
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request)
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
{
if (!await EnsureModuleAuthorized())
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
await TenantDb.Ado.BeginTranAsync();
if (useTransaction)
await TenantDb.Ado.BeginTranAsync();
try
{
var result = await ManagerService.SetTaskStatus(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now);
@ -211,12 +214,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
}
await TenantDb.Ado.CommitTranAsync();
if (useTransaction)
await TenantDb.Ado.CommitTranAsync();
return DataResult.Success;
}
catch (Exception ex)
{
await TenantDb.Ado.RollbackTranAsync();
if (useTransaction)
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}

Loading…
Cancel
Save