using HybirdFrameworkDriver.ModbusTcpMaster; using HybirdFrameworkServices.Plc; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using Service.Cloud.Msg.Cloud.Req; using Service.Init.Entity; using Service.Plc; namespace Service.Execute.Api; public class PlcApi { private const int TimeSpan = 60; /// /// PLC是否连接 /// public static bool con; /// /// 数据有效时间。单位秒 /// static int DataTimeSeconds = 2; /// /// 数据刷新时间 /// public static DateTime DataValidityTime = DateTime.Now; /// /// 是否远程模式 /// /// public static bool IsRemote() { return PlcMgr.IsRemote(); } /// /// 入口雷达检测 /// /// public static bool EntranceRadar() { return PlcMgr.EntranceRadar(); } /// /// 出口雷达检测 /// /// public static bool ExitRadar() { return PlcMgr.ExitRadar(); } /// /// 写入口灯 /// 红灯:1020 /// 绿灯:1000 /// /// /// public static bool WriteEntranceLamp(int data) { return PlcMgr.WriteEntranceLamp((byte)data); } /// /// 写出口灯 /// 红灯:1020 /// 绿灯:1000 /// /// /// public static bool WriteExistLamp(int data) { return PlcMgr.WriteExistLamp(data); } /// /// 下发选包 /// /// 入仓位,仓位号 /// 出仓位,仓位号 /// public static bool DistributeSelectPack(string inBinNo, string outBinNo) { return PlcMgr.DistributeSelectPack(inBinNo, outBinNo); } /// /// 下发启动换电 /// /// public static bool StartSwapping() { return PlcMgr.StartSwapping(); } /// /// 查看拍照状态 /// /// public static byte ChannelStatus() { return PlcMgr.ChannelStatus(); } /// /// 读plc任务状态 /// /// 6未连接 public static int ReadPlcTaskStatus() { return PlcMgr.ReadPlcTaskStatus(); } }