新增订舱的检索功能

master
jianghaiqing 4 months ago
parent bb4a57ce84
commit 15c46a750d

@ -13542,5 +13542,92 @@ namespace Myshipping.Application
return rlt;
}
#endregion
#region 检索订单信息
/// <summary>
/// 检索订单信息(如果当前为拆、合票,内包含分票信息)
/// </summary>
/// <param name="mblNo">提单号</param>
/// <returns></returns>
public async Task<SeaExportOrderExtension> SearchOrderInfo(string mblNo)
{
SeaExportOrderExtension model = new SeaExportOrderExtension();
/*
1
2
3
*/
var orderList = await _rep.AsQueryable().Filter(null, true)
.Where(a => (a.MBLNO == mblNo || a.CUSTNO == mblNo) && a.IsDeleted == false).ToListAsync();
var currOrder = orderList.FirstOrDefault(a => a.MBLNO == mblNo);
if (currOrder != null)
{
model.currOrder = currOrder.Adapt<BookingOrderDto>();
model.splitOrMergeFlag = currOrder.SPLIT_OR_MERGE_FLAG.HasValue ? currOrder.SPLIT_OR_MERGE_FLAG.Value : 0;
if (!currOrder.SPLIT_OR_MERGE_FLAG.HasValue || (currOrder.SPLIT_OR_MERGE_FLAG.HasValue && currOrder.SPLIT_OR_MERGE_FLAG.Value > 0))
{
//拆票
if (currOrder.SPLIT_OR_MERGE_FLAG.Value == 1)
{
//如果分单号和订舱编号不一致表示分票已经改成正式的提单号
if (!currOrder.HBLNO.Equals(currOrder.CUSTNO))
{
model.finalMBLNo = currOrder.HBLNO;
}
model.orderNo = currOrder.CUSTNO;
//找到所有相关的分票
var list = await _rep.AsQueryable().Filter(null, true)
.Where(a => a.CUSTNO == mblNo && a.IsDeleted == false && a.Id != currOrder.Id).ToListAsync();
model.otherOrderList = list.Select(b => new SeaExportOrderExtensionSubInfo
{
Id = b.Id,
OrderNo = b.CUSTNO,
MBLNO = b.MBLNO,
HBLNO = b.HBLNO
}).ToList();
}
else if (currOrder.SPLIT_OR_MERGE_FLAG.Value == 2)
{
//合票
if (currOrder.CUSTNO.Equals(currOrder.HBLNO))
{
//如果订舱编号和分单号一致,表示当前为主合票信息
model.isMaster = true;
model.masterId = currOrder.Id;
model.orderNo = currOrder.MBLNO;
}
//找到所有相关的分票
var list = await _rep.AsQueryable().Filter(null, true)
.Where(a => a.HBLNO == currOrder.HBLNO && a.IsDeleted == false && a.Id != currOrder.Id).ToListAsync();
model.otherOrderList = list.Select(b => new SeaExportOrderExtensionSubInfo
{
Id = b.Id,
OrderNo = b.CUSTNO,
MBLNO = b.MBLNO,
HBLNO = b.HBLNO
}).ToList();
var masterOrder = model.otherOrderList.FirstOrDefault(x => x.OrderNo == x.HBLNO);
if (masterOrder != null)
{
model.masterId = masterOrder.Id;
model.orderNo = masterOrder.OrderNo;
}
}
}
}
return model;
}
#endregion
}
}

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
/// <summary>
/// 检索海运订单
/// </summary>
public class SeaExportOrderExtension
{
/// <summary>
/// 当前订单
/// </summary>
public BookingOrderDto currOrder { get; set; }
/// <summary>
/// 是否主票 true-主票;false-分票
/// </summary>
public bool isMaster { get; set; }
/// <summary>
/// 拆票或合票标志 1-拆票 2-合票
/// </summary>
public int splitOrMergeFlag { get; set; }
/// <summary>
/// 主票主键
/// </summary>
public long masterId { get; set; }
/// <summary>
/// 主票订舱编号
/// </summary>
public string orderNo { get; set; }
/// <summary>
/// 最终提单号(拆票后最终提单号)
/// </summary>
public string finalMBLNo { get; set; }
/// <summary>
/// 分票订单信息
/// </summary>
public List<SeaExportOrderExtensionSubInfo> otherOrderList { get; set; }
}
/// <summary>
/// 分单号详情
/// </summary>
public class SeaExportOrderExtensionSubInfo
{
/// <summary>
/// 海运订单主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// Desc:订舱编号
/// </summary>
public string OrderNo { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string HBLNO { get; set; }
}
}

@ -163,5 +163,12 @@ namespace Myshipping.Application
/// <param name="model">舱位拆票或者合票请求</param>
/// <returns>返回舱位拆票或者合票结果</returns>
Task<BookingSlotMergeOrSplitResultDto> GetBookingSlotMergeOrSplitResult(BookingSlotMergeOrSplitRequestDto model);
/// <summary>
/// 检索订单信息(如果当前为拆、合票,内包含分票信息)
/// </summary>
/// <param name="mblNo">提单号</param>
/// <returns></returns>
Task<SeaExportOrderExtension> SearchOrderInfo(string mblNo);
}
}
Loading…
Cancel
Save