diff --git a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs index d2869dd8..c22e696c 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingMSKSPOTAPIService.cs @@ -726,7 +726,7 @@ namespace Myshipping.Application.Service.BookingOrder bookingDto.bookingBody.transport = new MSKAPIBookingTransport { carrierCode = model.carrierCode, - earliestDepartureDate = model.earliestDepartureDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"), + //earliestDepartureDate = model.earliestDepartureDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"), exportServiceMode = model.exportServiceMode, importServiceMode = model.importServiceMode, routeDetails = new MSKAPIBookingRouteDetails @@ -748,7 +748,22 @@ namespace Myshipping.Application.Service.BookingOrder } }; - for(int i=0;i< selectedShipSchedule.scheduleDetails.Count;i++) + //ETD + if (!string.IsNullOrWhiteSpace(selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.date)) + { + DateTime currDate = DateTime.MinValue; + + if (DateTime.TryParse($"{selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.date} {selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.time}", out currDate)) + { + bookingDto.bookingBody.transport.earliestDepartureDate = currDate.ToString("yyyy-MM-ddTHH:mm:ss"); + } + else + { + throw Oops.Bah($"查询船期错误,priceID={model.priceID} pid={model.PId} 预计离港日期departureDate={selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.date} {selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.time} 格式解析错误"); + } + } + + for (int i=0;i< selectedShipSchedule.scheduleDetails.Count;i++) { var detail = selectedShipSchedule.scheduleDetails[i]; @@ -768,7 +783,7 @@ namespace Myshipping.Application.Service.BookingOrder } } - //ETD + //ETA if (!string.IsNullOrWhiteSpace(detail.toLocation.date)) { DateTime currDate = DateTime.MinValue;