修改马士基API 检索港口、检索商品

usertest
jianghaiqing 4 months ago
parent d15420c182
commit a77d0e78e6

@ -647,28 +647,46 @@ public static class MultiLanguageConst
[Description("当前船公司{0} 不支持 API 合约订舱")]
public const string SpaceBookingAPIBookingNotSupport = "SpaceBK_API_Booking_NotSupport";
/// <summary>
/// 当前船公司{0} 不支持 API 查询港口
/// </summary>
[Description("当前船公司{0} 不支持 API 查询港口")]
public const string SpaceBookingAPISearchLocNotSupport = "SpaceBK_API_SearchLoc_NotSupport";
/// <summary>
/// 当前船公司{0} 不支持 API 查询商品
/// </summary>
[Description("当前船公司{0} 不支持 API 查询商品")]
public const string SpaceBookingAPISearchCommodityNotSupport = "SpaceBK_API_SearchCommodity_NotSupport";
/// <summary>
/// 当前船公司{0} 不支持 API 订舱查询船期
/// </summary>
[Description("当前船公司{0} 不支持 API 合约订舱查询船期")]
public const string SpaceBookingAPISearchShipNoSupport = "SpaceBK_API_SearchShip_NoSupport";
public const string SpaceBookingAPISearchShipNotSupport = "SpaceBK_API_SearchShip_NotSupport";
/// <summary>
/// 当前船公司{0} 不支持 API Spot 订舱查询船期
/// </summary>
[Description("当前船公司{0} 不支持 API Spot 订舱查询船期")]
public const string SpaceBookingAPISportSearchShipNoSupport = "SpaceBK_API_Spot_SearchShip_NoSupport";
public const string SpaceBookingAPISportSearchShipNotSupport = "SpaceBK_API_Spot_SearchShip_NotSupport";
/// <summary>
/// 当前船公司{0} 不支持 API 合约订舱查询港口
/// 未配置 MSK API 查询港口请求接口地址马士基API合约查询港口URL请联系管理员
/// </summary>
[Description("当前船公司{0} 不支持 API 合约订舱查询港口")]
public const string SpaceBookingAPISearchLocNoSupport = "SpaceBK_API_SearchLoc_NoSupport";
[Description("未配置 MSK API 查询港口请求接口地址马士基API合约查询港口URL请联系管理员")]
public const string SpaceBookingAPISearchLocNoConfig = "SpaceBK_API_SearchLoc_NoConfig";
/// <summary>
/// 未配置查询船期请求接口地址,请联系管理员
/// 未配置 MSK API 查询港口请求接口地址马士基API合约查询商品URL,请联系管理员
/// </summary>
[Description("未配置查询船期请求接口地址,请联系管理员")]
[Description("未配置 MSK API 查询港口请求接口地址马士基API合约查询商品URL请联系管理员")]
public const string SpaceBookingAPISearchCommodityNoConfig = "SpaceBK_API_SearchCommodity_NoConfig";
/// <summary>
/// 未配置 MSK API 查询船期请求接口地址马士基API合约查询船期URL请联系管理员
/// </summary>
[Description("未配置 MSK API 查询船期请求接口地址马士基API合约查询船期URL请联系管理员")]
public const string SpaceBookingAPISearchShipNoConfig = "SpaceBK_API_SearchShip_NoConfig";
/// <summary>
@ -991,6 +1009,13 @@ public static class MultiLanguageConst
/// </summary>
[Description("港口或城市名称至少输入3个以上字符")]
public const string SpaceBookingAPIQueryLocCityLeastThreeLNull = "SpaceBK_API_Query_LocCityName_Three_Null";
/// <summary>
/// 商品名称至少输入3个以上字符
/// </summary>
[Description("港口或城市名称至少输入3个以上字符")]
public const string SpaceBookingAPICommodityNameInputStrLeast3 = "SpaceBK_API_CommodityName_InputStr_Least3";
/*
*/
@ -1026,6 +1051,18 @@ public static class MultiLanguageConst
[Description("请求MSK API查询船期异常原因{0}")]
public const string SpaceBookingAPISearchShipException = "SpaceBK_API_SearchShip_Exception";
/// <summary>
/// 请求MSK API查询港口异常原因{0}
/// </summary>
[Description("请求MSK API查询港口异常原因{0}")]
public const string SpaceBookingAPISearchLocException = "SpaceBK_API_SearchLoc_Exception";
/// <summary>
/// 请求MSK API查询商品异常原因{0}
/// </summary>
[Description("请求MSK API查询商品异常原因{0}")]
public const string SpaceBookingAPISearchCommodityException = "SpaceBK_API_SearchCommodity_Exception";
/// <summary>
/// 请求MSK API SPOT 查询船期异常,原因:{0}
/// </summary>

