Browse Source

更新agv

样式分支
fyf 2 years ago
parent
commit
2cade5cbd9
4 changed files with 894 additions and 64 deletions
  1. +9
    -1
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  2. +184
    -18
      FryPot_DosingSystem/View/AgvView.xaml
  3. +123
    -34
      FryPot_DosingSystem/View/AgvView.xaml.cs
  4. +578
    -11
      FryPot_DosingSystem/ViewModel/AgvViewModel.cs

+ 9
- 1
BPASmartClient.CustomResource/Themes/MyStyle.xaml View File

@@ -172,6 +172,13 @@
<ImageBrush x:Key="imageBJ" ImageSource="/BPASmartClient.CustomResource;component/Image/图层1.png" />
<ImageBrush x:Key="image1" ImageSource="/BPASmartClient.CustomResource;component/Image/shape.png" />
<ImageBrush x:Key="image2" ImageSource="/BPASmartClient.CustomResource;component/Image/shape1.png" />
<Style x:Key="image完成" TargetType="Image">
<Style.Setters>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
</Style.Setters>
</Style>

<Style x:Key="image墙" TargetType="Image">
<Style.Setters>
@@ -1823,9 +1830,10 @@

<!--#region TextBlock-->
<Style x:Key="80号字体样式" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti"/>
<Setter Property="Foreground" Value="#FFC6AE82" />
<Setter Property="Foreground" Value="#FFFCD5B5" />
</Style>


+ 184
- 18
FryPot_DosingSystem/View/AgvView.xaml View File

@@ -851,8 +851,8 @@
</Grid.RenderTransform>
<Border Style="{DynamicResource border车}" Width="60" Height="60" HorizontalAlignment="Right"></Border>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="caiping">
<Border Margin="0,20,15,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
<Border Margin="0,20,5,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
<Border Margin="0,50,15,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
<Border Margin="0,50,5,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
</Grid>
<Grid x:Name="biaoji" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,0,0">
<Path x:Name="path1" Visibility="Collapsed" Data="M142.25,37 L128.75,44 146.40385,53.25" Fill="#26ECCE09" HorizontalAlignment="Right" Height="17" Margin="128,37,54,0" Stroke="#7FECCE09" StrokeThickness="3" Stretch="Fill" VerticalAlignment="Top" Width="18"/>
@@ -1096,21 +1096,50 @@
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
</UserControl.Resources>
<Grid>

<!--#region 测试按钮-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,100,0" Orientation="Horizontal">
<Button x:Name="StartButton" Width="100" Margin="10,0,0,0" Click="Button_Click" Cursor="Hand">开始</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_1">取菜</Button>
<Button x:Name="StopButton" Width="100" Margin="10,0,0,0" Click="StopButton_Click" Cursor="Hand">运输菜</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_2" Cursor="Hand">送空桶</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_3" Cursor="Hand">回去</Button>
<StackPanel>
<TextBlock Margin="5">停车桩测试</TextBlock>
<TextBox x:Name="tcz_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="设置有车" Cursor="Hand">设置有车</Button>
<Button Margin="5" Click="Button_Click" Tag="设置无车" Cursor="Hand">设置无车</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">料筒控制</TextBlock>
<TextBox x:Name="liaotong_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="启动" Cursor="Hand">启动</Button>
<Button Margin="5" Click="Button_Click" Tag="停止" Cursor="Hand">停止</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">设置物料</TextBlock>
<TextBox x:Name="liaotongwuliao_text" Margin="5">1</TextBox>
<TextBox x:Name="liaotongwuliaoshuliang_text" Margin="5">1</TextBox>

<Button Margin="5" Click="Button_Click" Tag="设置物料" Cursor="Hand">设置物料</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">小车测试</TextBlock>
<TextBox x:Name="xiaoche_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="小车停止" Cursor="Hand">小车停止</Button>
<ComboBox x:Name="控制命令" HorizontalAlignment="Left" Width="100"/>
<Button Margin="5" Click="Button_Click" Tag="运行小车" Cursor="Hand">运行小车</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">小车?物品</TextBlock>
<TextBox x:Name="xiaochewuping_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="有物品" Cursor="Hand">有物品</Button>
<Button Margin="5" Click="Button_Click" Tag="无物品" Cursor="Hand">无物品</Button>

<Button Width="100" Margin="10,0,0,0" Click="Button_Click_4" Cursor="Hand">停止</Button>

</StackPanel>
</StackPanel>
<!--#endregion-->

@@ -1235,18 +1264,155 @@
<Border Style="{DynamicResource border炒锅}" Grid.Column="4" HorizontalAlignment="Left">
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(5)号</TextBlock>
</Border>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="0">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="一号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_1.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_1.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_1.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_1.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="1">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="二号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_2.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_2.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_2.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_2.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="2">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="三号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_3.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_3.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_3.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_3.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="3">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="四号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_4.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_4.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_4.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_4.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="4">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="五号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_5.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_5.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_5.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_5.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Grid>
<!--#endregion-->

