修改MSK API

master
jianghaiqing 5 months ago
parent 884004e346
commit d1a36940d4

@ -686,6 +686,120 @@ namespace Myshipping.Application.Service.BookingOrder
// bookingDto.bookingBody.transport.routeDetails.selectedRoute.routeScheduleId = model.carrierProductId;
//}
for (int i = 0; i < selectedShipSchedule.transportLegs.Count; i++)
{
var detail = selectedShipSchedule.transportLegs[i];
var currDto = new MSKAPIBookingSchedules();
//ETD
if (detail.departureDateTime.HasValue)
{
currDto.originDepartureDateTimeLocal = detail.departureDateTime.Value.ToString("yyyy-MM-ddTHH:mm:ss");
}
else
{
throw Oops.Bah($"查询船期错误pid={model.PId} 预计离港日期departureDate 格式解析错误");
}
//ETA
if (detail.arrivalDateTime.HasValue)
{
currDto.destinationArrivalDateTimeLocal = detail.arrivalDateTime.Value.ToString("yyyy-MM-ddTHH:mm:ss");
}
else
{
throw Oops.Bah($"查询船期错误pid={model.PId} 预计到港日期arrivalDateTime 格式解析错误");
}
currDto.transportMode = new MSKAPIBookingTransportMode
{
vessel = new MSKAPIBookingTransportModeVessel
{
name = detail.transport.vessel.vesselName,
maerskVesselCode = detail.transport.vessel.carrierVesselCode,
vesselIMONumber = detail.transport.vessel.vesselIMONumber
},
exportVoyageNumber = detail.transport.carrierDepartureVoyageNumber,
};
currDto.serviceCode = detail.transport.carrierServiceCode;
currDto.transportModeCode = detail.transport.transportMode;
//首个
if (i == 0)
{
currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.startLocation.cityName,
ISOcountryCode = detail.facilities.startLocation.countryCode,
UNLocationCode = detail.facilities.startLocation.UNLocationCode,
maerskCityGeoId = selectedShipSchedule.originGeoId,
};
if (i == selectedShipSchedule.transportLegs.Count - 1)
{
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.endLocation.cityName,
ISOcountryCode = detail.facilities.endLocation.countryCode,
UNLocationCode = detail.facilities.endLocation.UNLocationCode,
maerskCityGeoId = selectedShipSchedule.destinationGeoId,
};
}
else
{
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.endLocation.cityName,
ISOcountryCode = detail.facilities.endLocation.countryCode,
UNLocationCode = detail.facilities.endLocation.UNLocationCode,
maerskSiteGeoId = detail.facilities.endLocation.carrierSiteGeoID,
};
}
}
else if (i == selectedShipSchedule.transportLegs.Count - 1)
{
currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.startLocation.cityName,
ISOcountryCode = detail.facilities.startLocation.countryCode,
UNLocationCode = detail.facilities.startLocation.UNLocationCode,
maerskSiteGeoId = detail.facilities.startLocation.carrierSiteGeoID,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.endLocation.cityName,
ISOcountryCode = detail.facilities.endLocation.countryCode,
UNLocationCode = detail.facilities.endLocation.UNLocationCode,
maerskCityGeoId = selectedShipSchedule.destinationGeoId,
};
}
else
{
currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.startLocation.cityName,
ISOcountryCode = detail.facilities.startLocation.countryCode,
UNLocationCode = detail.facilities.startLocation.UNLocationCode,
maerskSiteGeoId = detail.facilities.startLocation.carrierSiteGeoID,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.facilities.endLocation.cityName,
ISOcountryCode = detail.facilities.endLocation.countryCode,
UNLocationCode = detail.facilities.endLocation.UNLocationCode,
maerskSiteGeoId = detail.facilities.endLocation.carrierSiteGeoID,
};
}
bookingDto.bookingBody.transport.routeDetails.selectedRoute.bookingSchedules.Add(currDto);
}
bookingDto.bookingBody.cargo = new MSKAPIBookingCargo
{
commodityCode = model.commodityCode,
@ -1392,6 +1506,25 @@ namespace Myshipping.Application.Service.BookingOrder
}).ToList();
}
MSKAPISearchTransportSchedules selectedShipSchedule = null;
if (model.PId > 0)
{
var shipScheduleRecord = await _bookingDeliveryRecordShipScheduleRep.AsQueryable()
.FirstAsync(a => a.SHIP_RATE_PID != null && a.SHIP_RATE_PID.Value == model.PId);
if (shipScheduleRecord != null)
{
selectedShipSchedule = JSON.Deserialize<MSKAPISearchTransportSchedules>(shipScheduleRecord.SHIP_JSON);
if (selectedShipSchedule != null)
{
model.selectedShipScheduleShow = GetShipScheduleShow(selectedShipSchedule);
}
}
}
return model;
}
#endregion

@ -380,6 +380,11 @@ namespace Myshipping.Application
/// 交货地定位ID
/// </summary>
public string carrierDeliveryDestinationGeoID { get; set; }
/// <summary>
/// 选择的船期详情
/// </summary>
public SearchShipSailingScheduleResultDto selectedShipScheduleShow { get; set; }
}
public class MSKBookingCtnInfo

Loading…
Cancel
Save