1
0
Fork 0

feat - 添加PLC读写类

master^2
SoulStar 2 days ago
parent 978ade00b0
commit 8d04f196be

@ -7,6 +7,16 @@ namespace HighWayIot.Plc
{
public class PlcConnect
{
private static readonly Lazy<PlcConnect> lazy = new Lazy<PlcConnect>(() => new PlcConnect());
public static PlcConnect Instance
{
get
{
return lazy.Value;
}
}
private static LogHelper logHelper = LogHelper.Instance;
/// <summary>

@ -10,7 +10,7 @@ namespace HighWayIot.Plc.PlcEntity
public enum RgvStationEnum
{
[Description("裝圈工位RIFD触发")]
RgvRingInstallStation = 1,
RgvRingInstallStation = 0,
[Description("1#工位RIFD触发")]
Rgv1Station,

@ -8,5 +8,12 @@ namespace HighWayIot.Plc.PlcHelper
{
public class BasePlcHelper
{
public PlcConnect PlcInstance = PlcConnect.Instance;
public BasePlcHelper()
{
}
}
}

@ -0,0 +1,47 @@
using HighWayIot.Plc.PlcEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Plc.PlcHelper
{
public class WorkStationHelper
{
/// <summary>
/// RFID10小车工位识别点位写入
/// </summary>
/// <param name="rgvStation"></param>
/// <returns></returns>
public bool WriteStationSingal(RgvStationEnum rgvStation, int deviceNo)
{
int point = 0x600;
point += deviceNo * 32;
point += (int)rgvStation;
bool result = PlcConnect.PlcWrite($"B{point.ToString("X")}", true, DataTypeEnum.Bool).IsSuccess;
return result;
}
/// <summary>
/// RFID固定工位识别点位读取
/// </summary>
/// <param name="rgvStation"></param>
/// <returns></returns>
public bool[] ReadStationSingal()
{
bool[] result = new bool[17];
for (int i = 0x230; i <= 0x240; i++)
{
int j = 0;
result[j] = PlcConnect.ReadBool($"B{i.ToString("X")}");
j++;
}
return result;
}
}
}

@ -1,22 +0,0 @@
using HighWayIot.Plc.PlcEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Plc.PlcHelper
{
public class WorkStationWrite
{
/// <summary>
/// RFID工位识别写入
/// </summary>
/// <param name="rgvStation"></param>
/// <returns></returns>
public bool WriteStationSingal(RgvStationEnum rgvStation)
{
return false;
}
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Winform.Business
{
public class WorkStationBusiness
{
}
}
Loading…
Cancel
Save