Browse Source

20250814001 PLC新增的运行操作绑定完成

向羽 孟 8 tháng trước cách đây
mục cha
commit
4ae3eaa11b

+ 28 - 0
CCDCountWpf/PlcMessageShowBindingClass.cs

@@ -165,6 +165,34 @@ namespace CCDCountWpf
             }
         }
 
+        /// <summary>
+        /// 送瓶轮使能完成
+        /// </summary>
+        private bool bottleFeedingWheelEnableCompletion;
+        public bool BottleFeedingWheelEnableCompletion
+        {
+            get { return bottleFeedingWheelEnableCompletion; }
+            set
+            {
+                bottleFeedingWheelEnableCompletion = value;
+                OnPropertyChanged("BottleFeedingWheelEnableCompletion");
+            }
+        }
+
+        /// <summary>
+        /// 送瓶轮停止完成
+        /// </summary>
+        private bool bottleFeedingWheelStopCompletion;
+        public bool BottleFeedingWheelStopCompletion
+        {
+            get { return bottleFeedingWheelStopCompletion; }
+            set
+            {
+                bottleFeedingWheelStopCompletion = value;
+                OnPropertyChanged("BottleFeedingWheelStopCompletion");
+            }
+        }
+
         /// <summary>
         /// 速度模式运行速度
         /// </summary>

+ 5 - 0
CCDCountWpf/WpfFrom/MainWindow.xaml.cs

@@ -164,6 +164,7 @@ namespace CCDCountWpf
                     item.DisposeCamera();
                 }
             }
+            OnScreenKeyboard.KillTabTipProcess();
             StopUpdataShowDataThread();
             FaultLog.FaultError -= ShowErrorMesPage;
             Environment.Exit(0);
@@ -563,6 +564,10 @@ namespace CCDCountWpf
             plcData.PauseDataExchange;
             PlcSettingMessageBus.PlcMessageShowBindage.CacheCountDelayed =
             plcData.CacheCountDelayed;
+            PlcSettingMessageBus.PlcMessageShowBindage.BottleFeedingWheelEnableCompletion =
+            plcData.BottleFeedingWheelEnableCompletion;
+            PlcSettingMessageBus.PlcMessageShowBindage.BottleFeedingWheelStopCompletion =
+            plcData.BottleFeedingWheelStopCompletion;
         }
 
         private void UpdatePlcPara()

+ 3 - 2
CCDCountWpf/WpfFrom/UserLoginWindow.xaml.cs

@@ -46,6 +46,7 @@ namespace CCDCountWpf
 
         private void UserCancelBtn_Click(object sender, RoutedEventArgs e)
         {
+            OnScreenKeyboard.KillTabTipProcess();
             this.Close();
             Environment.Exit(0);
         }
@@ -62,12 +63,12 @@ namespace CCDCountWpf
 
         private void UserNameTbx_GotFocus(object sender, RoutedEventArgs e)
         {
-            OnScreenKeyboard.Show();
+            //OnScreenKeyboard.Show();
         }
 
         private void UserPassTbx_GotFocus(object sender, RoutedEventArgs e)
         {
-            OnScreenKeyboard.Show();
+            //OnScreenKeyboard.Show();
         }
     }
 }

+ 61 - 18
CCDCountWpf/WpfPage/PlcSettingPage.xaml

@@ -17,31 +17,44 @@
             <Button x:Name="PlcParaBtn" Content="PLC参数设置" HorizontalAlignment="Left" Margin="330,0,0,0" Width="165" Click="PlcParaBtn_Click" />
         </Grid>
         <Grid x:Name="ShowGrid" Grid.Row="1">
-            <Grid x:Name="PLCRuningSetting" Visibility="Collapsed">
+            <Grid x:Name="PLCRuningSetting" Visibility="Visible">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="*"/>
                     <ColumnDefinition Width="150"/>
                 </Grid.ColumnDefinitions>
                 <StackPanel Orientation="Vertical" Grid.Column="0">
                     <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
-                        <Button Content="使能" Margin="60,0,0,0" Width="80" Height="40" Click="Button_Click"/>
+                        <Button Content="使能" Margin="40,0,0,0" Width="90" Height="40" Click="Button_Click"/>
+                        <Button x:Name="InitiateBtn" Content="PLC启动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="InitiateBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="InitiateBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="StopBtn" Content="PLC停止" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="StopBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="StopBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="ReturnToZeroBtn" Content="回零" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="ReturnToZeroBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ReturnToZeroBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="RepositionBtn" Content="复位" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="RepositionBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="RepositionBtn_PreviewMouseLeftButtonUp"/>
                     </StackPanel>
                     <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
-                        <Button x:Name="InitiateBtn" Content="PLC启动" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="InitiateBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="InitiateBtn_PreviewMouseLeftButtonUp"/>
-                        <Button x:Name="StopBtn" Content="PLC停止" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="StopBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="StopBtn_PreviewMouseLeftButtonUp"/>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
-                        <Button x:Name="ReturnToZeroBtn" Content="回零" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="ReturnToZeroBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ReturnToZeroBtn_PreviewMouseLeftButtonUp"/>
-                        <Button x:Name="RepositionBtn" Content="复位" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="RepositionBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="RepositionBtn_PreviewMouseLeftButtonUp"/>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
-                        <Button x:Name="ForwardRotatingJogBtn" Content="正转点动" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="ForwardRotatingJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ForwardRotatingJogBtn_PreviewMouseLeftButtonUp"/>
-                        <Button x:Name="ReversalReverseJogBtn" Content="反转点动" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="ReversalReverseJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ReversalReverseJogBtn_PreviewMouseLeftButtonUp"/>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal" Margin="0,30,0,0">
-                        <Button x:Name="ShaftStopsBtn" Content="轴停止" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="ShaftStopsBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ShaftStopsBtn_PreviewMouseLeftButtonUp"/>
-                        <Button x:Name="SpeedRunBtn" Content="速度运行" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="SpeedRunBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="SpeedRunBtn_PreviewMouseLeftButtonUp"/>
-                        <Button x:Name="EquipmentOperationBtn" Content="设备运行" HorizontalAlignment="Left" Margin="60,0,0,0" Height="40" Width="80" PreviewMouseLeftButtonDown="EquipmentOperationBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="EquipmentOperationBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="ForwardRotatingJogBtn" Content="正转点动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="ForwardRotatingJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ForwardRotatingJogBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="ReversalReverseJogBtn" Content="反转点动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="ReversalReverseJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ReversalReverseJogBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="ShaftStopsBtn" Content="轴停止" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="ShaftStopsBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="ShaftStopsBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="SpeedRunBtn" Content="速度运行" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="SpeedRunBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="SpeedRunBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="EquipmentOperationBtn" Content="设备运行" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="EquipmentOperationBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="EquipmentOperationBtn_PreviewMouseLeftButtonUp"/>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,30,60,0">
+                        <Button x:Name="LevelOneVibrationTableBtn" Content="一级震台启动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="LevelOneVibrationTableBtn_Click"/>
+                        <Button x:Name="LevelTwoVibrationTableBtn" Content="二级震台启动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="LevelTwoVibrationTableBtn_Click"/>
+                        <Button x:Name="LevelThreeVibrationTableBtn" Content="三级震台启动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="LevelThreeVibrationTableBtn_Click"/>
+                        <Button x:Name="DeviceUpBtn" Content="设备上升" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="DeviceUpBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="DeviceUpBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="DeviceDownBtn" Content="设备下降" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="DeviceDownBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="DeviceDownBtn_PreviewMouseLeftButtonUp"/>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,30,60,0">
+                        <Button x:Name="TransferStartBtn" Content="传送带启动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="TransferStartBtn_Click"/>
+                        <Button x:Name="AirValveCloseBtn" Content="气锁关" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="AirValveCloseBtn_Click"/>
+                        <Button x:Name="BottleFeedingWheelResetBtn" Content="送瓶轮复位" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="BottleFeedingWheelResetBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="BottleFeedingWheelResetBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="BottleFeedingWheelReturnToZeroBtn" Content="送瓶轮回零" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="BottleFeedingWheelReturnToZeroBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="BottleFeedingWheelReturnToZeroBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="BottleFeedingWheelShaftStopsBtn" Content="送瓶轮轴停止" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="BottleFeedingWheelShaftStopsBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="BottleFeedingWheelShaftStopsBtn_PreviewMouseLeftButtonUp"/>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,30,60,0">
+                        <Button x:Name="BottleFeedingWheelPositiveRotationJogBtn" Content="送瓶轮正转点动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="BottleFeedingWheelPositiveRotationJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="BottleFeedingWheelPositiveRotationJogBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="BottleFeedingWheelReverseRotationJogBtn" Content="送瓶轮反转点动" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" PreviewMouseLeftButtonDown="BottleFeedingWheelReverseRotationJogBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="BottleFeedingWheelReverseRotationJogBtn_PreviewMouseLeftButtonUp"/>
+                        <Button x:Name="BottleFeedingWheelEnableBtn" Content="送瓶轮使能" HorizontalAlignment="Left" Margin="40,0,0,0" Height="40" Width="90" Click="BottleFeedingWheelEnableBtn_Click"/>
                     </StackPanel>
                 </StackPanel>
                 <StackPanel Orientation="Vertical" Grid.Column="1">
@@ -210,13 +223,43 @@
                             </Ellipse.Style>
                         </Ellipse>
                     </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                        <Label Content="送瓶轮使能完成:"></Label>
+                        <Ellipse Width="20" Height="20" Margin="12,0,0,0">
+                            <Ellipse.Style>
+                                <Style TargetType="Ellipse">
+                                    <Setter Property="Fill" Value="Red" />
+                                    <Style.Triggers>
+                                        <DataTrigger Binding="{Binding BottleFeedingWheelEnableCompletion}" Value="True">
+                                            <Setter Property="Fill" Value="Green" />
+                                        </DataTrigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Ellipse.Style>
+                        </Ellipse>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                        <Label Content="送瓶轮停止完成:"></Label>
+                        <Ellipse Width="20" Height="20" Margin="12,0,0,0">
+                            <Ellipse.Style>
+                                <Style TargetType="Ellipse">
+                                    <Setter Property="Fill" Value="Red" />
+                                    <Style.Triggers>
+                                        <DataTrigger Binding="{Binding BottleFeedingWheelStopCompletion}" Value="True">
+                                            <Setter Property="Fill" Value="Green" />
+                                        </DataTrigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Ellipse.Style>
+                        </Ellipse>
+                    </StackPanel>
                 </StackPanel>
             </Grid>
             <Grid x:Name="PLCTestSetting" Visibility="Collapsed">
                 <StackPanel Orientation="Vertical">
                 </StackPanel>
             </Grid>
-            <Grid x:Name="PlcParaSetting" Visibility="Visible">
+            <Grid x:Name="PlcParaSetting" Visibility="Collapsed">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="*"/>
                     <ColumnDefinition Width="*"/>

+ 100 - 0
CCDCountWpf/WpfPage/PlcSettingPage.xaml.cs

@@ -616,5 +616,105 @@ namespace CCDCountWpf.WpfPage
                 PlcSettingMessageBus.PlcMessageShowBindage.BottlingShutdownTime -= 1;
             }
         }
+
+        private void LevelOneVibrationTableBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchLevelOneVibrationTable();
+        }
+
+        private void LevelTwoVibrationTableBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchLevelTwoVibrationTable();
+        }
+
+        private void LevelThreeVibrationTableBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchLevelThreeVibrationTable();
+        }
+
+        private void DeviceUpBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteDeviceUpToTrue();
+        }
+
+        private void DeviceUpBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteDeviceUpToFalse();
+        }
+
+        private void DeviceDownBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteDeviceDownToTrue();
+        }
+
+        private void DeviceDownBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteDeviceDownToFalse();
+        }
+
+        private void TransferStartBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchTransferStart();
+        }
+
+        private void AirValveCloseBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchAirValveClose();
+        }
+
+        private void BottleFeedingWheelResetBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelResetToTrue();
+        }
+
+        private void BottleFeedingWheelResetBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelResetToFalse();
+        }
+
+        private void BottleFeedingWheelReturnToZeroBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroToTrue();
+        }
+
+        private void BottleFeedingWheelReturnToZeroBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReturnToZeroToFalse();
+        }
+
+        private void BottleFeedingWheelShaftStopsBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelShaftStopsToTrue();
+        }
+
+        private void BottleFeedingWheelShaftStopsBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelShaftStopsToFalse();
+        }
+
+        private void BottleFeedingWheelPositiveRotationJogBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPositiveRotationJogToTrue();
+        }
+
+        private void BottleFeedingWheelPositiveRotationJogBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelPositiveRotationJogToFalse();
+        }
+
+        private void BottleFeedingWheelReverseRotationJogBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReverseRotationJogToTrue();
+        }
+
+        private void BottleFeedingWheelReverseRotationJogBtn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.WriteBottleFeedingWheelReverseRotationJogToFalse();
+        }
+
+        private void BottleFeedingWheelEnableBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PlcSettingMessageBus.pLCManagement.SwitchBottleFeedingWheelEnable();
+        }
     }
 }

+ 198 - 1
TestWork.DLL/PLCManagementClass.cs

@@ -2,6 +2,7 @@
 using CCDCount.MODEL.PlcModel;
 using System;
 using System.Linq;
+using System.Security.Cryptography;
 
 namespace CCDCount.DLL
 {
@@ -187,6 +188,151 @@ namespace CCDCount.DLL
             modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 11, values: true);
         }
 
+        /// <summary>
+        /// 写入一级震台启动为True
+        /// </summary>
+        public void SwitchLevelOneVibrationTable()
+        {
+            bool Enable = ReadLevelOneVibrationTable();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 25, values: !Enable);
+        }
+
+        /// <summary>
+        /// 二级震台启动
+        /// </summary>
+        public void SwitchLevelTwoVibrationTable()
+        {
+            bool Enable = ReadLevelTwoVibrationTable();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 26, values: !Enable);
+        }
+
+
+        /// <summary>
+        /// 三级震台启动
+        /// </summary>
+        public void SwitchLevelThreeVibrationTable()
+        {
+            bool Enable = ReadLevelThreeVibrationTable();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 27, values: !Enable);
+        }
+
+
+        /// <summary>
+        /// 设备上升
+        /// </summary>
+        public void WriteDeviceUpToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 28, values: true);
+        }
+
+        public void WriteDeviceUpToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 28, values: false);
+        }
+
+
+        /// <summary>
+        /// 设备下降
+        /// </summary>
+        public void WriteDeviceDownToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 29, values: true);
+        }
+
+        public void WriteDeviceDownToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 29, values: false);
+        }
+
+        /// <summary>
+        /// 传送带启动
+        /// </summary>
+        public void SwitchTransferStart()
+        {
+            bool Enable = ReadTransferStart();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 30, values: !Enable);
+        }
+
+        /// <summary>
+        /// 气锁关
+        /// </summary>
+        public void SwitchAirValveClose()
+        {
+            bool Enable = ReadAirValveClose();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 31, values: !Enable);
+        }
+
+        /// <summary>
+        /// 送瓶轮复位
+        /// </summary>
+        public void WriteBottleFeedingWheelResetToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 32, values: true);
+        }
+
+        public void WriteBottleFeedingWheelResetToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 32, values: false);
+        }
+
+        /// <summary>
+        /// 送瓶轮回零
+        /// </summary>
+        public void WriteBottleFeedingWheelReturnToZeroToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 33, values: true);
+        }
+        public void WriteBottleFeedingWheelReturnToZeroToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 33, values: false);
+        }
+
+        /// <summary>
+        /// 送瓶轮轴停止
+        /// </summary>
+        public void WriteBottleFeedingWheelShaftStopsToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 34, values: true);
+        }
+
+        public void WriteBottleFeedingWheelShaftStopsToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 34, values: false);
+        }
+
+        /// <summary>
+        /// 送瓶轮正转点动
+        /// </summary>
+        public void WriteBottleFeedingWheelPositiveRotationJogToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 36, values: true);
+        }
+        public void WriteBottleFeedingWheelPositiveRotationJogToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 36, values: false);
+        }
+
+        /// <summary>
+        /// 送瓶轮反转点动
+        /// </summary>
+        public void WriteBottleFeedingWheelReverseRotationJogToTrue()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 37, values: true);
+        }
+        public void WriteBottleFeedingWheelReverseRotationJogToFalse()
+        {
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 37, values: false);
+        }
+
+        /// <summary>
+        /// 送瓶轮使能
+        /// </summary>
+        public void SwitchBottleFeedingWheelEnable()
+        {
+            bool Enable = ReadBottleFeedingWheelEnable();
+            modbusTcpClient.WriteCoilsRegister(slaveId: 1, CoilsAddress: 38, values: !Enable);
+        }
+
         /// <summary>
         /// 读取写入完成
         /// </summary>
