From 60fab066b2f46851d94c04f982f0c2a50c5054be Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 4 Jul 2024 19:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9MSK=20SPOT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingMSKSPOTAPIService.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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;