|
|
|
@ -121,11 +121,11 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
if (model.carrierCode.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_Poing2P_SECD_URL).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_Poing2P_SECD_URL, long.Parse(user.TenantId), false).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchShipNoSupport)), model.carrierCode));
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchShipNotSupport)), model.carrierCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//未配置查询船期请求接口地址,请联系管理员
|
|
|
|
@ -544,7 +544,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
if (model.carrierCode.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
sendUrl = configService.GetConfig(CONST_MSK_API_BOOKING_URL).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
sendUrl = configService.GetConfig(CONST_MSK_API_BOOKING_URL, long.Parse(user.TenantId), false).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1174,33 +1174,32 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPICommodityNameQueryNull)));
|
|
|
|
|
|
|
|
|
|
//船公司代码不能为空
|
|
|
|
|
//if (string.IsNullOrWhiteSpace(model.carrierCode))
|
|
|
|
|
//throw Oops.Oh("");
|
|
|
|
|
//throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPICommodityNameQueryNull)));
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.carrierCode))
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPICommodityNameQueryNull)));
|
|
|
|
|
|
|
|
|
|
//商品名称至少输入3个以上字符
|
|
|
|
|
// if (model.commodityName.Length < 3)
|
|
|
|
|
//throw Oops.Oh("");
|
|
|
|
|
//throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPICommodityNameQueryNull)));
|
|
|
|
|
if (model.commodityName.Length < 3)
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPICommodityNameInputStrLeast3)));
|
|
|
|
|
|
|
|
|
|
string queryUrl = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (model.carrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (model.carrierCode.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_COMMODITY_URL).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_COMMODITY_URL, long.Parse(user.TenantId), false).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
|
|
|
|
|
//当前船公司{0} 不支持 API 查询商品
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchCommodityNotSupport)), model.carrierCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (string.IsNullOrWhiteSpace(queryUrl))
|
|
|
|
|
//throw Oops.Oh("未配置商品请求接口地址,请联系管理员");
|
|
|
|
|
if (string.IsNullOrWhiteSpace(queryUrl))
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchCommodityNoConfig)), model.carrierCode));
|
|
|
|
|
|
|
|
|
|
var webAccountConfig = codeThirdPartyService.GetCodeThirdPartyInfoWithCompany("MSKApi").GetAwaiter().GetResult()?.Data;
|
|
|
|
|
|
|
|
|
|
//if (webAccountConfig == null)
|
|
|
|
|
//throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
|
|
|
|
|
if (webAccountConfig == null)
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPIThirdPartyNull)));
|
|
|
|
|
|
|
|
|
|
MSKAPISearchCommodityDto queryInfo = new MSKAPISearchCommodityDto
|
|
|
|
|
{
|
|
|
|
@ -1225,9 +1224,9 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//_logger.LogInformation($"请求MSK API检索商品异常,原因:{ex.Message}");
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"请求MSK API检索商品异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
//throw Oops.Bah($"请求MSK API检索商品异常,原因:{ex.Message}");
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchCommodityException)), ex.Message));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1239,9 +1238,9 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//_logger.LogError($"检索商品名称异常,req={JSON.Serialize(model)} 原因:{ex.Message}");
|
|
|
|
|
Logger.Log(NLog.LogLevel.Error, $"检索商品名称异常,req={JsonConvert.SerializeObject(model)} 原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
//throw Oops.Bah($"检索商品名称失败,{ex.Message}");
|
|
|
|
|
return DataResult<List<SearchCommodityResultDto>>.FailedData(list, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<SearchCommodityResultDto>>.Success(list);
|
|
|
|
@ -1284,21 +1283,23 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
if (model.carrierCode.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_LOCATION_URL).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
queryUrl = configService.GetConfig(CONST_MSK_API_LOCATION_URL,long.Parse(user.TenantId),false).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
|
|
|
|
|
//当前船公司{0} 不支持 API 查询港口
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchLocNotSupport)), model.carrierCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (string.IsNullOrWhiteSpace(queryUrl))
|
|
|
|
|
//throw Oops.Oh("未配置商品请求接口地址,请联系管理员");
|
|
|
|
|
//未配置 MSK API 查询港口请求接口地址(马士基API合约查询港口URL),请联系管理员
|
|
|
|
|
if (string.IsNullOrWhiteSpace(queryUrl))
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchLocNoConfig)));
|
|
|
|
|
|
|
|
|
|
var webAccountConfig = codeThirdPartyService.GetCodeThirdPartyInfoWithCompany("MSKApi").GetAwaiter().GetResult()?.Data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (webAccountConfig == null)
|
|
|
|
|
//throw Oops.Oh("未配检索始发地、目的港口,请先配置个人账户 类型-MSKApi");
|
|
|
|
|
//未配置第三方账户个人或公司账户(MSKApi)
|
|
|
|
|
if (webAccountConfig == null)
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPIThirdPartyNull)));
|
|
|
|
|
|
|
|
|
|
MSKAPISearchLocationDto queryInfo = new MSKAPISearchLocationDto
|
|
|
|
|
{
|
|
|
|
@ -1307,7 +1308,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
operatingEnvironment = mskAPIEnvironment,
|
|
|
|
|
name = model.cityName,
|
|
|
|
|
mskAppKey = webAccountConfig.AppKey,
|
|
|
|
|
carrierCode = model.carrierCode
|
|
|
|
|
carrierCode = model.serviceCarrierCode
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MSKAPISearchLocationResultDto resultInfo = null;
|
|
|
|
@ -1324,9 +1325,9 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//_logger.LogInformation($"请求MSK API检索始发地、目的港口异常,原因:{ex.Message}");
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info,$"请求MSK API检索始发地、目的港口异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
//throw Oops.Bah($"请求MSK API检索始发地、目的港口异常,原因:{ex.Message}");
|
|
|
|
|
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISearchLocException)),ex.Message));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1338,9 +1339,11 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//_logger.LogError($"检索始发地、目的港口异常,req={JSON.Serialize(model)} 原因:{ex.Message}");
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"检索始发地、目的港口异常,req={JsonConvert.SerializeObject(model)} 原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
//throw Oops.Bah($"检索始发地、目的港口失败,{ex.Message}");
|
|
|
|
|
|
|
|
|
|
return DataResult<List<QueryLocationsResultDto>>.FailedData(list, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<QueryLocationsResultDto>>.Success(list);
|
|
|
|
|