终端一体化运控平台
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.
 
 
 

71 lines
3.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. using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
  11. using BPASmartClient.CustomResource.UserControls.MessageShow;
  12. using BPASmartClient.CustomResource.UserControls;
  13. namespace BPASmartClient.JXJFoodSmallStation.Model
  14. {
  15. public class WindSendDeviceStatus
  16. {
  17. public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
  18. public bool IsConnected => Siemens_PLC_S7.IsConnected;
  19. public void Init()
  20. {
  21. if (IsConnected)
  22. {
  23. ThreadManage.GetInstance().StartLong(new Action(() =>
  24. {
  25. var res = this.Siemens_PLC_S7.ReadClass<XL_WindSendData_DB>(5);
  26. if(RTrig.GetInstance("CurrentCompleteSign").Start(res.CurrentCompleteSign))
  27. {
  28. ActionManage.GetInstance.Send("WindSendDosingFinish");
  29. }
  30. float weightAlarmStockBin1 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeightOffset;
  31. float weightAlarmStockBin2 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeightOffset;
  32. float weightAlarmStockBin3 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeightOffset;
  33. float weightAlarmStockBin4 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeightOffset;
  34. float weightAlarmStockBin5 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeightOffset;
  35. if (res.RawMaterial1_StockBinWeight < weightAlarmStockBin1)
  36. {
  37. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓1缺料!");
  38. }
  39. if (res.RawMaterial2_StockBinWeight < weightAlarmStockBin2)
  40. {
  41. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓2缺料!");
  42. }
  43. if (res.RawMaterial3_StockBinWeight < weightAlarmStockBin3)
  44. {
  45. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓3缺料!");
  46. }
  47. if (res.RawMaterial4_StockBinWeight < weightAlarmStockBin4)
  48. {
  49. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓4缺料!");
  50. }
  51. if (res.RawMaterial5_StockBinWeight < weightAlarmStockBin5)
  52. {
  53. NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓5缺料!");
  54. }
  55. Thread.Sleep(10);
  56. }),"监听服务数据");
  57. }
  58. }
  59. }
  60. enum DeviceName
  61. {
  62. 原料1,
  63. 原料2,
  64. 原料3,
  65. 原料4,
  66. 原料5
  67. }
  68. }