@@ -293,7 +439,55 @@ namespace CCDCount.DLL
         }
 
         /// <summary>
-        /// 读取所有状态(状态操作后十位)
+        /// 读取一级震台启动
+        /// </summary>
+        public bool ReadLevelOneVibrationTable()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 25, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取二级震台启动
+        /// </summary>
+        public bool ReadLevelTwoVibrationTable()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 26, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取三级震台启动
+        /// </summary>
+        public bool ReadLevelThreeVibrationTable()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 27, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取传送带启动
+        /// </summary>
+        public bool ReadTransferStart()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 30, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取气锁关
+        /// </summary>
+        public bool ReadAirValveClose()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 31, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取送瓶轮使能
+        /// </summary>
+        public bool ReadBottleFeedingWheelEnable()
+        {
+            return modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 38, numRegisters: 1)[0];
+        }
+
+        /// <summary>
+        /// 读取所有状态
         /// </summary>
         public PlcStaticModelClass ReadAllState()
         {
@@ -314,6 +508,9 @@ namespace CCDCount.DLL
                 CacheCountDelayed = Readresult[9],
                 Enable = Readresult[10]
             };
+            Readresult = modbusTcpClient.ReadCoilsRegister(slaveId: 1, startAddress: 35, numRegisters: 5);
+            result.BottleFeedingWheelEnableCompletion = Readresult[0];
+            result.BottleFeedingWheelStopCompletion = Readresult[4];
             return result;
         }
 

+ 10 - 55
TestWork.DLL/Tools/OnScreenKeyboardClass.cs

