任务台补充字段,调整查询台账

usertest
zhangxiaofeng 4 months ago
parent 0748c51e1c
commit 59cd3b5229

@ -18,10 +18,16 @@ namespace DS.WMS.Core.TaskPlat.Entity
public string TASK_NO { get; set; } = null!;
/// <summary>
/// 任务类型
/// 任务类型编码
/// </summary>
[SugarColumn(ColumnDescription = "任务类型", IsNullable = true, Length = 40)]
public string? TASK_TYPE { get; set; }
[SugarColumn(ColumnDescription = "任务类型编码", IsNullable = false, Length = 40)]
public string TASK_TYPE { get; set; }
/// <summary>
/// 任务类型名称
/// </summary>
[SugarColumn(ColumnDescription = "任务类型名称", IsNullable = true, Length = 255)]
public string? TASK_TYPE_NAME { get; set; }
/// <summary>
/// 任务来源
@ -29,11 +35,17 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "任务来源", IsNullable = true, Length = 64)]
public string? TASK_SOURCE { get; set; }
/// <summary>
/// 任务来源名称
/// </summary>
[SugarColumn(ColumnDescription = "任务来源名称", IsNullable = true, Length = 64)]
public string? TASK_SOURCE_NAME { get; set; }
/// <summary>
/// 状态 Create-待处理Retransmit-已转发Complete-已完成Cancel-已取消Pending-已挂起
/// </summary>
[SugarColumn(ColumnDescription = "状态 Create-待处理Retransmit-已转发Complete-已完成Cancel-已取消Pending-已挂起", IsNullable = true, Length = 20)]
public string? STATUS { get; set; }
[SugarColumn(ColumnDescription = "状态 Create-待处理Retransmit-已转发Complete-已完成Cancel-已取消Pending-已挂起", IsNullable = false, Length = 20)]
public string STATUS { get; set; }
/// <summary>
/// 状态名称
@ -71,11 +83,11 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "外业务主键", IsNullable = true)]
public long? OUT_BS_NO { get; set; }
/// <summary>
/// 基础业务类型
/// </summary>
[SugarColumn(ColumnDescription = "基础业务类型", IsNullable = true, Length = 40)]
public string? TASK_BASE_TYPE { get; set; }
///// <summary>
///// 基础业务类型
///// </summary>
//[SugarColumn(ColumnDescription = "基础业务类型", IsNullable = true, Length = 40)]
//public string? TASK_BASE_TYPE { get; set; }
/// <summary>
/// 船公司代号

@ -273,6 +273,7 @@ namespace DS.WMS.Core.TaskPlat.Method
}
if (!File.Exists(fileFullPath))
{
logger.LogError("根据任务主键获取文件信息失败文件不存在fileFullPath={fileFullPath}", fileFullPath);
//任务主键{0} 附件下载请求失败,请确认文件是否存在
throw new Exception(
string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskFileNotExists)), taskId)

