终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

74 строки
2.3 KiB

  1. using BPASmartClient.Helper;
  2. using BPASmartClient.Modbus;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using BPASmartClient.S7Net;
  9. namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
  10. {
  11. public class HKDeviceStatus
  12. {
  13. public SiemensHelper HK_PLC_S7 = new SiemensHelper();
  14. public bool IsConnected => HK_PLC_S7.IsConnected;
  15. public void Init()
  16. {
  17. if (IsConnected)
  18. {
  19. ThreadManage.GetInstance().StartLong(new Action(() =>
  20. {
  21. }),"信号收发处理");
  22. }
  23. }
  24. /// <summary>
  25. /// 单个配料机配料完成
  26. /// </summary>
  27. /// <param name="value"></param>
  28. public void SingleDosing(uint value)
  29. {
  30. if (IsConnected)
  31. {
  32. HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
  33. HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
  34. }
  35. }
  36. /// <summary>
  37. /// 复位plc允许接料信号
  38. /// </summary>
  39. public void AllowDosingSignReset()
  40. {
  41. HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
  42. }
  43. /// <summary>
  44. /// 复位plc到达某料仓信号
  45. /// </summary>
  46. public void StockStateSignReset()
  47. {
  48. HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0);
  49. }
  50. /// <summary>
  51. /// 复位一个配方配料完成信号
  52. /// </summary>
  53. public void RecipeDosingFinishReset()
  54. {
  55. HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
  56. }
  57. /// <summary>
  58. /// 下发配方数据
  59. /// </summary>
  60. /// <param name="BarrelNum">单个桶的编号</param>
  61. /// <param name="StockBinLocation">单个桶对应的料仓位置</param>
  62. public void StockBinPar(uint BarrelNum, ushort StockBinLocation)
  63. {
  64. if (IsConnected)
  65. {
  66. HK_PLC_S7.Write(HKPlcCommAddress.BarrelNumToPLC, BarrelNum);
  67. HK_PLC_S7.Write(HKPlcCommAddress.StockBinLocationToPLC, StockBinLocation);
  68. }
  69. }
  70. }
  71. }