@@ -25,6 +25,9 @@ namespace CCDCount.DLL.Tools
 
         public static async void Show()
         {
+            // 查找现有窗口
+            IntPtr keyboardWnd = FindWindow("IPTip_Main_Window", null);
+
             // 首先确保没有旧进程
             KillTabTipProcess();
 
@@ -34,9 +37,13 @@ namespace CCDCount.DLL.Tools
             // 启动新实例
             if (StartNewInstance())
             {
-                // 等待窗口出现
-                await Task.Delay(500);
-                IntPtr keyboardWnd = FindWindow("IPTip_Main_Window", null);
+                // 等待窗口出现(使用循环检测,而非固定延迟)
+                for (int i = 0; i < 10; i++)
+                {
+                    await Task.Delay(200);
+                    keyboardWnd = FindWindow("IPTip_Main_Window", null);
+                    if (keyboardWnd != IntPtr.Zero) break;
+                }
 
                 if (keyboardWnd != IntPtr.Zero)
                 {
@@ -46,58 +53,6 @@ namespace CCDCount.DLL.Tools
             }
         }
 
-        private static async Task ShowKeyboardAsync()
-        {
-            // 尝试查找已运行的键盘实例
-            IntPtr keyboardWnd = FindWindow("IPTip_Main_Window", null);
-
-            if (keyboardWnd != IntPtr.Zero && IsWindowVisible(keyboardWnd))
-            {
-                // 键盘已经在显示中
-                SetForegroundWindow(keyboardWnd);
-                return;
-            }
-
-            // 尝试使用COM接口
-            if (TryShowWithCom())
-                return;
-
-            // 启动新实例
-            if (StartNewInstance())
-            {
-                // 等待窗口出现
-                await Task.Delay(300);
-                keyboardWnd = FindWindow("IPTip_Main_Window", null);
-            }
-
-            // 显示窗口
-            if (keyboardWnd != IntPtr.Zero)
-            {
-                ShowWindow(keyboardWnd, SW_RESTORE);
-                SetForegroundWindow(keyboardWnd);
-            }
-        }
-
-        private static bool TryShowWithCom()
-        {
-            try
-            {
-                Type type = Type.GetTypeFromProgID("TabTip.TabTip");
-                if (type != null)
-                {
-                    object instance = Activator.CreateInstance(type);
-                    type.InvokeMember("Show", System.Reflection.BindingFlags.InvokeMethod, null, instance, null);
-                    Marshal.ReleaseComObject(instance);
-                    return true;
-                }
-            }
-            catch
-            {
-                // COM方法失败,继续尝试其他方法
-            }
-            return false;
-        }
-
         private static bool StartNewInstance()
         {
             try

+ 40 - 0
TestWork.MODEL/PlcModel/PlcParaModelClass.cs

@@ -157,5 +157,45 @@ namespace CCDCount.MODEL.PlcModel
         /// 装瓶停机时间
         /// </summary>
         public UInt32 BottlingShutdownTime { get; set; }
+
+        /// <summary>
+        /// 闸门点动
+        /// </summary>
+        public ushort ValveJog { get; set;}
+
+        /// <summary>
+        /// 送瓶轮运行速度
+        /// </summary>
+        public float BottleFeedingWheelRunningSpeed { get; set; }
+
+        /// <summary>
+        /// 送瓶轮点动速度
+        /// </summary>
+        public float BottleFeedingWheelJogRunningSpeed { get; set; }
+
+        /// <summary>
+        /// 送瓶轮回零偏移值
+        /// </summary>
+        public float BottleFeedingWheelReturnToZeroOffsetValue { get; set; }
+
+        /// <summary>
+        /// 送瓶轮回零速度
+        /// </summary>
+        public float BottleFeedingWheelReturnToZeroSpeed { get; set; }
+
+        /// <summary>
+        /// 送瓶轮定位长度
+        /// </summary>
+        public float BottleFeedingWheelPositionLength { get; set; }
+
+        /// <summary>
+        /// 送瓶轮暂停时间
+        /// </summary>
+        public float BottleFeedingWheelPauseTime { get; set; }
+
+        /// <summary>
+        /// 下料延时
+        /// </summary>
+        public float DelayBlanking { get; set; }
     }
 }

+ 10 - 0
TestWork.MODEL/PlcModel/PlcStaticModelClass.cs

@@ -62,5 +62,15 @@ namespace CCDCount.MODEL.PlcModel
         /// 使能
         /// </summary>
         public bool Enable { get; set;}
+
+        /// <summary>
+        /// 送瓶轮使能完成
+        /// </summary>
+        public bool BottleFeedingWheelEnableCompletion { get; set; }
+
+        /// <summary>
+        /// 送瓶轮停止完成
+        /// </summary>
+        public bool BottleFeedingWheelStopCompletion { get; set; }
     }
 }