This commit is contained in:
xyy
2026-05-09 14:34:05 +08:00
parent 5928600a84
commit dd36debb8d
6 changed files with 19 additions and 14 deletions

View File

@@ -2,13 +2,12 @@
<configuration> <configuration>
<appSettings> <appSettings>
<!--压力PLC--> <!--压力PLC-->
<!--<add key="PLC1_IP" value="192.168.1.100"/>--> <add key="PLC1_IP" value="192.168.1.11"/>
<add key="PLC1_IP" value="127.0.0.1"/> <add key="PLC1_Port" value="503"/>
<add key="PLC1_Port" value="502"/>
<!--二氧化碳PLC--> <!--二氧化碳PLC-->
<!--<add key="PLC2_IP" value="192.168.1.100"/>--> <add key="PLC2_IP" value="192.168.1.10"/>
<add key="PLC2_IP" value="127.0.0.1"/>
<add key="PLC2_Port" value="502"/> <add key="PLC2_Port" value="502"/>
<add key="Language" value="zh-CN"/> <add key="Language" value="zh-CN"/>

View File

@@ -128,7 +128,7 @@
<TextBlock Text="{DynamicResource Deformation1}" VerticalAlignment="Center" Foreground="Black" Margin="-60"/> <TextBlock Text="{DynamicResource Deformation1}" VerticalAlignment="Center" Foreground="Black" Margin="-60"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<TextBox Name="FowlTxt1" Width="80" Style="{StaticResource MyTextBoxStyle}" Foreground="Black" IsReadOnly="True"/> <TextBox Name="FowlTxt1" Width="120" Style="{StaticResource MyTextBoxStyle}" Foreground="Black" IsReadOnly="True"/>
<TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black" Margin="5,0,0,0"/> <TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black" Margin="5,0,0,0"/>
</StackPanel> </StackPanel>

View File

@@ -168,15 +168,15 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0,20"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0,20">
<StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" Width="Auto" HorizontalAlignment="Center">
<TextBlock Text="{DynamicResource TestDisplacement}" FontWeight="Bold" Width="220" TextAlignment="Right"/> <TextBlock Text="{DynamicResource TestDisplacement}" FontWeight="Bold" Width="220" TextAlignment="Right"/>
<TextBlock x:Name="recordOpenTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="10,0" Width="80" TextAlignment="Center"/> <TextBlock x:Name="recordOpenTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="0,0" Width="100" TextAlignment="Center"/>
<TextBlock Text=" pa" VerticalAlignment="Center"/> <TextBlock Text=" pa" VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Width="300" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" Width="Auto" HorizontalAlignment="Center">
<TextBlock Text="{DynamicResource TriggerValue}" FontWeight="Bold" Width="220" TextAlignment="Right"/> <TextBlock Text="{DynamicResource TriggerValue}" FontWeight="Bold" Width="220" TextAlignment="Right"/>
<TextBlock Name="recordCloseTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="10,0" Width="80" TextAlignment="Center"/> <TextBlock Name="recordCloseTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="0,0" Width="100" TextAlignment="Center"/>
<TextBlock Text=" pa" VerticalAlignment="Center"/> <TextBlock Text=" pa" VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@@ -1026,7 +1026,7 @@ namespace ShanghaiEnvironmentalTechnology
string invalidData = currentLanguage == "en-US" ? "Invalid flow or pressure value" : "流量或压力值格式不正确,请检查输入"; string invalidData = currentLanguage == "en-US" ? "Invalid flow or pressure value" : "流量或压力值格式不正确,请检查输入";
string noData = currentLanguage == "en-US" ? "No data to export" : "防室息阀压力表中无数据,无法导出"; string noData = currentLanguage == "en-US" ? "No data to export" : "防室息阀压力表中无数据,无法导出";
string exportSuccess = currentLanguage == "en-US" ? "Export success" : "数据已成功导出到Excel"; string exportSuccess = currentLanguage == "en-US" ? "Export success" : "数据已成功导出到Excel";
string exportFail = currentLanguage == "en-US" ? "Export failed" : "Excel导出失败请检查文件是否被占用"; //string exportFail = currentLanguage == "en-US" ? "Export failed" : "Excel导出失败请检查文件是否被占用";
if (!IsModbusConnected()) if (!IsModbusConnected())
{ {
@@ -1065,7 +1065,7 @@ namespace ShanghaiEnvironmentalTechnology
} }
else else
{ {
MessageBox.Show(exportFail, currentLanguage == "en-US" ? "Error" : "错误", MessageBoxButton.OK, MessageBoxImage.Error); //MessageBox.Show(exportFail, currentLanguage == "en-US" ? "Error" : "错误", MessageBoxButton.OK, MessageBoxImage.Error);
} }
} }

View File

@@ -299,7 +299,7 @@
<Button Content="{DynamicResource Deformation}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_2"/> <Button Content="{DynamicResource Deformation}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_2"/>
<Button Name="TestStartButton" Content="{DynamicResource Maximumforcevaluetestresult(N)}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/> <Button Name="TestStartButton" Content="{DynamicResource Maximumforcevaluetestresult(N)}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/>
<Button Content="{DynamicResource Deformation test results}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_3"/> <Button Content="{DynamicResource Deformation test results}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_3"/>
<Button Content="{DynamicResource Peak force test result(N)}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_7" Width="201"/> <Button Content="{DynamicResource ViewReport}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_7" Width="201"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10">

View File

@@ -687,6 +687,12 @@ namespace ShanghaiEnvironmentalTechnology
{ {
string lang = ConfigurationManager.AppSettings["Language"] ?? "zh-CN"; string lang = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
if (_modbusMaster == null)
{
// ShowError(lang == "en-US" ? "Modbus TCP not connected" : "Modbus TCP 未连接");
return;
}
if (!IsModbusConnected()) if (!IsModbusConnected())
{ {
InitializeModbusTcp(); InitializeModbusTcp();