|
- 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;
- using System.Threading;
- using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.CustomResource.UserControls;
-
- namespace BPASmartClient.JXJFoodSmallStation.Model
- {
- public class WindSendDeviceStatus
- {
- public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
- public bool IsConnected => Siemens_PLC_S7.IsConnected;
-
- public void Init()
- {
- if (IsConnected)
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- var res = this.Siemens_PLC_S7.ReadClass<XL_WindSendData_DB>(5);
- if(RTrig.GetInstance("CurrentCompleteSign").Start(res.CurrentCompleteSign))
- {
- ActionManage.GetInstance.Send("WindSendDosingFinish");
- }
- float weightAlarmStockBin1 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeightOffset;
- float weightAlarmStockBin2 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeightOffset;
- float weightAlarmStockBin3 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeightOffset;
- float weightAlarmStockBin4 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeightOffset;
- float weightAlarmStockBin5 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeightOffset;
- if (res.RawMaterial1_StockBinWeight < weightAlarmStockBin1)
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓1缺料!");
- }
- if (res.RawMaterial2_StockBinWeight < weightAlarmStockBin2)
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓2缺料!");
- }
- if (res.RawMaterial3_StockBinWeight < weightAlarmStockBin3)
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓3缺料!");
- }
- if (res.RawMaterial4_StockBinWeight < weightAlarmStockBin4)
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓4缺料!");
- }
- if (res.RawMaterial5_StockBinWeight < weightAlarmStockBin5)
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓5缺料!");
- }
- Thread.Sleep(10);
- }),"监听服务数据");
- }
- }
- }
- enum DeviceName
- {
- 原料1,
- 原料2,
- 原料3,
- 原料4,
- 原料5
- }
- }
|