diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 685bf4a9..3b244bf0 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2517,9 +2517,12 @@ namespace Myshipping.Application contaModel.CTNALLCODE = currConta.MapCode; + if (string.IsNullOrWhiteSpace(conta.KINDPKGS)) + throw Oops.Oh($"集装箱包装不能为空"); + var curContaBasePkgs = basePkgsList.FirstOrDefault(p => p.Name.Equals(conta.KINDPKGS, StringComparison.OrdinalIgnoreCase)); - if (curBasePkgs == null) + if (curContaBasePkgs == null) throw Oops.Bah($"包装{conta.KINDPKGS}的基础数据代码未找到"); //EDI包装 @@ -2546,7 +2549,15 @@ namespace Myshipping.Application cargoModel.CNTRNO = contaList.FirstOrDefault(a => a.Id == cargo.CTNID.Value).CNTRNO; - var ediDetailPkgs = ediPkgsList.FirstOrDefault(x => x.Code.Equals(cargo.KINDPKGS, StringComparison.OrdinalIgnoreCase)); + if (string.IsNullOrWhiteSpace(cargo.KINDPKGS)) + throw Oops.Oh($"多品名包装不能为空"); + + var curCargoBasePkgs = basePkgsList.FirstOrDefault(p => p.Name.Equals(cargo.KINDPKGS, StringComparison.OrdinalIgnoreCase)); + + if (curCargoBasePkgs == null) + throw Oops.Bah($"包装{cargo.KINDPKGS}的基础数据代码未找到"); + + var ediDetailPkgs = ediPkgsList.FirstOrDefault(x => x.Code.Equals(curCargoBasePkgs.Code, StringComparison.OrdinalIgnoreCase)); if (ediDetailPkgs == null) throw Oops.Oh($"货明细的包装{cargo.KINDPKGS}的EDI代码未找到");