diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs index 113347b4..b29108ff 100644 --- a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs @@ -109,7 +109,10 @@ namespace Myshipping.Application entity.State = "已录入"; if (input.Id == 0) { - entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(entity.CARRIERID)) { + entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); + } + await _seaeedi.InsertAsync(entity); if (input.EdiCtn != null) { @@ -129,7 +132,10 @@ namespace Myshipping.Application } else { - entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(entity.CARRIERID)) + { + entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); + } await _seaeedi.AsUpdateable(entity).IgnoreColumns(it => new { it.MBLNO,