|
|
|
@ -9,6 +9,7 @@ using DS.Module.DjyServiceStatus;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Code.Dtos;
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
|
using DS.WMS.Core.Map.Dtos;
|
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
@ -37,6 +38,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
private readonly ICodePortService codePortService;
|
|
|
|
|
private readonly IMappingPortService mappingPortService;
|
|
|
|
|
private readonly IMappingCarrierService mappingCarrierService;
|
|
|
|
|
private readonly ICodeCarrierService codeCarrierService;
|
|
|
|
|
|
|
|
|
|
// 按需构建
|
|
|
|
|
//private readonly Lazy<ISeaExportCommonService> seaExportCommonService;
|
|
|
|
@ -46,6 +48,11 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static DateTime LastMatchTaskTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 需要查海运出口表的小写字段名
|
|
|
|
|
/// </summary>
|
|
|
|
|
static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code"
|
|
|
|
|
|
|
|
|
|
public TaskManageService(IUser user,
|
|
|
|
|
ILogger<TaskManageService> logger,
|
|
|
|
|
ISaasDbService saasDbService,
|
|
|
|
@ -54,12 +61,14 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
ICodeCtnService codeCtnService,
|
|
|
|
|
ICodePortService codePortService,
|
|
|
|
|
IMappingPortService mappingPortService,
|
|
|
|
|
IMappingCarrierService mappingCarrierService) : base(user, logger, saasDbService, serviceProvider, environment)
|
|
|
|
|
IMappingCarrierService mappingCarrierService,
|
|
|
|
|
ICodeCarrierService codeCarrierService) : base(user, logger, saasDbService, serviceProvider, environment)
|
|
|
|
|
{
|
|
|
|
|
this.codeCtnService = codeCtnService;
|
|
|
|
|
this.codePortService = codePortService;
|
|
|
|
|
this.mappingPortService = mappingPortService;
|
|
|
|
|
this.mappingCarrierService = mappingCarrierService;
|
|
|
|
|
this.codeCarrierService = codeCarrierService;
|
|
|
|
|
|
|
|
|
|
//seaExportCommonService = new Lazy<ISeaExportCommonService>(serviceProvider.GetRequiredService<ISeaExportCommonService>);
|
|
|
|
|
}
|
|
|
|
@ -325,7 +334,22 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
BATCH_STATIC = info.Main.BatchStatic,
|
|
|
|
|
//DJYUserId = info.Head.DJYUserId,
|
|
|
|
|
OUT_BS_NO = info.Head.BSNO,
|
|
|
|
|
CUSTOMER_NO = info.Main.CUSTOMER_NO,
|
|
|
|
|
CUSTOMER_NO = info.Main.CustomerNo,
|
|
|
|
|
//CUSTOMER_NUM = info.Main.CustomsNum,
|
|
|
|
|
//HBL_NO = info.Main.HBLNO,
|
|
|
|
|
//BOOKING_NO = info.Main.BookingNo,
|
|
|
|
|
|
|
|
|
|
//PORTDISCHARGE = info.Main.PortDischarge,
|
|
|
|
|
//PORTDISCHARGE_CODE = info.Main.PortDischargeCode,
|
|
|
|
|
//PORTDISCHARGE_ID = info.Main.PortDischargeId,
|
|
|
|
|
//PORTLOAD = info.Main.PortLoad,
|
|
|
|
|
//PORTLOAD_ID = info.Main.PortLoadId,
|
|
|
|
|
//PORTLOAD_CODE = info.Main.PortLoadCode,
|
|
|
|
|
|
|
|
|
|
CARRIER_ID = info.Main.CarrierPK,
|
|
|
|
|
CARRIER_CODE = info.Main.CarrierId,
|
|
|
|
|
CARRIER_NAME = info.Main.CarrierName,
|
|
|
|
|
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
};
|
|
|
|
|
if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp))
|
|
|
|
@ -333,24 +357,29 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果船公司主键不为空,则直接保存船公司主键、Code、Name等信息
|
|
|
|
|
if (info.Main.CarrierPK != null)
|
|
|
|
|
// 如果船公司主键不为空,则直接保存船公司主键、Code、Name等信息(如果Name为空,查询一下再赋值)
|
|
|
|
|
if (taskInfo.CARRIER_ID != null)
|
|
|
|
|
{
|
|
|
|
|
taskInfo.CARRIER_ID = info.Main.CarrierPK;
|
|
|
|
|
taskInfo.CARRIER_CODE = info.Main.CarrierId;
|
|
|
|
|
taskInfo.CARRIER_NAME = info.Main.CarrierName;
|
|
|
|
|
if (string.IsNullOrEmpty(taskInfo.CARRIER_NAME))
|
|
|
|
|
{
|
|
|
|
|
var carrierShortName = await tenantDb.Queryable<CodeCarrier>().Where(x => x.Id == taskInfo.CARRIER_ID).Select(x => x.CnShortName).FirstAsync();
|
|
|
|
|
taskInfo.CARRIER_NAME = carrierShortName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 如果船公司主键为空,但是Code不为空,则通过映射查出船公司信息并保存
|
|
|
|
|
else if (!string.IsNullOrEmpty(info.Main.CarrierId))
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 船公司转换
|
|
|
|
|
var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List<MappingCarrierRes>();
|
|
|
|
|
MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(info.Main.CarrierId, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault();
|
|
|
|
|
if (carrierInfo != null)
|
|
|
|
|
// 如果船公司主键为空,但是Code不为空,则通过映射查出船公司信息并保存
|
|
|
|
|
if (!string.IsNullOrEmpty(taskInfo.CARRIER_CODE))
|
|
|
|
|
{
|
|
|
|
|
taskInfo.CARRIER_ID = carrierInfo.LinkId;
|
|
|
|
|
taskInfo.CARRIER_CODE = carrierInfo.MapCode;
|
|
|
|
|
taskInfo.CARRIER_NAME = carrierInfo.MapName;
|
|
|
|
|
// 船公司转换
|
|
|
|
|
var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List<MappingCarrierRes>();
|
|
|
|
|
MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(taskInfo.CARRIER_CODE, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault();
|
|
|
|
|
if (carrierInfo != null)
|
|
|
|
|
{
|
|
|
|
|
taskInfo.CARRIER_ID = carrierInfo.LinkId;
|
|
|
|
|
taskInfo.CARRIER_CODE = carrierInfo.MapCode;
|
|
|
|
|
taskInfo.CARRIER_NAME = carrierInfo.MapName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1703,7 +1732,12 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
if (item is ConditionalModel model)
|
|
|
|
|
{
|
|
|
|
|
if (!model.FieldName.StartsWith("t."))
|
|
|
|
|
string lowerFieldName = model.FieldName.ToLower();
|
|
|
|
|
if (seaExportFields.Contains(lowerFieldName))
|
|
|
|
|
{
|
|
|
|
|
model.FieldName = "s." + model.FieldName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
model.FieldName = "t." + model.FieldName;
|
|
|
|
|
}
|
|
|
|
@ -1735,17 +1769,41 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
switch (taskType)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
// POL、POD关联查询
|
|
|
|
|
queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortLoadCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE || querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE);
|
|
|
|
|
queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortDischargeCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE || querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
|
|
|
|
|
bc.BUSI_TYPE,
|
|
|
|
|
bc.SHIPPER,
|
|
|
|
|
bc.CONSIGNEE,
|
|
|
|
@ -1820,22 +1878,41 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.PROCESS_RESULT,
|
|
|
|
|
bc.PROCESS_DATE,
|
|
|
|
|
bc.PRICE_CALCULATION_DATE
|
|
|
|
|
})
|
|
|
|
|
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
}).Distinct();
|
|
|
|
|
var sql = queryableTemp.ToSqlString();
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
//var sql = queryable.ToSqlString();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TaskBaseTypeEnum.SI_FEEDBACK:
|
|
|
|
|
{
|
|
|
|
|
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, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.TAKE_ISSUETYPE_NAME,
|
|
|
|
@ -1876,20 +1953,41 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.DIFF_NUM,
|
|
|
|
|
bc.IS_UPDATE_BOOKING,
|
|
|
|
|
bc.UPDATE_BOOKING_DATE
|
|
|
|
|
})
|
|
|
|
|
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
}).Distinct();
|
|
|
|
|
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
|
|
|
|
|
bc.TASK_PKID,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
|
bc.INVOICE_NO,
|
|
|
|
@ -1900,20 +1998,38 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.DONGSH_RECV_TIME,
|
|
|
|
|
bc.DONGSH_RESULT_TIME,
|
|
|
|
|
bc.DONGSH_RECV_REASON
|
|
|
|
|
})
|
|
|
|
|
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
}).Distinct();
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.TRUCK_DISPATCH:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
//s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.BookingTruckId,
|
|
|
|
|
bc.BookingId,
|
|
|
|
@ -1965,20 +2081,38 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
bc.MBLNo,
|
|
|
|
|
bc.CntrTotal,
|
|
|
|
|
bc.FactoryAddr
|
|
|
|
|
})
|
|
|
|
|
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
}).Distinct();
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case TaskBaseTypeEnum.CUT_MODIFY:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.VESSEL,
|
|
|
|
@ -1992,13 +2126,31 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
case TaskBaseTypeEnum.TRANSFER_NOMINATION:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.PLAN_TYPE,
|
|
|
|
|
bc.BATCH_NO,
|
|
|
|
@ -2017,13 +2169,31 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
case TaskBaseTypeEnum.DRAFT:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
//bc.MBL_NO,
|
|
|
|
@ -2039,13 +2209,31 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
case TaskBaseTypeEnum.POD_GATEOUT_FULL:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.CARRIER,
|
|
|
|
|
bc.NOTICE_TYPE,
|
|
|
|
@ -2058,13 +2246,32 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
case TaskBaseTypeEnum.CAUTION_NOTICE:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.SOURCE_SYSTEM,
|
|
|
|
|
bc.SOURCE_BUSI_TYPE,
|
|
|
|
@ -2089,13 +2296,31 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
case TaskBaseTypeEnum.ROUTE_CUT_CHANGE:
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc) => new
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a, bc, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
bc.TASK_ID,
|
|
|
|
|
bc.VESSEL,
|
|
|
|
|
bc.VOYNO,
|
|
|
|
@ -2118,19 +2343,43 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}).Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
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<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
|
|
|
|
|
|
|
|
|
|
result = await queryable.Select<dynamic>((t, a) => new
|
|
|
|
|
var queryableTemp = queryable.Select<dynamic>((t, a, s) => new
|
|
|
|
|
{
|
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
|
s.CustomerNo,
|
|
|
|
|
s.CustomerNum,
|
|
|
|
|
s.BookingNo,
|
|
|
|
|
s.HBLNO,
|
|
|
|
|
|
|
|
|
|
s.CustomerName,
|
|
|
|
|
s.Sale,
|
|
|
|
|
s.CustomerServiceName,
|
|
|
|
|
s.OperatorName,
|
|
|
|
|
|
|
|
|
|
s.LoadPortCode,
|
|
|
|
|
s.LoadPort,
|
|
|
|
|
s.DischargePortCode,
|
|
|
|
|
s.DischargePort,
|
|
|
|
|
|
|
|
|
|
s.CntrTotal,
|
|
|
|
|
|
|
|
|
|
//TASK_USER_STATUS = a.Status,
|
|
|
|
|
//TASK_USER_STATUS_NAME = a.StatusName,
|
|
|
|
|
//TASK_USER_STATUS_TIME = a.StatusTime
|
|
|
|
|
}).Distinct().ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
}).Distinct();
|
|
|
|
|
|
|
|
|
|
var sql = queryableTemp.ToSqlString();
|
|
|
|
|
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -2140,6 +2389,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
// 查询任务接收人列表
|
|
|
|
|
var taskIdList = result.Data.Select(x => (long)x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
var allRecvUserList = await tenantDb.Queryable<TaskBaseAllocation>()
|
|
|
|
@ -2181,11 +2431,89 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static async Task SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T, SeaExport> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum? taskStatLevel,
|
|
|
|
|
QueryTaskManageDto queryDto,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.ClearFilter(typeof(IOrgId));
|
|
|
|
|
var taskTypeStr = taskType.ToString();
|
|
|
|
|
|
|
|
|
|
long? parentId = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.BusinessNo))
|
|
|
|
|
{
|
|
|
|
|
var parentIdTemp = await queryable.Context.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync();
|
|
|
|
|
parentId = parentIdTemp == 0 ? null : parentIdTemp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
queryable.Where(whereList)
|
|
|
|
|
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, bc, s) => queryDto.BusinessNo == t.MBL_NO
|
|
|
|
|
|| queryDto.BusinessNo == s.MBLNO
|
|
|
|
|
|| queryDto.BusinessNo == s.CustomerNo
|
|
|
|
|
|| queryDto.BusinessNo == s.BookingNo
|
|
|
|
|
|| queryDto.BusinessNo == s.CustomerNum
|
|
|
|
|
|| (parentId != null && s.Id == parentId))
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
&& a.Status == queryDto.Status)
|
|
|
|
|
.OrderByDescending(t => t.Id);
|
|
|
|
|
|
|
|
|
|
var sql = queryable.ToSqlString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static async Task SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, SeaExport> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum? taskStatLevel,
|
|
|
|
|
QueryTaskManageDto queryDto,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.ClearFilter(typeof(IOrgId));
|
|
|
|
|
long? parentId = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.BusinessNo))
|
|
|
|
|
{
|
|
|
|
|
var parentIdTemp = await queryable.Context.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync();
|
|
|
|
|
parentId = parentIdTemp == 0 ? null : parentIdTemp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
queryable.Where(whereList)
|
|
|
|
|
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO
|
|
|
|
|
|| queryDto.BusinessNo == s.MBLNO
|
|
|
|
|
|| queryDto.BusinessNo == s.CustomerNo
|
|
|
|
|
|| queryDto.BusinessNo == s.CustomerNum
|
|
|
|
|
|| queryDto.BusinessNo == s.BookingNo
|
|
|
|
|
|| (parentId != null && s.Id == parentId))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.PortLoadCode), (t, a, s) => queryDto.PortLoadCode == s.LoadPortCode)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.PortDischargeCode), (t, a, s) => queryDto.PortDischargeCode == s.DischargePortCode)
|
|
|
|
|
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
&& a.Status == queryDto.Status)
|
|
|
|
|
.OrderByDescending(t => t.Id);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取登陆人相关的任务统计信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch)
|
|
|
|
|
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto queryDto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
|
|
|
|
@ -2214,9 +2542,9 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
List<IConditionalModel>? whereList = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.QueryCondition))
|
|
|
|
|
{
|
|
|
|
|
whereList = tenantDb.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
|
|
|
|
|
whereList = tenantDb.Utilities.JsonToConditionalModels(queryDto.QueryCondition);
|
|
|
|
|
|
|
|
|
|
if (whereList != null)
|
|
|
|
|
{
|
|
|
|
@ -2224,7 +2552,12 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
if (item is ConditionalModel model)
|
|
|
|
|
{
|
|
|
|
|
if (!model.FieldName.StartsWith("t."))
|
|
|
|
|
string lowerFieldName = model.FieldName.ToLower();
|
|
|
|
|
if (seaExportFields.Contains(lowerFieldName))
|
|
|
|
|
{
|
|
|
|
|
model.FieldName = "s." + model.FieldName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
model.FieldName = "t." + model.FieldName;
|
|
|
|
|
}
|
|
|
|
@ -2234,14 +2567,53 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
var cancelStr = TaskStatusEnum.Cancel.ToString();
|
|
|
|
|
long? parentId = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo))
|
|
|
|
|
{
|
|
|
|
|
var parentIdTemp = await tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.OtherQueryCondition.BusinessNo).Select(x => x.ParentId).FirstAsync();
|
|
|
|
|
parentId = parentIdTemp == 0 ? null : parentIdTemp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long[]? portLoadTaskIdList = [];
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode))
|
|
|
|
|
{
|
|
|
|
|
var q1 = tenantDb.Queryable<TaskBCInfo>().Where(x => x.PORTLOAD_CODE == queryDto.OtherQueryCondition.PortLoadCode).Select(x => new { x.TASK_ID });
|
|
|
|
|
var temp = await q1.ToListAsync();
|
|
|
|
|
if (temp.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long[]? portDischargeTaskIdList = [];
|
|
|
|
|
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode))
|
|
|
|
|
{
|
|
|
|
|
var q1 = tenantDb.Queryable<TaskBCInfo>().Where(x => x.PORTDISCHARGE_CODE == queryDto.OtherQueryCondition.PortDischargeCode).Select(x => new { x.TASK_ID });
|
|
|
|
|
var temp = await q1.ToListAsync();
|
|
|
|
|
if (temp.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//任务列表分组统计
|
|
|
|
|
var groupList = await tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
var queryable = tenantDb.Queryable<TaskBaseInfo>()
|
|
|
|
|
.ClearFilter(typeof(IOrgId))
|
|
|
|
|
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
|
|
|
|
|
.LeftJoin<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
|
|
|
|
|
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(querySearch.BusinessNo), (t, a) => t.MBL_NO == querySearch.BusinessNo || t.CUSTOMER_NO == querySearch.BusinessNo)
|
|
|
|
|
.Where((t, a) => t.STATUS != cancelStr)
|
|
|
|
|
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), (t, a, s) => queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO
|
|
|
|
|
|| queryDto.OtherQueryCondition.BusinessNo == s.MBLNO
|
|
|
|
|
|| queryDto.OtherQueryCondition.BusinessNo == s.CustomerNo
|
|
|
|
|
|| queryDto.OtherQueryCondition.BusinessNo == s.BookingNo
|
|
|
|
|
|| queryDto.OtherQueryCondition.BusinessNo == s.CustomerNum
|
|
|
|
|
|| (parentId != null && s.Id == parentId))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode), (t, a, s) => queryDto.OtherQueryCondition.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode), (t, a, s) => queryDto.OtherQueryCondition.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id))
|
|
|
|
|
|
|
|
|
|
.GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC })
|
|
|
|
|
.Select((t, a) => new
|
|
|
|
|
{
|
|
|
|
@ -2251,7 +2623,10 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
AStatus = a.Status,
|
|
|
|
|
//IsExcept = t.IS_EXCEPT,
|
|
|
|
|
IsPublic = t.IS_PUBLIC
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
});
|
|
|
|
|
var sql = queryable.ToSqlString();
|
|
|
|
|
var groupList = await queryable.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var exceptList = groupList
|
|
|
|
@ -2696,49 +3071,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
return DataResult<TaskManageOrderResultDto>.Success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum? taskStatLevel,
|
|
|
|
|
QueryTaskManageDto queryTaskManageDto,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.ClearFilter(typeof(IOrgId))
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
&& a.Status == queryTaskManageDto.Status)
|
|
|
|
|
.OrderByDescending(t => t.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
|
|
|
|
|
List<IConditionalModel>? whereList,
|
|
|
|
|
TaskBaseTypeEnum? taskType,
|
|
|
|
|
TaskStatLevelEnum? taskStatLevel,
|
|
|
|
|
QueryTaskManageDto queryTaskManageDto,
|
|
|
|
|
long userId)
|
|
|
|
|
{
|
|
|
|
|
queryable.ClearFilter(typeof(IOrgId))
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
|
|
|
|
|
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status)
|
|
|
|
|
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
|
|
|
|
|
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId ||
|
|
|
|
|
&& a.Status == queryTaskManageDto.Status)
|
|
|
|
|
.OrderByDescending(t => t.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|