@@ -76,6 +76,7 @@ | |||
<None Remove="Image\Scroll_↓.png" /> | |||
<None Remove="Image\shape.png" /> | |||
<None Remove="Image\shape1.png" /> | |||
<None Remove="Image\textBox.png" /> | |||
<None Remove="Image\Title.png" /> | |||
<None Remove="Image\title2.png" /> | |||
<None Remove="Image\titletext.png" /> | |||
@@ -88,6 +89,7 @@ | |||
<None Remove="Image\个人信息.png" /> | |||
<None Remove="Image\临时模板.png" /> | |||
<None Remove="Image\产品制作.png" /> | |||
<None Remove="Image\光柱.png" /> | |||
<None Remove="Image\内部.png" /> | |||
<None Remove="Image\功能列表.png" /> | |||
<None Remove="Image\告警.png" /> | |||
@@ -114,6 +116,7 @@ | |||
<None Remove="Image\工艺流程.jpg" /> | |||
<None Remove="Image\工艺流程.png" /> | |||
<None Remove="Image\底部背景.png" /> | |||
<None Remove="Image\弹窗2.png" /> | |||
<None Remove="Image\按钮\AddGreen.png" /> | |||
<None Remove="Image\按钮\Delete.png" /> | |||
<None Remove="Image\按钮\停用.png" /> | |||
@@ -186,6 +189,7 @@ | |||
<None Remove="Image\背景矢量\左下.png" /> | |||
<None Remove="Image\背景矢量\矢量智能对象.png" /> | |||
<None Remove="Image\营销额.png" /> | |||
<None Remove="Image\蓝边框.png" /> | |||
<None Remove="Image\表头背景.png" /> | |||
<None Remove="Image\表格\矩形2609.png" /> | |||
<None Remove="Image\表格\表格底右.png" /> | |||
@@ -264,10 +268,12 @@ | |||
<Resource Include="Image\Exp.png" /> | |||
<Resource Include="Image\leftback.png" /> | |||
<Resource Include="Image\leftImage.png" /> | |||
<Resource Include="Image\textBox.png" /> | |||
<Resource Include="Image\WindowImages.png" /> | |||
<Resource Include="Image\上箭头.png" /> | |||
<Resource Include="Image\临时模板.png" /> | |||
<Resource Include="Image\产品制作.png" /> | |||
<Resource Include="Image\光柱.png" /> | |||
<Resource Include="Image\功能列表.png" /> | |||
<Resource Include="Image\告警\Wifi_NO.png" /> | |||
<Resource Include="Image\告警\Wifi_OK.png" /> | |||
@@ -277,6 +283,7 @@ | |||
<Resource Include="Image\告警\轻微告警.png" /> | |||
<Resource Include="Image\工艺流程.jpg" /> | |||
<Resource Include="Image\工艺流程.png" /> | |||
<Resource Include="Image\弹窗2.png" /> | |||
<Resource Include="Image\按钮\AddGreen.png" /> | |||
<Resource Include="Image\按钮\Delete.png" /> | |||
<Resource Include="Image\按钮\停用.png" /> | |||
@@ -296,6 +303,7 @@ | |||
<Resource Include="Image\组 8.png" /> | |||
<Resource Include="Image\背景2.png" /> | |||
<Resource Include="Image\背景3.jpg" /> | |||
<Resource Include="Image\蓝边框.png" /> | |||
<Resource Include="Image\调味品.jpeg" /> | |||
<Resource Include="Image\边角.png" /> | |||
</ItemGroup> | |||
@@ -12,45 +12,48 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
} | |||
/// <summary> | |||
/// 1 号滚筒线故障 | |||
/// </summary> | |||
[Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort LOneRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 2 号滚筒线故障 | |||
/// </summary> | |||
[Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort LTwoRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 3 号滚筒线故障 | |||
/// </summary> | |||
[Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort LThreeRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 1 号炒锅滚筒运行故障 | |||
/// </summary> | |||
[Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotOneRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 2 号炒锅滚筒运行故障 | |||
/// </summary> | |||
[Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotTwoRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 3 号炒锅滚筒运行故障 | |||
/// </summary> | |||
[Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotThreeRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 4 号炒锅滚筒运行故障 | |||
/// </summary> | |||
[Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotFourRollerTrouble { get; set; } | |||
/// <summary> | |||
/// 5 号炒锅滚筒运行故障 | |||
/// </summary> | |||
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] | |||
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotFiveRollerTrouble { get; set; } | |||
} | |||
} |
@@ -9,23 +9,23 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class UserInfo:ObservableObject | |||
public class UserInfo : ObservableObject | |||
{ | |||
public String LastLogInTime { get; set; } = "无"; | |||
public List<UserTreeViewModel> userTreeViewModels { get; set; } | |||
public string Id { get { return _id; }set { _id = value;OnPropertyChanged(); } } | |||
public string Id { get { return _id; } set { _id = value; OnPropertyChanged(); } } | |||
private string _id; | |||
public Permission permission { get { return _perimission; } set { _perimission = value;OnPropertyChanged(); } } | |||
public Permission permission { get { return _perimission; } set { _perimission = value; OnPropertyChanged(); } } | |||
private Permission _perimission; | |||
public string UserName { get { return _userName; } set { _userName = value;OnPropertyChanged(); } } | |||
private string _userName; | |||
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | |||
private string _userName = "admin"; | |||
public string Password { get { return _password; } set { _password = value;OnPropertyChanged(); } } | |||
private string _password; | |||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | |||
private string _password = "admin"; | |||
public string CardId { get; set; } = String.Empty; | |||
@@ -373,8 +373,9 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<ComboBox ItemsSource="{Binding DeviceName}" Text="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="120" Height="40" Margin="0,0,10,0"></ComboBox> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}"></Button> | |||
<ComboBox ItemsSource="{Binding DeviceName}" SelectedValue="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" | |||
VerticalContentAlignment="Center" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="130" Height="40" Margin="0,0,10,0"></ComboBox> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="1" Command="{Binding SaveDataCommand}"></Button> | |||
</StackPanel> | |||
<!--变量配置--> | |||
<DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
@@ -57,17 +57,18 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
ComboBox cbo= sender as ComboBox; | |||
if (cbo != null) | |||
if (cbo != null&>!=null&&fryOne!=null&&fryTwo!=null&&fryThree!=null&&fryFour!=null&&fryFive!=null) | |||
{ | |||
switch (cbo.SelectedValue) | |||
{ | |||
case "滚筒输送线": | |||
this.GT.Visibility = Visibility.Visible; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility=Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
this.GT.Visibility = Visibility.Visible; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅1": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
@@ -0,0 +1,47 @@ | |||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |||
<!--#region 输入框样式--> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="CaretBrush" Value="#009DFF" /> | |||
<Setter Property="Foreground" Value="#009dff" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="TextBox"> | |||
<Border | |||
x:Name="border" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.7" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Grid.Column="1" | |||
MinHeight="20" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="border" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocused" Value="true"> | |||
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> |
@@ -0,0 +1,81 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.UserControls.BatchingMachine" | |||
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="235" | |||
d:DesignWidth="390" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="fillColor" Color="#446BADF7" /> | |||
<SolidColorBrush x:Key="BorderColor" Color="#663FADFF" /> | |||
</UserControl.Resources> | |||
<Grid Name="gr"> | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas Width="390" Height="235"> | |||
<Path | |||
Data="M100,0 L350,60 250,90 0,30 100,0" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<Path | |||
Data="M0,30 L0,170 250,230 250,90" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<Path | |||
Data="M250,230 L350,170 350,60 250,90" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<Path | |||
Data="M350,60 L390,100 290,140 250,90" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<Path | |||
Data="M290,140 L250,130" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<Path | |||
Data="M390,100 L350,90" | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<TextBlock Text="IP:192.168.0.1" FontSize="25" Foreground="Red" Canvas.Left="31" Canvas.Top="156" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="12.644"/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
<TextBlock Text="原料设备A" FontSize="25" Foreground="Red" Canvas.Left="55" Canvas.Top="106" RenderTransformOrigin="0.5,0.5"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="12.644"/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
<TextBlock Text="125.0 kg" FontSize="25" Foreground="Red" Canvas.Left="275" Canvas.Top="78" RenderTransformOrigin="0.721,0.662" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="-21.298"/> | |||
<TranslateTransform X="0.241" Y="-6.13"/> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
</Canvas> | |||
</Viewbox> | |||
</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.CustomResource.UserControls | |||
{ | |||
/// <summary> | |||
/// BatchingMachine.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class BatchingMachine : UserControl | |||
{ | |||
public BatchingMachine() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,249 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.UserControls.Cylinder" | |||
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="100" | |||
d:DesignWidth="389" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="scb" Color="#FFB1B1B9" /> | |||
<SolidColorBrush x:Key="scbs" Color="#FF6d6666" /> | |||
</UserControl.Resources> | |||
<Grid Name="cav"> | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas | |||
Name="cv" | |||
Width="{Binding ElementName=cav, Path=ActualWidth}" | |||
Height="{Binding ElementName=cav, Path=ActualHeight}"> | |||
<Path | |||
Data="M2 30 L2 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M6 30 L6 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M10 30 L10 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M14 30 L14 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M18 30 L18 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M22 30 L22 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M26 30 L26 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M30 30 L30 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M34 30 L34 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M38 30 L38 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M42 30 L42 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M46 30 L46 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M50 30 L50 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M54 30 L54 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M58 30 L58 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M62 30 L62 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M64 30 L64 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M68 30 L68 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M72 30 L72 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M76 30 L76 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M80 30 L80 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M84 30 L84 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M88 30 L88 70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M92 30 L92 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M102 30 L102 70" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="16" /> | |||
<Path | |||
Data="M50 20 L50 80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="20" /> | |||
<Path | |||
Data="M42,25 L58,25 60,30 60,45 58,50 60,55 60,70 58,75 42,75 40,70 40,55 42,50 40,45 40,30 42,25" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="1" /> | |||
<Path | |||
Data="M42 50 L58 50" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="1" /> | |||
<Path Data="M110 0 L110,100 160,100 175,80 300 ,80 315,100 365,100 365,0 315,0 300,20 175,20 160,0 110,0"> | |||
<Path.Fill> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FF1EDEDA" /> | |||
<GradientStop Offset="1" Color="#FF1EDEDA" /> | |||
<GradientStop Offset="0.5" Color="#FFDDEAE9" /> | |||
</LinearGradientBrush> | |||
</Path.Fill> | |||
</Path> | |||
<Path | |||
Data="M110 30 L160,30 A2,5 0 1 1 160,70 L110,70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M160 0 L160,30" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M160 70 L160,100" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M175 20 L175,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M179 20 L179,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M183 20 L183,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M187 20 L187,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M365 30 L315,30 A2,5 0 1 0 315,70 L365,70" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M315 0 L315,30" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M315 70 L315,100" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M300 20 L300,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M296 20 L296,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M292 20 L292,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M288 20 L288,80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="2" /> | |||
<Path | |||
Data="M367 20 L367 80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M371 20 L371 80" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M375 20 L375 80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M379 20 L379 80" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M383 20 L383 80" | |||
Stroke="{StaticResource scb}" | |||
StrokeThickness="4" /> | |||
<Path | |||
Data="M387 20 L387 80" | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="120,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="325,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
</Canvas> | |||
</Viewbox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,31 @@ | |||
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.CustomResource.UserControls | |||
{ | |||
/// <summary> | |||
/// Cylinder.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Cylinder : UserControl | |||
{ | |||
public Cylinder() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -9,17 +9,23 @@ | |||
d:DesignWidth="700" | |||
mc:Ignorable="d"> | |||
<Grid Name="gr"> | |||
<Viewbox > | |||
<Viewbox> | |||
<Canvas Width="700" Height="500"> | |||
<local:Bottle | |||
x:Name="bottle" | |||
Canvas.Left="608" | |||
Canvas.Top="10" | |||
Width="84" | |||
Height="257" HorizontalAlignment="Center" VerticalAlignment="Top" Canvas.Top="10" /> | |||
Height="257" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" /> | |||
<local:DosingSystem | |||
Height="386" | |||
Canvas.Left="-66" | |||
Canvas.Top="186" | |||
Width="827" | |||
VerticalAlignment="Center" Canvas.Left="-66" Canvas.Top="186" HorizontalAlignment="Left" /> | |||
Height="386" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" /> | |||
<Ellipse | |||
Name="ep" | |||
@@ -27,7 +33,9 @@ | |||
Canvas.Top="339" | |||
Width="40" | |||
Height="40" | |||
Fill="Red" HorizontalAlignment="Center" VerticalAlignment="Top" /> | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
Fill="Red" /> | |||
</Canvas> | |||
</Viewbox> | |||
@@ -36,7 +44,10 @@ | |||
<VisualStateGroup> | |||
<VisualState Name="Start"> | |||
<Storyboard AutoReverse="True" x:Name="sb" RepeatBehavior="Forever"> | |||
<Storyboard | |||
x:Name="sb" | |||
AutoReverse="True" | |||
RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
Storyboard.TargetName="ep" | |||
Storyboard.TargetProperty="Opacity" | |||
@@ -44,7 +55,11 @@ | |||
To="1" | |||
Duration="0:0:1" /> | |||
<ColorAnimation Storyboard.TargetName="ep" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" From="Green" To="Green"/> | |||
<ColorAnimation | |||
Storyboard.TargetName="ep" | |||
Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" | |||
From="Green" | |||
To="Green" /> | |||
</Storyboard> | |||
</VisualState> | |||
@@ -55,7 +70,11 @@ | |||
Storyboard.TargetProperty="Opacity" | |||
To="1" | |||
Duration="0:0:1" /> | |||
<ColorAnimation Storyboard.TargetName="ep" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" To="Red" From="Red"/> | |||
<ColorAnimation | |||
Storyboard.TargetName="ep" | |||
Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" | |||
From="Red" | |||
To="Red" /> | |||
</Storyboard> | |||
</VisualState> | |||
@@ -2,6 +2,7 @@ | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
@@ -0,0 +1,52 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Runtime.Serialization.Formatters.Binary; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Helper | |||
{ | |||
public class DataRecord | |||
{ | |||
/// <summary> | |||
/// 读取序列化文件 | |||
/// </summary> | |||
/// <param name="FilePath">需要读取序列化文件的文件名,包括后缀名</param> | |||
/// <returns>返回序列化读取到的信息,需要自行转换成对应的类型</returns> | |||
public ReadT Read<ReadT>(string FilePath) | |||
{ | |||
if (File.Exists(FilePath)) | |||
{ | |||
FileStream fs = new FileStream(FilePath, FileMode.Open); | |||
BinaryFormatter bf = new BinaryFormatter(); | |||
var res = (ReadT)bf.Deserialize(fs); | |||
fs.Close(); | |||
return res; | |||
} | |||
return default; | |||
} | |||
/// <summary> | |||
/// 保存序列化文件 | |||
/// </summary> | |||
/// <param name="obj">需要通过序列化保存的对象</param> | |||
/// <param name="FileName">设置保存的文件名,包括后缀名,后缀名可以自定义</param> | |||
public void Save<SaveT>(SaveT obj, string FileName) | |||
{ | |||
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\ProductionData")); | |||
string path = $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\ProductionData\\{FileName}"; | |||
if (obj != null) | |||
{ | |||
FileStream fs = new FileStream(path, FileMode.Create); | |||
BinaryFormatter bf = new BinaryFormatter();//创建一个二进制格式化器 | |||
bf?.Serialize(fs, obj); | |||
fs.Close(); | |||
} | |||
} | |||
} | |||
} |
@@ -20,6 +20,7 @@ | |||
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" /> | |||
</ItemGroup> | |||
@@ -26,8 +26,8 @@ namespace BPASmartClient.Model | |||
/// <summary> | |||
/// 原料重量设置 | |||
/// </summary> | |||
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private uint _mRawMaterialWeight; | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private float _mRawMaterialWeight; | |||
/// <summary> | |||
@@ -86,7 +86,7 @@ namespace BPASmartClient.Model | |||
/// <summary> | |||
/// 原料设备执行状态 | |||
/// 1:空闲状态 | |||
/// 1:等待配料 | |||
/// 2:下料中 | |||
/// 3:下料完成 | |||
/// </summary> | |||
@@ -17,6 +17,7 @@ | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/TextBoxStyle.xaml" /> | |||
<ResourceDictionary> | |||
<con:ColorConverter x:Key="ColorConverter" /> | |||
@@ -30,12 +30,13 @@ namespace BPASmartClient.DosingSystem | |||
MenuInit(); | |||
DataInit(); | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
//NewMaterialDeviceParView newMaterialDeviceParView = new NewMaterialDeviceParView(); | |||
//newMaterialDeviceParView.ShowDialog(); | |||
MainView mv = new MainView(); | |||
//mv.Show(); | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
if (res != null && res == true) | |||
if (res != null && res == true) | |||
{ | |||
MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
mv.Show(); | |||
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.DosingSystem.Converter | |||
{ | |||
public class RunStatusConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is int tempValue) | |||
{ | |||
if (tempValue == 1) return ":等待配料"; | |||
if (tempValue == 2) return ":配料中"; | |||
if (tempValue == 3) return ":配料完成"; | |||
} | |||
return ":未知"; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -16,27 +16,72 @@ namespace BPASmartClient.DosingSystem.Model | |||
/// <summary> | |||
/// 料仓重量反馈起始地址 | |||
/// </summary> | |||
public static string WeightFeedback { get; set; } = "LW52";//LW204 | |||
public static string WeightFeedback { get; set; } = "LW52"; | |||
/// <summary> | |||
/// 重量设置地址 | |||
/// </summary> | |||
public static string WeightSet { get; set; } = "LW21";//LW200 | |||
public static string WeightSet { get; set; } = "LW21"; | |||
/// <summary> | |||
/// 启动信号地址 | |||
/// </summary> | |||
public static string Start { get; set; } = "LW20";//LW210 | |||
public static string Start { get; set; } = "LW20"; | |||
/// <summary> | |||
/// 下料重量反馈地址 | |||
/// </summary> | |||
public static string CutWeightFeedback { get; set; } = "LW54";//LW202 | |||
public static string CutWeightFeedback { get; set; } = "LW54"; | |||
/// <summary> | |||
/// 设备编号 | |||
/// </summary> | |||
public static string DeviceNum { get; set; } = "LW57"; | |||
/// <summary> | |||
/// 设备运行状态地址 | |||
/// </summary> | |||
public static string RunStatus { get; set; } = "LW51";//LW206 | |||
public static string RunStatus { get; set; } = "LW60"; | |||
/// <summary> | |||
/// 慢加重量 | |||
/// </summary> | |||
public static string SlowlyAddWeight { get; set; } = "LW23"; | |||
/// <summary> | |||
/// 提前关阀重量 | |||
/// </summary> | |||
public static string PreCloseValveWeight { get; set; } = "LW25"; | |||
/// <summary> | |||
/// 快加速度 | |||
/// </summary> | |||
public static string RapidAcceleration { get; set; } = "LW27"; | |||
/// <summary> | |||
/// 慢加速度 | |||
/// </summary> | |||
public static string SlowAcceleration { get; set; } = "LW29"; | |||
/// <summary> | |||
/// 伺服手动速度 | |||
/// </summary> | |||
public static string ServoManualSpeed { get; set; } = "LW31"; | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public static string SiloUpperLimitWeight { get; set; } = "LW33"; | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public static string LowerLimitWeightOfSilo { get; set; } = "LW35"; | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public static string StirringSpeed { get; set; } = "LW37"; | |||
} | |||
@@ -87,7 +87,7 @@ namespace BPASmartClient.DosingSystem.Model | |||
DS.modbusTcp.ConnectOk = new Action(() => | |||
{ | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20);//读取设备名称 | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim();//读取设备名称 | |||
if (DeviceName.Length > 0) | |||
{ | |||
DeviceLists.TryAdd(ip, DS); | |||
@@ -111,9 +111,9 @@ namespace BPASmartClient.DosingSystem.Model | |||
} | |||
} | |||
} | |||
if(Global.DeviceRawMaterials.Count > 0) | |||
if (Global.DeviceRawMaterials.Count > 0) | |||
{ | |||
if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == DeviceName) == null) | |||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null) | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip ,RawMaterialSource = 1}); | |||
} | |||
@@ -146,7 +146,7 @@ namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
DeviceListViewModel.devices.Remove(res); | |||
var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName); | |||
if (item!=null) Global.DeviceRawMaterials.Remove(item); | |||
if (item != null) Global.DeviceRawMaterials.Remove(item); | |||
})); | |||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||
@@ -176,7 +176,7 @@ namespace BPASmartClient.DosingSystem.Model | |||
/// </summary> | |||
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); | |||
public ModbusTcp modbusTcp = new ModbusTcp(); | |||
@@ -198,8 +198,11 @@ namespace BPASmartClient.DosingSystem.Model | |||
} | |||
//获取设备料仓剩余重量 | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10; | |||
deviceStatus.CutWeightFeedback = this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback) * 10; | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback); | |||
var resddd = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback); | |||
var rrr = this.modbusTcp.Read(DeviceAddress.WeightFeedback); | |||
var t = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback); | |||
Thread.Sleep(100); | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
@@ -221,11 +224,11 @@ namespace BPASmartClient.DosingSystem.Model | |||
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听"); | |||
} | |||
public void Start(uint Value) | |||
public void Start(float Value) | |||
{ | |||
if (modbusTcp.Connected) | |||
{ | |||
modbusTcp.SetUint(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
} | |||
} | |||
@@ -0,0 +1,51 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DevicePar | |||
{ | |||
/// <summary> | |||
/// 慢加重量 | |||
/// </summary> | |||
public float SlowlyAddWeight { get; set; } | |||
/// <summary> | |||
/// 提前关阀重量 | |||
/// </summary> | |||
public float PreCloseValveWeight { get; set; } | |||
/// <summary> | |||
/// 快加速度 | |||
/// </summary> | |||
public int RapidAcceleration { get; set; } | |||
/// <summary> | |||
/// 慢加速度 | |||
/// </summary> | |||
public int SlowAcceleration { get; set; } | |||
/// <summary> | |||
/// 伺服手动速度 | |||
/// </summary> | |||
public int ServoManualSpeed { get; set; } | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public int SiloUpperLimitWeight { get; set; } | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public int LowerLimitWeightOfSilo { get; set; } | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public int StirringSpeed { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class RecipeProcess : ObservableObject | |||
{ | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
public int RawMaterialStatus { get { return _mRawMaterialStatus; } set { _mRawMaterialStatus = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialStatus; | |||
} | |||
} |
@@ -44,15 +44,7 @@ | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<!--<pry:Bottle | |||
Width="80" | |||
Height="500" | |||
CurrentValue="50" />--> | |||
<!--<pry:MotorBottle IsRun="True" CurrentValue="100"/>--> | |||
<Grid Margin="-5,0,5,0"> | |||
<Grid> | |||
<ListView | |||
@@ -105,7 +97,8 @@ | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
VerticalAlignment="Bottom" | |||
FontSize="40" | |||
Margin="0 0 0 5" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding DeviceName}" /> | |||
@@ -129,6 +122,7 @@ | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Foreground="#00BEFA" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
@@ -136,8 +130,12 @@ | |||
VerticalAlignment="Bottom" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改设备名称" | |||
IsEnabled="{Binding IsEnable}" /> | |||
Content="修改原料名称" | |||
IsEnabled="{Binding IsEnable}"> | |||
<Button.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝边框.png" /> | |||
</Button.Background> | |||
</Button> | |||
</Grid> | |||
@@ -21,7 +21,7 @@ | |||
<!--#region 测试--> | |||
<ListView | |||
<!--<ListView | |||
Height="150" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
@@ -56,17 +56,83 @@ | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ListView>--> | |||
<!--#endregion--> | |||
<UniformGrid Columns="10"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Margin="0 0 0 35" | |||
FontSize="25" | |||
Foreground="#FFCCD61F" | |||
Text="香料剂" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="25.53 kg" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="1 号仓" /> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<!--<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/>--> | |||
</UniformGrid> | |||
<UniformGrid Grid.Row="2" Columns="10"> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
</UniformGrid> | |||
<UniformGrid Columns="10" Visibility="Collapsed"> | |||
<!--<UniformGrid Columns="10" Visibility="Collapsed"> | |||
<pry:MotorBottle | |||
Width="150" | |||
@@ -172,7 +238,7 @@ | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
</UniformGrid> | |||
</UniformGrid>--> | |||
<Grid x:Name="gr" Grid.Row="1"> | |||
@@ -180,16 +246,21 @@ | |||
Grid.Row="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="0,0,400,0" | |||
Margin="10,0,400,0" | |||
ConveyorBeltWidth="70" | |||
Direction="1" | |||
StrokeBrush="Red" | |||
Direction="0" | |||
StrokeBrush="#00BEFA" | |||
StrokeDashArray="1.5 1.5" | |||
StrokeFillBrush="Red" | |||
StrokeFillBrush="#00BEFA" | |||
StrokeThickness="2" /> | |||
<!--<pry:Pipeline CapRadius="30" Height="30"/>--> | |||
</Grid> | |||
<UniformGrid Grid.Row="2" Columns="10"> | |||
<!--<UniformGrid Grid.Row="2" Columns="10"> | |||
<pry:MotorBottle | |||
Width="150" | |||
@@ -303,7 +374,7 @@ | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
</UniformGrid> | |||
</UniformGrid>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.5*" /> | |||
@@ -0,0 +1,362 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.NewMaterialDeviceParView" | |||
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:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewMaterialDeviceParView" | |||
Width="550" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewMaterialDeviceParViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,10,0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="1" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--#region 请输入原料名称--> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入原料名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<StackPanel Grid.Column="2" Orientation="Horizontal"> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Command="{Binding SaveCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="7,0,0,0" | |||
Content="取消" /> | |||
</StackPanel> | |||
<!--#endregion--> | |||
<!--#region 慢加重量--> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="慢加重量:" /> | |||
<TextBox | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 提前关阀重量--> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="提前关阀重量:" /> | |||
<TextBox | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 快加速度--> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="快加速度:" /> | |||
<TextBox | |||
Grid.Row="3" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 慢加速度--> | |||
<TextBlock | |||
Grid.Row="4" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="慢加速度:" /> | |||
<TextBox | |||
Grid.Row="4" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="4" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 伺服手动速度--> | |||
<TextBlock | |||
Grid.Row="5" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="伺服手动速度:" /> | |||
<TextBox | |||
Grid.Row="5" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="5" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 料仓上限重量--> | |||
<TextBlock | |||
Grid.Row="6" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="料仓上限重量:" /> | |||
<TextBox | |||
Grid.Row="6" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="6" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 料仓下限重量--> | |||
<TextBlock | |||
Grid.Row="7" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="料仓下限重量:" /> | |||
<TextBox | |||
Grid.Row="7" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="7" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 搅拌速度--> | |||
<TextBlock | |||
Grid.Row="8" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="搅拌速度:" /> | |||
<TextBox | |||
Grid.Row="8" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="8" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,27 @@ | |||
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.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// NewMaterialDeviceParView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewMaterialDeviceParView : Window | |||
{ | |||
public NewMaterialDeviceParView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -1,21 +1,22 @@ | |||
<Window x:Class="BPASmartClient.DosingSystem.View.NewMaterialView" | |||
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.DosingSystem.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
mc:Ignorable="d" | |||
Title="NewMateritalView" | |||
Width="600" | |||
Height="600" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None"> | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.NewMaterialView" | |||
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:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewMateritalView" | |||
Width="600" | |||
Height="600" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewMaterialViewModel/> | |||
<vm:NewMaterialViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
@@ -24,7 +25,7 @@ | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
@@ -57,12 +58,16 @@ | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition Height="5*" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<StackPanel | |||
Grid.Row="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
@@ -70,47 +75,60 @@ | |||
Foreground="#FF2AB2E7" | |||
Text="请输入原料名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="10" | |||
FontSize="16" | |||
Text="{Binding MaterialName}" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="10" | |||
FontSize="16" | |||
Text="{Binding MaterialName}" /> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" Cursor="Hand" /> | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" | |||
Cursor="Hand" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Click="btClose_Click" | |||
Content="取消" /> | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Click="btClose_Click" | |||
Content="取消" /> | |||
</StackPanel> | |||
<TextBlock Grid.Row="2" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}"></TextBlock> | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="2" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="4"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="*" /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="本地原料" HorizontalAlignment="Center" FontSize="25" Foreground="#FF2AB2E7"/> | |||
<Border Grid.Row="1" BorderBrush="#FF2AB2E7" BorderThickness="1" Margin="100,10"> | |||
<ScrollViewer Grid.Row="1" BorderBrush="#FF2AB2E7" BorderThickness="1"> | |||
<ItemsControl ItemsSource="{Binding Materials}" Margin="10"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FF2AB2E7" | |||
Text="本地原料" /> | |||
<Border | |||
Grid.Row="1" | |||
Margin="100,10" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="1"> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="1"> | |||
<ItemsControl Margin="10" ItemsSource="{Binding Materials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
@@ -118,7 +136,7 @@ | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
@@ -127,16 +145,17 @@ | |||
Width="150" | |||
Height="29" | |||
Margin="3,1" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RawMaterialName}" /> | |||
<Button | |||
Grid.Column="1" | |||
Margin="10,0,10,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
Grid.Column="1" | |||
Margin="10,0,10,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
</Grid> | |||
@@ -52,11 +52,20 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" BorderThickness="1"> | |||
<Border | |||
Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />--> | |||
</Border.Background> | |||
<Grid> | |||
<!--<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" /> | |||
</Grid.Background>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition /> | |||
@@ -134,7 +143,11 @@ | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="2" Margin="5"> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
Margin="5" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
@@ -201,7 +214,8 @@ | |||
<Button | |||
Grid.Column="2" | |||
Margin="10,0,10,0" | |||
Width="80" | |||
Margin="25,0,0,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
@@ -2,6 +2,7 @@ | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.DosingSystem.Converter" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
@@ -17,6 +18,9 @@ | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<con:RunStatusConvert x:Key="RunStatusConvert" /> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
@@ -46,7 +50,12 @@ | |||
<Grid Margin="20"> | |||
<ScrollViewer> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.2*" /> | |||
</Grid.ColumnDefinitions> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ListView | |||
Margin="5" | |||
@@ -258,5 +267,48 @@ | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl>--> | |||
</ScrollViewer> | |||
<Grid Grid.Column="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="{Binding RecipeName}" /> | |||
<ItemsControl Grid.Row="1" ItemsSource="{Binding recipeProcesses}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Right" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
HorizontalAlignment="Left" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="{Binding RawMaterialStatus, Converter={StaticResource RunStatusConvert}}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -26,6 +26,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewMaterialDeviceParViewModel : ObservableObject | |||
{ | |||
} | |||
} |
@@ -56,7 +56,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
ErrorInfo = String.Empty; | |||
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写";return; } | |||
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; } | |||
for (int i = 0; i < RawMaterials.Count; i++) | |||
{ | |||
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
@@ -89,9 +89,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
} | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
//RawMaterialNames.Add("乳化剂"); | |||
//RawMaterialNames.Add("酶制剂"); | |||
//RawMaterialNames.Add("增味剂"); | |||
@@ -115,7 +115,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
foreach (var item in Global.DeviceRawMaterials) | |||
{ | |||
RawMaterialNames.Add(item.RawMaterialName); | |||
RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
foreach (var item in Json<LocaMaterial>.Data.LocalMaterails) | |||
@@ -135,7 +135,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (Global.userInfo.locaRawMaterials.FirstOrDefault(p => p.RawMaterialName == item.RawMaterialName) != null) RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
} | |||
} | |||
private void AddRecipes() | |||
@@ -153,7 +153,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
}); | |||
} | |||
private string RecipCode = string.Empty; | |||
@@ -50,9 +50,20 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量 | |||
RecipeName = Recipes.ElementAt(index).RecipeName; | |||
App.Current.Dispatcher?.Invoke(new Action(() => | |||
{ | |||
recipeProcesses.Add(new RecipeProcess() | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RawMaterialStatus = item.RecipeStatus | |||
}); | |||
})); | |||
} | |||
Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成 | |||
devices.TryDequeue(out string deviceName); | |||
@@ -70,6 +81,19 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus; | |||
//设备状态显示 | |||
if (Recipes.ElementAt(i).RecipeName == RecipeName) | |||
{ | |||
string deviceName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
int index = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||
if (index >= 0 && index < recipeProcesses.Count) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(index).RawMaterialStatus = RunStatus; })); | |||
} | |||
} | |||
Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus; | |||
var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count)//配方所有配料完成下料 | |||
@@ -77,6 +101,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
for (int r = 0; r < Recipes.ElementAt(i).RawMaterials.Count; r++) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
RecipeName = string.Empty; | |||
} | |||
Recipes.ElementAt(i).IsEnable = true; | |||
Recipes.ElementAt(i).Are.Set(); | |||
@@ -90,5 +116,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public RelayCommand<object> StartCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
public static ObservableCollection<RecipeProcess> recipeProcesses { get; set; } = new ObservableCollection<RecipeProcess>(); | |||
} | |||
} |
@@ -25,6 +25,7 @@ namespace FryPot_DosingSystem | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
public static Window MainWindow; | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
@@ -39,12 +40,12 @@ namespace FryPot_DosingSystem | |||
mv.Show(); | |||
DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取 | |||
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 | |||
HubHelper.GetInstance.Connect("192.168.1.14", 8089); | |||
HubHelper.GetInstance.Connect("192.168.1.40", 8089); | |||
AlarmHelper<AlarmInfo>.Init(); | |||
} | |||
else | |||
mv.Close(); | |||
MainWindow = mv; | |||
//HubHelper.GetInstance.Report = new Action<object>((o) => | |||
//{ | |||
@@ -57,7 +58,7 @@ namespace FryPot_DosingSystem | |||
//}); | |||
//本地服务连接 | |||
} | |||
@@ -86,7 +87,7 @@ namespace FryPot_DosingSystem | |||
SubMenuName = "配方下发", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "FryPot_DosingSystem", | |||
ToggleWindowPath = "View.RecipeSendDownView" | |||
ToggleWindowPath = "View.RecipesSendDown" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
@@ -58,7 +58,7 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
public ushort PlcInite { get; set; } | |||
/// <summary> | |||
/// 清洗台清洗完成信号 | |||
/// 清洗台清洗完成信号/洗桶出桶AGV呼叫信号 | |||
/// </summary> | |||
public ushort CleanComplete { get; set; } | |||
#region 上位机内部逻辑条件 | |||
@@ -185,8 +185,8 @@ namespace FryPot_DosingSystem.Control | |||
public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 | |||
//新增空桶清洗系列变量 | |||
public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清洗台或炒锅 | |||
public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 | |||
public bool agvArriveLineFour { get; set; }//agv从清洗台到达线体4下料位置 | |||
//public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 | |||
public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 | |||
public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置 | |||
@@ -250,6 +250,10 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 当前配方完成的中转信号 | |||
/// </summary> | |||
public ushort RecipeComMidSingle { get; set; } = 1; | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
@@ -268,6 +272,14 @@ namespace FryPot_DosingSystem.Control | |||
/// 线体1上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); | |||
/// <summary> | |||
/// AGV从炒锅到达线体4空桶下料位置 | |||
/// </summary> | |||
public bool agvArriveLineFour { get; set; } | |||
/// <summary> | |||
/// AGV从线体1到达清洗台 | |||
/// </summary> | |||
public bool agvArriveCleanUnLoad { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线2相关变量 | |||
@@ -318,7 +330,10 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 当前配方完成的中转信号 | |||
/// </summary> | |||
public ushort RecipeComMidSingle { get; set; } = 1; | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
@@ -337,6 +352,14 @@ namespace FryPot_DosingSystem.Control | |||
/// 线体2上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); | |||
/// <summary> | |||
/// AGV从炒锅到达线体4空桶下料位置 | |||
/// </summary> | |||
public bool agvArriveLineFour { get; set; } | |||
/// <summary> | |||
/// AGV从线体2到达清洗台 | |||
/// </summary> | |||
public bool agvArriveCleanUnLoad { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线3相关变量 | |||
@@ -387,7 +410,10 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 当前配方完成的中转信号 | |||
/// </summary> | |||
public ushort RecipeComMidSingle { get; set; } = 1; | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
@@ -407,6 +433,14 @@ namespace FryPot_DosingSystem.Control | |||
/// 线体3上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); | |||
/// <summary> | |||
/// AGV从炒锅到达线体4空桶下料位置 | |||
/// </summary> | |||
public bool agvArriveLineFour { get; set; } | |||
/// <summary> | |||
/// AGV从线体3到达清洗台 | |||
/// </summary> | |||
public bool agvArriveCleanUnLoad { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线4相关变量 | |||
@@ -457,8 +491,11 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 当前配方完成的中转信号 | |||
/// </summary> | |||
public ushort RecipeComMidSingle { get; set; } = 1; | |||
} | |||
/// <summary> | |||
/// 炒锅1相关变量 | |||
@@ -14,10 +14,10 @@ namespace FryPot_DosingSystem.Model | |||
/// </summary> | |||
public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } } | |||
private string _recipeName; | |||
/// <summary> | |||
/// 工艺步骤 | |||
/// </summary> | |||
public int Id { get; set; } | |||
///// <summary> | |||
///// 工艺步骤 | |||
///// </summary> | |||
//public int Id { get; set; } | |||
/// <summary> | |||
/// 炒制原料/桶号 | |||
@@ -0,0 +1,17 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace FryPot_DosingSystem.Model | |||
{ | |||
internal class FlowProcessNames:ObservableObject | |||
{ | |||
private static FlowProcessNames _instance; | |||
public static FlowProcessNames GetInstance => _instance ?? (_instance = new FlowProcessNames()); | |||
public ObservableCollection<string> Names { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -39,6 +39,7 @@ | |||
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/> | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/> | |||
<Button Content="配方完成信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneRecipeComSignal}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/> | |||
<Button Content="线体1任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneTaskExit}"></Button> | |||
<Button Content="AGV接口调试" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvDebug}"/> | |||
@@ -65,9 +66,11 @@ | |||
<Button Content="AGV线体1空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineOneEmptyRollerLoc}"/> | |||
<Button Content="AGV线体1空桶上料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvLineOneLoadEmptyCom}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV空桶清洗下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocCom}"/> | |||
<Button Content="AGV空桶清洗上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoad}"/> | |||
<Button Content="AGV空桶清洗上料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoadCom}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
<Button Content="AGV线体4空桶下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLocCom}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
@@ -82,6 +85,7 @@ | |||
<ComboBox SelectionChanged="ComboBox_SelectionChanged_1" ItemsSource="{Binding LineTwoRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/> | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/> | |||
<Button Content="配方完成信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineTwoRecipeComSignal}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/> | |||
<Button Content="线体2任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineTwoTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/> | |||
@@ -103,9 +107,11 @@ | |||
<Button Content="AGV线体2空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineTwoEmptyRollerLoc}"/> | |||
<Button Content="AGV线体2空桶上完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvLineTwoLoadEmptyCom}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV空桶清洗下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocCom}"/> | |||
<Button Content="AGV空桶清洗上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoad}"/> | |||
<Button Content="AGV空桶清洗上料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoadCom}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
<Button Content="AGV线体4空桶下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLocCom}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
@@ -118,6 +124,7 @@ | |||
<ComboBox SelectionChanged="ComboBox_SelectionChanged_2" ItemsSource="{Binding LineThreeRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/> | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/> | |||
<Button Content="配方完成信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineThreeRecipeComSignal}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/> | |||
<Button Content="线体3任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineThreeTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/> | |||
@@ -139,9 +146,11 @@ | |||
<Button Content="AGV线体3空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineThreeEmptyRollerLoc}"/> | |||
<Button Content="AGV线体3空桶上料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvLineThreeLoadEmptyCom}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV空桶清洗下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocCom}"/> | |||
<Button Content="AGV空桶清洗上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoad}"/> | |||
<Button Content="AGV空桶清洗上料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoadCom}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
<Button Content="AGV线体4空桶下料完成" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLocCom}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
@@ -4,6 +4,7 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
xmlns:local="clr-namespace:FryPot_DosingSystem.View" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
@@ -5,11 +5,384 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:FryPot_DosingSystem.View" | |||
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" | |||
mc:Ignorable="d" | |||
Title="FlowProcessView" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> | |||
<Window.DataContext> | |||
<vm:FlowProcessSetViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<!--<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary>--> | |||
<SolidColorBrush x:Key="foreground" Color="#a2c2e8" /> | |||
<SolidColorBrush x:Key="borderBrush" Color="#FF074B92" /> | |||
<Style x:Key="ComboBoxFocusVisual"> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle | |||
Margin="4,4,21,4" | |||
SnapsToDevicePixels="true" | |||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||
StrokeDashArray="1 2" | |||
StrokeThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry> | |||
<Style x:Key="ComboBoxTransparentButtonStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="0" /> | |||
<Setter Property="Width" Value="Auto" /> | |||
<Setter Property="Height" Value="Auto" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" /> | |||
<Setter Property="BorderThickness" Value="2" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<DockPanel | |||
Background="{TemplateBinding Background}" | |||
LastChildFill="false" | |||
SnapsToDevicePixels="true"> | |||
<Themes1:ClassicBorderDecorator | |||
x:Name="Border" | |||
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
DockPanel.Dock="Right"> | |||
<Path | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Data="{StaticResource DownArrowGeometry}" | |||
Fill="{TemplateBinding Foreground}" /> | |||
</Themes1:ClassicBorderDecorator> | |||
</DockPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="Border" Property="BorderStyle" Value="AltPressed" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="AllowDrop" Value="true" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
<Setter Property="MinHeight" Value="0" /> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TextBox}"> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Background="Transparent" | |||
Focusable="false" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Themes1:ClassicBorderDecorator | |||
x:Name="Border" | |||
BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="2"> | |||
<Popup | |||
x:Name="PART_Popup" | |||
AllowsTransparency="true" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<Themes1:SystemDropShadowChrome | |||
x:Name="Shdw" | |||
MinWidth="{Binding ActualWidth, ElementName=Border}" | |||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | |||
Color="Transparent"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" | |||
BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/窗体样式/From/内部背景.png" | |||
Opacity="0.5" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas | |||
Width="0" | |||
Height="0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top"> | |||
<Rectangle | |||
x:Name="OpaqueRect" | |||
Width="{Binding ActualWidth, ElementName=DropDownBorder}" | |||
Height="{Binding ActualHeight, ElementName=DropDownBorder}" | |||
Fill="{Binding Background, ElementName=DropDownBorder}" /> | |||
</Canvas> | |||
<ItemsPresenter | |||
x:Name="ItemsPresenter" | |||
KeyboardNavigation.DirectionalNavigation="Contained" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</Themes1:SystemDropShadowChrome> | |||
</Popup> | |||
</Themes1:ClassicBorderDecorator> | |||
<ToggleButton | |||
Width="Auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxTransparentButtonStyle}" /> | |||
<DockPanel> | |||
<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" /> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | |||
CaretBrush="White" | |||
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxEditableTextBox}" /> | |||
</DockPanel> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /> | |||
</Trigger> | |||
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true"> | |||
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> | |||
<Setter TargetName="Shdw" Property="Color" Value="#71000000" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true" /> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" /> | |||
</MultiTrigger> | |||
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false"> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" /> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="BaseComboBoxStyle" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" /> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Margin" Value="0,0,0,0" /> | |||
<Setter Property="Padding" Value="0" /> | |||
<Setter Property="Height" Value="24" /> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="IsTextSearchCaseSensitive" Value="true" /> | |||
<Setter Property="IsEditable" Value="true" /> | |||
<Setter Property="StaysOpenOnEdit" Value="true" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Themes1:ClassicBorderDecorator | |||
x:Name="Border" | |||
BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="2"> | |||
<Popup | |||
x:Name="PART_Popup" | |||
AllowsTransparency="true" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<Themes1:SystemDropShadowChrome | |||
x:Name="Shdw" | |||
MinWidth="{Binding ActualWidth, ElementName=Border}" | |||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | |||
Color="Transparent"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" | |||
BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/窗体样式/From/内部背景.png" /> | |||
</Border.Background> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas | |||
Width="0" | |||
Height="0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top"> | |||
<Rectangle | |||
x:Name="OpaqueRect" | |||
Width="{Binding ActualWidth, ElementName=DropDownBorder}" | |||
Height="{Binding ActualHeight, ElementName=DropDownBorder}" | |||
Fill="{Binding Background, ElementName=DropDownBorder}" /> | |||
</Canvas> | |||
<ItemsPresenter | |||
x:Name="ItemsPresenter" | |||
KeyboardNavigation.DirectionalNavigation="Contained" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</Themes1:SystemDropShadowChrome> | |||
</Popup> | |||
</Themes1:ClassicBorderDecorator> | |||
<DockPanel Margin="2"> | |||
<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" /> | |||
<Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}"> | |||
<ContentPresenter | |||
Margin="1,1,1,1" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</DockPanel> | |||
<ToggleButton | |||
Width="Auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxTransparentButtonStyle}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<!--<Condition Property="IsSelectionBoxHighlighted" Value="true"/>--> | |||
<Condition Property="IsDropDownOpen" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |||
</MultiTrigger> | |||
<!--<Trigger Property="IsSelectionBoxHighlighted" Value="true"> | |||
<Setter Property="Background" TargetName="SelectedItemBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> | |||
</Trigger>--> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true" /> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" /> | |||
</MultiTrigger> | |||
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true"> | |||
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> | |||
<Setter TargetName="Shdw" Property="Color" Value="#71000000" /> | |||
</Trigger> | |||
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false"> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" /> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Padding" Value="1" /> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style BasedOn="{StaticResource BaseComboBoxStyle}" TargetType="ComboBox" /> | |||
<!--#endregion--> | |||
<!--#region ColorCommboxStyle--> | |||
<ObjectDataProvider | |||
x:Key="colorPropertieOdp" | |||
MethodName="GetProperties" | |||
ObjectInstance="{x:Type Colors}" /> | |||
<Style | |||
x:Key="ColorCommboxStyle" | |||
BasedOn="{StaticResource BaseComboBoxStyle}" | |||
TargetType="ComboBox"> | |||
<Setter Property="IsTextSearchCaseSensitive" Value="False" /> | |||
<Setter Property="IsEditable" Value="False" /> | |||
<Setter Property="StaysOpenOnEdit" Value="False" /> | |||
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource colorPropertieOdp}}" /> | |||
<Setter Property="ItemTemplate"> | |||
<Setter.Value> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<Rectangle | |||
Width="40" | |||
Height="10" | |||
Fill="{Binding Name}" /> | |||
<TextBlock Text="{Binding Name}" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</Window.Resources> | |||
<Border x:Name="br"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#264c73"/> | |||
@@ -26,6 +399,9 @@ | |||
<Border BorderThickness="0,0,0,1" BorderBrush="#FF2AB2E7"></Border> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<Button Content="向前新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddFrontFlowItemCommand}" ></Button> | |||
<Button Content="向后新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddLastFlowItemCommand}" ></Button> | |||
<Button Content="删除选项" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding DeleteFlowItemCommand}" ></Button> | |||
<Button Content="保存工艺" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding ConfirmCommand}" ></Button> | |||
<Button Content="取消" Height="30" Width="100" Margin="0,0,10,0" Background="Transparent" FontSize="18" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding CloseWindowCommand}"></Button> | |||
@@ -51,25 +427,28 @@ | |||
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="5" Text="炒制时间" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
</Grid> | |||
<ItemsControl ItemsSource="{Binding flowProcessModels}" Grid.Row="3"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBox Text="{Binding Id}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" IsReadOnly="True" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1" /> | |||
<TextBox Text="{Binding FryMaterialNum}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding flowProcessModels.Count}" ItemsSource="{Binding flowProcessModels}" Margin="0,1,0,-1"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel x:Name="stk" Orientation="Horizontal" > | |||
<Label MouseLeftButtonDown="Label_MouseLeftButtonDown" Content="{Binding Path=(ItemsControl.AlternationIndex),RelativeSource={ | |||
RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/> | |||
<ComboBox ItemsSource="{Binding DataContext.FlowItems, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" Text="{Binding FryMaterialNum}" Style="{StaticResource BaseComboBoxStyle}" IsReadOnly="True" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.Helper; | |||
using FryPot_DosingSystem.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -20,16 +21,93 @@ namespace FryPot_DosingSystem.View | |||
/// </summary> | |||
public partial class FlowProcessView : Window | |||
{ | |||
public FlowProcessView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseFlowProcessView"); | |||
ActionManage.GetInstance.Register(new Action(() => { | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
this.Close(); | |||
}), "CloseFlowProcessView"); | |||
} | |||
private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
Label txt = sender as Label; | |||
if (txt != null) | |||
{ | |||
StackPanel oldSp = FindFirstVisualChild(itemcontrols, "stk"); | |||
if (oldSp != null) | |||
oldSp.Background = new SolidColorBrush(Color.FromRgb(38, 76, 115)); | |||
StackPanel sp = VisualTreeHelper.GetParent(txt) as StackPanel; | |||
sp.Background = new SolidColorBrush(Color.FromRgb(8, 20, 36)); | |||
ActionManage.GetInstance.Send("CurrentItemId", txt.Content); | |||
} | |||
} | |||
public StackPanel FindFirstVisualChild(DependencyObject obj, string childName) | |||
{ | |||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) | |||
{ | |||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); | |||
if (child != null && child is StackPanel && child.GetValue(NameProperty).ToString() == childName) | |||
{ | |||
if (child is StackPanel stack && stack.Background?.ToString() == "#FF081424") | |||
return stack; | |||
} | |||
else | |||
{ | |||
StackPanel SP = FindFirstVisualChild(child, childName); | |||
if (SP != null) | |||
{ | |||
return SP; | |||
} | |||
} | |||
} | |||
return null; | |||
} | |||
//private void ComboBox_KeyUp(object sender, KeyEventArgs e) | |||
//{ | |||
// var res = sender as ComboBox; | |||
// Json<FlowProcessNames>.Read(); | |||
// if (res.Text != null && res.Text != String.Empty) | |||
// { | |||
// var datas = Json<FlowProcessNames>.Data.Names.Where(s => s.Contains(res.Text.Trim())); | |||
// // var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim())); | |||
// if (datas.Count() > 0) | |||
// { | |||
// res.ItemsSource = datas; | |||
// res.IsDropDownOpen = true; | |||
// } | |||
// else | |||
// { | |||
// res.IsDropDownOpen = false; | |||
// } | |||
// } | |||
//} | |||
//private void ComboBox_LostFocus(object sender, RoutedEventArgs e) | |||
//{ | |||
// var res = sender as ComboBox; | |||
// if (res.Text != null && res.Text != String.Empty) | |||
// { | |||
// if (!Json<FlowProcessNames>.Data.Names.Contains(res.Text.Trim()))//判断是否存在原料 | |||
// { | |||
// //FlowProcessNames.GetInstance.Names.Add(res.Text.Trim()); | |||
// //Json<FlowProcessNames>.Data = FlowProcessNames.GetInstance; | |||
// Json<FlowProcessNames>.Data.Names.Add(res.Text.Trim()); | |||
// Json<FlowProcessNames>.Save(); | |||
// } | |||
// } | |||
//} | |||
} | |||
} |
@@ -40,7 +40,7 @@ namespace FryPot_DosingSystem.View | |||
var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString()); | |||
}); | |||
HubHelper.GetInstance.Connect("192.168.1.56", 8089); | |||
HubHelper.GetInstance.Connect("192.168.1.40", 8089); | |||
} | |||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) | |||
@@ -40,7 +40,7 @@ namespace FryPot_DosingSystem.View | |||
var res = sender as ComboBox; | |||
Json<MaterialNames>.Read(); | |||
if (res.Text != null) | |||
if (res.Text != null && res.Text != String.Empty) | |||
{ | |||
var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim())); | |||
// var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim())); | |||
@@ -59,7 +59,7 @@ namespace FryPot_DosingSystem.View | |||
private void ComboBox_LostFocus(object sender, RoutedEventArgs e) | |||
{ | |||
var res = sender as ComboBox; | |||
if (res.Text != null) | |||
if (res.Text != null && res.Text != String.Empty) | |||
{ | |||
if (!MaterialNames.GetInstance.Names.Contains(res.Text.Trim()))//判断是否存在原料 | |||
{ | |||
@@ -0,0 +1,122 @@ | |||
<UserControl x:Class="FryPot_DosingSystem.View.RecipesSendDown" | |||
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:FryPot_DosingSystem.View" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:RecipeSetDownViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
<!-- SelectedItem without focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.ControlBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
</Style.Resources> | |||
<!-- 设置触发器 --> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Content="配方一键下发" Width="110" Height="30" Margin="0,0,10,0" Cursor="Hand" Command="{Binding AllRecipeSetDownCommand}"></Button> | |||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" > | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="2,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeName}" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30" | |||
Background="#00BEFA"> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RecipeSetDownCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeId}" | |||
Content="订单下发" | |||
EnterBackground="Red" | |||
FontStyle="Normal" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ScrollViewer> | |||
</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 FryPot_DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipesSendDown.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipesSendDown : UserControl | |||
{ | |||
public RecipesSendDown() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -22,7 +22,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand FryPotInputArrive { get; set; } | |||
public RelayCommand FryPotEmptyRollerArrive { get; set; } | |||
public RelayCommand LineOneTaskExit { get; set; } | |||
public RelayCommand LineOneRecipeComSignal { get; set; } | |||
public RelayCommand AGVLOneArrive { get; set; } | |||
public RelayCommand AGVFryPotDownArrive { get; set; } | |||
@@ -36,7 +36,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand FryPotTwoInputArrive { get; set; } | |||
public RelayCommand FryPotTwoEmptyRollerArrive { get; set; } | |||
public RelayCommand LineTwoTaskExit { get; set; } | |||
public RelayCommand LineTwoRecipeComSignal { get; set; } | |||
public RelayCommand AGVLTwoArrive { get; set; } | |||
public RelayCommand AGVFryPotTwoDownArrive { get; set; } | |||
@@ -49,6 +49,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand FryPotThreeInputArrive { get; set; } | |||
public RelayCommand FryPotThreeEmptyRollerArrive { get; set; } | |||
public RelayCommand LineThreeTaskExit { get; set; } | |||
public RelayCommand LineThreeRecipeComSignal { get; set; } | |||
public RelayCommand AGVLThreeArrive { get; set; } | |||
public RelayCommand AGVFryPotThreeDownArrive { get; set; } | |||
@@ -69,10 +70,11 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand AgvLineThreeLoadEmptyCom { get; set; } | |||
public RelayCommand CleanPlateCallAgv { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLoc { get; set; }//下料 | |||
public RelayCommand AgvArriveLineFourLoc { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLocCom { get; set; }//下料完成 | |||
public RelayCommand AgvArriveLineFourLoc { get; set; }//下料 | |||
public RelayCommand AgvArriveLineFourLocCom { get; set; }//4号线空桶下料完成 | |||
public RelayCommand AgvArriveCleanPlateLocLoad { get; set; }//上料 | |||
public RelayCommand AgvArriveCleanPlateLocLoadCom { get; set; }//上料完成 | |||
public RelayCommand EmptyRollerCleanTaskRestart { get; set; } | |||
public DebugViewModel() | |||
{ | |||
@@ -80,7 +82,31 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
ActionManage.GetInstance.Send("AgvDebug"); | |||
})); | |||
AgvArriveCleanPlateLocCom = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLocCom"); | |||
}); | |||
AgvArriveLineFourLocCom = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineFourLocCom"); | |||
}); | |||
AgvArriveCleanPlateLocLoadCom = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLocLoadCom"); | |||
}); | |||
LineOneRecipeComSignal = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("LineOneRecipeComSignal"); | |||
}); | |||
LineTwoRecipeComSignal = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("LineTwoRecipeComSignal"); | |||
}); | |||
LineThreeRecipeComSignal = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("LineThreeRecipeComSignal"); | |||
}); | |||
EmptyRollerCleanTaskRestart = new RelayCommand(() => | |||
{ | |||
@@ -13,65 +13,162 @@ namespace FryPot_DosingSystem.ViewModel | |||
internal class FlowProcessSetViewModel | |||
{ | |||
public int Id { get; set; } = 0; | |||
public static int materialNum { get; set; } | |||
public ObservableCollection<FlowProcessModel> flowProcessModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
public string currnetRecipeName { get; set;} | |||
public string currentRecipeName { get; set; } | |||
public static int currentItemId { get; set; } | |||
public RelayCommand CloseWindowCommand { get; set; } | |||
public ObservableCollection<string> FlowItems { get; set; } = new ObservableCollection<string>(); | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand AddLastFlowItemCommand { get; set; } | |||
public RelayCommand AddFrontFlowItemCommand { get; set; } | |||
public RelayCommand DeleteFlowItemCommand { get; set; } | |||
public FlowProcessSetViewModel() | |||
{ | |||
Json<FlowProcessNames>.Read(); | |||
// FlowProcessNames.GetInstance.Names = Json<FlowProcessNames>.Data.Names; | |||
FlowItems = Json<FlowProcessNames>.Data.Names; | |||
ActionManage.GetInstance.Register(new Action<object>((obj) => | |||
{ | |||
if (obj != null) | |||
try | |||
{ | |||
currentItemId = Convert.ToInt32(obj); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
}), "CurrentItemId"); | |||
//ActionManage.GetInstance.Register(new Action<object>(obj => | |||
//{ | |||
// if (obj != null) | |||
// materialNum = Convert.ToInt32(obj); | |||
//}), "MaterialNum"); | |||
ActionManage.GetInstance.Register(new Action<object>(recipeName => | |||
{ | |||
if (recipeName != null) | |||
{ | |||
currnetRecipeName = recipeName.ToString(); | |||
currentRecipeName = recipeName.ToString(); | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.FlowProcess.RecipeName == recipeName.ToString()); | |||
if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 | |||
{ | |||
//flowProcessModels = recipe.FlowProcess.fpModels; | |||
foreach (var item in recipe.materialCollection) | |||
{ | |||
if (!FlowItems.Contains(item.MaterialName)) | |||
FlowItems.Insert(0, item.MaterialName);//下拉框 | |||
} | |||
foreach (var item in recipe.FlowProcess.fpModels) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = item.Id, FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); | |||
flowProcessModels.Add(new FlowProcessModel {FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); | |||
} | |||
// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count); | |||
} | |||
else//创建新工艺 | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p=>p.RecipeName==recipeName.ToString()); | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == recipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = recipeName.ToString(); | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = "油" }); | |||
Id++; | |||
foreach (var item in name.materialCollection) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = item.MaterialName }); | |||
Id++; | |||
if (!FlowItems.Contains(item.MaterialName)) | |||
FlowItems.Insert(0, item.MaterialName);//下拉框 | |||
} | |||
name.FlowProcess.fpModels= flowProcessModels; | |||
ActionManage.GetInstance.Send("MaterialNum", name.materialCollection.Count); | |||
name.FlowProcess.fpModels = flowProcessModels; | |||
} | |||
} | |||
} | |||
}), "EditFlowProcess"); | |||
CloseWindowCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == currnetRecipeName.ToString()); | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == currentRecipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = currnetRecipeName.ToString(); | |||
name.FlowProcess.fpModels = flowProcessModels; | |||
name.FlowProcess.RecipeName = currentRecipeName.ToString(); | |||
// name.FlowProcess.fpModels = flowProcessModels; | |||
name.FlowProcess.fpModels.Clear(); | |||
foreach (var item in flowProcessModels) | |||
{ | |||
name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); | |||
} | |||
foreach (var item in name.materialCollection) | |||
{ | |||
string s= Json<FlowProcessNames>.Data.Names.FirstOrDefault(p=>p == item.MaterialName); | |||
Json<FlowProcessNames>.Data.Names.Remove(s); | |||
} | |||
} | |||
Json<RecipeManage>.Save(); | |||
Json<FlowProcessNames>.Save(); | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
AddFrontFlowItemCommand = new RelayCommand(() => | |||
{ | |||
try | |||
{ | |||
if (currentItemId == 0) | |||
{ | |||
flowProcessModels.Insert(0, new FlowProcessModel()); | |||
} | |||
else | |||
{ | |||
flowProcessModels.Insert(currentItemId, new FlowProcessModel()); | |||
currentItemId = currentItemId + 1; | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
//throw; | |||
} | |||
}); | |||
AddLastFlowItemCommand = new RelayCommand(() => | |||
{ | |||
try | |||
{ | |||
if (flowProcessModels.Count <= 0) | |||
{ | |||
flowProcessModels.Insert(0, new FlowProcessModel()); | |||
} | |||
else if (currentItemId != 0) | |||
{ | |||
flowProcessModels.Insert(currentItemId + 1, new FlowProcessModel()); | |||
} | |||
else | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel()); | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
}); | |||
DeleteFlowItemCommand = new RelayCommand(() => | |||
{ | |||
if (flowProcessModels.Count > 0) | |||
flowProcessModels.RemoveAt(currentItemId); | |||
currentItemId = 0; | |||
}); | |||
} | |||
} | |||
} |
@@ -118,7 +118,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
} | |||
else | |||
{ | |||
MessageBox.Show("配方名称重复,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
MessageBox.Show("配方名称重复或为空,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
} | |||
@@ -1,4 +1,6 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using FryPot_DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
@@ -38,13 +40,15 @@ namespace FryPot_DosingSystem.ViewModel | |||
if (res != null) | |||
{ | |||
RecipeSetDown(new NewRecipeModel[] { res }); | |||
res.RecipeSetInfo = "配方下发成功"; | |||
Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); | |||
//res.RecipeSetInfo = "配方下发成功"; | |||
//Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | |||
} | |||
else | |||
{ | |||
res.RecipeSetInfo = "配方下发失败"; | |||
Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); | |||
//res.RecipeSetInfo = "配方下发失败"; | |||
//Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"配方下发失败!"); | |||
} | |||
} | |||
@@ -53,23 +57,28 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
if (Recipes != null) | |||
{ | |||
//foreach (var recipeModel in Recipes) | |||
//{ | |||
// RecipeSetDown(recipeModel); | |||
//} | |||
RecipeSetDown(Recipes.ToArray()); | |||
Task.Run(() => | |||
try | |||
{ | |||
RecipeSetDown(Recipes.ToArray()); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"所有配方下发成功!"); | |||
} | |||
catch (Exception) | |||
{ | |||
foreach (var item in Recipes) | |||
{ | |||
item.RecipeSetInfo = "下发成功"; | |||
} | |||
Thread.Sleep(1500); | |||
foreach (var item in Recipes) | |||
{ | |||
item.RecipeSetInfo = string.Empty; | |||
} | |||
}); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"配方下发失败!"); | |||
} | |||
//Task.Run(() => | |||
//{ | |||
// foreach (var item in Recipes) | |||
// { | |||
// item.RecipeSetInfo = "下发成功"; | |||
// } | |||
// Thread.Sleep(1500); | |||
// foreach (var item in Recipes) | |||
// { | |||
// item.RecipeSetInfo = string.Empty; | |||
// } | |||
//}); | |||
} | |||
@@ -1,4 +1,6 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Helper; | |||
using FryPot_DosingSystem.Model; | |||
using FryPot_DosingSystem.View; | |||
@@ -83,6 +85,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
Json<RecipeManage>.Save(); | |||
count = recipeModels.Count; | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | |||
})); | |||
EditRecipeCommand = new RelayCommand<object>((Id) => | |||
{ | |||
@@ -132,6 +132,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodBigSt | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodSmallStation", "BPASmartClient.JXJFoodSmallStation\BPASmartClient.JXJFoodSmallStation.csproj", "{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFDemo", "WPFDemo\WPFDemo.csproj", "{A456D582-D910-4CA2-8620-6D8F63344B47}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -1266,6 +1268,26 @@ Global | |||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}.Release|x64.Build.0 = Release|Any CPU | |||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}.Release|x86.ActiveCfg = Release|Any CPU | |||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}.Release|x86.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|x64.Build.0 = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Debug|x86.Build.0 = Debug|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|ARM.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|ARM64.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1327,6 +1349,7 @@ Global | |||
{D1F2379E-1755-4B50-9D67-15C960C33FFA} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | |||
{FA695D7E-6F12-4483-A16D-8494609FAE68} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{A456D582-D910-4CA2-8620-6D8F63344B47} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||
@@ -11,24 +11,23 @@ namespace TestDemo | |||
public Form1() | |||
{ | |||
InitializeComponent(); | |||
HubHelper.GetInstance.Connect("192.168.1.14", 8089); | |||
} | |||
private void button1_Click(object sender, EventArgs e) | |||
{ | |||
AGVToUpSystem aGVToUpSystem = new AGVToUpSystem(); | |||
string value = JsonConvert.SerializeObject(aGVToUpSystem); | |||
string url = $"http://192.168.1.14:8089/apicallback/quicktron/robotjob/report?sign={value}"; | |||
string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/report?sign={value}"; | |||
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST); | |||
} | |||
private void button2_Click(object sender, EventArgs e) | |||
{ | |||
Upstreamrequest aGVToUpSystem = new Upstreamrequest(); | |||
string value = JsonConvert.SerializeObject(aGVToUpSystem); | |||
string url = $"http://192.168.1.14:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}"; | |||
string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}"; | |||
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST); | |||
} | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
<Application x:Class="WPFDemo.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
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 WPFDemo | |||
{ | |||
/// <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,23 @@ | |||
<Window x:Class="WPFDemo.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:WPFDemo" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="450" Width="800"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Width="120" Height="30" Content="ADD" Click="Button_Click" /> | |||
<Button Width="120" Height="30" Content="DRAW LINE" Click="Button_Click_1" /> | |||
<Button Width="120" Height="30" Content="LOAD" Click="Button_Click_2" /> | |||
<Button Width="120" Height="30" Content="SAVE" Click="Button_Click_3" /> | |||
<Button Width="120" Height="30" Content="CLR" Click="Button_Click_4" /> | |||
</StackPanel> | |||
<local:SiloPanel x:Name="sp" Grid.Row="1" PanelHeight="1030" PanelWidth="2000"/> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,53 @@ | |||
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 WPFDemo | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
sp.AddSilo(); | |||
} | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
sp.AddLine(); | |||
} | |||
private void Button_Click_2(object sender, RoutedEventArgs e) | |||
{ | |||
sp.Load(); | |||
} | |||
private void Button_Click_3(object sender, RoutedEventArgs e) | |||
{ | |||
sp.Save(); | |||
} | |||
private void Button_Click_4(object sender, RoutedEventArgs e) | |||
{ | |||
sp.Clear(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Shapes; | |||
namespace WPFDemo | |||
{ | |||
public class Segment | |||
{ | |||
public List<SimpleSilo> Silos { get; set; } = new List<SimpleSilo>(); | |||
public List<SimpleLine> Lines { get; set; } = new List<SimpleLine>(); | |||
public class SimpleSilo | |||
{ | |||
public string Caption { get; set; } | |||
public string Index { get; set; } | |||
public double Top { get; set; } | |||
public double Left { get; set; } | |||
} | |||
public class SimpleLine { | |||
public double X1 { get; set; } | |||
public double X2 { get; set; } | |||
public double Y1 { get; set; } | |||
public double Y2 { get; set; } | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
<UserControl x:Class="WPFDemo.Silo" | |||
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:WPFDemo" | |||
Width="120" | |||
Height="150" | |||
mc:Ignorable="d" | |||
DataContext="{Binding RelativeSource={RelativeSource Self}}" | |||
> | |||
<Border BorderBrush="#FF243654" Background="#FF79E8C7"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition Height="35"></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<Image Width="120" Height="120" Source="device.png"></Image> | |||
<Grid Grid.Row="1" Margin="10,2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="编号" Grid.Row="0" Grid.Column="0"></TextBlock> | |||
<TextBlock Text="{Binding Index}" Grid.Row="0" Grid.Column="1"></TextBlock> | |||
<TextBlock Text="编号" Grid.Row="1" Grid.Column="0"></TextBlock> | |||
<TextBlock Text="{Binding Caption}" Grid.Row="1" Grid.Column="1"></TextBlock> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -0,0 +1,60 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
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 WPFDemo | |||
{ | |||
/// <summary> | |||
/// Silo.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Silo : UserControl, INotifyPropertyChanged | |||
{ | |||
public string Index | |||
{ | |||
get { return (string)GetValue(IndexProperty); } | |||
set { SetValue(IndexProperty, value); | |||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Index")); | |||
} | |||
} | |||
// Using a DependencyProperty as the backing store for Index. This enables animation, styling, binding, etc... | |||
public static readonly DependencyProperty IndexProperty = | |||
DependencyProperty.Register("Index", typeof(string), typeof(Silo), new PropertyMetadata("Unkown")); | |||
public string Caption | |||
{ | |||
get { return (string)GetValue(CaptionProperty); } | |||
set { SetValue(CaptionProperty, value); | |||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Caption")); | |||
} | |||
} | |||
// Using a DependencyProperty as the backing store for Caption. This enables animation, styling, binding, etc... | |||
public static readonly DependencyProperty CaptionProperty = | |||
DependencyProperty.Register("Caption", typeof(string), typeof(Silo), new PropertyMetadata("Null")); | |||
public Silo() | |||
{ | |||
InitializeComponent(); | |||
} | |||
public event PropertyChangedEventHandler? PropertyChanged; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
<UserControl x:Name="userControl" x:Class="WPFDemo.SiloPanel" | |||
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:WPFDemo" | |||
DataContext="{Binding RelativeSource={RelativeSource Self}}" | |||
mc:Ignorable="d" > | |||
<Viewbox > | |||
<Canvas Name="cvMain" Width="{Binding PanelWidth}" Height="{Binding PanelHeight}" Background="#B2C0E2E1"> | |||
<StackPanel Orientation="Horizontal" Canvas.Top="5" Canvas.Left="5"> | |||
<TextBlock FontSize="15" Text="{Binding Tips}"></TextBlock> | |||
</StackPanel> | |||
</Canvas> | |||
</Viewbox> | |||
</UserControl> |
@@ -0,0 +1,288 @@ | |||
using Microsoft.Win32; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.IO; | |||
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 WPFDemo | |||
{ | |||
/// <summary> | |||
/// SiloPanel.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class SiloPanel : UserControl, INotifyPropertyChanged | |||
{ | |||
//料仓模块左键按下标识 | |||
bool siloIsMouseDown = false; | |||
//画线标识 | |||
bool lineIsDraw = false; | |||
//当前线条 | |||
private Line currentLine; | |||
//线条集合 | |||
private List<Line> lines = new List<Line>(); | |||
//料仓集合 | |||
private List<Silo> silos = new List<Silo>(); | |||
//用于序列化 | |||
private Segment segment = new Segment(); | |||
//提示 | |||
private string tips = "常规模式"; | |||
/// <summary> | |||
/// 提示 | |||
/// </summary> | |||
public string Tips | |||
{ | |||
get { return tips; } | |||
set | |||
{ | |||
tips = value; | |||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Tips")); | |||
} | |||
} | |||
/// <summary> | |||
/// 当前选中的料仓 | |||
/// </summary> | |||
public Silo CurrentSilo { get; private set; } | |||
/// <summary> | |||
/// 画布宽度 | |||
/// </summary> | |||
public double PanelWidth | |||
{ | |||
get { return (double)GetValue(PanelWidthProperty); } | |||
set { SetValue(PanelWidthProperty, value); } | |||
} | |||
// Using a DependencyProperty as the backing store for PanelWidth. This enables animation, styling, binding, etc... | |||
public static readonly DependencyProperty PanelWidthProperty = | |||
DependencyProperty.Register("PanelWidth", typeof(double), typeof(SiloPanel), new PropertyMetadata(1920d)); | |||
/// <summary> | |||
/// 画布高度 | |||
/// </summary> | |||
public double PanelHeight | |||
{ | |||
get { return (double)GetValue(PanelHeightProperty); } | |||
set { SetValue(PanelHeightProperty, value); } | |||
} | |||
// Using a DependencyProperty as the backing store for PanelHeight. This enables animation, styling, binding, etc... | |||
public static readonly DependencyProperty PanelHeightProperty = | |||
DependencyProperty.Register("PanelHeight", typeof(double), typeof(SiloPanel), new PropertyMetadata(1080d)); | |||
public event PropertyChangedEventHandler? PropertyChanged; | |||
public SiloPanel() | |||
{ | |||
InitializeComponent(); | |||
cvMain.PreviewMouseLeftButtonDown += CvMain_PreviewMouseLeftButtonDown; | |||
cvMain.PreviewMouseMove += CvMain_PreviewMouseMove; | |||
cvMain.PreviewMouseLeftButtonUp += CvMain_PreviewMouseLeftButtonUp; | |||
} | |||
/// <summary> | |||
/// 开始画线 | |||
/// </summary> | |||
public void AddLine() | |||
{ | |||
lineIsDraw = true; | |||
Tips = "线条绘制"; | |||
} | |||
/// <summary> | |||
/// 添加料仓模块 | |||
/// </summary> | |||
public void AddSilo() | |||
{ | |||
if (lineIsDraw) | |||
lineIsDraw = false; | |||
newSilo(String.Empty, String.Empty); | |||
} | |||
/// <summary> | |||
/// 保存文件 | |||
/// </summary> | |||
public void Save() | |||
{ | |||
segment.Silos.Clear(); | |||
segment.Lines.Clear(); | |||
lines.ForEach(line => | |||
{ | |||
segment.Lines.Add(new Segment.SimpleLine() { X1 = line.X1, X2 = line.X2, Y1 = line.Y1, Y2 = line.Y2 }); | |||
}); | |||
silos.ForEach(silo => | |||
{ | |||
segment.Silos.Add(new Segment.SimpleSilo() | |||
{ | |||
Left = (double)silo.GetValue(Canvas.LeftProperty), | |||
Top = (double)silo.GetValue(Canvas.TopProperty), | |||
Caption = silo.Caption, | |||
Index = silo.Index | |||
}); | |||
}); | |||
string ResultJson = JsonConvert.SerializeObject(segment); | |||
SaveFileDialog dialog = new SaveFileDialog(); | |||
dialog.Filter = "配置文件|*.json"; | |||
if (dialog.ShowDialog() == true) | |||
{ | |||
File.WriteAllText(dialog.FileName, ResultJson); | |||
} | |||
} | |||
/// <summary> | |||
/// 加载文件 | |||
/// </summary> | |||
public void Load() | |||
{ | |||
OpenFileDialog dialog = new OpenFileDialog(); | |||
dialog.Filter = "配置文件|*.json"; | |||
if (dialog.ShowDialog() == true) | |||
{ | |||
string content = File.ReadAllText(dialog.FileName); | |||
try | |||
{ | |||
segment = JsonConvert.DeserializeObject<Segment>(content); | |||
lines.Clear(); | |||
silos.Clear(); | |||
cvMain.Children.Clear(); | |||
foreach (var line in segment.Lines) | |||
{ | |||
newLine(line.X1, line.Y1, line.X2, line.Y2); | |||
} | |||
foreach (var temp in segment.Silos) | |||
{ | |||
newSilo(temp.Caption, temp.Index,temp.Left,temp.Top); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageBox.Show(ex.Message); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 清空画布 | |||
/// </summary> | |||
public void Clear() | |||
{ | |||
lines.Clear(); | |||
silos.Clear(); | |||
cvMain.Children.Clear(); | |||
} | |||
private void newSilo(string caption, string index, double left = -1, double top = -1) | |||
{ | |||
Silo silo = new Silo() { Caption = caption, Index = index }; | |||
if (left == -1) | |||
silo.SetValue(Canvas.LeftProperty, cvMain.ActualWidth / 2 - silo.Width / 2); | |||
else | |||
silo.SetValue(Canvas.LeftProperty, left); | |||
if (top == -1) | |||
silo.SetValue(Canvas.TopProperty, cvMain.ActualHeight / 2 - silo.Height / 2); | |||
else | |||
silo.SetValue(Canvas.TopProperty, top); | |||
silo.AllowDrop = true; | |||
cvMain.Children.Add(silo); | |||
silos.Add(silo); | |||
silo.PreviewMouseLeftButtonDown += Silo_PreviewMouseLeftButtonDown; | |||
silo.PreviewMouseMove += Silo_PreviewMouseMove; | |||
silo.PreviewMouseLeftButtonUp += Silo_PreviewMouseLeftButtonUp; | |||
CurrentSilo = silo; | |||
} | |||
private void newLine(double x1, double y1, double x2, double y2) | |||
{ | |||
var temp = new Line(); | |||
temp.Stroke = Brushes.Green; | |||
temp.StrokeThickness = 1; | |||
temp.X1 = x1; | |||
temp.Y1 = y1; | |||
temp.X2 = x2; | |||
temp.Y2 = y2; | |||
cvMain.Children.Add(temp); | |||
lines.Add(temp); | |||
currentLine = temp; | |||
} | |||
private void CvMain_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) | |||
{ | |||
lineIsDraw = false; | |||
Tips = "常规模式"; | |||
} | |||
private void CvMain_PreviewMouseMove(object sender, MouseEventArgs e) | |||
{ | |||
if (e.LeftButton == MouseButtonState.Pressed && lineIsDraw) | |||
{ | |||
Point point = e.GetPosition(cvMain); | |||
currentLine.X2 = point.X; | |||
currentLine.Y2 = point.Y; | |||
} | |||
} | |||
private void CvMain_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
if (!lineIsDraw) | |||
return; | |||
var point = e.GetPosition(cvMain); | |||
newLine(point.X, point.Y, point.X, point.Y); | |||
} | |||
private void Silo_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) | |||
{ | |||
var c = sender as UIElement; | |||
siloIsMouseDown = false; | |||
c.ReleaseMouseCapture(); | |||
CurrentSilo = sender as Silo; | |||
} | |||
private void Silo_PreviewMouseMove(object sender, MouseEventArgs e) | |||
{ | |||
if (siloIsMouseDown) | |||
{ | |||
var c = sender as UIElement; | |||
var pos = e.GetPosition(this); | |||
c.SetValue(Canvas.LeftProperty, pos.X); | |||
c.SetValue(Canvas.TopProperty, pos.Y); | |||
} | |||
} | |||
private void Silo_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
var c = sender as UIElement; | |||
siloIsMouseDown = true; | |||
var transform = c.RenderTransform as TranslateTransform; | |||
if (transform == null) | |||
{ | |||
transform = new TranslateTransform(); | |||
c.RenderTransform = transform; | |||
} | |||
c.CaptureMouse(); | |||
} | |||
} | |||
} |
@@ -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> | |||
<None Remove="device.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="device.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
</ItemGroup> | |||
</Project> |