Browse Source

新增出汤时间设定。

master
ZhaoGang 1 year ago
parent
commit
03e6d090da
2 changed files with 191 additions and 4 deletions
  1. +129
    -1
      BPASmartClient.MorkS/View/ParSet.xaml
  2. +62
    -3
      BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs

+ 129
- 1
BPASmartClient.MorkS/View/ParSet.xaml View File

@@ -8,7 +8,7 @@
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel"
Name="参数设置界面"
d:DesignHeight="450"
d:DesignHeight="800"
d:DesignWidth="800"
mc:Ignorable="d">

@@ -79,6 +79,8 @@
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="150" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal">
@@ -325,6 +327,132 @@
Style="{StaticResource TextBlockStyle}"
Text="(个)" />
</StackPanel>
<!--抽汤时间设定-->
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<!--间隔时间设定-->
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="间隔时间设定:" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding IntervalTime}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
</StackPanel>
<!--反转抽汤时间设定-->
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="反转抽汤时间设定:" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding BackwardSoupSootTime}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
</StackPanel>
<!--翻转后再次出汤时间设定-->
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="翻转后再次出汤时间设定:" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding BackwardedOutSoupTime}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
</StackPanel>
<!--未反转抽汤情况下时间设定-->
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="未反转抽汤情况下时间设定:" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding UnBackwardSoupSootTime}" />
<TextBlock
Margin="10,0,0,0"
FontSize="21"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
</StackPanel>
</WrapPanel>
<!--抽汤调试按钮-->
<StackPanel Grid.Row="3" Orientation="Horizontal">
<Button
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding SoupSootForwardCommand}"
Content="抽汤正转"
Foreground="Aqua"
Style="{StaticResource ButtonStyle}" />
<Button
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding SoupSootBackwardCommand}"
Content="抽汤反转"
Foreground="Aqua"
Style="{StaticResource ButtonStyle}" />
<Button
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding SoupSootStopCommand}"
Content="抽汤停止"
Foreground="Aqua"
Style="{StaticResource ButtonStyle}" />
</StackPanel>
</Grid>

</Grid>


+ 62
- 3
BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs View File

@@ -10,6 +10,7 @@ using BPASmartClient.Model;
using BPASmartClient.MorkS.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Org.BouncyCastle.Utilities;

namespace BPASmartClient.MorkS.ViewModel
{
@@ -18,8 +19,14 @@ namespace BPASmartClient.MorkS.ViewModel
public ParSetViewModel()
{
SaveInfoCommand = new RelayCommand(SaveSettingData);
SoupSootForwardCommand=new RelayCommand(SoupSootForward);
SoupSootBackwardCommand = new RelayCommand(SoupSootBackward);
SoupSootStopCommand = new RelayCommand(SoupSootStop);


ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");


CommandStart = new RelayCommand(async ()=>
{
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M0.6", Value = true });
@@ -48,15 +55,41 @@ namespace BPASmartClient.MorkS.ViewModel

public RelayCommand SaveInfoCommand { get; set; }
public RelayCommand CommandStart { get; set; }

public RelayCommand SoupSootForwardCommand { get; set; }
public RelayCommand SoupSootBackwardCommand { get; set; }
public RelayCommand SoupSootStopCommand { get; set; }
#region 时间设定
/// <summary>
/// 间隔时间设定
/// </summary>
public float IntervalTime { get { return _IntervalTime; } set { _IntervalTime = value; OnPropertyChanged(); } }
private float _IntervalTime;
/// <summary>
/// 反转抽汤时间设定
/// </summary>
public float BackwardSoupSootTime { get { return _BackwardSoupSootTime; } set { _BackwardSoupSootTime = value; OnPropertyChanged(); } }
private float _BackwardSoupSootTime;
/// <summary>
/// 反转过后再次出汤时间设定
/// </summary>
public float BackwardedOutSoupTime { get { return _BackwardedOutSoupTime; } set { _BackwardedOutSoupTime = value; OnPropertyChanged(); } }
private float _BackwardedOutSoupTime;
/// <summary>
/// 未反转抽汤下时间设定
/// </summary>
public float UnBackwardSoupSootTime { get { return _UnBackwardSoupSootTime; } set { _UnBackwardSoupSootTime = value; OnPropertyChanged(); } }
private float _UnBackwardSoupSootTime;
//public RelayCommand VoicePlayTest { get; set; }
public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;


/// <summary>
/// 加汤时间设置
/// </summary>
public float AddSoup { get { return Json<MorksPar>.Data.AddSoupTime; } set { Json<MorksPar>.Data.AddSoupTime = value; OnPropertyChanged(); } }
#endregion


public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
public int OpenUseNumber { get { return Json<MorksPar>.Data.InvertedNoodles_OpenBusyNum; } set { Json<MorksPar>.Data.InvertedNoodles_OpenBusyNum = value; OnPropertyChanged(); } }
public ObservableCollection<ParSet> DishLibraryParSets { get; set; } = Json<MorksPar>.Data.DishLibraryParSets;

@@ -85,6 +118,32 @@ namespace BPASmartClient.MorkS.ViewModel
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = "VW2282", Value = times });
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
Json<MorksPar>.Save();

WriteTimeSet(IntervalTime);
WriteTimeSet(BackwardSoupSootTime);
WriteTimeSet(BackwardedOutSoupTime);
WriteTimeSet(UnBackwardSoupSootTime);
}

private void WriteTimeSet(float TimePar) {
ushort paras = Convert.ToUInt16(TimePar * 10);
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = "VW2282", Value = paras });
}
private async void SoupSootForward() {
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.0", Value = true });
await Task.Delay((int)DelayTime * 1000);
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.0", Value = false });
}
private async void SoupSootBackward() {
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.1", Value = true });
await Task.Delay((int)DelayTime * 1000);
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.1", Value = false });
}
private async void SoupSootStop() {
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.2", Value = true });
await Task.Delay((int)DelayTime * 1000);
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M1.2", Value = false });
}
}
}

Loading…
Cancel
Save