|
|
|
@ -28,6 +28,51 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
#region 对工作流提供的接口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工作流设置任务在个人下的状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bsno">业务主键</param>
|
|
|
|
|
/// <param name="taskBaseTypeEnum">业务类型</param>
|
|
|
|
|
/// <param name="taskStatusEnum">业务状态</param>
|
|
|
|
|
/// <param name="statusTime">状态发生时间</param>
|
|
|
|
|
/// <param name="userInfos">要设置任务状态的人员列表</param>
|
|
|
|
|
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos)
|
|
|
|
|
{
|
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
.OrderByDescending(a => a.CreateTime)
|
|
|
|
|
.FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString());
|
|
|
|
|
|
|
|
|
|
if (taskInfo == null)
|
|
|
|
|
{
|
|
|
|
|
logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum:【{taskBaseTypeEnum}】未查询到任务");
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.LogInformation("接收到任务个人状态修改报文 任务主键={id} 状态设置={status} 人员列表={userList}", taskInfo.Id, taskStatusEnum.ToString(), JsonConvert.SerializeObject(userInfos));
|
|
|
|
|
|
|
|
|
|
var taskBaseAllocationList = await tenantDb.Queryable<TaskBaseAllocation>().Where(x => x.TaskId == taskInfo.Id).ToListAsync();
|
|
|
|
|
taskBaseAllocationList.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
x.Status = taskStatusEnum.ToString();
|
|
|
|
|
x.StatusName = taskStatusEnum.EnumDescription();
|
|
|
|
|
x.StatusTime = statusTime;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable(taskBaseAllocationList).UpdateColumns(x => new
|
|
|
|
|
{
|
|
|
|
|
x.UpdateBy,
|
|
|
|
|
x.UpdateTime,
|
|
|
|
|
x.UpdateUserName,
|
|
|
|
|
x.Status,
|
|
|
|
|
x.StatusName,
|
|
|
|
|
x.StatusTime
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置任务状态
|
|
|
|
|
/// </summary>
|
|
|
|
@ -51,6 +96,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString());
|
|
|
|
|
taskInfo.STATUS = taskStatusEnum.ToString();
|
|
|
|
|
taskInfo.STATUS_NAME = taskStatusEnum.EnumDescription();
|
|
|
|
|
taskInfo.RealUserId = long.Parse(user.UserId);
|
|
|
|
|
taskInfo.RealUserName = user.UserName;
|
|
|
|
|
|
|
|
|
@ -60,10 +106,32 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
x.UpdateTime,
|
|
|
|
|
x.UpdateUserName,
|
|
|
|
|
x.STATUS,
|
|
|
|
|
x.STATUS_NAME,
|
|
|
|
|
x.RealUserId,
|
|
|
|
|
x.RealUserName
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var taskBaseAllocationList = await tenantDb.Queryable<TaskBaseAllocation>().Where(x => x.TaskId == taskInfo.Id).ToListAsync();
|
|
|
|
|
if (taskBaseAllocationList.Count != 0)
|
|
|
|
|
{
|
|
|
|
|
taskBaseAllocationList.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
x.Status = taskStatusEnum.ToString();
|
|
|
|
|
x.StatusName = taskStatusEnum.EnumDescription();
|
|
|
|
|
x.StatusTime = statusTime;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable(taskBaseAllocationList).UpdateColumns(x => new
|
|
|
|
|
{
|
|
|
|
|
x.UpdateBy,
|
|
|
|
|
x.UpdateTime,
|
|
|
|
|
x.UpdateUserName,
|
|
|
|
|
x.Status,
|
|
|
|
|
x.StatusName,
|
|
|
|
|
x.StatusTime
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -713,6 +781,11 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
if (querySearch.OtherQueryCondition == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(querySearch.OtherQueryCondition));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
List<IConditionalModel>? whereList = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
|
|
|
|
@ -757,10 +830,11 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
case TaskBaseTypeEnum.BC:
|
|
|
|
|
{
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -848,7 +922,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -894,7 +968,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.IS_UPDATE_BOOKING,
|
|
|
|
|
bc.UPDATE_BOOKING_DATE
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
|
|
|
|
@ -902,7 +976,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskPerBillBase>((t, a, bc) => t.Id == bc.TASK_PKID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -918,7 +992,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.DONGSH_RESULT_TIME,
|
|
|
|
|
bc.DONGSH_RECV_REASON
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.TRUCK_DISPATCH:
|
|
|
|
@ -926,7 +1000,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskTruck>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -991,7 +1065,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskCutDateChangeInfo>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1002,7 +1076,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.VOYNO,
|
|
|
|
|
bc.NOTICE_DATE
|
|
|
|
|
})
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.ROLLING_NOMINATION:
|
|
|
|
@ -1011,7 +1085,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskRollingNomination>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1037,7 +1111,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskDraftInfo>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1060,7 +1134,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskPodDischargeGateoutFull>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1079,7 +1153,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskCautionNotice>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1110,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<TaskRouteChangeAdvisory>((t, a, bc) => t.Id == bc.TASK_ID);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
{
|
|
|
|
@ -1141,7 +1215,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>(t => t).ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
@ -1650,32 +1724,40 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum taskStatLevel,
|
|
|
|
|
long userId)
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum taskStatLevel,
|
|
|
|
|
string status,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.Where(whereList)
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.IS_EXCEPT == 0)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 && t.IS_EXCEPT == 0 && a.UserId == userId);
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& t.IS_EXCEPT == 0
|
|
|
|
|
&& (t.CreateBy == userId || (a.UserId == userId && (t.STATUS == status || a.Status == status))));
|
|
|
|
|
|
|
|
|
|
//.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum taskStatLevel,
|
|
|
|
|
long userId)
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum taskStatLevel,
|
|
|
|
|
string status,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.Where(whereList)
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.IS_EXCEPT == 0)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 && t.IS_EXCEPT == 0 && a.UserId == userId);
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& t.IS_EXCEPT == 0
|
|
|
|
|
&& (t.CreateBy == userId || (a.UserId == userId && (t.STATUS == status || a.Status == status))));
|
|
|
|
|
|
|
|
|
|
//.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|