diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index a2ee5649..a7623c05 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1600,7 +1600,12 @@ namespace Myshipping.Application var t = list.Union(config).OrderBy(x => x.Sort).DistinctBy(x => x.StatusName).ToList(); if (t != null) { - var StatusName = t.OrderByDescending(x => x.FinishTime).Select(x => x.StatusName).First(); + var StatusName = t.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.FinishTime).Select(x => x.StatusName).FirstOrDefault(); + if (StatusName == null) + { + StatusName = ""; + } + order.BSSTATUSNAME = StatusName; await _rep.AsUpdateable(order).IgnoreColumns(it => new