This commit is contained in:
@@ -118,6 +118,7 @@ namespace MembranePoreTester.ViewModels
|
||||
CalculateCommand = new RelayCommand(Calculate);
|
||||
GenerateReportCommand = new RelayCommand(GenerateReport);
|
||||
SelectedLiquid = Liquids[0];
|
||||
Record.SampleType = "中空纤维膜";
|
||||
ReadPlcCommand = new RelayCommand(async () => await ReadPlcAsync());
|
||||
SaveCommand = new RelayCommand(SaveToDatabase);
|
||||
ExportCommand = new RelayCommand(ExportToExcel);
|
||||
@@ -282,6 +283,7 @@ namespace MembranePoreTester.ViewModels
|
||||
using var db = new AppDbContext();
|
||||
db.BubblePointRecords.Add(entity);
|
||||
db.SaveChanges();
|
||||
MessageBox.Show("保存成功!");
|
||||
}
|
||||
|
||||
public void LoadFromDatabase(int recordId)
|
||||
@@ -290,7 +292,7 @@ namespace MembranePoreTester.ViewModels
|
||||
var entity = db.BubblePointRecords.Find(recordId);
|
||||
if (entity == null) return;
|
||||
|
||||
Record.SampleType = entity.SampleType;
|
||||
Record.SampleType = entity.SampleType ?? "中空纤维膜";
|
||||
Record.SampleSpec = entity.SampleSpec;
|
||||
Record.RoomTemperature = entity.RoomTemperature ?? 0;
|
||||
Record.SoakingTime = entity.SoakingTime ?? 0;
|
||||
@@ -336,6 +338,7 @@ namespace MembranePoreTester.ViewModels
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _plcService.WriteCoilAsync(address, true);
|
||||
MessageBox.Show("校准成功!");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -364,6 +367,7 @@ namespace MembranePoreTester.ViewModels
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _plcService.WriteCoilAsync(address, true);
|
||||
MessageBox.Show("校准成功!");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace MembranePoreTester.ViewModels
|
||||
public List<PressureModeItem> InTakeModeList => _inTakeModeList ??= new List<PressureModeItem>
|
||||
{
|
||||
new PressureModeItem { Text = "底部进气", Value = 0 },
|
||||
new PressureModeItem { Text = "顶部进气", Value = 1 }
|
||||
//new PressureModeItem { Text = "顶部进气", Value = 1 }
|
||||
};
|
||||
|
||||
public PressureModeItem SelecteInTakeMode
|
||||
|
||||
@@ -213,8 +213,8 @@ namespace MembranePoreTester.ViewModels
|
||||
private TestLiquid _selectedLiquid;
|
||||
private bool _isCustomLiquid;
|
||||
private double _customSurfaceTension = 30.0;
|
||||
private double _lowerPore = 0.2;
|
||||
private double _upperPore = 0.8;
|
||||
private double _lowerPore = 0.05;
|
||||
private double _upperPore = 0.65;
|
||||
private double _rangePercentage;
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace MembranePoreTester.ViewModels
|
||||
|
||||
public IReadOnlyList<TestLiquid> Liquids => TestLiquid.Predefined;
|
||||
public List<string> PressureUnits => new() { "Pa", "cmHg", "psi" };
|
||||
public List<string> MembraneTypes => new() { "中空纤维膜" };
|
||||
public List<string> MembraneTypes => new() { "平板膜", "中空纤维膜" };
|
||||
|
||||
public TestLiquid SelectedLiquid
|
||||
{
|
||||
@@ -331,6 +331,7 @@ namespace MembranePoreTester.ViewModels
|
||||
CalculateCommand = new RelayCommand(Calculate);
|
||||
GenerateReportCommand = new RelayCommand(GenerateReport);
|
||||
SelectedLiquid = Liquids[0];
|
||||
Record.SampleType = "中空纤维膜";
|
||||
Record.PressureUnit = PressureUnits[0]; // 默认 "Pa"
|
||||
|
||||
ReadPlcCommand = new RelayCommand(async () => await ReadPlcAsync());
|
||||
@@ -842,6 +843,7 @@ namespace MembranePoreTester.ViewModels
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _plcService.WriteCoilAsync(address, true);
|
||||
MessageBox.Show("校准成功!");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -870,6 +872,7 @@ namespace MembranePoreTester.ViewModels
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _plcService.WriteCoilAsync(address, true);
|
||||
MessageBox.Show("校准成功!");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -932,7 +935,7 @@ namespace MembranePoreTester.ViewModels
|
||||
.FirstOrDefault(p => p.Id == recordId);
|
||||
if (entity == null) return;
|
||||
|
||||
Record.SampleType = entity.SampleType;
|
||||
Record.SampleType = entity.SampleType ?? "中空纤维膜";
|
||||
Record.SampleSpec = entity.SampleSpec;
|
||||
Record.RoomTemperature = entity.RoomTemperature;
|
||||
Record.SoakingTime = entity.SoakingTime;
|
||||
@@ -1029,7 +1032,7 @@ namespace MembranePoreTester.ViewModels
|
||||
}
|
||||
|
||||
|
||||
private string _testMode = "湿膜";
|
||||
private string _testMode = "湿膜"; // 默认湿膜
|
||||
public string TestMode
|
||||
{
|
||||
get => _testMode;
|
||||
@@ -1037,7 +1040,7 @@ namespace MembranePoreTester.ViewModels
|
||||
{
|
||||
if (SetProperty(ref _testMode, value))
|
||||
{
|
||||
// 切换测试模式时刷新曲线显示(显示对应模式的历史数据)
|
||||
// 切换测试模式时刷新曲线和相关逻辑
|
||||
UpdatePlot();
|
||||
}
|
||||
}
|
||||
@@ -1171,8 +1174,6 @@ namespace MembranePoreTester.ViewModels
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// PlotModel = model;
|
||||
//}
|
||||
|
||||
@@ -1333,6 +1334,9 @@ namespace MembranePoreTester.ViewModels
|
||||
}
|
||||
|
||||
|
||||
public List<string> TestModes { get; } = new List<string> {"全部", "湿膜", "干膜" };
|
||||
|
||||
|
||||
|
||||
|
||||
private double ConvertFlowByMode(double rawFlow)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="膜类型:"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding MembraneTypes}" SelectedItem="{Binding Record.SampleType}" Margin="5"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" IsEnabled="False" IsReadOnly="True" ItemsSource="{Binding MembraneTypes}" SelectedItem="{Binding Record.SampleType}" Margin="5"/>
|
||||
|
||||
<!--<Label Grid.Row="0" Grid.Column="2" Content="规格:"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Record.SampleSpec}" Margin="5"/>-->
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding PressureModeList}" SelectedItem="{Binding SelectedPressureMode}" Width="80"/>
|
||||
|
||||
<ComboBox ItemsSource="{Binding InTakeModeList}" SelectedItem="{Binding SelecteInTakeMode}" Width="80"/>
|
||||
<ComboBox ItemsSource="{Binding InTakeModeList}" SelectedItem="{Binding SelecteInTakeMode}" Width="80" IsEnabled="False"/>
|
||||
<Button Content="▶ 启动" Command="{Binding StartCommand}" Width="80" Background="#4CAF50"/>
|
||||
<Button Content="⏹ 停止" Command="{Binding StopCommand}" Width="80" Background="#F44336"/>
|
||||
<Button Content="{Binding PressButtonText}" Command="{Binding PressCommand}" Width="80" Background="#FF9800"/>
|
||||
@@ -163,12 +163,12 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="15,0,0,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,10,0">
|
||||
<Label Content="加压上限:" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<Label Content="加压上限(kPa):" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBox x:Name="txtPressureUpper" Width="120" FontSize="16" Height="32" VerticalAlignment="Center" Text="{Binding PressureUpperLimit, UpdateSourceTrigger=LostFocus, StringFormat=F3}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="加压速率:" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBox x:Name="txtPressureRate" Width="120" FontSize="16" Height="32" VerticalAlignment="Center" Text="{Binding PressureRate, UpdateSourceTrigger=LostFocus, StringFormat=F3}" />
|
||||
<Label Content="加压速率(kPa):" VerticalAlignment="Center" Margin="0,0,5,0" ToolTip="每10ms加压速率,一般1-10,不要太高"/>
|
||||
<TextBox x:Name="txtPressureRate" ToolTip="每10ms加压速率,一般1-10,不要太高" Width="120" FontSize="16" Height="32" VerticalAlignment="Center" Text="{Binding PressureRate, UpdateSourceTrigger=LostFocus, StringFormat=F3}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="膜类型:"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding MembraneTypes}"
|
||||
SelectedItem="{Binding Record.SampleType}"/>
|
||||
SelectedItem="{Binding Record.SampleType}" IsEnabled="False" IsReadOnly="True"/>
|
||||
|
||||
|
||||
<!--<Label Grid.Row="0" Grid.Column="2" Content="室温(°C):"/>
|
||||
@@ -152,20 +152,11 @@
|
||||
SelectedItem="{Binding Record.PressureUnit}"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="2" Content="(干/湿膜)/(大/小流量):"/>
|
||||
<ComboBox HorizontalAlignment="Left" Grid.Row="3" Grid.Column="3" SelectedItem="{Binding TestMode}" Width="80">
|
||||
<ComboBoxItem Content="全部" />
|
||||
<ComboBoxItem Content="湿膜" IsSelected="True"/>
|
||||
<ComboBoxItem Content="干膜"/>
|
||||
</ComboBox>
|
||||
<ComboBox Grid.Row="3" HorizontalAlignment="Right" Grid.Column="3" ItemsSource="{Binding PressureModeList}"
|
||||
SelectedItem="{Binding SelectedPressureMode}" Width="100"/>
|
||||
<Button Grid.Row="3" Grid.Column="3"
|
||||
Content="🗑 清除数据"
|
||||
Command="{Binding ClearAllCommand}"
|
||||
Background="#F44336"
|
||||
Width="90"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,5,5,5"/>
|
||||
<StackPanel Grid.Row="3" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<ComboBox ItemsSource="{Binding TestModes}" SelectedItem="{Binding TestMode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="0,0,5,0"/>
|
||||
<ComboBox ItemsSource="{Binding PressureModeList}" SelectedItem="{Binding SelectedPressureMode}" Width="100" Margin="0,0,5,0"/>
|
||||
<Button Content="🗑 清除数据" Command="{Binding ClearAllCommand}" Background="#F44336" Width="90" Margin="0,0,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user