using CCDCount.DLL; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace CCDCountWpf { public class PlcMessageShowBindingClass : INotifyPropertyChanged { /// /// 使能完成 /// private bool enableCompletion; public bool EnableCompletion { get { return enableCompletion; } set { enableCompletion = value; OnPropertyChanged("EnableCompletion"); } } /// /// 归零完成 /// private bool returnToZeroCompletion; public bool ReturnToZeroCompletion { get { return returnToZeroCompletion; } set { returnToZeroCompletion = value; OnPropertyChanged("ReturnToZeroCompletion"); } } /// /// 停止完成 /// private bool stopCompletion; public bool StopCompletion { get { return stopCompletion; } set { stopCompletion = value; OnPropertyChanged("StopCompletion"); } } /// /// 速度运行 /// private bool speedRunning; public bool SpeedRunning { get { return speedRunning; } set { speedRunning = value; OnPropertyChanged("SpeedRunning"); } } /// /// 回零中 /// private bool returnToZero; public bool ReturnToZero { get { return returnToZero; } set { returnToZero = value; OnPropertyChanged("ReturnToZero"); } } /// /// 中转阀开定位完成 /// private bool transferValveOpenCompletion; public bool TransferValveOpenCompletion { get { return transferValveOpenCompletion; } set { transferValveOpenCompletion = value; OnPropertyChanged("TransferValveOpenCompletion"); } } /// /// 中转阀关定位完成 /// private bool transferValveCloseCompletion; public bool TransferValveCloseCompletion { get { return transferValveCloseCompletion; } set { transferValveCloseCompletion = value; OnPropertyChanged("TransferValveCloseCompletion"); } } /// /// 允许数据交换 /// private bool allowsDataExchange; public bool AllowsDataExchange { get { return allowsDataExchange; } set { allowsDataExchange = value; OnPropertyChanged("AllowsDataExchange"); } } /// /// 暂停数据交换 /// private bool pauseDataExchange; public bool PauseDataExchange { get { return pauseDataExchange; } set { pauseDataExchange = value; OnPropertyChanged("PauseDataExchange"); } } /// /// 缓存计数延迟完成 /// private bool cacheCountDelayed; public bool CacheCountDelayed { get { return cacheCountDelayed; } set { cacheCountDelayed = value; OnPropertyChanged("CacheCountDelayed"); } } /// /// 使能 /// private bool enable; public bool Enable { get { return enable; } set { enable = value; OnPropertyChanged("Enable"); } } /// /// 送瓶轮使能完成 /// private bool bottleFeedingWheelEnableCompletion; public bool BottleFeedingWheelEnableCompletion { get { return bottleFeedingWheelEnableCompletion; } set { bottleFeedingWheelEnableCompletion = value; OnPropertyChanged("BottleFeedingWheelEnableCompletion"); } } /// /// 送瓶轮停止完成 /// private bool bottleFeedingWheelStopCompletion; public bool BottleFeedingWheelStopCompletion { get { return bottleFeedingWheelStopCompletion; } set { bottleFeedingWheelStopCompletion = value; OnPropertyChanged("BottleFeedingWheelStopCompletion"); } } /// /// 速度模式运行速度 /// private float speedModeRunningSpeed; public string SpeedModeRunningSpeed { get { return speedModeRunningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteSpeedModeRunningSpeed(result)) { speedModeRunningSpeed = result; } OnPropertyChanged("SpeedModeRunningSpeed"); } } } /// /// 点动速度 /// private float jogSpeed; public string JogSpeed { get { return jogSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if(PlcSettingMessageBus.pLCManagement.WriteJogSpeed(result)) { jogSpeed = result; } OnPropertyChanged("JogSpeed"); } } } /// /// 瓶装设定值 /// private ushort bottValueSet; public ushort BottValueSet { get { return bottValueSet; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottValueSet(value)) { bottValueSet = value; } OnPropertyChanged("BottValueSet"); } } /// /// 中转阀打开速度 /// private float transferValveOpeningSpeed; public string TransferValveOpeningSpeed { get { return transferValveOpeningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if(PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningSpeed(result)) { transferValveOpeningSpeed = result; } OnPropertyChanged("TransferValveOpeningSpeed"); } } } /// /// 中转阀打开时间 /// private UInt32 transferValveOpeningTime; public UInt32 TransferValveOpeningTime { get { return transferValveOpeningTime; } set { if (PlcSettingMessageBus.pLCManagement.WriteTransferValveOpeningTime(value)) { transferValveOpeningTime = value; } OnPropertyChanged("TransferValveOpeningTime"); } } /// /// 罐装减速值 /// private ushort bottingDecelerationValue; public ushort BottingDecelerationValue { get { return bottingDecelerationValue; } set { if (PlcSettingMessageBus.pLCManagement.WriteBottingDecelerationValue(value)) { bottingDecelerationValue = value; } OnPropertyChanged("BottingDecelerationValue"); } } /// /// 缓存减速值 /// private UInt16 cacheDecelerationValue { get; set;} public UInt16 CacheDecelerationValue { get { return cacheDecelerationValue; } set { if (PlcSettingMessageBus.pLCManagement.WriteCacheDecelerationValue(value)) { cacheDecelerationValue = value; } OnPropertyChanged("CacheDecelerationValue"); } } /// /// 缓存计数延迟时间 /// private UInt32 cacheCountDelayTiming; public UInt32 CacheCountDelayTiming { get { return cacheCountDelayTiming; } set { if (PlcSettingMessageBus.pLCManagement.WriteCacheCountDelayTiming(value)) { cacheCountDelayTiming = value; } OnPropertyChanged("CacheCountDelayTiming"); } } /// /// 缓存停机值 /// private ushort cacheShutdownValue; public ushort CacheShutdownValue { get { return cacheShutdownValue; } set { if (PlcSettingMessageBus.pLCManagement.WriteCacheShutdownValue(value)) { cacheShutdownValue = value; } OnPropertyChanged("CacheShutdownValue"); } } /// /// 罐装料筒震台高速值 /// private ushort bottingMaterialCylinderVibrationTableHighSpeedValue; public ushort BottingMaterialCylinderVibrationTableHighSpeedValue { get { return bottingMaterialCylinderVibrationTableHighSpeedValue; } set { if (PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableHighSpeedValue(value)) { bottingMaterialCylinderVibrationTableHighSpeedValue = value; } OnPropertyChanged("BottingMaterialCylinderVibrationTableHighSpeedValue"); } } /// /// 罐装过滤震台高速值 /// private ushort bottingFilterVibrationTableHighSpeedValue; public ushort BottingFilterVibrationTableHighSpeedValue { get { return bottingFilterVibrationTableHighSpeedValue; } set { if (PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableHighSpeedValue(value)) { bottingFilterVibrationTableHighSpeedValue = value; } OnPropertyChanged("BottingFilterVibrationTableHighSpeedValue"); } } /// /// 罐装计数震台高速值 /// private ushort bottingCountVibrationTableHighSpeedValue; public ushort BottingCountVibrationTableHighSpeedValue { get { return bottingCountVibrationTableHighSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableHighSpeedValue(value)) { bottingCountVibrationTableHighSpeedValue = value; } OnPropertyChanged("BottingCountVibrationTableHighSpeedValue"); } } /// /// 罐装料筒震台减速值 /// private ushort bottingMaterialCylinderVibrationTableDecelerationSpeedValue; public ushort BottingMaterialCylinderVibrationTableDecelerationSpeedValue { get { return bottingMaterialCylinderVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottingMaterialCylinderVibrationTableDecelerationSpeedValue(value)) { bottingMaterialCylinderVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("BottingMaterialCylinderVibrationTableDecelerationSpeedValue"); } } /// /// 罐装过滤震台减速值 /// private ushort bottingFilterVibrationTableDecelerationSpeedValue; public ushort BottingFilterVibrationTableDecelerationSpeedValue { get { return bottingFilterVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottingFilterVibrationTableDecelerationSpeedValue(value)) { bottingFilterVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("BottingFilterVibrationTableDecelerationSpeedValue"); } } /// /// 罐装计数震台减速值 /// private ushort bottingCountVibrationTableDecelerationSpeedValue; public ushort BottingCountVibrationTableDecelerationSpeedValue { get { return bottingCountVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottingCountVibrationTableDecelerationSpeedValue(value)) { bottingCountVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("BottingCountVibrationTableDecelerationSpeedValue"); } } /// /// 缓存料筒震台高速值 /// private ushort cacheMaterialCylinderVibrationTableHighSpeedValue; public ushort CacheMaterialCylinderVibrationTableHighSpeedValue { get { return cacheMaterialCylinderVibrationTableHighSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableHighSpeedValue(value)) { cacheMaterialCylinderVibrationTableHighSpeedValue = value; } OnPropertyChanged("CacheMaterialCylinderVibrationTableHighSpeedValue"); } } /// /// 缓存过滤震台高速值 /// private ushort cacheFilterVibrationTableHighSpeedValue; public ushort CacheFilterVibrationTableHighSpeedValue { get { return cacheFilterVibrationTableHighSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableHighSpeedValue(value)) { cacheFilterVibrationTableHighSpeedValue = value; } OnPropertyChanged("CacheFilterVibrationTableHighSpeedValue"); } } /// /// 缓存计数震台高速值 /// private ushort cacheCountVibrationTableHighSpeedValue; public ushort CacheCountVibrationTableHighSpeedValue { get { return cacheCountVibrationTableHighSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableHighSpeedValue(value)) { cacheCountVibrationTableHighSpeedValue = value; } OnPropertyChanged("CacheCountVibrationTableHighSpeedValue"); } } /// /// 缓存料筒震台减速值 /// private ushort cacheMaterialCylinderVibrationTableDecelerationSpeedValue; public ushort CacheMaterialCylinderVibrationTableDecelerationSpeedValue { get { return cacheMaterialCylinderVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheMaterialCylinderVibrationTableDecelerationSpeedValue(value)) { cacheMaterialCylinderVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("CacheMaterialCylinderVibrationTableDecelerationSpeedValue"); } } /// /// 缓存过滤震台减速值 /// private ushort cacheFilterVibrationTableDecelerationSpeedValue; public ushort CacheFilterVibrationTableDecelerationSpeedValue { get { return cacheFilterVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheFilterVibrationTableDecelerationSpeedValue(value)) { cacheFilterVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("CacheFilterVibrationTableDecelerationSpeedValue"); } } /// /// 缓存计数震台减速值 /// private ushort cacheCountVibrationTableDecelerationSpeedValue; public ushort CacheCountVibrationTableDecelerationSpeedValue { get { return cacheCountVibrationTableDecelerationSpeedValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteCacheCountVibrationTableDecelerationSpeedValue(value)) { cacheCountVibrationTableDecelerationSpeedValue = value; } OnPropertyChanged("CacheCountVibrationTableDecelerationSpeedValue"); } } /// /// 阀门打开延时 /// private UInt32 gateOpeningDelay; public UInt32 GateOpeningDelay { get { return gateOpeningDelay; } set { if(PlcSettingMessageBus.pLCManagement.WriteGateOpeningDelay(value)) { gateOpeningDelay = value; } OnPropertyChanged("GateOpeningDelay"); } } /// /// 回零偏移值 /// private float returnToZeroOffsetValue; public string ReturnToZeroOffsetValue { get { return returnToZeroOffsetValue.ToString("F2"); } set { if (value == "-") { return; } if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetValue(result)) { returnToZeroOffsetValue = result; } OnPropertyChanged("ReturnToZeroOffsetValue"); } } } /// /// 回零偏移速度 /// private float returnToZeroOffsetSpeed; public string ReturnToZeroOffsetSpeed { get { return returnToZeroOffsetSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteReturnToZeroOffsetSpeed(result)) { returnToZeroOffsetSpeed = result; } OnPropertyChanged("ReturnToZeroOffsetSpeed"); } } } /// /// 中转阀关闭速度 /// private float transferValveClosingSpeed; public string TransferValveClosingSpeed { get { return transferValveClosingSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if(PlcSettingMessageBus.pLCManagement.WriteTransferValveClosingSpeed(result)) { transferValveClosingSpeed = result; } OnPropertyChanged("TransferValveClosingSpeed"); } } } /// /// 中转阀开位置 /// private float transferValveOpenPosition; public string TransferValveOpenPosition { get { return transferValveOpenPosition.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if(PlcSettingMessageBus.pLCManagement.WriteTransferValveOpenPosition(result)) { transferValveOpenPosition = result; } OnPropertyChanged("TransferValveOpenPosition"); } } } /// /// 中转阀关位置 /// private float transferValveClosePosition; public string TransferValveClosePosition { get { return transferValveClosePosition.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if(PlcSettingMessageBus.pLCManagement.WriteTransferValveClosePosition(result)) { transferValveClosePosition = result; } OnPropertyChanged("TransferValveClosePosition"); } } } /// /// 气阀开延时 /// private UInt32 airValveOpeningDelay; public UInt32 AirValveOpeningDelay { get { return airValveOpeningDelay; } set { if(PlcSettingMessageBus.pLCManagement.WriteAirValveOpeningDelay(value)) { airValveOpeningDelay = value; } OnPropertyChanged("AirValveOpeningDelay"); } } /// /// 装瓶停机值 /// private UInt16 bottlingShutdownValue; public UInt16 BottlingShutdownValue { get { return bottlingShutdownValue; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownValue(value)) { bottlingShutdownValue = value; } OnPropertyChanged("BottlingShutdownValue"); } } /// /// 装瓶停机时间 /// private UInt32 bottlingShutdownTime; public UInt32 BottlingShutdownTime { get { return bottlingShutdownTime; } set { if(PlcSettingMessageBus.pLCManagement.WriteBottlingShutdownTime(value)) { bottlingShutdownTime = value; } OnPropertyChanged("BottlingShutdownTime"); } } /// /// 送瓶轮运行速度 /// private float bottleFeedingWheelRunningSpeed; public string BottleFeedingWheelRunningSpeed { get { return bottleFeedingWheelRunningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelRunningSpeed(result)) { bottleFeedingWheelRunningSpeed = result; } OnPropertyChanged("BottleFeedingWheelRunningSpeed"); } } } /// /// 送瓶轮点动速度 /// private float bottleFeedingWheelJogRunningSpeed; public string BottleFeedingWheelJogRunningSpeed { get { return bottleFeedingWheelJogRunningSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelJogRunningSpeed(result)) { bottleFeedingWheelJogRunningSpeed = result; } OnPropertyChanged("BottleFeedingWheelJogRunningSpeed"); } } } /// /// 送瓶轮回零偏移值 /// private float bottleFeedingWheelReturnToZeroOffsetValue; public string BottleFeedingWheelReturnToZeroOffsetValue { get { return bottleFeedingWheelReturnToZeroOffsetValue.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroOffsetValue(result)) { bottleFeedingWheelReturnToZeroOffsetValue = result; } OnPropertyChanged("BottleFeedingWheelReturnToZeroOffsetValue"); } } } /// /// 送瓶轮回零速度 /// private float bottleFeedingWheelReturnToZeroSpeed; public string BottleFeedingWheelReturnToZeroSpeed { get { return bottleFeedingWheelReturnToZeroSpeed.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroSpeed(result)) { bottleFeedingWheelReturnToZeroSpeed = result; } OnPropertyChanged("BottleFeedingWheelReturnToZeroSpeed"); } } } /// /// 送瓶轮定位长度 /// private float bottleFeedingWheelPositionLength; public string BottleFeedingWheelPositionLength { get { return bottleFeedingWheelPositionLength.ToString("F2"); } set { if (float.TryParse(value, out float result)) { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPositionLength(result)) { bottleFeedingWheelPositionLength = result; } OnPropertyChanged("BottleFeedingWheelPositionLength"); } } } /// /// 送瓶轮暂停时间 /// private UInt32 bottleFeedingWheelPauseTime; public UInt32 BottleFeedingWheelPauseTime { get { return bottleFeedingWheelPauseTime; } set { if (PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPauseTime(value)) { bottleFeedingWheelPauseTime = value; } OnPropertyChanged("BottleFeedingWheelPauseTime"); } } /// /// 下料延时 /// private UInt32 delayBlanking; public UInt32 DelayBlanking { get { return delayBlanking; } set { if (PlcSettingMessageBus.pLCManagement.WriteDelayBlanking(value)) { delayBlanking = value; } OnPropertyChanged("DelayBlanking"); } } //数据绑定核心实现 public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }