修改提单管理台账查询

dev
jianghaiqing 3 weeks ago
parent 0722c1b2de
commit 64705c1633

@ -17,15 +17,9 @@ namespace DS.WMS.Core.Op.Interface
/// 提单管理台账查询
/// </summary>
/// <param name="querySearch">查询条件</param>
/// <param name="isExport">是否导出</param>
/// <returns>返回回执</returns>
Task<DataResult<List<BLIssueManageBaseDto>>> GetPageAsync(PageRequest<BLIssueMangeQueryExtDto> querySearch);
/// <summary>
/// 获取导出数据列表
/// </summary>
/// <param name="querySearch">查询条件</param>
/// <returns>返回回执</returns>
Task<DataResult<List<BLIssueManageBaseDto>>> GetExportList(PageRequest<BLIssueMangeQueryExtDto> querySearch);
Task<DataResult<List<BLIssueManageBaseDto>>> GetPageAsync(PageRequest<BLIssueMangeQueryExtDto> querySearch, bool isExport = false);
/// <summary>
/// 打印

@ -101,8 +101,9 @@ namespace DS.WMS.Core.Op.Method
/// 提单管理台账查询
/// </summary>
/// <param name="querySearch">查询条件</param>
/// <param name="isExport">是否导出</param>
/// <returns>返回回执</returns>
public async Task<DataResult<List<BLIssueManageBaseDto>>> GetPageAsync(PageRequest<BLIssueMangeQueryExtDto> querySearch)
public async Task<DataResult<List<BLIssueManageBaseDto>>> GetPageAsync(PageRequest<BLIssueMangeQueryExtDto> querySearch,bool isExport = false)
{
/*
1
@ -118,13 +119,13 @@ namespace DS.WMS.Core.Op.Method
var eqlStatus = new string[] { "StatusModify", "ReleaseNotice", "BLModify", "CheckOut", "CheckIn", "BLSeize", "ChangeEndorse", "RejectReleaeNotice" };
var q1 = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(l => (l.IsRefund != null || l.IsRefund.Value == false)
&& (l.IsChangeETD != null || l.IsChangeETD.Value == false))
var q1 = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(l => (l.IsRefund == null || l.IsRefund.Value == false)
&& (l.IsChangeETD == null || l.IsChangeETD.Value == false))
.Select(a => new BLIssueManageBooking
{
Id = a.Id,
BillType = "M",
ParentId = null,
ParentId = 0,
MBLNO = a.MBLNO,
HBLNO = a.HBLNO,
CustomerId = a.CustomerId,
@ -153,11 +154,11 @@ namespace DS.WMS.Core.Op.Method
StlDate = a.StlDate
});
var q2 = q1.LeftJoin<SeaExportBillManage>((l, r) => l.Id == r.BusinessId)
var q2 = q1.InnerJoin<SeaExportBillManage>((l, r) => l.Id == r.BusinessId)
.Select((l, r) => new BLIssueManageBooking
{
Id = r.Id,
BillType = "M",
BillType = "H",
ParentId = l.Id,
MBLNO = r.MBLNO,
HBLNO = r.HBLNO,
@ -204,9 +205,9 @@ namespace DS.WMS.Core.Op.Method
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLSeizeQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsBLSeize == true)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.MHouseFlag)
&& otherQueryCondition.QueryTabCode.Equals("M", StringComparison.OrdinalIgnoreCase), (l, r) => l.ParentId == 0)
&& otherQueryCondition.MHouseFlag.Equals("M", StringComparison.OrdinalIgnoreCase), (l, r) => l.BillType == "M")
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.MHouseFlag)
&& otherQueryCondition.QueryTabCode.Equals("H", StringComparison.OrdinalIgnoreCase), (l, r) => l.ParentId > 0)
&& otherQueryCondition.MHouseFlag.Equals("H", StringComparison.OrdinalIgnoreCase), (l, r) => l.BillType == "H")
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLQuery.ToString(), StringComparison.OrdinalIgnoreCase)
@ -269,254 +270,11 @@ namespace DS.WMS.Core.Op.Method
query = query.Where(whereList);
}
var result = await query.ToQueryPageAsync(querySearch.PageCondition);
List<BLIssueManageBaseDto> resultList = new List<BLIssueManageBaseDto>();
if (result.Data.Count > 0)
{
int start = 1;
foreach(var data in result.Data)
{
if (data.bl != null && data.bl.Id > 0)
{
var currBl = data.bl.Adapt<BLIssueManageBaseDto>();
currBl.IssueType = data.order.IssueType;
currBl.IssueTypeCode = data.order.IssueTypeCode;
currBl.IssuePlaceId = data.order.IssuePlaceId;
currBl.IssuePlaceCode = data.order.IssuePlaceCode;
currBl.IssuePlace = data.order.IssuePlace;
currBl.LoadPortId = data.order.LoadPortId;
currBl.LoadPortCode = data.order.LoadPortCode;
currBl.LoadPort = data.order.LoadPort;
currBl.DischargePortId = data.order.DischargePortId;
currBl.DischargePortCode = data.order.DischargePortCode;
currBl.DischargePort = data.order.DischargePort;
currBl.CustomerService = data.order.CustomerService;
currBl.CustomerServiceName = data.order.CustomerServiceName;
currBl.Doc = data.order.Doc;
currBl.DocName = data.order.DocName;
currBl.MasterHBill = data.order.BillType;
currBl.MasterHBillName = data.order.BillType == "M" ? "主单" : "分单";
resultList.Add(currBl);
continue;
}
resultList.Add(new BLIssueManageBaseDto
{
Id = start,
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BusiType = BLIssueBusiTypeEnum.SeaExport.ToString(),
BusiTypeName = BLIssueBusiTypeEnum.SeaExport.GetDescription(),
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
StlDate = data.order.StlDate,
Doc = data.order.Doc,
DocName = data.order.DocName,
MasterHBill = data.order.BillType,
MasterHBillName = data.order.BillType == "M" ? "主单" : "分单",
});
start++;
}
}
return DataResult<List<BLIssueManageBaseDto>>.PageList(result.Count, resultList, MultiLanguageConst.DataQuerySuccess);
}
#endregion
#region 获取导出数据列表
/// <summary>
/// 获取导出数据列表
/// </summary>
/// <param name="querySearch">查询条件</param>
/// <returns>返回回执</returns>
public async Task<DataResult<List<BLIssueManageBaseDto>>> GetExportList(PageRequest<BLIssueMangeQueryExtDto> querySearch)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
List<IConditionalModel> whereList = null;
BLIssueMangeQueryExtDto otherQueryCondition = querySearch.OtherQueryCondition;
whereList = GetPageCondition(querySearch, out otherQueryCondition);
var eqlStatus = new string[] { "StatusModify", "ReleaseNotice", "BLModify", "CheckOut", "CheckIn", "BLSeize", "ChangeEndorse", "RejectReleaeNotice" };
var q1 = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(l => (l.IsRefund != null || l.IsRefund.Value == false)
&& (l.IsChangeETD != null || l.IsChangeETD.Value == false))
.Select(a => new BLIssueManageBooking
{
Id = a.Id,
BillType = "M",
ParentId = null,
MBLNO = a.MBLNO,
HBLNO = a.HBLNO,
CustomerId = a.CustomerId,
CustomerName = a.CustomerName,
ETD = a.ETD,
ETA = a.ETA,
CustomerService = a.CustomerService,
CustomerServiceName = a.CustomerServiceName,
DischargePortId = a.DischargePortId,
DischargePortCode = a.DischargePortCode,
DischargePort = a.DischargePort,
LoadPortId = a.LoadPortId,
LoadPortCode = a.LoadPortCode,
LoadPort = a.LoadPort,
Doc = a.Doc,
DocName = a.DocName,
IssuePlace = a.IssuePlace,
IssuePlaceId = a.IssuePlaceId,
IssueType = a.IssueType,
IssueTypeCode = a.IssueTypeCode,
Sale = a.Sale,
SaleId = a.SaleId,
Vessel = a.Vessel,
Voyno = a.Voyno,
IssuePlaceCode = a.IssuePlaceCode,
StlDate = a.StlDate
});
var q2 = q1.LeftJoin<SeaExportBillManage>((l, r) => l.Id == r.BusinessId)
.Select((l, r) => new BLIssueManageBooking
{
Id = r.Id,
BillType = "M",
ParentId = l.Id,
MBLNO = r.MBLNO,
HBLNO = r.HBLNO,
CustomerId = l.CustomerId,
CustomerName = l.CustomerName,
ETD = l.ETD,
ETA = l.ETA,
CustomerService = l.CustomerService,
CustomerServiceName = l.CustomerServiceName,
DischargePortId = r.DischargePortId,
DischargePortCode = "",
DischargePort = r.DischargePort,
LoadPortId = r.LoadPortId,
LoadPortCode = "",
LoadPort = r.LoadPort,
Doc = l.Doc,
DocName = l.DocName,
IssuePlace = r.IssuePlace,
IssuePlaceId = r.IssuePlaceId,
IssueType = r.IssueType,
IssueTypeCode = "",
Sale = l.Sale,
SaleId = l.SaleId,
Vessel = r.Vessel,
Voyno = r.Voyno,
IssuePlaceCode = "",
StlDate = null,
});
var queryBase = tenantDb.UnionAll(q1, q2);
var query = queryBase
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.CheckInQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsCheckIn == false)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.CheckOutQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsCheckIn == true)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.HasCheckOutQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsCheckOut == true)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLModifyQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsBLModify == true)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLSeizeQuery.ToString(), StringComparison.OrdinalIgnoreCase), (l, r) => r.IsBLSeize == true)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.MHouseFlag)
&& otherQueryCondition.QueryTabCode.Equals("M", StringComparison.OrdinalIgnoreCase), (l, r) => l.ParentId == 0)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.MHouseFlag)
&& otherQueryCondition.QueryTabCode.Equals("H", StringComparison.OrdinalIgnoreCase), (l, r) => l.ParentId > 0)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLQuery.ToString(), StringComparison.OrdinalIgnoreCase)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.BlNo), (l, r) => l.MBLNO.Contains(otherQueryCondition.BlNo))
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.QueryTabCode.Equals(BLQueryStatusEnum.BLQuery.ToString(), StringComparison.OrdinalIgnoreCase)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.IssueType), (l, r) => l.IssueType == otherQueryCondition.IssueType)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Vessel), (l, r) => l.Vessel == otherQueryCondition.Vessel)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Voyno), (l, r) => l.Voyno == otherQueryCondition.Voyno)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.CustomerId.HasValue, (l, r) => l.CustomerId == otherQueryCondition.CustomerId.Value)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.Doc.HasValue, (l, r) => l.Doc == otherQueryCondition.Doc.Value)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.ETDStart.HasValue, (l, r) => l.ETD >= otherQueryCondition.ETDStart)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.ETDEnd.HasValue, (l, r) => l.ETD < otherQueryCondition.ETDEnd)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.CheckInDateStart.HasValue, (l, r) => r.CheckInDate >= otherQueryCondition.CheckInDateStart)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.CheckInDateEnd.HasValue, (l, r) => r.CheckInDate < otherQueryCondition.CheckInDateEnd)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.CheckOutDateStart.HasValue, (l, r) => r.CheckOutDate >= otherQueryCondition.CheckOutDateStart)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.CheckOutDateEnd.HasValue, (l, r) => r.CheckOutDate < otherQueryCondition.CheckOutDateEnd)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& otherQueryCondition.Doc.HasValue, (l, r) => l.Doc == otherQueryCondition.Doc.Value)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Status)
&& otherQueryCondition.Status.Equals(BLIssueStatusEnum.UnCheckIn.ToString(), StringComparison.OrdinalIgnoreCase),
(l, r) => r.Id == 0)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Status)
&& otherQueryCondition.Status.Equals(BLIssueStatusEnum.CheckInUnCheckOut.ToString(), StringComparison.OrdinalIgnoreCase),
(l, r) => r.IsCheckIn == true && r.IsCheckOut == false)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Status)
&& otherQueryCondition.Status.Equals(BLIssueStatusEnum.UnCheckOut.ToString(), StringComparison.OrdinalIgnoreCase),
(l, r) => r.IsCheckOut == false)
.WhereIF(otherQueryCondition != null && !string.IsNullOrWhiteSpace(otherQueryCondition.QueryTabCode)
&& !string.IsNullOrWhiteSpace(otherQueryCondition.Status)
&& eqlStatus.Contains(otherQueryCondition.Status),
(l, r) => r.IsCheckIn == true && r.IsCheckOut == false)
.Select((l, r) => new { order = l, bl = r });
BLIssueMangeQueryExtDto otherQuery = null;
if (whereList != null)
if (isExport)
{
query = query.Where(whereList);
querySearch.PageCondition.PageSize = Int16.MaxValue;
}
querySearch.PageCondition.PageSize = Int16.MaxValue;
var result = await query.ToQueryPageAsync(querySearch.PageCondition);
List<BLIssueManageBaseDto> resultList = new List<BLIssueManageBaseDto>();
@ -525,7 +283,7 @@ namespace DS.WMS.Core.Op.Method
{
int start = 1;
foreach (var data in result.Data)
foreach(var data in result.Data)
{
if (data.bl != null && data.bl.Id > 0)
{
@ -2040,7 +1798,7 @@ namespace DS.WMS.Core.Op.Method
/// <summary>
/// 主单ID
/// </summary>
public Nullable<long> ParentId { get; set; }
public long ParentId { get; set; }
/// <summary>
/// 主提单号

@ -50,7 +50,7 @@ namespace DS.WMS.OpApi.Controllers
[Route("GetExportList")]
public async Task<DataResult<List<BLIssueManageBaseDto>>> GetExportList(PageRequest<BLIssueMangeQueryExtDto> querySearch)
{
return await _BLIssueManageService.GetExportList(querySearch);
return await _BLIssueManageService.GetPageAsync(querySearch,true);
}
#endregion

Loading…
Cancel
Save