@@ -21,6 +21,8 @@ | |||
<ItemGroup> | |||
<None Remove="Fonts\80号-萌趣小鱼体.ttf" /> | |||
<None Remove="Fonts\iconfont.ttf" /> | |||
<None Remove="Fonts\MT\iconfont.ttf" /> | |||
<None Remove="Fonts\naicha.ttf" /> | |||
<None Remove="Fonts\Quartz Regular.ttf" /> | |||
<None Remove="Image\AGV\agv.png" /> | |||
<None Remove="Image\AGV\AGV小车.png" /> | |||
@@ -225,6 +227,8 @@ | |||
<ItemGroup> | |||
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" /> | |||
<Resource Include="Fonts\iconfont.ttf" /> | |||
<Resource Include="Fonts\MT\iconfont.ttf" /> | |||
<Resource Include="Fonts\naicha.ttf" /> | |||
<Resource Include="Fonts\Quartz Regular.ttf" /> | |||
<Resource Include="Image\AGV\agv.png" /> | |||
<Resource Include="Image\AGV\AGV小车.png" /> | |||
@@ -797,6 +797,16 @@ | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="boreder奶茶背景" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/背景矢量/beijing.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border界面背景" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
@@ -0,0 +1,44 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<appSettings> | |||
<!--通用配置--> | |||
<!--<add key="ClientId" value="43"/>--> | |||
<add key="IsEnableTest" value="false"/> | |||
<!--测试环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="test1_HostComputer"/> | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<!--开发环境--> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="DEV.Config"/> | |||
<!--正式环境--> | |||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="TEST1.Config"/>--> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||
<!--LOCAL:直接使用下方本地“设备连接信息”--> | |||
<add key="StartupMode" value="API"/> | |||
<add key="ProductKey" value="grgpECHSL7q"/> | |||
<add key="DeviceName" value="qsqdzklb"/> | |||
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/> | |||
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/> | |||
<!--外设配置--> | |||
<add key="COM_Coffee" value="COM3"/> | |||
<add key="BAUD_Coffee" value="115200"/> | |||
<add key="COM_IceCream" value="COM12"/> | |||
<add key="BAUD_IceCream" value="9600"/> | |||
<add key="IceCream_CXB_Threshold" value="90"/> | |||
<add key="COM_ICChip" value="COM6"/> | |||
<add key="BAUD_IChip" value="9600"/> | |||
</appSettings> | |||
</configuration> |
@@ -0,0 +1,9 @@ | |||
<Application x:Class="BPASmartClient.MilkWithTea.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPASmartClient.MilkWithTea | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -0,0 +1,24 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="DeviceInfo.xml"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</None> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="ViewModel\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,86 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<BPADevices> | |||
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot"> | |||
<Parameters> | |||
<IpAddress>127.0.0.1</IpAddress> | |||
<HandSensor>1</HandSensor> | |||
<OutputSingalValue>0</OutputSingalValue> | |||
</Parameters> | |||
</Peripheral> | |||
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine"> | |||
<Parameters> | |||
<PortName>COM5</PortName> | |||
<BaudRate>9600</BaudRate> | |||
</Parameters> | |||
</Peripheral> | |||
<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine"> | |||
<Parameters> | |||
<PortName>COM5</PortName> | |||
<BaudRate>9600</BaudRate> | |||
</Parameters> | |||
</Peripheral> | |||
</Peripherals> | |||
</Device>--> | |||
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Control_MorkT" DeviceId="29"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine"> | |||
<Parameters> | |||
<PortName>COM4</PortName> | |||
<BaudRate>115200</BaudRate>--> | |||
<!--<IpAddress>192.168.6.1</IpAddress> | |||
<Port>502</Port> | |||
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>--> | |||
<!-- | |||
</Parameters> | |||
</Peripheral> | |||
<Peripheral Module="BPASmartClient.GSIceCream.IceCreamMachine"> | |||
<Parameters> | |||
<PortName>COM6</PortName> | |||
<BaudRate>9600</BaudRate> | |||
</Parameters> | |||
</Peripheral> | |||
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine"> | |||
<Parameters> | |||
<PortName>COM7</PortName> | |||
<BaudRate>9600</BaudRate> | |||
</Parameters> | |||
</Peripheral> | |||
<!<Peripheral Module="BPASmartClient.Lebai.LebaiRobot"> | |||
<Parameters> | |||
<IpAddress>192.168.2.100</IpAddress> | |||
<HandSensor>1</HandSensor> | |||
<OutputSingalValue>0</OutputSingalValue> | |||
</Parameters> | |||
</Peripheral>--> | |||
<!--</Peripherals> | |||
</Device>-->--> | |||
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> | |||
<Parameters> | |||
<IpAddress>192.168.6.1</IpAddress> | |||
<Port>502</Port> | |||
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress> | |||
</Parameters> | |||
</Peripheral> | |||
</Peripherals> | |||
</Device> | |||
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> | |||
<Parameters> | |||
<IpAddress>127.0.0.1</IpAddress> | |||
<Port>502</Port> | |||
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress> | |||
<PLCReadAddress>M,M230.0,24</PLCReadAddress> | |||
</Parameters> | |||
</Peripheral> | |||
</Peripherals> | |||
</Device>-->-->--> | |||
</BPADevices> |
@@ -0,0 +1,125 @@ | |||
<Window x:Class="BPASmartClient.MilkWithTea.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="1000" Width="1600" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStartupLocation="CenterScreen"> | |||
<Window.Resources> | |||
<Style x:Key="menuButtonTemplate" TargetType="{x:Type Button}"> | |||
<Setter Property="Focusable" Value="False"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
<Setter Property="Padding" Value="1"/> | |||
<Setter Property="FontSize" Value="20"/> | |||
<Setter Property="Foreground" Value="AliceBlue"/> | |||
<Setter Property="Margin" Value="0,20"/> | |||
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | |||
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsDefaulted" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" TargetName="border" Value="#63BCFB"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" TargetName="border" Value="#63BCFB"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/> | |||
</Trigger> | |||
<Trigger Property="ToggleButton.IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/> | |||
<Setter Property="Foreground" Value="#FF838383"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Border Background="#FF37A0EA" CornerRadius="20" BorderThickness="0"> | |||
<Grid Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions > | |||
<Grid.RowDefinitions > | |||
<RowDefinition Height="67"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.RowSpan="3" MouseDown="Grid_MouseDown"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="20"/> | |||
<RowDefinition Height="150"/> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="20"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="奶茶" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti" HorizontalAlignment="Center"/> | |||
<TextBlock Text="味魔方" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti"/> | |||
</StackPanel> | |||
<Button Grid.Row="2" Style="{StaticResource menuButtonTemplate}"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="" Margin="5,0"/> | |||
<TextBlock Text="主页"/> | |||
</StackPanel> | |||
</Button> | |||
<Button Grid.Row="3" Style="{StaticResource menuButtonTemplate}"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="" Margin="5,0"/> | |||
<TextBlock Text="日志"/> | |||
</StackPanel> | |||
</Button> | |||
<Button Grid.Row="4" Style="{StaticResource menuButtonTemplate}"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="" Margin="5,0"/> | |||
<TextBlock Text="配置"/> | |||
</StackPanel> | |||
</Button> | |||
<Button Grid.Row="5" Style="{StaticResource menuButtonTemplate}"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="" Margin="5,0"/> | |||
<TextBlock Text="参数"/> | |||
</StackPanel> | |||
</Button> | |||
<control:DateTimeUI Grid.Row="7" HorizontalContentAlignment="Center" /> | |||
</Grid> | |||
<Border Grid.Column="1" Grid.RowSpan="3" Background="Transparent"> | |||
<Border Background="White" CornerRadius="20" BorderThickness="0"> | |||
<Grid> | |||
<ContentControl x:Name="contentRegion"> | |||
<local:MainControlView/> | |||
</ContentControl> | |||
</Grid> | |||
</Border> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,37 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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 BPASmartClient.MilkWithTea | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Grid_MouseDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,90 @@ | |||
<UserControl x:Class="BPASmartClient.MilkWithTea.View.MainControlView" | |||
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:BPASmartClient.MilkWithTea.View" | |||
mc:Ignorable="d" | |||
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent"> | |||
<UserControl.Resources> | |||
<!--标题栏样式--> | |||
<Style TargetType="DataGridColumnHeader"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="30" /> | |||
<Setter Property="Foreground" Value="DarkSlateGray" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridColumnHeader"> | |||
<Border x:Name="BackgroundBorder" BorderThickness="1,1,1,1" | |||
BorderBrush="Black" | |||
Width="Auto"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" | |||
HorizontalAlignment="Center" /> | |||
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" | |||
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0" | |||
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> | |||
<Rectangle Width="1" Fill="Black" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Height" Value="25" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Background="#F3F6F9" Margin="20"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="6*"/> | |||
<ColumnDefinition Width="1"/> | |||
<ColumnDefinition Width="3*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="订单队列" FontWeight="Bold" Foreground="DarkSlateGray" VerticalAlignment="Center" Margin="15,30,0,0" FontSize="28"/> | |||
<DataGrid Grid.Row="1" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding }" | |||
FrozenColumnCount="1" Margin="10" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False"> | |||
<DataGrid.Columns> | |||
<DataGridTextColumn Header="取餐号" Width="*"/> | |||
<DataGridTextColumn Header="商品名" Width="2*" /> | |||
<DataGridTextColumn Header="开始时间" Width="2*"/> | |||
<DataGridTextColumn Header="结束时间" Width="2*"/> | |||
<DataGridTextColumn Header="制作状态" Width="2*"/> | |||
<DataGridTextColumn Header="完成时间" Width="2*" /> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<Border Grid.Column="1" Grid.RowSpan="5" BorderBrush="Black" BorderThickness="1" /> | |||
<Grid Grid.Column="2" Grid.RowSpan="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Grid.ColumnSpan="2" Text="本地奶茶下单" FontWeight="Bold" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="28"/> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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 BPASmartClient.MilkWithTea.View | |||
{ | |||
/// <summary> | |||
/// MainControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MainControlView : UserControl | |||
{ | |||
public MainControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -24,12 +24,12 @@ | |||
<ColumnDefinition Width="10*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="14*"/> | |||
<RowDefinition Height="8*"/> | |||
<RowDefinition Height="20*"/> | |||
<RowDefinition Height="384*"/> | |||
<RowDefinition Height="111*"/> | |||
<RowDefinition Height="5*"/> | |||
</Grid.RowDefinitions> | |||
<GroupBox Grid.ColumnSpan="2" | |||
<GroupBox Grid.ColumnSpan="2" Visibility="Collapsed" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Header=" 乐白机器人 "> | |||
@@ -91,15 +91,15 @@ | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
<GroupBox Grid.Row="2" | |||
<GroupBox Grid.Row="0" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Header=" 冰淇淋机器 "> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="10*" /> | |||
<RowDefinition Height="10*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="连接状态" /> | |||
<TextBlock Text="{Binding IceCreamConnected}" | |||
@@ -166,17 +166,17 @@ | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>冰淇淋</TextBlock> | |||
<Button Command="{Binding Button_MakeIceCreamCommand}" | |||
Margin="20,0" | |||
Margin="40,5" Height="50" Width="170" | |||
Content="制作" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox Width="100" | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="70"> | |||
<TextBlock >模式</TextBlock> | |||
<ComboBox Width="100" Height="40" FontSize="22" | |||
Margin="20,0" | |||
ItemsSource="{Binding IceCreamModes}" | |||
SelectedItem="{Binding SelecteIceCreamdMode}" /> | |||
<Button Command="{Binding Button_SetIceCreamModelCommand}" | |||
Margin="20,0" | |||
Margin="20,0" Height="50" Width="150" | |||
Content="设置" /> | |||
</StackPanel> | |||
</StackPanel> | |||
@@ -224,8 +224,8 @@ | |||
</ListBox> | |||
</Grid> | |||
</GroupBox>--> | |||
<GroupBox Grid.Row="2" Grid.Column="1" | |||
<GroupBox Grid.Row="0" Grid.Column="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Header=" 咖啡机"> | |||
@@ -275,26 +275,25 @@ | |||
Text="{Binding CaffeeFault}" Height="22" Width="60" /> | |||
</Grid> | |||
<StackPanel Grid.Row="2" Orientation="Vertical"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60"> | |||
<TextBlock>饮品</TextBlock> | |||
<ComboBox Margin="10,0" | |||
Width="100" | |||
<ComboBox Margin="10,0" Height="40" FontSize="20" | |||
Width="120" | |||
ItemsSource="{Binding Coffees}" | |||
SelectedItem="{Binding SelectedCoffee}" /> | |||
<Button Margin="10,0" | |||
<Button Margin="10,0" Height="40" Width="120" | |||
Command="{}" | |||
Content="制作"/> | |||
<Button Margin="10,0" | |||
<Button Margin="10,0" Height="40" Width="120" | |||
Command="{}" | |||
Content="停止制作" Cursor="Hand"/> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox Margin="10,0" | |||
Width="100" | |||
<ComboBox Margin="10,0" Height="40" Width="120" FontSize="20" | |||
ItemsSource="{Binding CoffeeCmds}" | |||
SelectedItem="{Binding SelectedCoffeeCmd}"/> | |||
<Button Margin="10,0" | |||
<Button Margin="10,0" Height="40" Width="120" | |||
Command="{}" | |||
Content="设置" Cursor="Hand"/> | |||
</StackPanel> | |||
@@ -307,11 +306,11 @@ | |||
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000"> | |||
<StackPanel Orientation="Horizontal" | |||
VerticalAlignment="Center" > | |||
<Button Content="咖啡杯落杯" Height="30" Width="120" | |||
<Button Content="咖啡杯落杯" Height="40" Width="170" | |||
Command="{Binding Button_CupControlCommand}" | |||
CommandParameter="CUP_COFFEE" | |||
Margin="10,10,50,10" Cursor="Hand"/> | |||
<Button Content="冰淇淋杯落杯" Height="30" Width="120" | |||
<Button Content="冰淇淋杯落杯" Height="40" Width="170" | |||
Command="{Binding Button_CupControlCommand}" | |||
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10" | |||
/> | |||
@@ -45,4 +45,8 @@ | |||
<Folder Include="Control\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" /> | |||
</ItemGroup> | |||
</Project> |
@@ -17,11 +17,17 @@ namespace BPASmartClient.MorkTM | |||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.TMC_MT; } } | |||
GVL_MorkTM morkTM = new GVL_MorkTM(); | |||
PolymerBatching polymer = new PolymerBatching(); | |||
//浮点数放大倍数 | |||
const int expand = 100; | |||
public override void DoMain() | |||
{ | |||
ServerInit(); | |||
DataParse(); | |||
PolymerBatching.GetMaterialInfo(); | |||
polymer.GetMaterialInfo(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); | |||
@@ -31,6 +37,8 @@ namespace BPASmartClient.MorkTM | |||
{ | |||
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); | |||
}), "WriteBools"); | |||
morkTM.ReachPosions = new List<bool>() { morkTM.ReachOutPosion_0, morkTM.ReachPosion_1, morkTM.ReachPosion_2, morkTM.ReachPosion_3, morkTM.ReachPosion_4, morkTM.ReachPosion_5, morkTM.ReachPosion_6 }; | |||
DeviceProcessLogShow("设备初始化完成"); | |||
@@ -68,13 +76,13 @@ namespace BPASmartClient.MorkTM | |||
OrderCount++; | |||
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
Dictionary<string, int> OrderPushes = new Dictionary<string, int>(); | |||
Dictionary<int, float> OrderPushes = new Dictionary<int, float>(); | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount); | |||
OrderPushes.TryAdd(int.Parse(res.BatchingLoc), item.BatchingCount); | |||
} | |||
} | |||
@@ -99,7 +107,6 @@ namespace BPASmartClient.MorkTM | |||
}); | |||
} | |||
public override void MainTask() | |||
{ | |||
IsHealth = true; | |||
@@ -108,30 +115,231 @@ namespace BPASmartClient.MorkTM | |||
private void MakeTeaWithMilkProcess() | |||
{ | |||
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0) | |||
if (morkTM.morkOrderPushesTeaWithMilk.Count > 0) | |||
{ | |||
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) | |||
if (morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) //&&原点位置是否有杯子) | |||
{ | |||
SetMatertialWeight(orderLoc.GoodPushes);//设置物料出料量 | |||
morkTM.RecipesPushes.Clear(); | |||
morkTM.RecipesPushes = orderLoc.GoodPushes; | |||
foreach(var item in morkTM.RecipesPushes) | |||
foreach (var item in morkTM.RecipesPushes) | |||
{ | |||
WriteData(item.Key,item.Value); | |||
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete)) | |||
{ | |||
Thread.Sleep(100); | |||
} | |||
PosionTurnOn(item.Key);//设定转盘位置并等待到位信号 | |||
Thread.Sleep(1000); | |||
OpenUsePassageWay(item.Key);//打开通道并等待出料完成 | |||
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 打开出料通道 | |||
/// </summary> | |||
private void OpenUsePassageWay(int pos) | |||
{ | |||
string address = ""; | |||
foreach (var item in polymer.OutPosionPLCs) | |||
{ | |||
if(item.posion is MaterialPosion posion) | |||
{ | |||
if(posion == (MaterialPosion)pos) | |||
{ | |||
WriteData(item.SetPLCPosion,true); | |||
address = item.GetPLCPosion; | |||
return; | |||
} | |||
} | |||
} | |||
while(!morkTM.outMaterialCompletes[pos]) //等待出料完成 | |||
{ | |||
Thread.Sleep(1000); | |||
} | |||
WriteData(address, false); | |||
} | |||
/// <summary> | |||
/// 转盘旋转位置设定 | |||
/// </summary> | |||
/// <param name="posion"></param> | |||
private void PosionTurnOn(int posion) | |||
{ | |||
int i = 0; | |||
string address = ""; | |||
foreach (var item in polymer.GoodsMaterialPosion) | |||
{ | |||
if (item.Key.Contains((MaterialPosion)posion)) | |||
{ | |||
WriteData(item.Value.SetPLCPosion,true); | |||
i = Convert.ToInt32(item.Value.posion); | |||
address = item.Value.GetPLCPosion; | |||
return; | |||
} | |||
} | |||
while(!morkTM.ReachPosions[i])//等待转盘到达信号 | |||
{ | |||
Thread.Sleep(1000); | |||
} | |||
if(address != null) WriteData(address, false);//把信号置为0 | |||
} | |||
/// <summary> | |||
/// 把每一个物料的用量写入plc | |||
/// </summary> | |||
/// <param name="materials"></param> | |||
private void SetMatertialWeight(Dictionary<int, float> materials) | |||
{ | |||
foreach (var material in materials) | |||
{ | |||
int value = Convert.ToInt32(material.Value*expand); | |||
WriteData(polymer.MaterialPosionList[(MaterialPosion)material.Key], value); | |||
Thread.Sleep(100); | |||
} | |||
} | |||
public override void ReadData() | |||
{ | |||
throw new NotImplementedException(); | |||
//启用通道的地址1 | |||
GetStatus("M0.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
} | |||
})); | |||
//启用通道的地址2 | |||
GetStatus("M1.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
} | |||
})); | |||
//启用通道的地址3 | |||
GetStatus("M2.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
} | |||
})); | |||
//打开通道的地址1 | |||
GetStatus("M10.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
morkTM.UsePassageWay_1 = bools[0]; | |||
morkTM.UsePassageWay_2 = bools[1]; | |||
morkTM.UsePassageWay_3 = bools[2]; | |||
morkTM.UsePassageWay_4 = bools[3]; | |||
morkTM.UsePassageWay_5 = bools[4]; | |||
morkTM.UsePassageWay_6 = bools[5]; | |||
morkTM.UsePassageWay_7 = bools[6]; | |||
morkTM.UsePassageWay_8 = bools[7]; | |||
} | |||
})); | |||
//打开通道的地址2 | |||
GetStatus("M11.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
morkTM.UsePassageWay_9 = bools[0]; | |||
morkTM.UsePassageWay_10 = bools[1]; | |||
morkTM.UsePassageWay_11 = bools[2]; | |||
morkTM.UsePassageWay_12 = bools[3]; | |||
morkTM.UsePassageWay_13 = bools[4]; | |||
morkTM.UsePassageWay_14 = bools[5]; | |||
morkTM.UsePassageWay_15 = bools[6]; | |||
morkTM.UsePassageWay_16 = bools[7]; | |||
} | |||
})); | |||
//打开通道的地址3 | |||
GetStatus("M12.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8) | |||
{ | |||
morkTM.UsePassageWay_17 = bools[0]; | |||
morkTM.UsePassageWay_18 = bools[1]; | |||
morkTM.UsePassageWay_19 = bools[2]; | |||
morkTM.UsePassageWay_20 = bools[3]; | |||
morkTM.UsePassageWay_21 = bools[4]; | |||
morkTM.UsePassageWay_22 = bools[5]; | |||
morkTM.UsePassageWay_23 = bools[6]; | |||
morkTM.UsePassageWay_24 = bools[7]; | |||
} | |||
})); | |||
//打开通道的地址4 | |||
GetStatus("M13.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 4) | |||
{ | |||
morkTM.UsePassageWay_25 = bools[0]; | |||
morkTM.UsePassageWay_26 = bools[1]; | |||
morkTM.UsePassageWay_27 = bools[2]; | |||
morkTM.UsePassageWay_28 = bools[3]; | |||
} | |||
})); | |||
GetStatus("M50.0",new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28) | |||
{ | |||
for (int i = 0; i < 28; i++) | |||
{ | |||
if (morkTM.outMaterialCompletes.ContainsKey(i+1)) | |||
{ | |||
morkTM.outMaterialCompletes[i+1] = bools[i]; | |||
} | |||
else | |||
{ | |||
morkTM.outMaterialCompletes.Add(i+1, bools[i]); | |||
} | |||
} | |||
} | |||
})); | |||
//转盘移动的地址 | |||
GetStatus("M4.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7) | |||
{ | |||
} | |||
})); | |||
//装盘移动到位的地址 | |||
GetStatus("M14.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7) | |||
{ | |||
morkTM.ReachPosion_1 = bools[0]; | |||
morkTM.ReachPosion_2 = bools[1]; | |||
morkTM.ReachPosion_3 = bools[2]; | |||
morkTM.ReachPosion_4 = bools[3]; | |||
morkTM.ReachPosion_5 = bools[4]; | |||
morkTM.ReachPosion_6 = bools[5]; | |||
morkTM.ReachOutPosion_0 = bools[6]; | |||
for (int i = 0; i < 7; i++) | |||
{ | |||
morkTM.ReachPosions[i] = bools[i]; | |||
} | |||
} | |||
})); | |||
} | |||
public override void ResetProgram() | |||
@@ -155,6 +363,7 @@ namespace BPASmartClient.MorkTM | |||
} | |||
} | |||
} | |||
public override void SimOrder() | |||
{ | |||
@@ -22,12 +22,213 @@ namespace BPASmartClient.MorkTM | |||
/// <summary> | |||
/// 奶茶配料的队列 | |||
/// </summary> | |||
public Dictionary<string, int> RecipesPushes = new Dictionary<string, int>(); | |||
public Dictionary<int, float> RecipesPushes = new Dictionary<int, float>(); | |||
/// <summary> | |||
/// | |||
/// PLC——转盘到达点位集合 | |||
/// </summary> | |||
[VariableMonitor("出料完成", "", "")] | |||
public bool OutMaterialComplete { get; set; } | |||
public List<bool> ReachPosions = new List<bool>(); | |||
/// <summary> | |||
/// PLC-- 通道出料完成信号集合 | |||
/// </summary> | |||
public Dictionary< int,bool> outMaterialCompletes = new Dictionary<int,bool>(); | |||
[VariableMonitor("打开通道1", "M10.0", "400")] | |||
public bool UsePassageWay_1 { get; set; } | |||
[VariableMonitor("打开通道2", "M10.1", "401")] | |||
public bool UsePassageWay_2 { get; set; } | |||
[VariableMonitor("打开通道3", "M10.2", "402")] | |||
public bool UsePassageWay_3 { get; set; } | |||
[VariableMonitor("打开通道4", "M10.3", "403")] | |||
public bool UsePassageWay_4 { get; set; } | |||
[VariableMonitor("打开通道5", "M10.4", "404")] | |||
public bool UsePassageWay_5 { get; set; } | |||
[VariableMonitor("打开通道6", "M10.5", "405")] | |||
public bool UsePassageWay_6 { get; set; } | |||
[VariableMonitor("打开通道7", "M10.6", "406")] | |||
public bool UsePassageWay_7 { get; set; } | |||
[VariableMonitor("打开通道8", "M10.7", "407")] | |||
public bool UsePassageWay_8 { get; set; } | |||
[VariableMonitor("打开通道9", "M11.0", "408")] | |||
public bool UsePassageWay_9 { get; set; } | |||
[VariableMonitor("打开通道10", "M11.1", "409")] | |||
public bool UsePassageWay_10 { get; set; } | |||
[VariableMonitor("打开通道11", "M11.2", "410")] | |||
public bool UsePassageWay_11 { get; set; } | |||
[VariableMonitor("打开通道12", "M11.3", "411")] | |||
public bool UsePassageWay_12 { get; set; } | |||
[VariableMonitor("打开通道13", "M11.4", "412")] | |||
public bool UsePassageWay_13 { get; set; } | |||
[VariableMonitor("打开通道14", "M11.5", "413")] | |||
public bool UsePassageWay_14 { get; set; } | |||
[VariableMonitor("打开通道15", "M11.6", "414")] | |||
public bool UsePassageWay_15 { get; set; } | |||
[VariableMonitor("打开通道16", "M11.7", "415")] | |||
public bool UsePassageWay_16 { get; set; } | |||
[VariableMonitor("打开通道17", "M12.0", "416")] | |||
public bool UsePassageWay_17 { get; set; } | |||
[VariableMonitor("打开通道18", "M12.1", "417")] | |||
public bool UsePassageWay_18 { get; set; } | |||
[VariableMonitor("打开通道19", "M12.2", "418")] | |||
public bool UsePassageWay_19 { get; set; } | |||
[VariableMonitor("打开通道20", "M12.3", "419")] | |||
public bool UsePassageWay_20 { get; set; } | |||
[VariableMonitor("打开通道21", "M12.4", "420")] | |||
public bool UsePassageWay_21 { get; set; } | |||
[VariableMonitor("打开通道22", "M12.5", "421")] | |||
public bool UsePassageWay_22 { get; set; } | |||
[VariableMonitor("打开通道23", "M12.6", "422")] | |||
public bool UsePassageWay_23 { get; set; } | |||
[VariableMonitor("打开通道24", "M12.7", "423")] | |||
public bool UsePassageWay_24 { get; set; } | |||
[VariableMonitor("打开通道25", "M13.0", "424")] | |||
public bool UsePassageWay_25 { get; set; } | |||
[VariableMonitor("打开通道26", "M13.1", "425")] | |||
public bool UsePassageWay_26 { get; set; } | |||
[VariableMonitor("打开通道27", "M13.2", "426")] | |||
public bool UsePassageWay_27 { get; set; } | |||
[VariableMonitor("打开通道28", "M13.3", "427")] | |||
public bool UsePassageWay_28 { get; set; } | |||
[VariableMonitor("通道出料完成信号1", "M50.0", "720")] | |||
public bool OutMateraiComplete_1 { get; set; } | |||
[VariableMonitor("通道出料完成信号2", "M50.1", "721")] | |||
public bool OutMateraiComplete_2 { get; set; } | |||
[VariableMonitor("通道出料完成信号3", "M50.2", "722")] | |||
public bool OutMateraiComplete_3 { get; set; } | |||
[VariableMonitor("通道出料完成信号4", "M50.3", "723")] | |||
public bool OutMateraiComplete_4 { get; set; } | |||
[VariableMonitor("通道出料完成信号5", "M50.4", "724")] | |||
public bool OutMateraiComplete_5 { get; set; } | |||
[VariableMonitor("通道出料完成信号6", "M50.5", "725")] | |||
public bool OutMateraiComplete_6 { get; set; } | |||
[VariableMonitor("通道出料完成信号7", "M50.6", "726")] | |||
public bool OutMateraiComplete_7 { get; set; } | |||
[VariableMonitor("通道出料完成信号8", "M50.7", "727")] | |||
public bool OutMateraiComplete_8 { get; set; } | |||
[VariableMonitor("通道出料完成信号9", "M51.0", "728")] | |||
public bool OutMateraiComplete_9 { get; set; } | |||
[VariableMonitor("通道出料完成信号10", "M51.1", "729")] | |||
public bool OutMateraiComplete_10 { get; set; } | |||
[VariableMonitor("通道出料完成信号11", "M51.2", "730")] | |||
public bool OutMateraiComplete_11 { get; set; } | |||
[VariableMonitor("通道出料完成信号12", "M51.3", "731")] | |||
public bool OutMateraiComplete_12 { get; set; } | |||
[VariableMonitor("通道出料完成信号13", "M51.4", "732")] | |||
public bool OutMateraiComplete_13 { get; set; } | |||
[VariableMonitor("通道出料完成信号14", "M51.5", "733")] | |||
public bool OutMateraiComplete_14 { get; set; } | |||
[VariableMonitor("通道出料完成信号15", "M51.6", "734")] | |||
public bool OutMateraiComplete_15 { get; set; } | |||
[VariableMonitor("通道出料完成信号16", "M51.7", "735")] | |||
public bool OutMateraiComplete_16 { get; set; } | |||
[VariableMonitor("通道出料完成信号17", "M52.0", "736")] | |||
public bool OutMateraiComplete_17 { get; set; } | |||
[VariableMonitor("通道出料完成信号18", "M52.1", "737")] | |||
public bool OutMateraiComplete_18 { get; set; } | |||
[VariableMonitor("通道出料完成信号19", "M52.2", "738")] | |||
public bool OutMateraiComplete_19 { get; set; } | |||
[VariableMonitor("通道出料完成信号20", "M52.3", "739")] | |||
public bool OutMateraiComplete_20 { get; set; } | |||
[VariableMonitor("通道出料完成信号21", "M52.4", "740")] | |||
public bool OutMateraiComplete_21 { get; set; } | |||
[VariableMonitor("通道出料完成信号22", "M52.5", "741")] | |||
public bool OutMateraiComplete_22 { get; set; } | |||
[VariableMonitor("通道出料完成信号23", "M52.6", "742")] | |||
public bool OutMateraiComplete_23 { get; set; } | |||
[VariableMonitor("通道出料完成信号24", "M52.7", "743")] | |||
public bool OutMateraiComplete_24 { get; set; } | |||
[VariableMonitor("通道出料完成信号25", "M53.0", "744")] | |||
public bool OutMateraiComplete_25 { get; set; } | |||
[VariableMonitor("通道出料完成信号26", "M53.1", "744")] | |||
public bool OutMateraiComplete_26 { get; set; } | |||
[VariableMonitor("通道出料完成信号27", "M53.2", "745")] | |||
public bool OutMateraiComplete_27 { get; set; } | |||
[VariableMonitor("通道出料完成信号28", "M53.3", "746")] | |||
public bool OutMateraiComplete_28 { get; set; } | |||
[VariableMonitor("到达一号位置", "M14.0", "432")] | |||
public bool ReachPosion_1 { get; set; } | |||
[VariableMonitor("到达二号位置", "M14.1", "433")] | |||
public bool ReachPosion_2 { get; set; } | |||
[VariableMonitor("到达三号位置", "M14.2", "434")] | |||
public bool ReachPosion_3 { get; set; } | |||
[VariableMonitor("到达四号位置", "M14.3", "435")] | |||
public bool ReachPosion_4 { get; set; } | |||
[VariableMonitor("到达五号位置", "M14.4", "436")] | |||
public bool ReachPosion_5 { get; set; } | |||
[VariableMonitor("到达六号位置", "M14.5", "437")] | |||
public bool ReachPosion_6 { get; set; } | |||
[VariableMonitor("到达取料位置", "M14.6", "438")] | |||
public bool ReachOutPosion_0 { get; set; } | |||
} | |||
} |
@@ -0,0 +1,68 @@ | |||
using BPASmartClient.MorkTM; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Text; | |||
namespace Model | |||
{ | |||
public class LocalTeaWithMilkConfig: ObservableObject | |||
{ | |||
/// <summary> | |||
/// 奶茶名称 | |||
/// </summary> | |||
public string GoodNames { get { return _goodNames; } set { _goodNames = value; OnPropertyChanged(); } } | |||
private string _goodNames; | |||
/// <summary> | |||
/// 奶茶配方 | |||
/// </summary> | |||
public ObservableCollection<MaterialRecipe> materialRecipes = new ObservableCollection<MaterialRecipe>(); | |||
} | |||
public class MaterialRecipe:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 物料ID | |||
/// </summary> | |||
public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } } | |||
private int _materialID =1; | |||
/// <summary> | |||
/// 物料位置 | |||
/// </summary> | |||
public string Material { get { return _material; } set { _material = value; OnPropertyChanged(); } } | |||
private string _material ; | |||
/// <summary> | |||
/// 物料的出料量 | |||
/// </summary> | |||
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | |||
private int _materialWeight = 10; | |||
} | |||
public class LocalMaterialRecipes: ObservableObject | |||
{ | |||
/// <summary> | |||
/// 奶茶名称 | |||
/// </summary> | |||
public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } } | |||
private string _recipeName; | |||
/// <summary> | |||
/// 配方信息 | |||
/// </summary> | |||
public ObservableCollection<MaterialRecipe> RecipeNotes = new ObservableCollection<MaterialRecipe>(); | |||
} | |||
public class MaterailNameAndPosion: ObservableObject | |||
{ | |||
public string MaterialPosion { get { return _materaiPosion; } set { _materaiPosion = value; OnPropertyChanged(); } } | |||
private string _materaiPosion; | |||
public string MaterialName { get { return _materailName; } set { _materailName = value; OnPropertyChanged(); } } | |||
private string _materailName; | |||
} | |||
} |
@@ -13,6 +13,7 @@ namespace BPASmartClient.MorkTM | |||
public ushort RecipeNumber { get; set; } | |||
public string GoodName { get; set; } | |||
public Dictionary<string, int> GoodPushes { get; set; } | |||
public Dictionary<int, float> GoodPushes { get; set; } | |||
} | |||
} |
@@ -8,33 +8,130 @@ namespace BPASmartClient.MorkTM | |||
{ | |||
public enum MaterialPosion | |||
{ | |||
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6, | |||
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10, | |||
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Bottom_4, Marerial_Bottom_5, Marerial_Bottom_6, | |||
Matetial_Tea_1, Matetial_Tea_2, Matetial_Tea_3, Matetial_Tea_4, Matetial_Tea_5, Matetial_Tea_6 | |||
Top1 =1, Top2 =2, Top3 =3, Top4 = 4, Top5 = 5, Top6= 6, Top7 = 7, Top8=8, Top9 =9, Top10 =10, | |||
Top11 = 11, Top12 =12, Top13 =13, Top14 =14, Top15= 15, Top16=16, Top17 =17, Top18 =18, Top19 =19, Top20 =20, | |||
Top21 =21, Top22 =22, Top23 =23, Top24 =24, Top25 =25, Top26 =26, Top27 =27, Top28=28 | |||
} | |||
public enum OutMaterialPosion | |||
{ | |||
OutMaterial_1, OutMaterial_2, OutMaterial_3, OutMaterial_4, OutMaterial_5, OutMaterial_6, OutMaterial_7, OutMaterial_8, OutMaterial_9, OutMaterial_10 | |||
OutMaterial_1 = 1, OutMaterial_2 = 2, OutMaterial_3 =3, OutMaterial_4 = 4, OutMaterial_5 = 5, OutMaterial_6 = 6 | |||
} | |||
public class CommationPosionPLC | |||
{ | |||
public CommationPosionPLC( string set,string get, Enum @enum) | |||
{ | |||
SetPLCPosion = set; | |||
GetPLCPosion = get; | |||
posion = @enum; | |||
} | |||
public string SetPLCPosion; | |||
public string GetPLCPosion; | |||
public Enum posion; | |||
} | |||
public class PolymerBatching | |||
{ | |||
public static void GetMaterialInfo() | |||
/// <summary> | |||
/// 物料对应的plc点位 | |||
/// </summary> | |||
public Dictionary<MaterialPosion,string > MaterialPosionList = new Dictionary<MaterialPosion, string>() | |||
{ | |||
{MaterialPosion.Top1 , "VW304"}, | |||
{MaterialPosion.Top2 , "VW308"}, | |||
{MaterialPosion.Top3 , "VW312"}, | |||
{MaterialPosion.Top4 , "VW316"}, | |||
{MaterialPosion.Top5 , "VW320"}, | |||
{MaterialPosion.Top6 , "VW324"}, | |||
{MaterialPosion.Top7 , "VW328"}, | |||
{MaterialPosion.Top8 , "VW332"}, | |||
{MaterialPosion.Top9 , "VW336"}, | |||
{MaterialPosion.Top10, "VW340" }, | |||
{MaterialPosion.Top11, "VW344" }, | |||
{MaterialPosion.Top12, "VW348" }, | |||
{MaterialPosion.Top13, "VW352" }, | |||
{MaterialPosion.Top14, "VW356" }, | |||
{MaterialPosion.Top15, "VW360" }, | |||
{MaterialPosion.Top16, "VW364" }, | |||
{MaterialPosion.Top17, "VW368" }, | |||
{MaterialPosion.Top18, "VW372" }, | |||
{MaterialPosion.Top19, "VW376" }, | |||
{MaterialPosion.Top20, "VW380" }, | |||
{MaterialPosion.Top21, "VW384" }, | |||
{MaterialPosion.Top22, "VW388" }, | |||
{MaterialPosion.Top23, "VW392" }, | |||
{MaterialPosion.Top24, "VW396" }, | |||
{MaterialPosion.Top25, "VW400" }, | |||
{MaterialPosion.Top26, "VW404" }, | |||
{MaterialPosion.Top27, "VW408" }, | |||
{MaterialPosion.Top28, "VW412" }, | |||
}; | |||
public List<CommationPosionPLC> TurnPosionPLCs = new List<CommationPosionPLC>() | |||
{ | |||
Array arrayPosion = Enum.GetValues(typeof(MaterialPosion)); | |||
Array arrayOutPosion = Enum.GetValues(typeof(OutMaterialPosion)); | |||
for (int i = 0; i < arrayPosion.Length; i++) | |||
{ | |||
int j = (int)Math.Ceiling((double)(i + 1) / 3) - 1; | |||
GoodsMaterialPosion.Add((MaterialPosion)arrayPosion.GetValue(i), (OutMaterialPosion)arrayOutPosion.GetValue(j)); | |||
new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.OutMaterial_1), | |||
new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.OutMaterial_2), | |||
new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.OutMaterial_3), | |||
new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.OutMaterial_4), | |||
new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.OutMaterial_5), | |||
new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.OutMaterial_6), | |||
}; | |||
public List<CommationPosionPLC> OutPosionPLCs = new List<CommationPosionPLC>() | |||
{ | |||
new CommationPosionPLC("M10.0","M50.0",MaterialPosion.Top1), | |||
new CommationPosionPLC("M10.1","M50.1",MaterialPosion.Top2), | |||
new CommationPosionPLC("M10.2","M50.2",MaterialPosion.Top3), | |||
new CommationPosionPLC("M10.3","M50.3",MaterialPosion.Top4), | |||
new CommationPosionPLC("M10.4","M50.4",MaterialPosion.Top5), | |||
new CommationPosionPLC("M10.5","M50.5",MaterialPosion.Top6), | |||
new CommationPosionPLC("M10.6","M50.6",MaterialPosion.Top7), | |||
new CommationPosionPLC("M10.7","M50.7",MaterialPosion.Top8), | |||
new CommationPosionPLC("M11.0","M51.0",MaterialPosion.Top9), | |||
new CommationPosionPLC("M11.1","M51.1",MaterialPosion.Top10), | |||
new CommationPosionPLC("M11.2","M51.2",MaterialPosion.Top11), | |||
new CommationPosionPLC("M11.3","M51.3",MaterialPosion.Top12), | |||
new CommationPosionPLC("M11.4","M51.4",MaterialPosion.Top13), | |||
new CommationPosionPLC("M11.5","M51.5",MaterialPosion.Top14), | |||
new CommationPosionPLC("M11.6","M51.6",MaterialPosion.Top15), | |||
new CommationPosionPLC("M11.7","M51.7",MaterialPosion.Top16), | |||
new CommationPosionPLC("M12.0","M52.0",MaterialPosion.Top17), | |||
new CommationPosionPLC("M12.1","M52.1",MaterialPosion.Top18), | |||
new CommationPosionPLC("M12.2","M52.2",MaterialPosion.Top19), | |||
new CommationPosionPLC("M12.3","M52.3",MaterialPosion.Top20), | |||
new CommationPosionPLC("M12.4","M52.4",MaterialPosion.Top21), | |||
new CommationPosionPLC("M12.5","M52.5",MaterialPosion.Top22), | |||
new CommationPosionPLC("M12.6","M52.6",MaterialPosion.Top23), | |||
new CommationPosionPLC("M12.7","M52.7",MaterialPosion.Top24), | |||
new CommationPosionPLC("M13.0","M53.0",MaterialPosion.Top25), | |||
new CommationPosionPLC("M13.1","M53.1",MaterialPosion.Top26), | |||
new CommationPosionPLC("M13.2","M53.2",MaterialPosion.Top27), | |||
new CommationPosionPLC("M13.3","M53.3",MaterialPosion.Top28), | |||
}; | |||
public void GetMaterialInfo() | |||
{ | |||
List<MaterialPosion> materialPosions = Enum.GetValues(typeof(MaterialPosion)).Cast<MaterialPosion>().ToList(); | |||
for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length; i++) | |||
{ | |||
if (i == 2 || i == 3) | |||
{ | |||
GoodsMaterialPosion.Add(materialPosions.Take(4).ToList(), TurnPosionPLCs[i]); | |||
materialPosions.RemoveRange(0, 4); | |||
} | |||
else | |||
{ | |||
GoodsMaterialPosion.Add(materialPosions.Take(5).ToList(), TurnPosionPLCs[i]); | |||
materialPosions.RemoveRange(0, 5); | |||
} | |||
} | |||
} | |||
public static Dictionary<MaterialPosion, OutMaterialPosion> GoodsMaterialPosion = new Dictionary<MaterialPosion, OutMaterialPosion>(); | |||
public Dictionary<List<MaterialPosion>, CommationPosionPLC> GoodsMaterialPosion = new Dictionary<List<MaterialPosion>, CommationPosionPLC>(); | |||
} | |||
} |
@@ -5,6 +5,7 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkTM.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel" | |||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | |||
mc:Ignorable="d" | |||
d:DesignHeight="800" d:DesignWidth="1000" | |||
Name="调试界面"> | |||
@@ -63,7 +64,13 @@ | |||
Grid.Row="3" Grid.ColumnSpan="4" | |||
HorizontalAlignment="Center"/> | |||
</Grid> | |||
<Grid Grid.Row="3" Grid.ColumnSpan="2"> | |||
<wv2:WebView2 | |||
Name="webView" Grid.Row="3" Grid.ColumnSpan="2" | |||
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}" | |||
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}"/> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -23,6 +23,7 @@ namespace BPASmartClient.MorkTM.View | |||
public Debug() | |||
{ | |||
InitializeComponent(); | |||
webView.Source = new Uri("https://www.baidu.com/"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,284 @@ | |||
<UserControl x:Class="View.RecipeView" | |||
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:View" | |||
xmlns:vm ="clr-namespace:ViewModel" | |||
mc:Ignorable="d" | |||
Name="参数设置界面" | |||
d:DesignHeight="600" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:RecipeViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
<Style x:Key="button_Style" TargetType="Button"> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Foreground" Value="#a2c2e8" /> | |||
<Setter Property="Width" Value="80" /> | |||
<Setter Property="Height" Value="25" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<ControlTemplate.Resources> | |||
<Storyboard x:Key="OnMouseEnter1"> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)"> | |||
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF139DDB" /> | |||
</ColorAnimationUsingKeyFrames> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> | |||
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF135EC2" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</ControlTemplate.Resources> | |||
<Border | |||
x:Name="BD" | |||
Background="Transparent" | |||
BorderBrush="#05408a" | |||
BorderThickness="1" | |||
CornerRadius="12"> | |||
<TextBlock | |||
x:Name="textBlock" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
FontSize="16" | |||
Foreground="#a2c2e8" | |||
Text="{TemplateBinding Content}" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="BD" Property="Background" Value="#009dff" /> | |||
<Setter TargetName="textBlock" Property="Foreground" Value="#a2c2e8" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter TargetName="BD" Property="Background" Value="#ff55" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="DataGrid"> | |||
<Setter Property="CanUserResizeColumns" Value="false" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="HorizontalGridLinesBrush"> | |||
<Setter.Value> | |||
<SolidColorBrush Color="#4fade8" /> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="VerticalGridLinesBrush"> | |||
<Setter.Value> | |||
<SolidColorBrush Color="#4fade8" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--标题栏样式--> | |||
<Style TargetType="DataGridColumnHeader"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="25" /> | |||
<Setter Property="Foreground" Value="#FF00EEF3" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridColumnHeader"> | |||
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" | |||
BorderBrush="#FF074B92" | |||
Width="Auto"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" | |||
HorizontalAlignment="Center" /> | |||
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" | |||
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0" | |||
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> | |||
<Rectangle Width="1" Fill="#FF074B92" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Height" Value="25" /> | |||
</Style> | |||
<!--行样式触发--> | |||
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式--> | |||
<Style TargetType="DataGridRow"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Height" Value="30" /> | |||
<Setter Property="Foreground" Value="#a2c2e8" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
</Style> | |||
<!--单元格样式触发--> | |||
<Style TargetType="DataGridCell"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridCell"> | |||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Height="30" > | |||
<ContentPresenter Height="28" /> | |||
</TextBlock> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsSelected" Value="True"> | |||
<Setter Property="Background" Value="#4fade8" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid > | |||
<Grid Margin="50" > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="奶茶配方录入" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0"> | |||
<TextBlock Text="奶茶名称:" Foreground="#409EFF" FontSize="16" Margin="10,0" VerticalAlignment="Center"/> | |||
<TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0"/> | |||
<Button Content="添加配方" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding AddRecipeCommand}"/> | |||
<Button Content="保存" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding SaveRecipeCommand}"/> | |||
<Button Content="取消" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding RecipeCancelCommand}"/> | |||
</StackPanel> | |||
<DataGrid Grid.Row="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materialRecipes}" | |||
x:Name="recipeDataGrid" | |||
FrozenColumnCount="1" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" > | |||
<DataGrid.Columns > | |||
<DataGridTemplateColumn Header="ID" Width="30"> | |||
<DataGridTemplateColumn.CellTemplate > | |||
<DataTemplate> | |||
<TextBlock Text="{ Binding MaterialID}" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="配料" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate > | |||
<DataTemplate> | |||
<ComboBox x:Name="combox" FontSize="16" Width="100" | |||
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}" | |||
IsReadOnly="True" | |||
SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" | |||
/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="配料量" Width="175"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/> | |||
<TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="操作" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" | |||
Style="{StaticResource button_Style}"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<TextBlock Text="本地奶茶配方" Grid.Row="3" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
<DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding localMaterialRecipes}" Width="500" | |||
FrozenColumnCount="1" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="奶茶" Width="200"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBlock Text="{Binding RecipeName}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="操作" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" | |||
Style="{StaticResource button_Style}"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="配料名称修改" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Wheat" FontSize="18"/> | |||
<Button Content="更新物料位置名称" Grid.Column="2" Grid.Row="1" Style="{StaticResource button_Style}" Width="150" Command="{Binding UpdateMaterialPosionCommand}"/> | |||
<DataGrid Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materailNameAndPosions}" | |||
FrozenColumnCount="1" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="物料位置" Width="170"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBlock Text="{Binding MaterialPosion}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" FontSize="16"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="物料" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="80" FontSize="16"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,36 @@ | |||
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.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Media.Media3D; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using ViewModel; | |||
namespace View | |||
{ | |||
/// <summary> | |||
/// RecipeView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeView : UserControl | |||
{ | |||
public RecipeView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void DataGridComboBoxColumn_SourceUpdated(object sender, DataTransferEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,241 @@ | |||
using BPASmartClient.MorkTM; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using Model; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.IO; | |||
using System.Text; | |||
using System.Windows; | |||
namespace ViewModel | |||
{ | |||
public class RecipeViewModel : ObservableObject | |||
{ | |||
//路径 | |||
string recipePath = string.Empty; | |||
string posionPath = string.Empty; | |||
#region 奶茶配方录入 | |||
/// <summary> | |||
/// 奶茶配方 | |||
/// </summary> | |||
public ObservableCollection<MaterialRecipe> materialRecipes { get; set;} = new ObservableCollection<MaterialRecipe>(); | |||
/// <summary> | |||
/// 出料集合 | |||
/// </summary> | |||
public ObservableCollection<string> MaterailList { get; set; } = new ObservableCollection<string>(); | |||
/// <summary> | |||
/// 奶茶名称 | |||
/// </summary> | |||
public string LocalGoodName { get { return _localGoodName; } set { _localGoodName = value; OnPropertyChanged(); } } | |||
private string _localGoodName; | |||
/// <summary> | |||
/// 添加一条配方 | |||
/// </summary> | |||
public RelayCommand AddRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 删除一条配方 | |||
/// </summary> | |||
public RelayCommand<object> RemoveRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 取消配方 | |||
/// </summary> | |||
public RelayCommand RecipeCancelCommand { get; set; } | |||
/// <summary> | |||
/// 保存配方 | |||
/// </summary> | |||
public RelayCommand SaveRecipeCommand { get; set; } | |||
#endregion | |||
#region 本地奶茶配方 | |||
/// <summary> | |||
/// 本地奶茶配方列表 | |||
/// </summary> | |||
public ObservableCollection<LocalMaterialRecipes> localMaterialRecipes { get; set; } = new ObservableCollection<LocalMaterialRecipes>(); | |||
/// <summary> | |||
/// 删除配方奶茶 | |||
/// </summary> | |||
public RelayCommand<object> DeleteRecipeCommand { get; set; } | |||
#endregion | |||
#region 物料位置名称 | |||
/// <summary> | |||
/// 物料位置名称集合 | |||
/// </summary> | |||
public ObservableCollection<MaterailNameAndPosion> materailNameAndPosions { get; set; } = new ObservableCollection<MaterailNameAndPosion>(); | |||
/// <summary> | |||
/// 更新物料位置 | |||
/// </summary> | |||
public RelayCommand UpdateMaterialPosionCommand{ get; set; } | |||
#endregion | |||
public RecipeViewModel() | |||
{ | |||
materialRecipes.Add(new MaterialRecipe() | |||
{ | |||
MaterialWeight = 10 | |||
}); | |||
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion))) | |||
{ | |||
materailNameAndPosions.Add(new MaterailNameAndPosion() | |||
{ | |||
MaterialPosion = item.ToString() | |||
}); | |||
} | |||
AddRecipeCommand = new RelayCommand(new Action(() => | |||
{ | |||
materialRecipes.Add(new MaterialRecipe() | |||
{ | |||
MaterialID = materialRecipes.Count() + 1 | |||
}) ; | |||
})); | |||
RemoveRecipeCommand = new RelayCommand<object>((o=> | |||
{ | |||
if(o!=null&&o is int index) | |||
{ | |||
materialRecipes.RemoveAt(index); | |||
for (int i = 0; i < materialRecipes.Count; i++)//ID排序 | |||
{ | |||
materialRecipes[i].MaterialID = i + 1; | |||
} | |||
} | |||
})); | |||
RecipeCancelCommand = new RelayCommand(new Action(() => | |||
{ | |||
materialRecipes.Clear(); | |||
})); | |||
SaveRecipeCommand = new RelayCommand(new Action(() => | |||
{ | |||
if(LocalGoodName == "" || LocalGoodName == null) return; | |||
if(materialRecipes.Count == 0) return; | |||
localMaterialRecipes.Insert(0, new LocalMaterialRecipes() | |||
{ | |||
RecipeName = LocalGoodName, | |||
RecipeNotes = materialRecipes | |||
}); | |||
UpdateLocalJosnData<LocalMaterialRecipes>(recipePath, localMaterialRecipes);//更新奶茶配方json文件 | |||
MessageBox.Show("保存成功"); | |||
})); | |||
DeleteRecipeCommand = new RelayCommand<object>((o => | |||
{ | |||
if (o != null && o is int index) | |||
{ | |||
localMaterialRecipes.RemoveAt(index); | |||
UpdateLocalJosnData<LocalMaterialRecipes>(recipePath, localMaterialRecipes);//更新奶茶配方json文件 | |||
} | |||
})); | |||
UpdateMaterialPosionCommand = new RelayCommand(new Action(() => | |||
{ | |||
UpdateLocalJosnData<MaterailNameAndPosion>(posionPath, materailNameAndPosions);//更新物料位置名称 | |||
})); | |||
Init(); | |||
} | |||
/// <summary> | |||
/// 界面初始化加载 | |||
/// </summary> | |||
private void Init() | |||
{ | |||
string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes"); | |||
//判断文件夹是否存在,如果不存在就创建file文件夹 | |||
if (!Directory.Exists(path)) | |||
{ | |||
Directory.CreateDirectory(path); | |||
} | |||
recipePath = Path.Combine(path, "LocalRecipes.json"); | |||
posionPath = Path.Combine(path, "MaterialPosion.json"); | |||
localMaterialRecipes = GetJsonToT<LocalMaterialRecipes>(recipePath); | |||
materailNameAndPosions = GetJsonToT<MaterailNameAndPosion>(posionPath); | |||
if(materailNameAndPosions.Count == 0) | |||
{ | |||
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion))) | |||
{ | |||
materailNameAndPosions.Add(new MaterailNameAndPosion() | |||
{ | |||
MaterialPosion = item.ToString() | |||
}); | |||
} | |||
} | |||
foreach(MaterailNameAndPosion m in materailNameAndPosions) | |||
{ | |||
if(m.MaterialName!=null) MaterailList.Add(m.MaterialName); | |||
} | |||
} | |||
/// <summary> | |||
/// 获取Json文件内容,转换成ObservableCollection | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="path"></param> | |||
/// <returns></returns> | |||
private ObservableCollection<T> GetJsonToT<T>(string path) | |||
{ | |||
if (!File.Exists(path)) | |||
{ | |||
//创建该文件 | |||
File.Create(path); | |||
return default; | |||
} | |||
else | |||
{ | |||
using (StreamReader recipeReader = new StreamReader(path))//读取json文件 | |||
{ | |||
string datacache = ""; | |||
string line; | |||
while ((line = recipeReader.ReadLine()) != null) //循环将每一行数据拼接为一个完整的字符串 | |||
{ | |||
datacache = datacache + line; | |||
} | |||
var res = JsonConvert.DeserializeObject<ObservableCollection<T>>(datacache); //将string转换为class类,从而达到json文件转换的目的 | |||
if(res != null) | |||
return res; | |||
else return new ObservableCollection<T> { }; | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 更新Json文件数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="path"></param> | |||
/// <param name="ts"></param> | |||
private void UpdateLocalJosnData<T>(string path,ObservableCollection<T> ts) | |||
{ | |||
if(ts != null) File.WriteAllText(path, JsonConvert.SerializeObject(ts)); | |||
} | |||
} | |||
} |
@@ -13,7 +13,7 @@ | |||
<!--开发环境--> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="dev1_common"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="DEV.Config"/> | |||
<!--正式环境--> | |||
@@ -15,7 +15,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1185.39" /> | |||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -85,6 +85,17 @@ | |||
</Peripheral> | |||
</Peripherals> | |||
</Device>-->--> | |||
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> | |||
<Parameters> | |||
<IpAddress>192.168.6.1</IpAddress> | |||
<Port>502</Port> | |||
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress> | |||
</Parameters> | |||
</Peripheral> | |||
</Peripherals> | |||
</Device> | |||
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100"> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> | |||
@@ -27,7 +27,7 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border x:Name="br" Style="{DynamicResource border主窗体背景}"> | |||
<Border Style="{DynamicResource border主窗体背景}"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60" /> | |||
@@ -40,7 +40,7 @@ | |||
<ColumnDefinition Width="300" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
<Border x:Name="br" | |||
Grid.ColumnSpan="2" | |||
Height="52" | |||
VerticalAlignment="Top" | |||
@@ -118,6 +118,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{76B6B333-0109-4EE8-A9B2-3E53A7421D92}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MilkWithTea", "BPASmartClient.MilkWithTea\BPASmartClient.MilkWithTea.csproj", "{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -1112,6 +1114,26 @@ Global | |||
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.Build.0 = Release|Any CPU | |||
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.ActiveCfg = Release|Any CPU | |||
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.Build.0 = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x64.Build.0 = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Debug|x86.Build.0 = Debug|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM.Build.0 = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|ARM64.Build.0 = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x64.ActiveCfg = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x64.Build.0 = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x86.ActiveCfg = Release|Any CPU | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1165,6 +1187,8 @@ Global | |||
{E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | |||
{76B6B333-0109-4EE8-A9B2-3E53A7421D92} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{BFA4E222-BBCC-4AC7-9EA4-4549AEF3174B} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||