<!--#region 滚筒线,IsEnabled True代表有菜 false 空碗.Text:Start 执行动画 Tag:代表传输带上有几个菜碗-->
<StackPanel Orientation="Horizontal" Height="240" Width="580" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="290,0,0,0">
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_1.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_1.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" ></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(1)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(1)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_2.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_2.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(2)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(2)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_3.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_3.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0" ></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(3)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(3)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带空}" IsEnabled="False" Text="{Binding RollerLines_4.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_4.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="16" HorizontalAlignment="Right">空桶滚筒线</TextBlock>
</StackPanel>
@@ -1255,22 +1421,22 @@
<!--#region 停车桩与充电桩-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,30,0">
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(1号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(1号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(2号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(2号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(3号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(3号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(4号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(4号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="0,10,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(1号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="0,10,-25,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(5号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="-2,0,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(2号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="-2,0,-25,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(6号)</TextBlock>
</Border>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,100,0">


+ 123
- 34
FryPot_DosingSystem/View/AgvView.xaml.cs View File

@@ -27,46 +27,135 @@ namespace FryPot_DosingSystem.View
{
InitializeComponent();
this.DataContext = AgvViewModel.GetInstance();
控制命令.ItemsSource = AgvViewModel.GetInstance().GetCommand();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
// AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
AgvViewModel.GetInstance().ParkingPileModel_1.isBool = IsBool.No;
AgvViewModel.GetInstance().cartModel_1.isBool=IsBool.No;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.qc_1;
int id = 1;
if (sender is Button)
{
byte[] data;
bool istrue = false;
Button button = sender as Button;
if (button.Tag != null)
{
switch (button.Tag.ToString())
{
case "设置有车":
try
{
id=int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.Yes);
break;
case "设置无车":
try
{
id = int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.No);
break;
case "启动":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
break;
case "停止":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);
break;
case "设置物料":
try
{
id = int.Parse(liaotongwuliao_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-8 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线上数量(id, liaotongwuliaoshuliang_text.Text);
break;
case "小车停止":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车停止(id);
break;
case "运行小车":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车运动(id, AgvViewModel.GetInstance().GetCommandValue(控制命令.Text));
break;
case "有物品":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.Yes);
break;
case "无物品":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.No);
break;

}
}
}
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().RollerLines_1.isRun = IsRun.Start;
}

private void StopButton_Click(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().RollerLines_1.isRun = IsRun.Stop;
AgvViewModel.GetInstance().cartModel_1.isBool = IsBool.Yes;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.yc_1_1;
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.isBool = IsBool.No;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.hs_1;
}

private void Button_Click_3(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.hj;
AgvViewModel.GetInstance().ParkingPileModel_1.isBool = IsBool.Yes;
}

private void Button_Click_4(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;

}
}
}

+ 578
- 11
FryPot_DosingSystem/ViewModel/AgvViewModel.cs View File

@@ -2,9 +2,12 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem.ViewModel
{
@@ -30,25 +33,304 @@ namespace FryPot_DosingSystem.ViewModel
cartModel_2 = new CartModel();
cartModel_3 = new CartModel();
cartModel_4 = new CartModel();
//初始化滚筒线
RollerLines_1 = new RollerLinesModel();
RollerLines_2 = new RollerLinesModel();
RollerLines_3 = new RollerLinesModel();
RollerLines_4 = new RollerLinesModel();
//初始化停车桩
ParkingPileModel_1 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_2 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_3 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_4 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_5 = new ParkingPileModel { isBool = IsBool.No };
ParkingPileModel_6 = new ParkingPileModel { isBool = IsBool.No };
//初始化炒锅
wokModel_1 = new WokModel();
wokModel_2 = new WokModel();
wokModel_3 = new WokModel();
wokModel_4 = new WokModel();
wokModel_5 = new WokModel();
Test();
}
#endregion

#region 公共调用函数
public void Test()
{
RollerLines_2.DishesNum = "3";


wokModel_1.goodsName = "番茄炒蛋";
wokModel_1.workflows = new ObservableCollection<WorkflowModel>
{
new WorkflowModel {id=1,Name="取番茄",isBool= IsBool.Yes},
new WorkflowModel {id=2,Name="取蛋" } };
}
#endregion
/// <summary>
/// 设置停车桩或充电桩
/// </summary>
/// <param name="id">设置哪一个停车桩:1 2 3(5 6 为充电桩)</param>
/// <param name="isBool">是否有小车</param>
public void Set停车桩(int id, IsBool isBool)
{
try
{
switch (id)
{
case 1:
ParkingPileModel_1.isBool = isBool;
break;
case 2:
ParkingPileModel_2.isBool = isBool;
break;
case 3:
ParkingPileModel_3.isBool = isBool;
break;
case 4:
ParkingPileModel_4.isBool = isBool;
break;
case 5:
ParkingPileModel_5.isBool = isBool;
break;
case 6:
ParkingPileModel_6.isBool = isBool;
break;
}
}
catch (Exception ex)
{

#region 公共函数
}
}
/// <summary>
/// 小车停止
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
public void Set小车停止(int id)
{
try
{
switch (id)
{
case 1:
cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 2:
cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 3:
cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 4:
cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 控制小车运行
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
/// <param name="cart"></param>
public void Set小车运动(int id, CartMotionTrajectory cart)
{
try
{
switch (id)
{
case 1:
cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_1.cartMotionTrajectory = cart;
break;
case 2:
cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_2.cartMotionTrajectory = cart;
break;
case 3:
cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_3.cartMotionTrajectory = cart;
break;
case 4:
cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_4.cartMotionTrajectory = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 小车是否承载物品
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
/// <param name="cart"></param>
public void Set小车是否承载物品(int id, IsBool cart)
{
try
{
switch (id)
{
case 1:
cartModel_1.isBool = cart;
break;
case 2:
cartModel_2.isBool = cart;
break;
case 3:
cartModel_3.isBool = cart;
break;
case 4:
cartModel_4.isBool = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 小车是否承载物品
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
/// <param name="cart"></param>
public void Set滚筒线状态(int id, IsRun cart)
{
try
{
switch (id)
{
case 1:
RollerLines_1.isRun = cart;
break;
case 2:
RollerLines_2.isRun = cart;
break;
case 3:
RollerLines_3.isRun = cart;
break;
case 4:
RollerLines_4.isRun = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 滚筒线上数量
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
/// <param name="cart">默认: 1 - 8,最多承载 8个菜品或者8个空碗</param>
public void Set滚筒线上数量(int id, string cart)
{
try
{
switch (id)
{
case 1:
RollerLines_1.DishesNum = cart;
break;
case 2:
RollerLines_2.DishesNum = cart;
break;
case 3:
RollerLines_3.DishesNum = cart;
break;
case 4:
RollerLines_4.DishesNum = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 设置炒锅显示流程
/// </summary>
/// <param name="id">默认:1 2 3 4 5,代表五个炒锅</param>
/// <param name="mode"></param>
public void Set炒锅显示流程(int id, WokModel mode)
{
try
{
switch (id)
{
case 1:
wokModel_1=mode;
break;
case 2:
wokModel_2 = mode;
break;
case 3:
wokModel_3 = mode;
break;
case 4:
wokModel_4 = mode;
break;
case 5:
wokModel_5 = mode;
break;
}

}
catch (Exception ex)
{

}
}

/// <summary>
/// 获取所有命令
/// </summary>
public List<string> GetCommand()
{
List<string> vs = new List<string>();
try
{
vs = System.Enum.GetNames(typeof(CartMotionTrajectory))?.ToList();
}
catch (Exception ex)
{
return vs;
}
return vs;
}
/// <summary>
/// 根据命令获取值
/// </summary>
public CartMotionTrajectory GetCommandValue(string name)
{
return ToEnumValue<CartMotionTrajectory>(name);
}
/// <summary>
/// 根据枚举名称获取枚举值
/// </summary>
public T ToEnumValue<T>(string name)
{
return (T)Enum.Parse(typeof(T), name);
}
#endregion

#region 4个滚筒线控制
@@ -312,6 +594,98 @@ namespace FryPot_DosingSystem.ViewModel
}
#endregion

#region 5个炒锅流程控制
/// <summary>
/// 一号炒锅工作流程
/// </summary>
private WokModel _wokModel_1;
public WokModel wokModel_1
{
get
{
return _wokModel_1;
}
set
{
if (_wokModel_1 == value)
return;
_wokModel_1 = value;
OnPropertyChanged("wokModel_1");
}
}
/// <summary>
/// 二号炒锅工作流程
/// </summary>
private WokModel _wokModel_2;
public WokModel wokModel_2
{
get
{
return _wokModel_2;
}
set
{
if (_wokModel_2 == value)
return;
_wokModel_2 = value;
OnPropertyChanged("wokModel_2");
}
}
/// <summary>
/// 三号炒锅工作流程
/// </summary>
private WokModel _wokModel_3;
public WokModel wokModel_3
{
get
{
return _wokModel_3;
}
set
{
if (_wokModel_3 == value)
return;
_wokModel_3 = value;
OnPropertyChanged("wokModel_3");
}
}
/// <summary>
/// 四号炒锅工作流程
/// </summary>
private WokModel _wokModel_4;
public WokModel wokModel_4
{
get
{
return _wokModel_4;
}
set
{
if (_wokModel_4 == value)
return;
_wokModel_4 = value;
OnPropertyChanged("wokModel_4");
}
}
/// <summary>
/// 五号炒锅工作流程
/// </summary>
private WokModel _wokModel_5;
public WokModel wokModel_5
{
get
{
return _wokModel_5;
}
set
{
if (_wokModel_5 == value)
return;
_wokModel_5 = value;
OnPropertyChanged("wokModel_5");
}
}
#endregion
}

/// <summary>
@@ -319,7 +693,6 @@ namespace FryPot_DosingSystem.ViewModel
/// </summary>
public class CartModel : ObservableObject
{

/// <summary>
/// 车上是否有物品
/// </summary>
@@ -333,11 +706,10 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_isBool = value;
Text= _isBool.ToString();
Text = _isBool.ToString();
OnPropertyChanged("isBool");
}
}
/// <summary>
/// 车运动轨迹方式
/// </summary>
@@ -351,7 +723,7 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_cartMotionTrajectory = value;
Tag= _cartMotionTrajectory.ToString();
Tag = _cartMotionTrajectory.ToString();
OnPropertyChanged("cartMotionTrajectory");
}
}
@@ -437,7 +809,7 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_isRun = value;
Text= _isRun.ToString();
Text = _isRun.ToString();
OnPropertyChanged("isBool");
}
}
@@ -475,8 +847,6 @@ namespace FryPot_DosingSystem.ViewModel
OnPropertyChanged("DishesNum");
}
}


private string _Text = IsRun.Stop.ToString();
public string Text
{
@@ -491,6 +861,203 @@ namespace FryPot_DosingSystem.ViewModel
}
}
}
/// <summary>
/// 炒锅 流程控制
/// </summary>
public class WokModel : ObservableObject
{
/// <summary>
/// id
/// </summary>
private string _id;
public string id
{
get
{
return _id;
}
set
{
_id = value;
OnPropertyChanged("id");
}
}
/// <summary>
/// 订单id
/// </summary>
private string _orderID;
public string orderID
{
get
{
return _orderID;
}
set
{
_orderID = value;
OnPropertyChanged("orderID");
}
}
/// <summary>
/// 商品名称
/// </summary>
private string _goodsName;
public string goodsName
{
get
{
return _goodsName;
}
set
{
_goodsName = value;
OnPropertyChanged("goodsName");
}
}
/// <summary>
/// 其他信息
/// </summary>
private string _other;
public string other
{
get
{
return _other;
}
set
{
_other = value;
OnPropertyChanged("other");
}
}
/// <summary>
/// 工作流程
/// </summary>
private ObservableCollection<WorkflowModel> _workflows = new ObservableCollection<WorkflowModel>();
public ObservableCollection<WorkflowModel> workflows
{
get
{
return _workflows;
}
set
{
_workflows = value;
OnPropertyChanged("workflows");
}
}
public WokModel()
{
id = Guid.NewGuid().ToString();
workflows = new ObservableCollection<WorkflowModel>();
}
}

/// <summary>
/// 工作流程
/// </summary>
public class WorkflowModel : ObservableObject
{
/// <summary>
/// 序号默认:1-10
/// </summary>
private int _id=1;
public int id
{
get
{
return _id;
}
set
{
_id = value;
xh = GetXH.ID(_id);
OnPropertyChanged("id");
}
}
/// <summary>
/// 名称
/// </summary>
private string _Name;
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
OnPropertyChanged("Name");
}
}
/// <summary>
/// 是否已完成当前步骤
/// </summary>
private IsBool _isBool = IsBool.No;
public IsBool isBool
{
get
{
return _isBool;
}
set
{
_isBool = value;
if (_isBool == IsBool.Yes)
{
visibility = Visibility.Visible;
}
else
{
visibility = Visibility.Collapsed;
}
OnPropertyChanged("isBool");
}
}
private Visibility _visibility = Visibility.Collapsed;
public Visibility visibility
{
get
{
return _visibility;
}
set
{
_visibility = value;
OnPropertyChanged("visibility");
}
}
private string _xh;
public string xh
{
get
{
return _xh;
}
set
{
_xh = value;
OnPropertyChanged("xh");
}
}
}

/// <summary>
/// 获取序号
/// </summary>
static class GetXH
{
//①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿
public static string ID(int i)
{
string strbu = "① ";
string str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿";
if (i <= 50)
{
strbu= str.Substring(i-1, 1)+" ";
}
return strbu;
}
}
}

Loading…
Cancel
Save