|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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(() =>
- {
-
- }),"信号收发处理");
- }
- }
- /// <summary>
- /// 单个配料机配料完成
- /// </summary>
- /// <param name="value"></param>
- public void SingleDosing(uint value)
- {
- if (IsConnected)
- {
- HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
- HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
- }
- }
- /// <summary>
- /// 复位plc允许接料信号
- /// </summary>
- public void AllowDosingSignReset()
- {
- HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
- }
- /// <summary>
- /// 复位plc到达某料仓信号
- /// </summary>
- public void StockStateSignReset()
- {
- HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0);
- }
- /// <summary>
- /// 复位一个配方配料完成信号
- /// </summary>
- public void RecipeDosingFinishReset()
- {
- HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
- }
- /// <summary>
- /// 下发配方数据
- /// </summary>
- /// <param name="BarrelNum">单个桶的编号</param>
- /// <param name="StockBinLocation">单个桶对应的料仓位置</param>
- public void StockBinPar(uint BarrelNum, ushort StockBinLocation)
- {
- if (IsConnected)
- {
- HK_PLC_S7.Write(HKPlcCommAddress.BarrelNumToPLC, BarrelNum);
- HK_PLC_S7.Write(HKPlcCommAddress.StockBinLocationToPLC, StockBinLocation);
- }
- }
- }
- }
|