@@ -12,19 +12,22 @@ namespace BPASmart.Model | |||
public static AddressConvert GetInstance => _Instance ?? (_Instance = new AddressConvert()); | |||
private AddressConvert() { } | |||
public string PlcConverter(ICommunicationDevice device, string Address) | |||
public PlcConvertModel PlcConverter(ICommunicationDevice device, string Address) | |||
{ | |||
string address = string.Empty; | |||
//if (Address != null && int.TryParse(Address, out int result)) return result; | |||
PlcConvertModel plcConvertModel = new PlcConvertModel(); | |||
if (device != null && Address != null && Address.Length > 0) | |||
{ | |||
switch (device) | |||
{ | |||
case Invoance _tempInvoance: | |||
if (Address.ToUpper().Contains("LW") && Address.Length >= 3) | |||
if (Address.ToUpper().Contains("D") && Address.Length >= 3) | |||
{ | |||
var res = Address.Substring(2); | |||
if (res != null && int.TryParse(res, out int LwAddress)) return LwAddress.ToString(); | |||
if (res != null && int.TryParse(res, out int LwAddress)) | |||
{ | |||
plcConvertModel.Address = LwAddress.ToString(); | |||
plcConvertModel.DataType = EDataType.Word.ToString(); | |||
} | |||
} | |||
break; | |||
case kinco _tempKinco: | |||
@@ -37,7 +40,8 @@ namespace BPASmart.Model | |||
{ | |||
if (ExitAddress >= 0 && ExitAddress <= 7) | |||
{ | |||
return ((firstAddress * 8) + 320 + ExitAddress).ToString(); | |||
plcConvertModel.Address = ((firstAddress * 8) + 320 + ExitAddress).ToString(); | |||
plcConvertModel.DataType = EDataType.Bool.ToString(); | |||
} | |||
} | |||
} | |||
@@ -45,21 +49,29 @@ namespace BPASmart.Model | |||
else if ((Address.ToUpper().Contains("VW") || Address.ToUpper().Contains("VD")) && Address.Length >= 3) | |||
{ | |||
var res = Address.Substring(2); | |||
if (res != null && int.TryParse(res, out int tempAddress)) return ((tempAddress / 2) + 100).ToString(); | |||
if (res != null && int.TryParse(res, out int tempAddress)) | |||
{ | |||
plcConvertModel.Address = ((tempAddress / 2) + 100).ToString(); | |||
plcConvertModel.DataType = Address.ToUpper().Contains("VW") ? EDataType.Word.ToString() : EDataType.Dword.ToString(); | |||
} | |||
} | |||
break; | |||
case KincoOneMachine _tempKincoOneMachine: | |||
if (Address.ToUpper().Contains("D") && Address.Length >= 2) | |||
if (Address.ToUpper().Contains("LW") && Address.Length >= 2) | |||
{ | |||
var res = Address.Substring(1); | |||
if (res != null && int.TryParse(res, out int LwAddress)) return LwAddress.ToString(); | |||
if (res != null && int.TryParse(res, out int LwAddress)) | |||
{ | |||
plcConvertModel.Address = LwAddress.ToString(); | |||
plcConvertModel.DataType = EDataType.Word.ToString(); | |||
} | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
return address; | |||
return plcConvertModel; | |||
} | |||
} | |||
@@ -17,6 +17,8 @@ namespace BPASmart.Model | |||
Word = 4, | |||
Dint = 5, | |||
Dword = 6, | |||
Float = 7 | |||
Float = 7, | |||
Double = 8, | |||
String = 9, | |||
} | |||
} |
@@ -0,0 +1,110 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public static class ExpandMethod | |||
{ | |||
/// <summary> | |||
/// 获取数据类型的大小 | |||
/// </summary> | |||
/// <param name="eDataType"></param> | |||
/// <returns></returns> | |||
public static ushort GetEDataSize(this EDataType eDataType) | |||
{ | |||
switch (eDataType) | |||
{ | |||
case EDataType.Bool: | |||
case EDataType.Byte: | |||
case EDataType.Int: | |||
case EDataType.Word: | |||
return 1; | |||
case EDataType.Dint: | |||
case EDataType.Dword: | |||
case EDataType.Float: | |||
return 2; | |||
case EDataType.Double: | |||
break; | |||
case EDataType.String: | |||
break; | |||
default: | |||
break; | |||
} | |||
return 1; | |||
} | |||
/// <summary> | |||
/// 获取Modbus Tcp 连续变量数据的组对象 | |||
/// </summary> | |||
/// <param name="variableInfos"></param> | |||
/// <param name="by"></param> | |||
/// <returns></returns> | |||
public static List<ReadDataModel> GetDataGroup(this IGrouping<string, VariableInfo> variableInfos, int by = 1) | |||
{ | |||
List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
List<int> RealAddresss = new List<int>(); | |||
variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); }); | |||
int count = 0; | |||
if (res != null) | |||
{ | |||
int address = RealAddresss.Min(); | |||
int startAddress = address; | |||
for (int i = 0; i < res.Count; i++) | |||
{ | |||
if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress)) | |||
{ | |||
if (TempAddress == address) | |||
{ | |||
count++; | |||
address += by; | |||
} | |||
else | |||
{ | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
count = 1; | |||
address = TempAddress + by; | |||
startAddress = TempAddress; | |||
} | |||
} | |||
} | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
} | |||
return ReturnValue; | |||
} | |||
public static Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels(this ObservableCollection<VariableInfo> varialeInfos) | |||
{ | |||
Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>(); | |||
varialeInfos.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar => | |||
{ | |||
if (tempVar.Key != null && tempVar.Key.Length > 0) | |||
{ | |||
EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key); | |||
switch (dataType) | |||
{ | |||
case EDataType.Bool: | |||
case EDataType.Byte: | |||
case EDataType.Int: | |||
case EDataType.Word: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, tempVar.GetDataGroup()); | |||
break; | |||
case EDataType.Dint: | |||
case EDataType.Dword: | |||
case EDataType.Float: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, tempVar.GetDataGroup(2)); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
}); | |||
return readDataModels; | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class GlobalVar | |||
{ | |||
public static ICommunicationDevice DeviceType { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class PlcConvertModel | |||
{ | |||
public string Address { get; set; } = string.Empty; | |||
public string DataType { get; set; } = string.Empty; | |||
} | |||
} |
@@ -8,11 +8,35 @@ namespace BPASmart.Model | |||
{ | |||
public class PublishModel | |||
{ | |||
public string DeviceName { get; set; } | |||
public string RealAddress { get; set; } | |||
public string Value { get; set; } | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
public string DeviceName { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 变量实际地址 | |||
/// </summary> | |||
public string RealAddress { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 变量名称 | |||
/// </summary> | |||
public string VarName { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 变量长度 | |||
/// </summary> | |||
public int Length { get; set; } = 1; | |||
/// <summary> | |||
/// 变量当前值 | |||
/// </summary> | |||
public string Value { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 变量数据类型 | |||
/// </summary> | |||
public EDataType DataType { get; set; } | |||
public int Sleep { get; set; } | |||
} | |||
} |
@@ -10,5 +10,6 @@ namespace BPASmart.Model | |||
{ | |||
public string VarName { get; set; } | |||
public string VarVaule { get; set; } | |||
public EDataType DataType { get; set; } | |||
} | |||
} |
@@ -17,13 +17,8 @@ namespace BPASmart.Model | |||
{ | |||
public class VariableInfo : AlarmSet | |||
{ | |||
private ICommunicationDevice DeviceType; | |||
public VariableInfo(params object[] s) | |||
{ | |||
if (s != null && s.Length >= 0) | |||
{ | |||
DeviceType = s[0] as ICommunicationDevice; | |||
} | |||
CancelCommand = new RelayCommand(() => { IsOpen = false; }); | |||
ConfirmCommand = new RelayCommand(() => { IsOpen = false; }); | |||
} | |||
@@ -56,8 +51,9 @@ namespace BPASmart.Model | |||
{ | |||
_mAddress = value; | |||
OnPropertyChanged(); | |||
string address = AddressConvert.GetInstance.PlcConverter(DeviceType, value); | |||
if (address.Length > 0) RealAddress = address; | |||
var address = AddressConvert.GetInstance.PlcConverter(GlobalVar.DeviceType, value); | |||
if (address.Address.Length > 0) RealAddress = address.Address; | |||
if (DataType.Length <= 0) DataType = address.DataType; | |||
} | |||
} | |||
private string _mAddress = string.Empty; | |||
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
{ | |||
public class LocalMaterails | |||
{ | |||
public ObservableCollection<RecipeMaterials> locaMaterails { get; set; } = new ObservableCollection<RecipeMaterials>(); | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
| |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
{ | |||
public class LocalRecipes | |||
{ | |||
public ObservableCollection<Recipes> locaRecipes { get; set; } = new ObservableCollection<Recipes>(); | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
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 BPASmart.Model.配方 | |||
{ | |||
public class Order:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 订单ID | |||
/// </summary> | |||
public string OrderId { get { return _orderId; } set { _orderId = value; OnPropertyChanged(); } } | |||
private string _orderId; | |||
/// <summary> | |||
/// 下单时间 | |||
/// </summary> | |||
public string OrderdateTime { get { return _orderDateTime; } set { _orderDateTime = value; OnPropertyChanged(); } } | |||
private string _orderDateTime; | |||
/// <summary> | |||
/// 订单完成时间 | |||
/// </summary> | |||
public string OrderCompeleteTime { get { return _orderCompeleteTime; } set { _orderCompeleteTime = value; OnPropertyChanged(); } } | |||
private string _orderCompeleteTime; | |||
/// <summary> | |||
/// 配方集合 | |||
/// </summary> | |||
public ObservableCollection<Recipes> Recipes { get; set; } = new ObservableCollection<Recipes>(); | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
{ | |||
public class RecipeMaterials:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料ID | |||
/// </summary> | |||
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } } | |||
private string _id; | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
public string Name { get { return _name; } set { _name = value;OnPropertyChanged(); } } | |||
private string _name; | |||
/// <summary> | |||
/// 物料种类 | |||
/// </summary> | |||
public MaterialType MaterialType { get { return _materialType; } set { _materialType = value; OnPropertyChanged(); } } | |||
private MaterialType _materialType; | |||
/// <summary> | |||
/// 物料重量 | |||
/// </summary> | |||
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | |||
private int _materialWeight; | |||
/// <summary> | |||
/// 原料位置 | |||
/// </summary> | |||
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value;OnPropertyChanged(); } } | |||
private string _materialPosion; | |||
} | |||
public enum MaterialType | |||
{ | |||
无 = 0, | |||
干料 = 1, | |||
湿料 = 2, | |||
粉体 = 3, | |||
膏体 = 4 | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
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 BPASmart.Model.配方 | |||
{ | |||
public class Recipes:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方ID | |||
/// </summary> | |||
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } } | |||
private string _id; | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string Name { get { return _name; } set { _name = value; OnPropertyChanged(); } } | |||
public string _name; | |||
/// <summary> | |||
/// 配方状态 | |||
/// </summary> | |||
public RecipeStates RecipeState { get { return _recipeState; } set { _recipeState = value; OnPropertyChanged(); } } | |||
public RecipeStates _recipeState; | |||
/// <summary> | |||
/// 配方单数 | |||
/// </summary> | |||
public int RecipeCount { get { return _recipeCount; } set { _recipeCount = value; OnPropertyChanged(); } } | |||
private int _recipeCount; | |||
/// <summary> | |||
/// 配方原料集合 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> recipeMaterials { get; set; } | |||
} | |||
public enum RecipeStates | |||
{ | |||
等待制作 = 0, | |||
制作中 = 1, | |||
制作完成 = 2 | |||
} | |||
} | |||
@@ -0,0 +1,275 @@ | |||
<Application x:Class="BPASmart.RecipeManagement.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ContextMenu}"> | |||
<Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0"> | |||
<Border.BorderBrush> | |||
<SolidColorBrush Color="#104E8B" /> | |||
</Border.BorderBrush> | |||
<ItemsPresenter/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type MenuItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type MenuItem}"> | |||
<Border Margin="0,5" MinWidth="80" CornerRadius="5"> | |||
<Border.Background> | |||
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" /> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
<MultiTrigger.ExitActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.ExitActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> | |||
<Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
Background="White" | |||
Opacity="0" /> | |||
<Path | |||
x:Name="Arrow" | |||
Grid.Column="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Data="M 0 0 6 6 12 0 Z" | |||
Fill="Black" | |||
Stretch="None"> | |||
<Path.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
Direction="90" | |||
Opacity="1" | |||
RenderingBias="Quality" | |||
ShadowDepth="0" | |||
Color="Transparent" /> | |||
</Path.Effect> | |||
</Path> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="Arrow" Property="RenderTransform"> | |||
<Setter.Value> | |||
<RotateTransform Angle="180" CenterX="6" CenterY="3" /> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style TargetType="{x:Type ComboBox}"> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Background" Value="White"/> | |||
<Setter Property="ItemContainerStyle"> | |||
<Setter.Value> | |||
<Style TargetType="ComboBoxItem"> | |||
<Setter Property="Height" Value="25" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBoxItem}"> | |||
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> | |||
<Border x:Name="_borderbg" Background="White" /> | |||
<TextBlock | |||
x:Name="_txt" | |||
Margin="5,0,3,0" | |||
FontWeight="Black" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
<Border | |||
x:Name="_border" | |||
Background="White" | |||
Opacity="0" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsSelected" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="true" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="_borderbg" Property="Background" Value="#AFEEEE" /> | |||
<Setter TargetName="_txt" Property="Foreground" Value="black" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.3*" MaxWidth="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
x:Name="_prybr" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="0" /> | |||
<ContentPresenter | |||
x:Name="ContentSite" | |||
Margin="3,3,0,3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
IsHitTestVisible="False" /> | |||
<!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen --> | |||
<ToggleButton | |||
x:Name="ToggleButton" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Template="{StaticResource ComboBoxToggleButton}" /> | |||
<!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 --> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="2,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="White" | |||
BorderThickness="0" | |||
CaretBrush="{TemplateBinding Foreground}" | |||
Focusable="True" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsReadOnly="{TemplateBinding IsReadOnly}" | |||
Visibility="Hidden" /> | |||
<!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen --> | |||
<Popup | |||
x:Name="Popup" | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="Slide"> | |||
<Grid | |||
x:Name="DropDown" | |||
MinWidth="{TemplateBinding ActualWidth}" | |||
MaxHeight="150" | |||
SnapsToDevicePixels="True"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="Black" | |||
BorderThickness="0" /> | |||
<ScrollViewer | |||
Margin="1" | |||
CanContentScroll="True" | |||
HorizontalScrollBarVisibility="Auto" | |||
SnapsToDevicePixels="True" | |||
VerticalScrollBarVisibility="Auto"> | |||
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True --> | |||
<!-- 一下可以设置列表背景色 --> | |||
<StackPanel | |||
Background="White" | |||
IsItemsHost="True" | |||
KeyboardNavigation.DirectionalNavigation="Contained" /> | |||
</ScrollViewer> | |||
</Grid> | |||
</Popup> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter TargetName="ContentSite" Property="Opacity" Value="0.6" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</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 BPASmart.RecipeManagement | |||
{ | |||
/// <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,51 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Compile Remove="新文件夹1\**" /> | |||
<EmbeddedResource Remove="新文件夹1\**" /> | |||
<None Remove="新文件夹1\**" /> | |||
<Page Remove="新文件夹1\**" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Remove="Image\AddGreen.png" /> | |||
<None Remove="Image\Delete.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="View\RecipesConfigure.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="View\RecipesConfigure.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Image\Delete.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Image\AddGreen.png" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,19 @@ | |||
using BPASmart.Model.配方; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.Globle | |||
{ | |||
public class GlobleData | |||
{ | |||
public static RecipeMaterials ChangeMaterail; | |||
public static Recipes ChangeRecipes; | |||
public static ObservableCollection<Order> orders { get; set; } = new ObservableCollection<Order>(); | |||
} | |||
} |
@@ -0,0 +1,107 @@ | |||
<Window x:Class="BPASmart.RecipeManagement.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:BPASmart.RecipeManagement" | |||
xmlns:view="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="900" Width="1400" WindowStyle="None" WindowStartupLocation="CenterScreen"> | |||
<Window.DataContext> | |||
<vm:MainWindowViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="RadioNavigation" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="-4,10"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="GroupName" Value="Navigation"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" Value="#1971B6"/> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="White"/> | |||
<Setter Property="BorderThickness" TargetName="_borderOver" Value="0,1"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ButtonNavigation" TargetType="Button"> | |||
<Setter Property="Height" Value="40"/> | |||
<Setter Property="Foreground" Value="White"/> | |||
<Setter Property="FontSize" Value="20"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" Value="#1971B6"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Border Background="Transparent"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="200"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="2"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="10"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="60"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel x:Name="mylistview" Background="#2196F3" Grid.RowSpan="2" | |||
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" | |||
MouseDown="mylistview_MouseDown" > | |||
<RadioButton Content="订单管理" Style="{DynamicResource RadioNavigation}" IsChecked="True" | |||
Click="NavButton_Click" Tag="OrderManager"/> | |||
<RadioButton Content="配方管理" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="RecipeManager"/> | |||
<RadioButton Content="原料管理" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="MaterialManager"/> | |||
<RadioButton Content="工艺参数" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="TechnologySetting"/> | |||
<RadioButton Content="权限分配" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="PowerManager"/> | |||
</StackPanel> | |||
<Border Background="#2196F3" Grid.Row="2"> | |||
<Button Content="退出" | |||
Style="{DynamicResource ButtonNavigation}" | |||
Click="Button_Click"> | |||
</Button> | |||
</Border> | |||
<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" > | |||
<view:PowerManager/> | |||
</ContentControl> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,58 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
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 BPASmart.RecipeManagement | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void mylistview_MouseDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void NavButton_Click(object sender, RoutedEventArgs e) | |||
{ | |||
try | |||
{ | |||
if (sender is RadioButton bt) | |||
{ | |||
Type type = Type.GetType($"BPASmart.RecipeManagement.View.{bt.Tag?.ToString()}"); | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
contentRegion.Content = (FrameworkElement)cti.Invoke(null); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,112 @@ | |||
<Window x:Class="BPASmart.RecipeManagement.View.CreateOrder" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="CreateOrder" Height="250" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown"> | |||
<Window.DataContext> | |||
<vm:CreateOrderViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
</Grid.RowDefinitions> | |||
<Button Content="增加配方" Width="100" Height="30" HorizontalAlignment="Right" Margin="10,0" | |||
Background="#58B0ED" Foreground="White" Command="{Binding AddRecipeCommand}"/> | |||
<Border Grid.Row="1" BorderBrush="#B0E2FF" BorderThickness="0,1"> | |||
<ItemsControl ItemsSource="{Binding recipes}" Grid.Row="1" HorizontalAlignment="Center"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150"/> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="60" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="Black" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="Black" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.recipesName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedItem="{Binding Name}" | |||
/> | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Name="tb" | |||
Grid.Column="1" | |||
Width="60" | |||
Height="29" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RecipeCount}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,8,4" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="单" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Column="2" | |||
Width="50" | |||
Height="24" | |||
Foreground="White" | |||
FontSize="14" | |||
Background="#58B0ED" | |||
Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" | |||
CommandParameter="{Binding ID}" | |||
Content="删 除" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Border> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="30" Margin="10,2" Background="#58B0ED" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="30" Margin="10,2" Background="#58B0ED" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,37 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// CreateOrder.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class CreateOrder : Window | |||
{ | |||
public CreateOrder() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
<Window x:Class="BPASmart.RecipeManagement.View.MaterialConfigure" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="MaterialConfigure" Height="300" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown"> | |||
<Window.DataContext> | |||
<vm:MaterialConfigureViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
</Window.Resources> | |||
<Border CornerRadius="20" Background="White"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="17*"/> | |||
<ColumnDefinition Width="33*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料名称:" FontSize="22" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBlock Text="原料种类:" FontSize="22" Grid.Row="1" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBlock Text="原料位置:" FontSize="22" Grid.Row="2" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" | |||
VerticalContentAlignment="Center"/> | |||
<ComboBox ItemsSource="{Binding MaterialTypes}" | |||
FontSize="18" | |||
Grid.Column="1" Grid.Row="1" Width="200" Height="40" | |||
SelectedItem="{Binding MaterialType}"/> | |||
<TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2" | |||
Width="100" Height="40" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" | |||
VerticalContentAlignment="Center"/> | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2" | |||
Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,39 @@ | |||
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 BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// MaterialConfigure.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MaterialConfigure : Window | |||
{ | |||
public MaterialConfigure() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,185 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.MaterialManager" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800" > | |||
<UserControl.DataContext> | |||
<vm:MaterialManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style TargetType="ListViewItem" > | |||
<Setter Property="Margin" Value="60,20"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10"> | |||
<Grid Width="100" > | |||
<Grid.Background> | |||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> | |||
<GradientStop Color="#4F94CD" Offset="0"/> | |||
<GradientStop Color="Transparent" Offset="0.3"/> | |||
<GradientStop Color="Transparent" Offset="0.7"/> | |||
<GradientStop Color="#4F94CD" Offset="1" /> | |||
</LinearGradientBrush> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="25"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="{Binding MaterialPosion}" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/> | |||
<TextBlock Text="{Binding Name}" Grid.ColumnSpan="2" | |||
FontSize="24" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Grid.Row="1" Text="种类:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/> | |||
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="16" | |||
VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Text="{Binding MaterialType}" TextAlignment="Center"></TextBlock> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ContextMenu}"> | |||
<Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0"> | |||
<Border.BorderBrush> | |||
<SolidColorBrush Color="#104E8B" /> | |||
</Border.BorderBrush> | |||
<ItemsPresenter/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type MenuItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type MenuItem}"> | |||
<Border Margin="0,5" MinWidth="80" CornerRadius="5"> | |||
<Border.Background> | |||
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" /> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
<MultiTrigger.ExitActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.ExitActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Background="White"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.RowSpan="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料清单" FontSize="28" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<ListView x:Name="mylistview" Grid.Row="1" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 10" Background="#FFFAFA" > | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Header="新建原料" Name="MenuAdd" Command="{Binding CreateMaterailCommand}"></MenuItem> | |||
<MenuItem Header="编辑原料" Name="MenuEdit" | |||
Command="{Binding EditMaterailCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
<MenuItem Header="删除原料" Name="MenuDelete" | |||
Command="{Binding DeleteMaterailCommand}" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,33 @@ | |||
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 BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// MaterialManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MaterialManager : UserControl | |||
{ | |||
public MaterialManager() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,179 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.OrderManager" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm ="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:OrderManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style TargetType="ListBoxItem"> | |||
<Setter Property="Margin" Value="2"/> | |||
<Setter Property="FontSize" Value="22"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListBoxItem"> | |||
<Border BorderBrush="Black" BorderThickness="1"> | |||
<Grid HorizontalAlignment="Center" Margin="10 "> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="配方:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="数量:" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="已完成:" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="{Binding Name}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="{Binding RecipeCount}" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="" /> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="ListViewItem" > | |||
<Setter Property="Margin" Value="10"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="3,3,3,10" CornerRadius="10" Margin="10" | |||
Background="White"> | |||
<Border.Effect> | |||
<DropShadowEffect Color="#696969" Direction="215" ShadowDepth="10" Opacity="0.8"/> | |||
</Border.Effect> | |||
<Grid | |||
Name="tt" | |||
Height="250" | |||
Width="300" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="*" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="Black" | |||
Text="下单时间: " /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="Black" | |||
Text="{Binding OrderdateTime}" /> | |||
</StackPanel> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
Margin="20,10" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Auto"> | |||
<ListBox ItemsSource="{Binding Recipes}" FontFamily="楷体"> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="执行订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" | |||
Background="#58B0ED" Foreground="White" | |||
Command="{Binding }" | |||
/> | |||
<Button Content="删除订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" | |||
Background="#58B0ED" Foreground="White" | |||
Command="{Binding }" | |||
CommandParameter="{Binding}"/> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Button Content="创建订单" Width="100" Height="30" HorizontalAlignment="Right" Margin="10,0" | |||
Background="#58B0ED" Foreground="White" Command="{Binding CreateOrderCommand}"/> | |||
<ListView Grid.Row="1" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding orders}" Background="#FFFAFA" > | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,30 @@ | |||
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 BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// OrderManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class OrderManager : UserControl | |||
{ | |||
public OrderManager() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,361 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.PowerManager" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:PowerManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
<ImageBrush x:Key="ImageBrushAddGray" ImageSource="../Image/Delete.png"></ImageBrush> | |||
<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||
<Border Background="Transparent" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0"> | |||
<ContentPresenter /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsSelected" Value="true"> | |||
<Setter TargetName="IconBorder" Property="BitmapEffect"> | |||
<Setter.Value> | |||
<OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||
<Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}"> | |||
<Grid> | |||
<Border CornerRadius="2" Width="0.5" Background="#FF046BFF" /> | |||
<Track x:Name="PART_Track" IsDirectionReversed="true"> | |||
<Track.DecreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" /> | |||
</Track.DecreaseRepeatButton> | |||
<Track.Thumb> | |||
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb> | |||
</Track.Thumb> | |||
<Track.IncreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" /> | |||
</Track.IncreaseRepeatButton> | |||
</Track> | |||
</Grid> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}"> | |||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="Auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="Auto"/> | |||
</Grid.RowDefinitions> | |||
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/> | |||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> | |||
<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" | |||
Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" | |||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" | |||
Template="{StaticResource VerticalScrollBar}"/> | |||
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/> | |||
</Grid> | |||
</ControlTemplate> | |||
</UserControl.Resources> | |||
<Grid Margin="0,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="20"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="选择用户" FontSize="22" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0"/> | |||
<ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserName }" FontSize="16"/> | |||
<Button Foreground="White" Background="#009DFF" Margin="20,0" | |||
FontSize="18" Height="30" Width="120" | |||
Command="{Binding SaveCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="保存" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料权限" FontSize="22" Foreground="DarkSlateGray" VerticalAlignment="Bottom" HorizontalAlignment="Center" /> | |||
<TextBlock Grid.Column="1" Text="配方权限" FontSize="22" Foreground="DarkSlateGray" VerticalAlignment="Bottom" HorizontalAlignment="Center" /> | |||
</Grid> | |||
<Grid Grid.Row="3" Margin="5,10,5,50"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="70"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="20"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="70"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<!--#region原料权限--> | |||
<Border Grid.Column="0" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<Border Grid.Column="2" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<ScrollViewer Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" | |||
Width="auto"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding AllMaterials}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="Black" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.AddMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
Command="{Binding AddAllCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
Command="{Binding DeleteAllCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<ScrollViewer Grid.Column="2" Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto" | |||
ItemsSource="{Binding UserMaterials}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="Black" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
<!--#region 配方权限--> | |||
<Border Grid.Column="4" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<Border Grid.Column="6" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<ScrollViewer Grid.Column="4" Width="auto" Margin="5,5,5,5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" > | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding AllRecipes}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="Black" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.AddRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
Command="{Binding AddAllCommand}" CommandParameter="Recipes"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
Command="{Binding DeleteAllCommand}" CommandParameter="Recipes"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<ScrollViewer Grid.Column="6" Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
Width="auto" | |||
ItemsSource="{Binding UserRecipes}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="Black" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// PowerManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class PowerManager : UserControl | |||
{ | |||
public PowerManager() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,158 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.RecipeManager" | |||
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:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:RecipeManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style TargetType="ListViewItem" > | |||
<Setter Property="Margin" Value="10"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10" Margin="10" | |||
Background="Transparent"> | |||
<Grid | |||
Name="tt" | |||
Height="200" | |||
Width="150" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="Black" | |||
Text="{Binding Name}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="Black" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding recipeMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding Name}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" | |||
VerticalAlignment="Center" | |||
VerticalContentAlignment="Center" ItemsSource="{Binding recipeMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#FF2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding MaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="配方清单" FontSize="28" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<ListView Grid.Row="1" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding RecipeList}" Margin=" 10" Background="#FFFAFA" > | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Header="新建配方" Name="MenuAdd" Command="{Binding CreateRecipeCommand}"></MenuItem> | |||
<MenuItem Header="编辑配方" Name="MenuEdit" | |||
Command="{Binding EditRecipeCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
<MenuItem Header="删除配方" Name="MenuDelete" | |||
Command="{Binding DeleteRecipeCommand}" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</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 BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// RecipeManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeManager : UserControl | |||
{ | |||
public RecipeManager() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,273 @@ | |||
<Window x:Class="BPASmartClient.RecipeManagement.View.RecipesConfigure" | |||
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.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="RecipesConfigure" Height="600" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown"> | |||
<Window.DataContext> | |||
<vm:RecipesConfigureViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="ItemContainerStyle"> | |||
<Setter.Value> | |||
<Style TargetType="ComboBoxItem"> | |||
<Setter Property="Height" Value="25" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBoxItem}"> | |||
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> | |||
<Border x:Name="_borderbg" Background="White" /> | |||
<TextBlock | |||
x:Name="_txt" | |||
Margin="5,0,3,0" | |||
FontWeight="Black" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Foreground="Black" | |||
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
<Border | |||
x:Name="_border" | |||
Background="White" | |||
Opacity="0" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsSelected" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="true" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="_borderbg" Property="Background" Value="#AFEEEE" /> | |||
<Setter TargetName="_txt" Property="Foreground" Value="black" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.3*" MaxWidth="30" /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
x:Name="_prybr" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
CornerRadius="0" /> | |||
<ContentPresenter | |||
x:Name="ContentSite" | |||
Margin="3,3,0,3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
IsHitTestVisible="False" /> | |||
<!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen --> | |||
<ToggleButton | |||
x:Name="ToggleButton" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Template="{StaticResource ComboBoxToggleButton}" /> | |||
<!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 --> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="2,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
CaretBrush="{TemplateBinding Foreground}" | |||
Focusable="True" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsReadOnly="{TemplateBinding IsReadOnly}" | |||
Visibility="Hidden" /> | |||
<!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen --> | |||
<Popup | |||
x:Name="Popup" | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="Slide"> | |||
<Grid | |||
x:Name="DropDown" | |||
MinWidth="{TemplateBinding ActualWidth}" | |||
MaxHeight="150" | |||
SnapsToDevicePixels="True"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="Black" | |||
BorderThickness="0" /> | |||
<ScrollViewer | |||
Margin="1" | |||
CanContentScroll="True" | |||
HorizontalScrollBarVisibility="Auto" | |||
SnapsToDevicePixels="True" | |||
VerticalScrollBarVisibility="Auto"> | |||
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True --> | |||
<!-- 一下可以设置列表背景色 --> | |||
<StackPanel | |||
Background="White" | |||
IsItemsHost="True" | |||
KeyboardNavigation.DirectionalNavigation="Contained" /> | |||
</ScrollViewer> | |||
</Grid> | |||
</Popup> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter TargetName="ContentSite" Property="Opacity" Value="0.6" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition /> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition Height="60"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="103*" /> | |||
<ColumnDefinition Width="147*" /> | |||
<ColumnDefinition Width="100*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="配方名称:" FontSize="22" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBox Text="{Binding RecipeName}" FontSize="20" Grid.Column="1" Width="160" Height="36" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" | |||
VerticalContentAlignment="Center"/> | |||
<Button Grid.Column="2" | |||
Content="添加原料" | |||
Foreground="White" FontSize="16" Width="90" Height="30" Margin="10" Background="#58B0ED" | |||
Command="{Binding AddMaterailsCommand}"/> | |||
<ScrollViewer Grid.ColumnSpan="3" | |||
Grid.Row="1" | |||
Margin="15,10" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Auto"> | |||
<ItemsControl ItemsSource="{Binding recipeMaterials}" > | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="Black" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="Black" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.materialsName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
Style="{StaticResource ComboBoxStyle}" | |||
SelectedItem="{Binding Name}" | |||
/> | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Name="tb" | |||
Grid.Column="1" | |||
Width="100" | |||
Height="29" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding MaterialWeight}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,8,4" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="g" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Column="2" | |||
Width="70" | |||
Height="28" | |||
Margin="25,0,0,0" | |||
Foreground="White" | |||
FontSize="16" | |||
Background="#58B0ED" | |||
Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" | |||
CommandParameter="{Binding ID}" | |||
Content="删 除" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="2" Grid.ColumnSpan="3" | |||
Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,37 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// RecipesConfigure.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipesConfigure : Window | |||
{ | |||
public RecipesConfigure() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.TechnologySetting" | |||
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:BPASmart.RecipeManagement.View" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// TechnologySetting.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class TechnologySetting : UserControl | |||
{ | |||
public TechnologySetting() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,62 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class CreateOrderViewModel: ObservableObject | |||
{ | |||
public ObservableCollection<Recipes> recipes { get; set; } = new ObservableCollection<Recipes>(); | |||
public ObservableCollection<string> recipesName { get; set; } = new ObservableCollection<string>(); | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand<object> DeleteCommand { get; set; } | |||
public RelayCommand AddRecipeCommand { get; set; } | |||
private void Delete(object o) | |||
{ | |||
if(o == null) return; | |||
if(o is string id) | |||
{ | |||
var res = recipes.FirstOrDefault(x => x.ID == id); | |||
recipes.Remove(res); | |||
} | |||
} | |||
public CreateOrderViewModel() | |||
{ | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
Globle.GlobleData.orders.Add(new Order | |||
{ | |||
OrderId = Guid.NewGuid().ToString(), | |||
OrderdateTime = DateTime.Now.ToString(), | |||
Recipes = recipes | |||
}); | |||
}); | |||
DeleteCommand = new RelayCommand<object>(Delete); | |||
AddRecipeCommand = new RelayCommand(() => | |||
{ | |||
recipes.Add(new Recipes() { ID = Guid.NewGuid().ToString() }); | |||
}); | |||
foreach( var item in Json<LocalRecipes>.Data.locaRecipes ) | |||
{ | |||
recipesName.Add(item.Name); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MainWindowViewModel: ObservableObject | |||
{ | |||
public MainWindowViewModel() | |||
{ | |||
Json<LocalMaterails>.Read(); | |||
Json<LocalRecipes>.Read(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,106 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.RecipeManagement.Globle; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MaterialConfigureViewModel:ObservableObject | |||
{ | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName; | |||
public ObservableCollection<MaterialType> MaterialTypes { get; set; } = new ObservableCollection<MaterialType>(); | |||
public MaterialType MaterialType { get{ return _materialType; } set { _materialType = value; OnPropertyChanged(); } } | |||
private MaterialType _materialType = 0; | |||
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value; OnPropertyChanged(); } } | |||
private string _materialPosion; | |||
public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } } | |||
private string _errorMessage; | |||
public RelayCommand SaveCommand { get; set; } | |||
public MaterialConfigureViewModel() | |||
{ | |||
if(GlobleData.ChangeMaterail != null) | |||
{ | |||
MaterialName = GlobleData.ChangeMaterail.Name; | |||
MaterialType = GlobleData.ChangeMaterail.MaterialType; | |||
MaterialPosion = GlobleData.ChangeMaterail.MaterialPosion; | |||
} | |||
foreach(MaterialType item in Enum.GetValues(typeof(MaterialType))) | |||
{ | |||
MaterialTypes.Add(item); | |||
} | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(MaterialName == null) | |||
{ | |||
ErrorMessage = "原料名称不能为空"; | |||
return; | |||
} | |||
if(GlobleData.ChangeMaterail!=null)//编辑原料 | |||
{ | |||
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p=>p.ID == GlobleData.ChangeMaterail.ID); | |||
if (res != null) | |||
{ | |||
res.Name = MaterialName; | |||
res.MaterialType = MaterialType; | |||
res.MaterialPosion = MaterialPosion; | |||
Json<LocalMaterails>.Save(); | |||
ErrorMessage = "保存成功"; | |||
} | |||
} | |||
else //添加新原料 | |||
{ | |||
if(Json<LocalMaterails>.Data.locaMaterails != null) | |||
{ | |||
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.Name == MaterialName); | |||
if (res != null) | |||
{ | |||
ErrorMessage = "原料名称已存在"; | |||
return; | |||
} | |||
Json<LocalMaterails>.Data.locaMaterails.Add(new RecipeMaterials | |||
{ | |||
ID = Guid.NewGuid().ToString(), | |||
Name = MaterialName, | |||
MaterialType = MaterialType, | |||
MaterialPosion = MaterialPosion | |||
}); | |||
Json<LocalMaterails>.Save(); | |||
ErrorMessage = "保存成功"; | |||
} | |||
else | |||
{ | |||
Json<LocalMaterails>.Data.locaMaterails.Add(new RecipeMaterials | |||
{ | |||
ID = Guid.NewGuid().ToString(), | |||
Name = MaterialName, | |||
MaterialType = MaterialType, | |||
MaterialPosion = MaterialPosion | |||
}); | |||
Json<LocalMaterails>.Save(); | |||
ErrorMessage = "保存成功"; | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
using System; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmart.Model.配方; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmart.RecipeManagement.View; | |||
using System.Windows.Controls; | |||
using BPASmart.RecipeManagement.Globle; | |||
using BPASmartClient.Helper; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MaterialManagerViewModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料集合 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> MaterialList { get; set; } = Json<LocalMaterails>.Data.locaMaterails; | |||
public RelayCommand CreateMaterailCommand { get; set; } | |||
public RelayCommand<object> EditMaterailCommand { get; set; } | |||
public RelayCommand<object> DeleteMaterailCommand { get; set; } | |||
private void EditMaterail(object o) | |||
{ | |||
if(o == null) return; | |||
if(o is int item) | |||
{ | |||
GlobleData.ChangeMaterail = new RecipeMaterials(); | |||
GlobleData.ChangeMaterail = MaterialList[item]; | |||
MaterialConfigure materialConfigure = new MaterialConfigure(); | |||
materialConfigure.ShowDialog(); | |||
} | |||
} | |||
private void DeleteMaterail(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is int item) | |||
{ | |||
MaterialList.RemoveAt(item); | |||
Json<LocalMaterails>.Save(); | |||
} | |||
} | |||
public MaterialManagerViewModel() | |||
{ | |||
CreateMaterailCommand = new RelayCommand(() => | |||
{ | |||
GlobleData.ChangeMaterail = null; | |||
MaterialConfigure materialConfigure = new MaterialConfigure(); | |||
materialConfigure.ShowDialog(); | |||
}); | |||
EditMaterailCommand = new RelayCommand<object>(EditMaterail); | |||
DeleteMaterailCommand = new RelayCommand<object>(DeleteMaterail); | |||
} | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.RecipeManagement.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class OrderManagerViewModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 订单集合 | |||
/// </summary> | |||
public ObservableCollection<Order> orders { get; set; } = Globle.GlobleData.orders; | |||
public RelayCommand CreateOrderCommand { get; set; } | |||
public OrderManagerViewModel() | |||
{ | |||
CreateOrderCommand = new RelayCommand(() => | |||
{ | |||
CreateOrder createOrder = new CreateOrder(); | |||
createOrder.ShowDialog(); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,150 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class PowerManagerViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<string> UserName { get; set; } = new ObservableCollection<string>(); | |||
/// <summary> | |||
/// 全部物料 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> AllMaterials { get; set; } = Json<LocalMaterails>.Data.locaMaterails; | |||
/// <summary> | |||
/// 用户权限物料 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> UserMaterials { get; set; } = new ObservableCollection<RecipeMaterials>(); | |||
/// <summary> | |||
/// 全部配方 | |||
/// </summary> | |||
public ObservableCollection<Recipes> AllRecipes { get; set; } = Json<LocalRecipes>.Data.locaRecipes; | |||
/// <summary> | |||
/// 用户权限配方 | |||
/// </summary> | |||
public ObservableCollection<Recipes> UserRecipes { get; set; } = new ObservableCollection<Recipes>(); | |||
public RelayCommand<object> DeleteAllCommand { get; set; } | |||
public RelayCommand<object> AddAllCommand { get; set; } | |||
public RelayCommand<object> AddMaterialCommand { get; set; } | |||
public RelayCommand<object> DeleteMaterialCommand { get; set; } | |||
public RelayCommand<object> AddRecipeCommand { get; set; } | |||
public RelayCommand<object> DeleteRecipeCommand { get; set; } | |||
private void DeleteAll(object o) | |||
{ | |||
if (o == null) return; | |||
if (o.ToString() == "Materials") | |||
{ | |||
UserMaterials.Clear(); | |||
} | |||
else if (o.ToString() == "Recipes") | |||
{ | |||
UserRecipes.Clear(); | |||
} | |||
} | |||
private void AddAll(object o) | |||
{ | |||
if (o == null) return; | |||
if (o.ToString() == "Materials") | |||
{ | |||
UserMaterials.Clear(); | |||
foreach (RecipeMaterials item in AllMaterials) | |||
{ | |||
UserMaterials.Add(item); | |||
} | |||
} | |||
else if (o.ToString() == "Recipes") | |||
{ | |||
UserRecipes.Clear(); | |||
foreach (Recipes item in AllRecipes) | |||
{ | |||
UserRecipes.Add(item); | |||
} | |||
} | |||
} | |||
private void AddMaterial(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = AllMaterials.FirstOrDefault(p => p.Name == materail); | |||
if (UserMaterials.FirstOrDefault(p => p.Name == res.Name) == null) | |||
{ | |||
UserMaterials.Add(res); | |||
} | |||
} | |||
} | |||
private void DeleteMaterial(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = UserMaterials.FirstOrDefault(p => p.Name == materail); | |||
UserMaterials.Remove(res); | |||
} | |||
} | |||
private void AddRecipe(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = AllRecipes.FirstOrDefault(p => p.Name == materail); | |||
if (UserRecipes.FirstOrDefault(p => p.Name == res.Name) == null) | |||
{ | |||
UserRecipes.Add(res); | |||
} | |||
} | |||
} | |||
private void DeleteRecipe(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string materail) | |||
{ | |||
var res = UserRecipes.FirstOrDefault(p => p.Name == materail); | |||
UserRecipes.Remove(res); | |||
} | |||
} | |||
public PowerManagerViewModel() | |||
{ | |||
DeleteAllCommand = new RelayCommand<object>(DeleteAll); | |||
AddAllCommand = new RelayCommand<object>(AddAll); | |||
AddMaterialCommand = new RelayCommand<object>(AddMaterial); | |||
DeleteMaterialCommand = new RelayCommand<object>(DeleteMaterial); | |||
AddRecipeCommand = new RelayCommand<object>(AddRecipe); | |||
DeleteRecipeCommand = new RelayCommand<object>(DeleteRecipe); | |||
UserName.Add("admin"); | |||
UserName.Add("员工1号"); | |||
UserName.Add("员工2号"); | |||
UserName.Add("员工3号"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,60 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.RecipeManagement.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class RecipeManagerViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<Recipes> RecipeList { get; set; } = Json<LocalRecipes>.Data.locaRecipes; | |||
public RelayCommand CreateRecipeCommand { get; set; } | |||
public RelayCommand<object> EditRecipeCommand { get; set; } | |||
public RelayCommand<object> DeleteRecipeCommand { get; set; } | |||
private void EditRecipe(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is int item && item >= 0) | |||
{ | |||
Globle.GlobleData.ChangeRecipes = new Recipes(); | |||
Globle.GlobleData.ChangeRecipes = RecipeList[item]; | |||
RecipesConfigure recipesConfigure = new RecipesConfigure(); | |||
recipesConfigure.ShowDialog(); | |||
} | |||
} | |||
private void DeleteRecipe(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is int i && i >= 0) | |||
{ | |||
RecipeList.RemoveAt(i); | |||
Json<LocalRecipes>.Save(); | |||
} | |||
} | |||
public RecipeManagerViewModel() | |||
{ | |||
CreateRecipeCommand = new RelayCommand(() => | |||
{ | |||
Globle.GlobleData.ChangeRecipes = null; | |||
RecipesConfigure recipesConfigure = new RecipesConfigure(); | |||
recipesConfigure.ShowDialog(); | |||
}); | |||
EditRecipeCommand = new RelayCommand<object>(EditRecipe); | |||
DeleteRecipeCommand = new RelayCommand<object>(DeleteRecipe); | |||
} | |||
} | |||
} |
@@ -0,0 +1,115 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class RecipesConfigureViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<RecipeMaterials> recipeMaterials { get; set; } = new ObservableCollection<RecipeMaterials>(); | |||
/// <summary> | |||
/// 原料名称集合 | |||
/// </summary> | |||
public ObservableCollection<string> materialsName { get; set; } = new ObservableCollection<string>(); | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _repiceName; } set { _repiceName = value; OnPropertyChanged(); } } | |||
private string _repiceName; | |||
public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } } | |||
private string _errorMessage; | |||
public RelayCommand AddMaterailsCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand<object> DeleteCommand { get; set; } | |||
private void Delete(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
{ | |||
var res = recipeMaterials.FirstOrDefault(p=>p.ID == id); | |||
if (res != null) recipeMaterials.Remove(res); | |||
} | |||
} | |||
public RecipesConfigureViewModel() | |||
{ | |||
AddMaterailsCommand = new RelayCommand(() => | |||
{ | |||
recipeMaterials.Add(new RecipeMaterials() | |||
{ | |||
ID = Guid.NewGuid().ToString() | |||
}); | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(RecipeName == null) | |||
{ | |||
ErrorMessage = "配方名称为空"; | |||
return; | |||
} | |||
if (Globle.GlobleData.ChangeRecipes!=null) | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == Globle.GlobleData.ChangeRecipes.ID); | |||
res.recipeMaterials = recipeMaterials; | |||
res.Name = RecipeName; | |||
} | |||
else | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.Name == RecipeName); | |||
if (res != null) | |||
{ | |||
ErrorMessage = "配方名称已存在"; | |||
return; | |||
} | |||
Json<LocalRecipes>.Data.locaRecipes.Add(new Recipes | |||
{ | |||
ID = Guid.NewGuid().ToString() , | |||
Name = RecipeName, | |||
recipeMaterials = recipeMaterials | |||
}); | |||
} | |||
Json<LocalRecipes>.Save(); | |||
}); | |||
DeleteCommand = new RelayCommand<object>(Delete); | |||
if (Json<LocalMaterails>.Data.locaMaterails.Count > 0) | |||
{ | |||
foreach (var materail in Json<LocalMaterails>.Data.locaMaterails) | |||
{ | |||
materialsName.Add(materail.Name); | |||
} | |||
} | |||
if(Globle.GlobleData.ChangeRecipes != null) | |||
{ | |||
RecipeName = Globle.GlobleData.ChangeRecipes.Name.ToString(); | |||
recipeMaterials = Globle.GlobleData.ChangeRecipes.recipeMaterials; | |||
} | |||
} | |||
} | |||
} |
@@ -4,11 +4,12 @@ | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.10" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.6" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.13" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.7" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -14,7 +14,6 @@ namespace BPASmart.Server | |||
public void Init() | |||
{ | |||
var tt = sizeof(bool); | |||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("通讯模块初始化"); | |||
RedisHelper.GetInstance.ConnectAsync(); | |||
MqttInit(); | |||
@@ -35,48 +34,83 @@ namespace BPASmart.Server | |||
CommunicationDevices.TryAdd(item.DeviceName, modbusTcpMaster); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetReadDataModels(item).ToList()?.ForEach(temp => | |||
{ | |||
switch (temp.Key) | |||
{ | |||
case EDataType.Bool: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadBool(value.StartAddress.ToString(), value.Length); | |||
SetValue(res.Content, item.DeviceName, value, 1); | |||
}); | |||
break; | |||
case EDataType.Byte: | |||
break; | |||
case EDataType.Int: | |||
break; | |||
case EDataType.Word: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadUshort(value.StartAddress.ToString(), value.Length); | |||
SetValue(res.Content, item.DeviceName, value, 1); | |||
}); | |||
break; | |||
case EDataType.Dint: | |||
break; | |||
case EDataType.Dword: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadUint(value.StartAddress.ToString(), value.Length); | |||
SetValue(res.Content, item.DeviceName, value, 2); | |||
}); | |||
break; | |||
case EDataType.Float: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadFloat(value.StartAddress.ToString(), value.Length); | |||
SetValue(res.Content, item.DeviceName, value, 2); | |||
}); | |||
break; | |||
default: | |||
break; | |||
} | |||
}); | |||
item.VarTableModels.GetReadDataModels().ToList()?.ForEach(temp => | |||
{ | |||
//switch (temp.Key) | |||
//{ | |||
// case EDataType.Bool: | |||
// temp.Value?.ForEach(value => | |||
// { | |||
// //var res = modbusTcpMaster.ReadBool(value.StartAddress.ToString(), value.Length); | |||
// var res = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length); | |||
// SetValue(res.Content, item.DeviceName, value, 1); | |||
// }); | |||
// break; | |||
// case EDataType.Byte: | |||
// break; | |||
// case EDataType.Int: | |||
// break; | |||
// case EDataType.Word: | |||
// temp.Value?.ForEach(value => | |||
// { | |||
// //var res = modbusTcpMaster.ReadUshort(value.StartAddress.ToString(), value.Length); | |||
// var res = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length); | |||
// SetValue(res.Content, item.DeviceName, value, 1); | |||
// }); | |||
// break; | |||
// case EDataType.Dint: | |||
// break; | |||
// case EDataType.Dword: | |||
// temp.Value?.ForEach(value => | |||
// { | |||
// //var res = modbusTcpMaster.ReadUint(value.StartAddress.ToString(), value.Length); | |||
// var res = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length); | |||
// SetValue(res.Content, item.DeviceName, value, 2); | |||
// }); | |||
// break; | |||
// case EDataType.Float: | |||
// temp.Value?.ForEach(value => | |||
// { | |||
// //var res = modbusTcpMaster.ReadFloat(value.StartAddress.ToString(), value.Length); | |||
// var res = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length); | |||
// SetValue(res.Content, item.DeviceName, value, 2); | |||
// }); | |||
// break; | |||
// default: | |||
// break; | |||
//} | |||
Array ResultArray = null; | |||
temp.Value?.ForEach(value => | |||
{ | |||
switch (temp.Key) | |||
{ | |||
case EDataType.Bool: | |||
ResultArray = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Byte: | |||
break; | |||
case EDataType.Int: | |||
ResultArray = modbusTcpMaster.Read<short[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Word: | |||
ResultArray = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Dint: | |||
ResultArray = modbusTcpMaster.Read<int[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Dword: | |||
ResultArray = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Float: | |||
ResultArray = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
default: | |||
break; | |||
} | |||
SetValue(ResultArray, item.DeviceName, value, temp.Key); | |||
}); | |||
}); | |||
Thread.Sleep(100); | |||
}), $"{item.DeviceName} 设备数据采集"); | |||
@@ -128,42 +162,120 @@ namespace BPASmart.Server | |||
{ | |||
if (CommunicationDevices.ContainsKey(item.DeviceName)) | |||
{ | |||
switch (item.DataType) | |||
string address = string.Empty; | |||
if (item.RealAddress != null && item.RealAddress.Length > 0) address = item.DeviceName; | |||
else | |||
{ | |||
case EDataType.Bool: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToBoolean(item.Value)); | |||
break; | |||
case EDataType.Byte: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToByte(item.Value)); | |||
break; | |||
case EDataType.Int: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToInt16(item.Value)); | |||
break; | |||
case EDataType.Word: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToUInt16(item.Value)); | |||
break; | |||
case EDataType.Dint: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToInt32(item.Value)); | |||
break; | |||
case EDataType.Dword: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToUInt32(item.Value)); | |||
break; | |||
case EDataType.Float: | |||
CommunicationDevices[item.DeviceName].Write(item.RealAddress, Convert.ToSingle(item.Value)); | |||
break; | |||
default: | |||
break; | |||
var res = Json<CommunicationPar>.Data.CommunicationDevices.FirstOrDefault(p => p.DeviceName == item.DeviceName); | |||
var res2 = res?.VarTableModels.FirstOrDefault(p => p.VarName?.Length > 0 && p.VarName == item.VarName); | |||
address = res2?.RealAddress; | |||
} | |||
if (item.Value != null && item.Value.Length > 0) | |||
{ | |||
switch (item.DataType) | |||
{ | |||
case EDataType.Bool: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToBoolean(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToBoolean(item.Value)); | |||
break; | |||
case EDataType.Byte: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToByte(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToByte(item.Value)); | |||
break; | |||
case EDataType.Int: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt16(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt16(item.Value)); | |||
break; | |||
case EDataType.Word: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt16(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt16(item.Value)); | |||
break; | |||
case EDataType.Dint: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt32(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt32(item.Value)); | |||
break; | |||
case EDataType.Dword: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt32(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt32(item.Value)); | |||
break; | |||
case EDataType.Float: | |||
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToSingle(item.Value)); | |||
CommunicationDevices[item.DeviceName].Write(address, Convert.ToSingle(item.Value)); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
} | |||
private void SetValue<TArray>(TArray[] arrays, string DeviceName, ReadDataModel readDataModel, ushort by) | |||
//private void SetValue<TArray>(TArray[] arrays, string DeviceName, ReadDataModel readDataModel, ushort by) | |||
//{ | |||
// if (arrays != null) | |||
// { | |||
// int index = Array.FindIndex(Json<CommunicationPar>.Data.CommunicationDevices.ToArray(), p => p.DeviceName == DeviceName);//获取设备所在集合位置 | |||
// if (index >= 0 && index < Json<CommunicationPar>.Data.CommunicationDevices.Count) | |||
// { | |||
// var tempArray = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ToArray(); | |||
// for (int i = 0; i < arrays.Length; i++) | |||
// { | |||
// int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
// if (varIndex >= 0 && varIndex < tempArray.Length) | |||
// { | |||
// Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); | |||
// } | |||
// } | |||
// var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName; | |||
// List<ReeisDataModel> reeisDataModels = new List<ReeisDataModel>(); | |||
// Json<CommunicationPar>.Data.CommunicationDevices[index].VarTableModels.ToList().ForEach(tempVar => | |||
// { | |||
// if (tempVar.VarName.Length > 0) | |||
// { | |||
// reeisDataModels.Add(new ReeisDataModel() | |||
// { | |||
// VarName = tempVar.VarName, | |||
// VarVaule = tempVar.CurrentValue, | |||
// DataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.DataType) | |||
// }); | |||
// } | |||
// }); | |||
// RedisHelper.GetInstance.SetValue($"{Devicename}", reeisDataModels); | |||
// } | |||
// } | |||
//} | |||
//private ushort GetBySize(EDataType eDataType) | |||
//{ | |||
// switch (eDataType) | |||
// { | |||
// case EDataType.Bool: | |||
// case EDataType.Byte: | |||
// case EDataType.Int: | |||
// case EDataType.Word: | |||
// return 1; | |||
// case EDataType.Dint: | |||
// case EDataType.Dword: | |||
// case EDataType.Float: | |||
// return 2; | |||
// case EDataType.Double: | |||
// break; | |||
// case EDataType.String: | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// return 1; | |||
//} | |||
private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType) | |||
{ | |||
if (arrays != null) | |||
{ | |||
ushort by = eDataType.GetEDataSize(); | |||
int index = Array.FindIndex(Json<CommunicationPar>.Data.CommunicationDevices.ToArray(), p => p.DeviceName == DeviceName);//获取设备所在集合位置 | |||
if (index >= 0 && index < Json<CommunicationPar>.Data.CommunicationDevices.Count) | |||
{ | |||
@@ -173,7 +285,7 @@ namespace BPASmart.Server | |||
int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
if (varIndex >= 0 && varIndex < tempArray.Length) | |||
{ | |||
Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); | |||
Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays.GetValue(i)?.ToString(); | |||
} | |||
} | |||
var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName; | |||
@@ -185,7 +297,8 @@ namespace BPASmart.Server | |||
reeisDataModels.Add(new ReeisDataModel() | |||
{ | |||
VarName = tempVar.VarName, | |||
VarVaule = tempVar.CurrentValue | |||
VarVaule = tempVar.CurrentValue, | |||
DataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.DataType) | |||
}); | |||
} | |||
}); | |||
@@ -194,70 +307,72 @@ namespace BPASmart.Server | |||
} | |||
} | |||
private Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels(CommunicationModel communicationModel) | |||
{ | |||
Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>(); | |||
communicationModel.VarTableModels.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar => | |||
{ | |||
if (tempVar.Key != null && tempVar.Key.Length > 0) | |||
{ | |||
//int address = tempVar.Min(p => p.RealAddress); | |||
EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key); | |||
switch (dataType) | |||
{ | |||
case EDataType.Bool: | |||
case EDataType.Byte: | |||
case EDataType.Int: | |||
case EDataType.Word: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar)); | |||
break; | |||
case EDataType.Dint: | |||
case EDataType.Dword: | |||
case EDataType.Float: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar, 2)); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
}); | |||
return readDataModels; | |||
} | |||
private List<ReadDataModel> GetDataGroup(IGrouping<string, VariableInfo> variableInfos, int by = 1) | |||
{ | |||
List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
List<int> RealAddresss = new List<int>(); | |||
variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); }); | |||
int count = 0; | |||
if (res != null) | |||
{ | |||
//int address = variableInfos.Min(p => p.RealAddress); | |||
int address = RealAddresss.Min(); | |||
int startAddress = address; | |||
for (int i = 0; i < res.Count; i++) | |||
{ | |||
if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress)) | |||
{ | |||
if (TempAddress == address) | |||
{ | |||
count++; | |||
address += by; | |||
} | |||
else | |||
{ | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
count = 1; | |||
address = TempAddress + by; | |||
startAddress = TempAddress; | |||
} | |||
} | |||
} | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
} | |||
return ReturnValue; | |||
} | |||
//private Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels(CommunicationModel communicationModel) | |||
//{ | |||
// Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>(); | |||
// communicationModel.VarTableModels.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar => | |||
// { | |||
// if (tempVar.Key != null && tempVar.Key.Length > 0) | |||
// { | |||
// //int address = tempVar.Min(p => p.RealAddress); | |||
// EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key); | |||
// switch (dataType) | |||
// { | |||
// case EDataType.Bool: | |||
// case EDataType.Byte: | |||
// case EDataType.Int: | |||
// case EDataType.Word: | |||
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar)); | |||
// break; | |||
// case EDataType.Dint: | |||
// case EDataType.Dword: | |||
// case EDataType.Float: | |||
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar, 2)); | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// } | |||
// }); | |||
// return readDataModels; | |||
//} | |||
//private List<ReadDataModel> GetDataGroup(IGrouping<string, VariableInfo> variableInfos, int by = 1) | |||
//{ | |||
// List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
// var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
// List<int> RealAddresss = new List<int>(); | |||
// variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); }); | |||
// int count = 0; | |||
// if (res != null) | |||
// { | |||
// //int address = variableInfos.Min(p => p.RealAddress); | |||
// int address = RealAddresss.Min(); | |||
// int startAddress = address; | |||
// for (int i = 0; i < res.Count; i++) | |||
// { | |||
// if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress)) | |||
// { | |||
// if (TempAddress == address) | |||
// { | |||
// count++; | |||
// address += by; | |||
// } | |||
// else | |||
// { | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
// count = 1; | |||
// address = TempAddress + by; | |||
// startAddress = TempAddress; | |||
// } | |||
// } | |||
// } | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
// } | |||
// return ReturnValue; | |||
//} | |||
} | |||
} |
@@ -112,6 +112,17 @@ namespace BPASmart.VariableManager | |||
private void DataSave() | |||
{ | |||
//for (int i = 0; i < Json<CommunicationPar>.Data.CommunicationDevices.Count; i++) | |||
//{ | |||
// for (int m = 0; m < Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.Count; m++) | |||
// { | |||
// var deviceType = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).CommDevice; | |||
// var deviceValue = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.ElementAt(m).Address; | |||
// string RealAddress = AddressConvert.GetInstance.PlcConverter(deviceType, deviceValue); | |||
// Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(i).VarTableModels.ElementAt(m).RealAddress = RealAddress; | |||
// } | |||
//} | |||
Json<CommunicationPar>.Save(); | |||
} | |||
@@ -29,7 +29,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.10" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.13" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -27,32 +27,33 @@ namespace BPASmart.VariableManager.ViewModels | |||
{ | |||
DataInit(o); | |||
VarNameChanged(); | |||
DelegationNotifi.GetInstance.VariableSave = new Action(() => { Json<CommunicationPar>.Save(); }); | |||
StartMotionCommand = new RelayCommand(() => | |||
{ | |||
switch (ButtonContext) | |||
{ | |||
case "开始监控": | |||
TabName = "当前值"; | |||
CurrentVisibility = Visibility.Visible; | |||
RemoveButVisiblity = Visibility.Collapsed; | |||
ButtonContext = "停止监控"; | |||
IsEnable = false; | |||
Motion(); | |||
break; | |||
case "停止监控": | |||
TabName = "操作"; | |||
CurrentVisibility = Visibility.Collapsed; | |||
RemoveButVisiblity = Visibility.Visible; | |||
ButtonContext = "开始监控"; | |||
IsEnable = true; | |||
ThreadManage.GetInstance().StopTask($"{DeviceType} 初始化连接"); | |||
ThreadManage.GetInstance().StopTask($"{DeviceType} 设备数据采集"); | |||
break; | |||
default: | |||
break; | |||
} | |||
}); | |||
{ | |||
switch (ButtonContext) | |||
{ | |||
case "开始监控": | |||
TabName = "当前值"; | |||
CurrentVisibility = Visibility.Visible; | |||
RemoveButVisiblity = Visibility.Collapsed; | |||
ButtonContext = "停止监控"; | |||
IsEnable = false; | |||
Motion(); | |||
break; | |||
case "停止监控": | |||
TabName = "操作"; | |||
CurrentVisibility = Visibility.Collapsed; | |||
RemoveButVisiblity = Visibility.Visible; | |||
ButtonContext = "开始监控"; | |||
IsEnable = true; | |||
ThreadManage.GetInstance().StopTask($"{DeviceType} 初始化连接"); | |||
ThreadManage.GetInstance().StopTask($"{DeviceType} 设备数据采集"); | |||
break; | |||
default: | |||
break; | |||
} | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
@@ -73,6 +74,7 @@ namespace BPASmart.VariableManager.ViewModels | |||
if (varialeInfosIndex >= 0 && varialeInfosIndex < Json<CommunicationPar>.Data.CommunicationDevices.Count) | |||
{ | |||
DeviceType = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(varialeInfosIndex).CommDevice; | |||
GlobalVar.DeviceType = DeviceType; | |||
varialeInfos = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(varialeInfosIndex).VarTableModels; | |||
if (varialeInfos.Count <= 0) AddRow(); | |||
} | |||
@@ -156,52 +158,42 @@ namespace BPASmart.VariableManager.ViewModels | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetReadDataModels().ToList()?.ForEach(temp => | |||
varialeInfos.GetReadDataModels().ToList()?.ForEach(temp => | |||
{ | |||
switch (temp.Key) | |||
Array ResultArray = null; | |||
temp.Value?.ForEach(value => | |||
{ | |||
case EDataType.Bool: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadCoils(value.StartAddress, value.Length); | |||
SetValue(res, value, 1); | |||
}); | |||
break; | |||
case EDataType.Byte: | |||
break; | |||
case EDataType.Int: | |||
break; | |||
case EDataType.Word: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadHoldingRegisters(value.StartAddress, value.Length); | |||
SetValue(res, value, 1); | |||
}); | |||
break; | |||
case EDataType.Dint: | |||
break; | |||
case EDataType.Dword: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadHoldingRegisters(value.StartAddress, value.Length); | |||
SetValue(res, value, 2); | |||
}); | |||
break; | |||
case EDataType.Float: | |||
temp.Value?.ForEach(value => | |||
{ | |||
var res = modbusTcpMaster.ReadHoldingRegisters(value.StartAddress, value.Length); | |||
SetValue(res, value, 2); | |||
}); | |||
break; | |||
default: | |||
break; | |||
} | |||
switch (temp.Key) | |||
{ | |||
case EDataType.Bool: | |||
ResultArray = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Byte: | |||
break; | |||
case EDataType.Int: | |||
ResultArray = modbusTcpMaster.Read<short[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Word: | |||
ResultArray = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Dint: | |||
ResultArray = modbusTcpMaster.Read<int[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Dword: | |||
ResultArray = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
case EDataType.Float: | |||
ResultArray = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length)?.Content; | |||
break; | |||
default: | |||
break; | |||
} | |||
SetValue(ResultArray, value, temp.Key); | |||
}); | |||
}); | |||
Thread.Sleep(100); | |||
}), $"{DeviceType} 设备数据采集"); | |||
//var DeviceModel = item; | |||
}); | |||
modbusTcpMaster.IsReconnect = true; | |||
modbusTcpMaster.ModbusTcpConnect(_modbusTcp.IP, _modbusTcp.PortNum); | |||
@@ -283,109 +275,131 @@ namespace BPASmart.VariableManager.ViewModels | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
#endregion | |||
private void SetValue<TArray>(TArray[] arrays, ReadDataModel readDataModel, ushort by) | |||
{ | |||
for (int i = 0; i < arrays.Length; i++) | |||
{ | |||
int varIndex = Array.FindIndex(varialeInfos.ToArray(), p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
if (varIndex >= 0 && varIndex < varialeInfos.Count) | |||
{ | |||
varialeInfos.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); | |||
} | |||
} | |||
} | |||
//private void SetValue<TArray>(TArray[] arrays, ReadDataModel readDataModel, ushort by) | |||
//{ | |||
// for (int i = 0; i < arrays.Length; i++) | |||
// { | |||
// int varIndex = Array.FindIndex(varialeInfos.ToArray(), p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
// if (varIndex >= 0 && varIndex < varialeInfos.Count) | |||
// { | |||
// varialeInfos.ElementAt(varIndex).CurrentValue = arrays[i].ToString(); | |||
// } | |||
// } | |||
private Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels() | |||
//} | |||
private void SetValue(Array arrays, ReadDataModel readDataModel, EDataType eDataType) | |||
{ | |||
Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>(); | |||
varialeInfos.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar => | |||
if (arrays != null) | |||
{ | |||
if (tempVar.Key != null && tempVar.Key.Length > 0) | |||
ushort by = eDataType.GetEDataSize(); | |||
for (int i = 0; i < arrays.Length; i++) | |||
{ | |||
//int address = tempVar.Min(p => p.RealAddress); | |||
EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key); | |||
switch (dataType) | |||
int varIndex = Array.FindIndex(varialeInfos.ToArray(), p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
if (varIndex >= 0 && varIndex < varialeInfos.Count) | |||
{ | |||
case EDataType.Bool: | |||
case EDataType.Byte: | |||
case EDataType.Int: | |||
case EDataType.Word: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar)); | |||
break; | |||
case EDataType.Dint: | |||
case EDataType.Dword: | |||
case EDataType.Float: | |||
if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar, 2)); | |||
break; | |||
default: | |||
break; | |||
varialeInfos.ElementAt(varIndex).CurrentValue = arrays.GetValue(i)?.ToString(); | |||
} | |||
} | |||
}); | |||
return readDataModels; | |||
} | |||
private List<ReadDataModel> GetDataGroup(IGrouping<string, VariableInfo> variableInfos, int by = 1) | |||
{ | |||
//List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
//var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
//int count = 0; | |||
//if (res != null) | |||
//{ | |||
// int address = variableInfos.Min(p => p.RealAddress); | |||
// int startAddress = address; | |||
// for (int i = 0; i < res.Count; i++) | |||
// { | |||
// if (res.ElementAt(i).RealAddress == address) | |||
// { | |||
// count++; | |||
// address += by; | |||
// } | |||
// else | |||
// { | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
// count = 1; | |||
// address = res.ElementAt(i).RealAddress + by; | |||
// startAddress = res.ElementAt(i).RealAddress; | |||
// } | |||
// } | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
//} | |||
//return ReturnValue; | |||
List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
List<int> RealAddresss = new List<int>(); | |||
variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); }); | |||
int count = 0; | |||
if (res != null) | |||
{ | |||
int address = RealAddresss.Min(); | |||
int startAddress = address; | |||
for (int i = 0; i < res.Count; i++) | |||
{ | |||
if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress)) | |||
{ | |||
if (TempAddress == address) | |||
{ | |||
count++; | |||
address += by; | |||
} | |||
else | |||
{ | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
count = 1; | |||
address = TempAddress + by; | |||
startAddress = TempAddress; | |||
} | |||
} | |||
} | |||
ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
//int index = Array.FindIndex(Json<CommunicationPar>.Data.CommunicationDevices.ToArray(), p => p.DeviceName == DeviceName);//获取设备所在集合位置 | |||
//if (index >= 0 && index < Json<CommunicationPar>.Data.CommunicationDevices.Count) | |||
//{ | |||
// var tempArray = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ToArray(); | |||
// for (int i = 0; i < arrays.Length; i++) | |||
// { | |||
// int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString()); | |||
// if (varIndex >= 0 && varIndex < tempArray.Length) | |||
// { | |||
// Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays.GetValue(i)?.ToString(); | |||
// } | |||
// } | |||
// var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName; | |||
// List<ReeisDataModel> reeisDataModels = new List<ReeisDataModel>(); | |||
// Json<CommunicationPar>.Data.CommunicationDevices[index].VarTableModels.ToList().ForEach(tempVar => | |||
// { | |||
// if (tempVar.VarName.Length > 0) | |||
// { | |||
// reeisDataModels.Add(new ReeisDataModel() | |||
// { | |||
// VarName = tempVar.VarName, | |||
// VarVaule = tempVar.CurrentValue, | |||
// DataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.DataType) | |||
// }); | |||
// } | |||
// }); | |||
// RedisHelper.GetInstance.SetValue($"{Devicename}", reeisDataModels); | |||
//} | |||
} | |||
return ReturnValue; | |||
} | |||
//private Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels() | |||
//{ | |||
// Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>(); | |||
// varialeInfos.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar => | |||
// { | |||
// if (tempVar.Key != null && tempVar.Key.Length > 0) | |||
// { | |||
// EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key); | |||
// switch (dataType) | |||
// { | |||
// case EDataType.Bool: | |||
// case EDataType.Byte: | |||
// case EDataType.Int: | |||
// case EDataType.Word: | |||
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar)); | |||
// break; | |||
// case EDataType.Dint: | |||
// case EDataType.Dword: | |||
// case EDataType.Float: | |||
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar, 2)); | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// } | |||
// }); | |||
// return readDataModels; | |||
//} | |||
//private List<ReadDataModel> GetDataGroup(IGrouping<string, VariableInfo> variableInfos, int by = 1) | |||
//{ | |||
// List<ReadDataModel> ReturnValue = new List<ReadDataModel>(); | |||
// var res = variableInfos?.OrderBy(p => p.RealAddress).ToList(); | |||
// List<int> RealAddresss = new List<int>(); | |||
// variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); }); | |||
// int count = 0; | |||
// if (res != null) | |||
// { | |||
// int address = RealAddresss.Min(); | |||
// int startAddress = address; | |||
// for (int i = 0; i < res.Count; i++) | |||
// { | |||
// if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress)) | |||
// { | |||
// if (TempAddress == address) | |||
// { | |||
// count++; | |||
// address += by; | |||
// } | |||
// else | |||
// { | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
// count = 1; | |||
// address = TempAddress + by; | |||
// startAddress = TempAddress; | |||
// } | |||
// } | |||
// } | |||
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count }); | |||
// } | |||
// return ReturnValue; | |||
//} | |||
/// <summary> | |||
@@ -248,7 +248,7 @@ | |||
<!--#endregion--> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer IsEnabled="{Binding IsEnable}" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding varialeInfos}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
@@ -272,11 +272,13 @@ | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Text="{Binding ID}" /> | |||
<Grid Grid.Column="1"> | |||
<Grid Grid.Column="1" KeyDown="TextBox_KeyDown"> | |||
<TextBox | |||
IsEnabled="{Binding DataContext.IsEnable, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
Width="{Binding DataContext.NameWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
TabIndex="{Binding ID}" | |||
Text="{Binding VarName}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
@@ -286,9 +288,12 @@ | |||
<TextBox | |||
Grid.Column="2" | |||
IsEnabled="{Binding DataContext.IsEnable, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
KeyDown="TextBox_KeyDown" | |||
Width="{Binding DataContext.AddressWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
TabIndex="{Binding ID}" | |||
Text="{Binding Address}" /> | |||
<Grid Grid.Column="3"> | |||
@@ -63,5 +63,19 @@ namespace BPASmart.VariableManager.Views | |||
} | |||
} | |||
private void TextBox_KeyDown(object sender, KeyEventArgs e) | |||
{ | |||
var uie = e.OriginalSource as TextBox; | |||
if (uie != null) | |||
{ | |||
if (e.Key == Key.Enter) | |||
{ | |||
uie.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); | |||
e.Handled = true; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -9,6 +9,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" /> | |||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" /> | |||
<PackageReference Include="MQTTnet" Version="3.1.2" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
<PackageReference Include="ServiceStack.Redis" Version="6.3.0" /> | |||
<PackageReference Include="StackExchange.Redis" Version="2.6.66" /> | |||
@@ -51,6 +51,7 @@ namespace BPASmartClient.Compiler | |||
_database = _connection.GetDatabase(0);//默认使用db0 | |||
subscibe = _connection.GetSubscriber(); | |||
} | |||
int dbi = 0; | |||
public void Connect(string connection) | |||
{ | |||
_connection = ConnectionMultiplexer.Connect(ConfigurationOptions.Parse(connection)); | |||
@@ -58,7 +59,7 @@ namespace BPASmartClient.Compiler | |||
{ | |||
string[] str=connection.Split(','); | |||
string stro = str.ToList().Find(s => s.Contains("defaultDatabase=")); | |||
int dbi = 0; | |||
try | |||
{ | |||
dbi=int.Parse(stro.Replace("defaultDatabase=","")); | |||
@@ -72,7 +73,7 @@ namespace BPASmartClient.Compiler | |||
} | |||
else | |||
{ | |||
_database = _connection.GetDatabase();//默认使用db0 | |||
_database = _connection.GetDatabase(dbi);//默认使用db0 | |||
} | |||
subscibe = _connection.GetSubscriber(); | |||
} | |||
@@ -89,7 +90,14 @@ namespace BPASmartClient.Compiler | |||
//获取指定服务器 | |||
var server = _connection.GetServer(endPoint); | |||
//在指定服务器上使用 keys 或者 scan 命令来遍历key | |||
foreach (var key in server.Keys(0,"设备列表:*")) | |||
//foreach (var key in server.Keys(0,"设备列表:*")) | |||
//{ | |||
// //获取key对于的值 | |||
// var val = _database.StringGet(key); | |||
// Console.WriteLine($"key: {key}, value: {val}"); | |||
// keys[key] = val; | |||
//} | |||
foreach (var key in server.Keys(dbi,"*")) | |||
{ | |||
//获取key对于的值 | |||
var val = _database.StringGet(key); | |||
@@ -0,0 +1,142 @@ | |||
using MQTTnet; | |||
using MQTTnet.Client; | |||
using MQTTnet.Client.Options; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Compiler | |||
{ | |||
public class MQTT | |||
{ | |||
//private volatile static MQTT _Instance; | |||
//public static MQTT GetInstance => _Instance ?? (_Instance = new MQTT()); | |||
//private MQTT() { } | |||
public IMqttClient client; | |||
IMqttClientOptions options; | |||
/// <summary> | |||
/// MQTT 接收消息 | |||
/// </summary> | |||
public Action<MqttApplicationMessageReceivedEventArgs> MqttReceive { get; set; } | |||
/// <summary> | |||
/// MQTT 连接成功 | |||
/// </summary> | |||
public Action ConnectOk { get; set; } | |||
/// <summary> | |||
/// 重连成功 | |||
/// </summary> | |||
public Action Reconnection { get; set; } | |||
public async void MqttInitAsync(string UserName,string pass,string IP,int port,string clientID) | |||
{ | |||
p1: | |||
options = new MqttClientOptionsBuilder().WithTcpServer(IP,port).WithClientId(clientID).WithCredentials(UserName,pass).Build(); | |||
client = new MqttFactory().CreateMqttClient(); | |||
client.UseDisconnectedHandler(async c => | |||
{ | |||
Thread.Sleep(2000); | |||
//while (!Device.DataBus.内存数据缓存.DataBus.GetInstance().NetworkConnectState) | |||
//{ | |||
// Thread.Sleep(2000); | |||
//} | |||
//Device.DataBus.内存数据缓存.DataBus.GetInstance().MQTTConnectState = false; | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"断开连接"); | |||
try | |||
{ | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"重连中"); | |||
await client.ConnectAsync(options); | |||
} | |||
catch (Exception ex) | |||
{ | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message); | |||
} | |||
if (client.IsConnected) | |||
{ | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT重连成功"); | |||
if (Reconnection != null) Reconnection(); | |||
} | |||
}).UseApplicationMessageReceivedHandler(c => | |||
{ | |||
MqttReceive(c); | |||
}).UseConnectedHandler((e) => | |||
{ | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"连接成功"); | |||
}); | |||
try | |||
{ | |||
await client.ConnectAsync(options); | |||
} | |||
catch (Exception ex) | |||
{ | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message); | |||
} | |||
if (!client.IsConnected) | |||
{ | |||
Thread.Sleep(2000); | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"mqtt连接失败!重连执行中"); | |||
goto p1; | |||
} | |||
Thread.Sleep(2000); | |||
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT连接成功!"); | |||
if (ConnectOk != null) ConnectOk(); | |||
} | |||
/// <summary> | |||
/// Mqtt 订阅 | |||
/// </summary> | |||
/// <param name="topic">需要订阅的主题</param> | |||
public async void MqttSubscriptionAsync(string topic) | |||
{ | |||
if (client != null) | |||
{ | |||
if (client.IsConnected) | |||
{ | |||
try | |||
{ | |||
var result = await client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(topic).WithExactlyOnceQoS().Build()); | |||
} | |||
catch { } | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// Mqtt 发布 | |||
/// </summary> | |||
/// <param name="topic">需要发布的主题</param> | |||
/// <param name="content">需要发布的内容</param> | |||
public async void MqttPublishAsync(string topic,string content) | |||
{ | |||
if (client != null) | |||
{ | |||
if (client.IsConnected) | |||
{ | |||
var msg = new MqttApplicationMessageBuilder().WithTopic(topic).WithPayload(content).WithExactlyOnceQoS().Build(); | |||
try | |||
{ | |||
var result = await client.PublishAsync(msg); | |||
} | |||
catch { } | |||
} | |||
} | |||
} | |||
private static readonly object sendMessageLock = new object(); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>Exe</OutputType> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>disable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,7 @@ | |||
// See https://aka.ms/new-console-template for more information | |||
using BPASmartClient.ControlCenterService; | |||
using System; | |||
Console.WriteLine("------------------ 控制中心服务启动 ------------------"); | |||
Serviceinitialization serviceinitialization = new Serviceinitialization(); |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.ControlCenterService | |||
{ | |||
public class Serviceinitialization | |||
{ | |||
public Serviceinitialization() | |||
{ | |||
//初始化加载 | |||
init(); | |||
} | |||
private void init() | |||
{ | |||
//订单接收模块 | |||
//AGV通讯模块 | |||
} | |||
} | |||
} |
@@ -0,0 +1,111 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.ControlCenterService.炒锅 | |||
{ | |||
public class PanMakeHelper | |||
{ | |||
public int PanMakerID { get; set; } | |||
public string PanMakerName { get; set; } | |||
/// <summary> | |||
/// 允许加料 | |||
/// </summary> | |||
public bool IsAllowAddMaterial { get; set; } | |||
/// <summary> | |||
/// 火力等级 | |||
/// </summary> | |||
public int FireGrade { get; set; } | |||
/// <summary> | |||
/// 当前炒锅温度值 | |||
/// </summary> | |||
public int CurrentFryPanTemperature { get; set; } | |||
/// <summary> | |||
/// 当前炒锅基础重量 | |||
/// </summary> | |||
public int CurrentFryPanWeight { get; set; } | |||
/// <summary> | |||
/// 当前油锅温度值 | |||
/// </summary> | |||
public int CurrentOilPanTemperature { get; set; } | |||
/// <summary> | |||
/// 当前油锅基础重量 | |||
/// </summary> | |||
public int CurrentOilPanWeight { get; set; } | |||
/// <summary> | |||
/// 定量罐运行中标志位 | |||
/// </summary> | |||
public bool PotIsRuning { get; set; } | |||
/// <summary> | |||
/// 定量罐加油完成标志位 | |||
/// </summary> | |||
public bool PotAddOilCompelete { get; set; } | |||
/// <summary> | |||
/// 定量罐液位满标志位 | |||
/// </summary> | |||
public bool PotLiquidFull { get; set; } | |||
/// <summary> | |||
/// 洗锅 | |||
/// </summary> | |||
public void CleanPan() | |||
{ | |||
} | |||
/// <summary> | |||
/// 搅拌 | |||
/// </summary> | |||
/// <param name="time">搅拌时间</param> | |||
/// <param name="speed">搅拌速度</param> | |||
public void StirPan(int time,int speed) | |||
{ | |||
} | |||
/// <summary> | |||
/// 加热油锅到设定温度 | |||
/// </summary> | |||
/// <param name="SettingTemperature"></param> | |||
public void HeatingOilPan(int SettingTemperature) | |||
{ | |||
} | |||
/// <summary> | |||
/// 加热炒锅 | |||
/// </summary> | |||
/// <param name="SettingSettingTemperature">设定温度</param> | |||
/// <param name=""></param> | |||
public void HeatingFryPan(int SettingTemperature) | |||
{ | |||
} | |||
/// <summary> | |||
/// 关火 | |||
/// </summary> | |||
public void StopFire() | |||
{ | |||
} | |||
/// <summary> | |||
/// 出料控制 | |||
/// </summary> | |||
public void OutMaterial() | |||
{ | |||
} | |||
} | |||
} |
@@ -28,11 +28,21 @@ namespace BPASmartClient.DATABUS | |||
/// <summary> | |||
/// 设备数据 | |||
/// </summary> | |||
public ConcurrentDictionary<string, Dictionary<string,object>> Dic_DeviceData = new ConcurrentDictionary<string,Dictionary<string,object>>(); | |||
public ConcurrentDictionary<string, Dictionary<string,DeviceDataModel>> Dic_DeviceData = new ConcurrentDictionary<string,Dictionary<string,DeviceDataModel>>(); | |||
/// <summary> | |||
/// API数据 | |||
/// </summary> | |||
public ConcurrentDictionary<string,string> Dic_APIData = new ConcurrentDictionary<string,string>(); | |||
#endregion | |||
} | |||
public class DeviceDataModel | |||
{ | |||
public string VarName { get; set; } | |||
public string VarVaule { get; set; } | |||
public string DataType { get; set; } | |||
} | |||
} |
@@ -55,11 +55,18 @@ namespace BPASmartClient.JXJFoodBigStation | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "服务配方管理", | |||
SubMenuName = "本地配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | |||
ToggleWindowPath = "View.RecipeReceiveView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "本地配方下发", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | |||
ToggleWindowPath = "View.RecipeSendDownView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
@@ -115,6 +122,13 @@ namespace BPASmartClient.JXJFoodBigStation | |||
#region 硬件设备监控 | |||
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>(); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "料仓管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | |||
ToggleWindowPath = "View.DeviceManageView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
@@ -0,0 +1,31 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.JXJFoodBigStation.Converter | |||
{ | |||
public class DataTableRedundantConverter: IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value != null && value is bool bit) | |||
{ | |||
if (bit) | |||
return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98)); | |||
else | |||
return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231)); | |||
} | |||
return default; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -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.JXJFoodBigStation.Converter | |||
{ | |||
public class EnbleConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort tempValue) | |||
{ | |||
if (tempValue == 0) return true; | |||
if (tempValue == 1) return false; | |||
} | |||
return true; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -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.JXJFoodBigStation.Converter | |||
{ | |||
public class IntToSourceConvert: IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort tempValue) | |||
{ | |||
if (tempValue == 0) return "本地原料"; | |||
if (tempValue == 1) return "设备原料"; | |||
} | |||
return "未知"; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -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.JXJFoodBigStation.Converter | |||
{ | |||
public class RunStatusConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort 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(); | |||
} | |||
} | |||
} |
@@ -21,7 +21,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | |||
private int _mDeviceNum; | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
internal class DeviceInfo:ObservableObject | |||
{ | |||
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } } | |||
private string _mIpAddress; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -97,5 +97,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
/// </summary> | |||
public static string StationIsExistTray { get; set; } = "M4007"; | |||
#endregion | |||
public static string StationIsExistCar { get; set; } | |||
} | |||
} |
@@ -12,29 +12,29 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// </summary> | |||
public class RawMaterialModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
private int _mIp; | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; } } | |||
/// <summary> | |||
/// 原料编号 | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public int RawMateriaLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 原料设备IP | |||
/// 需要原料重量 | |||
/// </summary> | |||
public string DeviceIp { get; set; } | |||
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private double _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料重量设置 | |||
/// 原料对应料仓的位置/名称 | |||
/// </summary> | |||
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private uint _mRawMaterialWeight; | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
/// <summary> | |||
/// 原料类型 MW18 | |||
/// 1:液体 | |||
@@ -34,8 +34,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private string _mRecipCode; | |||
public long RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private long _mRecipCode; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
[Newtonsoft.Json.JsonIgnore] | |||
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | |||
@@ -43,7 +49,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 原料集合 | |||
/// </summary> | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public ObservableCollection<RawMaterialModel> RawMaterial { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
} | |||
} |
@@ -1,4 +1,6 @@ | |||
using System; | |||
| |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
@@ -7,12 +9,12 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
public class RemoteRecipeData | |||
public class RemoteRecipeData : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; } } | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
@@ -24,7 +26,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; } } | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
/// <summary> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -6,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
public class RemoteRecipeRawMaterial | |||
public class RemoteRecipeRawMaterial :ObservableObject | |||
{ | |||
private int _mIp; | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; }} | |||
@@ -20,13 +21,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; } } | |||
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value;OnPropertyChanged(); } } | |||
private int _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } } | |||
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private double _mRawMaterialWeight; | |||
/// <summary> | |||
@@ -38,7 +39,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; } } | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
} | |||
} |
@@ -0,0 +1,117 @@ | |||
<Window x:Class="BPASmartClient.JXJFoodBigStation.View.ChangeDeviceNameView" | |||
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.JXJFoodBigStation.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
mc:Ignorable="d" | |||
Title="ChangeDeviceNameView" Width="400" | |||
Height="200" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None"> | |||
<Window.DataContext> | |||
<vm:ChangeDeviceNameViewModel/> | |||
</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" | |||
Background="#FF0B2F5F" | |||
BorderThickness="1"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入新设备名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
FontSize="16" | |||
Text="{Binding DeviceName}" /> | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Grid.Column="1" | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding ConfirmCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="148" | |||
Height="30" | |||
Command="{Binding CancleCommand}" | |||
Content="取消" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,31 @@ | |||
using BPASmartClient.Helper; | |||
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.JXJFoodBigStation.View | |||
{ | |||
/// <summary> | |||
/// ChangeDeviceNameView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ChangeDeviceNameView : Window | |||
{ | |||
public ChangeDeviceNameView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose"); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
} | |||
} | |||
} |
@@ -0,0 +1,133 @@ | |||
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.DeviceManageView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.JXJFoodBigStation.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:DeviceManageViewModel/> | |||
</UserControl.DataContext> | |||
<Grid Margin="-5,0,5,0"> | |||
<Grid> | |||
<ListView | |||
Grid.Column="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Devices}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Width="180" | |||
Height="150" | |||
Margin="10" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ClipToBounds="True" | |||
CornerRadius="0"> | |||
<Border.Background> | |||
<ImageBrush Stretch="Fill" ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" /> | |||
</Border.Background> | |||
<Grid Margin="20 0"> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
Margin="0,10,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="设备IP:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="{Binding IpAddress}" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Row="2" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<!--<Button | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Foreground="#00BEFA" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
IsEnabled="{Binding IsEnable}"> | |||
<Button.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" /> | |||
</Button.Background> | |||
</Button>--> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.JXJFoodBigStation.View | |||
{ | |||
/// <summary> | |||
/// DeviceManageView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DeviceManageView : UserControl | |||
{ | |||
public DeviceManageView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -15,12 +15,61 @@ | |||
<UserControl.DataContext> | |||
<vm:HardwareStatusViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<PathGeometry x:Key="move" Figures="M 0,0 L 0,20"/> | |||
<Storyboard x:Key="Open" > | |||
<DoubleAnimationUsingPath Duration="0:0:1" PathGeometry="{StaticResource move}" RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" Source="Y"></DoubleAnimationUsingPath> | |||
</Storyboard> | |||
<SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ListBox.Static.Border" Color="#FFABADB3"/> | |||
<SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9"/> | |||
<Style x:Key="ListViewStyle1" TargetType="{x:Type ListView}"> | |||
<Setter Property="Background" Value="{StaticResource ListBox.Static.Background}"/> | |||
<Setter Property="BorderBrush" Value="{StaticResource ListBox.Static.Border}"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> | |||
<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="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListView}"> | |||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1" SnapsToDevicePixels="true"> | |||
<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}"> | |||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | |||
</ScrollViewer> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Border}"/> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<!--<UserControl.Triggers> | |||
<EventTrigger RoutedEvent="Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource Open}"></BeginStoryboard> | |||
</EventTrigger> | |||
</UserControl.Triggers>--> | |||
<!--<Grid> | |||
<Grid> | |||
<!--#region 测试--> | |||
<ListView | |||
Height="150" | |||
VerticalAlignment="Center" | |||
@@ -57,15 +106,6 @@ | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
<!--#endregion--> | |||
<UniformGrid Columns="10" Visibility="Collapsed"> | |||
<pry:MotorBottle | |||
@@ -310,5 +350,305 @@ | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
</Grid>--> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
<!--#region 顶部料仓--> | |||
<Grid Name="TopGrid"> | |||
<ListView Style="{DynamicResource ListViewStyle1}" | |||
x:Name="FListView" | |||
Height="{Binding ElementName=TopGrid, Path=ActualHeight}" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding TopDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>--> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.1*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.RowSpan="2" | |||
Panel.ZIndex="1" | |||
Margin="55,100,0,0" | |||
HorizontalAlignment="Center"> | |||
<Path x:Name="path" Tag="{Binding DeviceName}" Visibility="Collapsed" Fill="LightGreen" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z"> | |||
<Path.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90"/> | |||
<TranslateTransform Y="0"/> | |||
</TransformGroup> | |||
</Path.RenderTransform> | |||
</Path> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<pry:IcoButton | |||
Width="80" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="5,0,10,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Content="启动" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" | |||
/> | |||
<pry:IcoButton | |||
Width="80" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StopCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Content="停止" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid x:Name="gr" Grid.Row="1" Margin="0,50,0,0"> | |||
<pry:ConveyorBelt | |||
Grid.Row="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="10,0,30,0" | |||
ConveyorBeltWidth="70" | |||
Direction="2" | |||
StrokeBrush="#00BEFA" | |||
StrokeDashArray="1.5 1.5" | |||
StrokeFillBrush="#00BEFA" | |||
StrokeThickness="2" /> | |||
</Grid> | |||
<!--#region 底部料仓--> | |||
<Grid Grid.Row="2"> | |||
<ListView | |||
Style="{DynamicResource ListViewStyle1}" | |||
x:Name="buttonListView" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BottomDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.1*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.RowSpan="2" | |||
Panel.ZIndex="1" | |||
Margin="55,100,0,0" | |||
HorizontalAlignment="Center"> | |||
<Path x:Name="path1" Tag="{Binding DeviceName}" Visibility="Collapsed" Fill="LightGreen" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z"> | |||
<Path.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90"/> | |||
<TranslateTransform Y="0"/> | |||
</TransformGroup> | |||
</Path.RenderTransform> | |||
</Path> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<pry:IcoButton | |||
Width="80" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="5,0,10,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Content="启动" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" | |||
/> | |||
<pry:IcoButton | |||
Width="80" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StopCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Content="停止" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -1,4 +1,6 @@ | |||
using System; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -9,6 +11,7 @@ using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
@@ -20,9 +23,231 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
/// </summary> | |||
public partial class HardwareStatusView : UserControl | |||
{ | |||
Storyboard storyboard; | |||
public HardwareStatusView() | |||
{ | |||
InitializeComponent(); | |||
storyboard = Resources["Open"] as Storyboard; | |||
ActionManage.GetInstance.CancelRegister("StartTopDevice"); | |||
ActionManage.GetInstance.CancelRegister("StopTopDevice"); | |||
ActionManage.GetInstance.CancelRegister("StartBottomDevice"); | |||
ActionManage.GetInstance.CancelRegister("StopBottomDevice"); | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName.ToString()&& storyboard != null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
} | |||
} | |||
} | |||
}),"StartTopDevice" ); | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName.ToString()) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
}), "StopTopDevice"); | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path1", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName.ToString() && storyboard != null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
} | |||
} | |||
} | |||
}), "StartBottomDevice"); | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path1", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName.ToString()) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
}), "StopBottomDevice"); | |||
} | |||
//顶部启动下料动画 | |||
private void IcoButton_Click(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag == (sender as IcoButton).Tag&&storyboard!=null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
} | |||
} | |||
} | |||
} | |||
//顶部停止下料动画 | |||
private void IcoButton_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag == (sender as IcoButton).Tag) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
} | |||
//底部启动下料动画 | |||
private void IcoButton_Click_2(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path1", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag == (sender as IcoButton).Tag && storyboard != null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
} | |||
} | |||
} | |||
} | |||
//底部停止下料动画 | |||
private void IcoButton_Click_3(object sender, RoutedEventArgs e) | |||
{ | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
// Getting the ContentPresenter of myListBoxItem | |||
var myContentPresenter = FindVisualChild<ContentPresenter>(myListBoxItem); | |||
// Finding textBlock from the DataTemplate that is set on that ContentPresenter | |||
DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; | |||
var obj = myDataTemplate.FindName("path1", myContentPresenter); | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag == (sender as IcoButton).Tag) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
} | |||
private childItem FindVisualChild<childItem>(DependencyObject obj) | |||
where childItem : DependencyObject | |||
{ | |||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) | |||
{ | |||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); | |||
if (child != null && child is childItem) | |||
return (childItem)child; | |||
else | |||
{ | |||
childItem childOfChild = FindVisualChild<childItem>(child); | |||
if (childOfChild != null) | |||
return childOfChild; | |||
} | |||
} | |||
return null; | |||
} | |||
} | |||
} |
@@ -7,8 +7,8 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
Title="RecipeInfosView" | |||
Width="550" | |||
Height="450" | |||
Width="800" | |||
Height="550" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
@@ -52,7 +52,7 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" BorderThickness="1" > | |||
<!--<Border Name="br" BorderThickness="1" > | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
@@ -134,5 +134,243 @@ | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border>--> | |||
<!--<Border Name="br"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"></RowDefinition> | |||
<RowDefinition Height="88"></RowDefinition> | |||
<RowDefinition Height="40"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="大料站配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="22" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2" Margin="0,0,0,8"> | |||
<StackPanel Orientation="Vertical" Margin="0,0,-13,0"> | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="16" Margin="5,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding RecipeName}" Width="150" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入托盘编号:" Foreground="#FF2AB2E7" FontSize="16" Margin="5,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding TrayCode}" InputMethod.IsInputMethodEnabled="False" Width="150" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid Width="260" HorizontalAlignment="Right"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,5,0"> | |||
<Button Content="添加原料" Width="120" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="120" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Margin="0,3,5,0"> | |||
<Button Content="另存为" Height="30" Width="120" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="120" Cursor="Hand"></Button> | |||
</StackPanel> | |||
</Grid> | |||
</UniformGrid> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="130"/> | |||
<ColumnDefinition Width="145"/> | |||
<ColumnDefinition Width="145"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="14"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="14"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="14"></TextBlock> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="14"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel></StackPanel> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton> | |||
<RadioButton.Template> | |||
<ControlTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="130"/> | |||
<ColumnDefinition Width="145"></ColumnDefinition> | |||
<ColumnDefinition Width="145"></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding RawMaterialBarrelNum}" Margin="5,0,0,5" Width="120" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" > | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="#e69519"/> | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" > | |||
<TextBox Text="{Binding RawMaterialLocation}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="135" Margin="5,0,0,5" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Column="2"> | |||
<TextBox Text="{Binding RawMaterialWeight}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="125" Margin="5,0,0,5" ></TextBox> | |||
<TextBlock VerticalAlignment="Center" Margin="4,0,0,5" Text="g" Foreground="#e69519" ></TextBlock> | |||
</StackPanel> | |||
<Button Grid.Column="3" | |||
Content="删除" | |||
Width="94" | |||
FontSize="14" | |||
Margin="10,0,20,5" | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding MaterialCode}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border>--> | |||
<Border Name="br" BorderThickness="2" BorderBrush="#0CADF5"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"></RowDefinition> | |||
<RowDefinition Height="85"></RowDefinition> | |||
<RowDefinition Height="40"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="大配料站配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2" Margin="0,0,0,5"> | |||
<StackPanel Orientation="Vertical" > | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入托盘编号:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding TrayCode}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,4,0,0"> | |||
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,4,0,0" HorizontalAlignment="Center"> | |||
<Button Content="另存为" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="180" Cursor="Hand"></Button> | |||
</StackPanel> | |||
</Grid> | |||
</UniformGrid> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="210"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="托盘桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel></StackPanel> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton> | |||
<RadioButton.Template> | |||
<ControlTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="210"/> | |||
<ColumnDefinition Width="210"></ColumnDefinition> | |||
<ColumnDefinition Width="225"></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding RawMaterialLocation}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus"> | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="#e69519"/> | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" > | |||
<TextBox Text="{Binding RawMaterialBarrelNum}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Column="2"> | |||
<TextBox Text="{Binding RawMaterialWeight}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox> | |||
<TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock> | |||
</StackPanel> | |||
<Button Grid.Column="3" | |||
Content="删除" | |||
Width="94" | |||
FontSize="14" | |||
Margin="0,0,20,10" | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RawMaterialLocation}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -23,9 +23,24 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
public RecipeInfosView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView"); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
private void ComboBox_KeyUp(object sender, KeyEventArgs e) | |||
{ | |||
} | |||
private void ComboBox_LostFocus(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -13,6 +13,9 @@ | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
@@ -37,6 +40,112 @@ | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
<!--#region 下拉列表样式--> | |||
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<!--<Setter Property="Height" Value="10" />--> | |||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | |||
<Setter Property="VerticalContentAlignment" Value="Top" /> | |||
<Setter Property="Padding" Value="10,10" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<Grid> | |||
<Border | |||
x:Name="border2" | |||
Width="auto" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Background="{TemplateBinding Background}"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<!--<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Background" Value="#FFd2e7f4" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="false"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger>--> | |||
<!--<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger>--> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="False"> | |||
<Setter TargetName="border2" Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | |||
<Setter Property="VerticalContentAlignment" Value="Stretch" /> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Expander}"> | |||
<DockPanel> | |||
<ToggleButton | |||
x:Name="HeaderSite" | |||
Height="20" | |||
Width="auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="1" | |||
Padding="{TemplateBinding Padding}" | |||
Background="Transparent" | |||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding Header}" | |||
ContentTemplate="{TemplateBinding HeaderTemplate}" | |||
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" | |||
DockPanel.Dock="Top" | |||
FontFamily="{TemplateBinding FontFamily}" | |||
FontSize="{TemplateBinding FontSize}" | |||
FontStretch="{TemplateBinding FontStretch}" | |||
FontStyle="{TemplateBinding FontStyle}" | |||
FontWeight="{TemplateBinding FontWeight}" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ToggleButtonStyle}" /> | |||
<ContentPresenter | |||
x:Name="ExpandSite" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
DockPanel.Dock="Left" | |||
Focusable="false" | |||
Visibility="Visible" /> | |||
</DockPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsExpanded" Value="True"> | |||
<Setter TargetName="ExpandSite" Property="Visibility" Value="Collapsed" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
@@ -49,6 +158,16 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding NewRecipe}" | |||
Content="新建配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
@@ -74,70 +193,194 @@ | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="1"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ListBox | |||
Grid.Row="2" | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
</ListBox.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<ListBox.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"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Grid.Column="0" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="详情" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterial}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Expander Style="{StaticResource ExpanderStyle}" Margin="40,0,0,0"> | |||
<Expander.Header> | |||
<StackPanel Orientation="Horizontal"> | |||
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="0,0,5,0"> | |||
<Border.Background> | |||
<RadialGradientBrush> | |||
<GradientStop Color="#FF2AB2E7" Offset="0.5" /> | |||
<GradientStop Color="White"/> | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Expander.Header> | |||
<Expander.Content> | |||
<StackPanel Margin="36,0,0,0"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="原料重量:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
</StackPanel> | |||
</Expander.Content> | |||
</Expander> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<!--<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,877 @@ | |||
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.RecipeSendDownView" | |||
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:con="clr-namespace:BPASmartClient.JXJFoodBigStation.Converter" | |||
xmlns:local="clr-namespace:BPASmartClient.JXJFoodBigStation.View" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:RecipeSendDownViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<con:EnbleConvert x:Key="EnbleConvert"/> | |||
<con:IntToSourceConvert x:Key="IntToSourceConvert"/> | |||
<con:RunStatusConvert x:Key="RunStatusConvert"/> | |||
<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> | |||
<Style x:Key="RadioState" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="1" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="VerticalContentAlignment" Value="Bottom" /> | |||
<Setter Property="Margin" Value="2,5" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="FontFamily" Value="Consolas" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border | |||
Name="radiobutton" | |||
Background="{TemplateBinding Background}" | |||
CornerRadius="5" | |||
Opacity="0.85"> | |||
<Grid> | |||
<!--<Border | |||
x:Name="back_border" | |||
BorderBrush="Black" | |||
BorderThickness="0" | |||
CornerRadius="1"> | |||
<Border.Effect> | |||
<BlurEffect KernelType="Gaussian" Radius="2" /> | |||
</Border.Effect> | |||
</Border> | |||
<Border | |||
x:Name="fore_border" | |||
Margin="2" | |||
BorderBrush="White" | |||
BorderThickness="0" | |||
CornerRadius="{Binding ElementName=button, Path=CornerRadius}" | |||
Opacity="0.7"> | |||
<Border.Effect> | |||
<BlurEffect KernelType="Gaussian" Radius="2" /> | |||
</Border.Effect> | |||
</Border>--> | |||
<ContentPresenter | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
TextBlock.FontFamily="{TemplateBinding FontFamily}" | |||
TextBlock.FontSize="{TemplateBinding FontSize}" | |||
TextBlock.Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="im" | |||
Source="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<!--<Setter TargetName="back_border" Property="BorderThickness" Value="1,0,1,1" /> | |||
<Setter TargetName="back_border" Property="CornerRadius" Value="5" /> | |||
<Setter TargetName="fore_border" Property="BorderThickness" Value="0,2,0,0" /> | |||
<Setter Property="Background" Value=" #4169E1" />--> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 7.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<!--<Setter TargetName="back_border" Property="BorderBrush" Value="white" /> | |||
<Setter TargetName="back_border" Property="BorderThickness" Value="1,1,1,1" />--> | |||
<Setter TargetName="radiobutton" Property="Opacity" Value="1" /> | |||
<!--<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮背景蓝色.png" />--> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="materialMakingButton" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="#CD5555" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Border | |||
x:Name="brState" | |||
Padding="2" | |||
BorderBrush="White" | |||
BorderThickness="0"> | |||
<TextBlock | |||
x:Name="txState" | |||
Margin="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="True"> | |||
<Setter TargetName="brState" Property="BorderThickness" Value="0" /> | |||
<Setter TargetName="brState" Property="CornerRadius" Value="5" /> | |||
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" /> | |||
<Setter TargetName="txState" Property="Foreground" Value="#CD5555" /> | |||
</Trigger> | |||
<DataTrigger Binding="{Binding RecipeStatus}" Value="3"> | |||
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" /> | |||
<Setter TargetName="txState" Property="Foreground" Value="#3CB371" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding RecipeStatus}" Value="2"> | |||
<Setter TargetName="txState" Property="Foreground" Value="Aqua" /> | |||
</DataTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
<Condition Property="IsEnabled" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="txState" Property="FontSize" Value="17 " /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers /> | |||
</Style> | |||
<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem"> | |||
<Grid Height="28" Margin="50,0,0,0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="原料:" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
<Style x:Key="recipeTreeItem" TargetType="TreeViewItem"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="IsExpanded" Value="True" /> | |||
<Setter Property="HeaderTemplate"> | |||
<Setter.Value> | |||
<HierarchicalDataTemplate ItemTemplate="{StaticResource TreeItemTemplate}" ItemsSource="{Binding RawMaterials, Mode=TwoWay}"> | |||
<StackPanel | |||
Height="28" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="配方:" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
</StackPanel> | |||
</HierarchicalDataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TreeViewItem}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="Auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="Auto" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Border | |||
x:Name="Bd" | |||
Grid.Column="0" | |||
Padding="{TemplateBinding Padding}" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}"> | |||
<ContentPresenter | |||
x:Name="PART_Header" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
ContentSource="Header" /> | |||
</Border> | |||
<ItemsPresenter | |||
x:Name="ItemsHost" | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Visibility="Collapsed" /> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup x:Name="SelectionStates"> | |||
<VisualState x:Name="Selected"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Unselected" /> | |||
<VisualState x:Name="SelectedInactive"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="ExpansionStates"> | |||
<VisualState x:Name="Expanded"> | |||
<Storyboard> | |||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)"> | |||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> | |||
</ObjectAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Collapsed" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Width" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" /> | |||
</MultiTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Height" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#region 下拉列表样式--> | |||
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<!--<Setter Property="Height" Value="10" />--> | |||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | |||
<Setter Property="VerticalContentAlignment" Value="Top" /> | |||
<Setter Property="Padding" Value="10,10" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<Grid> | |||
<Border | |||
x:Name="border2" | |||
Width="auto" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Background="{TemplateBinding Background}"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<!--<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Background" Value="#FFd2e7f4" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="false"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger>--> | |||
<!--<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger>--> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="False"> | |||
<Setter TargetName="border2" Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | |||
<Setter Property="VerticalContentAlignment" Value="Stretch" /> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Expander}"> | |||
<DockPanel> | |||
<ToggleButton | |||
x:Name="HeaderSite" | |||
Height="20" | |||
Width="auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="1" | |||
Padding="{TemplateBinding Padding}" | |||
Background="Transparent" | |||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding Header}" | |||
ContentTemplate="{TemplateBinding HeaderTemplate}" | |||
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" | |||
DockPanel.Dock="Top" | |||
FontFamily="{TemplateBinding FontFamily}" | |||
FontSize="{TemplateBinding FontSize}" | |||
FontStretch="{TemplateBinding FontStretch}" | |||
FontStyle="{TemplateBinding FontStyle}" | |||
FontWeight="{TemplateBinding FontWeight}" | |||
Foreground="{TemplateBinding Foreground}" | |||
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ToggleButtonStyle}" /> | |||
<ContentPresenter | |||
x:Name="ExpandSite" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
DockPanel.Dock="Left" | |||
Focusable="false" | |||
Visibility="Visible" /> | |||
</DockPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsExpanded" Value="True"> | |||
<Setter TargetName="ExpandSite" Property="Visibility" Value="Collapsed" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</UserControl.Resources> | |||
<Grid Margin="20"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.25*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Name="ggr" Margin="10"> | |||
<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | |||
<ListBox | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterial}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Expander Style="{StaticResource ExpanderStyle}" Margin="40,0,0,0"> | |||
<Expander.Header> | |||
<StackPanel Orientation="Horizontal"> | |||
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="0,0,5,0"> | |||
<Border.Background> | |||
<RadialGradientBrush> | |||
<GradientStop Color="#FF2AB2E7" Offset="0.5" /> | |||
<GradientStop Color="White"/> | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Expander.Header> | |||
<Expander.Content> | |||
<StackPanel Margin="36,0,0,0"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="原料重量:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
</StackPanel> | |||
</Expander.Content> | |||
</Expander> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<!--<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions>--> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<!--<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
<!--<Grid Name="tt" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="4" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,5" | |||
Foreground="#ffc000" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<Grid | |||
Name="grb" | |||
Grid.Row="3" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Image | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
StretchDirection="Both" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
Height="{Binding ElementName=grb, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid>--> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
<Grid | |||
Name="gr" | |||
Grid.Column="1" | |||
Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" /> | |||
<Grid Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<RadioButton | |||
Click="RadioButtonWait_Click" | |||
Command="{Binding ChangeRecipeStateCommand}" | |||
Content="等待中" | |||
GroupName="state" | |||
IsChecked="True" | |||
Style="{DynamicResource RadioState}" /> | |||
<RadioButton | |||
Grid.Column="1" | |||
Click="RadioButtonMaking_Click" | |||
Content="执行中" | |||
GroupName="state" | |||
Style="{DynamicResource RadioState}" /> | |||
<RadioButton | |||
Grid.Column="2" | |||
Click="RadioButtonCompelete_Click" | |||
Content="已完成" | |||
GroupName="state" | |||
Style="{DynamicResource RadioState}" /> | |||
</Grid> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Border> | |||
<Grid Grid.Row="1"> | |||
<Grid x:Name="repiceListMaking" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding CurrentRecipeName}" /> | |||
<ItemsControl | |||
Grid.Row="1" | |||
Margin="50,0" | |||
ItemsSource="{Binding recipeProcesses}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="16" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="10,0,5,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#AA2AB2E7" | |||
Text="{Binding RawMaterialName}" | |||
ToolTip="{Binding RawMaterialSource, Converter={StaticResource IntToSourceConvert}}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#AA2AB2E7" | |||
Text=":" /> | |||
<Button | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Command="{Binding DataContext.ChangeRecipeStateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" | |||
IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}" | |||
Style="{StaticResource materialMakingButton}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}"> | |||
</TreeView>--> | |||
<!-- 等待和已完成 --> | |||
<TreeView | |||
x:Name="repiceList" | |||
HorizontalAlignment="Stretch" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemContainerStyle="{StaticResource recipeTreeItem}" | |||
ItemsSource="{Binding UserTreeWait}" | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" /> | |||
</Grid> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,54 @@ | |||
using BPASmartClient.JXJFoodBigStation.ViewModel; | |||
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.JXJFoodBigStation.View | |||
{ | |||
/// <summary> | |||
/// RecipeSendDownView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeSendDownView : UserControl | |||
{ | |||
public RecipeSendDownView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceListMaking.Visibility = Visibility.Visible; | |||
repiceList.Visibility = Visibility.Hidden; | |||
} | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
internal class ChangeDeviceNameViewModel:ObservableObject | |||
{ | |||
private static string IpAddress = string.Empty; | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand CancleCommand { get; set; } | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
public ChangeDeviceNameViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is string str) IpAddress = str; | |||
}), "ChangeDeviceNameViewOpen"); | |||
CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); }); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
if (string.IsNullOrEmpty(DeviceName)) | |||
{ | |||
ErrorInfo = "设备名称不能为空"; | |||
return; | |||
} | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
using BPA.Models.SqlEntity.BPA_Kitchen; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using BPASmartClient.JXJFoodBigStation.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
internal class DeviceManageViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<DeviceInfo> Devices { get; set; }=new ObservableCollection<DeviceInfo>() { new DeviceInfo {DeviceName="123",IpAddress="123.213.123.213." } }; | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
public DeviceManageViewModel() | |||
{ | |||
ChangeNameCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
ChangeDeviceNameView cdn = new ChangeDeviceNameView(); | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewOpen", str); | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -17,10 +17,70 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
public HardwareStatusViewModel() | |||
{ | |||
for (int i = 0; i <8; i++) | |||
{ | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = i.ToString(), | |||
DeviceNum=i, | |||
RunStatus = false, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
for (int i = 8; i < 16; i++) | |||
{ | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = i.ToString(), | |||
DeviceNum = i, | |||
RunStatus = false, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
StartCommand = new RelayCommand<string>((deviceName) => { | |||
//PLC控制 | |||
//动画 | |||
if (deviceName != null) | |||
{ | |||
var top= TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StartTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
{ | |||
ActionManage.GetInstance.Send("StartBottomDevice", deviceName); | |||
} | |||
} | |||
}); | |||
StopCommand = new RelayCommand<string>((deviceName) => { | |||
//PLC控制 | |||
//动画 | |||
if (deviceName != null) | |||
{ | |||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StopTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
{ | |||
ActionManage.GetInstance.Send("StopBottomDevice", deviceName); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public RelayCommand<string> StartCommand { get; set; } | |||
public RelayCommand<string> StopCommand { get; set; } | |||
} | |||
} |
@@ -9,6 +9,8 @@ using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||
using System.Windows.Forms; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
@@ -18,7 +20,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RemoteRecipeData rm) | |||
if (o != null && o is RecipeModel rm) | |||
{ | |||
RecipeName = rm.RecipeName; | |||
RecipeCode = rm.RecipeCode; | |||
@@ -33,10 +35,89 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
} | |||
}), "RecipeInfo"); | |||
ReturnPage = new RelayCommand(() => | |||
AddRecipe = new RelayCommand(() => { | |||
RawMaterialsInfo.Add(new RawMaterialModel()); | |||
}); | |||
Comfirm = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
var bom= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); | |||
if (bom == null)//新配方 | |||
{ | |||
var name= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); | |||
if (name == null) | |||
{ | |||
go: | |||
long recipeCode = new Random().Next(10000, 99999); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode}); | |||
Json<LocaPar>.Save(); | |||
} | |||
else | |||
{ | |||
goto go; | |||
} | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
else | |||
{ | |||
MessageBox.Show("配方名称重复,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
} | |||
else//编辑已有配方 | |||
{ | |||
bom.RawMaterial.Clear(); | |||
foreach (var item in RawMaterialsInfo) | |||
{ | |||
bom.RawMaterial.Add(item); | |||
} | |||
bom.RecipeName = RecipeName; | |||
Json<LocaPar>.Save(); | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
}); | |||
SaveAs = new RelayCommand(() => { | |||
var bom = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); | |||
var rec = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); | |||
if (bom == null && rec != null)//配方名称更改 | |||
{ | |||
prop: long recipeCode = new Random().Next(10000, 99999);//配方唯一ID,后期根据实际要求更改 | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加 | |||
Json<LocaPar>.Save(); | |||
} | |||
else | |||
{ | |||
goto prop; | |||
} | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
else | |||
{ | |||
MessageBox.Show("另存配方失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
RemoveRecipe = new RelayCommand<int>((materilaName) => { | |||
var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialLocation==materilaName); | |||
if (res != null) | |||
RawMaterialsInfo.Remove(res); | |||
}); | |||
//ReturnPage = new RelayCommand(() => | |||
//{ | |||
// ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
//}); | |||
} | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
@@ -50,6 +131,14 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public RelayCommand ReturnPage { get; set; } | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RelayCommand AddRecipe { get; set; } | |||
public RelayCommand Comfirm { get; set; } | |||
public RelayCommand SaveAs { get; set; } | |||
public RelayCommand<int> RemoveRecipe { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterialModel>() ; | |||
} | |||
} |
@@ -23,30 +23,33 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
public class RecipeReceiveViewModel : ObservableObject | |||
{ | |||
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public RecipeReceiveViewModel() | |||
{ | |||
//Json<LocaPar>.Read(); | |||
Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | |||
Json<LocaPar>.Read(); | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string num) | |||
{ | |||
ActionManage.GetInstance.CancelRegister("RecipeInfo"); | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num); | |||
if (res != null) | |||
{ | |||
ActionManage.GetInstance.Send("RecipeInfo", res); | |||
nrv.Show(); | |||
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}"); | |||
} | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num); | |||
ActionManage.GetInstance.Send("RecipeInfo", res); | |||
nrv.Show(); | |||
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}"); | |||
} | |||
}); | |||
NewRecipe = new RelayCommand(() => { | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
nrv.ShowDialog(); | |||
}); | |||
NewSimulateRecipe = new RelayCommand(() => | |||
{ | |||
RawMaterials.Clear(); | |||
string recipeName = "配方" + (Json<LocalRecipeDataColl>.Data.Recipes.Count + 1) + ""; | |||
string recipeName = "配方" + (Json<LocaPar>.Data.Recipes.Count + 1) + ""; | |||
go: | |||
string recipeCode = new Random().Next(10000, 99999).ToString(); | |||
foreach (var item in Recipes) | |||
@@ -64,30 +67,48 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
a = 1; | |||
} | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
RawMaterials.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialWeight = new Random().Next(10, 1000), | |||
RawMaterialBarrelNum = a, | |||
RawMaterialLocation = i, | |||
}); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
{ | |||
RecipeName = recipeName, | |||
RecipeCode = recipeCode, | |||
TrayCode = trayCode, | |||
RawMaterial = RawMaterials, | |||
}); | |||
Json<LocaPar>.Save(); | |||
}); | |||
ClearAllRecipe = new RelayCommand(() => | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.Clear(); | |||
Json<LocaPar>.Data.Recipes.Clear(); | |||
Json<LocaPar>.Save(); | |||
}); | |||
RemoveCommand = new RelayCommand<long>((recipeCode) => { | |||
var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode); | |||
if(res!=null) | |||
{ | |||
Recipes.Remove(res); | |||
Json<LocaPar>.Save(); | |||
} | |||
}); | |||
} | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand NewSimulateRecipe { get; set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } | |||
public RelayCommand NewRecipe { get; set; } | |||
public RelayCommand<long> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
internal class RecipeSendDownViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes; | |||
/// <summary> | |||
/// 当前正在制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
/// <summary> | |||
/// 等待制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> UserTreeWait { get; set; } = new ObservableCollection<RecipeModel>(); | |||
/// <summary> | |||
/// 已完成的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeModel>(); | |||
public RelayCommand<string> StartCommand { get; set; } | |||
public RecipeSendDownViewModel() | |||
{ | |||
StartCommand = new RelayCommand<string>((recipeName) => { | |||
if (recipeName != null) | |||
{ | |||
//配方下发逻辑 | |||
var res= Recipes.FirstOrDefault(p=>p.RecipeName==recipeName); | |||
if (res != null) | |||
{ | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -9,10 +9,20 @@ | |||
<ApplicationIcon>hbl.ico</ApplicationIcon> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="image\down.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<EmbeddedResource Include="image\down.png"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
@@ -0,0 +1,9 @@ | |||
<Application x:Class="BPASmartClient.MinimalistUI.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPASmartClient.MinimalistUI | |||
{ | |||
/// <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,45 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<ApplicationIcon>Images\fyf.ico</ApplicationIcon> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="Images\bj.png" /> | |||
<None Remove="Images\fyf.ico" /> | |||
<None Remove="Images\logo-pic.png" /> | |||
<None Remove="Images\logo-Text.png" /> | |||
<None Remove="Images\top_h.png" /> | |||
<None Remove="Images\椭圆 22 副本 2.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="Images\fyf.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\bj.png" /> | |||
<Resource Include="Images\fyf.ico" /> | |||
<Resource Include="Images\logo-pic.png" /> | |||
<Resource Include="Images\logo-Text.png" /> | |||
<Resource Include="Images\top_h.png" /> | |||
<Resource Include="Images\椭圆 22 副本 2.png" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,32 @@ | |||
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.MinimalistUI.Converters | |||
{ | |||
public class ZoomConverter :IValueConverter | |||
{ | |||
public bool IsHeight { get; set; } | |||
public object Convert(object value,Type targetType,object parameter,CultureInfo culture) | |||
{ | |||
if (double.TryParse(value.ToString(),out double zoom)) | |||
{ | |||
return IsHeight ? zoom * 1080 : zoom * 1920; | |||
} | |||
else | |||
{ | |||
return IsHeight ? 1080 : 1920; | |||
} | |||
} | |||
public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture) | |||
{ | |||
return value; | |||
} | |||
} | |||
} |
@@ -0,0 +1,144 @@ | |||
<UserControl x:Class="BPASmartClient.MinimalistUI.FControl.HBLControl" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI.FControl" | |||
mc:Ignorable="d" | |||
d:DesignHeight="140" d:DesignWidth="140"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<LinearGradientBrush x:Key="yanjing" EndPoint="0,1"> | |||
<GradientStop Color="#CC00EAFF" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.96"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.96"></GradientStop> | |||
</LinearGradientBrush> | |||
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever"> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,0"/> | |||
</PointAnimationUsingKeyFrames> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,1"/> | |||
</PointAnimationUsingKeyFrames> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> | |||
<EasingColorKeyFrame KeyTime="00:00:02" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:02.5000000" Value="#FF075AFF"/> | |||
<EasingColorKeyFrame KeyTime="00:00:4.5" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:5" Value="#FF075AFF"/> | |||
</ColorAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ico_map"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="-180"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:5" Value="-360"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
<Storyboard x:Key="StoryboardZY" RepeatBehavior="Forever"> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border1"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<UserControl.Triggers> | |||
<EventTrigger RoutedEvent="FrameworkElement.Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> | |||
<BeginStoryboard Storyboard="{StaticResource StoryboardZY}"/> | |||
</EventTrigger> | |||
</UserControl.Triggers> | |||
<Grid Width="100" Height="100" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20"> | |||
<Image x:Name="ico_map" Width="85" Height="85" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Source="/Images/椭圆 22 副本 2.png" RenderTransformOrigin="0.5,0.5" > | |||
<Image.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Image.RenderTransform> | |||
</Image> | |||
<Image HorizontalAlignment="Center" Margin="0,90,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="100" Height="20" Source="/Images/top_h.png" /> | |||
<Grid x:Name="grid_xiaoboluo" Width="100" Height="100" MouseEnter="grid_MouseEnter" MouseLeave="grid_MouseLeave"> | |||
<Grid> | |||
<Ellipse x:Name="rectangle" Width="70" Height="70" StrokeThickness="4" Fill="#FF022E50"> | |||
<Ellipse.Stroke> | |||
<LinearGradientBrush Opacity="1"> | |||
<GradientStop Color="Transparent" Offset="0"/> | |||
<GradientStop Color="#FF075AFF" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Ellipse.Stroke> | |||
</Ellipse> | |||
<Image x:Name="ico" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-20,25,0,0" Width="25" Height="30" Source="/Images/logo-pic.png" /> | |||
<Image Width="31.6" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Height="7.9" Margin="20,0,0,25" Source="/Images/logo-Text.png" /> | |||
<TextBlock Margin="0,24,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FF00EAFF" FontFamily="黑体" FontWeight="Bold">智能卓越</TextBlock> | |||
</Grid> | |||
<Grid x:Name="grid_celine" Visibility="Collapsed"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Ellipse Grid.ColumnSpan="2" Width="70" Height="70" Fill="#2571ac" ></Ellipse> | |||
<Grid x:Name="yanjing_move" Grid.ColumnSpan="2" Width="35" Height="35"> | |||
<Grid > | |||
<Border x:Name="border1" HorizontalAlignment="Left" Grid.Column="0" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
<Border x:Name="border" HorizontalAlignment="Right" Grid.Column="1" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,37 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MinimalistUI.FControl | |||
{ | |||
/// <summary> | |||
/// HBLControl.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class HBLControl :UserControl | |||
{ | |||
public HBLControl() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void grid_MouseEnter(object sender,MouseEventArgs e) | |||
{ | |||
grid_celine.Visibility = Visibility.Visible; | |||
} | |||
private void grid_MouseLeave(object sender,MouseEventArgs e) | |||
{ | |||
grid_celine.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
<UserControl x:Class="BPASmartClient.MinimalistUI.FControl.RunCanvas" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI.FControl" | |||
xmlns:con="clr-namespace:BPASmartClient.MinimalistUI.Converters" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.Resources> | |||
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/> | |||
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/> | |||
</UserControl.Resources> | |||
<Grid ClipToBounds="True"> | |||
<Canvas x:Name="RootCanvas" ClipToBounds="True" Background="Transparent" MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp" | |||
MouseMove="RootCanvas_MouseMove" MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown" MouseWheel="RootCanvas_MouseWheel"> | |||
<Canvas.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform x:Name="Scale"/> | |||
<TranslateTransform x:Name="Translate"/> | |||
</TransformGroup> | |||
</Canvas.RenderTransform> | |||
</Canvas> | |||
<Grid VerticalAlignment="Bottom" Background="#4B959595"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="8 0"> | |||
<CheckBox x:Name="DragEnable" Content="拖动" Margin="4"/> | |||
<CheckBox x:Name="ZoomEnable" Content="缩放" Margin="4"/> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |