@@ -239,6 +239,55 @@ namespace BPASmartClient.AGV | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从清洗台到4号线体卸桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅1 | |||
/// </summary> | |||
/// <returns></returns> | |||
@@ -483,6 +532,203 @@ namespace BPASmartClient.AGV | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从1号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLOneToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从2号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLTwoToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从3号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLThreeToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从洗桶处运桶到4号洗桶线 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveCleanToLFour(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// 任务取消 | |||
/// </summary> | |||
@@ -1,5 +1,6 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
@@ -10,6 +11,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class PlcVariableInfoManage:ObservableObject | |||
{ | |||
public ObservableCollection<PlcVariableInfoModel> VariablesInfo { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>> VariablesInfo { get; set; } = new ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>>(); | |||
} | |||
} |
@@ -5,12 +5,14 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:VariableViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="dataGrid" TargetType="DataGrid" > | |||
<Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/> | |||
<Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/> | |||
@@ -83,17 +85,299 @@ | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="FontSize" Value="16"/> | |||
</Style> | |||
<Style x:Key="FocusVisual"> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/> | |||
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="AllowDrop" Value="true"/> | |||
<Setter Property="MinWidth" Value="0"/> | |||
<Setter Property="MinHeight" Value="0"/> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TextBox}"> | |||
<ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/> | |||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/> | |||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/> | |||
<LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="#FFDAECFC" Offset="0.0"/> | |||
<GradientStop Color="#FFC4E0FC" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/> | |||
<LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="#FFDAEBFC" Offset="0.0"/> | |||
<GradientStop Color="#FFC4E0FC" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/> | |||
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Focusable" Value="false"/> | |||
<Setter Property="ClickMode" Value="Press"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<Border x:Name="templateRoot" Background="{StaticResource ComboBox.Static.Background}" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> | |||
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"> | |||
<Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/> | |||
</Border> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}"> | |||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/> | |||
</Grid.ColumnDefinitions> | |||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> | |||
<Border x:Name="dropDownBorder" Background="Transparent" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1"> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0"> | |||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/> | |||
</Canvas> | |||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</theme:SystemDropShadowChrome> | |||
</Popup> | |||
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/> | |||
<Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}"> | |||
<TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Opacity" TargetName="border" Value="0.56"/> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocusWithin" Value="true"> | |||
<Setter Property="Foreground" Value="Black"/> | |||
</Trigger> | |||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"> | |||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/> | |||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/> | |||
</Trigger> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> | |||
</MultiTrigger> | |||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false"> | |||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/> | |||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> | |||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/> | |||
</Grid.ColumnDefinitions> | |||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> | |||
<Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1"> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0"> | |||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/> | |||
</Canvas> | |||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</theme:SystemDropShadowChrome> | |||
</Popup> | |||
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/> | |||
<ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"> | |||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/> | |||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/> | |||
</Trigger> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> | |||
</MultiTrigger> | |||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false"> | |||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/> | |||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> | |||
<Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/> | |||
<Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> | |||
<Setter Property="Padding" Value="6,3,5,3"/> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/> | |||
<Style.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Padding" Value="2"/> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.12*"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}" ></Button> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<ComboBox ItemsSource="{Binding DeviceName}" Text="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="120" Height="40" Margin="0,0,10,0"></ComboBox> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}"></Button> | |||
</StackPanel> | |||
<!--变量配置--> | |||
<DataGrid Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" | |||
<DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
@@ -124,6 +408,165 @@ | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅1配置--> | |||
<DataGrid x:Name="fryOne" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryOneVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryOne_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅2配置--> | |||
<DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryTwoVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryTwo_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅3配置--> | |||
<DataGrid x:Name="fryThree" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryThreeVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryThree_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅4配置--> | |||
<DataGrid x:Name="fryFour" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFourVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryFour_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅5配置--> | |||
<DataGrid x:Name="fryFive" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFiveVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryFive_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
</UserControl> |
@@ -29,7 +29,93 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryOne_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryTwo_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryThree_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryFour_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryFive_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
ComboBox cbo= sender as ComboBox; | |||
if (cbo != null) | |||
{ | |||
switch (cbo.SelectedValue) | |||
{ | |||
case "滚筒输送线": | |||
this.GT.Visibility = Visibility.Visible; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility=Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅1": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Visible; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅2": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Visible; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅3": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Visible; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅4": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Visible; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅5": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Visible; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -15,15 +15,45 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
public class VariableViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<PlcVariableInfoModel> Variables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public List<string> DeviceName { get; set; } = new List<string> { "滚筒输送线", "炒锅1", "炒锅2", "炒锅3", "炒锅4", "炒锅5" }; | |||
public RelayCommand SaveDataCommand { get; set; } | |||
public VariableViewModel() | |||
{ | |||
Json<PlcVariableInfoManage>.Read(); | |||
Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo; | |||
try | |||
{ | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count>0) | |||
{ | |||
Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"]; | |||
FryOneVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"]; | |||
FryTwoVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"]; | |||
FryThreeVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"]; | |||
FryFourVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"]; | |||
FryFiveVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"]; | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
SaveDataCommand = new RelayCommand(() => | |||
{ | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"] = Variables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"] = FryOneVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"]=FryTwoVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"] = FryThreeVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"]= FryFourVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"] = FryFiveVariables; | |||
Json<PlcVariableInfoManage>.Save(); | |||
MessageBox.Show("保存成功","提示",MessageBoxButton.OK,MessageBoxImage.Information); | |||
}); | |||
@@ -20,15 +20,35 @@ namespace FryPot_DosingSystem.Control | |||
private static DeviceOperate _instance; | |||
public static DeviceOperate GetInstance => _instance ??= new DeviceOperate(); | |||
public bool IsConfig { get; set; }//设备plc数据是否配置 | |||
ModbusTcp modbus = new ModbusTcp(); | |||
private string Ip { get; set; } | |||
private string Port { get; set; } | |||
ModbusTcp modbus = new ModbusTcp();//滚筒线Modbus通讯对象 | |||
ModbusTcp fryOneModbus = new ModbusTcp();//炒锅1Modbus通讯对象 | |||
ModbusTcp fryTwoModbus = new ModbusTcp();//炒锅2Modbus通讯对象 | |||
ModbusTcp fryThreeModbus = new ModbusTcp();//炒锅3Modbus通讯对象 | |||
ModbusTcp fryFourModbus = new ModbusTcp();//炒锅4Modbus通讯对象 | |||
ModbusTcp fryFiveModbus = new ModbusTcp();//炒锅5Modbus通讯对象 | |||
// private string Ip { get; set; } | |||
// private string Port { get; set; } | |||
public bool Connected { get; set; } | |||
public bool FryOneConnected { get; set; } | |||
public bool FryTwoConnected { get; set; } | |||
public bool FryThreeConnected { get; set; } | |||
public bool FryFourConnected { get; set; } | |||
public bool FryFiveConnected { get; set; } | |||
private string DeviceName { get; set; } | |||
// private string DeviceName { get; set; } | |||
public ConcurrentDictionary<string, object> Data { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryOneData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryTwoData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryThreeData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryFourData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryFiveData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ObservableCollection<PlcVariableModel> Variables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public DeviceOperate() | |||
{ | |||
Init(); | |||
@@ -37,18 +57,69 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
public void Init() | |||
{ | |||
if (Variables.Count > 0) | |||
{ | |||
Variables.Clear(); | |||
} | |||
Variables.Clear(); | |||
FryOneVariables.Clear(); | |||
FryTwoVariables.Clear(); | |||
FryThreeVariables.Clear(); | |||
FryFourVariables.Clear(); | |||
FryFiveVariables.Clear(); | |||
Json<PlcVariableInfoManage>.Read(); | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count > 0) | |||
{ | |||
try | |||
{ | |||
foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"].Count>0) | |||
{ | |||
Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
//foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒运输线"]) | |||
//{ | |||
// Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
//} | |||
foreach (KeyValuePair<string,ObservableCollection<PlcVariableInfoModel>> dic in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
{ | |||
if (string.Equals(dic.Key, "滚筒输送线")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅1")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryOneVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅2")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryTwoVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅3")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryThreeVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅4")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryFourVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅5")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryFiveVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
} | |||
} | |||
IsConfig = true; | |||
} | |||
@@ -59,8 +130,8 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
} | |||
else | |||
{ | |||
IsConfig= false; | |||
{ | |||
IsConfig = false; | |||
} | |||
//Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 | |||
//Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 | |||
@@ -88,13 +159,26 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
if (devices.Devices.Count > 0) | |||
{ | |||
Ip = devices.Devices[0].Ip; | |||
Port = devices.Devices[0].Port; | |||
DeviceName = devices.Devices[0].DeviceName; | |||
Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); | |||
// Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); App.Current.Dispatcher.Invoke(new Action(() => { BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.RunLog("PLC连接成功"); })); }); | |||
for (int i = 0; i < devices.Devices.Count; i++) | |||
{ | |||
string Ip = devices.Devices[i].Ip; | |||
string Port = devices.Devices[i].Port; | |||
string DeviceName = devices.Devices[i].DeviceName; | |||
switch (DeviceName) | |||
{ | |||
case "滚筒输送线": Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅1": Task.Run(() => { fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅2": Task.Run(() => { fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅3": Task.Run(() => { fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅4": Task.Run(() => { fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅5": Task.Run(() => { fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
} | |||
} | |||
// Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); App.Current.Dispatcher.Invoke(new Action(() => { BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.RunLog("PLC连接成功"); })); }); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public void ReadData() | |||
@@ -103,6 +187,7 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//滚筒线 | |||
Connected = modbus.Connected; | |||
while (Connected) | |||
{ | |||
@@ -118,11 +203,106 @@ namespace FryPot_DosingSystem.Control | |||
Data.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(500); | |||
Thread.Sleep(50); | |||
} | |||
//炒锅1 | |||
FryOneConnected = fryOneModbus.Connected; | |||
while (FryOneConnected) | |||
{ | |||
foreach (var item in FryOneVariables) | |||
{ | |||
var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryOneData.ContainsKey(item.Address)) | |||
{ | |||
FryOneData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryOneData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(1000); | |||
}), $"设备【{DeviceName}】PLC实时数据读取线程"); | |||
//炒锅2 | |||
FryTwoConnected = fryTwoModbus.Connected; | |||
while (FryTwoConnected) | |||
{ | |||
foreach (var item in FryTwoVariables) | |||
{ | |||
var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryTwoData.ContainsKey(item.Address)) | |||
{ | |||
FryTwoData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryTwoData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅3 | |||
FryThreeConnected = fryThreeModbus.Connected; | |||
while (FryThreeConnected) | |||
{ | |||
foreach (var item in FryThreeVariables) | |||
{ | |||
var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryThreeData.ContainsKey(item.Address)) | |||
{ | |||
FryThreeData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryThreeData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅4 | |||
FryFourConnected = fryFourModbus.Connected; | |||
while (FryFourConnected) | |||
{ | |||
foreach (var item in FryFourVariables) | |||
{ | |||
var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFourData.ContainsKey(item.Address)) | |||
{ | |||
FryFourData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFourData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅5 | |||
FryFiveConnected = fryFiveModbus.Connected; | |||
while (FryFiveConnected) | |||
{ | |||
foreach (var item in FryFiveVariables) | |||
{ | |||
var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFiveData.ContainsKey(item.Address)) | |||
{ | |||
FryFiveData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFiveData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(500); | |||
}), $"PLC实时数据读取线程"); | |||
} | |||
} | |||
public void WritePlcData(string address, ushort value) | |||
@@ -136,5 +316,25 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
return Data; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryOneData() | |||
{ | |||
return FryOneData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryTwoData() | |||
{ | |||
return FryTwoData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryThreeData() | |||
{ | |||
return FryThreeData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryFourData() | |||
{ | |||
return FryFourData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryFiveData() | |||
{ | |||
return FryFiveData; | |||
} | |||
} | |||
} |
@@ -57,6 +57,10 @@ namespace FryPot_DosingSystem.Control | |||
/// PLC初始化状态 | |||
/// </summary> | |||
public ushort PlcInite { get; set; } | |||
/// <summary> | |||
/// 清洗台清洗完成信号 | |||
/// </summary> | |||
public ushort CleanComplete { get; set; } | |||
#region 上位机内部逻辑条件 | |||
/// <summary> | |||
/// 退出线体1任务 | |||
@@ -178,8 +182,17 @@ namespace FryPot_DosingSystem.Control | |||
public bool LThreeagvFryPotEmptyRollerArrive { get; set; } | |||
public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 | |||
public int LFourRollerNum { get; set; } = 0; | |||
#endregion | |||
public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 | |||
//新增 | |||
public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清戏台或炒锅 | |||
public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 | |||
public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 | |||
public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置 | |||
public bool agvArriveLineTwoLoadEmptyRoller { get; set; }//agv到达线体2空桶上料位置 | |||
public bool agvArriveLineThreeLoadEmptyRoller { get; set; }//agv到达线体3空桶上料位置 | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 滚筒线1相关变量 | |||
@@ -230,8 +243,23 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个桶是否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体1上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>() {108}; | |||
} | |||
/// <summary> | |||
/// 滚筒线2相关变量 | |||
@@ -282,6 +310,24 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个同时否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体2上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; }=new List<ushort>(); | |||
} | |||
/// <summary> | |||
/// 滚筒线3相关变量 | |||
@@ -332,6 +378,24 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个同时否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体3上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); | |||
} | |||
/// <summary> | |||
/// 滚筒线4相关变量 | |||
@@ -0,0 +1,16 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace FryPot_DosingSystem.Model | |||
{ | |||
internal class FlowProcessManage:ObservableObject | |||
{ | |||
public string RecipeName { get; set; } | |||
public ObservableCollection<FlowProcessModel> fpModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
} | |||
} |
@@ -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 FryPot_DosingSystem.Model | |||
{ | |||
internal class FlowProcessModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 工艺对应配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } } | |||
private string _recipeName; | |||
/// <summary> | |||
/// 工艺步骤 | |||
/// </summary> | |||
public int Id { get; set; } | |||
/// <summary> | |||
/// 炒制原料/桶号 | |||
/// </summary> | |||
public string FryMaterialNum { get { return _fryMaterialNum; } set { _fryMaterialNum = value;OnPropertyChanged(); } } | |||
private string _fryMaterialNum; | |||
/// <summary> | |||
/// 炒制速度 | |||
/// </summary> | |||
public double FrySpeed { get { return _frySpeed; }set { _frySpeed = value;OnPropertyChanged(); } } | |||
private double _frySpeed; | |||
/// <summary> | |||
/// 炒制重量 | |||
/// </summary> | |||
public double FryWeight { get { return _fryMaterialWeight; }set { _fryMaterialWeight = value;OnPropertyChanged(); } } | |||
private double _fryMaterialWeight; | |||
/// <summary> | |||
/// 炒制温度 | |||
/// </summary> | |||
public double FryTemperature { get { return _fryTemperature; } set { _fryTemperature = value;OnPropertyChanged(); } } | |||
private double _fryTemperature; | |||
/// <summary> | |||
/// 炒制时间 | |||
/// </summary> | |||
public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value;OnPropertyChanged(); } } | |||
private double _fryPeriodTime; | |||
} | |||
} |
@@ -29,7 +29,12 @@ namespace FryPot_DosingSystem.Model | |||
private string _updateTime; | |||
public string UpdateTime { get { return _updateTime; } set { _updateTime = value;OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 工艺流程 | |||
/// </summary> | |||
public FlowProcessManage FlowProcess { get { return _flowProcessManage; } set { _flowProcessManage = value;OnPropertyChanged(); } } | |||
private FlowProcessManage _flowProcessManage; | |||
/// <summary> | |||
/// 配方下发状况信息 | |||
/// </summary> | |||
@@ -52,12 +52,30 @@ | |||
<div class="content unicode" style="display: block;"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">节点-子流程</div> | |||
<div class="code-name">&#xe6e2;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">流程</div> | |||
<div class="code-name">&#xe64c;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">下载</div> | |||
<div class="code-name">&#xe622;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">232编辑、输入</div> | |||
<div class="code-name">&#xe8cc;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">账号信息</div> | |||
@@ -118,6 +136,12 @@ | |||
<div class="code-name">&#xe6b7;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">工艺流程_0</div> | |||
<div class="code-name">&#xe7ab;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">166-NFC</div> | |||
@@ -142,7 +166,7 @@ | |||
<pre><code class="language-css" | |||
>@font-face { | |||
font-family: 'iconfont'; | |||
src: url('iconfont.ttf?t=1659497763775') format('truetype'); | |||
src: url('iconfont.ttf?t=1659942239310') format('truetype'); | |||
} | |||
</code></pre> | |||
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> | |||
@@ -168,6 +192,24 @@ | |||
<div class="content font-class"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-jiedianziliucheng"></span> | |||
<div class="name"> | |||
节点-子流程 | |||
</div> | |||
<div class="code-name">.icon-jiedianziliucheng | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-liucheng"></span> | |||
<div class="name"> | |||
流程 | |||
</div> | |||
<div class="code-name">.icon-liucheng | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-xiazai"></span> | |||
<div class="name"> | |||
@@ -177,6 +219,15 @@ | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-bianjishuru"></span> | |||
<div class="name"> | |||
232编辑、输入 | |||
</div> | |||
<div class="code-name">.icon-bianjishuru | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-zhanghaoxinxi"></span> | |||
<div class="name"> | |||
@@ -267,6 +318,15 @@ | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-gongyiliucheng_0"></span> | |||
<div class="name"> | |||
工艺流程_0 | |||
</div> | |||
<div class="code-name">.icon-gongyiliucheng_0 | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-a-166-NFC"></span> | |||
<div class="name"> | |||
@@ -303,6 +363,22 @@ | |||
<div class="content symbol"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-jiedianziliucheng"></use> | |||
</svg> | |||
<div class="name">节点-子流程</div> | |||
<div class="code-name">#icon-jiedianziliucheng</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-liucheng"></use> | |||
</svg> | |||
<div class="name">流程</div> | |||
<div class="code-name">#icon-liucheng</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-xiazai"></use> | |||
@@ -311,6 +387,14 @@ | |||
<div class="code-name">#icon-xiazai</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-bianjishuru"></use> | |||
</svg> | |||
<div class="name">232编辑、输入</div> | |||
<div class="code-name">#icon-bianjishuru</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-zhanghaoxinxi"></use> | |||
@@ -391,6 +475,14 @@ | |||
<div class="code-name">#icon-mianxingmima</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-gongyiliucheng_0"></use> | |||
</svg> | |||
<div class="name">工艺流程_0</div> | |||
<div class="code-name">#icon-gongyiliucheng_0</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-a-166-NFC"></use> | |||
@@ -32,26 +32,42 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<UniformGrid Columns="2"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineRunning}"></Button> | |||
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>--> | |||
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/> | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/> | |||
<Button Content="线体1任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneTaskExit}"></Button> | |||
<Button Content="AGV接口调试" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvDebug}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体1上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLOneArrive}"/> | |||
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotDownArrive}"> | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体1空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineOneEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
<Button Content="AGV空桶清洗上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoad}"/> | |||
</WrapPanel> | |||
</GroupBox> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
<UniformGrid Columns="2" Grid.Row="1"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
@@ -62,6 +78,10 @@ | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/> | |||
<Button Content="线体2任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineTwoTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
@@ -71,6 +91,12 @@ | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotTwoUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotTwoGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体2空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineTwoEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
@@ -83,6 +109,10 @@ | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/> | |||
<Button Content="线体3任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineThreeTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
@@ -92,6 +122,12 @@ | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotThreeUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotThreeGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体3空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineThreeEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
@@ -0,0 +1,75 @@ | |||
<Window x:Class="FryPot_DosingSystem.View.FlowProcessView" | |||
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:FryPot_DosingSystem.View" | |||
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
mc:Ignorable="d" | |||
Title="FlowProcessView" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> | |||
<Window.DataContext> | |||
<vm:FlowProcessSetViewModel/> | |||
</Window.DataContext> | |||
<Border x:Name="br"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#264c73"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="炒锅工艺" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" Background="Transparent" FontSize="25" Cursor="Arrow" ></TextBlock> | |||
<Border BorderThickness="0,0,0,1" BorderBrush="#FF2AB2E7"></Border> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<Button Content="保存工艺" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding ConfirmCommand}" ></Button> | |||
<Button Content="取消" Height="30" Width="100" Margin="0,0,10,0" Background="Transparent" FontSize="18" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding CloseWindowCommand}"></Button> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,8"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="工艺步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="炒制原料/桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="1" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="炒制速度" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="炒制重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock> | |||
<GridSplitter Grid.Column="3" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="4" Text="炒制温度" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="5" Text="炒制时间" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
</Grid> | |||
<ItemsControl ItemsSource="{Binding flowProcessModels}" Grid.Row="3"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBox Text="{Binding Id}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" IsReadOnly="True" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1" /> | |||
<TextBox Text="{Binding FryMaterialNum}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,35 @@ | |||
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 FryPot_DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// FlowProcessView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class FlowProcessView : Window | |||
{ | |||
public FlowProcessView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseFlowProcessView"); | |||
ActionManage.GetInstance.Register(new Action(() => { | |||
this.Close(); | |||
}), "CloseFlowProcessView"); | |||
} | |||
} | |||
} |
@@ -195,20 +195,20 @@ | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="25" Margin="0,10"></TextBlock> | |||
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2"> | |||
<StackPanel Orientation="Vertical"> | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入桶的数量:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="请输入桶的数量:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeRollerNum}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox> | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid> | |||
@@ -217,30 +217,30 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button> | |||
<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" 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="Aqua" Foreground="Aqua" Width="180" Cursor="Hand"></Button> | |||
<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="Cyan" Margin="0,0,0,10"> | |||
<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="Tomato"/> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/> | |||
<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="Tomato"></TextBlock> | |||
<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="Tomato"/> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding materials}"> | |||
@@ -150,6 +150,7 @@ | |||
<TextBlock Text="操作:" Foreground="White" FontSize="18"></TextBlock> | |||
<Button Style="{DynamicResource ButtonStyle1}" Content="编辑" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RecipeId}"/> | |||
<Button Margin="60,0,0,0" Style="{DynamicResource ButtonStyle1}" Content="炒制工艺" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.OperateFlowProcess,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeName}"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,5"> | |||
<TextBlock Text="创建时间:" FontSize="18" Foreground="White"></TextBlock> | |||
@@ -53,8 +53,55 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand AGVFryPotThreeUpArrive { get; set; } | |||
public RelayCommand AGVFryPotThreeGetEmptyRoller { get; set; } | |||
//AGV接口联调 | |||
public RelayCommand AgvDebug { get; set; } | |||
//线体123空桶清洗以及回收 | |||
public RelayCommand AgvArriveLineOneEmptyRollerLoc { get; set; } | |||
public RelayCommand AgvArriveLineTwoEmptyRollerLoc { get; set; } | |||
public RelayCommand AgvArriveLineThreeEmptyRollerLoc { get; set; } | |||
public RelayCommand CleanPlateCallAgv { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLoc { get; set; }//下料 | |||
public RelayCommand AgvArriveLineFourLoc { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLocLoad { get; set; }//上料 | |||
public DebugViewModel() | |||
{ | |||
AgvDebug = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvDebug"); | |||
})); | |||
AgvArriveLineOneEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineOneEmptyRollerLoc"); | |||
})); | |||
AgvArriveLineTwoEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineTwoEmptyRollerLoc"); | |||
})); | |||
AgvArriveLineThreeEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineThreeEmptyRollerLoc"); | |||
})); | |||
CleanPlateCallAgv = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("CleanPlateCallAgv"); | |||
})); | |||
AgvArriveCleanPlateLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLoc"); | |||
})); | |||
AgvArriveCleanPlateLocLoad = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLocLoad"); | |||
})); | |||
AgvArriveLineFourLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineFourLoc"); | |||
})); | |||
RollerLineRunning = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("RollerLineRunning"); | |||
@@ -20,7 +20,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand<string> DeleteDevice { get; set; } | |||
public DeviceListViewModel() | |||
{ | |||
//Json<DeviceManage>.Read(); | |||
Json<DeviceManage>.Read(); | |||
devices = Json<DeviceManage>.Data.Devices; | |||
DeviceName.Add("滚筒输送线"); | |||
DeviceName.Add("炒锅1"); | |||
@@ -0,0 +1,77 @@ | |||
using BPASmartClient.Helper; | |||
using FryPot_DosingSystem.Model; | |||
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 FryPot_DosingSystem.ViewModel | |||
{ | |||
internal class FlowProcessSetViewModel | |||
{ | |||
public int Id { get; set; } = 0; | |||
public ObservableCollection<FlowProcessModel> flowProcessModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
public string currnetRecipeName { get; set;} | |||
public RelayCommand CloseWindowCommand { get; set; } | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public FlowProcessSetViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>(recipeName => | |||
{ | |||
if (recipeName != null) | |||
{ | |||
currnetRecipeName = recipeName.ToString(); | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.FlowProcess.RecipeName == recipeName.ToString()); | |||
if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 | |||
{ | |||
//flowProcessModels = recipe.FlowProcess.fpModels; | |||
foreach (var item in recipe.FlowProcess.fpModels) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = item.Id, FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); | |||
} | |||
} | |||
else//创建新工艺 | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p=>p.RecipeName==recipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = recipeName.ToString(); | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = "油" }); | |||
Id++; | |||
foreach (var item in name.materialCollection) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = item.MaterialName }); | |||
Id++; | |||
} | |||
name.FlowProcess.fpModels= flowProcessModels; | |||
} | |||
} | |||
} | |||
}), "EditFlowProcess"); | |||
CloseWindowCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == currnetRecipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = currnetRecipeName.ToString(); | |||
name.FlowProcess.fpModels = flowProcessModels; | |||
} | |||
Json<RecipeManage>.Save(); | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
} | |||
} | |||
} |
@@ -102,7 +102,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); | |||
if (res == null) | |||
{ | |||
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials,DataTime=DateTime.Now.ToShortDateString()});//配方添加 | |||
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, FlowProcess=new FlowProcessManage(), materialCollection = materials,DataTime=DateTime.Now.ToShortDateString()});//配方添加 | |||
} | |||
else | |||
{ | |||
@@ -33,6 +33,10 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand SaveRecipe { get; set; } | |||
/// <summary> | |||
/// 工艺操作 | |||
/// </summary> | |||
public RelayCommand<string> OperateFlowProcess { get; set; } | |||
/// <summary> | |||
/// 编辑配方 | |||
/// </summary> | |||
public RelayCommand<object> EditRecipeCommand { get; set; } | |||
@@ -103,6 +107,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
} | |||
} | |||
}); | |||
//工艺流程操作 | |||
OperateFlowProcess = new RelayCommand<string>((recipeName) => | |||
{ | |||
if (recipeName != null && recipeName != string.Empty && recipeName != "") | |||
{ | |||
ActionManage.GetInstance.CancelRegister("EditFlowProcess"); | |||
FlowProcessView fps = new FlowProcessView(); | |||
ActionManage.GetInstance.Send("EditFlowProcess", recipeName); | |||
fps.ShowDialog(); | |||
} | |||
}); | |||
} | |||
} | |||
} |