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

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

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

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

Loading…
Cancel
Save