|
@ -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
|
|
@ -71,9 +71,9 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
foreach (var incomingToWms in incomingToWmsList) |
|
|
foreach (var incomingToWms in incomingToWmsList) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
await AddOrUpdateWmsAsync(workerContext, incomingToWms).ConfigureAwait(false); |
|
|
await AddOrUpdateWmsAsync(workerContext, incomingToWms).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (AbpValidationException ex) |
|
|
catch (AbpValidationException ex) |
|
|
{ |
|
|
{ |
|
@ -172,23 +172,23 @@ 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(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
private async Task SendBackFlush(PeriodicBackgroundWorkerContext workerContext, IncomingToWms incomingToWms) |
|
|
private async Task SendBackFlush(PeriodicBackgroundWorkerContext workerContext, IncomingToWms incomingToWms) |
|
|
{ // 定义请求的 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) |
|
|
{ |
|
|
{ |
|
@ -274,10 +277,10 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
//{
|
|
|
//{
|
|
|
// //Resolve dependencies
|
|
|
// //Resolve dependencies
|
|
|
// var incomingToWmsManager = workerContext.ServiceProvider.GetRequiredService<IIncomingToWmsManager>();
|
|
|
// var incomingToWmsManager = workerContext.ServiceProvider.GetRequiredService<IIncomingToWmsManager>();
|
|
|
|
|
|
|
|
|
// //归档并删除
|
|
|
// //归档并删除
|
|
|
// await incomingToWmsManager.ArchiveAutoSaveAsync(incomingToWms).ConfigureAwait(false);
|
|
|
// await incomingToWmsManager.ArchiveAutoSaveAsync(incomingToWms).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|