using Leit.FrameWork.Log; using Leit.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Leit.StationFunction { public partial class ServiceData { public static bool PlcInitOk { get; set; } public static void CycleReadPlcData() { Task.Run(()=>{ try { DbTags.ForEach(p => { var result = PlcServer.Read($"{p.AreaId}.{p.StartByteIndex}", Convert.ToUInt16(p.Length)); if (result.IsSuccess) { p.BytesValue = result.Content; } }); PlcInitOk = true; } catch(Exception ex) { LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex); } }); } } }