@ -16,11 +16,6 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
public string commodityName { get; set; }
/// <summary>
/// 船公司主键
/// </summary>
public string carrierId { get; set; }
/// <summary>
/// 船公司代码
/// </summary>

@ -10,7 +10,7 @@ namespace DS.WMS.Core.Op.Entity.BookingSlot
/// <summary>
/// 舱位分配表
/// </summary>
[SqlSugar.SugarTable("op_sea_booking_slot_allocation", "舱位分配表")]
[SqlSugar.SugarTable("op_sea_booking_slot_demand", "舱位分配表")]
public class BookingSlotDemand : BaseModelV2<long>
{
/// <summary>

@ -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);

@ -256,7 +256,7 @@ namespace DS.WMS.Core.Op.Method
else
{
//当前船公司{0} 不支持 API Spot 订舱查询船期
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISportSearchShipNoSupport)), model.carrierId));
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SpaceBookingAPISportSearchShipNotSupport)), model.carrierId));
}
//未配置API SPOT 查询船期请求接口地址 key={0},请联系管理员
@ -1320,7 +1320,7 @@ namespace DS.WMS.Core.Op.Method
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;
}

@ -362,3 +362,52 @@
2024-07-17 14:01:25.5048 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:01:25.5048 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:01:25.5048 Info Configuration initialized.
2024-07-17 14:24:20.2274 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 14:24:20.2393 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 14:24:20.2393 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 14:24:20.2393 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 14:24:20.2572 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:24:20.2572 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:24:20.2572 Info Configuration initialized.
2024-07-17 14:44:45.5004 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 14:44:45.5124 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 14:44:45.5124 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 14:44:45.5248 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 14:44:45.5248 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:44:45.5248 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:44:45.5374 Info Configuration initialized.
2024-07-17 14:47:43.7392 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 14:47:43.7545 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 14:47:43.7545 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 14:47:43.7722 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 14:47:43.7722 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:47:43.7722 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:47:43.7870 Info Configuration initialized.
2024-07-17 14:49:57.5797 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 14:49:57.5940 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 14:49:57.5979 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 14:49:57.5979 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 14:49:57.6144 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 14:49:57.6144 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 14:49:57.6144 Info Configuration initialized.
2024-07-17 15:14:43.5725 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 15:14:43.5908 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 15:14:43.5908 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 15:14:43.6084 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 15:14:43.6164 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 15:14:43.6164 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 15:14:43.6164 Info Configuration initialized.
2024-07-17 15:26:53.4201 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 15:26:53.4332 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 15:26:53.4332 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 15:26:53.4461 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 15:26:53.4461 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 15:26:53.4461 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 15:26:53.4592 Info Configuration initialized.
2024-07-17 15:36:51.5749 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-07-17 15:36:51.5894 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-07-17 15:36:51.5894 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-07-17 15:36:51.6019 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-07-17 15:36:51.6019 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-07-17 15:36:51.6019 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-07-17 15:36:51.6154 Info Configuration initialized.

@ -6,7 +6,7 @@
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Code\PublishCopy\ds8-opapi</_PublishTargetUrl>
<History>True|2024-07-15T05:43:42.6073130Z||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||;</History>
<History>True|2024-07-17T06:03:08.1814323Z||;True|2024-07-15T13:43:42.6073130+08:00||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save