diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index abd8adde..fd88788c 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -11891,6 +11891,9 @@ namespace Myshipping.Application if (string.IsNullOrWhiteSpace(model.vesselOperatorCarrierCode)) throw Oops.Oh($"服务船公司不能为空"); + if (string.IsNullOrWhiteSpace(model.carrierId)) + throw Oops.Oh("船公司代码不能为空"); + if (string.IsNullOrWhiteSpace(model.startDate)) throw Oops.Oh($"预计离港日期不能为空"); @@ -11960,7 +11963,65 @@ namespace Myshipping.Application if (resultInfo != null && resultInfo.code == 200 && resultInfo.data != null && resultInfo.data.Count > 0) { - list = resultInfo.data.Adapt>(); + resultInfo.data.ForEach(a => + { + a.transportSchedules.ForEach(b => + { + SearchShipSailingScheduleResultDto info = new SearchShipSailingScheduleResultDto + { + carrierProductId = a.carrierProductId, + carrierProductSequenceId = a.carrierProductSequenceId, + ETD = b.departureDateTime, + ATD = b.arrivalDateTime, + vesselOperatorCarrierCode = b.vesselOperatorCarrierCode + }; + + if (b.departureDateTime.HasValue && b.arrivalDateTime.HasValue) + { + TimeSpan ts = b.arrivalDateTime.Value.Subtract(b.departureDateTime.Value); + var timeDiff = ts.TotalHours; + + info.days = (int)Math.Ceiling(timeDiff / 24.0); + } + + if(b.facilities != null) + { + info.orignCityName = b.facilities.collectionOrigin?.cityName; + info.orignCarrierSiteGeoID = b.facilities.collectionOrigin?.carrierSiteGeoID; + info.orignLocationName = b.facilities.collectionOrigin?.locationName; + info.orignCountryCode = b.facilities.collectionOrigin?.countryCode; + info.orignLocationType = b.facilities.collectionOrigin?.locationType; + info.orignUNLocationCode = b.facilities.collectionOrigin?.UNLocationCode; + info.orignUNRegionCode = b.facilities.collectionOrigin?.UNRegionCode; + + info.deliveryCityName = b.facilities.deliveryDestination?.cityName; + info.deliveryCarrierSiteGeoID = b.facilities.deliveryDestination?.carrierSiteGeoID; + info.deliveryLocationName = b.facilities.deliveryDestination?.locationName; + info.deliveryCountryCode = b.facilities.deliveryDestination?.countryCode; + info.deliveryLocationType = b.facilities.deliveryDestination?.locationType; + info.deliveryUNLocationCode = b.facilities.deliveryDestination?.UNLocationCode; + info.deliveryUNRegionCode = b.facilities.deliveryDestination?.UNRegionCode; + } + + info.vesselIMONumber = b.firstDepartureVessel?.vesselIMONumber; + info.carrierVesselCode = b.firstDepartureVessel?.carrierVesselCode; + info.vesselName = b.firstDepartureVessel?.vesselName; + + if (b.transportLegs != null && b.transportLegs.Count > 0) + { + var firstTransportLegs = b.transportLegs.FirstOrDefault(); + + if (firstTransportLegs.transport != null) + { + info.transportMode = firstTransportLegs.transport.transportMode; + info.carrierDepartureVoyageNumber = firstTransportLegs.transport.carrierDepartureVoyageNumber; + } + + } + + list.Add(info); + }); + }); } } catch (Exception ex) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPISearchPoint2PointScheduleResultDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPISearchPoint2PointScheduleResultDto.cs index 05d5b8df..c6af2ea2 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPISearchPoint2PointScheduleResultDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/MSKAPI/MSKAPISearchPoint2PointScheduleResultDto.cs @@ -75,6 +75,21 @@ namespace Myshipping.Application /// public Nullable arrivalDateTime { get; set; } + /// + /// 路线相关数据 + /// + public MSKAPISearchFacilities facilities { get; set; } + + /// + /// 头程船信息 + /// + public MSKDepartureVessel firstDepartureVessel { get; set; } + + /// + /// 通过的时间,以分钟为单位 + /// + public string transitTime { get; set; } + /// /// The details for the individual schedule /// @@ -101,15 +116,7 @@ namespace Myshipping.Application /// public MSKAPISearchFacilitiesCityInfo deliveryDestination { get; set; } - /// - /// 头程船信息 - /// - public MSKDepartureVessel firstDepartureVessel { get; set; } - - /// - /// 通过的时间,以分钟为单位 - /// - public string transitTime { get; set; } + } /// diff --git a/Myshipping.Application/Service/BookingOrder/Dto/SearchShipSailingScheduleResultDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/SearchShipSailingScheduleResultDto.cs index 5d634b69..18f48fa7 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/SearchShipSailingScheduleResultDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/SearchShipSailingScheduleResultDto.cs @@ -6,7 +6,135 @@ using System.Threading.Tasks; namespace Myshipping.Application { - public class SearchShipSailingScheduleResultDto: MSKAPISearchPoint2PointScheduleResultDataDto + /// + /// 查询船期回执 + /// + public class SearchShipSailingScheduleResultDto { + /// + /// 产品id + /// + public string carrierProductId { get; set; } + + /// + /// 产品序号 + /// + public string carrierProductSequenceId { get; set; } + + /// + /// ETD + /// + public Nullable ETD { get; set; } + + /// + /// ATD + /// + public Nullable ATD { get; set; } + + /// + /// 城市名(始发地) + /// + public string orignCityName { get; set; } + + /// + /// 地点的GEO ID(始发地) + /// + public string orignCarrierSiteGeoID { get; set; } + + /// + /// 地点的名称(始发地) + /// + public string orignLocationName { get; set; } + + /// + /// 国家代码(始发地) + /// + public string orignCountryCode { get; set; } + + /// + /// 位置类型(始发地) + /// + public string orignLocationType { get; set; } + + /// + /// 五字码(始发地) + /// + public string orignUNLocationCode { get; set; } + + /// + /// 区代码(始发地) + /// + public string orignUNRegionCode { get; set; } + + /// + /// 城市名(目的地) + /// + public string deliveryCityName { get; set; } + + /// + /// 地点的GEO ID(目的地) + /// + public string deliveryCarrierSiteGeoID { get; set; } + + /// + /// 地点的名称(目的地) + /// + public string deliveryLocationName { get; set; } + + /// + /// 国家代码(目的地) + /// + public string deliveryCountryCode { get; set; } + + /// + /// 位置类型(目的地) + /// + public string deliveryLocationType { get; set; } + + /// + /// 五字码(目的地) + /// + public string deliveryUNLocationCode { get; set; } + + /// + /// 区代码(目的地) + /// + public string deliveryUNRegionCode { get; set; } + + + /// + /// IMO + /// + public string vesselIMONumber { get; set; } + + /// + /// 航次号 + /// + public string carrierVesselCode { get; set; } + + /// + /// 运输方式 + /// + public string transportMode { get; set; } + + /// + /// 船名 + /// + public string vesselName { get; set; } + + /// + /// 航次代码 + /// + public string carrierDepartureVoyageNumber { get; set; } + + /// + /// 承运人代码(MAEU, SEAU, SEJJ, MCPU, MAEI) + /// + public string vesselOperatorCarrierCode { get; set; } + + /// + /// 行程天数 + /// + public int days { get; set; } } }