@ -41,7 +41,7 @@ namespace DS.WMS.Core.TaskPlat.Method
TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_BASE_TYPE == taskBaseTypeEnum.ToString());
.FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString());
if (taskInfo == null)
{
@ -79,7 +79,7 @@ namespace DS.WMS.Core.TaskPlat.Method
try
{
var taskId = await tenantDb.Queryable<TaskBaseInfo>()
.Where(t => t.OUT_BS_NO == bsno && t.TASK_BASE_TYPE == taskBaseTypeEnum.ToString())
.Where(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString())
.OrderByDescending(a => a.CreateTime)
.Select<long?>(t => t.Id)
.FirstAsync();
@ -180,10 +180,12 @@ namespace DS.WMS.Core.TaskPlat.Method
{
Id = SnowFlakeSingle.Instance.NextId(),
STATUS = TaskStatusEnum.Create.ToString(),
STATUS_NAME = TaskStatusEnum.Create.EnumDescription(),
IS_EXCEPT = 0,
IS_COMPLETE = 0,
MBL_NO = info.Main.MBlNo,
TASK_BASE_TYPE = info.Main.TaskType.ToString(),
TASK_TYPE = info.Main.TaskType.ToString(),
//TASK_BASE_TYPE = info.Main.TaskType.ToString(),
CARRIER_ID = info.Main.CarrierId?.Trim(),
//IS_PUBLIC = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0,
IS_PUBLIC = 1,
@ -192,7 +194,7 @@ namespace DS.WMS.Core.TaskPlat.Method
TASK_TITLE = info.Main.TaskTitle,
TASK_DESP = info.Main.TaskDesp,
TASK_SOURCE = info.Main.TaskSource.ToString(),
TASK_TYPE = info.Main.TaskType.ToString(),
TASK_SOURCE_NAME = info.Main.TaskSource.EnumDescription(),
VESSEL_VOYNO = info.Main.VesselVoyno?.Trim(),
CONTA_INFO = info.Main.ContaInfo,
TASK_REQ_USERNAME = info.Main.TaskUserName,
@ -205,6 +207,10 @@ namespace DS.WMS.Core.TaskPlat.Method
OUT_BS_NO = info.Head.BSNO,
CreateTime = DateTime.Now,
};
if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp))
{
taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription();
}
// 人员字段说明:
// TaskBaseInfo.CreateBy 创建人:谁创建的,只有一个人(可能是某个租户的管理员,因为任务可以由外部(邮件)创建,无法为每个人创建接口授权信息)
@ -273,37 +279,37 @@ namespace DS.WMS.Core.TaskPlat.Method
string attachFileType = string.Empty;
string fileCategory = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcfiles";
fileCategory = TaskFileCategoryEnum.BC.ToString();
}
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcmodifyfiles";
fileCategory = TaskFileCategoryEnum.BC_MODIFY.ToString();
}
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bccancelfiles";
fileCategory = TaskFileCategoryEnum.BC_CANCEL.ToString();
}
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "draftfiles";
fileCategory = TaskFileCategoryEnum.DRAFT.ToString();
}
else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "sisubmittedfiles";
fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString();
}
else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "advisoryfiles";
@ -333,37 +339,37 @@ namespace DS.WMS.Core.TaskPlat.Method
string attachFileType = string.Empty;
string fileCategory = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcfiles";
fileCategory = TaskFileCategoryEnum.BC.ToString();
}
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcmodifyfiles";
fileCategory = TaskFileCategoryEnum.BC_MODIFY.ToString();
}
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bccancelfiles";
fileCategory = TaskFileCategoryEnum.BC_CANCEL.ToString();
}
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "draftfiles";
fileCategory = TaskFileCategoryEnum.DRAFT.ToString();
}
else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "sisubmittedfiles";
fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString();
}
else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "advisoryfiles";
@ -402,16 +408,16 @@ namespace DS.WMS.Core.TaskPlat.Method
string fileCategory = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_TYPE)
fileCategory = TaskFileCategoryEnum.BC_NOTICE.ToString();
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_TYPE)
fileCategory = TaskFileCategoryEnum.BC_MODIFY_NOTICE.ToString();
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_TYPE)
fileCategory = TaskFileCategoryEnum.BC_CANCEL_NOTICE.ToString();
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_TYPE)
fileCategory = TaskFileCategoryEnum.DRAFT_NOTICE.ToString();
if (info.Main.FileList == null)
@ -435,26 +441,26 @@ namespace DS.WMS.Core.TaskPlat.Method
string attachFileType = string.Empty;
string fileCategory = string.Empty;
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcnoticefiles";
fileCategory = TaskFileCategoryEnum.BC_NOTICE.ToString();
}
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bcmodifynoticefiles";
fileCategory = TaskFileCategoryEnum.BC_MODIFY_NOTICE.ToString();
}
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "bccancelnoticefiles";
fileCategory = TaskFileCategoryEnum.BC_CANCEL_NOTICE.ToString();
}
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_TYPE)
{
attachFileType = "draftnoticefiles";
@ -512,12 +518,12 @@ namespace DS.WMS.Core.TaskPlat.Method
if (string.IsNullOrWhiteSpace(file.FileCategory))
{
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_TYPE)
{
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString();
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription();
}
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_TYPE)
{
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC_MODIFY.ToString();
fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.EnumDescription();
@ -712,6 +718,20 @@ namespace DS.WMS.Core.TaskPlat.Method
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
{
whereList = tenantDb.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
if (whereList != null)
{
foreach (var item in whereList)
{
if (item is ConditionalModel model)
{
if (!model.FieldName.StartsWith("t."))
{
model.FieldName = "t." + model.FieldName;
}
}
}
}
}
// 格式化参数
@ -740,7 +760,7 @@ namespace DS.WMS.Core.TaskPlat.Method
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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -820,7 +840,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.PROCESS_DATE,
bc.PRICE_CALCULATION_DATE
})
.ToQueryPageAsync(querySearch.PageCondition);
.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.SI_FEEDBACK:
@ -828,7 +848,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -882,7 +902,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -906,7 +926,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -971,7 +991,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -991,7 +1011,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1017,7 +1037,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1040,7 +1060,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1059,7 +1079,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1090,7 +1110,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, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1121,7 +1141,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId);
SetCondition(queryable, whereList, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
result = await queryable.Select<dynamic>(t => t).ToQueryPageAsync(querySearch.PageCondition);
@ -1627,28 +1647,32 @@ namespace DS.WMS.Core.TaskPlat.Method
}
/// <summary>
/// 公共设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
public void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
private void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
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);
}
/// <summary>
/// 公共设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
public void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
private void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
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);

Loading…
Cancel
Save