|
|
@ -64,12 +64,17 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var sleepTime = (_options.Value.AutoRemote.TimeCycle*60/ _options.Value.AutoRemote.Interval)-10; |
|
|
|
#if DEBUG
|
|
|
|
_options.Value.AutoRemote.TimeCycle = 1; |
|
|
|
_options.Value.AutoRemote.Interval = 2; |
|
|
|
|
|
|
|
#endif
|
|
|
|
// var sleepTime = (_options.Value.AutoRemote.TimeCycle*60/ _options.Value.AutoRemote.Interval)-10;
|
|
|
|
var invterval = _options.Value.AutoRemote.Interval; |
|
|
|
|
|
|
|
var successTime = 0; |
|
|
|
|
|
|
|
|
|
|
|
var guid = DateTime.Now.ToString("yyyyMMddHHmmssfff"); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <invterval; i++) |
|
|
@ -98,9 +103,17 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
camralist.AddRange(idsList); |
|
|
|
} |
|
|
|
successTime++; |
|
|
|
sw.Stop(); |
|
|
|
_logger.LogInformation($"读取标识{guid}读取成功次数{successTime},耗时 {sw.ElapsedMilliseconds}毫秒"); |
|
|
|
Thread.Sleep(1000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (successTime == invterval) |
|
|
|
{ |
|
|
|
sw = Stopwatch.StartNew(); |
|
|
|
|
|
|
|
_logger.LogInformation($"开始标识{guid}同步WMS开始"); |
|
|
|
List<UnCompletedRequestDto> inputdetail = new List<UnCompletedRequestDto>(); |
|
|
|
foreach (var item in camralist) |
|
|
|
{ |
|
|
@ -166,14 +179,16 @@ public class InjectionMoldingRequestReader : IReader |
|
|
|
} |
|
|
|
// 创建新的注塑请求并将数据写入数据库
|
|
|
|
await _injectionRequest.CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
_logger.LogInformation($"标识{guid}同步WMS结束,耗时{sw.ElapsedMilliseconds }毫秒"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Thread.Sleep(sleepTime * 1000); |
|
|
|
Thread.Sleep(1000); |
|
|
|
} |
|
|
|
sw.Stop(); |
|
|
|
_logger.LogInformation($"读取成功次数{successTime},耗时 ${sw.ElapsedMilliseconds / 1000 / 60}分钟"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|