终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

59 lines
2.5 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. using System.Threading;
  10. namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
  11. {
  12. public class SiemensDeviceStatus
  13. {
  14. public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
  15. public bool IsConnected => Siemens_PLC_S7.IsConnected;
  16. public void Init()
  17. {
  18. if (IsConnected)
  19. {
  20. ThreadManage.GetInstance().StartLong(new Action(() =>
  21. {
  22. var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201);
  23. var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231);
  24. var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261);
  25. var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
  26. if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe)
  27. {
  28. Start.Order_Request = true;
  29. this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
  30. }
  31. if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK))
  32. {
  33. ActionManage.GetInstance.Send("SiemensRecipeRecive", Start);
  34. Start.Order_Request_ACK = false;
  35. this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
  36. }
  37. if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
  38. {
  39. ActionManage.GetInstance.Send("AGV放货架到位",Status);
  40. Status.AgvRequestPut = false;
  41. this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
  42. }
  43. if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet))
  44. {
  45. ActionManage.GetInstance.Send("AGV取货架到位", Status);
  46. Status.AgvRequestGet = false;
  47. this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
  48. }
  49. Thread.Sleep(10);
  50. }),"监听服务数据");
  51. }
  52. }
  53. }
  54. }