You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

54 lines
1018 B

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);
}
});
}
}
}