@@ -6,6 +6,7 @@ | |||
xmlns:local="clr-namespace:HBLConsole.Debug" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:s="https://github.com/canton7/Stylet" | |||
xmlns:pry="clr-namespace:HBLConsole.PryUserControl;assembly=HBLConsole.PryUserControl" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -17,6 +18,7 @@ | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="Style.xaml" /> | |||
<!--<ResourceDictionary Source="pry://application:,,,/HBLConsole.PryUserControl;ScrollViewerStyle.xaml"/>--> | |||
<ResourceDictionary> | |||
<!--#region ComboBox 样式--> | |||
<!-- ComBoBox项选中背景色 --> | |||
@@ -34,18 +36,18 @@ | |||
<ColumnDefinition Width="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
Background="White" | |||
Opacity="0" /> | |||
Grid.ColumnSpan="2" | |||
Background="White" | |||
Opacity="0" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontFamily="../Fonts/#iconfont" | |||
FontSize="14" | |||
Foreground="#FF23CACA" | |||
Text="" /> | |||
Grid.Column="1" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontFamily="../Fonts/#iconfont" | |||
FontSize="14" | |||
Foreground="#FF23CACA" | |||
Text="" /> | |||
<!--<Path | |||
x:Name="Arrow" | |||
Grid.Column="1" | |||
@@ -118,17 +120,17 @@ | |||
<Border x:Name="_borderbg" Background="Transparent" /> | |||
<TextBlock | |||
x:Name="_txt" | |||
Margin="3,0,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#DDD" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
x:Name="_txt" | |||
Margin="3,0,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#DDD" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
<Border | |||
x:Name="_border" | |||
Background="#103153" | |||
Opacity="0" /> | |||
x:Name="_border" | |||
Background="#103153" | |||
Opacity="0" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsSelected" Value="true"> | |||
@@ -161,71 +163,71 @@ | |||
<ColumnDefinition Width="0.3*" MaxWidth="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
x:Name="_prybr" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="0" /> | |||
x:Name="_prybr" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="0" /> | |||
<ContentPresenter | |||
x:Name="ContentSite" | |||
Margin="3,3,0,3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
IsHitTestVisible="False" /> | |||
x:Name="ContentSite" | |||
Margin="3,3,0,3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
IsHitTestVisible="False" /> | |||
<!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen --> | |||
<ToggleButton | |||
x:Name="ToggleButton" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Template="{StaticResource ComboBoxToggleButton}" /> | |||
x:Name="ToggleButton" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Template="{StaticResource ComboBoxToggleButton}" /> | |||
<!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 --> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="2,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
Focusable="True" | |||
IsReadOnly="{TemplateBinding IsReadOnly}" | |||
Visibility="Hidden" /> | |||
x:Name="PART_EditableTextBox" | |||
Margin="2,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
Focusable="True" | |||
IsReadOnly="{TemplateBinding IsReadOnly}" | |||
Visibility="Hidden" /> | |||
<!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen --> | |||
<Popup | |||
x:Name="Popup" | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="Slide"> | |||
x:Name="Popup" | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="Slide"> | |||
<Grid | |||
x:Name="DropDown" | |||
MinWidth="{TemplateBinding ActualWidth}" | |||
MaxHeight="150" | |||
SnapsToDevicePixels="True"> | |||
x:Name="DropDown" | |||
MinWidth="{TemplateBinding ActualWidth}" | |||
MaxHeight="150" | |||
SnapsToDevicePixels="True"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="#3ba7f2" | |||
BorderThickness="0" /> | |||
x:Name="DropDownBorder" | |||
BorderBrush="#3ba7f2" | |||
BorderThickness="0" /> | |||
<ScrollViewer | |||
Margin="1" | |||
CanContentScroll="True" | |||
HorizontalScrollBarVisibility="Auto" | |||
SnapsToDevicePixels="True" | |||
VerticalScrollBarVisibility="Auto"> | |||
Margin="1" | |||
CanContentScroll="True" | |||
HorizontalScrollBarVisibility="Auto" | |||
SnapsToDevicePixels="True" | |||
VerticalScrollBarVisibility="Auto"> | |||
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True --> | |||
<!-- 一下可以设置列表背景色 --> | |||
<StackPanel | |||
Background="#103153" | |||
IsItemsHost="True" | |||
KeyboardNavigation.DirectionalNavigation="Contained" /> | |||
Background="#103153" | |||
IsItemsHost="True" | |||
KeyboardNavigation.DirectionalNavigation="Contained" /> | |||
</ScrollViewer> | |||
</Grid> | |||
</Popup> | |||
@@ -260,7 +262,7 @@ | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="300"/> | |||
<RowDefinition Height="300" /> | |||
</Grid.RowDefinitions> | |||
<!--#region 乐百机器人控制--> | |||
@@ -277,7 +279,7 @@ | |||
<RowDefinition Height="50" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<Button | |||
Width="130" | |||
@@ -294,34 +296,54 @@ | |||
Content="咖啡模拟" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Grid.Row="1" Margin="0,10,0,0" Orientation="Vertical"> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,10,0,0" | |||
Orientation="Vertical"> | |||
<Grid HorizontalAlignment="Left"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="100"></ColumnDefinition> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="100"></ColumnDefinition> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="100"></ColumnDefinition> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock>机器人连接状态</TextBlock> | |||
<TextBlock Margin="10,0,0,0" Grid.Column="1" Text="{Binding RobotConnected}"></TextBlock> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="10,0,0,0" | |||
Text="{Binding RobotConnected}" /> | |||
<TextBlock Grid.Column="2">冰淇淋机连接状态</TextBlock> | |||
<TextBlock Margin="10,0,0,0" Grid.Column="3" Text="{Binding IceCreamConnected}"></TextBlock> | |||
<TextBlock | |||
Grid.Column="3" | |||
Margin="10,0,0,0" | |||
Text="{Binding IceCreamConnected}" /> | |||
<TextBlock Grid.Column="4">咖啡机连接状态</TextBlock> | |||
<TextBlock Margin="10,0,0,0" Grid.Column="5" Text="{Binding CoffeeConnected}"></TextBlock> | |||
<TextBlock | |||
Grid.Column="5" | |||
Margin="10,0,0,0" | |||
Text="{Binding CoffeeConnected}" /> | |||
<TextBlock Grid.Row="1">测距(是否有物)</TextBlock> | |||
<TextBlock Grid.Row="1" Margin="10,0,0,0" Grid.Column="1" Text="{Binding HasArticle}"></TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="10,0,0,0" | |||
Text="{Binding HasArticle}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2">测距(距离)</TextBlock> | |||
<TextBlock Grid.Row="1" Margin="10,0,0,0" Grid.Column="3" Text="{Binding ArticleDist}"></TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="3" | |||
Margin="10,0,0,0" | |||
Text="{Binding ArticleDist}" /> | |||
</Grid> | |||
</StackPanel> | |||
</Grid> | |||
@@ -347,116 +369,78 @@ | |||
<StackPanel Orientation="Vertical"> | |||
<StackPanel.Resources> | |||
<Style TargetType="StackPanel"> | |||
<Setter Property="Margin" Value="5"></Setter> | |||
<Setter Property="Margin" Value="5" /> | |||
</Style> | |||
</StackPanel.Resources> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="1号口开" s:View.ActionTarget="{Binding}" Command="{s:Action OpenSE1}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button Content="1号口关" s:View.ActionTarget="{Binding}" Command="{s:Action CloseSE1}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action OpenSE1}" | |||
Content="1号口开" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action CloseSE1}" | |||
Content="1号口关" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="2号口开" s:View.ActionTarget="{Binding}" Command="{s:Action OpenSE2}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button Content="2号口关" s:View.ActionTarget="{Binding}" Command="{s:Action CloseSE2}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action OpenSE2}" | |||
Content="2号口开" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action CloseSE2}" | |||
Content="2号口关" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="3号口开" s:View.ActionTarget="{Binding}" Command="{s:Action OpenSE3}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button Content="3号口关" s:View.ActionTarget="{Binding}" Command="{s:Action CloseSE3}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action OpenSE3}" | |||
Content="3号口开" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action CloseSE3}" | |||
Content="3号口关" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="转筒转动" s:View.ActionTarget="{Binding}" Command="{s:Action TurnRoll}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button Content="停止转筒转动" s:View.ActionTarget="{Binding}" Command="{s:Action StopTurnRoll}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action TurnRoll}" | |||
Content="转筒转动" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action StopTurnRoll}" | |||
Content="停止转筒转动" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="完整制作流程" s:View.ActionTarget="{Binding}" Command="{s:Action MakeIceCreamBySE1}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action MakeIceCreamBySE1}" | |||
Content="完整制作流程" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Content="存在物" s:View.ActionTarget="{Binding}" Command="{s:Action DoHasArticle}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button Content="测距" s:View.ActionTarget="{Binding}" Command="{s:Action DoArticleDist}" Style="{StaticResource ButtonStyle}"></Button> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action DoHasArticle}" | |||
Content="存在物" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action DoArticleDist}" | |||
Content="测距" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Row="0" Grid.Column="0">预冷温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Text="{Binding YLWD}" /> | |||
<TextBlock Grid.Row="0" Grid.Column="2">回气温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="3" | |||
Text="{Binding HQWD}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="0">环境温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Text="{Binding HJWD}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2">当前模式</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="3" | |||
Text="{Binding CurrentMode}" /> | |||
<TextBlock Grid.Row="2" Grid.Column="0">电流</TextBlock> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Text="{Binding DL}" /> | |||
<TextBlock Grid.Row="2" Grid.Column="2">电压</TextBlock> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="3" | |||
Text="{Binding DY}" /> | |||
<TextBlock Grid.Row="3" Grid.Column="0">成型比</TextBlock> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="1" | |||
Text="{Binding CXB}" /> | |||
<TextBlock Grid.Row="3" Grid.Column="2">故障</TextBlock> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="3" | |||
Text="{Binding IceCreamFault}" /> | |||
</Grid> | |||
<StackPanel Grid.Row="1" Orientation="Vertical"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>饮品</TextBlock> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action MakeIceCream}" | |||
Content="制作" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding IceCreamModes}" | |||
SelectedItem="{Binding SelecteIceCreamdMode}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action SetIceCreamModel}" | |||
Content="设置" /> | |||
</StackPanel> | |||
</StackPanel>--> | |||
</StackPanel> | |||
</GroupBox> | |||
<!--#endregion--> | |||
@@ -520,202 +504,36 @@ | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding Coffees}" | |||
SelectedItem="{Binding SelectedCoffee}" Style="{DynamicResource ComboBoxStyle}" /> | |||
SelectedItem="{Binding SelectedCoffee}" | |||
Style="{DynamicResource ComboBoxStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action MakeCoffee}" | |||
Style="{StaticResource ButtonStyle}" | |||
Content="制作" /> | |||
Content="制作" | |||
Style="{StaticResource ButtonStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action StopMakeCoffee}" | |||
Style="{StaticResource ButtonStyle}" | |||
Content="停止制作" /> | |||
Content="停止制作" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding CoffeeCmds}" | |||
SelectedItem="{Binding SelectedCoffeeCmd}" Style="{DynamicResource ComboBoxStyle}" /> | |||
SelectedItem="{Binding SelectedCoffeeCmd}" | |||
Style="{DynamicResource ComboBoxStyle}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action SetCoffeeModel}" | |||
Style="{StaticResource ButtonStyle}" | |||
Content="设置" /> | |||
Content="设置" | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox> | |||
<!--#endregion--> | |||
</Grid> | |||
<!--<GroupBox | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Header="冰淇淋机"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Row="0" Grid.Column="0">预冷温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Text="{Binding YLWD}" /> | |||
<TextBlock Grid.Row="0" Grid.Column="2">回气温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="3" | |||
Text="{Binding HQWD}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="0">环境温度</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Text="{Binding HJWD}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2">当前模式</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="3" | |||
Text="{Binding CurrentMode}" /> | |||
<TextBlock Grid.Row="2" Grid.Column="0">电流</TextBlock> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Text="{Binding DL}" /> | |||
<TextBlock Grid.Row="2" Grid.Column="2">电压</TextBlock> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="3" | |||
Text="{Binding DY}" /> | |||
<TextBlock Grid.Row="3" Grid.Column="0">成型比</TextBlock> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="1" | |||
Text="{Binding CXB}" /> | |||
<TextBlock Grid.Row="3" Grid.Column="2">故障</TextBlock> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="3" | |||
Text="{Binding IceCreamFault}" /> | |||
</Grid> | |||
<StackPanel Grid.Row="1" Orientation="Vertical"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>饮品</TextBlock> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action MakeIceCream}" | |||
Content="制作" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding IceCreamModes}" | |||
SelectedItem="{Binding SelecteIceCreamdMode}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action SetIceCreamModel}" | |||
Content="设置" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox>--> | |||
<!--<GroupBox | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Header="咖啡机"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<Grid.Resources> | |||
<Style TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
</Grid.Resources> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="120" /> | |||
<ColumnDefinition Width="150" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Row="0" Grid.Column="0">咖啡机状态</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Text="{Binding CoffeeStatus}" /> | |||
<TextBlock Grid.Row="0" Grid.Column="2">应用状态</TextBlock> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="3" | |||
Text="{Binding AppStatus}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="0">告警信息</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Text="{Binding Warning}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2">故障信息</TextBlock> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="3" | |||
Text="{Binding CaffeeFault}" /> | |||
</Grid> | |||
<StackPanel Grid.Row="1" Orientation="Vertical"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>饮品</TextBlock> | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding Coffees}" | |||
SelectedItem="{Binding SelectedCoffee}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action MakeCoffee}" | |||
Content="制作" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action StopMakeCoffee}" | |||
Content="停止制作" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox | |||
Width="100" | |||
ItemsSource="{Binding CoffeeCmds}" | |||
SelectedItem="{Binding SelectedCoffeeCmd}" /> | |||
<Button | |||
s:View.ActionTarget="{Binding}" | |||
Command="{s:Action SetCoffeeModel}" | |||
Content="设置" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox>--> | |||
</Grid> | |||
</UserControl> |
@@ -14,6 +14,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\HBLConsole.PryUserControl\HBLConsole.PryUserControl.csproj" /> | |||
<ProjectReference Include="..\HBLConsole.Service\HBLConsole.Service.csproj" /> | |||
<ProjectReference Include="..\HBLDevice.Coffee\HBLDevice.Coffee.csproj" /> | |||
<ProjectReference Include="..\HBLDevice.ICChip\HBLDevice.ICChip.csproj" /> | |||
@@ -36,6 +36,7 @@ namespace HBLConsole.Factory | |||
GetAbsMessageServer.AddOrder(message); | |||
GetAbsMessageServer.GetBatchingInfo(message); | |||
GetAbsMessageServer.GetRecipeBom(message); | |||
GetAbsMessageServer.Chargeback(message); | |||
} | |||
/// <summary> | |||
@@ -18,6 +18,7 @@ using System.Collections.Concurrent; | |||
using System.Diagnostics; | |||
using BPA.Message.IOT; | |||
using HBLDevice.ICChip; | |||
using System.Threading.Tasks; | |||
namespace HBLConsole.MORKIC | |||
{ | |||
@@ -37,6 +38,8 @@ namespace HBLConsole.MORKIC | |||
private CoffeeMachine coffeeMachine; | |||
//单片机主控程序 | |||
private ICChipMachine icchipMachine; | |||
//广绅单口冰淇淋机 | |||
private IceCreamMachine iceCreamMachine; | |||
//物料存放位置 | |||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||
//容器位置 | |||
@@ -99,22 +102,22 @@ namespace HBLConsole.MORKIC | |||
coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee)); | |||
//单片机机创建 | |||
icchipMachine = new ICChipMachine(com_ICChip, (BaudRates)Enum.Parse(typeof(BaudRates), baud_ICChip)); | |||
//冰淇淋机创建 | |||
iceCreamMachine = new IceCreamMachine(com_IceCream, (BaudRates)Enum.Parse(typeof(BaudRates), baud_IceCream)); | |||
Main(); | |||
ReadData(); | |||
ThreadManage.GetInstance.StartLong(new Action(() => | |||
{ | |||
while (morkOrderPushes.Count > 0) | |||
{ | |||
if (!LebaiHelper.GetInstance.GetInput(1)) | |||
if (!LebaiHelper.GetInstance.GetInput()) | |||
{ | |||
while (enableFunny) { Thread.Sleep(10); } | |||
MessageLog.GetInstance.Show("当前非自嗨模式,允许开工"); | |||
working = true; | |||
if (morkOrderPushes.TryDequeue(out MorkOrderPush order)) | |||
{ | |||
{ | |||
MessageLog.GetInstance.Show($"开始制作订单[{order.SortNum}]"); | |||
//Thread.Sleep(5000); | |||
@@ -177,8 +180,9 @@ namespace HBLConsole.MORKIC | |||
coffeeMachine.Start(); | |||
//单片机开启主线程 | |||
icchipMachine.Start(); | |||
//冰淇淋机开启主线程 | |||
iceCreamMachine.Start(); | |||
new ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadManage.GetInstance.StartLong(new Action(() => | |||
{ | |||
@@ -197,36 +201,7 @@ namespace HBLConsole.MORKIC | |||
} | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_欢迎); | |||
}), "MORK-IC欢迎"); | |||
//ThreadManage.GetInstance.StartLong(new Action(() => | |||
//{ | |||
// if (null != lebai) | |||
// { | |||
// if (!working) | |||
// { | |||
// if (DateTime.Now.Subtract(lastRecvdOrder).TotalSeconds >= 30) | |||
// { | |||
// MessageLog.GetInstance.Show("进入自嗨模式"); | |||
// enableFunny = true; | |||
// //ThreadManage.GetInstance.Start(new Action(() => | |||
// //{ | |||
// //}), "调用乐百机器人做咖啡场景"); | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_自嗨); | |||
// Thread.Sleep(2000); | |||
// while (lebai.Ok && lebai.Value != 10) | |||
// { | |||
// Thread.Sleep(5); | |||
// } | |||
// enableFunny = false; | |||
// MessageLog.GetInstance.Show("退出自嗨模式"); | |||
// Thread.Sleep(60*1000); | |||
// } | |||
// } | |||
// } | |||
// Thread.Sleep(100); | |||
//}), "MORK-IC自嗨"); | |||
} | |||
public void DataParse<T>(T order) | |||
@@ -281,16 +256,14 @@ namespace HBLConsole.MORKIC | |||
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测); | |||
Wait(); | |||
LebaiHelper.GetInstance.SetValue(1); | |||
if (!LebaiHelper.GetInstance.GetInput()) | |||
if (!LebaiHelper.GetInstance.GetTcpInput()) | |||
{ | |||
MessageLog.GetInstance.Show("执行二次取咖啡杯"); | |||
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_二次取咖啡杯); | |||
Wait(); | |||
new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 | |||
LebaiHelper.GetInstance.SetValue(1); | |||
goto p; | |||
} | |||
@@ -303,7 +276,7 @@ namespace HBLConsole.MORKIC | |||
Thread.Sleep(3000); | |||
LebaiHelper.GetInstance.SetValue(1); | |||
while (LebaiHelper.GetInstance.GetInput(1)) | |||
while (LebaiHelper.GetInstance.GetInput()) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
@@ -314,175 +287,6 @@ namespace HBLConsole.MORKIC | |||
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
#endregion | |||
#region 最初版本 | |||
//are.Reset(); | |||
//LebaiHelper.GetInstance.SetValue(0); | |||
////订单状态改变:开始制作 | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
////todo:先调用机器人 | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡); | |||
////ThreadManage.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡); }), "调用乐百机器人做咖啡场景"); | |||
//Thread.Sleep(2000); | |||
//while (!(lebai.Ok && lebai.Value == 1)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
////todo:咖啡杯下杯 | |||
//new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish(); | |||
//Thread.Sleep(500); | |||
////while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_COFFEE) { Thread.Sleep(5); } | |||
//MessageLog.GetInstance.Show("咖啡杯取杯完成"); | |||
//LebaiHelper.GetInstance.SetValue(100); | |||
//while (!(lebai.Ok && lebai.Value == 2)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//MessageLog.GetInstance.Show("机器人到达接咖啡口位置"); | |||
//new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | |||
//are.WaitOne(1000 * 180); | |||
////are.WaitOne(1 * 180); | |||
//MessageLog.GetInstance.Show("咖啡机制作咖啡完成"); | |||
//LebaiHelper.GetInstance.SetValue(101); | |||
//while (!(lebai.Ok && lebai.Value == 3)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//MessageLog.GetInstance.Show("机器人到达接咖啡口位置"); | |||
////订单状态改变:完成 | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); | |||
//---------------------------------------------------------含咖啡杯检测-----------------------------------------// | |||
#endregion | |||
#region 含咖啡杯检测的多场景 | |||
//int checkeNum = 0; | |||
//are.Reset(); | |||
//LebaiHelper.GetInstance.SetValue(0); | |||
////订单状态改变:开始制作 | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
////todo:先调用机器人 | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取咖啡杯); | |||
////ThreadManage.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡); }), "调用乐百机器人做咖啡场景"); | |||
//Thread.Sleep(2000); | |||
//while (!(lebai.Ok && lebai.Value == 1)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
////todo:咖啡杯下杯 | |||
//new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish(); | |||
//Thread.Sleep(500); | |||
////while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_COFFEE) { Thread.Sleep(5); } | |||
//MessageLog.GetInstance.Show("咖啡杯取杯完成"); | |||
//LebaiHelper.GetInstance.SetValue(100); | |||
//Thread.Sleep(1500); | |||
////咖啡杯检测场景 | |||
//while (!LebaiHelper.GetInstance.GetInput()) | |||
//{ | |||
// checkeNum++; | |||
// if (checkeNum > 1) | |||
// { | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_再次取杯); | |||
// while (!(lebai.Ok && lebai.Value == 3)) | |||
// { | |||
// //LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_再次取杯); | |||
// Thread.Sleep(5); | |||
// } | |||
// new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish(); | |||
// Thread.Sleep(500); | |||
// } | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测); | |||
// //场景需要两次才能进去 | |||
// Thread.Sleep(2000); | |||
// if (lebai.Value != 2) | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测); | |||
// while (!(lebai.Ok && lebai.Value == 2)) | |||
// { | |||
// Thread.Sleep(5); | |||
// } | |||
// Thread.Sleep(1000); | |||
//} | |||
//checkeNum = 0; | |||
//ChipStatus.GetInstance().ArticleExits = false; | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接咖啡); | |||
//while (!(lebai.Ok && lebai.Value == 4)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//MessageLog.GetInstance.Show("机器人到达接咖啡口位置"); | |||
//new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | |||
//are.WaitOne(1000 * 180); | |||
////are.WaitOne(1 * 180); | |||
//MessageLog.GetInstance.Show("咖啡机制作咖啡完成"); | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); | |||
//LebaiHelper.GetInstance.SetValue(101); | |||
//Thread.Sleep(2000); | |||
////LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_送咖啡); | |||
////while (!(lebai.Ok && lebai.Value == 5)) | |||
////{ | |||
//// Thread.Sleep(5); | |||
////} | |||
////MessageLog.GetInstance.Show("机器人到达顾客取咖啡位置"); | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_New送咖啡); | |||
//Thread.Sleep(500); | |||
//while (!(lebai.Ok && lebai.Value == 5)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//MessageLog.GetInstance.Show("机器人到达顾客取咖啡位置"); | |||
//// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_有无咖啡检测); | |||
////while (!(lebai.Ok && lebai.Value == 6)) | |||
////{ | |||
//// Thread.Sleep(5); | |||
////} | |||
////new ArticleExitsEvent() { }.Publish(); | |||
////Thread.Sleep(1000); | |||
//////有咖啡 | |||
////while (ChipStatus.GetInstance().ArticleExits) | |||
////{ | |||
//// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_再送咖啡); | |||
//// while (!(lebai.Ok&&lebai.Value==7)) | |||
//// { | |||
//// Thread.Sleep(5); | |||
//// } | |||
//// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_有无咖啡检测); | |||
//// while (!(lebai.Ok && lebai.Value == 6)) | |||
//// { | |||
//// Thread.Sleep(5); | |||
//// } | |||
//// new ArticleExitsEvent() { }.Publish(); | |||
//// Thread.Sleep(1000); | |||
////} | |||
////ChipStatus.GetInstance().ArticleExits = false; | |||
////MessageLog.GetInstance.Show("顾客已经取走咖啡"); | |||
//if (!(morkOrderPushes.Count > 0)) | |||
//{ | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_复位); | |||
// while (!(lebai.Ok && lebai.Value == 6)) | |||
// { | |||
// Thread.Sleep(8); | |||
// } | |||
// MessageLog.GetInstance.Show("机器人复位"); | |||
//} | |||
////订单状态改变:完成 | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
#endregion | |||
} | |||
/// <summary> | |||
@@ -490,52 +294,13 @@ namespace HBLConsole.MORKIC | |||
/// </summary> | |||
private void DoIceCream() | |||
{ | |||
#region 之前版本 | |||
//LebaiHelper.GetInstance.SetValue(0); | |||
//new RotorSwitchEvent() { TurnOn = true }.Publish(); | |||
//int scene = LebaiHelper.SENCE_接冰淇淋2; | |||
//var se = IC_SE.SE_2; | |||
//se = PolymerBatching.GetIceCreamSE(mainMaterialLoc, out scene); | |||
////订单状态改变:开始制作 | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
////todo:先调用机器人 | |||
//LebaiHelper.GetInstance.Scene(scene); | |||
//MessageLog.GetInstance.Show("调用乐百机器人做冰淇淋场景"); | |||
//Thread.Sleep(2000); | |||
//while (!(lebai.Ok && lebai.Value == 1)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish(); | |||
//Thread.Sleep(500); | |||
////while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_ICECREAM) { Thread.Sleep(5); } | |||
//LebaiHelper.GetInstance.SetValue(100); | |||
//while (!(lebai.Ok && lebai.Value == 2)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//new MakeIceCreamEvent() { SteeringEngine = se }.Publish(); | |||
//Thread.Sleep(1000); | |||
//LebaiHelper.GetInstance.SetValue(101); | |||
//new RotorSwitchEvent() { TurnOn = false }.Publish(); | |||
//while (!(lebai.Ok && lebai.Value == 3)) | |||
//{ | |||
// Thread.Sleep(5); | |||
//} | |||
//MessageLog.GetInstance.Show("冰淇凌制作完成"); | |||
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); | |||
#endregion | |||
if (LebaiHelper.GetInstance.GetInput(3)) | |||
return; | |||
#region 且时且多入场设备程序 | |||
int checkeNum = 0; | |||
are.Reset(); | |||
LebaiHelper.GetInstance.SetValue(0); | |||
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
// SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取冰淇淋杯); | |||
Wait(); | |||
@@ -553,7 +318,7 @@ namespace HBLConsole.MORKIC | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_冰淇淋杯检测); | |||
Wait(); | |||
LebaiHelper.GetInstance.SetValue(1); | |||
if (!LebaiHelper.GetInstance.GetInput()) | |||
if (!LebaiHelper.GetInstance.GetTcpInput()) | |||
{ | |||
MessageLog.GetInstance.Show("执行二次取冰淇淋杯"); | |||
//LebaiHelper.GetInstance.SetValue(1); | |||
@@ -570,25 +335,59 @@ namespace HBLConsole.MORKIC | |||
goto p; | |||
} | |||
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接冰淇淋公共点); | |||
//Thread.Sleep(2000); | |||
//if (lebai.Value != 101) | |||
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接冰淇淋公共点); | |||
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接冰淇淋公共点); | |||
//Wait(); | |||
//LebaiHelper.GetInstance.SetValue(1); | |||
#region 通讯冰淇淋机 | |||
//制冷模式 | |||
new ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
LebaiHelper.GetInstance.SetValue(0); | |||
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接1号冰淇淋); | |||
Wait(); | |||
bool doItResult = true; | |||
//出料 | |||
new DischargeEvent().Publish(delegate (object[] args) | |||
{ | |||
doItResult = (bool)args[0]; | |||
}); | |||
if (doItResult) | |||
{ | |||
int retry = 3; | |||
DateTime beginTime = DateTime.Now; | |||
while (!LebaiHelper.GetInstance.GetInput(3)) | |||
{ | |||
if (retry <= 0 && DateTime.Now.Subtract(beginTime).TotalSeconds >= 10) | |||
{ | |||
MessageLog.GetInstance.Show("超时未出料,重试次数用尽"); | |||
break; | |||
} | |||
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5) | |||
{ | |||
MessageLog.GetInstance.Show("超时未出料,重新发送打料指令"); | |||
new ModeSetEvent() { Mode = MORKI_MODE.打料 }.Publish(); | |||
beginTime = DateTime.Now; | |||
retry--; | |||
} | |||
Thread.Sleep(10); | |||
} | |||
MessageLog.GetInstance.Show("开始等待6s"); | |||
Thread.Sleep(5000); | |||
} | |||
LebaiHelper.GetInstance.SetValue(1); | |||
#endregion | |||
//var res = PolymerBatching.GetIceCreamSE(mainMaterialLoc, out int scene); | |||
//LebaiHelper.GetInstance.Scene(scene); | |||
var res = PolymerBatching.GetIceCreamSE(mainMaterialLoc, out int scene); | |||
LebaiHelper.GetInstance.Scene(scene); | |||
//Thread.Sleep(2000); | |||
//if (lebai.Value != 101) | |||
// LebaiHelper.GetInstance.Scene(scene); | |||
Wait(); | |||
new MakeIceCreamEvent() { SteeringEngine = res }.Publish(); //控制舵机 | |||
//Wait(); | |||
//new MakeIceCreamEvent() { SteeringEngine = res }.Publish(); //控制舵机 | |||
Thread.Sleep(500); | |||
LebaiHelper.GetInstance.SetValue(1); | |||
while (LebaiHelper.GetInstance.GetInput(1)) | |||
//Thread.Sleep(500); | |||
//LebaiHelper.GetInstance.SetValue(1); | |||
while (LebaiHelper.GetInstance.GetInput()) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
@@ -602,6 +401,8 @@ namespace HBLConsole.MORKIC | |||
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
#endregion | |||
} | |||
private void CoffeEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack) | |||
@@ -609,32 +410,6 @@ namespace HBLConsole.MORKIC | |||
are.Set(); | |||
} | |||
//public void Main() | |||
//{ | |||
// //咖啡机开启主线程 | |||
// coffeeMachine.Start(); | |||
// //冰淇淋机开启主线程 | |||
// iceCreamMachine.Start(); | |||
// icchipMachine.Start(); | |||
// new ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
// //开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
// ThreadManage.GetInstance.StartLong(new Action(() => | |||
// { | |||
// //GeneralConfig.Healthy = true; | |||
// //GeneralConfig.Healthy = | |||
// // LebaiHelper.GetInstance.IsConnected && | |||
// // MorkIStatus.GetInstance().CanDo && | |||
// // MorkCStatus.GetInstance().CanDo; | |||
// GeneralConfig.Healthy = | |||
// LebaiHelper.GetInstance.IsConnected && | |||
// MorkCStatus.GetInstance().CanDo; | |||
// GeneralConfig.Healthy = true; | |||
// Thread.Sleep(100); | |||
// }), "MORK-IC心跳刷新"); | |||
//} | |||
public void ReadData() | |||
{ | |||
@@ -651,12 +426,7 @@ namespace HBLConsole.MORKIC | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
//ThreadManage.GetInstance.Start(new Action(() => | |||
//{ | |||
// DoIceCream(); | |||
// //DoCoffee(); | |||
//}), "aaa"); | |||
} | |||
/// <summary> | |||
@@ -296,7 +296,7 @@ namespace HBLConsole.MORKS | |||
ThreadManage.GetInstance.StartLong(new Action(() => | |||
{ | |||
mORKS.AllowRun = mORKS.InitComplete; | |||
GeneralConfig.Healthy = mORKS.Error && mORKS.InitComplete && !GeneralConfig.EnableLocalSimOrder; | |||
//GeneralConfig.Healthy = mORKS.Error && mORKS.InitComplete && !GeneralConfig.EnableLocalSimOrder; | |||
TakeBowlTask(); | |||
@@ -392,7 +392,6 @@ namespace HBLConsole.MORKS | |||
} | |||
} | |||
//转台到位检测 | |||
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace && mORKS.CurrentLoc == mORKS.TurntableFeedbackloc)) | |||
{ | |||
@@ -4,10 +4,10 @@ | |||
<!--通用配置--> | |||
<!--正式服务 Consul 地址--> | |||
<!--<add key="ConsulAddress" value="http://1.14.74.54:9005" />--> | |||
<add key="ConsulAddress" value="http://1.14.74.54:9005" /> | |||
<!--测试服务 Consul 地址--> | |||
<add key="ConsulAddress" value="http://111.9.47.105:9011" /> | |||
<!--<add key="ConsulAddress" value="http://111.9.47.105:9011" />--> | |||
<!--客户端ID--> | |||
@@ -877,8 +877,8 @@ | |||
<TextBlock | |||
x:Name="_txt" | |||
Margin="3,0,3,0" | |||
HorizontalAlignment="Center" | |||
Margin="5,0,3,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="#DDD" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
@@ -1,4 +1,4 @@ | |||
#define test | |||
//#define test | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
@@ -176,14 +176,14 @@ namespace HBLConsole.ViewModel | |||
{ | |||
Test(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o == null) return; | |||
if (o is string id) | |||
{ | |||
SimpleFactory.GetInstance.OrderChanged(id, ORDER_STATUS.ABANDONED); | |||
} | |||
}), "chargeback"); | |||
//ActionManage.GetInstance.Register(new Action<object>((o) => | |||
//{ | |||
// if (o == null) return; | |||
// if (o is string id) | |||
// { | |||
// SimpleFactory.GetInstance.OrderChanged(id, ORDER_STATUS.ABANDONED); | |||
// } | |||
//}), "chargeback"); | |||
//清除订单数据 | |||
ActionManage.GetInstance.Register(new Action(() => | |||
@@ -58,11 +58,13 @@ namespace HBLDevice.IceCream | |||
if (MorkIStatus.GetInstance().Fault != MORKI_FAULT.未发生故障) | |||
{ | |||
MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作", MorkIStatus.GetInstance().Fault)); | |||
callBack?.Invoke(false); | |||
return; | |||
} | |||
if (MorkIStatus.GetInstance().CXB <= 86) | |||
{ | |||
MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作", MorkIStatus.GetInstance().CXB)); | |||
callBack?.Invoke(false); | |||
return; | |||
} | |||
@@ -70,8 +72,14 @@ namespace HBLDevice.IceCream | |||
if (!modeRight) | |||
{ | |||
PauseAsk?.Invoke(true); | |||
Thread.Sleep(200); | |||
var temp = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.制冷模式)); | |||
commProxy.SendData(temp); | |||
Thread.Sleep(200); | |||
PauseAsk?.Invoke(false); | |||
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.制冷模式)); | |||
DateTime freeTime = DateTime.Now.AddSeconds(5); | |||
@@ -94,10 +102,12 @@ namespace HBLDevice.IceCream | |||
PauseAsk?.Invoke(false); | |||
iceCreamEndCook.Publish(); | |||
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料)); | |||
callBack?.Invoke(true); | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料", MorkIStatus.GetInstance().CurrentMode)); | |||
callBack?.Invoke(false); | |||
} | |||
} | |||
} | |||
@@ -57,6 +57,7 @@ namespace HBLDevice.IceCream | |||
/// </summary> | |||
public bool DLCompleted { get; set; } | |||
public bool CanDo | |||
{ | |||
get | |||