瀏覽代碼

morkf

样式分支
yahaha 2 年之前
父節點
當前提交
11b5970de7
共有 3 個檔案被更改,包括 225 行新增1 行删除
  1. +21
    -1
      BPASmartClient.Device/BaseDevice.cs
  2. +178
    -0
      BPASmartClient/Control/StirFryView.xaml
  3. +26
    -0
      BPASmartClient/Control/StirFryView.xaml.cs

+ 21
- 1
BPASmartClient.Device/BaseDevice.cs 查看文件

@@ -103,6 +103,11 @@ namespace BPASmartClient.Device
/// </summary>
private List<IPeripheral> peripherals;

/// <summary>
/// <炒锅>:<外设状态,硬件设备数据>的键值对
/// </summary>
protected Dictionary<int, ConcurrentDictionary<string, object>> dicPort2peripheralStatus = new Dictionary<int, ConcurrentDictionary<string, object>>();

public Action<int, object> AddErrorAction { get; set; }
public Action<int, object> DeleteErrorAction { get; set; }
public List<Alarm> alarms { get; set; } = new List<Alarm>();
@@ -174,19 +179,34 @@ namespace BPASmartClient.Device
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
int i = 0;
foreach (var peripheral in peripherals)
{
string TypeName = peripheral.GetType().FullName.Replace("BPASmartClient.", "");
Status.Update($"{TypeName}.IsConnected", peripheral.IsConnected);
Status.Update($"{TypeName}.IsWork", peripheral.IsWork);
//做为炒锅与状态字典的新数据
ConcurrentDictionary<string, object> newPeripheralStatus = new ConcurrentDictionary<string, object>();
foreach (var key in peripheral.GetAllStatus().Keys)
{
peripheralStatus[key] = peripheral.GetAllStatus()[key];
//新的硬件设备数据存储
newPeripheralStatus[key] = peripheral.GetAllStatus()[key];
if (TypeName != "PLC.PLCMachine")
{
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]);
}
}
if(dicPort2peripheralStatus.ContainsKey(i))
{
dicPort2peripheralStatus[i] = newPeripheralStatus;
}
else
{
//将存储的新硬件设备数据放入字典中,i是作为炒锅编号。
dicPort2peripheralStatus.Add(i, newPeripheralStatus);
}
i++;
}

if (AddErrorAction != null && DeleteErrorAction != null)
@@ -352,7 +372,7 @@ namespace BPASmartClient.Device
{
ReadData();
Thread.Sleep(10);
}), $"ReadData:{DeviceId}");
}), $"ReadData:{DeviceId}",true);
#endregion

#region 任务流程


+ 178
- 0
BPASmartClient/Control/StirFryView.xaml 查看文件

@@ -0,0 +1,178 @@
<UserControl x:Class="Control.StirFryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Control"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
Background="{x:Null}"
>

<UserControl.DataContext>
<vm:OrderStatusViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />-->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</UserControl.Resources>

<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 表格标题栏设置-->
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="菜品名" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="商品名" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="开始时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="结束时间" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="制作状态" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" />
</Grid>

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.SortNum}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding StartDate}" />

<Grid Grid.Column="3">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding EndDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<Grid Grid.Column="5">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Grid Grid.Column="6">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding CompleteDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1,0,1,1" />

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->
</Grid>
</UserControl>

+ 26
- 0
BPASmartClient/Control/StirFryView.xaml.cs 查看文件

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Control
{
/// <summary>
/// StirFryView.xaml 的交互逻辑
/// </summary>
public partial class StirFryView : UserControl
{
public StirFryView()
{
InitializeComponent();
}
}
}

Loading…
取消
儲存