Browse Source

接口优化

master
lvzb 1 year ago
parent
commit
d30ebc66bf
  1. 8
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Properties/launchSettings.json
  2. 20
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs
  3. 3
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs
  4. 4
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json

8
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Properties/launchSettings.json

@ -0,0 +1,8 @@
{
"profiles": {
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}

20
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs

@ -48,16 +48,16 @@ public class AgentModule : AbpModule
{ {
PreConfigure<AbpHttpClientBuilderOptions>(options => PreConfigure<AbpHttpClientBuilderOptions>(options =>
{ {
//Polly 重试3次 // Polly 重试3次
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => //options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) =>
{ //{
clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => // clientBuilder.AddTransientHttpErrorPolicy(policyBuilder =>
policyBuilder.WaitAndRetryAsync( // policyBuilder.WaitAndRetryAsync(
3, // 1,
i => TimeSpan.FromSeconds(Math.Pow(2, i)) // i => TimeSpan.FromSeconds(Math.Pow(2, i))
) // )
); // );
}); //});
//默认添加Authorization Header: Bearer Token //默认添加Authorization Header: Bearer Token
options.ProxyClientActions.Add((a, s, h) => options.ProxyClientActions.Add((a, s, h) =>

3
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs

@ -237,6 +237,8 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
if (!string.IsNullOrEmpty(_options.Value.IncomingOptions.apiUrl)) if (!string.IsNullOrEmpty(_options.Value.IncomingOptions.apiUrl))
{ {
var productReceiptJson = JsonSerializer.Deserialize<ProductReceiptNoteEditInput>(incomingToWms.DataContent); var productReceiptJson = JsonSerializer.Deserialize<ProductReceiptNoteEditInput>(incomingToWms.DataContent);
var memos = productReceiptJson.Details.Select(r => r.Remark).ToList();
string memostr = String.Join(", ", memos);
productReceiptJson.Worker = "Mes"; productReceiptJson.Worker = "Mes";
try try
{ {
@ -256,6 +258,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
// 读取响应内容并返回 // 读取响应内容并返回
string responseBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false); string responseBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Logger.LogInformation("标签"+memostr);
} }
catch (HttpRequestException ex) catch (HttpRequestException ex)
{ {

4
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json

@ -42,14 +42,14 @@
"IncomingOptions": { "IncomingOptions": {
"Active": true, "Active": true,
"PeriodSeconds": 10, "PeriodSeconds": 10,
"RetryTimes": 3, "RetryTimes": 1,
"BatchSize": 100, "BatchSize": 100,
"apiUrl": "http://10.164.113.31:60085/" "apiUrl": "http://10.164.113.31:60085/"
}, },
"OutgoingOptions": { "OutgoingOptions": {
"Active": false, "Active": false,
"PeriodSeconds": 10, "PeriodSeconds": 10,
"RetryTimes": 3, "RetryTimes": 1,
"BatchSize": 100, "BatchSize": 100,
"BaseUrl": "https://localhost:7034/test", "BaseUrl": "https://localhost:7034/test",
"Username": "username", "Username": "username",

Loading…
Cancel
Save