|
|
@ -12048,14 +12048,89 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
MSKApiBooking
|
|
|
|
MSKApiBooking
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.carrierCode))
|
|
|
|
|
|
|
|
throw Oops.Oh($"服务船公司不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.carrierId))
|
|
|
|
|
|
|
|
throw Oops.Oh("船公司代码不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string sendUrl = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.carrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sendUrl = _cache.GetAllDictData().GetAwaiter().GetResult()
|
|
|
|
|
|
|
|
.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == CONST_MSK_API_BOOKING_URL)?.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(sendUrl))
|
|
|
|
|
|
|
|
throw Oops.Oh("未配置发送订舱请求接口地址,请联系管理员");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var webAccountConfig = _webAccountConfig
|
|
|
|
|
|
|
|
.GetAccountConfig("MSKApi", UserManager.UserId).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (webAccountConfig == null)
|
|
|
|
|
|
|
|
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSKAPIBookingDto bookingDto = new MSKAPIBookingDto {
|
|
|
|
|
|
|
|
userKey = App.Configuration["MSKAPIDjyUserKey"],
|
|
|
|
|
|
|
|
userSecret = App.Configuration["MSKAPIDjyUserSecret"],
|
|
|
|
|
|
|
|
operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"],
|
|
|
|
|
|
|
|
mskAppKey = webAccountConfig.Account,
|
|
|
|
|
|
|
|
bookingBody = new MSKAPIBookingBodyDto()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.references = new MSKAPIBookingReferenceDto {
|
|
|
|
|
|
|
|
priceReference = model.priceReference,
|
|
|
|
|
|
|
|
productCode = model.productCode,
|
|
|
|
|
|
|
|
sender = model.sender,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.mandatoryParties = new MSKAPIBookingMandatoryParties {
|
|
|
|
|
|
|
|
bookedByCompanyName = model.bookedByCompanyName,
|
|
|
|
|
|
|
|
bookedByMaerskPartyCode = model.bookedByMaerskPartyCode,
|
|
|
|
|
|
|
|
bookedByPartyContact = new MSKAPIBookingMandatoryPartyContact {
|
|
|
|
|
|
|
|
name = model.bookedByCompanyContactName,
|
|
|
|
|
|
|
|
email = model.bookedByCompanyContactEmail
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
priceOwnerCompanyName = model.priceOwnerCompanyName,
|
|
|
|
|
|
|
|
priceOwnerMaerskPartyCode = model.priceOwnerMaerskPartyCode,
|
|
|
|
|
|
|
|
priceOwnerPartyContact = new MSKAPIBookingMandatoryPartyContact {
|
|
|
|
|
|
|
|
name = model.priceOwnerContactName,
|
|
|
|
|
|
|
|
email = model.priceOwnerContactEmail
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingDto.bookingBody.transport = new MSKAPIBookingTransport {
|
|
|
|
|
|
|
|
carrierCode = model.carrierCode,
|
|
|
|
|
|
|
|
earliestDepartureDate = model.earliestDepartureDate,
|
|
|
|
|
|
|
|
exportServiceMode = model.exportServiceMode,
|
|
|
|
|
|
|
|
importServiceMode = model.importServiceMode,
|
|
|
|
|
|
|
|
routeDetails = new MSKAPIBookingRouteDetails {
|
|
|
|
|
|
|
|
placeOfReceipt = new MSKAPIBookingRouteDetailsBase {
|
|
|
|
|
|
|
|
UNLocationCode = model.placeOfReceiptUnLocCode,
|
|
|
|
|
|
|
|
cityName = model.placeOfReceiptCityName,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
placeOfDelivery = new MSKAPIBookingRouteDetailsBase {
|
|
|
|
|
|
|
|
UNLocationCode = model.placeOfDeliveryUnLocCode,
|
|
|
|
|
|
|
|
cityName = model.placeOfDeliveryCityName,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"检索海运船期详情异常,req={JSON.Serialize(model)} 原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah($"检索海运船期详情失败,{ex.Message}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|