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