修改MSK SPOT

master
jianghaiqing 5 months ago
parent a705d8aa8c
commit 3afd294dd5

@ -623,7 +623,7 @@ namespace Myshipping.Application.Service.BookingOrder
throw Oops.Oh("未配置发送订舱请求接口地址,请联系管理员"); throw Oops.Oh("未配置发送订舱请求接口地址,请联系管理员");
var webAccountConfig = _webAccountConfig var webAccountConfig = _webAccountConfig
.GetAccountConfig("MSKApi", UserManager.UserId).GetAwaiter().GetResult(); .GetAccountConfig("MSKSpotApi", UserManager.UserId).GetAwaiter().GetResult();
if (webAccountConfig == null) if (webAccountConfig == null)
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi"); throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
@ -661,7 +661,7 @@ namespace Myshipping.Application.Service.BookingOrder
if (selectedShipSchedule == null) if (selectedShipSchedule == null)
throw Oops.Oh("船期数据校验失败,请重新查询船期信息"); throw Oops.Oh("船期数据校验失败,请重新查询船期信息");
if (selectedShipSchedule.priceID.Equals(model.priceID)) if (!selectedShipSchedule.priceID.Equals(model.priceID))
{ {
_logger.LogInformation($"请求当前船期请求参数错误 priceID={model.priceID} 缓存priceID={selectedShipSchedule.priceID} PId={model.PId}"); _logger.LogInformation($"请求当前船期请求参数错误 priceID={model.priceID} 缓存priceID={selectedShipSchedule.priceID} PId={model.PId}");
@ -795,60 +795,74 @@ namespace Myshipping.Application.Service.BookingOrder
}; };
currDto.serviceCode = detail.serviceCode; currDto.serviceCode = detail.serviceCode;
currDto.transportModeCode = detail.transport.transportMode;
//首个 //首个
if(i == 0) if (i == 0)
{ {
currDto.startLocation = new MSKAPIBookingRouteDetailsBase currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName, cityName = detail.fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode, ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode, UNLocationCode = detail.fromLocation.unLocCode,
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityGeoId, maerskCityGeoId = detail.fromLocation.cityGeoId,
}; };
currDto.endLocation = new MSKAPIBookingRouteDetailsBase if (i == selectedShipSchedule.scheduleDetails.Count - 1)
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName, currDto.endLocation = new MSKAPIBookingRouteDetailsBase
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode, {
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode, cityName = detail.toLocation.cityName,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.siteGeoId, ISOcountryCode = detail.toLocation.countryCode,
}; UNLocationCode = detail.toLocation.unLocCode,
maerskCityGeoId = detail.toLocation.cityGeoId,
};
}
else
{
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.toLocation.cityName,
ISOcountryCode = detail.toLocation.countryCode,
UNLocationCode = detail.toLocation.unLocCode,
maerskSiteGeoId = detail.toLocation.siteGeoId,
};
}
} }
else if(i == selectedShipSchedule.scheduleDetails.Count - 1) else if (i == selectedShipSchedule.scheduleDetails.Count - 1)
{ {
currDto.startLocation = new MSKAPIBookingRouteDetailsBase currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName, cityName = detail.fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode, ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode, UNLocationCode = detail.fromLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.siteGeoId, maerskSiteGeoId = detail.fromLocation.siteGeoId,
}; };
currDto.endLocation = new MSKAPIBookingRouteDetailsBase currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName, cityName = detail.toLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode, ISOcountryCode = detail.toLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode, UNLocationCode = detail.toLocation.unLocCode,
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityGeoId, maerskCityGeoId = detail.toLocation.cityGeoId,
}; };
} }
else else
{ {
currDto.startLocation = new MSKAPIBookingRouteDetailsBase currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName, cityName = detail.fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode, ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode, UNLocationCode = detail.fromLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.siteGeoId, maerskSiteGeoId = detail.fromLocation.siteGeoId,
}; };
currDto.endLocation = new MSKAPIBookingRouteDetailsBase currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{ {
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName, cityName = detail.toLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode, ISOcountryCode = detail.toLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode, UNLocationCode = detail.toLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.siteGeoId, maerskSiteGeoId = detail.toLocation.siteGeoId,
}; };
} }
@ -932,7 +946,10 @@ namespace Myshipping.Application.Service.BookingOrder
_logger.LogInformation($"开始请求MSK API订舱JSON={JSON.Serialize(bookingDto)}"); _logger.LogInformation($"开始请求MSK API订舱JSON={JSON.Serialize(bookingDto)}");
var jsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(bookingDto); var jsonBody = Newtonsoft.Json.JsonConvert.SerializeObject(bookingDto, Formatting.Indented, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
var rlt = await sendUrl.SetBody(jsonBody) var rlt = await sendUrl.SetBody(jsonBody)
.PostAsStringAsync(); .PostAsStringAsync();

Loading…
Cancel
Save