diff --git a/BPASmartClient.Helper/TTrig.cs b/BPASmartClient.Helper/TTrig.cs index 0b047c86..1c7fd1d3 100644 --- a/BPASmartClient.Helper/TTrig.cs +++ b/BPASmartClient.Helper/TTrig.cs @@ -11,11 +11,15 @@ namespace BPASmartClient.Helper public class TTrig { private volatile static ConcurrentDictionary _Instance; + private static readonly object Lock = new object(); public static TTrig GetInstance(string name) { - if (_Instance == null) _Instance = new ConcurrentDictionary(); - if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig()); - return _Instance[name]; + lock (Lock) + { + if (_Instance == null) _Instance = new ConcurrentDictionary(); + if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig()); + return _Instance[name]; + } } private TTrig() { } diff --git a/BPASmartClient.Modbus/ModbusTcp.cs b/BPASmartClient.Modbus/ModbusTcp.cs index 852425a7..aa6bf6a3 100644 --- a/BPASmartClient.Modbus/ModbusTcp.cs +++ b/BPASmartClient.Modbus/ModbusTcp.cs @@ -151,6 +151,7 @@ namespace BPASmartClient.Modbus { try { + //D1001 string head = (Convert.ToInt32(address.Substring(1, 1))).ToString(); int num = Convert.ToInt32(address.Substring(2, 3)); int len = num.ToString().Length; diff --git a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj index 2c7b15a9..08200dbd 100644 --- a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj +++ b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj @@ -90,10 +90,6 @@ - - - - ..\BPASmartClient.Compiler\DLL\Antlr3.Runtime.dll diff --git a/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs b/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs index 8550a017..05c4dca6 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs @@ -1,25 +1,14 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; +using BPASmartClient.Compiler; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; using System.Windows.Shapes; -using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls { diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs index cc40df81..02b1ab39 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs @@ -1,27 +1,12 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; -using BPASmartClient.SCADAControl.EnumClass; +using BPASmartClient.Compiler; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using StackExchange.Redis; using System; -using System.Collections; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs index b592039c..dc5a8200 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs @@ -1,23 +1,11 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; +using BPASmartClient.Compiler; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; namespace BPASmartClient.SCADAControl.CustomerControls { diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs index 84a36784..e1fcec75 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs @@ -1,7 +1,4 @@ using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl.Converters; -using BPASmartClient.SCADAControl.EnumClass; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -9,17 +6,8 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Data; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs index 97bd436a..4ff5f137 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs @@ -1,25 +1,14 @@ using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl.Converters; -using BPASmartClient.SCADAControl.EnumClass; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Linq; using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; using System.Xml; diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs index 2029b74d..4eec6a92 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs @@ -1,24 +1,12 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; +using BPASmartClient.Compiler; using Newtonsoft.Json; -using StackExchange.Redis; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs index 32449edc..d34191a9 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs @@ -1,24 +1,13 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; +using BPASmartClient.Compiler; using Newtonsoft.Json; using StackExchange.Redis; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs b/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs index 99c26dd5..04c002fb 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs @@ -1,25 +1,12 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; +using BPASmartClient.Compiler; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls { diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs index 15a514b5..2826e57b 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs @@ -1,26 +1,11 @@ -using BPASmart.Model; -using BPASmartClient.Compiler; - -using BPASmartClient.SCADAControl; +using BPASmartClient.Compiler; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; namespace BPASmartClient.SCADAControl.CustomerControls { diff --git a/BPASmartClient.SCADAControl/EnumClass/DataTypeEnum.cs b/BPASmartClient.SCADAControl/EnumClass/DataTypeEnum.cs index 71fd801b..2e1f0bfc 100644 --- a/BPASmartClient.SCADAControl/EnumClass/DataTypeEnum.cs +++ b/BPASmartClient.SCADAControl/EnumClass/DataTypeEnum.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.SCADAControl.EnumClass +namespace BPASmartClient.SCADAControl { /// /// 数据来源类型 @@ -46,4 +47,156 @@ namespace BPASmartClient.SCADAControl.EnumClass GET, PUT } + + /// + /// 数据类型枚举 + /// + public enum EDataType + { + Bool = 1, + Byte = 2, + Int = 3, + Word = 4, + Dint = 5, + Dword = 6, + Float = 7, + Double = 8, + String = 9, + } + + public class ReeisDataModel + { + public string VarName { get; set; } + public string VarVaule { get; set; } + public EDataType DataType { get; set; } + } + + public class PublishModel + { + /// + /// 设备名称 + /// + public string DeviceName { get; set; } = string.Empty; + + /// + /// 变量实际地址 + /// + public string RealAddress { get; set; } = string.Empty; + + /// + /// 变量名称 + /// + public string VarName { get; set; } = string.Empty; + + /// + /// 变量长度 + /// + public int Length { get; set; } = 1; + + /// + /// 变量当前值 + /// + public string Value { get; set; } = string.Empty; + + /// + /// 变量数据类型 + /// + public EDataType DataType { get; set; } + + } + public class PublishInfo + { + public List PublishModels { get; set; } = new List(); + } + + /// + /// 通讯参数配置 + /// + public class CommunicationPar + { + public ObservableCollection CommunicationDevices { get; set; } = new ObservableCollection(); + } + + public class CommunicationModel + { + /// + /// 是否激活 + /// + public bool IsActive { get { return _mIsActive; } set { _mIsActive = value;} } + private bool _mIsActive = true; + + + /// + /// 新增设备名称 + /// + public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; } } + private string _mDeviceName; + + /// + /// 通讯模块名称 + /// + public string ModelName { get { return _mModelName; } set { _mModelName = value; } } + private string _mModelName; + + /// + /// 变量表数据 + /// + public ObservableCollection VarTableModels { get; set; } = new ObservableCollection(); + + } + + public class VariableInfo + { + public VariableInfo(params object[] s) + { + + } + + public int ID { get { return _mID; } set { _mID = value; } } + private int _mID; + + /// + /// 变量名 + /// + public string VarName + { + get { return _mVarName.Trim()?.Replace(" ", ""); } + set + { + _mVarName = value; + } + } + private string _mVarName = string.Empty; + + /// + /// 地址 + /// + public string Address + { + get { return _mAddress.Trim()?.Replace(" ", "").ToUpper(); } + set + { + _mAddress = value; + } + } + private string _mAddress = string.Empty; + + /// + /// 实际地址 + /// + public string RealAddress { get; set; } + + /// + /// 数据类型 + /// + public string DataType { get { return _mDataType; } set { _mDataType = value; } } + private string _mDataType = string.Empty; + + /// + /// 是否启用报警 + /// + public bool IsEnableAlarm { get { return _mIsEnableAlarm; } set { _mIsEnableAlarm = value; } } + private bool _mIsEnableAlarm; + + } } diff --git a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs index add8f814..c7fe6e53 100644 --- a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs +++ b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs @@ -1,33 +1,22 @@ using BeDesignerSCADA.Common; using BeDesignerSCADA.View; -using Newtonsoft.Json; using BeDesignerSCADA.ViewModel; -using BPASmart.Model; -using BPASmartClient.Compiler; +using Newtonsoft.Json; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; using System.IO; using System.Linq; using System.Reflection; using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Media.Effects; -using BeDesignerSCADA.Helper; namespace BeDesignerSCADA.Controls { diff --git a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs index 76c1476f..f98ed805 100644 --- a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs +++ b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs @@ -1,29 +1,21 @@ using BeDesignerSCADA.Common; using BeDesignerSCADA.View; using BeDesignerSCADA.ViewModel; -using BPASmart.Model; -using BPASmartClient.Compiler; using System; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using System.Linq; using System.Reflection; using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; namespace BeDesignerSCADA.Controls { diff --git a/BeDesignerSCADA/View/PropertyBindingWindow.xaml.cs b/BeDesignerSCADA/View/PropertyBindingWindow.xaml.cs index 013bcea3..567798d7 100644 --- a/BeDesignerSCADA/View/PropertyBindingWindow.xaml.cs +++ b/BeDesignerSCADA/View/PropertyBindingWindow.xaml.cs @@ -1,20 +1,11 @@ using BeDesignerSCADA.Common; using BeDesignerSCADA.ViewModel; -using BPASmart.Model; +using BPASmartClient.SCADAControl; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; 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 BeDesignerSCADA.View { diff --git a/BeDesignerSCADA/ViewModel/DataBusModel.cs b/BeDesignerSCADA/ViewModel/DataBusModel.cs index 248817f4..fc660efd 100644 --- a/BeDesignerSCADA/ViewModel/DataBusModel.cs +++ b/BeDesignerSCADA/ViewModel/DataBusModel.cs @@ -1,12 +1,8 @@ -using BPASmart.Model; +using BPASmartClient.SCADAControl; using Newtonsoft.Json; using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace BeDesignerSCADA.ViewModel { diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 17eb8f26..14d92d8f 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -32,6 +32,7 @@ namespace FryPot_DosingSystem SystemHelper.GetInstance.CreateDesktopShortcut(); MenuInite(); LoginDataInite(); + Json.Read(); MainView mv = new MainView(); LoginView lv = new LoginView(); var res = lv.ShowDialog(); @@ -48,10 +49,10 @@ namespace FryPot_DosingSystem MessageNotify.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机"); } //开启实时PLC数据读取 - DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 + DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 AlarmHelper.Init();//报警实时监控 HubHelper.GetInstance.Connect("172.16.12.100", 8089); - + } else mv.Close(); diff --git a/FryPot_DosingSystem/Control/DeviceOperate.cs b/FryPot_DosingSystem/Control/DeviceOperate.cs index 15e21ea1..5f86e0e3 100644 --- a/FryPot_DosingSystem/Control/DeviceOperate.cs +++ b/FryPot_DosingSystem/Control/DeviceOperate.cs @@ -54,15 +54,11 @@ namespace FryPot_DosingSystem.Control Init(); Connect(); ReadData(); - ConnectStatusMonitor(); - } - - private void ConnectStatusMonitor() - { - } + + public void Init() { Variables.Clear(); @@ -181,11 +177,11 @@ namespace FryPot_DosingSystem.Control switch (DeviceName) { case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break; - //case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break; - //case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break; - //case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break; - //case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break; - //case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break; + case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break; + case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break; + case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break; + case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break; + case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break; } } @@ -414,19 +410,18 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void WritePotOnePlcData(string address,object value ) - { - - + public void WritePotOnePlcData(string address,ushort value ) + { + fryOneModbus.Write(address,value); } /// /// 炒锅2工艺数据 /// /// /// - public void WritePotTwoPlcData(string address, object value) + public void WritePotTwoPlcData(string address, ushort value) { - + fryTwoModbus.Write(address, value); } /// @@ -434,9 +429,9 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void WritePotThreePlcData(string address, object value) + public void WritePotThreePlcData(string address, ushort value) { - + fryThreeModbus.Write(address, value); } /// @@ -444,10 +439,10 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void WritePotFourPlcData(string address, object value) + public void WritePotFourPlcData(string address, ushort value) { - + fryFourModbus.Write(address,value); } /// /// 炒锅5工艺数据 @@ -456,7 +451,7 @@ namespace FryPot_DosingSystem.Control /// public void WritePotFivePlcData(string address, object value) { - + fryFiveModbus.Write(address, value); } public ConcurrentDictionary GetAllData() diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 2f2b9d17..c961fc70 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -158,6 +158,8 @@ namespace FryPot_DosingSystem.Control Dictionary agvCode = new Dictionary() { { "ZT11-21", 1 }, { "ZT11-22", 2 }, { "ZT11-23", 3 }, { "ZT11-24", 4 } };//agv小车的编号对AGV动画小车编号 private static readonly object Obj_Lock = new object();//3条滚筒线洗桶线程互斥锁 + + private static readonly object Pot_Lock = new object();//炒股工艺工艺下发锁 public int CleanNum = 0;//当前清洗台桶数 #endregion @@ -437,7 +439,7 @@ namespace FryPot_DosingSystem.Control ReadPlcData(); SaveFryPotData(); MainTask(); - CommandRegist(); + // CommandRegist(); } /// /// 文件数据定期清理 @@ -855,7 +857,62 @@ namespace FryPot_DosingSystem.Control { if (objData.state == "ABNORMAL_COMPLETED") { - MessageBox.Show("任务异常完成"); + if (objData.robotJobId == LOnerobotJobId) + { + globalVar.LineOneRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + } + if (objData.robotJobId == LTworobotJobId) + { + globalVar.LineTwoRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + } + if (objData.robotJobId == LThreerobotJobId) + { + globalVar.LineThreeRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + + } + if (objData.robotJobId == LFourrobotJobId) + { + globalVar.LineFourRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + } + if (objData.robotJobId == LFiverobotJobId) + { + globalVar.LineFiveRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + } + if (objData.robotJobId == LSixrobotJobId) + { + globalVar.LineSixRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + } + if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null) + { + globalVar.LineSevenRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + + } + if (LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null) + { + globalVar.LineEightRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + + } + if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null) + { + globalVar.LineNineRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + + } + if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null) + { + globalVar.LineTenRobotTaskError = true; + MessageNotify.GetInstance.ShowRunLog($"编号【{objData.jobData.agvCode}】AGV小车任务【{objData.robotJobId}】执行异常,请人工介入"); + + } + } #region 线体上下料任务信息回报 //线体1任务上报 @@ -1193,7 +1250,7 @@ namespace FryPot_DosingSystem.Control if (objData.state == "LOAD_COMPLETED" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "TitRYC")//指定上料位置上料完成,指清戏台空桶到上料 { DeviceOperate.GetInstance.WritePlcData("D1066", 0); - globalVar.AllowNextEmptyRollerToClean = true; + // globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志 MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成"); AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);//去四号空桶线 @@ -1276,61 +1333,87 @@ namespace FryPot_DosingSystem.Control { ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() => { + WritePlcData("D1101", 0);//复位开始执行指令 ActionManage.GetInstance.Send("ClearOneRecipes"); - globalVar.rollerLineOne = null; - globalVar.rollerLineOne = new RollerLineOne(); - globalVar.fryPotOne = null; - globalVar.fryPotOne = new FryPotOne(); - globalVar.fryPotFour = null; - globalVar.fryPotFour = new FryPotFour(); + //globalVar.rollerLineOne = null; + //globalVar.rollerLineOne = new RollerLineOne(); + //globalVar.fryPotOne = null; + //globalVar.fryPotOne = new FryPotOne(); + //globalVar.fryPotFour = null; + //globalVar.fryPotFour = new FryPotFour(); + + globalVar.rollerLineOne.RecipeComMidSingle = 1; + globalVar.rollerLineOne.LowSignalJude = false; + globalVar.rollerLineOne.NextStart = false; + globalVar.rollerLineOne.IsEpmtyBefore = false; + globalVar.rollerLineOne.CanRun = true; + globalVar.ExitLineOneTask = false; + + globalVar.LOneCurrentRecipeName = string.Empty; + globalVar.AllowAgvToLineLoadRoller = true; globalVar.InOrOutputLock = false; - globalVar.LOneCurrentRecipeName = string.Empty; globalVar.LoadRoller = false; globalVar.AgvToFryPot = false; globalVar.PotOneInputMaterialArrive = false; globalVar.PotOneOutputRollerArrive = false; globalVar.AgvArrivePot = false; + globalVar.LOneMaterialNum = 0; - globalVar.LOneFryPotSerial = 1; globalVar.LOneCurrentCookingStep = 0; - globalVar.agvArriveUpLoad = false; - globalVar.agvArriveUnLoad = false; - globalVar.agvFryPotEmptyRollerArrive = false; - globalVar.agvLineOneLoadCom = false; + + //globalVar.agvArriveUpLoad = false; + //globalVar.agvArriveUnLoad = false; + //globalVar.agvFryPotEmptyRollerArrive = false; + //globalVar.agvLineOneLoadCom = false; + ErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); MessageNotify.GetInstance.ShowUserLog("滚筒线【1】任务重启成功"); + })); } public void LineTwoTaskRestart() { ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() => { + WritePlcData("D1102", 0);//复位开始执行指令 ActionManage.GetInstance.Send("ClearTwoRecipes"); - globalVar.rollerLineTwo = null; - globalVar.rollerLineTwo = new RollerLineTwo(); - globalVar.fryPotTwo = null; - globalVar.fryPotTwo = new FryPotTwo(); - globalVar.fryPotFive = null; - globalVar.fryPotFive = new FryPotFive(); + //globalVar.rollerLineTwo = null; + //globalVar.rollerLineTwo = new RollerLineTwo(); + //globalVar.fryPotTwo = null; + //globalVar.fryPotTwo = new FryPotTwo(); + //globalVar.fryPotFive = null; + //globalVar.fryPotFive = new FryPotFive(); + globalVar.rollerLineTwo.RecipeComMidSingle = 1; + globalVar.rollerLineTwo.LowSignalJude = false; + globalVar.rollerLineTwo.NextStart = false; + globalVar.rollerLineTwo.IsEpmtyBefore = false; + globalVar.rollerLineTwo.CanRun = true; + + globalVar.ExitLineTwoTask = false; + + globalVar.LTwoCurrentRecipeName = string.Empty; + globalVar.AllowAgvToLineTwoLoadRoller = true; globalVar.LTwoInOrOutputLock = false; - globalVar.LTwoCurrentRecipeName = string.Empty; + globalVar.LTwoLoadRoller = false; globalVar.LTwoAgvToFryPot = false; globalVar.LTwoPotInputMaterialArrive = false; globalVar.LTwoPotOutputRollerArrive = false; globalVar.LTwoAgvArrivePot = false; + globalVar.LTwoMaterialNum = 0; - globalVar.LTwoFryPotSerial = 2; globalVar.LTwoCurrentCookingStep = 0; - globalVar.agvArriveLTwoUpLoad = false; - globalVar.LTwoagvArriveUnLoad = false; - globalVar.LTwoagvFryPotEmptyRollerArrive = false; - globalVar.agvLineTwoLoadCom = false; + + //globalVar.agvArriveLTwoUpLoad = false; + //globalVar.LTwoagvArriveUnLoad = false; + //globalVar.LTwoagvFryPotEmptyRollerArrive = false; + //globalVar.agvLineTwoLoadCom = false; + LTwoErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); MessageNotify.GetInstance.ShowUserLog("滚筒线【2】任务重启成功"); @@ -1340,27 +1423,39 @@ namespace FryPot_DosingSystem.Control { ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() => { + WritePlcData("D1103", 0);//复位开始执行指令 ActionManage.GetInstance.Send("ClearThreeRecipes"); - globalVar.rollerLineThree = null; - globalVar.rollerLineThree = new RollerLineThree(); - globalVar.fryPotThree = null; - globalVar.fryPotThree = new FryPotThree(); + //globalVar.rollerLineThree = null; + //globalVar.rollerLineThree = new RollerLineThree(); + //globalVar.fryPotThree = null; + //globalVar.fryPotThree = new FryPotThree(); + globalVar.rollerLineTwo.RecipeComMidSingle = 1; + globalVar.rollerLineTwo.LowSignalJude = false; + globalVar.rollerLineTwo.NextStart = false; + globalVar.rollerLineTwo.IsEpmtyBefore = false; + globalVar.rollerLineTwo.CanRun = true; + globalVar.ExitLineThreeTask = false; + globalVar.AllowAgvToLineThreeLoadRoller = true; globalVar.LThreeInOrOutputLock = false; + globalVar.LThreeCurrentRecipeName = string.Empty; + globalVar.LThreeLoadRoller = false; globalVar.LThreeAgvToFryPot = false; globalVar.LThreePotInputMaterialArrive = false; globalVar.LThreePotOutputRollerArrive = false; globalVar.LThreeAgvArrivePot = false; + globalVar.LThreeMaterialNum = 0; - globalVar.LThreeFryPotSerial = 3; globalVar.LThreeCurrentCookingStep = 0; - globalVar.agvArriveLThreeUpLoad = false; - globalVar.LThreeagvArriveUnLoad = false; - globalVar.LThreeagvFryPotEmptyRollerArrive = false; - globalVar.agvLineThreeLoadCom = false; + + //globalVar.agvArriveLThreeUpLoad = false; + //globalVar.LThreeagvArriveUnLoad = false; + //globalVar.LThreeagvFryPotEmptyRollerArrive = false; + //globalVar.agvLineThreeLoadCom = false; + LThreeErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); MessageNotify.GetInstance.ShowUserLog("滚筒线【3】任务重启成功"); })); @@ -1372,9 +1467,9 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineOne.StationEight = 0; globalVar.rollerLineOne.EmptyRollerNums.Clear(); - globalVar.rollerLineOne.EmptyRollerNums.Add(108); + globalVar.rollerLineOne.IsEpmtyBefore = false; - // globalVar.rollerLineOne.CanRun = true; + globalVar.rollerLineOne.CanRun = true; globalVar.agvArriveLineFour = false; globalVar.agvArriveCleanLoad = false; @@ -1394,9 +1489,9 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineTwo.StationEight = 0; globalVar.rollerLineTwo.EmptyRollerNums.Clear(); - globalVar.rollerLineTwo.EmptyRollerNums.Add(208); + globalVar.rollerLineTwo.IsEpmtyBefore = false; - //globalVar.rollerLineTwo.CanRun = true; + globalVar.rollerLineTwo.CanRun = true; globalVar.agvArriveLineFour = false; @@ -1416,9 +1511,9 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineThree.StationEight = 0; globalVar.rollerLineThree.EmptyRollerNums.Clear(); - globalVar.rollerLineThree.EmptyRollerNums.Add(308); + globalVar.rollerLineThree.IsEpmtyBefore = false; - //globalVar.rollerLineThree.CanRun = true; + globalVar.rollerLineThree.CanRun = true; globalVar.agvArriveLineFour = false; globalVar.agvArriveCleanLoad = false; @@ -1596,29 +1691,177 @@ namespace FryPot_DosingSystem.Control })); //炒锅1状态数据 - //GetFryOneData("D2001", new Action(data => - //{ - // //FryPotMonitorManage.GetInstance.fryOne.Temperature =?; - //})); + GetFryOneData("D0258", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.Temperature = data[0] / 10.0; + })); + GetFryOneData("D0510", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.SmallFire = data[0]; + })); + GetFryOneData("D0512", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.MidFire = data[0]; + })); + GetFryOneData("D0514", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.BigFire = data[0]; + })); + GetFryOneData("D0516", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.StrongFire = data[0]; + })); + GetFryOneData("D2500", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.Speed = data[0] / 10.0; + })); + GetFryOneData("D0600", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.FryPotWeight = data[0] / 10.0; + })); + GetFryOneData("D3000", new Action(data => + { + FryPotMonitorManage.GetInstance.fryOne.Step = data[0]; + })); ////炒锅2状态数据 - //GetFryTwoData("D2001", new Action(data => - //{ + GetFryTwoData("D0258", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.Temperature = data[0] / 10.0; + })); + GetFryTwoData("D0510", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.SmallFire = data[0]; + })); + GetFryTwoData("D0512", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.MidFire = data[0]; + })); + GetFryTwoData("D0514", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.BigFire = data[0]; + })); + GetFryTwoData("D0516", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.StrongFire = data[0]; + })); + GetFryTwoData("D2500", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.Speed = data[0] / 10.0; + })); + GetFryTwoData("D0600", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight = data[0] / 10.0; + })); + GetFryTwoData("D3000", new Action(data => + { + FryPotMonitorManage.GetInstance.fryTwo.Step = data[0]; + })); + - //})); ////炒锅3状态数据 - //GetFryThreeData("D2001", new Action(data => - //{ + GetFryThreeData("D0258", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.Temperature = data[0] / 10.0; + })); + GetFryThreeData("D0510", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.SmallFire = data[0]; + })); + GetFryThreeData("D0512", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.MidFire = data[0]; + })); + GetFryThreeData("D0514", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.BigFire = data[0]; + })); + GetFryThreeData("D0516", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.StrongFire = data[0]; + })); + GetFryThreeData("D2500", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.Speed = data[0] / 10.0; + })); + GetFryThreeData("D0600", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.FryPotWeight = data[0] / 10.0; + })); + GetFryThreeData("D3000", new Action(data => + { + FryPotMonitorManage.GetInstance.fryThree.Step = data[0]; + })); //})); ////炒锅4状态数据 - //GetFryFourData("D2001", new Action(data => - //{ + GetFryFourData("D0258", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.Temperature = data[0] / 10.0; + })); + GetFryFourData("D0510", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.SmallFire = data[0]; + })); + GetFryFourData("D0512", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.MidFire = data[0]; + })); + GetFryFourData("D0514", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.BigFire = data[0]; + })); + GetFryFourData("D0516", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.StrongFire = data[0]; + })); + GetFryFourData("D2500", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + })); + GetFryFourData("D0600", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.FryPotWeight = data[0] / 10.0; + })); + GetFryFourData("D3000", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.Step = data[0]; + })); //})); ////炒锅5状态数据 - //GetFryFiveData("D2001", new Action(data => - //{ + GetFryFiveData("D0258", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.Temperature = data[0] / 10.0; + })); + GetFryFiveData("D0510", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.SmallFire = data[0]; + })); + GetFryFiveData("D0512", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.MidFire = data[0]; + })); + GetFryFiveData("D0514", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.BigFire = data[0]; + })); + GetFryFiveData("D0516", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.StrongFire = data[0]; + })); + GetFryFiveData("D2500", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + })); + GetFryFiveData("D0600", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.FryPotWeight = data[0] / 10.0; + })); + GetFryFiveData("D3000", new Action(data => + { + FryPotMonitorManage.GetInstance.fryFive.Step = data[0]; + })); //})); //线体上放空桶 @@ -1661,32 +1904,32 @@ namespace FryPot_DosingSystem.Control } //是否手动复位PLC } - //炒锅状态数据 - if (globalVar.fryPotOne.OilConfirm == 1) - { - FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity; - FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity; - } - if (globalVar.fryPotTwo.OilConfirm == 1) - { - FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity; - FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity; - } - if (globalVar.fryPotThree.OilConfirm == 1) - { - FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity; - FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity; - } - if (globalVar.fryPotFour.OilConfirm == 1) - { - FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity; - FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity; - } - if (globalVar.fryPotFive.OilConfirm == 1) - { - FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; - FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; - } + ////炒锅状态数据 + //if (globalVar.fryPotOne.OilConfirm == 1) + //{ + // FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity; + // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity; + //} + //if (globalVar.fryPotTwo.OilConfirm == 1) + //{ + // FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity; + // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity; + //} + //if (globalVar.fryPotThree.OilConfirm == 1) + //{ + // FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity; + // FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity; + //} + //if (globalVar.fryPotFour.OilConfirm == 1) + //{ + // FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity; + // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity; + //} + //if (globalVar.fryPotFive.OilConfirm == 1) + //{ + // FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; + // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; + //} //炒锅状态实时显示 FryPotStatusDisplay(); RollerLineStatusDisplay(); @@ -1700,41 +1943,61 @@ namespace FryPot_DosingSystem.Control private void FryPotStatusDisplay() { FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString(); - FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.SmallFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.MidFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.BigFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.StrongFire.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Step.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString(); - FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.SmallFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.MidFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.BigFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.StrongFire.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Step.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString(); - FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.SmallFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.MidFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.BigFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.StrongFire.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Step.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString(); - FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.SmallFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.MidFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.BigFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.StrongFire.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Step.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString(); - FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSmallFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.SmallFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveMidFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.MidFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveBigFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.BigFire.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveStrongFire").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.StrongFire.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveProcessStep").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Step.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString(); FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString(); @@ -1765,7 +2028,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1781,7 +2044,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryOne.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryOne.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryOne.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryOne.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1801,7 +2064,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1817,7 +2080,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryTwo.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryTwo.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryTwo.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryTwo.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1837,7 +2100,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1853,7 +2116,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryThree.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryThree.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryThree.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryThree.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1873,7 +2136,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1889,7 +2152,21 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotFourStatus p1 = new PotFourStatus + { + Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, + SmallFire = FryPotMonitorManage.GetInstance.fryFour.SmallFire, + MidFire = FryPotMonitorManage.GetInstance.fryFour.MidFire, + BigFire = FryPotMonitorManage.GetInstance.fryFour.BigFire, + StrongFire = FryPotMonitorManage.GetInstance.fryFour.StrongFire, + Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, + FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, + OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, + TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, + TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, + RecipeName = fryFourRecipe, + Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1909,7 +2186,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1925,7 +2202,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, SmallFire = FryPotMonitorManage.GetInstance.fryFive.SmallFire, MidFire = FryPotMonitorManage.GetInstance.fryFive.MidFire, BigFire = FryPotMonitorManage.GetInstance.fryFive.BigFire, StrongFire = FryPotMonitorManage.GetInstance.fryFive.StrongFire, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -2074,7 +2351,7 @@ namespace FryPot_DosingSystem.Control } } /// - /// 写Plc数据 + /// 滚筒线写Plc数据 /// /// /// @@ -2082,16 +2359,28 @@ namespace FryPot_DosingSystem.Control { DeviceOperate.GetInstance.WritePlcData(address, Value); } + /// - /// 初始化任务 + /// 炒锅写Plc数据 /// - //public void IniteTask() - //{ - // ThreadManage.GetInstance().StartLong(new Action(() => - // { - // MainTask(); - // }), "MainTask"); - //} + /// + /// + /// + public void WritePotData(int potNum, string address, ushort value) + { + switch (potNum) + { + case 1: DeviceOperate.GetInstance.WritePotOnePlcData(address, value); break; + case 2: DeviceOperate.GetInstance.WritePotTwoPlcData(address, value); break; + case 3: DeviceOperate.GetInstance.WritePotThreePlcData(address, value); break; + case 4: DeviceOperate.GetInstance.WritePotFourPlcData(address, value); break; + case 5: DeviceOperate.GetInstance.WritePotFivePlcData(address, value); break; + + } + + } + + /// /// 配方数据接收 /// @@ -2182,7 +2471,6 @@ namespace FryPot_DosingSystem.Control /// public void LineOneProcessExecute() { - LOneRecipeDataToPlc(); LineOneRecipeExecuteConfirm(); LOneLoadRoller(); @@ -2257,7 +2545,7 @@ namespace FryPot_DosingSystem.Control } private void CleanPlateUpLoad() { - if (globalVar.agvArriveCleanLoad) + if (globalVar.agvArriveCleanLoad || globalVar.LineTenRobotTaskError) { globalVar.agvArriveCleanLoad = false; MessageNotify.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); @@ -2288,10 +2576,14 @@ namespace FryPot_DosingSystem.Control { if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障 { + if (TTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + { + MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为普通洗桶模式"); + } if (globalVar.rollerLineOne.WashEmptyRollerModel == 0) { - + try { lock (Obj_Lock) @@ -2388,8 +2680,13 @@ namespace FryPot_DosingSystem.Control // 线体2到清洗台 if (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//输送线无故障 { + if (TTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + { + MessageNotify.GetInstance.ShowRunLog($"2号滚筒线切换为普通洗桶模式"); + } if (globalVar.rollerLineTwo.WashEmptyRollerModel == 0) { + try { lock (Obj_Lock) @@ -2487,8 +2784,13 @@ namespace FryPot_DosingSystem.Control //线体3到清洗台 if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障 { + if (TTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + { + MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为普通洗桶模式"); + } if (globalVar.rollerLineThree.WashEmptyRollerModel == 0) { + try { lock (Obj_Lock) @@ -2579,13 +2881,14 @@ namespace FryPot_DosingSystem.Control /// private void AgvArriveCleanPlateFromLineOne() { - if (globalVar.rollerLineOne.agvArriveCleanUnLoad) + if (globalVar.rollerLineOne.agvArriveCleanUnLoad||globalVar.LineSevenRobotTaskError) { globalVar.rollerLineOne.agvArriveCleanUnLoad = false; MessageNotify.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); erp: if (AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0) { + globalVar.LineSevenRobotTaskError = false;//AGV故障信号复位 //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2611,13 +2914,14 @@ namespace FryPot_DosingSystem.Control private void AgvArriveCleanPlateFromLineTwo() { - if (globalVar.rollerLineTwo.agvArriveCleanUnLoad) + if (globalVar.rollerLineTwo.agvArriveCleanUnLoad || globalVar.LineEightRobotTaskError) { globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; MessageNotify.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶"); erp: if (AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0) { + globalVar.LineEightRobotTaskError = false;//AGV故障信号复位 //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2643,12 +2947,13 @@ namespace FryPot_DosingSystem.Control private void AgvArriveCleanPlateFromLineThree() { - if (globalVar.rollerLineThree.agvArriveCleanUnLoad) + if (globalVar.rollerLineThree.agvArriveCleanUnLoad || globalVar.LineNineRobotTaskError) { globalVar.rollerLineThree.agvArriveCleanUnLoad = false; MessageNotify.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶"); erp: if (AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 0) { + globalVar.LineNineRobotTaskError = false;//AGV故障信号复位 //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC @@ -2681,10 +2986,8 @@ namespace FryPot_DosingSystem.Control { if (RTrig.GetInstance("呼叫AGV").Start(Convert.ToBoolean(globalVar.CleanComplete))) { - //DeviceOperate.GetInstance.WritePlcData("D2076",0); - //Thread.Sleep(800); - //是否需要手动给PLC置位?? - // globalVar.CleanComplete = 0; + + globalVar.AllowNextEmptyRollerToClean = true;//AGV到滚筒线搬运空桶的允许标志 e: string id = Guid.NewGuid().ToString("D"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; @@ -2711,7 +3014,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineThree.RecipeComMidSingle = 1; if (globalVar.LThreeCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); + MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方所有料桶已送达炒锅"); + ResetPotData(3); WritePlcData("D2103", 0); WritePlcData("D1103", 0);//复位开始执行指令 PlcLineThreeRecipeDataReset(); @@ -2727,58 +3031,98 @@ namespace FryPot_DosingSystem.Control //Sqlite.GetInstance.Save();//保存数据 } globalVar.LThreeCurrentRecipeName = string.Empty; - Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); + // Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); } } + if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle))) + Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1 && globalVar.rollerLineThree.WashEmptyRollerModel == 0)//后续添加其它限制条件 { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; })); - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection(); })); - AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop); - WritePlcData("D2103", 0); - WritePlcData("D1103", 0);//复位开始执行指令 - //清空配方数据队列 - PlcLineThreeRecipeDataReset();//PLC复位 - Thread.Sleep(800); - //if (globalVar.LThreeCurrentRecipeName != string.Empty) - // MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); - if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result)) - { - LThreeErrorRecipe = false; - int headNum = result.materialCollection[0].MaterialLoc / 100; - globalVar.LThreeMaterialNum = result.materialCollection.Count; - globalVar.LThreeFryPotSerial = headNum; - globalVar.LThreeCurrentRecipeName = result.RecipeName; - - AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString()); - MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方"); - for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 - { - //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3) - //{ + if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle)) || globalVar.LThreeFryPotSerial == 0 || globalVar.fryPotThree.ProcessStep == 0) + { + if (globalVar.LThreeCurrentRecipeName != string.Empty) + { + // globalVar.LThreeCurrentRecipeName = string.Empty; + Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); + } + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; })); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection(); })); + AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop); + ResetPotData(3); + WritePlcData("D2103", 0); + WritePlcData("D1103", 0);//复位开始执行指令 + //清空配方数据队列 + PlcLineThreeRecipeDataReset();//PLC复位 + Thread.Sleep(800); + + if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result)) + { + LThreeErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LThreeMaterialNum = result.materialCollection.Count; + globalVar.LThreeFryPotSerial = headNum; + globalVar.LThreeCurrentRecipeName = result.RecipeName; + + AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString()); + MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方"); fryThreeRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; })); - //将配方中原料加入新的队列 - LThreeInputMaterialQuene.Enqueue(new MaterialInfo() + for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发 - //} - //else - //{ - // MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // LThreeInputMaterialQuene.Clear(); - // LThreeErrorRecipe = true; - // return; - //} - } - DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据 - // globalVar.rollerLineThree.RecipeComMidSingle = 0; - WritePlcData("D1103", 1);//配方开始执行命令 - globalVar.rollerLineThree.LowSignalJude = true; + //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3) + //{ + + //将配方中原料加入新的队列 + LThreeInputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发 + + + + //} + // else + //{ + // MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + // MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + // LThreeInputMaterialQuene.Clear(); + // LThreeErrorRecipe = true; + // return; + //} + } + #region 炒股用油量记录 + try + { + if (result.FlowProcess.fpModels.Count > 0) + { + FryPotMonitorManage.GetInstance.fryThree.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight; + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryThree.OilCapacity; + FryPotRecipeSetDown(headNum, result);//炒锅工艺数据下发 + } + else + { + MessageNotify.GetInstance.ShowUserLog($"3号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消"); + LThreeRecipeQuene.Clear(); + LThreeInputMaterialQuene.Clear(); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); })); + return; + } + } + catch (Exception) + { + return; + + //throw; + } + #endregion + DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据 + // globalVar.rollerLineThree.RecipeComMidSingle = 0; + WritePlcData("D1103", 1);//配方开始执行命令 + globalVar.rollerLineThree.LowSignalJude = true; + } } } //else if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel))) @@ -2802,7 +3146,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineTwo.RecipeComMidSingle = 1; if (globalVar.LTwoCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); + MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方所有料桶已送达炒锅"); + ResetPotData(globalVar.LTwoFryPotSerial); WritePlcData("D2102", 0); WritePlcData("D1102", 0);//复位开始执行指令 PlcLineTwoRecipeDataReset(); @@ -2828,45 +3173,53 @@ namespace FryPot_DosingSystem.Control //Sqlite.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 //Sqlite.GetInstance.Save();//保存数据 } - globalVar.LTwoCurrentRecipeName = string.Empty; - Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; }); + globalVar.LTwoCurrentRecipeName = string.Empty; + // Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; }); } } - + if (RTrig.GetInstance("炒锅2配方完成").Start(Convert.ToBoolean(globalVar.fryPotTwo.RecipeCompleteSingle))) + Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; }); + if (RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle))) + Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; }); if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1 && globalVar.rollerLineTwo.WashEmptyRollerModel == 0)//后续添加其它限制条件 { - if (globalVar.LTwoFryPotSerial == 2) - { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; })); - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection(); })); - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); - } - if (globalVar.LTwoFryPotSerial == 5) + + if ((LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 2 && RTrig.GetInstance("炒锅2配方完成").Start(Convert.ToBoolean(globalVar.fryPotTwo.RecipeCompleteSingle))) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 5 && RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle))) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 2 && globalVar.fryPotFive.ProcessStep == 0) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotTwo.ProcessStep == 0) || globalVar.LTwoFryPotSerial == 0 || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial == 5 && globalVar.fryPotFive.ProcessStep == 0)|| (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LTwoFryPotSerial && globalVar.LTwoFryPotSerial ==2 && globalVar.fryPotTwo.ProcessStep == 0)) { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; })); - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection(); })); - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); - } - //if (globalVar.LTwoCurrentRecipeName != string.Empty) - // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); - WritePlcData("D2102", 0); - WritePlcData("D1102", 0);//复位开始执行指令 - //清空配方数据队列 - PlcLineTwoRecipeDataReset();//PLC复位 - Thread.Sleep(800); - if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result)) - { - LTwoErrorRecipe = false; - int headNum = result.materialCollection[0].MaterialLoc / 100; - globalVar.LTwoMaterialNum = result.materialCollection.Count; - globalVar.LTwoFryPotSerial = headNum; - globalVar.LTwoCurrentRecipeName = result.RecipeName; - AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString()); - MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方"); - for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 - { - //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5)) - //{ + if (globalVar.LTwoFryPotSerial == 2) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = string.Empty; })); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows = new ObservableCollection(); })); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); + + Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; }); + } + if (globalVar.LTwoFryPotSerial == 5) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = string.Empty; })); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection(); })); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); + + Task.Run(() => { Thread.Sleep(1500); fryFiveRecipe = string.Empty; }); + } + //if (globalVar.LTwoCurrentRecipeName != string.Empty) + // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); + + + WritePlcData("D2102", 0); + WritePlcData("D1102", 0);//复位开始执行指令 + //清空配方数据队列 + PlcLineTwoRecipeDataReset();//PLC复位 + + if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result)) + { + LTwoErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LTwoMaterialNum = result.materialCollection.Count; + globalVar.LTwoFryPotSerial = headNum; + globalVar.LTwoCurrentRecipeName = result.RecipeName; + AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString()); + MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方"); if (headNum == 2)//炒锅2 { fryTwoRecipe = result.RecipeName;//炒锅状态开始记录 @@ -2877,35 +3230,99 @@ namespace FryPot_DosingSystem.Control fryFiveRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; })); } - //将配方中原料加入新的队列 - LTwoInputMaterialQuene.Enqueue(new MaterialInfo() + ResetPotData(globalVar.LTwoFryPotSerial); + Thread.Sleep(800); + for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发 - //} - //else - //{ - // MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // LTwoInputMaterialQuene.Clear(); - // LTwoErrorRecipe = true; - // return; - //} - } - DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据 - //globalVar.rollerLineTwo.RecipeComMidSingle = 0; - WritePlcData("D1102", 1);//配方开始执行命令 - globalVar.rollerLineTwo.LowSignalJude = true; - } - //else if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) - //{ - // MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方"); - // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); })); - // LTwoRecipeQuene.Clear(); - //} + //if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5)) + //{ + + //将配方中原料加入新的队列 + LTwoInputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发 + + + + //} + //else + //{ + // MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + // MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + // LTwoInputMaterialQuene.Clear(); + // LTwoErrorRecipe = true; + // return; + //} + } + #region 炒股用油量记录 + //if (headNum == 2) + //{ + // try + // { + // if (result.FlowProcess.fpModels.Count > 0) + // { + // FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight; + // FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryTwo.OilCapacity; + // FryPotRecipeSetDown(headNum, result);//炒锅工艺下发 + // } + // else + // { + // MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消"); + // LTwoRecipeQuene.Clear(); + // LTwoInputMaterialQuene.Clear(); + // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); })); + // return; + // } + // } + // catch (Exception) + // { + // return; + // // throw; + // } + //} + //else + //{ + // try + // { + // if (result.FlowProcess.fpModels.Count > 0) + // { + // FryPotMonitorManage.GetInstance.fryFive.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight; + // FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFive.OilCapacity; + // FryPotRecipeSetDown(headNum, result);//炒锅工艺下发 + // } + // else + // { + // MessageNotify.GetInstance.ShowUserLog($"2号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消"); + // LTwoRecipeQuene.Clear(); + // LTwoInputMaterialQuene.Clear(); + // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); })); + // return; + // } + // } + // catch (Exception) + // { + // return; + // // throw; + // } + //} + #endregion + DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据 + //globalVar.rollerLineTwo.RecipeComMidSingle = 0; + WritePlcData("D1102", 1);//配方开始执行命令 + globalVar.rollerLineTwo.LowSignalJude = true; + } + + } } + //else if (RTrig.GetInstance("LineTwoModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + //{ + // MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方"); + // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); })); + // LTwoRecipeQuene.Clear(); + //} } /// @@ -2918,7 +3335,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.RecipeComMidSingle = 1; if (globalVar.LOneCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成"); + MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方所有料桶已送达炒锅"); + ResetPotData(globalVar.LOneFryPotSerial); WritePlcData("D2101", 0); WritePlcData("D1101", 0);//复位开始执行指令 PlcLineOneRecipeDataReset(); @@ -2945,42 +3363,51 @@ namespace FryPot_DosingSystem.Control //Sqlite.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 //Sqlite.GetInstance.Save();//保存数据 } - globalVar.LOneCurrentRecipeName = string.Empty; - Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; }); + globalVar.LOneCurrentRecipeName = string.Empty; + // Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; }); } } + if (RTrig.GetInstance("炒锅1配方完成").Start(Convert.ToBoolean(globalVar.fryPotOne.RecipeCompleteSingle))) + Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; }); + if (RTrig.GetInstance("炒锅4配方完成").Start(Convert.ToBoolean(globalVar.fryPotFour.RecipeCompleteSingle))) + Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; }); if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1 && globalVar.rollerLineOne.WashEmptyRollerModel == 0)//后续添加其它限制条件 { + //if ((RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 1 && RTrig.GetInstance("炒锅1配方完成").Start(Convert.ToBoolean(globalVar.fryPotOne.RecipeCompleteSingle))) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 4 && RTrig.GetInstance("炒锅4配方完成").Start(Convert.ToBoolean(globalVar.fryPotFour.RecipeCompleteSingle))) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotFour.ProcessStep == 0) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 != globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotOne.ProcessStep == 0) || globalVar.LOneFryPotSerial == 0||(RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 4 && globalVar.fryPotFour.ProcessStep == 0)||(RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == globalVar.LOneFryPotSerial && globalVar.LOneFryPotSerial == 1 && globalVar.fryPotOne.ProcessStep == 0)) //炒锅空闲才能下配方 + //{ if (globalVar.LOneFryPotSerial == 1) - { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; })); - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection(); })); - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); - } - if (globalVar.LOneFryPotSerial == 4) - { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; })); - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection(); })); - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); - } - WritePlcData("D2101", 0); - WritePlcData("D1101", 0);//复位开始执行指令 - //清空配方数据队列 - PlcLineOneRecipeDataReset();//PLC复位 - Thread.Sleep(800); - if (RecipeQuene.TryDequeue(out NewRecipeModel result)) - { - ErrorRecipe = false; - int headNum = result.materialCollection[0].MaterialLoc / 100; - globalVar.LOneMaterialNum = result.materialCollection.Count; - globalVar.LOneFryPotSerial = headNum; - globalVar.LOneCurrentRecipeName = result.RecipeName; - AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString()); - MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方"); - for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 - { - //if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4)) - //{ + { + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = string.Empty; })); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows = new ObservableCollection(); })); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); + + Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; }); + } + if (globalVar.LOneFryPotSerial == 4) + { + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = string.Empty; })); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows = new ObservableCollection(); })); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); + + Task.Run(() => { Thread.Sleep(1500); fryFourRecipe = string.Empty; }); + } + + WritePlcData("D2101", 0); + WritePlcData("D1101", 0);//复位开始执行指令 + //清空配方数据队列 + PlcLineOneRecipeDataReset();//PLC复位 + + if (RecipeQuene.TryDequeue(out NewRecipeModel result)) + { + ErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LOneMaterialNum = result.materialCollection.Count; + globalVar.LOneFryPotSerial = headNum; + globalVar.LOneCurrentRecipeName = result.RecipeName; + AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString()); + MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方"); if (headNum == 1)//炒锅1 { fryOneRecipe = result.RecipeName;//炒锅状态开始记录 @@ -2991,29 +3418,92 @@ namespace FryPot_DosingSystem.Control fryFourRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; })); } - //将配方中原料加入新的队列 - InputMaterialQuene.Enqueue(new MaterialInfo() + ResetPotData(globalVar.LOneFryPotSerial); + Thread.Sleep(800); + for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发 + if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4)) + { + + //将配方中原料加入新的队列 + InputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发 + + + + + } + else + { + MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + InputMaterialQuene.Clear(); + ErrorRecipe = true; + return; + } + } + #region 炒股用油量记录及工艺下发 + //if (headNum == 1) + //{ + // try + // { + // if (result.FlowProcess.fpModels.Count > 0) + // { + // FryPotMonitorManage.GetInstance.fryOne.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight; + // FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryOne.OilCapacity; + // FryPotRecipeSetDown(headNum, result);//炒锅工艺下发 + // } + // else + // { + // MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消"); + // RecipeQuene.Clear(); + // InputMaterialQuene.Clear(); + // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); })); + // return; + // } + // } + // catch (Exception) + // { + // return; + // // throw; + // } //} //else //{ - // MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); - // InputMaterialQuene.Clear(); - // ErrorRecipe = true; - // return; + // try + // { + // if (result.FlowProcess.fpModels.Count > 0) + // { + // FryPotMonitorManage.GetInstance.fryFour.OilCapacity = result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == (Json.Data.NameId.FirstOrDefault(s => s.Value == 1)).Key).FryWeight; + // FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += FryPotMonitorManage.GetInstance.fryFour.OilCapacity; + // FryPotRecipeSetDown(headNum, result);//炒锅工艺下发 + // } + // else + // { + // MessageNotify.GetInstance.ShowUserLog($"1号滚筒线【{result.RecipeName}】配方未制定炒锅工艺,已取消"); + // RecipeQuene.Clear(); + // InputMaterialQuene.Clear(); + // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"当前配方未指定炒锅工艺,配方取消制作"); })); + // return; + // } + // } + // catch (Exception) + // { + // return; + // //throw; + // } //} + #endregion + DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据 + WritePlcData("D1101", 1);//线体1配方开始执行命令 + globalVar.rollerLineOne.LowSignalJude = true; } - DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据 - // globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0 - WritePlcData("D1101", 1);//线体1配方开始执行命令 - globalVar.rollerLineOne.LowSignalJude = true; - } + //} } //else if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel))) //{ @@ -3046,6 +3536,7 @@ namespace FryPot_DosingSystem.Control RecipeQuene.Clear(); OutputMaterialQuene.Clear(); globalVar.rollerLineOne.NextStart = false; + ResetPotData(globalVar.LOneFryPotSerial); WritePlcData("D2101", 0); WritePlcData("D1101", 0);//复位开始执行指令 //清空配方数据队列 @@ -3057,6 +3548,7 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowUserLog($"1号滚筒线所有配方已清除"); globalVar.LOneCurrentRecipeName = string.Empty; globalVar.rollerLineOne.LowSignalJude = false; + } else //未收到下位执行信号 { @@ -3084,6 +3576,7 @@ namespace FryPot_DosingSystem.Control LTwoRecipeQuene.Clear(); LTwoOutputMaterialQuene.Clear(); globalVar.rollerLineTwo.NextStart = false; + ResetPotData(globalVar.LOneFryPotSerial); WritePlcData("D2102", 0); WritePlcData("D1102", 0);//复位开始执行指令 //清空配方数据队列 @@ -3122,6 +3615,7 @@ namespace FryPot_DosingSystem.Control LThreeRecipeQuene.Clear(); LThreeOutputMaterialQuene.Clear(); globalVar.rollerLineThree.NextStart = false; + ResetPotData(globalVar.LOneFryPotSerial); WritePlcData("D2103", 0); WritePlcData("D1103", 0);//复位开始执行指令 //清空配方数据队列 @@ -3160,7 +3654,7 @@ namespace FryPot_DosingSystem.Control /// private void AgvLineOneLoadRollerCom() { - if (globalVar.agvLineOneLoadCom) + if (globalVar.agvLineOneLoadCom|| globalVar.LineOneRobotTaskError) { globalVar.rollerLineOne.CanRun = true; globalVar.agvLineOneLoadCom = false; @@ -3186,7 +3680,7 @@ namespace FryPot_DosingSystem.Control /// private void AgvLineTwoLoadRollerCom() { - if (globalVar.agvLineTwoLoadCom) + if (globalVar.agvLineTwoLoadCom|| globalVar.LineTwoRobotTaskError) { globalVar.rollerLineTwo.CanRun = true; globalVar.agvLineTwoLoadCom = false; @@ -3212,7 +3706,7 @@ namespace FryPot_DosingSystem.Control /// private void AgvLineThreeLoadRollerCom() { - if (globalVar.agvLineThreeLoadCom) + if (globalVar.agvLineThreeLoadCom || globalVar.LineThreeRobotTaskError)) { globalVar.rollerLineThree.CanRun = true; globalVar.agvLineThreeLoadCom = false; @@ -3249,7 +3743,7 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotInputMaterial() { - if (OutputMaterialQuene.Count > 0 && globalVar.agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive) + if (OutputMaterialQuene.Count > 0 && (globalVar.agvArriveUnLoad|| globalVar.LineOneRobotTaskError) && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive) { //if (globalVar.LOneFryPotSerial == 1) //{ @@ -3264,6 +3758,7 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotOneOrFourSingleSetDown(); globalVar.agvArriveUnLoad = false; globalVar.PotOneInputMaterialArrive = true; + globalVar.LineOneRobotTaskError = false;//AGV故障信号复位 FryPotOneRollerTroubleCheck(); } } @@ -3271,7 +3766,7 @@ namespace FryPot_DosingSystem.Control public void LOneFallMaterial() { - if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive) + if (!globalVar.InOrOutputLock && ((globalVar.fryPotOne.InputMaterialArrivedSingle == 1&&globalVar.LOneFryPotSerial==1) || (globalVar.fryPotFour.InputMaterialArrivedSingle == 1&&globalVar.LOneFryPotSerial==4)) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive) { //if (globalVar.LOneFryPotSerial == 1) //{ @@ -3313,7 +3808,7 @@ namespace FryPot_DosingSystem.Control /// public void LTwoFryPotInputMaterial() { - if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive) + if (LTwoOutputMaterialQuene.Count > 0 &&( globalVar.LTwoagvArriveUnLoad|| globalVar.LineTwoRobotTaskError) && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive) { //if (globalVar.LTwoFryPotSerial == 2) //{ @@ -3327,12 +3822,13 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotTwoOrFiveSingleSetDown(); globalVar.LTwoagvArriveUnLoad = false; globalVar.LTwoPotInputMaterialArrive = true; + globalVar.LineTwoRobotTaskError = false;//agv故障信号复位 FryPotTwoRollerTroubleCheck(); } } public void LTwoFallMaterial() { - if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive) + if (!globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.InputMaterialArrivedSingle == 1&&globalVar.LTwoFryPotSerial==2) || (globalVar.fryPotFive.InputMaterialArrivedSingle == 1&&globalVar.LTwoFryPotSerial==5) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)) { //if (globalVar.LTwoFryPotSerial == 2) //{ @@ -3375,13 +3871,14 @@ namespace FryPot_DosingSystem.Control /// public void LThreeFryPotInputMaterial() { - if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive) + if (LThreeOutputMaterialQuene.Count > 0 && (globalVar.LThreeagvArriveUnLoad || globalVar.LineThreeRobotTaskError) && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive) { // AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3); MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号炒锅下料位置"); AgvArriveFryPotThreeSingleSetDown(); globalVar.LThreeagvArriveUnLoad = false; globalVar.LThreePotInputMaterialArrive = true; + globalVar.LineThreeRobotTaskError = false;//agv故障信号复位 FryPotThreeRollerTroubleCheck(); } } @@ -3450,7 +3947,7 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotOutputMaterial() { - if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot) + if (((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1&&globalVar.LOneFryPotSerial==1) || (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1&&globalVar.LOneFryPotSerial==4)) && OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot) { //上游下发搬运任务给AGV if (AgvFromFryPotOneOrFourToClean()) @@ -3468,9 +3965,9 @@ namespace FryPot_DosingSystem.Control public void LOneEmptyOperate() { - if (globalVar.agvArriveUpLoad && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) + if ((globalVar.agvArriveUpLoad||globalVar.LineFourRobotTaskError) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) { - if (globalVar.agvFryPotEmptyRollerArrive) + if (globalVar.agvFryPotEmptyRollerArrive|| globalVar.LineFourRobotTaskError) { FryPotOneOrFourOutEmpetyRollerOperate(); if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 @@ -3509,7 +4006,7 @@ namespace FryPot_DosingSystem.Control /// public void LTwoFryPotOutputMaterial() { - if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot) + if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1&&globalVar.LTwoFryPotSerial==2) || (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1&&globalVar.LTwoFryPotSerial==5)) && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot) { //上游下发搬运任务给AGV if (AgvFromFryPotTwoOrFiveToClean()) @@ -3528,13 +4025,13 @@ namespace FryPot_DosingSystem.Control public void LTwoEmptyOperate() { - if (globalVar.agvArriveLTwoUpLoad && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot) + if ((globalVar.agvArriveLTwoUpLoad || globalVar.LineFiveRobotTaskError) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot) { //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障 //{ - if (globalVar.LTwoagvFryPotEmptyRollerArrive) + if (globalVar.LTwoagvFryPotEmptyRollerArrive || globalVar.LineFiveRobotTaskError) { FryPotTwoOrFiveOutEmpetyRollerOperate(); @@ -3590,11 +4087,11 @@ namespace FryPot_DosingSystem.Control public void LThreeEmptyOperate() { - if (globalVar.agvArriveLThreeUpLoad && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot) + if ((globalVar.agvArriveLThreeUpLoad || globalVar.LineSixRobotTaskError) && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot) { //if (FryPotThreeAlarm == 1)//无故障 //{ - if (globalVar.LThreeagvFryPotEmptyRollerArrive) + if (globalVar.LThreeagvFryPotEmptyRollerArrive || globalVar.LineSixRobotTaskError) { //FryPotThreeOutEmpetyRollerOperate(); MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); @@ -3629,9 +4126,10 @@ namespace FryPot_DosingSystem.Control public void EmptyRollerToLinFourFromClean() { - if (globalVar.agvArriveLineFour)//agv到达线体4下料位置 + if (globalVar.agvArriveLineFour || globalVar.LineTenRobotTaskError)//agv到达线体4下料位置 { globalVar.agvArriveLineFour = false; + globalVar.LineTenRobotTaskError = false;//AGV故障信号复位 //线体四信号交互 WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC MessageNotify.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶"); @@ -3642,27 +4140,30 @@ namespace FryPot_DosingSystem.Control public void EmptyRollerToLinFourFromPot() { - if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置 + if (globalVar.rollerLineOne.agvArriveLineFour||globalVar.LineFourRobotTaskError)//agv到达线体4下料位置 { globalVar.rollerLineOne.agvArriveLineFour = false; //线体四信号交互 WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + globalVar.LineFourRobotTaskError = false;//AGV故障信号复位 MessageNotify.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置 + if (globalVar.rollerLineTwo.agvArriveLineFour|| globalVar.LineFiveRobotTaskError)//agv到达线体4下料位置 { globalVar.rollerLineTwo.agvArriveLineFour = false; //线体四信号交互 WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + globalVar.LineFiveRobotTaskError = false;//AGV故障信号复位 MessageNotify.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置 + if (globalVar.rollerLineThree.agvArriveLineFour|| globalVar.LineSixRobotTaskError)//agv到达线体4下料位置 { globalVar.rollerLineThree.agvArriveLineFour = false; //线体四信号交互 WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + globalVar.LineSixRobotTaskError = false;//AGV故障信号复位 MessageNotify.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } @@ -4122,7 +4623,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0) { - if (globalVar.agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障 + if ((globalVar.agvArriveUpLoad||globalVar.LineOneRobotTaskError) && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障 { MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); @@ -4160,7 +4661,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置 + if (globalVar.agvArriveLineOneLoadEmptyRoller|| globalVar.LineSevenRobotTaskError)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc @@ -4171,7 +4672,7 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineOneLoadEmptyRoller = false; //原料到位,agv到位,agv自行运料到清洗处 } - if (globalVar.agvArriveLineOneLoadCom)//上料完成 + if (globalVar.agvArriveLineOneLoadCom|| globalVar.LineSevenRobotTaskError)//上料完成 { if (emptyRollerNum != 0) globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0); @@ -4203,7 +4704,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障 + if ((globalVar.agvArriveLTwoUpLoad||globalVar.LineTwoRobotTaskError) && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障 { MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); AgvArriveLineSingelSetDown(LTwoInputMaterialQuene); @@ -4242,7 +4743,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置 + if (globalVar.agvArriveLineTwoLoadEmptyRoller||globalVar.LineEightRobotTaskError)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc @@ -4254,7 +4755,7 @@ namespace FryPot_DosingSystem.Control //原料到位,agv到位,agv自行运料到清洗处 } - if (globalVar.agvArriveLineTwoLoadCom)//上料完成 + if (globalVar.agvArriveLineTwoLoadCom || globalVar.LineEightRobotTaskError)//上料完成 { if (emptyRollerNum != 0) globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0); @@ -4286,7 +4787,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障 + if ((globalVar.agvArriveLThreeUpLoad||globalVar.LineThreeRobotTaskError) && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障 { MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); AgvArriveLineSingelSetDown(LThreeInputMaterialQuene); @@ -4325,7 +4826,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置 + if (globalVar.agvArriveLineThreeLoadEmptyRoller||globalVar.LineNineRobotTaskError)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc @@ -4338,7 +4839,7 @@ namespace FryPot_DosingSystem.Control //原料到位,agv到位,agv自行运料到清洗处 } - if (globalVar.agvArriveLineThreeLoadCom)//上料完成 + if (globalVar.agvArriveLineThreeLoadCom || globalVar.LineNineRobotTaskError)//上料完成 { if (emptyRollerNum != 0) globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0); @@ -5087,5 +5588,505 @@ namespace FryPot_DosingSystem.Control DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F); DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F); } + /// + /// 炒锅配方下发 + /// + /// + /// + public void FryPotRecipeSetDown(int potNum, NewRecipeModel result) + { + lock (Pot_Lock) + { + Json.Read(); + #region 炒锅工艺下发 + for (int i = 0; i < result.FlowProcess.fpModels.Count; i++) + { + bool can = ushort.TryParse(result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum, out ushort res); + //按工序下发数据 + + #region 工序1 + if (i == 0) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3001", 2); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3001", 3); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3001", 4); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3001", 5); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3001", 6); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3001", 7); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3001", 8); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3001", 9); WritePotData(potNum, "D3004", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3001", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3004", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3002", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3005", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3006", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3007", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3008", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3009", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序2 + if (i == 1) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3011", 2); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3011", 3); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3011", 4); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3011", 5); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3011", 6); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3011", 7); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3011", 8); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3011", 9); WritePotData(potNum, "D3014", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3011", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3014", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3012", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3015", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3016", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3017", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3018", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3019", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序3 + if (i == 2) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3021", 2); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3021", 3); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3021", 4); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3021", 5); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3021", 6); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3021", 7); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3021", 8); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3021", 9); WritePotData(potNum, "D3024", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3021", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3024", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3022", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3025", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3026", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3027", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3028", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3029", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序4 + if (i == 3) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3031", 2); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3031", 3); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3031", 4); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3031", 5); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3031", 6); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3031", 7); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3031", 8); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3031", 9); WritePotData(potNum, "D3034", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3031", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3034", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3032", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3035", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3036", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3037", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3038", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3039", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序5 + if (i == 4) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3041", 2); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3041", 3); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3041", 4); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3041", 5); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3041", 6); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3041", 7); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3041", 8); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3041", 9); WritePotData(potNum, "D3044", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3041", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3044", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3042", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3045", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3046", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3047", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3048", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3049", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序6 + if (i == 5) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3051", 2); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3051", 3); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3051", 4); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3051", 5); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3051", 6); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3051", 7); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3051", 8); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3051", 9); WritePotData(potNum, "D3054", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3051", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3054", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3052", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3055", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3056", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3057", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3058", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3059", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序7 + if (i == 6) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3061", 2); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3061", 3); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3061", 4); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3061", 5); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3061", 6); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3061", 7); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3061", 8); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3061", 9); WritePotData(potNum, "D3064", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3061", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3064", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3062", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3065", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3066", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3067", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3068", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3069", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序8 + if (i == 7) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3071", 2); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3071", 3); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3071", 4); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3071", 5); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3071", 6); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3071", 7); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3071", 8); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3071", 9); WritePotData(potNum, "D3074", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3071", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3074", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3072", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3075", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3076", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3077", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3078", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3079", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序9 + if (i == 8) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3081", 2); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3081", 3); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3081", 4); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3081", 5); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3081", 6); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3081", 7); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3081", 8); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3081", 9); WritePotData(potNum, "D3084", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + + } + } + else + { + WritePotData(potNum, "D3081", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3084", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3082", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3085", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3086", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3087", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3088", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3089", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序10 + if (i == 9) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3091", 2); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3091", 3); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3091", 4); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3091", 5); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3091", 6); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3091", 7); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3091", 8); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3091", 9); WritePotData(potNum, "D3094", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + } + } + else + { + WritePotData(potNum, "D3091", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3094", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3092", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3095", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3096", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3097", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3098", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3099", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序11 + if (i == 10) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3101", 2); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3101", 3); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3101", 4); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3101", 5); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3101", 6); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3101", 7); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3101", 8); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3101", 9); WritePotData(potNum, "D3104", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + } + } + else + { + WritePotData(potNum, "D3101", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3104", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3102", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3105", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3106", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3107", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3108", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3109", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + #region 工序12 + if (i == 11) + { + if (can)//是桶号 + { + //发送桶号对应的ID以及物料重量 + switch (res % 100) + { + case 1: WritePotData(potNum, "D3111", 2); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[0].MaterialWeight * 10)); break; + case 2: WritePotData(potNum, "D3111", 3); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[1].MaterialWeight * 10)); break; + case 3: WritePotData(potNum, "D3111", 4); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[2].MaterialWeight * 10)); break; + case 4: WritePotData(potNum, "D3111", 5); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[3].MaterialWeight * 10)); break; + case 5: WritePotData(potNum, "D3111", 6); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[4].MaterialWeight * 10)); break; + case 6: WritePotData(potNum, "D3111", 7); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[5].MaterialWeight * 10)); break; + case 7: WritePotData(potNum, "D3111", 8); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[6].MaterialWeight * 10)); break; + case 8: WritePotData(potNum, "D3111", 9); WritePotData(potNum, "D3114", Convert.ToUInt16(result.materialCollection[7].MaterialWeight * 10)); break; + } + } + else + { + WritePotData(potNum, "D3111", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + } + + WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); + WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); + WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); + WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); + WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); + WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).StrongFirePercent)); + WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FrySpeed * 10)); + continue; + } + #endregion + } + WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count));//工序数量 + #endregion + } + + } + + /// + /// 清除炒锅工艺数据 + /// + /// + public void ResetPotData(int PotNum) + { + lock (this) + { + if (PotNum == 1 || PotNum == 2 || PotNum == 3 || PotNum == 4 || PotNum == 5) + { + + for (int i = 1; i < 10; i++) + { + WritePotData(PotNum, "D300" + i, 0); + } + for (int i = 11; i < 20; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 21; i < 30; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 31; i < 40; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 41; i < 50; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 51; i < 60; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 61; i < 70; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 71; i < 80; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 81; i < 90; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 91; i < 100; i++) + { + WritePotData(PotNum, "D30" + i, 0); + } + for (int i = 101; i < 110; i++) + { + WritePotData(PotNum, "D3" + i, 0); + } + WritePotData(PotNum, "D3120", 0); + } + } + + } } } diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 6814738a..3c05105b 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -158,7 +158,7 @@ namespace FryPot_DosingSystem.Control #endregion #region AGV视图显示变量 public int LOneMaterialNum { get; set; } = 0; - public int LOneFryPotSerial { get; set; } = 1; + public int LOneFryPotSerial { get; set; } = 0; public int LOneCurrentCookingStep { get; set; } = 0; public bool agvArriveUpLoad { get; set; } public bool agvArriveUnLoad { get; set; } @@ -167,7 +167,7 @@ namespace FryPot_DosingSystem.Control public bool agvLineOneLoadCom { get; set; }//线体1上料完成 public int LTwoMaterialNum { get; set; } = 0; - public int LTwoFryPotSerial { get; set; } = 2; + public int LTwoFryPotSerial { get; set; } =0; public int LTwoCurrentCookingStep { get; set; } = 0; public bool agvArriveLTwoUpLoad { get; set; } public bool LTwoagvArriveUnLoad { get; set; } @@ -175,7 +175,7 @@ namespace FryPot_DosingSystem.Control public bool agvLineTwoLoadCom { get; set; }//线体2上料完成 public int LThreeMaterialNum { get; set; } = 0; - public int LThreeFryPotSerial { get; set; } = 3; + public int LThreeFryPotSerial { get; set; } = 0; public int LThreeCurrentCookingStep { get; set; } = 0; public bool agvArriveLThreeUpLoad { get; set; } public bool LThreeagvArriveUnLoad { get; set; } @@ -202,6 +202,34 @@ namespace FryPot_DosingSystem.Control /// public bool AllowNextEmptyRollerToClean { get; set; } = true; + + + #endregion + + + #region AGV任务号对应的AGV故障信号 + /// + /// 线体1到炒锅1,4 AGV故障 + /// + public bool LineOneRobotTaskError { get; set; } + + public bool LineTwoRobotTaskError { get; set; } + + public bool LineThreeRobotTaskError { get; set; } + + public bool LineFourRobotTaskError { get; set; } + + public bool LineFiveRobotTaskError { get; set; } + + public bool LineSixRobotTaskError { get; set; } + + public bool LineSevenRobotTaskError { get; set; } + + public bool LineEightRobotTaskError { get; set; } + + public bool LineNineRobotTaskError { get; set; } + + public bool LineTenRobotTaskError { get; set; } #endregion } /// @@ -309,6 +337,8 @@ namespace FryPot_DosingSystem.Control /// public ushort WashRollerArriveSignal { get; set; } + + } /// /// 滚筒线2相关变量 @@ -608,6 +638,15 @@ namespace FryPot_DosingSystem.Control /// 当前配方用油量 /// public double OilCapacity { get; set; } + + /// + /// 当前线体配方完成信号 + /// + public ushort RecipeCompleteSingle { get; set; } + /// + /// 炒股当前步数 + /// + public ushort ProcessStep { get; set; } } /// /// 炒锅2相关变量 @@ -642,6 +681,15 @@ namespace FryPot_DosingSystem.Control /// 当前配方用油量 /// public double OilCapacity { get; set; } + + /// + /// 当前线体配方完成信号 + /// + public ushort RecipeCompleteSingle { get; set; } + /// + /// 炒锅当前步数 + /// + public ushort ProcessStep { get; set; } } /// /// 炒锅3相关变量 @@ -676,6 +724,17 @@ namespace FryPot_DosingSystem.Control /// 当前配方用油量 /// public double OilCapacity { get; set; } + + + /// + /// 当前线体配方完成信号 + /// + public ushort RecipeCompleteSingle { get; set; } + + /// + /// 炒股当前步数 + /// + public ushort ProcessStep { get; set; } } /// /// 炒锅4相关变量 @@ -710,6 +769,16 @@ namespace FryPot_DosingSystem.Control /// 当前配方用油量 /// public double OilCapacity { get; set; } + + /// + /// 当前线体配方完成信号 + /// + public ushort RecipeCompleteSingle { get; set; } + + /// + /// 炒股当前步数 + /// + public ushort ProcessStep { get; set; } } /// /// 炒锅5相关变量 @@ -744,5 +813,15 @@ namespace FryPot_DosingSystem.Control /// 当前配方用油量 /// public double OilCapacity { get; set; } + + /// + /// 当前线体配方完成信号 + /// + public ushort RecipeCompleteSingle { get; set; } + + /// + /// 炒股当前步数 + /// + public ushort ProcessStep { get; set; } } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs index 12fb7bb6..7bc5138c 100644 --- a/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs +++ b/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs @@ -19,66 +19,88 @@ namespace FryPot_DosingSystem.FryPotStatus [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 public int Id { get; set; } [Column("Temperature")] - [Variable("FryPotFiveTemp","5号炒锅温度","","")] + [Variable("FryPotFiveTemp","5号炒锅温度","D258","")] /// /// 温度 /// public double? Temperature { get { return temperature; } set { temperature = value; } } private double? temperature=0; - [Column("HotPower")] - [Variable("FryPotFivePower", "5号炒锅火力", "", "")] - /// - /// 火力 - /// - public string? HotPower { get { return hotPower; } set { hotPower = value; } } - private string? hotPower="0"; + //[Column("HotPower")] + //[Variable("FryPotFivePower", "5号炒锅火力", "", "")] + ///// + ///// 火力 + ///// + //public string? HotPower { get { return hotPower; } set { hotPower = value; } } + //private string? hotPower="0"; [Column("Speed")] - [Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "", "")] + [Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "D2500", "")] /// /// 搅拌速度 /// public double? Speed { get { return speed; } set { speed = value; } } private double? speed=0; [Column("FryPotWeight")] - [Variable("FryPotFiveWeight", "5号炒锅载重", "", "")] + [Variable("FryPotFiveWeight", "5号炒锅载重", "D600", "")] /// /// 炒锅重量 /// public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } } private double? fryPotWeight=0; + + + + [Column("ReicpeName")] + /// + /// 当前配方名称 + /// + public string RecipeName { get; set; } = string.Empty; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + + + [Variable("FryPotFiveProcessStep", "5号炒锅当前工艺步数", "D3000", "")] + /// + /// 当前工艺步数 + /// + public ushort Step { get { return _step; } set { _step = value; } } + private ushort _step; + [Variable("FryPotFiveSmallFire", "5号炒锅小火火力", "D510", "")] + public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } } + private ushort _smallFire; + [Variable("FryPotFiveMidFire", "5号炒锅中火火力", "D512", "")] + public ushort MidFire { get { return _midFire; } set { _midFire = value; } } + private ushort _midFire; + [Variable("FryPotFiveBigFire", "5号炒锅大火火力", "D514", "")] + public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } } + private ushort _bigFire; + [Variable("FryPotFiveStrongFire", "5号炒锅强火火力", "D516", "")] + public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } } + private ushort _strongFire; + [Column("OilCapacity")] [Variable("FryPotFiveOil", "5号炒锅当前配方用油量", "", "")] /// /// 单次配方用油量 /// - public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } - private double? oilCapacity=0; + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } + private double? oilCapacity = 0; [Column("TotalOilCapactiy")] [Variable("FryPotFiveTotalOil", "5号炒锅总用油量", "", "")] /// /// 一天总用油量 /// public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } - private double? totalOilCapactiy=0; + private double? totalOilCapactiy = 0; [Column("TotalProduct")] [Variable("FryPotFiveTotalProduct", "5号炒锅总产量", "", "")] /// /// 一天配方生产总量 /// - public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } - private int? totalProduct=0; - - - [Column("ReicpeName")] - /// - /// 当前配方名称 - /// - public string RecipeName { get; set; } = string.Empty; - [Column("Time")] - /// - /// 时间 - /// - public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } + private int? totalProduct = 0; } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs index 5ccb2cc0..7fe929ed 100644 --- a/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs +++ b/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs @@ -19,65 +19,87 @@ namespace FryPot_DosingSystem.FryPotStatus [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 public int Id { get; set; } [Column("Temperature")] - [Variable("FryPotFourTemp", "4号炒锅温度", "", "")] + [Variable("FryPotFourTemp", "4号炒锅温度", "D258", "")] /// /// 温度 /// public double? Temperature { get { return temperature; } set { temperature = value; } } private double? temperature=0; - [Column("HotPower")] - [Variable("FryPotFourPower", "4号炒锅火力", "", "")] - /// - /// 火力 - /// - public string? HotPower { get { return hotPower; } set { hotPower = value; } } - private string? hotPower="0"; + //[Column("HotPower")] + //[Variable("FryPotFourPower", "4号炒锅火力", "", "")] + ///// + ///// 火力 + ///// + //public string? HotPower { get { return hotPower; } set { hotPower = value; } } + //private string? hotPower="0"; [Column("Speed")] - [Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "", "")] + [Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "D2500", "")] /// /// 搅拌速度 /// public double? Speed { get { return speed; } set { speed = value; } } private double? speed=0; [Column("FryPotWeight")] - [Variable("FryPotFourWeight", "4号炒锅载重", "", "")] + [Variable("FryPotFourWeight", "4号炒锅载重", "D600", "")] /// /// 炒锅重量 /// public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } } private double? fryPotWeight=0; + + + [Column("ReicpeName")] + /// + /// 当前配方名称 + /// + public string RecipeName { get; set; } = string.Empty; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + + + [Variable("FryPotFourProcessStep", "4号炒锅当前工艺步数", "D3000", "")] + /// + /// 当前工艺步数 + /// + public ushort Step { get { return _step; } set { _step = value; } } + private ushort _step; + [Variable("FryPotFourSmallFire", "4号炒锅小火火力", "D510", "")] + public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } } + private ushort _smallFire; + [Variable("FryPotFourMidFire", "4号炒锅中火火力", "D512", "")] + public ushort MidFire { get { return _midFire; } set { _midFire = value; } } + private ushort _midFire; + [Variable("FryPotFourBigFire", "4号炒锅大火火力", "D514", "")] + public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } } + private ushort _bigFire; + [Variable("FryPotFourStrongFire", "4号炒锅强火火力", "D516", "")] + public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } } + private ushort _strongFire; + [Column("OilCapacity")] [Variable("FryPotFourOil", "4号炒锅当前配方用油量", "", "")] /// /// 单次配方用油量 /// - public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } - private double? oilCapacity=0; + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } + private double? oilCapacity = 0; [Column("TotalOilCapactiy")] [Variable("FryPotFourTotalOil", "4号炒锅总用油量", "", "")] /// /// 一天总用油量 /// - public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value;; } } - private double? totalOilCapactiy=0; + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; ; } } + private double? totalOilCapactiy = 0; [Column("TotalProduct")] [Variable("FryPotFourTotalProduct", "4号炒锅总产量", "", "")] /// /// 一天配方生产总量 /// - public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } - private int? totalProduct=0; - - [Column("ReicpeName")] - /// - /// 当前配方名称 - /// - public string RecipeName { get; set; } = string.Empty; - [Column("Time")] - /// - /// 时间 - /// - public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } + private int? totalProduct = 0; } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs index ef155e38..7d5b8902 100644 --- a/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs +++ b/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs @@ -19,46 +19,77 @@ namespace FryPot_DosingSystem.FryPotStatus [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 public int Id { get; set; } [Column("Temperature")] - [Variable("FryPotOneTemp", "1号炒锅温度", "", "")] + [Variable("FryPotOneTemp", "1号炒锅温度", "D258", "")] /// /// 温度 /// public double? Temperature { get { return temperature; } set { temperature = value;} } private double? temperature=0; - [Column("HotPower")] - [Variable("FryPotOnePower", "1号炒锅火力", "", "")] - /// - /// 火力 - /// - public string? HotPower { get { return hotPower; } set { hotPower = value; } } - private string? hotPower="0"; + //[Column("HotPower")] + //[Variable("FryPotOnePower", "1号炒锅火力", "", "")] + ///// + ///// 火力 + ///// + //public string? HotPower { get { return hotPower; } set { hotPower = value; } } + //private string? hotPower="0"; [Column("Speed")] - [Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "", "")] + [Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "D2500", "")] /// /// 搅拌速度 /// public double? Speed { get { return speed; } set { speed = value; } } private double? speed = 0; [Column("FryPotWeight")] - [Variable("FryPotOneWeight", "1号炒锅载重", "", "")] + [Variable("FryPotOneWeight", "1号炒锅载重", "D600", "")] /// /// 炒锅重量 /// public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } } private double? fryPotWeight = 0; + + [Column("ReicpeName")] + /// + /// 当前配方名称 + /// + public string RecipeName { get; set; } = string.Empty; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + + [Variable("FryPotOneProcessStep", "1号炒锅当前工艺步数", "D3000", "")] + /// + /// 当前工艺步数 + /// + public ushort Step { get { return _step; } set { _step = value; } } + private ushort _step; + [Variable("FryPotOneSmallFire", "1号炒锅小火火力", "D510", "")] + public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } } + private ushort _smallFire; + [Variable("FryPotOneMidFire", "1号炒锅中火火力", "D512", "")] + public ushort MidFire { get { return _midFire; } set { _midFire = value; } } + private ushort _midFire; + [Variable("FryPotOneBigFire", "1号炒锅大火火力", "D514", "")] + public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } } + private ushort _bigFire; + [Variable("FryPotOneStrongFire", "1号炒锅强火火力", "D516", "")] + public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } } + private ushort _strongFire; + [Column("OilCapacity")] [Variable("FryPotOneOil", "1号炒锅当前配方用油量", "", "")] /// /// 单次配方用油量 /// - public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } private double? oilCapacity = 0; [Column("TotalOilCapactiy")] [Variable("FryPotOneTotalOil", "1号炒锅总用油量", "", "")] /// /// 一天总用油量 /// - public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } private double? totalOilCapactiy = 0; [Column("TotalProduct")] @@ -68,16 +99,6 @@ namespace FryPot_DosingSystem.FryPotStatus /// public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } private int? totalProduct = 0; - [Column("ReicpeName")] - /// - /// 当前配方名称 - /// - public string RecipeName { get; set; } = string.Empty; - [Column("Time")] - /// - /// 时间 - /// - public string Time { get; set; } = DateTime.Now.ToShortTimeString(); - + } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs index fefc3a48..e90e5cc9 100644 --- a/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs +++ b/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs @@ -19,66 +19,88 @@ namespace FryPot_DosingSystem.FryPotStatus [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 public int Id { get; set; } [Column("Temperature")] - [Variable("FryPotThreeTemp", "3号炒锅温度", "", "")] + [Variable("FryPotThreeTemp", "3号炒锅温度", "D258", "")] /// /// 温度 /// public double? Temperature { get { return temperature; } set { temperature = value; } } private double? temperature=0; - [Column("HotPower")] - [Variable("FryPotThreePower", "3号炒锅火力", "", "")] - /// - /// 火力 - /// - public string? HotPower { get { return hotPower; } set { hotPower = value;} } - private string? hotPower="0"; + //[Column("HotPower")] + //[Variable("FryPotThreePower", "3号炒锅火力", "", "")] + ///// + ///// 火力 + ///// + //public string? HotPower { get { return hotPower; } set { hotPower = value;} } + //private string? hotPower="0"; [Column("Speed")] - [Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "", "")] + [Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "D2500", "")] /// /// 搅拌速度 /// public double? Speed { get { return speed; } set { speed = value; } } private double? speed=0; [Column("FryPotWeight")] - [Variable("FryPotThreeWeight", "3号炒锅载重", "", "")] + [Variable("FryPotThreeWeight", "3号炒锅载重", "D600", "")] /// /// 炒锅重量 /// public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } } private double? fryPotWeight=0; + + + + [Column("ReicpeName")] + /// + /// 当前配方名称 + /// + public string RecipeName { get; set; } = string.Empty; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + + + [Variable("FryPotThreeProcessStep", "3号炒锅当前工艺步数", "D3000", "")] + /// + /// 当前工艺步数 + /// + public ushort Step { get { return _step; } set { _step = value; } } + private ushort _step; + [Variable("FryPotThreeSmallFire", "3号炒锅小火火力", "D510", "")] + public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } } + private ushort _smallFire; + [Variable("FryPotThreeMidFire", "3号炒锅中火火力", "D512", "")] + public ushort MidFire { get { return _midFire; } set { _midFire = value; } } + private ushort _midFire; + [Variable("FryPotThreeBigFire", "3号炒锅大火火力", "D514", "")] + public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } } + private ushort _bigFire; + [Variable("FryPotThreeStrongFire", "3号炒锅强火火力", "D516", "")] + public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } } + private ushort _strongFire; + [Column("OilCapacity")] [Variable("FryPotThreeOil", "3号炒锅当前配方用油量", "", "")] /// /// 单次配方用油量 /// - public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } - private double? oilCapacity=0; + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } + private double? oilCapacity = 0; [Column("TotalOilCapactiy")] [Variable("FryPotThreeTotalOil", "3号炒锅总用油量", "", "")] /// /// 一天总用油量 /// - public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } - private double? totalOilCapactiy=0; + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } + private double? totalOilCapactiy = 0; [Column("TotalProduct")] [Variable("FryPotThreeTotalProduct", "3号炒锅总产量", "", "")] /// /// 一天配方生产总量 /// - public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } - private int? totalProduct=0; - - - [Column("ReicpeName")] - /// - /// 当前配方名称 - /// - public string RecipeName { get; set; } = string.Empty; - [Column("Time")] - /// - /// 时间 - /// - public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } + private int? totalProduct = 0; } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs index 388ed607..a11410b4 100644 --- a/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs +++ b/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs @@ -19,47 +19,80 @@ namespace FryPot_DosingSystem.FryPotStatus [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 public int Id { get; set; } [Column("Temperature")] - [Variable("FryPotTwoTemp", "2号炒锅温度", "", "")] + [Variable("FryPotTwoTemp", "2号炒锅温度", "D258", "")] /// /// 温度 /// public double? Temperature { get { return temperature; } set { temperature = value; } } private double? temperature=0; - [Column("HotPower")] - [Variable("FryPotTwoPower", "2号炒锅火力", "", "")] - /// - /// 火力 - /// - public string? HotPower { get { return hotPower; } set { hotPower = value; } } - private string? hotPower="0"; + //[Column("HotPower")] + //[Variable("FryPotTwoPower", "2号炒锅火力", "", "")] + ///// + ///// 火力 + ///// + //public string? HotPower { get { return hotPower; } set { hotPower = value; } } + //private string? hotPower="0"; [Column("Speed")] - [Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "", "")] + [Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "D2500", "")] /// /// 搅拌速度 /// public double? Speed { get { return speed; } set { speed = value; } } private double? speed=0; [Column("FryPotWeight")] - [Variable("FryPotTwoWeight", "2号炒锅载重", "", "")] + [Variable("FryPotTwoWeight", "2号炒锅载重", "D600", "")] /// /// 炒锅重量 /// public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } } private double? fryPotWeight=0; + + + [Column("ReicpeName")] + /// + /// 当前配方名称 + /// + public string RecipeName { get; set; } = string.Empty; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + + + [Variable("FryPotTwoProcessStep", "2号炒锅当前工艺步数", "D3000", "")] + /// + /// 当前工艺步数 + /// + public ushort Step { get { return _step; } set { _step = value; } } + private ushort _step; + [Variable("FryPotTwoSmallFire", "2号炒锅小火火力", "D510", "")] + public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } } + private ushort _smallFire; + [Variable("FryPotTwoMidFire", "2号炒锅中火火力", "D512", "")] + public ushort MidFire { get { return _midFire; } set { _midFire = value; } } + private ushort _midFire; + [Variable("FryPotTwoBigFire", "2号炒锅大火火力", "D514", "")] + public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } } + private ushort _bigFire; + [Variable("FryPotTwoStrongFire", "2号炒锅强火火力", "D516", "")] + public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } } + private ushort _strongFire; + [Column("OilCapacity")] [Variable("FryPotTwoOil", "2号炒锅当前配方用油量", "", "")] /// /// 单次配方用油量 /// public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } } - private double? oilCapacity=0; + private double? oilCapacity = 0; [Column("TotalOilCapactiy")] [Variable("FryPotTwoTotalOil", "2号炒锅总用油量", "", "")] /// /// 一天总用油量 /// public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } } - private double? totalOilCapactiy=0; + private double? totalOilCapactiy = 0; [Column("TotalProduct")] [Variable("FryPotTwoTotalProduct", "2号炒锅总产量", "", "")] @@ -67,17 +100,6 @@ namespace FryPot_DosingSystem.FryPotStatus /// 一天配方生产总量 /// public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } } - private int? totalProduct=0; - - [Column("ReicpeName")] - /// - /// 当前配方名称 - /// - public string RecipeName { get; set; } = string.Empty; - [Column("Time")] - /// - /// 时间 - /// - public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + private int? totalProduct = 0; } } diff --git a/FryPot_DosingSystem/Model/FlowProcessModel.cs b/FryPot_DosingSystem/Model/FlowProcessModel.cs index 8022b04a..65b73017 100644 --- a/FryPot_DosingSystem/Model/FlowProcessModel.cs +++ b/FryPot_DosingSystem/Model/FlowProcessModel.cs @@ -9,11 +9,11 @@ namespace FryPot_DosingSystem.Model { internal class FlowProcessModel:ObservableObject { - /// - /// 工艺对应配方名称 - /// - public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } } - private string _recipeName; + ///// + ///// 工艺步骤对应名称 + ///// + //public string ProcessName { get { return _processName; }set { _processName = value;OnPropertyChanged(); } } + //private string _processName; ///// ///// 工艺步骤 ///// @@ -29,11 +29,11 @@ namespace FryPot_DosingSystem.Model /// public double FrySpeed { get { return _frySpeed; }set { _frySpeed = value;OnPropertyChanged(); } } private double _frySpeed; - ///// - ///// 炒制重量 - ///// - //public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } } - //private double _fryMaterialWeight; + /// + /// 炒制重量 + /// + public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } } + private double _fryMaterialWeight; /// /// 炒制温度 /// @@ -45,15 +45,27 @@ namespace FryPot_DosingSystem.Model public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value;OnPropertyChanged(); } } private double _fryPeriodTime; /// - /// 炒制火力 + /// 小火比例 + /// + public double SmallFirePercent { get { return _smallFirePercent; } set { _smallFirePercent = value; OnPropertyChanged(); } } + private double _smallFirePercent; + + /// + /// 中火比例 + /// + public double MidFirePercent { get { return _midFirePercent; } set { _midFirePercent = value; OnPropertyChanged(); } } + private double _midFirePercent; + + /// + /// 大火比例 /// - public double FryFire { get { return _fryFire; } set { _fryFire = value; OnPropertyChanged(); } } - private double _fryFire; + public double BigFirePercent { get { return _bigFirePercent; } set { _bigFirePercent = value; OnPropertyChanged(); } } + private double _bigFirePercent; /// - /// 火力比例 + /// 强火比例 /// - public double FryFirePercent { get { return _fryFirePercent; } set { _fryFirePercent = value; OnPropertyChanged(); } } - private double _fryFirePercent; + public double StrongFirePercent { get { return _strongFilePercent; } set { _strongFilePercent = value; OnPropertyChanged(); } } + private double _strongFilePercent; } } diff --git a/FryPot_DosingSystem/Model/FlowProcessNames.cs b/FryPot_DosingSystem/Model/FlowProcessNames.cs index 85b76ca2..e7394e94 100644 --- a/FryPot_DosingSystem/Model/FlowProcessNames.cs +++ b/FryPot_DosingSystem/Model/FlowProcessNames.cs @@ -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; @@ -8,10 +9,11 @@ using System.Threading.Tasks; namespace FryPot_DosingSystem.Model { - internal class FlowProcessNames:ObservableObject + internal class FlowProcessNames : ObservableObject { private static FlowProcessNames _instance; public static FlowProcessNames GetInstance => _instance ?? (_instance = new FlowProcessNames()); - public ObservableCollection Names { get; set; } = new ObservableCollection(); + // public ObservableCollection Names { get; set; } = new ObservableCollection(); + public ConcurrentDictionary NameId { get; set; } = new ConcurrentDictionary(); } } diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml b/FryPot_DosingSystem/View/FlowProcessView.xaml index 04dc2f1a..dd2cad78 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml @@ -402,35 +402,44 @@ + - - - - - - - + + + + + + + + + + + - - + - + - + - + + + + + + + @@ -443,20 +452,20 @@ diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs index 57576935..f3c50322 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs @@ -1,9 +1,11 @@ using BPASmartClient.Helper; using FryPot_DosingSystem.Model; +using FryPot_DosingSystem.ViewModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -21,7 +23,7 @@ namespace FryPot_DosingSystem.View /// public partial class FlowProcessView : Window { - + public FlowProcessView() { InitializeComponent(); @@ -31,7 +33,7 @@ namespace FryPot_DosingSystem.View { this.Close(); }), "CloseFlowProcessView"); - + } @@ -72,6 +74,92 @@ namespace FryPot_DosingSystem.View return null; } + private void Button_Click(object sender, RoutedEventArgs e) + { + NewFryPotMaterial win = new NewFryPotMaterial(); + win.Show(); + } + + public string TextLimit(string str) + { + if (Regex.IsMatch(str, @"^\d+$"))//非负整数 非零正整数^\+?[1-9][0-9]*$ + { + return str; + } + else + { + return string.Empty; + } + } + /// + /// 文本输入做限定 + /// + /// + /// + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_2(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_3(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_4(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_5(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_6(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + private void TextBox_TextChanged_7(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + //private void ComboBox_KeyUp(object sender, KeyEventArgs e) //{ // var res = sender as ComboBox; @@ -104,7 +192,7 @@ namespace FryPot_DosingSystem.View // //Json.Data = FlowProcessNames.GetInstance; // Json.Data.Names.Add(res.Text.Trim()); // Json.Save(); - + // } // } diff --git a/FryPot_DosingSystem/View/NewFryPotMaterial.xaml b/FryPot_DosingSystem/View/NewFryPotMaterial.xaml new file mode 100644 index 00000000..5778939a --- /dev/null +++ b/FryPot_DosingSystem/View/NewFryPotMaterial.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +