zhangxiaofeng 9 months ago
commit d2d3d64f91

@ -11881,11 +11881,92 @@ namespace Myshipping.Application
*/
try
{
if(string.IsNullOrWhiteSpace(model.collectionOriginCityName))
throw Oops.Oh($"始发地不能为空");
if (string.IsNullOrWhiteSpace(model.deliveryDestinationCityName))
throw Oops.Oh($"目的地不能为空");
if (string.IsNullOrWhiteSpace(model.vesselOperatorCarrierCode))
throw Oops.Oh($"服务船公司不能为空");
if (string.IsNullOrWhiteSpace(model.startDate))
throw Oops.Oh($"预计离港日期不能为空");
DateTime etd = DateTime.MinValue;
if(!DateTime.TryParse(model.startDate,out etd))
throw Oops.Oh($"预计离港日期格式错误");
string queryUrl = string.Empty;
if (model.carrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
{
queryUrl = _cache.GetAllDictData().GetAwaiter().GetResult()
.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == CONST_MSK_API_Poing2P_SECD_URL)?.Value;
}
else
{
throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
}
if (string.IsNullOrWhiteSpace(queryUrl))
throw Oops.Oh("未配置查询船期请求接口地址,请联系管理员");
var webAccountConfig = _webAccountConfig
.GetAccountConfig("MSKApi", UserManager.UserId).GetAwaiter().GetResult();
if (webAccountConfig == null)
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
MSKAPISearchPoint2PointScheduleDto queryInfo = new MSKAPISearchPoint2PointScheduleDto
{
userKey = App.Configuration["MSKAPIDjyUserKey"],
userSecret = App.Configuration["MSKAPIDjyUserSecret"],
operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"],
mskAppKey = webAccountConfig.Account,
collectionOriginCityName = model.collectionOriginCityName,
collectionOriginCountryCode = model.collectionOriginCountryCode,
deliveryDestinationCityName = model.deliveryDestinationCityName,
deliveryDestinationCountryCode = model.deliveryDestinationCountryCode,
cargoType = model.cargoType,
exportServiceMode = model.exportServiceMode,
importServiceMode = model.importServiceMode,
vesselOperatorCarrierCode = model.vesselOperatorCarrierCode,
startDate = etd.ToString("yyyy-MM-dd"),
startDateType = "D",
};
MSKAPISearchPoint2PointScheduleResultDto resultInfo = null;
var rlt = await queryUrl.SetBody(queryInfo)
.PostAsStringAsync();
if (!string.IsNullOrWhiteSpace(rlt))
{
try
{
resultInfo = JSON.Deserialize<MSKAPISearchPoint2PointScheduleResultDto>(rlt);
}
catch (Exception ex)
{
_logger.LogInformation($"请求MSK API查询船期异常原因{ex.Message}");
throw Oops.Bah($"请求MSK API查询船期异常原因{ex.Message}");
}
}
if (resultInfo != null && resultInfo.code == 200
&& resultInfo.data != null && resultInfo.data.Count > 0)
{
list = resultInfo.data.Adapt<List<SearchShipSailingScheduleResultDto>>();
}
}
catch (Exception ex)
{
_logger.LogError($"检索海运船期详情异常req={JSON.Serialize(model)} 原因:{ex.Message}");
throw Oops.Bah($"检索海运船期详情失败,{ex.Message}");
}
return list;

@ -109,7 +109,7 @@ namespace Myshipping.Application
/// <summary>
/// 箱体积
/// </summary>
public int stuffingVolume { get; set; }
public Nullable<int> stuffingVolume { get; set; }
/// <summary>
/// 体积单位MTQ, FTQ

@ -24,7 +24,7 @@ namespace Myshipping.Application
/// <summary>
/// 回执代码
/// </summary>
public MSKAPISearchPoint2PointScheduleResultDataDto data { get; set; }
public List<MSKAPISearchPoint2PointScheduleResultDataDto> data { get; set; }
}
public class MSKAPISearchPoint2PointScheduleResultDataDto

@ -187,6 +187,14 @@ namespace Myshipping.Application
/// </summary>
public string commodityCodeType { get; set; }
/// <summary>
/// 箱型箱量列表
/// </summary>
public List<MSKBookingCtnInfo> ctns { get; set; }
}
public class MSKBookingCtnInfo
{
/// <summary>
/// 箱型
/// </summary>

@ -11,6 +11,11 @@ namespace Myshipping.Application
/// </summary>
public class QueryShipSailingScheduleDto
{
/// <summary>
/// 船公司代码
/// </summary>
public string carrierId { get; set; }
/// <summary>
/// 起始地的GEO ID
/// </summary>

Loading…
Cancel
Save