Browse Source

缴库接口修改

dev_DY_CC
lvzb 1 year ago
parent
commit
b0c97c9796
  1. 18
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs
  2. 13
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs
  3. 4
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/appsettings.json

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

@ -49,15 +49,15 @@ 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, // 3,
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) =>

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

@ -62,7 +62,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
} }
private async Task HandleIncomingDataAsync(PeriodicBackgroundWorkerContext workerContext) private async Task HandleIncomingDataAsync(PeriodicBackgroundWorkerContext workerContext)
{ {
//Resolve dependencies //Resolve dependencies
var incomingToWmsManager = workerContext.ServiceProvider.GetRequiredService<IIncomingToWmsManager>(); var incomingToWmsManager = workerContext.ServiceProvider.GetRequiredService<IIncomingToWmsManager>();
//Do the work //Do the work
@ -72,7 +72,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
{ {
try try
{ {
await AddOrUpdateWmsAsync(workerContext, incomingToWms).ConfigureAwait(false); await AddOrUpdateWmsAsync(workerContext, incomingToWms).ConfigureAwait(false);
} }
catch (AbpValidationException ex) catch (AbpValidationException ex)
@ -172,14 +172,14 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false); await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.BackFlush: case EnumIncomingDataType.BackFlush:
// await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false); // await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false);
await SendBackFlush(workerContext, incomingToWms).ConfigureAwait(false); await SendBackFlush(workerContext, incomingToWms).ConfigureAwait(false);
break; break;
case EnumIncomingDataType.None: case EnumIncomingDataType.None:
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
if( incomingToWms.Status != EnumExchangeDataStatus.Error) if (incomingToWms.Status != EnumExchangeDataStatus.Error)
{ {
incomingToWms.SetSuccess(); incomingToWms.SetSuccess();
} }
@ -188,7 +188,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
{ // 定义请求的 URL { // 定义请求的 URL
// string apiUrl = "http://10.164.113.31:60085/api/wms/store/product-receipt-note"; // string apiUrl = "http://10.164.113.31:60085/api/wms/store/product-receipt-note";
string apiUrl = _options.Value.IncomingOptions.apiUrl+ "api/wms/store/backFlush-note/create-many"; string apiUrl = _options.Value.IncomingOptions.apiUrl + "api/wms/store/backFlush-note/create-many";
if (!string.IsNullOrEmpty(_options.Value.IncomingOptions.apiUrl)) if (!string.IsNullOrEmpty(_options.Value.IncomingOptions.apiUrl))
{ {
@ -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