@@ -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; | |||
@@ -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> | |||
@@ -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); | |||
@@ -44,7 +45,7 @@ namespace FryPot_DosingSystem | |||
} | |||
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() | |||
@@ -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空桶上料位置 | |||
@@ -272,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相关变量 | |||
@@ -344,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相关变量 | |||
@@ -417,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相关变量 | |||
@@ -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>(); | |||
} | |||
} |
@@ -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 = 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(); | |||
} | |||
} | |||
} |
@@ -13,69 +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&&res.FlowProcess.fpModels.Count==res.materialCollection.Count+1) //编辑已有工艺 | |||
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) | |||
{ | |||
if (name.FlowProcess.fpModels.Count > 0) | |||
{ | |||
name.FlowProcess.fpModels.Clear(); | |||
} | |||
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) => | |||
{ | |||