修改MSK SPOT

master
jianghaiqing 5 months ago
parent a705d8aa8c
commit 3afd294dd5

@ -623,7 +623,7 @@ namespace Myshipping.Application.Service.BookingOrder
throw Oops.Oh("未配置发送订舱请求接口地址,请联系管理员");
var webAccountConfig = _webAccountConfig
.GetAccountConfig("MSKApi", UserManager.UserId).GetAwaiter().GetResult();
.GetAccountConfig("MSKSpotApi", UserManager.UserId).GetAwaiter().GetResult();
if (webAccountConfig == null)
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
@ -661,7 +661,7 @@ namespace Myshipping.Application.Service.BookingOrder
if (selectedShipSchedule == null)
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}");
@ -795,60 +795,74 @@ namespace Myshipping.Application.Service.BookingOrder
};
currDto.serviceCode = detail.serviceCode;
currDto.transportModeCode = detail.transport.transportMode;
//首个
if(i == 0)
if (i == 0)
{
currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode,
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityGeoId,
cityName = detail.fromLocation.cityName,
ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = detail.fromLocation.unLocCode,
maerskCityGeoId = detail.fromLocation.cityGeoId,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
if (i == selectedShipSchedule.scheduleDetails.Count - 1)
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.siteGeoId,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = detail.toLocation.cityName,
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
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.siteGeoId,
cityName = detail.fromLocation.cityName,
ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = detail.fromLocation.unLocCode,
maerskSiteGeoId = detail.fromLocation.siteGeoId,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode,
maerskCityGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityGeoId,
cityName = detail.toLocation.cityName,
ISOcountryCode = detail.toLocation.countryCode,
UNLocationCode = detail.toLocation.unLocCode,
maerskCityGeoId = detail.toLocation.cityGeoId,
};
}
else
{
currDto.startLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().fromLocation.siteGeoId,
cityName = detail.fromLocation.cityName,
ISOcountryCode = detail.fromLocation.countryCode,
UNLocationCode = detail.fromLocation.unLocCode,
maerskSiteGeoId = detail.fromLocation.siteGeoId,
};
currDto.endLocation = new MSKAPIBookingRouteDetailsBase
{
cityName = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.cityName,
ISOcountryCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.countryCode,
UNLocationCode = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.unLocCode,
maerskSiteGeoId = selectedShipSchedule.scheduleDetails.FirstOrDefault().toLocation.siteGeoId,
cityName = detail.toLocation.cityName,
ISOcountryCode = detail.toLocation.countryCode,
UNLocationCode = detail.toLocation.unLocCode,
maerskSiteGeoId = detail.toLocation.siteGeoId,
};
}
@ -932,7 +946,10 @@ namespace Myshipping.Application.Service.BookingOrder
_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)
.PostAsStringAsync();

Loading…
Cancel
Save