|
|
@ -26,12 +26,19 @@ namespace Myshipping.Application
|
|
|
|
public class RulesEngineClientService: IRulesEngineClientService, IDynamicApiController, ITransient
|
|
|
|
public class RulesEngineClientService: IRulesEngineClientService, IDynamicApiController, ITransient
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public RulesEngineClientService(SqlSugarRepository<BookingOrder> bookingOrderRepository)
|
|
|
|
public RulesEngineClientService(SqlSugarRepository<BookingOrder> bookingOrderRepository,
|
|
|
|
|
|
|
|
SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
|
|
|
|
|
|
|
|
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
|
|
|
|
_bookingOrderContaRepository = bookingOrderContaRepository;
|
|
|
|
|
|
|
|
_bookingOrderContaCargoRepository = bookingOrderContaCargoRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -40,6 +47,8 @@ namespace Myshipping.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model">海运订舱请求业务</param>
|
|
|
|
/// <param name="model">海运订舱请求业务</param>
|
|
|
|
/// <returns>返回用户信息</returns>
|
|
|
|
/// <returns>返回用户信息</returns>
|
|
|
|
|
|
|
|
[ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)]
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBookingByMsg(RulesEngineOrderBookingMessageInfo model)
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBookingByMsg(RulesEngineOrderBookingMessageInfo model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RulesEngineExcuteResultDto result = new RulesEngineExcuteResultDto();
|
|
|
|
RulesEngineExcuteResultDto result = new RulesEngineExcuteResultDto();
|
|
|
@ -68,6 +77,7 @@ namespace Myshipping.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="bookingId">海运订舱主键</param>
|
|
|
|
/// <param name="bookingId">海运订舱主键</param>
|
|
|
|
/// <returns>返回用户信息</returns>
|
|
|
|
/// <returns>返回用户信息</returns>
|
|
|
|
|
|
|
|
[ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)]
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBooking(string bookingId)
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBooking(string bookingId)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -113,6 +123,39 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
|
|
|
|
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (contaList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.Adapt<List<RulesEngineOrderBookingContaInfo>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cargoList = await _bookingOrderContaCargoRepository.AsQueryable()
|
|
|
|
|
|
|
|
.Where(x=> contaList.Any(a=>a.Id == x.CTNID)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(cargoList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.GroupJoin(cargoList, l => l.Id, r => r.CTNID, (l, r) => {
|
|
|
|
|
|
|
|
var currList = r.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var info = l.Adapt<RulesEngineOrderBookingContaInfo>();
|
|
|
|
|
|
|
|
info.CargoList = currList.Adapt<List<RulesEngineOrderBookingContaCargoInfo>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return l.Adapt<RulesEngineOrderBookingContaInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.Adapt<List<RulesEngineOrderBookingContaInfo>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var ruleResult = await ExcuteRulesEngine(msgModel);
|
|
|
|
var ruleResult = await ExcuteRulesEngine(msgModel);
|
|
|
|
|
|
|
|
|
|
|
|
if(ruleResult == null)
|
|
|
|
if(ruleResult == null)
|
|
|
@ -143,6 +186,7 @@ namespace Myshipping.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model">海运订舱报文类</param>
|
|
|
|
/// <param name="model">海运订舱报文类</param>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
[ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)]
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBookingByModel(BookingOrderDto model)
|
|
|
|
public async Task<RulesEngineExcuteResultDto> ExcuteRulesOceanBookingByModel(BookingOrderDto model)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -162,7 +206,7 @@ namespace Myshipping.Application
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
DateTime nowDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
//var model =
|
|
|
|
//var model =
|
|
|
|
|
|
|
|
|
|
|
|
//if()
|
|
|
|
//if()
|
|
|
|
// _bookingOrderRepository.AsQueryable().InSingle(bookingId);
|
|
|
|
// _bookingOrderRepository.AsQueryable().InSingle(bookingId);
|
|
|
|
|
|
|
|
|
|
|
@ -192,6 +236,39 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
|
|
|
|
msgModel.Main.BusinessInfo = model.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (contaList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.Adapt<List<RulesEngineOrderBookingContaInfo>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cargoList = await _bookingOrderContaCargoRepository.AsQueryable()
|
|
|
|
|
|
|
|
.Where(x => contaList.Any(a => a.Id == x.CTNID)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cargoList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.GroupJoin(cargoList, l => l.Id, r => r.CTNID, (l, r) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var currList = r.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var info = l.Adapt<RulesEngineOrderBookingContaInfo>();
|
|
|
|
|
|
|
|
info.CargoList = currList.Adapt<List<RulesEngineOrderBookingContaCargoInfo>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return l.Adapt<RulesEngineOrderBookingContaInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msgModel.Main.BusinessInfo.ContaList = contaList.Adapt<List<RulesEngineOrderBookingContaInfo>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
var ruleResult = await ExcuteRulesEngine(msgModel);
|
|
|
|
var ruleResult = await ExcuteRulesEngine(msgModel);
|
|
|
|
|
|
|
|
|
|
|
|
if (ruleResult == null)
|
|
|
|
if (ruleResult == null)
|
|
|
|