using BPASmartClient.Helper; using BPASmartClient.Modbus; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BPASmartClient.S7Net; namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC { public class HKDeviceStatus { public SiemensHelper HK_PLC_S7 = new SiemensHelper(); public bool IsConnected => HK_PLC_S7.IsConnected; public void Init() { if (IsConnected) { ThreadManage.GetInstance().StartLong(new Action(() => { }),"信号收发处理"); } } /// /// 单个配料机配料完成 /// /// public void SingleDosing(uint value) { if (IsConnected) { HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value); HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1); } } /// /// 复位plc允许接料信号 /// public void AllowDosingSignReset() { HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0); } /// /// 复位plc到达某料仓信号 /// public void StockStateSignReset() { HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0); } /// /// 复位一个配方配料完成信号 /// public void RecipeDosingFinishReset() { HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0); } /// /// 下发配方数据 /// /// 单个桶的编号 /// 单个桶对应的料仓位置 public void StockBinPar(uint BarrelNum, ushort StockBinLocation) { if (IsConnected) { HK_PLC_S7.Write(HKPlcCommAddress.BarrelNumToPLC, BarrelNum); HK_PLC_S7.Write(HKPlcCommAddress.StockBinLocationToPLC, StockBinLocation); } } } }