|
@ -21,6 +21,8 @@ using System.IdentityModel.Tokens.Jwt; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using System.Net.NetworkInformation; |
|
|
using System.Net.NetworkInformation; |
|
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; |
|
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; |
|
|
|
|
|
using System.Threading; |
|
|
|
|
|
using System.Diagnostics; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming; |
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming; |
|
|
public class InjectionMoldingRequestReader : IReader |
|
|
public class InjectionMoldingRequestReader : IReader |
|
@ -62,14 +64,18 @@ public class InjectionMoldingRequestReader : IReader |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
// 获取注塑叫料任务数量
|
|
|
var sleepTime = (_options.Value.AutoRemote.TimeCycle*60/ _options.Value.AutoRemote.Interval)-10; |
|
|
//var count = await _injectionRequest.GetCountAsync().ConfigureAwait(false);
|
|
|
var invterval = _options.Value.AutoRemote.Interval; |
|
|
//List<InjectionIssueRequestEditInput> joblist = new List<InjectionIssueRequestEditInput>();
|
|
|
|
|
|
//if (count == 0)
|
|
|
var successTime = 0; |
|
|
//{
|
|
|
|
|
|
// 调用 ReaderCameraApi 方法获取摄像头信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <invterval; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
Stopwatch sw = Stopwatch.StartNew(); |
|
|
|
|
|
|
|
|
Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
|
|
|
Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
|
|
|
|
|
|
|
|
|
var flag = await client.GetMacStaticAsync().ConfigureAwait(false); |
|
|
var flag = await client.GetMacStaticAsync().ConfigureAwait(false); |
|
@ -79,13 +85,11 @@ public class InjectionMoldingRequestReader : IReader |
|
|
_logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头"); |
|
|
_logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头"); |
|
|
return new List<IncomingFromExternal>(); |
|
|
return new List<IncomingFromExternal>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(_options.Value.AutoRemote.AreaIDs)) |
|
|
if (string.IsNullOrEmpty(_options.Value.AutoRemote.AreaIDs)) |
|
|
{ |
|
|
{ |
|
|
_logger.LogInformation($"没有设置指定区域AutoRemote->AreaIDs"); |
|
|
_logger.LogInformation($"没有设置指定区域AutoRemote->AreaIDs"); |
|
|
return new List<IncomingFromExternal>(); |
|
|
return new List<IncomingFromExternal>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var ids = _options.Value.AutoRemote.AreaIDs.Split(","); |
|
|
var ids = _options.Value.AutoRemote.AreaIDs.Split(","); |
|
|
List<ResponCargoItem> camralist = new List<ResponCargoItem>(); |
|
|
List<ResponCargoItem> camralist = new List<ResponCargoItem>(); |
|
|
foreach (var itm in ids)//遍历区域查找所有货物
|
|
|
foreach (var itm in ids)//遍历区域查找所有货物
|
|
@ -93,8 +97,9 @@ public class InjectionMoldingRequestReader : IReader |
|
|
var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false); |
|
|
var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false); |
|
|
camralist.AddRange(idsList); |
|
|
camralist.AddRange(idsList); |
|
|
} |
|
|
} |
|
|
camralist = camralist.Where(p=>p.Flag==0).ToList(); |
|
|
successTime++; |
|
|
|
|
|
if (successTime == invterval) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
List<UnCompletedRequestDto> inputdetail = new List<UnCompletedRequestDto>(); |
|
|
List<UnCompletedRequestDto> inputdetail = new List<UnCompletedRequestDto>(); |
|
|
foreach (var item in camralist) |
|
|
foreach (var item in camralist) |
|
@ -161,14 +166,48 @@ public class InjectionMoldingRequestReader : IReader |
|
|
} |
|
|
} |
|
|
// 创建新的注塑请求并将数据写入数据库
|
|
|
// 创建新的注塑请求并将数据写入数据库
|
|
|
await _injectionRequest.CreateAsync(input).ConfigureAwait(false); |
|
|
await _injectionRequest.CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Thread.Sleep(sleepTime * 1000); |
|
|
|
|
|
} |
|
|
|
|
|
sw.Stop(); |
|
|
|
|
|
_logger.LogInformation($"读取成功次数{successTime},耗时 ${sw.ElapsedMilliseconds / 1000 / 60}分钟"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
|
|
|
|
|
|
|
|
|
|
|
|
//var flag= await client.GetMacStaticAsync().ConfigureAwait(false);
|
|
|
|
|
|
//if (flag!=1)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// // 记录错误日志并返回空列表
|
|
|
|
|
|
// _logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头");
|
|
|
|
|
|
// return new List<IncomingFromExternal>();
|
|
|
//}
|
|
|
//}
|
|
|
//else
|
|
|
|
|
|
|
|
|
//if (string.IsNullOrEmpty(_options.Value.AutoRemote.AreaIDs))
|
|
|
//{
|
|
|
//{
|
|
|
// _logger.LogInformation("注塑叫料任务已存在,无需读取");
|
|
|
// _logger.LogInformation($"没有设置指定区域AutoRemote->AreaIDs");
|
|
|
|
|
|
// return new List<IncomingFromExternal>();
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//var ids=_options.Value.AutoRemote.AreaIDs.Split(",");
|
|
|
|
|
|
//List<ResponCargoItem> camralist = new List<ResponCargoItem>();
|
|
|
|
|
|
//foreach (var itm in ids)//遍历区域查找所有货物
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var idsList= await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
|
|
|
|
|
|
// camralist.AddRange(idsList);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//camralist = camralist.Where(p=>p.Flag==0).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 捕获特定异常并记录日志
|
|
|
// 捕获特定异常并记录日志
|
|
|
|
|
|
|
|
|