Browse Source

更新版本

dev_DY_CC
赵新宇 10 months ago
parent
commit
007a082c59
  1. 20
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

20
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

@ -76,20 +76,15 @@ public class InjectionMoldingRequestReader : IReader
Stopwatch sw = Stopwatch.StartNew(); 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);
if (flag != 1) if (flag != 1)
{ {
// 记录错误日志并返回空列表 // 记录错误日志并返回空列表
_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(",");
@ -101,6 +96,8 @@ public class InjectionMoldingRequestReader : IReader
{ {
var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false); var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
Thread.Sleep(500);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息 Thread.Sleep(500);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息
//flag 1-有货 0-空闲 //flag 1-有货 0-空闲
foreach (var respon in idsList.Where(r => r.Flag == 0)) foreach (var respon in idsList.Where(r => r.Flag == 0))
@ -109,11 +106,9 @@ public class InjectionMoldingRequestReader : IReader
response.FromObject(respon); response.FromObject(respon);
response.Number = $"第{i.ToString()}次读取"; response.Number = $"第{i.ToString()}次读取";
camralist1.Add(response); camralist1.Add(response);
} }
camralist.AddRange(idsList.Where(r => r.Flag == 0)); camralist.AddRange(idsList.Where(r => r.Flag == 0));
} }
_logger.LogInformation($"读取标识{guid}读取成功次数{i},耗时 {sw.ElapsedMilliseconds}毫秒"); _logger.LogInformation($"读取标识{guid}读取成功次数{i},耗时 {sw.ElapsedMilliseconds}毫秒");
} }
_logger.LogInformation($"标识{guid}读取{invterval}次接口表:{System.Text.Json.JsonSerializer.Serialize(camralist1)}"); _logger.LogInformation($"标识{guid}读取{invterval}次接口表:{System.Text.Json.JsonSerializer.Serialize(camralist1)}");
@ -150,7 +145,6 @@ public class InjectionMoldingRequestReader : IReader
jobrequestinput.PositionCode = item.CargoID.ToString(); jobrequestinput.PositionCode = item.CargoID.ToString();
inputdetail.Add(jobrequestinput); inputdetail.Add(jobrequestinput);
} }
var uncompletelist = await _injectionRequest.Getlist(inputdetail).ConfigureAwait(false);//将所有库位物品信息查找未完成记录 var uncompletelist = await _injectionRequest.Getlist(inputdetail).ConfigureAwait(false);//将所有库位物品信息查找未完成记录
var query = from itm in list.Select(r => r.Key).ToList() var query = from itm in list.Select(r => r.Key).ToList()
@ -160,15 +154,8 @@ public class InjectionMoldingRequestReader : IReader
where tm == null where tm == null
select itm; select itm;
var injectionList = query.ToList();//已经完成的记录 var injectionList = query.ToList();//已经完成的记录
_logger.LogInformation($"标识{guid}同步WMS内容:{System.Text.Json.JsonSerializer.Serialize(injectionList)}"); _logger.LogInformation($"标识{guid}同步WMS内容:{System.Text.Json.JsonSerializer.Serialize(injectionList)}");
_logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList)); _logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList));
//_logger.LogInformation($"标识{guid}同步WMS开始");
foreach (var inject in injectionList) foreach (var inject in injectionList)
{ {
List<InjectionRequest> cameraList = new List<InjectionRequest>(); List<InjectionRequest> cameraList = new List<InjectionRequest>();
@ -212,7 +199,6 @@ public class InjectionMoldingRequestReader : IReader
} }
// 创建新的注塑请求并将数据写入数据库 // 创建新的注塑请求并将数据写入数据库
await _injectionRequest.CreateAsync(input).ConfigureAwait(false); await _injectionRequest.CreateAsync(input).ConfigureAwait(false);
} }
_logger.LogInformation($"标识{guid}同步WMS结束,耗时{sw.ElapsedMilliseconds}毫秒"); _logger.LogInformation($"标识{guid}同步WMS结束,耗时{sw.ElapsedMilliseconds}毫秒");
} }

Loading…
Cancel
Save