修改任务完成方法

optimize
jianghaiqing 1 year ago
parent 1e0da274df
commit 9b5e244eda

@ -1539,7 +1539,7 @@ namespace Myshipping.Application
model.STATUS = TaskStatusEnum.Complete.ToString(); model.STATUS = TaskStatusEnum.Complete.ToString();
model.STATUS_NAME = TaskStatusEnum.Complete.GetDescription(); model.STATUS_NAME = TaskStatusEnum.Complete.GetDescription();
_taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new await _taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
{ {
it.COMPLETE_DATE, it.COMPLETE_DATE,
it.COMPLETE_DEAL, it.COMPLETE_DEAL,
@ -1547,7 +1547,7 @@ namespace Myshipping.Application
it.IS_COMPLETE, it.IS_COMPLETE,
it.STATUS, it.STATUS,
it.STATUS_NAME it.STATUS_NAME
}).ExecuteCommand(); }).ExecuteCommandAsync();
} }
else if (taskOperTypeEnum == TaskOperTypeEnum.CANCEL_TASK) else if (taskOperTypeEnum == TaskOperTypeEnum.CANCEL_TASK)
{ {
@ -1556,7 +1556,7 @@ namespace Myshipping.Application
model.STATUS = TaskStatusEnum.Cancel.ToString(); model.STATUS = TaskStatusEnum.Cancel.ToString();
model.STATUS_NAME = TaskStatusEnum.Cancel.GetDescription(); model.STATUS_NAME = TaskStatusEnum.Cancel.GetDescription();
_taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new await _taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
{ {
it.COMPLETE_DATE, it.COMPLETE_DATE,
it.COMPLETE_DEAL, it.COMPLETE_DEAL,
@ -1564,7 +1564,7 @@ namespace Myshipping.Application
it.IS_COMPLETE, it.IS_COMPLETE,
it.STATUS, it.STATUS,
it.STATUS_NAME it.STATUS_NAME
}).ExecuteCommand(); }).ExecuteCommandAsync();
} }
else if (model.TASK_TYPE == TaskBusiTypeEnum.ABORT_CHANGE_SHIP.ToString()) else if (model.TASK_TYPE == TaskBusiTypeEnum.ABORT_CHANGE_SHIP.ToString())
{ {
@ -1585,14 +1585,14 @@ namespace Myshipping.Application
model.UpdatedUserId = UserManager.UserId; model.UpdatedUserId = UserManager.UserId;
model.UpdatedUserName = UserManager.Name; model.UpdatedUserName = UserManager.Name;
_taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new await _taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
{ {
it.UpdatedTime, it.UpdatedTime,
it.UpdatedUserId, it.UpdatedUserId,
it.UpdatedUserName, it.UpdatedUserName,
it.STATUS, it.STATUS,
it.STATUS_NAME it.STATUS_NAME
}).ExecuteCommand(); }).ExecuteCommandAsync();
} }
} }

@ -11,6 +11,7 @@ using Myshipping.Application.Entity;
using Myshipping.Application.Helper; using Myshipping.Application.Helper;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using MySqlX.XDevAPI.Common;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -921,7 +922,64 @@ namespace Myshipping.Application
[HttpPost("/ServiceWorkFlowBase/PublishRelease")] [HttpPost("/ServiceWorkFlowBase/PublishRelease")]
public async Task<TaskManageOrderResultDto> PublishRelease([FromBody]string[] pkIds) public async Task<TaskManageOrderResultDto> PublishRelease([FromBody]string[] pkIds)
{ {
return new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
if (pkIds.Length == 0)
{
throw Oops.Oh($"服务流程主键数组不能为空", typeof(InvalidOperationException));
}
var list = _serviceWorkFlowBaseRepository.AsQueryable()
.Where(a => pkIds.Contains(a.PK_ID)).ToList();
if (list.Count == 0)
throw Oops.Oh($"服务流程获取失败,请服务流程信息是否存在", typeof(InvalidOperationException));
if (list.Count != pkIds.Length)
throw Oops.Oh($"部分服务流程获取失败,请服务流程信息是否存在", typeof(InvalidOperationException));
List<TaskManageOrderResultDto> rltList = new List<TaskManageOrderResultDto>();
//list.ForEach(pr => {
// rltList.Add(InnerExcuteServiceWF(pr, OperateTypeEnum.Delete).GetAwaiter().GetResult());
//});
result.succ = true;
result.msg = rltList.FirstOrDefault().msg;
result.ext = rltList;
var succ = rltList.Count(x => x.succ);
var fail = rltList.Count(x => !x.succ);
if (succ > 0)
{
result.batchTotal = succ.ToString();
}
else
{
result.batchTotal = "- ";
}
if (fail > 0)
{
result.batchTotal += "/" + fail.ToString();
}
else
{
result.batchTotal += " -";
}
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"启用服务项目异常,原因:{ex.Message}";
}
return result;
} }
#region 获取展示服务流程时间轴列表 #region 获取展示服务流程时间轴列表

Loading…
Cancel
Save