From afb3837795811b9a37e433ee93924fd32abb2385 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 14 Nov 2022 10:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=B7=E6=B1=82=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=BC=95=E6=93=8E=E7=9A=84=E9=9B=86=E8=A3=85=E7=AE=B1?= =?UTF-8?q?=E5=92=8C=E8=B4=A7=E7=89=A9=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 157 +++++++++++++++++- .../RulesEngine/Dtos/OceanBookingMapper.cs | 65 ++++++++ .../RulesEngineOrderBookingContaCargoInfo.cs | 44 +++++ .../RulesEngineOrderBookingContaInfo.cs | 100 +++++++++++ .../RulesEngineOrderBookingMainInfo.cs | 5 + .../RulesEngine/RulesEngineClientService.cs | 81 ++++++++- Myshipping.Core/Myshipping.Core.xml | 34 +++- 7 files changed, 482 insertions(+), 4 deletions(-) create mode 100644 Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaCargoInfo.cs create mode 100644 Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaInfo.cs diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index b0f7835a..22a50149 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -5359,6 +5359,156 @@ 租户ID + + + 件数 + + + + + 包装 + + + + + 毛重 + + + + + 尺码 + + + + + HS编码 + + + + + 唛头 + + + + + 货描 + + + + + 备注 + + + + + 集装箱信息 + + + + + 箱型代码 + + + + + 箱型 + + + + + TEU + + + + + 箱号 + + + + + 封号 + + + + + 件数 + + + + + 包装 + + + + + 毛重 + + + + + 尺码 + + + + + 皮重 + + + + + 箱状态 + + + + + 称重方式 + + + + + 称重重量 + + + + + 称重联系人 + + + + + VGM联系公司 + + + + + VGM联系电话 + + + + + 称重日期 + + + + + VGM地址 + + + + + VGM邮箱 + + + + + 备注 + + + + + 货物明细 + + 项目代码(可以填多个,主要是标识要进行的规则过滤) @@ -6126,6 +6276,11 @@ 是否拼箱 + + + 箱信息 + + 海运订舱规则请求报文 @@ -6327,7 +6482,7 @@ 请求规则平台 - + diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs index fd41857b..e56f9395 100644 --- a/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OceanBookingMapper.cs @@ -276,6 +276,71 @@ namespace Myshipping.Application .Map(dest => dest.LaneName, src => src.LANENAME) .Map(dest => dest.FreightPayer, src => src.FREIGHTPAYER); + + config.ForType() + .Map(dest => dest.ContaType, src => src.CTNCODE) + .Map(dest => dest.ContaTypeName, src => src.CTNALL) + .Map(dest => dest.TEU, src => src.TEU) + .Map(dest => dest.ContaNo, src => src.CNTRNO) + .Map(dest => dest.SealNo, src => src.SEALNO) + .Map(dest => dest.PKGs, src => src.PKGS) + .Map(dest => dest.KindPKGs, src => src.KINDPKGS) + .Map(dest => dest.KGs, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.TareWeight, src => src.TAREWEIGHT) + .Map(dest => dest.ContaStatus, src => src.CTNSTATUS) + .Map(dest => dest.WeighType, src => src.WEIGHTYPE) + .Map(dest => dest.WeighKGs, src => src.WEIGHKGS) + .Map(dest => dest.WeighAttn, src => src.WEIGHATTN) + .Map(dest => dest.VGMConnCom, src => src.VGMCONNCOM) + .Map(dest => dest.WeighTel, src => src.WEIGHTEL) + .Map(dest => dest.WeighDate, src => src.WEIGHDATE) + .Map(dest => dest.VGMAddr, src => src.VGMADDR) + .Map(dest => dest.VGMEmail, src => src.VGMEMAIL) + .Map(dest => dest.Remark, src => src.REMARK); + + config.ForType() + .Map(dest => dest.ContaType, src => src.CTNCODE) + .Map(dest => dest.ContaTypeName, src => src.CTNALL) + .Map(dest => dest.TEU, src => src.TEU) + .Map(dest => dest.ContaNo, src => src.CNTRNO) + .Map(dest => dest.SealNo, src => src.SEALNO) + .Map(dest => dest.PKGs, src => src.PKGS) + .Map(dest => dest.KindPKGs, src => src.KINDPKGS) + .Map(dest => dest.KGs, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.TareWeight, src => src.TAREWEIGHT) + .Map(dest => dest.ContaStatus, src => src.CTNSTATUS) + .Map(dest => dest.WeighType, src => src.WEIGHTYPE) + .Map(dest => dest.WeighKGs, src => src.WEIGHKGS) + .Map(dest => dest.WeighAttn, src => src.WEIGHATTN) + .Map(dest => dest.VGMConnCom, src => src.VGMCONNCOM) + .Map(dest => dest.WeighTel, src => src.WEIGHTEL) + .Map(dest => dest.WeighDate, src => src.WEIGHDATE) + .Map(dest => dest.VGMAddr, src => src.VGMADDR) + .Map(dest => dest.VGMEmail, src => src.VGMEMAIL) + .Map(dest => dest.Remark, src => src.REMARK); + + config.ForType() + .Map(dest => dest.PKGs, src => src.PKGS) + .Map(dest => dest.KindPKGs, src => src.KINDPKGS) + .Map(dest => dest.KGs, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.HSCode, src => src.HSCODE) + .Map(dest => dest.Marks, src => src.MARKS) + .Map(dest => dest.Description, src => src.DESCRIPTION) + .Map(dest => dest.Remark, src => src.REMARK); + + + config.ForType() + .Map(dest => dest.PKGs, src => src.PKGS) + .Map(dest => dest.KindPKGs, src => src.KINDPKGS) + .Map(dest => dest.KGs, src => src.KGS) + .Map(dest => dest.CBM, src => src.CBM) + .Map(dest => dest.HSCode, src => src.HSCODE) + .Map(dest => dest.Marks, src => src.MARKS) + .Map(dest => dest.Description, src => src.DESCRIPTION) + .Map(dest => dest.Remark, src => src.REMARK); } } } diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaCargoInfo.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaCargoInfo.cs new file mode 100644 index 00000000..5303204d --- /dev/null +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaCargoInfo.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class RulesEngineOrderBookingContaCargoInfo + { + /// + /// 件数 + /// + public Nullable PKGs { get; set; } + /// + /// 包装 + /// + public string KindPKGs { get; set; } + /// + /// 毛重 + /// + public Nullable KGs { get; set; } + /// + /// 尺码 + /// + public Nullable CBM { get; set; } + /// + /// HS编码 + /// + public string HSCode { get; set; } + /// + /// 唛头 + /// + public string Marks { get; set; } + /// + /// 货描 + /// + public string Description { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + } +} diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaInfo.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaInfo.cs new file mode 100644 index 00000000..2f62b450 --- /dev/null +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingContaInfo.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 集装箱信息 + /// + public class RulesEngineOrderBookingContaInfo + { + /// + /// 箱型代码 + /// + public string ContaType { get; set; } + /// + /// 箱型 + /// + public string ContaTypeName { get; set; } + /// + /// TEU + /// + public Nullable TEU { get; set; } + /// + /// 箱号 + /// + public string ContaNo { get; set; } + /// + /// 封号 + /// + public string SealNo { get; set; } + /// + /// 件数 + /// + public Nullable PKGs { get; set; } + /// + /// 包装 + /// + public string KindPKGs { get; set; } + /// + /// 毛重 + /// + public Nullable KGs { get; set; } + /// + /// 尺码 + /// + public Nullable CBM { get; set; } + /// + /// 皮重 + /// + public Nullable TareWeight { get; set; } + /// + /// 箱状态 + /// + public string ContaStatus { get; set; } + /// + /// 称重方式 + /// + public string WeighType { get; set; } + /// + /// 称重重量 + /// + public Nullable WeighKGs { get; set; } + /// + /// 称重联系人 + /// + public string WeighAttn { get; set; } + /// + /// VGM联系公司 + /// + public string VGMConnCom { get; set; } + /// + /// VGM联系电话 + /// + public string WeighTel { get; set; } + /// + /// 称重日期 + /// + public string WeighDate { get; set; } + /// + /// VGM地址 + /// + public string VGMAddr { get; set; } + /// + /// VGM邮箱 + /// + public string VGMEmail { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 货物明细 + /// + public List CargoList { get; set; } + } +} diff --git a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs index 6e93425d..30ce29fe 100644 --- a/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs +++ b/Myshipping.Application/Service/RulesEngine/Dtos/OrderBooking/RulesEngineOrderBookingMainInfo.cs @@ -641,5 +641,10 @@ namespace Myshipping.Application /// 是否拼箱 /// public Nullable IsContaLCL { get; set; } + + /// + /// 箱信息 + /// + public List ContaList { get; set; } } } diff --git a/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs b/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs index 05622005..57395cac 100644 --- a/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs +++ b/Myshipping.Application/Service/RulesEngine/RulesEngineClientService.cs @@ -26,12 +26,19 @@ namespace Myshipping.Application public class RulesEngineClientService: IRulesEngineClientService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _bookingOrderRepository; + private readonly SqlSugarRepository _bookingOrderContaRepository; + private readonly SqlSugarRepository _bookingOrderContaCargoRepository; + /// /// /// - public RulesEngineClientService(SqlSugarRepository bookingOrderRepository) + public RulesEngineClientService(SqlSugarRepository bookingOrderRepository, + SqlSugarRepository bookingOrderContaRepository, + SqlSugarRepository bookingOrderContaCargoRepository) { _bookingOrderRepository = bookingOrderRepository; + _bookingOrderContaRepository = bookingOrderContaRepository; + _bookingOrderContaCargoRepository = bookingOrderContaCargoRepository; } @@ -40,6 +47,8 @@ namespace Myshipping.Application /// /// 海运订舱请求业务 /// 返回用户信息 + [ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)] + [HttpPost] public async Task ExcuteRulesOceanBookingByMsg(RulesEngineOrderBookingMessageInfo model) { RulesEngineExcuteResultDto result = new RulesEngineExcuteResultDto(); @@ -68,6 +77,7 @@ namespace Myshipping.Application /// /// 海运订舱主键 /// 返回用户信息 + [ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)] [HttpGet] public async Task ExcuteRulesOceanBooking(string bookingId) { @@ -113,6 +123,39 @@ namespace Myshipping.Application msgModel.Main.BusinessInfo = model.Adapt(); + var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync(); + + if (contaList.Count > 0) + { + msgModel.Main.BusinessInfo.ContaList = contaList.Adapt>(); + + 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(); + info.CargoList = currList.Adapt>(); + + return info; + } + + return l.Adapt(); + + }).ToList(); + } + else + { + msgModel.Main.BusinessInfo.ContaList = contaList.Adapt>(); + } + + } + var ruleResult = await ExcuteRulesEngine(msgModel); if(ruleResult == null) @@ -143,6 +186,7 @@ namespace Myshipping.Application /// /// 海运订舱报文类 /// 返回回执 + [ApiDescriptionSettings(LowercaseRoute = false, SplitCamelCase = false)] [HttpPost] public async Task ExcuteRulesOceanBookingByModel(BookingOrderDto model) { @@ -162,7 +206,7 @@ namespace Myshipping.Application DateTime nowDate = DateTime.Now; //var model = - + //if() // _bookingOrderRepository.AsQueryable().InSingle(bookingId); @@ -192,6 +236,39 @@ namespace Myshipping.Application msgModel.Main.BusinessInfo = model.Adapt(); + var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync(); + + if (contaList.Count > 0) + { + msgModel.Main.BusinessInfo.ContaList = contaList.Adapt>(); + + 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(); + info.CargoList = currList.Adapt>(); + + return info; + } + + return l.Adapt(); + + }).ToList(); + } + else + { + msgModel.Main.BusinessInfo.ContaList = contaList.Adapt>(); + } + + } var ruleResult = await ExcuteRulesEngine(msgModel); if (ruleResult == null) diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 612bc28b..2ab001d5 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -6645,7 +6645,7 @@ - 新增编辑船公司映射信息 + 新增编辑箱型映射信息 @@ -6653,6 +6653,21 @@ 付费方式 + + + 新增付费方式 + + + + + 获取付费映射列表信息 + + + + + 新增编辑付费映射信息 + + 模块 @@ -6734,6 +6749,23 @@ + + + 获取箱型映射 + + + + + + 付费方式 + + + + + + 付费方式映射 + + 获取库表信息