From 03b21ac136317ee265a1cb28c6a5a8fb4392f7a2 Mon Sep 17 00:00:00 2001 From: NXX <447201003@qq> Date: Wed, 9 Nov 2022 13:39:52 +0800 Subject: [PATCH 01/10] morkf --- BPASmartClient.ViewModel/FoodMenuViewModel.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BPASmartClient.ViewModel/FoodMenuViewModel.cs b/BPASmartClient.ViewModel/FoodMenuViewModel.cs index 0d7733f8..4de85018 100644 --- a/BPASmartClient.ViewModel/FoodMenuViewModel.cs +++ b/BPASmartClient.ViewModel/FoodMenuViewModel.cs @@ -19,8 +19,7 @@ namespace BPASmartClient.ViewModel public FoodMenuViewModel() { - FoodMenus.Add(new FoodMenuModel { GoodKey = "1111", GoodName = "小炒肉" }); - FoodMenus.Add(new FoodMenuModel { GoodKey = "222", GoodName = "大炒肉大炒肉大炒肉" }); + StartOrder = new RelayCommand((o) => { ActionManage.GetInstance.Send("开始下单", o); From ae559ad991c48755048e1ad37ca1888a7cee6a07 Mon Sep 17 00:00:00 2001 From: taoye Date: Thu, 10 Nov 2022 14:26:22 +0800 Subject: [PATCH 02/10] =?UTF-8?q?180=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.AGV/AGVHelper.cs | 10 +- .../Pages/Model/MessageNotify.cs | 24 +- .../Pages/View/RunLogView.xaml | 3 +- .../Pages/View/UserLogView.xaml | 4 +- .../Pages/ViewModel/LoginViewModel.cs | 64 +- BPASmartClient.Helper/Json.cs | 16 +- BPASmartClient.HubHelper/HubHelper.cs | 1 - BPASmartClient.Modbus/ModbusTcp.cs | 4 +- FryPot_DosingSystem/App.xaml.cs | 26 +- FryPot_DosingSystem/Control/DeviceOperate.cs | 397 ++- .../Control/DosingLogicControl.cs | 2396 ++++++++++++----- FryPot_DosingSystem/Control/GlobalVariable.cs | 8 +- .../Model/FlowProcessManage.cs | 2 + FryPot_DosingSystem/Model/FlowProcessModel.cs | 7 +- FryPot_DosingSystem/View/AgvView.xaml | 228 +- FryPot_DosingSystem/View/AgvView.xaml.cs | 366 +-- FryPot_DosingSystem/View/DebugView.xaml | 302 ++- FryPot_DosingSystem/View/DebugView.xaml.cs | 342 ++- FryPot_DosingSystem/View/FlowProcessView.xaml | 36 +- .../View/FlowProcessView.xaml.cs | 28 + .../View/RecipeSendDownView.xaml | 2 +- FryPot_DosingSystem/View/RecipesSendDown.xaml | 2 +- .../ViewModel/FlowProcessSetViewModel.cs | 36 +- .../ViewModel/NewRecipeViewModel.cs | 81 +- .../ViewModel/RecipeSetDownViewModel.cs | 4 +- .../ViewModel/RecipeSetViewModel.cs | 6 +- 26 files changed, 3150 insertions(+), 1245 deletions(-) diff --git a/BPASmartClient.AGV/AGVHelper.cs b/BPASmartClient.AGV/AGVHelper.cs index ca56e07e..95be2611 100644 --- a/BPASmartClient.AGV/AGVHelper.cs +++ b/BPASmartClient.AGV/AGVHelper.cs @@ -471,7 +471,7 @@ namespace BPASmartClient.AGV httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 httpJobData.loadEquipmentId = 5; - httpJobData.unloadEquipmentId = 4; + httpJobData.unloadEquipmentId = 40; httpModel.jobData = httpJobData; string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; //货位到货位 @@ -526,7 +526,7 @@ namespace BPASmartClient.AGV httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 httpJobData.loadEquipmentId = 6; - httpJobData.unloadEquipmentId = 4; + httpJobData.unloadEquipmentId = 41; httpModel.jobData = httpJobData; string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; //货位到货位 @@ -581,7 +581,7 @@ namespace BPASmartClient.AGV httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 httpJobData.loadEquipmentId = 7; - httpJobData.unloadEquipmentId = 4; + httpJobData.unloadEquipmentId = 42; httpModel.jobData = httpJobData; string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; //货位到货位 @@ -636,7 +636,7 @@ namespace BPASmartClient.AGV httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 httpJobData.loadEquipmentId = 8; - httpJobData.unloadEquipmentId = 4; + httpJobData.unloadEquipmentId = 40; httpModel.jobData = httpJobData; string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; //货位到货位 @@ -691,7 +691,7 @@ namespace BPASmartClient.AGV httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 httpJobData.loadEquipmentId = 9; - httpJobData.unloadEquipmentId = 4; + httpJobData.unloadEquipmentId = 41; httpModel.jobData = httpJobData; string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; //货位到货位 diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs index e1325b1a..f0688f09 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs @@ -66,15 +66,23 @@ namespace BPASmartClient.CustomResource.Pages.Model { lock (runLock) { - RunLog runLog = new RunLog() + try { - Date = DateTime.Now.ToString("yyyy-MM-dd"), - Time = DateTime.Now.ToString("HH:mm:ss"), - RunLogInfo = info - }; - Sqlite.GetInstance.Base.Add(runLog); - Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); })); - RunLog?.Invoke(info); + RunLog runLog = new RunLog() + { + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + RunLogInfo = info + }; + Sqlite.GetInstance.Base.Add(runLog); + Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); })); + RunLog?.Invoke(info); + } + catch (Exception) + { + + // throw; + } } } diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml index ef67919e..e265a036 100644 --- a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml @@ -263,7 +263,8 @@ Margin="10,0,0,0" HorizontalAlignment="Left" Style="{StaticResource DataTextBlockStyle}" - Text="{Binding RunLogInfo}" /> + Text="{Binding RunLogInfo}" + TextWrapping="Wrap"/> + Text="{Binding LogInfo}" + TextWrapping="Wrap" + /> 0) - { - foreach (var items in MenuManage.GetInstance.menuModels) - { - foreach (var item in items.subMenumodels) - { - items.MainMenuVisibility = Visibility.Visible; - if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null) - { - item.SubMenuVisibility = Visibility.Visible; - } - } - } - } - } - } + ////分配后的权限 + //if (res.permission == Enums.Permission.管理员) + //{ + // foreach (var items in MenuManage.GetInstance.menuModels) + // { + // items.MainMenuVisibility = Visibility.Visible; + // foreach (var item in items.subMenumodels) + // { + // item.SubMenuVisibility = Visibility.Visible; + // } + // } + //} + //else + //{ + // if (res.userTreeViewModels != null) + // { + // if (res.userTreeViewModels.Count > 0) + // { + // foreach (var items in MenuManage.GetInstance.menuModels) + // { + // foreach (var item in items.subMenumodels) + // { + // items.MainMenuVisibility = Visibility.Visible; + // if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null) + // { + // item.SubMenuVisibility = Visibility.Visible; + // } + // } + // } + // } + // } + //} ActionManage.GetInstance.Send("PermissionChange"); diff --git a/BPASmartClient.Helper/Json.cs b/BPASmartClient.Helper/Json.cs index e20bdb75..c9950a08 100644 --- a/BPASmartClient.Helper/Json.cs +++ b/BPASmartClient.Helper/Json.cs @@ -22,6 +22,8 @@ namespace BPASmartClient.Helper public static T Data { get; set; } = new T(); + + /// /// 保存数据 /// @@ -36,12 +38,14 @@ namespace BPASmartClient.Helper /// public static void Read() { - if (File.Exists(path)) - { - string JsonString = File.ReadAllText(path); - var result = JsonConvert.DeserializeObject(JsonString); - if (result != null) { Data = result; } - } + + if (File.Exists(path)) + { + string JsonString = File.ReadAllText(path); + var result = JsonConvert.DeserializeObject(JsonString); + if (result != null) { Data = result; } + } + } /// diff --git a/BPASmartClient.HubHelper/HubHelper.cs b/BPASmartClient.HubHelper/HubHelper.cs index a687570a..7ae097ae 100644 --- a/BPASmartClient.HubHelper/HubHelper.cs +++ b/BPASmartClient.HubHelper/HubHelper.cs @@ -19,7 +19,6 @@ namespace BPASmartClient.HubHelper public void Connect(string ip, int port) { hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl($"http://{ip}:{port}/personhub").Build();//连接 - hubConnection.On("Report", (s) => { Report?.Invoke(s); });//客户端注册方法 hubConnection.On("Upstreamrequest", (s) => { Upstreamrequest?.Invoke(s); });//客户端注册方法 diff --git a/BPASmartClient.Modbus/ModbusTcp.cs b/BPASmartClient.Modbus/ModbusTcp.cs index aa6bf6a3..22d72013 100644 --- a/BPASmartClient.Modbus/ModbusTcp.cs +++ b/BPASmartClient.Modbus/ModbusTcp.cs @@ -37,7 +37,7 @@ namespace BPASmartClient.Modbus public Action Disconnect { get; set; } - public bool IsReconnect { get; set; } = true; //true=启用重连,false=禁用重连 + public bool IsReconnect { get; set; } = false; //true=启用重连,false=禁用重连 /// /// 判断是否连接成功 @@ -344,7 +344,7 @@ namespace BPASmartClient.Modbus { commandType = CommandType.Inputs; } - Show?.Invoke($"成功,地址:{address},值:{value}"); + //Show?.Invoke($"成功,地址:{address},值:{value}"); return true; } catch (Exception ex) diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 14d92d8f..5fe45596 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -51,7 +51,7 @@ namespace FryPot_DosingSystem //开启实时PLC数据读取 DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 AlarmHelper.Init();//报警实时监控 - HubHelper.GetInstance.Connect("172.16.12.100", 8089); + Task.Run(()=> { HubHelper.GetInstance.Connect("172.16.12.100", 8089); }); } else @@ -164,7 +164,7 @@ namespace FryPot_DosingSystem ParamSet.Add(new SubMenumodel() { SubMenuName = "PLC变量配置", - SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, + SubMenuPermission = new Permission[] { Permission.技术员 }, AssemblyName = "BPASmartClient.CustomResource", ToggleWindowPath = "Pages.View.VariableConfigView" }); @@ -253,13 +253,13 @@ namespace FryPot_DosingSystem AssemblyName = "BPASmartClient.CustomResource", ToggleWindowPath = "Pages.View.UserManageView" }); - UserManager.Add(new SubMenumodel() - { - SubMenuName = "NFC登录设置", - SubMenuPermission = new Permission[] { Permission.管理员 }, - AssemblyName = "BPASmartClient.CustomResource", - ToggleWindowPath = "Pages.View.NfcSetView" - }); + //UserManager.Add(new SubMenumodel() + //{ + // SubMenuName = "NFC登录设置", + // SubMenuPermission = new Permission[] { Permission.管理员 }, + // AssemblyName = "BPASmartClient.CustomResource", + // ToggleWindowPath = "Pages.View.NfcSetView" + //}); MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", @@ -269,11 +269,11 @@ namespace FryPot_DosingSystem subMenumodels = UserManager, }); #endregion - #region 调试界面 + #region 手动控制界面 ObservableCollection DebugManage = new ObservableCollection(); DebugManage.Add(new SubMenumodel() { - SubMenuName = "单一流程调试", + SubMenuName = "手动控制", SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, AssemblyName = "FryPot_DosingSystem", ToggleWindowPath = "View.DebugView" @@ -282,7 +282,7 @@ namespace FryPot_DosingSystem MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", - MainMenuName = "调试界面", + MainMenuName = "操作界面", Alias = "Debug Management", MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, subMenumodels = DebugManage, @@ -291,7 +291,7 @@ namespace FryPot_DosingSystem } private void LoginDataInite() { - //Config.GetInstance.Init();//用户数据初始化 + Config.GetInstance.Init();//用户数据初始化 Json.Read(); } } diff --git a/FryPot_DosingSystem/Control/DeviceOperate.cs b/FryPot_DosingSystem/Control/DeviceOperate.cs index 5f86e0e3..08d7086b 100644 --- a/FryPot_DosingSystem/Control/DeviceOperate.cs +++ b/FryPot_DosingSystem/Control/DeviceOperate.cs @@ -140,21 +140,56 @@ namespace FryPot_DosingSystem.Control IsConfig = false; MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载失败:文件无数据,请重新配置并重启软件"); } - //Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 - //Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 - //Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号 - //Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态 - //Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行 - //Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号 - //Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号 - //Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV - //Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV - //Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行 - //Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号 - //Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号 - //Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV - //Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号 - //Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号 + //消息注册 + modbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryOneModbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryTwoModbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryThreeModbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryFourModbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryFiveModbus.ShowEx += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + + modbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryOneModbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryTwoModbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryThreeModbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryFourModbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); + fryFiveModbus.Show += new Action((s) => + { + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); + }); } public void Connect() { @@ -176,17 +211,28 @@ namespace FryPot_DosingSystem.Control string DeviceName = devices.Devices[i].DeviceName; switch (DeviceName) { - case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线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; + case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; + case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; + case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; + case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; + case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; + case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); break; } } - + if (modbus.Connected) + MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); + if (fryOneModbus.Connected) + MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); + if (fryTwoModbus.Connected) + MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); + if (fryThreeModbus.Connected) + MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); + if (fryFourModbus.Connected) + MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); + if (fryFiveModbus.Connected) + MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); } } } @@ -198,30 +244,39 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StartLong(new Action(() => { //滚筒线 - Connected = modbus.Connected; - if (Connected) + try { - foreach (var item in Variables) + Connected = modbus.Connected; + if (Connected) { - var res = modbus.Read(item.Address, item.Length);//读取plc数据 - if (Data.ContainsKey(item.Address)) - { - Data[item.Address] = res; - } - else + foreach (var item in Variables) { - Data.TryAdd(item.Address, res); + var res = modbus.Read(item.Address, item.Length);//读取plc数据 + if (Data.ContainsKey(item.Address)) + { + Data[item.Address] = res; + } + else + { + Data.TryAdd(item.Address, res); + } } - } + } + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "滚筒输送线"); + if (res != null) + modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "滚筒输送线"); - if (res != null) - modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC重连成功"); + + // throw; } Thread.Sleep(10); }), $"滚筒线实时数据读取线程"); @@ -231,151 +286,195 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StartLong(new Action(() => { - //炒锅1 - FryOneConnected = fryOneModbus.Connected; - if (FryOneConnected) + try { - foreach (var item in FryOneVariables) + //炒锅1 + FryOneConnected = fryOneModbus.Connected; + if (FryOneConnected) { - var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 - if (FryOneData.ContainsKey(item.Address)) + foreach (var item in FryOneVariables) { - FryOneData[item.Address] = res; - } - else - { - FryOneData.TryAdd(item.Address, res); + var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 + if (FryOneData.ContainsKey(item.Address)) + { + FryOneData[item.Address] = res; + } + else + { + FryOneData.TryAdd(item.Address, res); + } } + //Thread.Sleep(50); + } - //Thread.Sleep(50); + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1"); + if (res != null) + fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1"); - if (res != null) - fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功"); + + //throw; } Thread.Sleep(10); }), $"炒锅1实时数据读取线程"); ThreadManage.GetInstance().StartLong(new Action(() => { - //炒锅2 - FryTwoConnected = fryTwoModbus.Connected; - if (FryTwoConnected) + try { - foreach (var item in FryTwoVariables) + //炒锅2 + FryTwoConnected = fryTwoModbus.Connected; + if (FryTwoConnected) { - var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 - if (FryTwoData.ContainsKey(item.Address)) + foreach (var item in FryTwoVariables) { - FryTwoData[item.Address] = res; - } - else - { - FryTwoData.TryAdd(item.Address, res); + var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 + if (FryTwoData.ContainsKey(item.Address)) + { + FryTwoData[item.Address] = res; + } + else + { + FryTwoData.TryAdd(item.Address, res); + } } } - - + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2"); + if (res != null) + fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2"); - if (res != null) - fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功"); + + //throw; } Thread.Sleep(10); }), $"炒锅2实时数据读取线程"); ThreadManage.GetInstance().StartLong(new Action(() => { //炒锅3 - FryThreeConnected = fryThreeModbus.Connected; - if (FryThreeConnected) + try { - foreach (var item in FryThreeVariables) + FryThreeConnected = fryThreeModbus.Connected; + if (FryThreeConnected) { - var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 - if (FryThreeData.ContainsKey(item.Address)) - { - FryThreeData[item.Address] = res; - } - else + foreach (var item in FryThreeVariables) { - FryThreeData.TryAdd(item.Address, res); + var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 + if (FryThreeData.ContainsKey(item.Address)) + { + FryThreeData[item.Address] = res; + } + else + { + FryThreeData.TryAdd(item.Address, res); + } } - } - //Thread.Sleep(50); + //Thread.Sleep(50); + } + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3"); + if (res != null) + fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3"); - if (res != null) - fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功"); + + //throw; } Thread.Sleep(10); }), $"炒锅3实时数据读取线程"); ThreadManage.GetInstance().StartLong(new Action(() => { - //炒锅4 - FryFourConnected = fryFourModbus.Connected; - if (FryFourConnected) + try { - foreach (var item in FryFourVariables) + //炒锅4 + FryFourConnected = fryFourModbus.Connected; + if (FryFourConnected) { - var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 - if (FryFourData.ContainsKey(item.Address)) - { - FryFourData[item.Address] = res; - } - else + foreach (var item in FryFourVariables) { - FryFourData.TryAdd(item.Address, res); + var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 + if (FryFourData.ContainsKey(item.Address)) + { + FryFourData[item.Address] = res; + } + else + { + FryFourData.TryAdd(item.Address, res); + } } - } - //Thread.Sleep(50); + //Thread.Sleep(50); + } + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4"); + if (res != null) + fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4"); - if (res != null) - fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功"); + + //throw; } Thread.Sleep(10); }), $"炒锅4实时数据读取线程"); ThreadManage.GetInstance().StartLong(new Action(() => { - //炒锅5 - FryFiveConnected = fryFiveModbus.Connected; - if (FryFiveConnected) + try { - foreach (var item in FryFiveVariables) + //炒锅5 + FryFiveConnected = fryFiveModbus.Connected; + if (FryFiveConnected) { - var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 - if (FryFiveData.ContainsKey(item.Address)) - { - FryFiveData[item.Address] = res; - } - else + foreach (var item in FryFiveVariables) { - FryFiveData.TryAdd(item.Address, res); + var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 + if (FryFiveData.ContainsKey(item.Address)) + { + FryFiveData[item.Address] = res; + } + else + { + FryFiveData.TryAdd(item.Address, res); + } } - } - // Thread.Sleep(50); + // Thread.Sleep(50); + } + else + { + DeviceManage devices = Json.Data; + var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5"); + if (res != null) + fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); + Thread.Sleep(10000); + } } - else + catch (Exception) { - DeviceManage devices = Json.Data; - var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5"); - if (res != null) - fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功"); + + // throw; } Thread.Sleep(10); }), $"炒锅5实时数据读取线程"); @@ -414,6 +513,16 @@ namespace FryPot_DosingSystem.Control { fryOneModbus.Write(address,value); } + /// + /// 炒锅1工艺目标重量偏差 + /// + /// + /// + public void WritePotOneRealPlcData(string address, float value) + { + fryOneModbus.SetReal(address, value); + } + /// /// 炒锅2工艺数据 /// @@ -425,6 +534,15 @@ namespace FryPot_DosingSystem.Control } /// + /// 炒锅2工艺目标重量偏差 + /// + /// + /// + public void WritePotTwoRealPlcData(string address, float value) + { + fryTwoModbus.SetReal(address, value); + } + /// /// 炒锅3工艺数据 /// /// @@ -435,6 +553,15 @@ namespace FryPot_DosingSystem.Control } /// + /// 炒锅3工艺目标重量偏差 + /// + /// + /// + public void WritePotThreeRealPlcData(string address, float value) + { + fryThreeModbus.SetReal(address, value); + } + /// /// 炒锅4工艺数据 /// /// @@ -445,6 +572,15 @@ namespace FryPot_DosingSystem.Control fryFourModbus.Write(address,value); } /// + /// 炒锅4工艺目标重量偏差 + /// + /// + /// + public void WritePotFourRealPlcData(string address, float value) + { + fryFourModbus.SetReal(address, value); + } + /// /// 炒锅5工艺数据 /// /// @@ -454,6 +590,15 @@ namespace FryPot_DosingSystem.Control fryFiveModbus.Write(address, value); } + /// + /// 炒锅5工艺目标重量偏差 + /// + /// + /// + public void WritePotFiveRealPlcData(string address, float value) + { + fryFiveModbus.SetReal(address, value); + } public ConcurrentDictionary GetAllData() { return Data; diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index c961fc70..4e7e7d67 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -24,6 +24,7 @@ using System.Runtime.Serialization.Formatters.Binary; using System.Diagnostics; using BPASmartClient.CustomResource.UserControls.MessageShow; using BPASmartClient.CustomResource.UserControls; +using Renci.SshNet.Messages; namespace FryPot_DosingSystem.Control { @@ -162,6 +163,17 @@ namespace FryPot_DosingSystem.Control private static readonly object Pot_Lock = new object();//炒股工艺工艺下发锁 public int CleanNum = 0;//当前清洗台桶数 + ushort LOneCurrentRollerNum = 0;//当前线体1的空桶桶号 + ushort LTwoCurrentRollerNum = 0;//当前线体2的空桶桶号 + ushort LThreeCurrentRollerNum = 0;//当前线体3的空桶桶号 + + + public NewRecipeModel potOneCurrentRecipe = null; + public NewRecipeModel potTwoCurrentRecipe = null; + public NewRecipeModel potThreeCurrentRecipe = null; + public NewRecipeModel potFourCurrentRecipe = null; + public NewRecipeModel potFiveCurrentRecipe = null; + #endregion /// /// 调试命令注册 @@ -185,145 +197,131 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineThreeLoadEmptyRoller = true; }), "AgvArriveLineThreeEmptyRollerLoc"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.CleanComplete = 1; + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.CleanComplete = 1; - }), "CleanPlateCallAgv"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位 - globalVar.rollerLineTwo.agvArriveCleanUnLoad = true; - globalVar.rollerLineThree.agvArriveCleanUnLoad = true; + //}), "CleanPlateCallAgv"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位 + // globalVar.rollerLineTwo.agvArriveCleanUnLoad = true; + // globalVar.rollerLineThree.agvArriveCleanUnLoad = true; - }), "AgvArriveCleanPlateLoc"); + //}), "AgvArriveCleanPlateLoc"); ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveCleanLoad = true;//清洗台空桶上料就位 }), "AgvArriveCleanPlateLocLoad"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.agvArriveLineFour = true; - globalVar.rollerLineOne.agvArriveLineFour = true; - globalVar.rollerLineTwo.agvArriveLineFour = true; - globalVar.rollerLineThree.agvArriveLineFour = true; - }), "AgvArriveLineFourLoc"); - - ActionManage.GetInstance.Register(new Action(() => - { - LineOneEmptyRollerCleanTaskRestart(); - - }), "EmptyRollerCleanTaskRestart"); - ActionManage.GetInstance.Register(new Action(() => - { - LineTwoEmptyRollerCleanTaskRestart(); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.agvArriveLineFour = true; + // globalVar.rollerLineOne.agvArriveLineFour = true; + // globalVar.rollerLineTwo.agvArriveLineFour = true; + // globalVar.rollerLineThree.agvArriveLineFour = true; + //}), "AgvArriveLineFourLoc"); - }), "LineTwoEmptyRollerCleanTaskRestart"); - ActionManage.GetInstance.Register(new Action(() => - { - LineThreeEmptyRollerCleanTaskRestart(); - }), "LineThreeEmptyRollerCleanTaskRestart"); #endregion //接口调试 - ActionManage.GetInstance.Register(new Action(() => - { - string id = Guid.NewGuid().ToString("D"); - string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); - if (errorCode == "SUCCESS") - { - MessageNotify.GetInstance.ShowRunLog($"AGV任务下发成功"); - } - else if (errorCode == "Analysis Error") - { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文"); - } - else - { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}"); - } - }), "AgvDebug"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // string id = Guid.NewGuid().ToString("D"); + // string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); + // if (errorCode == "SUCCESS") + // { + // MessageNotify.GetInstance.ShowRunLog($"AGV任务下发成功"); + // } + // else if (errorCode == "Analysis Error") + // { + // MessageNotify.GetInstance.ShowRunLog($"提示:AGV 调用API失败,请检查请求报文"); + // } + // else + // { + // MessageNotify.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}"); + // } + //}), "AgvDebug"); - ActionManage.GetInstance.Register(() => - { - MessageNotify.GetInstance.ShowRunLog("清洗台卸桶完成"); + //ActionManage.GetInstance.Register(() => + //{ + // MessageNotify.GetInstance.ShowRunLog("清洗台卸桶完成"); - }, "AgvArriveCleanPlateLocCom"); + //}, "AgvArriveCleanPlateLocCom"); - ActionManage.GetInstance.Register(() => - { - MessageNotify.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成"); - MessageNotify.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成"); - MessageNotify.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成"); - MessageNotify.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成"); + //ActionManage.GetInstance.Register(() => + //{ + // MessageNotify.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成"); + // MessageNotify.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成"); + // MessageNotify.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成"); + // MessageNotify.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成"); - }, "AgvArriveLineFourLocCom"); - ActionManage.GetInstance.Register(() => - { - MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成"); + //}, "AgvArriveLineFourLocCom"); + //ActionManage.GetInstance.Register(() => + //{ + // MessageNotify.GetInstance.ShowRunLog("清洗台空桶装载完成"); - }, "AgvArriveCleanPlateLocLoadCom"); + //}, "AgvArriveCleanPlateLocLoadCom"); - ActionManage.GetInstance.Register(() => - { - // globalVar.rollerLineOne.RecipeCompleteSingle = 1; + //ActionManage.GetInstance.Register(() => + //{ + // // globalVar.rollerLineOne.RecipeCompleteSingle = 1; - }, "LineOneRecipeComSignal"); - ActionManage.GetInstance.Register(() => - { - // globalVar.rollerLineTwo.RecipeCompleteSingle = 1; + //}, "LineOneRecipeComSignal"); + //ActionManage.GetInstance.Register(() => + //{ + // // globalVar.rollerLineTwo.RecipeCompleteSingle = 1; - }, "LineTwoRecipeComSignal"); - ActionManage.GetInstance.Register(() => - { - // globalVar.rollerLineThree.RecipeCompleteSingle = 1; + //}, "LineTwoRecipeComSignal"); + //ActionManage.GetInstance.Register(() => + //{ + // // globalVar.rollerLineThree.RecipeCompleteSingle = 1; - }, "LineThreeRecipeComSignal"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.agvArriveLineOneLoadCom = true; - }), "AgvLineOneLoadEmptyCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.agvArriveLineTwoLoadCom = true; - }), "AgvLineTwoLoadEmptyCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.agvArriveLineThreeLoadCom = true; - }), "AgvLineThreeLoadEmptyCom"); + //}, "LineThreeRecipeComSignal"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.agvArriveLineOneLoadCom = true; + //}), "AgvLineOneLoadEmptyCom"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.agvArriveLineTwoLoadCom = true; + //}), "AgvLineTwoLoadEmptyCom"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.agvArriveLineThreeLoadCom = true; + //}), "AgvLineThreeLoadEmptyCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineOne.CanRun = true; - }), "AGVLineOneLoadCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineTwo.CanRun = true; - }), "AGVLineTwoLoadCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineThree.CanRun = true; - }), "AGVLineThreeLoadCom"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineOne.CanRun = true; + //}), "AGVLineOneLoadCom"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineTwo.CanRun = true; + //}), "AGVLineTwoLoadCom"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineThree.CanRun = true; + //}), "AGVLineThreeLoadCom"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineOne.OutMaterialingSingle = 1; - }), "RollerLineRunning"); - ActionManage.GetInstance.Register(new Action((obj) => - { - globalVar.rollerLineOne.StationEight = (ushort)obj; - }), "EightWorkLoc"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotOne.InputMaterialArrivedSingle = 1; - globalVar.fryPotFour.InputMaterialArrivedSingle = 1; - }), "FryPotInputArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1; - globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1; - }), "FryPotEmptyRollerArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineOne.OutMaterialingSingle = 1; + //}), "RollerLineRunning"); + //ActionManage.GetInstance.Register(new Action((obj) => + //{ + // globalVar.rollerLineOne.StationEight = (ushort)obj; + //}), "EightWorkLoc"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotOne.InputMaterialArrivedSingle = 1; + // globalVar.fryPotFour.InputMaterialArrivedSingle = 1; + //}), "FryPotInputArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1; + // globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1; + //}), "FryPotEmptyRollerArrive"); ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveUpLoad = true; @@ -336,30 +334,30 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveUpLoad = true; }), "AGVFryPotUpArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.agvFryPotEmptyRollerArrive = true; + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.agvFryPotEmptyRollerArrive = true; - }), "AGVFryPotGetEmptyRoller"); + //}), "AGVFryPotGetEmptyRoller"); //滚筒线2 - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineTwo.OutMaterialingSingle = 1; - }), "RollerLineTwoRunning"); - ActionManage.GetInstance.Register(new Action((obj) => - { - globalVar.rollerLineTwo.StationEight = (ushort)obj; - }), "TwoEightWorkLoc"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotTwo.InputMaterialArrivedSingle = 1; - globalVar.fryPotFive.InputMaterialArrivedSingle = 1; - }), "FryPotTwoInputArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1; - globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1; - }), "FryPotTwoEmptyRollerArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineTwo.OutMaterialingSingle = 1; + //}), "RollerLineTwoRunning"); + //ActionManage.GetInstance.Register(new Action((obj) => + //{ + // globalVar.rollerLineTwo.StationEight = (ushort)obj; + //}), "TwoEightWorkLoc"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotTwo.InputMaterialArrivedSingle = 1; + // globalVar.fryPotFive.InputMaterialArrivedSingle = 1; + //}), "FryPotTwoInputArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1; + // globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1; + //}), "FryPotTwoEmptyRollerArrive"); ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveLTwoUpLoad = true; @@ -372,28 +370,28 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveLTwoUpLoad = true; }), "AGVFryPotTwoUpArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.LTwoagvFryPotEmptyRollerArrive = true; + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.LTwoagvFryPotEmptyRollerArrive = true; - }), "AGVFryPotTwoGetEmptyRoller"); + //}), "AGVFryPotTwoGetEmptyRoller"); //滚筒线3 - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.rollerLineThree.OutMaterialingSingle = 1; - }), "RollerLineThreeRunning"); - ActionManage.GetInstance.Register(new Action((obj) => - { - globalVar.rollerLineThree.StationEight = (ushort)obj; - }), "ThreeEightWorkLoc"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotThree.InputMaterialArrivedSingle = 1; - }), "FryPotThreeInputArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1; - }), "FryPotThreeEmptyRollerArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.rollerLineThree.OutMaterialingSingle = 1; + //}), "RollerLineThreeRunning"); + //ActionManage.GetInstance.Register(new Action((obj) => + //{ + // globalVar.rollerLineThree.StationEight = (ushort)obj; + //}), "ThreeEightWorkLoc"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotThree.InputMaterialArrivedSingle = 1; + //}), "FryPotThreeInputArrive"); + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1; + //}), "FryPotThreeEmptyRollerArrive"); ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveLThreeUpLoad = true; @@ -406,11 +404,11 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveLThreeUpLoad = true; }), "AGVFryPotThreeUpArrive"); - ActionManage.GetInstance.Register(new Action(() => - { - globalVar.LThreeagvFryPotEmptyRollerArrive = true; + //ActionManage.GetInstance.Register(new Action(() => + //{ + // globalVar.LThreeagvFryPotEmptyRollerArrive = true; - }), "AGVFryPotThreeGetEmptyRoller"); + //}), "AGVFryPotThreeGetEmptyRoller"); } public DosingLogicControl() { @@ -433,14 +431,35 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit"); ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit"); ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.ExitLineOneTask = true; + LineOneEmptyRollerCleanTaskRestart(); + + }), "EmptyRollerCleanTaskRestart"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.ExitLineTwoTask = true; + LineTwoEmptyRollerCleanTaskRestart(); + + }), "LineTwoEmptyRollerCleanTaskRestart"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.ExitLineThreeTask = true; + LineThreeEmptyRollerCleanTaskRestart(); + + }), "LineThreeEmptyRollerCleanTaskRestart"); HubHelper.GetInstance.Report = new Action(AgvTaskUpReportDataAnalysis); HubHelper.GetInstance.Upstreamrequest = new Action(AgvFeedBackUpReportDataAnalysis); //ResetProgram(); ReadPlcData(); + SaveFryPotData(); MainTask(); - // CommandRegist(); + CommandRegist(); } + + /// /// 文件数据定期清理 /// @@ -699,8 +718,7 @@ namespace FryPot_DosingSystem.Control } } } - int cout = 0; - int cout1 = 0; + /// /// AGV上下料上报数据解析 /// @@ -755,11 +773,10 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅空桶上料位置"); AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//发送AGV到位信号 } - if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if (objData.equipmentId == 40 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置 //AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - } //炒锅2,5到线体4 if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "LOAD") @@ -769,7 +786,7 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//发送AGV到位信号 } - if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if (objData.equipmentId == 41 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置 @@ -782,7 +799,7 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowRunLog($"AGV到达【{globalVar.LThreeFryPotSerial}】号炒锅空桶上料位置"); AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//发送AGV到位信号 } - if (objData.equipmentId == 4 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if (objData.equipmentId == 42 && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置 } @@ -1001,6 +1018,7 @@ namespace FryPot_DosingSystem.Control { DeviceOperate.GetInstance.WritePlcData("D1058", 0); } + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj); AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); @@ -1253,7 +1271,7 @@ namespace FryPot_DosingSystem.Control // 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);//去四号空桶线 + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_4);//去四号空桶线 AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum); } @@ -1349,7 +1367,7 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.CanRun = true; globalVar.ExitLineOneTask = false; - + globalVar.LOneCurrentRecipeName = string.Empty; globalVar.AllowAgvToLineLoadRoller = true; @@ -1362,16 +1380,19 @@ namespace FryPot_DosingSystem.Control globalVar.LOneMaterialNum = 0; globalVar.LOneCurrentCookingStep = 0; + globalVar.LFourCurrentCookingStep = 0; + - //globalVar.agvArriveUpLoad = false; - //globalVar.agvArriveUnLoad = false; - //globalVar.agvFryPotEmptyRollerArrive = false; - //globalVar.agvLineOneLoadCom = false; + globalVar.agvArriveUpLoad = false; + globalVar.agvArriveUnLoad = false; + globalVar.agvFryPotEmptyRollerArrive = false; + globalVar.rollerLineOne.agvArriveLineFour = false; + globalVar.agvLineOneLoadCom = false; ErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); MessageNotify.GetInstance.ShowUserLog("滚筒线【1】任务重启成功"); - + })); } public void LineTwoTaskRestart() @@ -1399,7 +1420,7 @@ namespace FryPot_DosingSystem.Control globalVar.AllowAgvToLineTwoLoadRoller = true; globalVar.LTwoInOrOutputLock = false; - + globalVar.LTwoLoadRoller = false; globalVar.LTwoAgvToFryPot = false; globalVar.LTwoPotInputMaterialArrive = false; @@ -1408,11 +1429,13 @@ namespace FryPot_DosingSystem.Control globalVar.LTwoMaterialNum = 0; globalVar.LTwoCurrentCookingStep = 0; + globalVar.LFiveCurrentCookingStep = 0; - //globalVar.agvArriveLTwoUpLoad = false; - //globalVar.LTwoagvArriveUnLoad = false; - //globalVar.LTwoagvFryPotEmptyRollerArrive = false; - //globalVar.agvLineTwoLoadCom = false; + globalVar.agvArriveLTwoUpLoad = false; + globalVar.LTwoagvArriveUnLoad = false; + globalVar.LTwoagvFryPotEmptyRollerArrive = false; + globalVar.rollerLineTwo.agvArriveLineFour = false; + globalVar.agvLineTwoLoadCom = false; LTwoErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); @@ -1451,10 +1474,11 @@ namespace FryPot_DosingSystem.Control globalVar.LThreeMaterialNum = 0; 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.rollerLineThree.agvArriveLineFour = false; + globalVar.agvLineThreeLoadCom = false; LThreeErrorRecipe = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); MessageNotify.GetInstance.ShowUserLog("滚筒线【3】任务重启成功"); @@ -1466,10 +1490,11 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() => { globalVar.rollerLineOne.StationEight = 0; - globalVar.rollerLineOne.EmptyRollerNums.Clear(); - + globalVar.ExitLineOneTask = false; + //globalVar.rollerLineOne.EmptyRollerNums.Clear(); + globalVar.rollerLineOne.IsEpmtyBefore = false; - globalVar.rollerLineOne.CanRun = true; + globalVar.rollerLineOne.CanRun = true; globalVar.agvArriveLineFour = false; globalVar.agvArriveCleanLoad = false; @@ -1488,8 +1513,9 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineTwo.StationEight = 0; - globalVar.rollerLineTwo.EmptyRollerNums.Clear(); - + globalVar.ExitLineTwoTask = false; + // globalVar.rollerLineTwo.EmptyRollerNums.Clear(); + globalVar.rollerLineTwo.IsEpmtyBefore = false; globalVar.rollerLineTwo.CanRun = true; @@ -1510,8 +1536,9 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() => { globalVar.rollerLineThree.StationEight = 0; - globalVar.rollerLineThree.EmptyRollerNums.Clear(); - + globalVar.ExitLineThreeTask = false; + // globalVar.rollerLineThree.EmptyRollerNums.Clear(); + globalVar.rollerLineThree.IsEpmtyBefore = false; globalVar.rollerLineThree.CanRun = true; @@ -1533,36 +1560,69 @@ namespace FryPot_DosingSystem.Control { GetAddressData("D2001", new Action((data) => { - globalVar.rollerLineOne.StationOne = data[0]; - globalVar.rollerLineOne.StationTwo = data[1]; - globalVar.rollerLineOne.StationThree = data[2]; - globalVar.rollerLineOne.StationFour = data[3]; - globalVar.rollerLineOne.StationFive = data[4]; - globalVar.rollerLineOne.StationSix = data[5]; - globalVar.rollerLineOne.StationSeven = data[6]; - globalVar.rollerLineOne.StationEight = data[7]; + try + { + if (data.Count() > 0) + { + globalVar.rollerLineOne.StationOne = data[0]; + globalVar.rollerLineOne.StationTwo = data[1]; + globalVar.rollerLineOne.StationThree = data[2]; + globalVar.rollerLineOne.StationFour = data[3]; + globalVar.rollerLineOne.StationFive = data[4]; + globalVar.rollerLineOne.StationSix = data[5]; + globalVar.rollerLineOne.StationSeven = data[6]; + globalVar.rollerLineOne.StationEight = data[7]; + } + } + catch (Exception) + { + + // throw; + } })); GetAddressData("D2011", new Action((data) => { - globalVar.rollerLineTwo.StationOne = data[0]; - globalVar.rollerLineTwo.StationTwo = data[1]; - globalVar.rollerLineTwo.StationThree = data[2]; - globalVar.rollerLineTwo.StationFour = data[3]; - globalVar.rollerLineTwo.StationFive = data[4]; - globalVar.rollerLineTwo.StationSix = data[5]; - globalVar.rollerLineTwo.StationSeven = data[6]; - globalVar.rollerLineTwo.StationEight = data[7]; + try + { + if (data.Count() > 0) + { + globalVar.rollerLineTwo.StationOne = data[0]; + globalVar.rollerLineTwo.StationTwo = data[1]; + globalVar.rollerLineTwo.StationThree = data[2]; + globalVar.rollerLineTwo.StationFour = data[3]; + globalVar.rollerLineTwo.StationFive = data[4]; + globalVar.rollerLineTwo.StationSix = data[5]; + globalVar.rollerLineTwo.StationSeven = data[6]; + globalVar.rollerLineTwo.StationEight = data[7]; + } + } + catch (Exception) + { + + // throw; + } })); GetAddressData("D2021", new Action((data) => { - globalVar.rollerLineThree.StationOne = data[0]; - globalVar.rollerLineThree.StationTwo = data[1]; - globalVar.rollerLineThree.StationThree = data[2]; - globalVar.rollerLineThree.StationFour = data[3]; - globalVar.rollerLineThree.StationFive = data[4]; - globalVar.rollerLineThree.StationSix = data[5]; - globalVar.rollerLineThree.StationSeven = data[6]; - globalVar.rollerLineThree.StationEight = data[7]; + try + { + if (data.Count() > 0) + { + globalVar.rollerLineThree.StationOne = data[0]; + globalVar.rollerLineThree.StationTwo = data[1]; + globalVar.rollerLineThree.StationThree = data[2]; + globalVar.rollerLineThree.StationFour = data[3]; + globalVar.rollerLineThree.StationFive = data[4]; + globalVar.rollerLineThree.StationSix = data[5]; + globalVar.rollerLineThree.StationSeven = data[6]; + globalVar.rollerLineThree.StationEight = data[7]; + } + } + catch (Exception) + { + + //throw; + } })); GetAddressData("D2031", new Action((data) => { @@ -1574,9 +1634,20 @@ namespace FryPot_DosingSystem.Control //AlarmHelper.GetInstance().LineTwoRollerRunning = data[4]; //AlarmHelper.GetInstance().LineThreeRollerRunning = data[5]; - AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble = data[6]; - AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble = data[7]; - AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble = data[8]; + try + { + if (data.Count() > 0) + { + AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble = data[6]; + AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble = data[7]; + AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble = data[8]; + } + } + catch (Exception) + { + + // throw; + } })); //GetAddressData("D2040", new Action((data) => @@ -1596,19 +1667,41 @@ namespace FryPot_DosingSystem.Control //})); GetAddressData("D2045", new Action((data) => { - globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; - globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; - globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; - globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; - globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; + try + { + if (data.Count() > 0) + { + globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; + globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; + globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; + globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; + globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; + } + } + catch (Exception) + { + + // throw; + } })); GetAddressData("D2050", new Action((data) => { - globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; - globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; - globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; - globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; - globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; + try + { + if (data.Count() > 0) + { + globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; + globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; + globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; + globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; + globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; + } + } + catch (Exception) + { + + //throw; + } })); //GetAddressData("D2065", new Action((data) => //{ @@ -1631,11 +1724,22 @@ namespace FryPot_DosingSystem.Control //globalVar.fryPotThree.RollerTroubleSingle = data[2]; //globalVar.fryPotFour.RollerTroubleSingle = data[3]; //globalVar.fryPotFive.RollerTroubleSingle = data[4]; - AlarmHelper.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble = data[0]; - AlarmHelper.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble = data[1]; - AlarmHelper.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble = data[2]; - AlarmHelper.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble = data[3]; - AlarmHelper.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble = data[4]; + try + { + if (data.Count() > 0) + { + AlarmHelper.GetInstance("1号炒锅滚筒故障").FryPotOneRollerTrouble = data[0]; + AlarmHelper.GetInstance("2号炒锅滚筒故障").FryPotTwoRollerTrouble = data[1]; + AlarmHelper.GetInstance("3号炒锅滚筒故障").FryPotThreeRollerTrouble = data[2]; + AlarmHelper.GetInstance("4号炒锅滚筒故障").FryPotFourRollerTrouble = data[3]; + AlarmHelper.GetInstance("5号炒锅滚筒故障").FryPotFiveRollerTrouble = data[4]; + } + } + catch (Exception) + { + + // throw; + } })); //GetAddressData("D2078", new Action(data => //{ @@ -1645,224 +1749,739 @@ namespace FryPot_DosingSystem.Control //})); GetAddressData("D2075", new Action(data => { - AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning = data[0]; - globalVar.CleadBarrelEnterSingle = data[0]; + try + { + if (data.Count() > 0) + { + AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning = data[0]; + globalVar.CleadBarrelEnterSingle = data[0]; + } + } + catch (Exception) + { + + // throw; + } })); GetAddressData("D2076", new Action(data => { - globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号 + try + { + if (data.Count() > 0) + globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号 + } + catch (Exception) + { + + //throw; + } })); GetAddressData("D2077", new Action(data => { - AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning = data[0]; - globalVar.CleadBarrelExitSingle = data[0]; + try + { + if (data.Count() > 0) + { + AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning = data[0]; + globalVar.CleadBarrelExitSingle = data[0]; + } + } + catch (Exception) + { + + // throw; + } })); //滚筒线123开始信号 GetAddressData("D2101", new Action(data => { - globalVar.rollerLineOne.ExcuteIsConfirm = data[0]; - globalVar.rollerLineTwo.ExcuteIsConfirm = data[1]; - globalVar.rollerLineThree.ExcuteIsConfirm = data[2]; - })); - GetAddressData("D4400", new Action(data => + try + { + if (data.Count() > 0) + { + globalVar.rollerLineOne.ExcuteIsConfirm = data[0]; + globalVar.rollerLineTwo.ExcuteIsConfirm = data[1]; + globalVar.rollerLineThree.ExcuteIsConfirm = data[2]; + } + } + catch (Exception) + { + + //throw; + } + })); + GetAddressData("D4400", new Action(data => { - globalVar.rollerLineOne.EmptyRollerNum = data[0]; + try + { + if (data.Count() > 0) + globalVar.rollerLineOne.EmptyRollerNum = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetAddressData("D4410", new Action(data => { - globalVar.rollerLineTwo.EmptyRollerNum = data[0]; + try + { + if (data.Count() > 0) + globalVar.rollerLineTwo.EmptyRollerNum = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetAddressData("D4420", new Action(data => { - globalVar.rollerLineThree.EmptyRollerNum = data[0]; + try + { + if (data.Count() > 0) + globalVar.rollerLineThree.EmptyRollerNum = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetAddressData("D2111", new Action(data => { - globalVar.rollerLineOne.WashEmptyRollerModel = data[0]; - globalVar.rollerLineTwo.WashEmptyRollerModel = data[1]; - globalVar.rollerLineThree.WashEmptyRollerModel = data[2]; + try + { + if (data.Count() > 0) + { + globalVar.rollerLineOne.WashEmptyRollerModel = data[0]; + globalVar.rollerLineTwo.WashEmptyRollerModel = data[1]; + globalVar.rollerLineThree.WashEmptyRollerModel = data[2]; - globalVar.rollerLineOne.WashRollerArriveSignal = data[3]; - globalVar.rollerLineTwo.WashRollerArriveSignal = data[4]; - globalVar.rollerLineThree.WashRollerArriveSignal = data[5]; + globalVar.rollerLineOne.WashRollerArriveSignal = data[3]; + globalVar.rollerLineTwo.WashRollerArriveSignal = data[4]; + globalVar.rollerLineThree.WashRollerArriveSignal = data[5]; + } + } + catch (Exception) + { + + // throw; + } })); //炒锅1状态数据 GetFryOneData("D0258", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.Temperature = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.Temperature = data[0] / 10.0; + } + catch (Exception) + { + + // throw; + } })); GetFryOneData("D0510", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.SmallFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.SmallFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryOneData("D0512", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.MidFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.MidFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryOneData("D0514", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.BigFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.BigFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryOneData("D0516", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.StrongFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.StrongFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryOneData("D2500", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.Speed = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.Speed = data[0] / 10.0; + } + catch (Exception) + { + + // throw; + } })); GetFryOneData("D0600", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.FryPotWeight = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryOne.FryPotWeight = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryOneData("D3000", new Action(data => { - FryPotMonitorManage.GetInstance.fryOne.Step = data[0]; + try + { + if (data.Count() > 0) + { + FryPotMonitorManage.GetInstance.fryOne.Step = data[0]; + globalVar.fryPotOne.ProcessStep = data[0]; + } + } + catch (Exception) + { + + //throw; + } })); + GetFryOneData("D3301", new Action(data => + { + try + { + if (data.Count() > 0) + globalVar.fryPotOne.RecipeCompleteSingle = data[0]; + } + catch (Exception) + { + //throw; + } + })); ////炒锅2状态数据 GetFryTwoData("D0258", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.Temperature = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.Temperature = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryTwoData("D0510", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.SmallFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.SmallFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryTwoData("D0512", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.MidFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.MidFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryTwoData("D0514", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.BigFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.BigFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryTwoData("D0516", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.StrongFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.StrongFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryTwoData("D2500", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.Speed = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.Speed = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryTwoData("D0600", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryTwoData("D3000", new Action(data => { - FryPotMonitorManage.GetInstance.fryTwo.Step = data[0]; + try + { + if (data.Count() > 0) + { + FryPotMonitorManage.GetInstance.fryTwo.Step = data[0]; + globalVar.fryPotTwo.ProcessStep = data[0]; + } + } + catch (Exception) + { + + // throw; + } })); + GetFryTwoData("D3302", new Action(data => + { + try + { + if (data.Count() > 0) + globalVar.fryPotTwo.RecipeCompleteSingle = data[0]; + } + catch (Exception) + { + // throw; + } + })); ////炒锅3状态数据 GetFryThreeData("D0258", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.Temperature = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.Temperature = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryThreeData("D0510", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.SmallFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.SmallFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryThreeData("D0512", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.MidFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.MidFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryThreeData("D0514", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.BigFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.BigFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryThreeData("D0516", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.StrongFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.StrongFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryThreeData("D2500", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.Speed = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.Speed = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryThreeData("D0600", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.FryPotWeight = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryThree.FryPotWeight = data[0] / 10.0; + } + catch (Exception) + { + + // throw; + } })); GetFryThreeData("D3000", new Action(data => { - FryPotMonitorManage.GetInstance.fryThree.Step = data[0]; + try + { + if (data.Count() > 0) + { + FryPotMonitorManage.GetInstance.fryThree.Step = data[0]; + globalVar.fryPotThree.ProcessStep = data[0]; + } + } + catch (Exception) + { + + // throw; + } })); + GetFryThreeData("D3303", new Action(data => + { + try + { + if (data.Count() > 0) + globalVar.fryPotThree.RecipeCompleteSingle = data[0]; + } + catch (Exception) + { + //throw; + } + })); //})); ////炒锅4状态数据 GetFryFourData("D0258", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.Temperature = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.Temperature = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryFourData("D0510", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.SmallFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.SmallFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryFourData("D0512", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.MidFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.MidFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryFourData("D0514", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.BigFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.BigFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryFourData("D0516", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.StrongFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.StrongFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryFourData("D2500", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + } + catch (Exception) + { + + // throw; + } })); GetFryFourData("D0600", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.FryPotWeight = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.FryPotWeight = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryFourData("D3000", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.Step = data[0]; + try + { + if (data.Count() > 0) + { + FryPotMonitorManage.GetInstance.fryFour.Step = data[0]; + globalVar.fryPotFour.ProcessStep = data[0]; + } + } + catch (Exception) + { + + //throw; + } })); + GetFryFourData("D3304", new Action(data => + { + try + { + if(data.Count()>0) + globalVar.fryPotFour.RecipeCompleteSingle = data[0]; + } + catch (Exception) + { + //throw; + } + })); //})); ////炒锅5状态数据 GetFryFiveData("D0258", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.Temperature = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.Temperature = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryFiveData("D0510", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.SmallFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.SmallFire = data[0]; + } + catch (Exception) + { + + // throw; + } })); GetFryFiveData("D0512", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.MidFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.MidFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryFiveData("D0514", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.BigFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.BigFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryFiveData("D0516", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.StrongFire = data[0]; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.StrongFire = data[0]; + } + catch (Exception) + { + + //throw; + } })); GetFryFiveData("D2500", new Action(data => { - FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFour.Speed = data[0] / 10.0; + } + catch (Exception) + { + + // throw; + } })); GetFryFiveData("D0600", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.FryPotWeight = data[0] / 10.0; + try + { + if (data.Count() > 0) + FryPotMonitorManage.GetInstance.fryFive.FryPotWeight = data[0] / 10.0; + } + catch (Exception) + { + + //throw; + } })); GetFryFiveData("D3000", new Action(data => { - FryPotMonitorManage.GetInstance.fryFive.Step = data[0]; + try + { + if (data.Count() > 0) + { + FryPotMonitorManage.GetInstance.fryFive.Step = data[0]; + globalVar.fryPotFive.ProcessStep = data[0]; + } + } + catch (Exception) + { + + // throw; + } })); + GetFryFiveData("D3305", new Action(data => + { + try + { + if (data.Count() > 0) + globalVar.fryPotFive.RecipeCompleteSingle = data[0]; + } + catch (Exception) + { + //throw; + } + })); //})); //线体上放空桶 if (globalVar.rollerLineOne.EmptyRollerNum != 0) @@ -1937,6 +2556,9 @@ namespace FryPot_DosingSystem.Control }), "MainViewReadPlcData"); } + + + /// /// 炒锅状态实时显示 /// @@ -2015,7 +2637,6 @@ namespace FryPot_DosingSystem.Control /// public void FryPotDataSaveToBinaryFile() { - #region 炒锅1状态数据保存 if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据")) { @@ -2370,17 +2991,32 @@ namespace FryPot_DosingSystem.Control { 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; + 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; + + } + + } + /// + /// 炒锅写float类型Plc数据 + /// + public void WritePotRealData(int potNum, string address, float value) + { + switch (potNum) + { + case 1: DeviceOperate.GetInstance.WritePotOneRealPlcData(address, value); break; + case 2: DeviceOperate.GetInstance.WritePotTwoRealPlcData(address, value); break; + case 3: DeviceOperate.GetInstance.WritePotThreeRealPlcData(address, value); break; + case 4: DeviceOperate.GetInstance.WritePotFourRealPlcData(address, value); break; + case 5: DeviceOperate.GetInstance.WritePotFiveRealPlcData(address, value); break; } } - /// /// 配方数据接收 /// @@ -2445,32 +3081,12 @@ namespace FryPot_DosingSystem.Control } - ///// - ///// 1号线统一洗桶 - ///// - //public void LineOneUnifyWashRollerModel() - //{ - - //} - ///// - ///// 2号线统一洗桶 - ///// - //public void LineTwoUnifyWashRollerModel() - //{ - - //} - ///// - ///// 3号线统一洗桶 - ///// - //public void LineThreeUnifyWashRollerModel() - //{ - - //} /// /// 线体1的执行流程 /// public void LineOneProcessExecute() { + LOneFryPotStepDisplay(); LOneRecipeDataToPlc(); LineOneRecipeExecuteConfirm(); LOneLoadRoller(); @@ -2487,7 +3103,7 @@ namespace FryPot_DosingSystem.Control /// public void LineTwoProcessExecute() { - + LTwoFryPotStepDisplay(); LTwoRecipeDataToPlc(); LineTwoRecipeExecuteConfirm(); LTwoAgvLoadRoller(); @@ -2504,7 +3120,7 @@ namespace FryPot_DosingSystem.Control /// public void LineThreeProcessExecute() { - + LThreeFryPotStepDisplay(); LThreeRecipeDataToPlc(); LineThreeRecipeExecuteConfirm(); LThreeAgvLoadRoller(); @@ -2545,27 +3161,29 @@ namespace FryPot_DosingSystem.Control } private void CleanPlateUpLoad() { - if (globalVar.agvArriveCleanLoad || globalVar.LineTenRobotTaskError) + if (globalVar.agvArriveCleanLoad) { globalVar.agvArriveCleanLoad = false; MessageNotify.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); - erp: if (AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 0) - { - //plc交互 - WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC + //plc交互 + WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC + //erp: if (AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 0) + // { + // //plc交互 + // WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC - } - else//有故障 - { - while (AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 1) - { - Thread.Sleep(1000); - if (globalVar.ExitLineOneTask) - return; - } - MessageNotify.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!"); - goto erp; - } + // } + // else//有故障 + // { + // while (AlarmHelper.GetInstance("洗桶机出桶未运行").CleanOutputRollerRunning == 1) + // { + // Thread.Sleep(1000); + // if (globalVar.ExitLineOneTask) + // return; + // } + // MessageNotify.GetInstance.ShowRunLog("清洗台空桶出桶滚筒重新运行!!"); + // goto erp; + // } } } @@ -2576,26 +3194,27 @@ namespace FryPot_DosingSystem.Control { if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//输送线无故障 { - if (TTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + if (TTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel))) { MessageNotify.GetInstance.ShowRunLog($"1号滚筒线切换为普通洗桶模式"); } if (globalVar.rollerLineOne.WashEmptyRollerModel == 0) { - + try { lock (Obj_Lock) { + //线体1到清洗台 if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun && globalVar.AllowNextEmptyRollerToClean && globalVar.rollerLineOne.EmptyRollerNums.Count > 0) { var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight); - if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶 + if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Contains(globalVar.rollerLineOne.StationEight)))//一种情况工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶,另一种在没有下单的情况下,线体上的桶都认为是空桶 { - + LOneCurrentRollerNum = globalVar.rollerLineOne.StationEight; //下发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) @@ -2606,7 +3225,7 @@ namespace FryPot_DosingSystem.Control // Thread.Sleep(500); if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1))//AGV呼叫成功 { - + WritePlcData("D1250", LOneCurrentRollerNum);//下发空桶桶号到洗桶机 globalVar.rollerLineOne.IsEpmtyBefore = true; globalVar.AllowNextEmptyRollerToClean = false; } @@ -2621,7 +3240,7 @@ namespace FryPot_DosingSystem.Control } else { - AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 + AgvFromLineOneToClean(LOneCurrentRollerNum);//AGV从线体1到清洗处 } } } @@ -2686,7 +3305,7 @@ namespace FryPot_DosingSystem.Control } if (globalVar.rollerLineTwo.WashEmptyRollerModel == 0) { - + try { lock (Obj_Lock) @@ -2695,8 +3314,9 @@ namespace FryPot_DosingSystem.Control { var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight); - if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶 + if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Contains(globalVar.rollerLineTwo.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶 { + LTwoCurrentRollerNum = globalVar.rollerLineTwo.StationEight; //下发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) @@ -2707,7 +3327,7 @@ namespace FryPot_DosingSystem.Control //Thread.Sleep(500); if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2)) { - + WritePlcData("D1250", LTwoCurrentRollerNum);//下发空桶桶号到洗桶机 globalVar.rollerLineTwo.IsEpmtyBefore = true; globalVar.AllowNextEmptyRollerToClean = false; } @@ -2723,7 +3343,7 @@ namespace FryPot_DosingSystem.Control else { - AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 + AgvFromLineTwoToClean(LTwoCurrentRollerNum);//AGV从线体1到清洗处 } } @@ -2784,13 +3404,13 @@ namespace FryPot_DosingSystem.Control //线体3到清洗台 if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//输送线无故障 { - if (TTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineTwo.WashEmptyRollerModel))) + if (TTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel))) { MessageNotify.GetInstance.ShowRunLog($"3号滚筒线切换为普通洗桶模式"); } if (globalVar.rollerLineThree.WashEmptyRollerModel == 0) { - + try { lock (Obj_Lock) @@ -2799,8 +3419,9 @@ namespace FryPot_DosingSystem.Control { var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight); - if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶 + if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Contains(globalVar.rollerLineThree.StationEight)))//工位8上面有桶且不是配方上的原料桶,即空桶 { + LThreeCurrentRollerNum = globalVar.rollerLineThree.StationEight; //下发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) @@ -2811,7 +3432,7 @@ namespace FryPot_DosingSystem.Control //Thread.Sleep(500); if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功 { - + WritePlcData("D1250", LThreeCurrentRollerNum);//下发空桶桶号到洗桶机 globalVar.rollerLineThree.IsEpmtyBefore = true; globalVar.AllowNextEmptyRollerToClean = false; } @@ -2827,7 +3448,7 @@ namespace FryPot_DosingSystem.Control } else { - AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处 + AgvFromLineThreeToClean(LThreeCurrentRollerNum);//AGV从线体3到清洗处 } } } @@ -2881,7 +3502,7 @@ namespace FryPot_DosingSystem.Control /// private void AgvArriveCleanPlateFromLineOne() { - if (globalVar.rollerLineOne.agvArriveCleanUnLoad||globalVar.LineSevenRobotTaskError) + if (globalVar.rollerLineOne.agvArriveCleanUnLoad || globalVar.LineSevenRobotTaskError) { globalVar.rollerLineOne.agvArriveCleanUnLoad = false; MessageNotify.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); @@ -2931,7 +3552,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1) { Thread.Sleep(1000); - if (globalVar.ExitLineOneTask) + if (globalVar.ExitLineTwoTask) return; } MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!"); @@ -2963,7 +3584,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.GetInstance("洗桶机进筒未运行").CleanEnterRollerRunning == 1) { Thread.Sleep(1000); - if (globalVar.ExitLineOneTask) + if (globalVar.ExitLineThreeTask) return; } MessageNotify.GetInstance.ShowRunLog("清洗台空桶进桶滚筒重新运行!!"); @@ -3014,8 +3635,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineThree.RecipeComMidSingle = 1; if (globalVar.LThreeCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方所有料桶已送达炒锅"); - ResetPotData(3); + MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方所有料桶已送达炒锅"); + // ResetPotData(3); WritePlcData("D2103", 0); WritePlcData("D1103", 0);//复位开始执行指令 PlcLineThreeRecipeDataReset(); @@ -3035,17 +3656,19 @@ namespace FryPot_DosingSystem.Control } } if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle))) + { + ResetPotData(3); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); + ActionManage.GetInstance.Send("炒锅工艺流程更新", 3); + MessageNotify.GetInstance.ShowRunLog("炒锅3配方制作完成"); + AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop); 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)//后续添加其它限制条件 { - if (RTrig.GetInstance("炒锅3配方完成").Start(Convert.ToBoolean(globalVar.fryPotThree.RecipeCompleteSingle)) || globalVar.LThreeFryPotSerial == 0 || globalVar.fryPotThree.ProcessStep == 0) + if (globalVar.fryPotThree.RecipeCompleteSingle == 1 || 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); @@ -3058,6 +3681,7 @@ namespace FryPot_DosingSystem.Control if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result)) { + potThreeCurrentRecipe = result; LThreeErrorRecipe = false; int headNum = result.materialCollection[0].MaterialLoc / 100; globalVar.LThreeMaterialNum = result.materialCollection.Count; @@ -3070,28 +3694,29 @@ namespace FryPot_DosingSystem.Control Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = 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) - //{ - - //将配方中原料加入新的队列 - LThreeInputMaterialQuene.Enqueue(new MaterialInfo() + if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3) { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//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; - //} + + } + else + { + MessageNotify.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + MessageNotify.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + LThreeInputMaterialQuene.Clear(); + LThreeRecipeQuene.Clear(); + LThreeErrorRecipe = true; + return; + } } #region 炒股用油量记录 try @@ -3122,16 +3747,27 @@ namespace FryPot_DosingSystem.Control // globalVar.rollerLineThree.RecipeComMidSingle = 0; WritePlcData("D1103", 1);//配方开始执行命令 globalVar.rollerLineThree.LowSignalJude = true; + globalVar.LThreeCurrentCookingStep = 0; + PotThreestep = 0; + if (LThreeRecipeQuene.Count > 0) + LThreeRecipeQuene.Clear(); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); })); } } + else + { + LThreeRecipeQuene.Clear(); + MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线配方完成前禁止再次下发订单"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线配方完成前禁止再次下发订单"); })); + } } - //else if (RTrig.GetInstance("LineThreeModel").Start(Convert.ToBoolean(globalVar.rollerLineThree.WashEmptyRollerModel))) - //{ - // MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线处于集中洗桶模式,无法下发配方"); - // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线处于集中洗桶模式,无法下发配方"); })); - // LThreeRecipeQuene.Clear(); + else if (globalVar.rollerLineThree.WashEmptyRollerModel == 1 && LThreeRecipeQuene.Count > 0) + { + MessageNotify.GetInstance.ShowUserLog("提示:3号滚筒线处于集中洗桶模式,无法下发配方"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"3号滚筒线处于集中洗桶模式,无法下发配方"); })); + LThreeRecipeQuene.Clear(); - //} + } } @@ -3146,8 +3782,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineTwo.RecipeComMidSingle = 1; if (globalVar.LTwoCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方所有料桶已送达炒锅"); - ResetPotData(globalVar.LTwoFryPotSerial); + MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方所有料桶已送达炒锅"); + // ResetPotData(globalVar.LTwoFryPotSerial); WritePlcData("D2102", 0); WritePlcData("D1102", 0);//复位开始执行指令 PlcLineTwoRecipeDataReset(); @@ -3173,25 +3809,43 @@ 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; + 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))) + { + ResetPotData(2); + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); + ActionManage.GetInstance.Send("炒锅工艺流程更新", 2); + MessageNotify.GetInstance.ShowRunLog("炒锅2配方制作完成"); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; }); + } + if (RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle))) + { + ResetPotData(5); + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); + ActionManage.GetInstance.Send("炒锅工艺流程更新", 5); + MessageNotify.GetInstance.ShowRunLog("炒锅5配方制作完成"); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); 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 ((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)) + if ((LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 2 && globalVar.fryPotTwo.RecipeCompleteSingle == 1) || (LTwoRecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 5 && globalVar.fryPotFive.RecipeCompleteSingle == 1) || (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 && globalVar.fryPotTwo.ProcessStep == 0 && globalVar.fryPotFive.ProcessStep == 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)) { 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) @@ -3199,18 +3853,18 @@ namespace FryPot_DosingSystem.Control 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; @@ -3222,11 +3876,17 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方"); if (headNum == 2)//炒锅2 { + potTwoCurrentRecipe = result; + globalVar.LTwoCurrentCookingStep = 0; + PotTwostep = 0; fryTwoRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; })); } else//炒锅5 { + potFiveCurrentRecipe = result; + PotFivestep = 0; + globalVar.LFiveCurrentCookingStep = 0; fryFiveRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; })); } @@ -3234,95 +3894,105 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(800); 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)) - //{ - - //将配方中原料加入新的队列 - LTwoInputMaterialQuene.Enqueue(new MaterialInfo() + if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5)) { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发 - + //将配方中原料加入新的队列 + 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; - //} + + + } + else + { + MessageNotify.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + MessageNotify.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + LTwoInputMaterialQuene.Clear(); + LTwoRecipeQuene.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; - // } - //} + 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; + if (LTwoRecipeQuene.Count > 0) + LTwoRecipeQuene.Clear(); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); })); } } + else + { + LTwoRecipeQuene.Clear(); + MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线配方完成前禁止再次下发订单"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线配方完成前禁止再次下发订单"); })); + } + } + else if (globalVar.rollerLineTwo.WashEmptyRollerModel == 1 && LTwoRecipeQuene.Count > 0) + { + MessageNotify.GetInstance.ShowUserLog("提示:2号滚筒线处于集中洗桶模式,无法下发配方"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"2号滚筒线处于集中洗桶模式,无法下发配方"); })); + LTwoRecipeQuene.Clear(); } - //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(); - //} } /// @@ -3335,8 +4005,8 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.RecipeComMidSingle = 1; if (globalVar.LOneCurrentRecipeName != string.Empty) { - MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方所有料桶已送达炒锅"); - ResetPotData(globalVar.LOneFryPotSerial); + MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方所有料桶已送达炒锅"); + // ResetPotData(globalVar.LOneFryPotSerial); WritePlcData("D2101", 0); WritePlcData("D1101", 0);//复位开始执行指令 PlcLineOneRecipeDataReset(); @@ -3363,42 +4033,59 @@ 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; + 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; }); + { + ResetPotData(1); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); + ActionManage.GetInstance.Send("炒锅工艺流程更新", 1); + MessageNotify.GetInstance.ShowRunLog("炒锅1配方制作完成"); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); + 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; }); + { + ResetPotData(4); + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); + ActionManage.GetInstance.Send("炒锅工艺流程更新", 4); + MessageNotify.GetInstance.ShowRunLog("炒锅4配方制作完成"); + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Stop); + 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) + if ((RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 1 && globalVar.fryPotOne.RecipeCompleteSingle == 1) || (RecipeQuene.ElementAt(0).materialCollection[0].MaterialLoc / 100 == 4 && globalVar.fryPotFour.RecipeCompleteSingle == 1) || (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 && globalVar.fryPotOne.ProcessStep == 0 && globalVar.fryPotFour.ProcessStep == 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) { - + globalVar.LOneCurrentCookingStep = 0; + PotOnestep = 0; 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) { - + globalVar.LFourCurrentCookingStep = 0; + PotFourstep = 0; 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; @@ -3410,11 +4097,13 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方"); if (headNum == 1)//炒锅1 { + potOneCurrentRecipe = result; fryOneRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; })); } else//炒锅4 { + potFourCurrentRecipe = result; fryFourRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; })); } @@ -3422,11 +4111,11 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(800); 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)) - { + 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() + //将配方中原料加入新的队列 + InputMaterialQuene.Enqueue(new MaterialInfo() { materialType = result.materialCollection[i], materialId = result.RecipeId @@ -3437,81 +4126,91 @@ namespace FryPot_DosingSystem.Control + } + else + { + MessageNotify.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + MessageNotify.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + InputMaterialQuene.Clear(); + RecipeQuene.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; + } } - } - #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 - //{ - // 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; + if (RecipeQuene.Count > 0) + RecipeQuene.Clear(); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); })); } - //} + } + else + { + RecipeQuene.Clear(); + MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线配方完成前禁止再次下发订单"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线配方完成前禁止再次下发订单"); })); + } } - //else if (RTrig.GetInstance("LineOneModel").Start(Convert.ToBoolean(globalVar.rollerLineOne.WashEmptyRollerModel))) - //{ - // MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线处于集中洗桶模式,无法下发配方"); - // Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); })); - // RecipeQuene.Clear(); - //} - + else if (globalVar.rollerLineOne.WashEmptyRollerModel == 1 && RecipeQuene.Count > 0) + { + MessageNotify.GetInstance.ShowUserLog("提示:1号滚筒线处于集中洗桶模式,无法下发配方"); + Application.Current.Dispatcher.Invoke(new Action(() => { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "提示", $"1号滚筒线处于集中洗桶模式,无法下发配方"); })); + RecipeQuene.Clear(); + } + } @@ -3548,7 +4247,7 @@ namespace FryPot_DosingSystem.Control MessageNotify.GetInstance.ShowUserLog($"1号滚筒线所有配方已清除"); globalVar.LOneCurrentRecipeName = string.Empty; globalVar.rollerLineOne.LowSignalJude = false; - + } else //未收到下位执行信号 { @@ -3576,7 +4275,7 @@ namespace FryPot_DosingSystem.Control LTwoRecipeQuene.Clear(); LTwoOutputMaterialQuene.Clear(); globalVar.rollerLineTwo.NextStart = false; - ResetPotData(globalVar.LOneFryPotSerial); + ResetPotData(globalVar.LTwoFryPotSerial); WritePlcData("D2102", 0); WritePlcData("D1102", 0);//复位开始执行指令 //清空配方数据队列 @@ -3615,7 +4314,7 @@ namespace FryPot_DosingSystem.Control LThreeRecipeQuene.Clear(); LThreeOutputMaterialQuene.Clear(); globalVar.rollerLineThree.NextStart = false; - ResetPotData(globalVar.LOneFryPotSerial); + ResetPotData(globalVar.LThreeFryPotSerial); WritePlcData("D2103", 0); WritePlcData("D1103", 0);//复位开始执行指令 //清空配方数据队列 @@ -3645,8 +4344,8 @@ namespace FryPot_DosingSystem.Control { AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot();//AGV到1号线体装桶 - AgvLineOneLoadRollerCom(); } + AgvLineOneLoadRollerCom(); } /// /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 @@ -3654,8 +4353,10 @@ namespace FryPot_DosingSystem.Control /// private void AgvLineOneLoadRollerCom() { - if (globalVar.agvLineOneLoadCom|| globalVar.LineOneRobotTaskError) + if ((globalVar.agvLineOneLoadCom || globalVar.LineOneRobotTaskError)&& globalVar.AgvToFryPot) { + if (globalVar.LineOneRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1052", 0);//就位信号复位 globalVar.rollerLineOne.CanRun = true; globalVar.agvLineOneLoadCom = false; MessageNotify.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成"); @@ -3671,17 +4372,18 @@ namespace FryPot_DosingSystem.Control { AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot();//AGV到2号线体装桶 - AgvLineTwoLoadRollerCom(); - } + AgvLineTwoLoadRollerCom(); } /// - /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 + /// 判断agv在2号线体是否上料完成,作为线体空桶能否开始运输的条件 /// private void AgvLineTwoLoadRollerCom() { - if (globalVar.agvLineTwoLoadCom|| globalVar.LineTwoRobotTaskError) + if ((globalVar.agvLineTwoLoadCom || globalVar.LineTwoRobotTaskError)&&globalVar.LTwoAgvToFryPot) { + if (globalVar.LineTwoRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1053", 0); globalVar.rollerLineTwo.CanRun = true; globalVar.agvLineTwoLoadCom = false; MessageNotify.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成"); @@ -3698,16 +4400,19 @@ namespace FryPot_DosingSystem.Control AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot();//AGV到2号线体装桶 - AgvLineThreeLoadRollerCom(); + } + AgvLineThreeLoadRollerCom(); } /// /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 /// private void AgvLineThreeLoadRollerCom() { - if (globalVar.agvLineThreeLoadCom || globalVar.LineThreeRobotTaskError)) + if ((globalVar.agvLineThreeLoadCom || globalVar.LineThreeRobotTaskError)&&globalVar.LThreeAgvToFryPot) { + if (globalVar.LineThreeRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1054", 0); globalVar.rollerLineThree.CanRun = true; globalVar.agvLineThreeLoadCom = false; MessageNotify.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成"); @@ -3743,7 +4448,7 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotInputMaterial() { - if (OutputMaterialQuene.Count > 0 && (globalVar.agvArriveUnLoad|| globalVar.LineOneRobotTaskError) && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive) + if (OutputMaterialQuene.Count > 0 && (globalVar.agvArriveUnLoad || globalVar.LineOneRobotTaskError) && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive) { //if (globalVar.LOneFryPotSerial == 1) //{ @@ -3766,29 +4471,24 @@ namespace FryPot_DosingSystem.Control public void LOneFallMaterial() { - 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.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) - //{ - // Sqlite.GetInstance.Base.Add(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, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 - // Sqlite.GetInstance.Save();//保存数据 - //} - //else - //{ - // 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();//保存数据 - //} + + //FryPotOneRollerTroubleCheck(); if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1) || (FryPotFourAlarm == 1 && globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障 { if (globalVar.LOneFryPotSerial == 1) { - - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); + + DeviceOperate.GetInstance.WritePlcData("D1055", 0); + //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); })); } else { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); + + DeviceOperate.GetInstance.WritePlcData("D1058", 0); + // Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); })); } //炒锅滚筒进料运行到位处理 @@ -3808,7 +4508,7 @@ namespace FryPot_DosingSystem.Control /// public void LTwoFryPotInputMaterial() { - if (LTwoOutputMaterialQuene.Count > 0 &&( globalVar.LTwoagvArriveUnLoad|| globalVar.LineTwoRobotTaskError) && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive) + if (LTwoOutputMaterialQuene.Count > 0 && (globalVar.LTwoagvArriveUnLoad || globalVar.LineTwoRobotTaskError) && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive) { //if (globalVar.LTwoFryPotSerial == 2) //{ @@ -3828,7 +4528,7 @@ namespace FryPot_DosingSystem.Control } public void LTwoFallMaterial() { - 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.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) //{ @@ -3845,14 +4545,16 @@ namespace FryPot_DosingSystem.Control { if (globalVar.LTwoFryPotSerial == 2) { - - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); + + DeviceOperate.GetInstance.WritePlcData("D1056", 0); + //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); })); } else { - - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); + + DeviceOperate.GetInstance.WritePlcData("D1059", 0); + //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); })); } //炒锅滚筒进料运行到位处理 @@ -3892,7 +4594,9 @@ namespace FryPot_DosingSystem.Control if (FryPotThreeAlarm == 1)//炒锅滚筒无故障 { - Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); + + DeviceOperate.GetInstance.WritePlcData("D1057", 0); + //Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc.ToString(), isBool = IsBool.Yes }); })); //炒锅滚筒进料运行到位处理 FryPotThreeInputMaterialRollerOperate(); @@ -3930,7 +4634,7 @@ namespace FryPot_DosingSystem.Control // { // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 // { - // Thread.Sleep(5); + // Thread.Sleep(5);agvFryPotEmptyRollerArrive // if (globalVar.ExitMainTask) // return; // } @@ -3947,7 +4651,7 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotOutputMaterial() { - if (((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1&&globalVar.LOneFryPotSerial==1) || (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1&&globalVar.LOneFryPotSerial==4)) && 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()) @@ -3965,10 +4669,22 @@ namespace FryPot_DosingSystem.Control public void LOneEmptyOperate() { - if ((globalVar.agvArriveUpLoad||globalVar.LineFourRobotTaskError) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) + if ((globalVar.agvArriveUpLoad || globalVar.LineFourRobotTaskError) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) { - if (globalVar.agvFryPotEmptyRollerArrive|| globalVar.LineFourRobotTaskError) + if (globalVar.agvFryPotEmptyRollerArrive || globalVar.LineFourRobotTaskError)//炒锅上料完成 { + if (globalVar.LineFourRobotTaskError) + { + if (globalVar.LOneFryPotSerial == 1) + { + DeviceOperate.GetInstance.WritePlcData("D1060", 0); + } + else + { + DeviceOperate.GetInstance.WritePlcData("D1063", 0); + } + } + FryPotOneOrFourOutEmpetyRollerOperate(); if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { @@ -4006,7 +4722,7 @@ namespace FryPot_DosingSystem.Control /// public void LTwoFryPotOutputMaterial() { - if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1&&globalVar.LTwoFryPotSerial==2) || (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1&&globalVar.LTwoFryPotSerial==5)) && 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()) @@ -4033,7 +4749,17 @@ namespace FryPot_DosingSystem.Control //{ if (globalVar.LTwoagvFryPotEmptyRollerArrive || globalVar.LineFiveRobotTaskError) { - + if (globalVar.LineFiveRobotTaskError) + { + if (globalVar.LTwoFryPotSerial == 2) + { + DeviceOperate.GetInstance.WritePlcData("D1061", 0); + } + else + { + DeviceOperate.GetInstance.WritePlcData("D1064", 0); + } + } FryPotTwoOrFiveOutEmpetyRollerOperate(); if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { @@ -4093,8 +4819,10 @@ namespace FryPot_DosingSystem.Control //{ if (globalVar.LThreeagvFryPotEmptyRollerArrive || globalVar.LineSixRobotTaskError) { + if (globalVar.LineSixRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1062", 0); //FryPotThreeOutEmpetyRollerOperate(); - MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); + MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { //AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes); @@ -4128,6 +4856,8 @@ namespace FryPot_DosingSystem.Control if (globalVar.agvArriveLineFour || globalVar.LineTenRobotTaskError)//agv到达线体4下料位置 { + if (globalVar.LineTenRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1066", 0); globalVar.agvArriveLineFour = false; globalVar.LineTenRobotTaskError = false;//AGV故障信号复位 //线体四信号交互 @@ -4140,25 +4870,25 @@ namespace FryPot_DosingSystem.Control public void EmptyRollerToLinFourFromPot() { - if (globalVar.rollerLineOne.agvArriveLineFour||globalVar.LineFourRobotTaskError)//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】号回收线体,准备卸桶"); + MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LOneFryPotSerial}】号炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - if (globalVar.rollerLineTwo.agvArriveLineFour|| globalVar.LineFiveRobotTaskError)//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】号回收线体,准备卸桶"); + MessageNotify.GetInstance.ShowRunLog($"AGV从【{globalVar.LTwoFryPotSerial}】炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - if (globalVar.rollerLineThree.agvArriveLineFour|| globalVar.LineSixRobotTaskError)//agv到达线体4下料位置 + if (globalVar.rollerLineThree.agvArriveLineFour || globalVar.LineSixRobotTaskError)//agv到达线体4下料位置 { globalVar.rollerLineThree.agvArriveLineFour = false; //线体四信号交互 @@ -4330,14 +5060,14 @@ namespace FryPot_DosingSystem.Control // Thread.Sleep(5); if (globalVar.ExitMainTask) // return; //} - MessageNotify.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; + MessageNotify.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break; case 4: //while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0) //{ // Thread.Sleep(5); if (globalVar.ExitMainTask) // return; //} - MessageNotify.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; + MessageNotify.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break; } } /// @@ -4353,14 +5083,14 @@ namespace FryPot_DosingSystem.Control // Thread.Sleep(5); if (globalVar.ExitMainTask) // return; //} - MessageNotify.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; + MessageNotify.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break; case 5: //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) //{ // Thread.Sleep(5); if (globalVar.ExitMainTask) // return; //} - MessageNotify.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; + MessageNotify.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); break; } } /// @@ -4373,7 +5103,7 @@ namespace FryPot_DosingSystem.Control // Thread.Sleep(5); if (globalVar.ExitMainTask) // return; //} - MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); + MessageNotify.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】空桶上料完成"); } /// /// 发送agv送料就位信号至PLC(线体到炒锅) @@ -4623,7 +5353,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0) { - if ((globalVar.agvArriveUpLoad||globalVar.LineOneRobotTaskError) && 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】号滚筒线装桶位置"); @@ -4631,8 +5361,14 @@ namespace FryPot_DosingSystem.Control if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - - globalVar.LOneCurrentCookingStep++; + //if (materialInfo.materialType.MaterialLoc / 100 == 1) + //{ + // globalVar.LOneCurrentCookingStep++; + //} + //else + //{ + // globalVar.LFourCurrentCookingStep++; + //} OutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveUpLoad = false; globalVar.AgvToFryPot = true; @@ -4661,7 +5397,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("1号滚筒线故障").LOneRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineOneLoadEmptyRoller|| globalVar.LineSevenRobotTaskError)//agv到达上料位置 + if (globalVar.agvArriveLineOneLoadEmptyRoller)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc @@ -4672,10 +5408,12 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineOneLoadEmptyRoller = false; //原料到位,agv到位,agv自行运料到清洗处 } - if (globalVar.agvArriveLineOneLoadCom|| globalVar.LineSevenRobotTaskError)//上料完成 + if (globalVar.agvArriveLineOneLoadCom || globalVar.LineSevenRobotTaskError)//上料完成 { + if (globalVar.LineSevenRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1052", 0); if (emptyRollerNum != 0) - globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0); + globalVar.rollerLineOne.EmptyRollerNums.Remove(emptyRollerNum); globalVar.agvArriveLineOneLoadCom = false; globalVar.rollerLineOne.IsEpmtyBefore = false; if (emptyRollerNum != 0) @@ -4704,15 +5442,21 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障 { - if ((globalVar.agvArriveLTwoUpLoad||globalVar.LineTwoRobotTaskError) && 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); if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - - globalVar.LTwoCurrentCookingStep++; + //if (materialInfo.materialType.MaterialLoc / 100 == 2) + //{ + // globalVar.LTwoCurrentCookingStep++; + //} + //else + //{ + // globalVar.LFiveCurrentCookingStep++; + //} LTwoOutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveLTwoUpLoad = false; globalVar.LTwoAgvToFryPot = true; @@ -4743,7 +5487,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineTwoLoadEmptyRoller||globalVar.LineEightRobotTaskError)//agv到达上料位置 + if (globalVar.agvArriveLineTwoLoadEmptyRoller)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc @@ -4757,8 +5501,10 @@ namespace FryPot_DosingSystem.Control } if (globalVar.agvArriveLineTwoLoadCom || globalVar.LineEightRobotTaskError)//上料完成 { + if (globalVar.LineEightRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1053", 0); if (emptyRollerNum != 0) - globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0); + globalVar.rollerLineTwo.EmptyRollerNums.Remove(emptyRollerNum); globalVar.agvArriveLineTwoLoadCom = false; globalVar.rollerLineTwo.IsEpmtyBefore = false; if (emptyRollerNum != 0) @@ -4770,7 +5516,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.GetInstance("2号滚筒线故障").LTwoRollerTrouble == 1) { Thread.Sleep(1000); - if (globalVar.ExitLineOneTask) + if (globalVar.ExitLineTwoTask) return; } MessageNotify.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行"); @@ -4787,7 +5533,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障 { - if ((globalVar.agvArriveLThreeUpLoad||globalVar.LineThreeRobotTaskError) && 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); @@ -4795,7 +5541,7 @@ namespace FryPot_DosingSystem.Control { MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - globalVar.LThreeCurrentCookingStep++; + // globalVar.LThreeCurrentCookingStep++; LThreeOutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveLThreeUpLoad = false; globalVar.LThreeAgvToFryPot = true; @@ -4826,7 +5572,7 @@ namespace FryPot_DosingSystem.Control { erp: if (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 0)//无故障 { - if (globalVar.agvArriveLineThreeLoadEmptyRoller||globalVar.LineNineRobotTaskError)//agv到达上料位置 + if (globalVar.agvArriveLineThreeLoadEmptyRoller)//agv到达上料位置 { MessageNotify.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc @@ -4841,8 +5587,10 @@ namespace FryPot_DosingSystem.Control } if (globalVar.agvArriveLineThreeLoadCom || globalVar.LineNineRobotTaskError)//上料完成 { + if (globalVar.LineNineRobotTaskError) + DeviceOperate.GetInstance.WritePlcData("D1054", 0); if (emptyRollerNum != 0) - globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0); + globalVar.rollerLineThree.EmptyRollerNums.Remove(emptyRollerNum); globalVar.agvArriveLineThreeLoadCom = false; globalVar.rollerLineThree.IsEpmtyBefore = false; if (emptyRollerNum != 0) @@ -4854,7 +5602,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.GetInstance("3号滚筒线故障").LThreeRollerTrouble == 1) { Thread.Sleep(1000); - if (globalVar.ExitLineOneTask) + if (globalVar.ExitLineThreeTask) return; } MessageNotify.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行"); @@ -4923,12 +5671,12 @@ namespace FryPot_DosingSystem.Control } else if (errorCode == "Analysis Error") { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文"); + MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线API调用失败,请检查请求报文"); return false; } else { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}"); + MessageNotify.GetInstance.ShowRunLog($"提示:AGV从清洗台到{num}号滚筒线失败,错误码:{errorCode}"); return false; } } @@ -4941,17 +5689,17 @@ namespace FryPot_DosingSystem.Control { if (errorCode == "SUCCESS") { - MessageNotify.GetInstance.ShowRunLog($"AGV离开{num}号炒锅"); + MessageNotify.GetInstance.ShowRunLog($"AGV去{num}号炒锅"); return true; } else if (errorCode == "Analysis Error") { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查"); + MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅接口调用失败,请检查"); return false; } else { - MessageNotify.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}"); + MessageNotify.GetInstance.ShowRunLog($"提示:AGV去{num}号炒锅失败,错误码:{errorCode}"); return false; } } @@ -5588,6 +6336,25 @@ namespace FryPot_DosingSystem.Control DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F); DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F); } + /// + /// 累加重量计算 + /// + /// + public ushort SumAllTargetWeight(ObservableCollection collect,int length) + { + ushort total = 0; + if (collect.Count >= length) + { + for (int i = 0; i < length; i++) + { + total += collect.ElementAt(i).TargeWeight; + + } + } + return total; + } + + /// /// 炒锅配方下发 /// @@ -5599,7 +6366,39 @@ namespace FryPot_DosingSystem.Control { Json.Read(); #region 炒锅工艺下发 - for (int i = 0; i < result.FlowProcess.fpModels.Count; i++) + int length = 0; + WritePotData(potNum,"D3920",Convert.ToUInt16(result.FlowProcess.targetWeightOffset*10));//目标重量偏差下发 + if (result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == "清洗") != null) + { + WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count - 1));//工序数量 + if (result.FlowProcess.fpModels.Count < 12) + { + length = result.FlowProcess.fpModels.Count - 1; + WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryTemperature * 10)); + WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime * 600)); + WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryWeight * 10));//炒制重量 + WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).SmallFirePercent)); + WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).MidFirePercent)); + WritePotData(potNum, "D3117", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).BigFirePercent)); + WritePotData(potNum, "D3118", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).StrongFirePercent)); + WritePotData(potNum, "D3119", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FrySpeed * 10)); + WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight*10)));//清洗目标重量 + + } + else + { + length = result.FlowProcess.fpModels.Count; + } + } + else//没有编辑清洗 + { + length = result.FlowProcess.fpModels.Count; + WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count));//工序数量 + + } + + + for (int i = 0; i < length; i++) { bool can = ushort.TryParse(result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum, out ushort res); //按工序下发数据 @@ -5620,13 +6419,14 @@ namespace FryPot_DosingSystem.Control 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)); @@ -5636,8 +6436,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4011", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序1目标重量 + continue; } + #endregion #region 工序2 if (i == 1) @@ -5660,6 +6463,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5671,8 +6475,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4021", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序2目标重量 + continue; } + #endregion #region 工序3 if (i == 2) @@ -5695,6 +6502,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5706,8 +6514,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4031", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序3目标重量 + continue; } + #endregion #region 工序4 if (i == 3) @@ -5730,6 +6541,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5741,8 +6553,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4041", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序4目标重量 + continue; } + #endregion #region 工序5 if (i == 4) @@ -5765,6 +6580,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5776,8 +6592,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4051", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序5目标重量 + continue; } + #endregion #region 工序6 if (i == 5) @@ -5800,6 +6619,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5811,8 +6631,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4061", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序6目标重量 + continue; } + #endregion #region 工序7 if (i == 6) @@ -5835,6 +6658,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5846,8 +6670,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4071", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序7目标重量 + continue; } + #endregion #region 工序8 if (i == 7) @@ -5870,6 +6697,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5881,8 +6709,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4081", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序8目标重量 + continue; } + #endregion #region 工序9 if (i == 8) @@ -5905,6 +6736,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5916,8 +6748,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4091", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序9目标重量 + continue; } + #endregion #region 工序10 if (i == 9) @@ -5939,6 +6774,7 @@ namespace FryPot_DosingSystem.Control } 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));//炒制重量 } @@ -5950,8 +6786,11 @@ namespace FryPot_DosingSystem.Control 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)); + WritePotData(potNum, "D4101", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序10目标重量 + continue; } + #endregion #region 工序11 if (i == 10) @@ -5973,57 +6812,72 @@ namespace FryPot_DosingSystem.Control } 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)); + + WritePotData(potNum, "D4111", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(i).TargeWeight * 10)));//工序11目标重量 + 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 + //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 + //{ + + + //} + if (result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum == "清洗") { - WritePotData(potNum, "D3111", Convert.ToUInt16(Json.Data.NameId[result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum])); + 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, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 + 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)); + WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight * 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 + + #endregion } } @@ -6042,6 +6896,7 @@ namespace FryPot_DosingSystem.Control for (int i = 1; i < 10; i++) { WritePotData(PotNum, "D300" + i, 0); + } for (int i = 11; i < 20; i++) { @@ -6083,9 +6938,230 @@ namespace FryPot_DosingSystem.Control { WritePotData(PotNum, "D3" + i, 0); } + + #region 目标重量清零 + for (int i = 1; i < 10; i++) + { + WritePotData(PotNum, "D40" + i + "1", 0); + } + for (int i = 0; i < 3; i++) + { + WritePotData(PotNum, "D41" + i + "1", 0); + } + #endregion WritePotData(PotNum, "D3120", 0); + WritePotData(PotNum,"D3920",0);//目标重量清零 + + } + } + + } + + int PotOnestep = 0; + int PotFourstep = 0; + int PotTwostep = 0; + int PotFivestep = 0; + int PotThreestep = 0; + + public void LOneFryPotStepDisplay() + { + + try + { + if (PotOnestep != globalVar.fryPotOne.ProcessStep && globalVar.fryPotOne.ProcessStep != 0 && potOneCurrentRecipe != null) + { + if (globalVar.fryPotOne.ProcessStep == 20) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); })); + + } + else + { + if (potOneCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotOne.ProcessStep != 12 && globalVar.fryPotOne.ProcessStep != 13) + { + try + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = potOneCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotOne.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); })); + + } + catch (Exception) + { + + //throw; + } + } + else if (globalVar.fryPotOne.ProcessStep == 12) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); })); + + } + globalVar.LOneCurrentCookingStep++; + } + + PotOnestep = globalVar.fryPotOne.ProcessStep; + } + if (PotFourstep != globalVar.fryPotFour.ProcessStep && globalVar.fryPotFour.ProcessStep != 0 && potFourCurrentRecipe != null) + { + if (globalVar.fryPotFour.ProcessStep == 20) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); })); + + } + else + { + if (potFourCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFour.ProcessStep != 12 && globalVar.fryPotFour.ProcessStep != 13) + { + try + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = potFourCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFour.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); })); + + } + catch (Exception) + { + + // throw; + } + } + else if (globalVar.fryPotFour.ProcessStep == 12) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LFourCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); })); + + + } + globalVar.LFourCurrentCookingStep++; + + } + PotFourstep = globalVar.fryPotFour.ProcessStep; + } + } + catch (Exception) + { + + // throw; + } + } + public void LTwoFryPotStepDisplay() + { + + try + { + if (PotTwostep != globalVar.fryPotTwo.ProcessStep && globalVar.fryPotTwo.ProcessStep != 0 && potTwoCurrentRecipe != null) + { + if (globalVar.fryPotTwo.ProcessStep == 20) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); })); + + } + else + { + if (potTwoCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotTwo.ProcessStep != 12 && globalVar.fryPotTwo.ProcessStep != 13) + { + try + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = potTwoCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotTwo.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); })); + + } + catch (Exception) + { + + //throw; + } + } + else if (globalVar.fryPotTwo.ProcessStep == 12) + { + + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); })); + + } + globalVar.LTwoCurrentCookingStep++; + } + PotTwostep = globalVar.fryPotTwo.ProcessStep; + } + if (PotFivestep != globalVar.fryPotFive.ProcessStep && globalVar.fryPotFive.ProcessStep != 0 && potFiveCurrentRecipe != null) + { + if (globalVar.fryPotFive.ProcessStep == 20) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); })); + + globalVar.LFiveCurrentCookingStep++; + } + else + { + if (potFiveCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotFive.ProcessStep != 12 && globalVar.fryPotFive.ProcessStep != 13) + { + + try + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = potFiveCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotFive.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); })); + + } + catch (Exception) + { + + //throw; + } + } + else if (globalVar.fryPotFive.ProcessStep == 12) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); })); + + } + globalVar.LFiveCurrentCookingStep++; + } + + PotFivestep = globalVar.fryPotFive.ProcessStep; + } + } + catch (Exception) + { + + //throw; + } + } + public void LThreeFryPotStepDisplay() + { + + try + { + + if (PotThreestep != globalVar.fryPotThree.ProcessStep && globalVar.fryPotThree.ProcessStep != 0 && potThreeCurrentRecipe != null) + { + if (globalVar.fryPotThree.ProcessStep == 20) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "正在出料", isBool = IsBool.Yes }); })); + + } + else + { + if (potThreeCurrentRecipe.FlowProcess.fpModels.Count > 0 && globalVar.fryPotThree.ProcessStep != 12 && globalVar.fryPotThree.ProcessStep != 13) + { + try + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = potThreeCurrentRecipe.FlowProcess.fpModels.ElementAt(globalVar.fryPotThree.ProcessStep - 1).FryMaterialNum, isBool = IsBool.Yes }); })); + + } + catch (Exception) + { + + //throw; + } + } + else if (globalVar.fryPotThree.ProcessStep == 12) + { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep + 1, Name = "清洗", isBool = IsBool.Yes }); })); + + } + globalVar.LThreeCurrentCookingStep++; + } + + PotThreestep = globalVar.fryPotThree.ProcessStep; } } + catch (Exception) + { + + //throw; + } } } diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 3c05105b..445ac4f8 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -131,6 +131,7 @@ namespace FryPot_DosingSystem.Control public bool LoadRoller { get; set; } public bool AgvToFryPot { get; set; } + public bool PotOneInputMaterialArrive { get; set; } public bool PotOneOutputRollerArrive { get; set; } @@ -160,14 +161,19 @@ namespace FryPot_DosingSystem.Control public int LOneMaterialNum { get; set; } = 0; public int LOneFryPotSerial { get; set; } = 0; public int LOneCurrentCookingStep { get; set; } = 0; + public int LFourCurrentCookingStep { get; set; } = 0; public bool agvArriveUpLoad { get; set; } public bool agvArriveUnLoad { get; set; } public bool agvFryPotEmptyRollerArrive { get; set; } public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 - public bool agvLineOneLoadCom { get; set; }//线体1上料完成 + public bool agvLineOneLoadCom { get; set; }//线体1满料桶上料完成 + //2022.11.1 新增 + + public int LTwoMaterialNum { get; set; } = 0; public int LTwoFryPotSerial { get; set; } =0; + public int LFiveCurrentCookingStep { get; set; } = 0; public int LTwoCurrentCookingStep { get; set; } = 0; public bool agvArriveLTwoUpLoad { get; set; } public bool LTwoagvArriveUnLoad { get; set; } diff --git a/FryPot_DosingSystem/Model/FlowProcessManage.cs b/FryPot_DosingSystem/Model/FlowProcessManage.cs index d27924cb..b09c707f 100644 --- a/FryPot_DosingSystem/Model/FlowProcessManage.cs +++ b/FryPot_DosingSystem/Model/FlowProcessManage.cs @@ -11,6 +11,8 @@ namespace FryPot_DosingSystem.Model internal class FlowProcessManage:ObservableObject { public string RecipeName { get; set; } + public float targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); }} + private float _targetWeightOffset; public ObservableCollection fpModels { get; set; } = new ObservableCollection(); } } diff --git a/FryPot_DosingSystem/Model/FlowProcessModel.cs b/FryPot_DosingSystem/Model/FlowProcessModel.cs index 65b73017..9b2b2e3a 100644 --- a/FryPot_DosingSystem/Model/FlowProcessModel.cs +++ b/FryPot_DosingSystem/Model/FlowProcessModel.cs @@ -30,11 +30,16 @@ 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 ushort TargeWeight { get { return _targetWeight; }set { _targetWeight = value;OnPropertyChanged(); } } + private ushort _targetWeight; + /// /// 炒制温度 /// public double FryTemperature { get { return _fryTemperature; } set { _fryTemperature = value;OnPropertyChanged(); } } diff --git a/FryPot_DosingSystem/View/AgvView.xaml b/FryPot_DosingSystem/View/AgvView.xaml index 25325e98..5b46b97b 100644 --- a/FryPot_DosingSystem/View/AgvView.xaml +++ b/FryPot_DosingSystem/View/AgvView.xaml @@ -566,7 +566,7 @@ - + + + + + + + + @@ -30,47 +36,54 @@ + + + - + - - + + + + + + + + + + + + + - + - + + @@ -425,23 +427,30 @@ - + - + - + - + - + - + - + - + + + - + + + + + + @@ -455,7 +464,8 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/> - + + diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs index f3c50322..7f0efff8 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs @@ -160,6 +160,34 @@ namespace FryPot_DosingSystem.View } } + private void TextBox_TextChanged_8(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txt) + { + txt.Text = TextLimit(txt.Text); + } + } + + + + private void TextBox_TextChanged_10(object sender, TextChangedEventArgs e) + { + if (sender is TextBox txtbox) + { + if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[1-9]{0,1})?$"))//验证整数或1位小数 + { + txtbox.Text = txtbox.Text.Trim(); + + } + else + { + // MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); + txtbox.Text = string.Empty; + } + + } + } + //private void ComboBox_KeyUp(object sender, KeyEventArgs e) //{ // var res = sender as ComboBox; diff --git a/FryPot_DosingSystem/View/RecipeSendDownView.xaml b/FryPot_DosingSystem/View/RecipeSendDownView.xaml index 5b6824e3..540a3cd0 100644 --- a/FryPot_DosingSystem/View/RecipeSendDownView.xaml +++ b/FryPot_DosingSystem/View/RecipeSendDownView.xaml @@ -26,7 +26,7 @@ - + diff --git a/FryPot_DosingSystem/View/RecipesSendDown.xaml b/FryPot_DosingSystem/View/RecipesSendDown.xaml index 73b465c5..235a6b8f 100644 --- a/FryPot_DosingSystem/View/RecipesSendDown.xaml +++ b/FryPot_DosingSystem/View/RecipesSendDown.xaml @@ -49,7 +49,7 @@ - + flowProcessModels { get; set; } = new ObservableCollection(); - + /// + /// 目标重量偏差 + /// + public string targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); } } + private string _targetWeightOffset; public string currentRecipeName { get; set; } public static int currentItemId { get; set; } public RelayCommand CloseWindowCommand { get; set; } @@ -66,6 +71,7 @@ namespace FryPot_DosingSystem.ViewModel var res = Json.Data.Recipes.FirstOrDefault(p => p.FlowProcess?.RecipeName == recipeName?.ToString()); if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 { + targetWeightOffset = recipe.FlowProcess.targetWeightOffset.ToString(); foreach (var item in recipe.materialCollection) { if (!FlowItems.Contains(item.MaterialLoc.ToString())) @@ -73,7 +79,7 @@ namespace FryPot_DosingSystem.ViewModel } foreach (var item in recipe.FlowProcess.fpModels) { - flowProcessModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent }); + flowProcessModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, TargeWeight=item.TargeWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent }); } // ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count); @@ -92,7 +98,7 @@ namespace FryPot_DosingSystem.ViewModel FlowItems.Add(item.MaterialLoc.ToString());//下拉框 } ActionManage.GetInstance.Send("MaterialNum", name.materialCollection.Count); - name.FlowProcess.fpModels = flowProcessModels; + //name.FlowProcess.fpModels = flowProcessModels; } } @@ -110,6 +116,16 @@ namespace FryPot_DosingSystem.ViewModel if (name != null) { name.FlowProcess.RecipeName = currentRecipeName.ToString(); + if (float.TryParse(targetWeightOffset.Trim(), out float offset)) + { + name.FlowProcess.targetWeightOffset = offset;//目标重量偏差 + } + else + { + MessageBox.Show("非法目标重量偏差设置", "提示", MessageBoxButton.OK, MessageBoxImage.Error); + name.FlowProcess.targetWeightOffset = 0.0F; + return; + } //工艺桶号重复性检测 foreach (var item in name.materialCollection) { @@ -122,11 +138,21 @@ namespace FryPot_DosingSystem.ViewModel return; } } + //工艺步骤中清洗工艺重复性检测 + if (flowProcessModels.FirstOrDefault(p=>p.FryMaterialNum=="清洗")!=null) + { + if (flowProcessModels.Where(p => p.FryMaterialNum == "清洗").Count() > 1||flowProcessModels.IndexOf(flowProcessModels.FirstOrDefault(p => p.FryMaterialNum == "清洗")).Read(); + Json.Read(); MaterialNames.GetInstance.Names = Json.Data.Names; materialNames = Json.Data.Names; @@ -51,6 +51,7 @@ namespace FryPot_DosingSystem.ViewModel { if (Id != null && Id is string strId) { + var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == strId); if (res != null && res is NewRecipeModel rom) { @@ -102,24 +103,25 @@ namespace FryPot_DosingSystem.ViewModel if (materials.Count<=8&& materials.Count> 0) { - //int lineNum= materials.ElementAt(0).MaterialLoc / 100; - // //桶号正确性验证 - // for (int i = 0; i < materials.Count; i++) - // { - // if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5) - // { - // MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】"); - // NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效"); - // ActionManage.GetInstance.Send("CloseNewRecipeView"); - // return; - // } - // } + int lineNum = materials.ElementAt(0).MaterialLoc / 100; + //桶号正确性验证 + for (int i = 0; i < materials.Count; i++) + { + if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) + { + MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】"); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效"); + ActionManage.GetInstance.Send("CloseNewRecipeView"); + return; + } + } prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改 var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); if (res == null) { Json.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, FlowProcess=new FlowProcessManage(), materialCollection = materials,DataTime=DateTime.Now.ToShortDateString()});//配方添加 + } else { @@ -145,21 +147,23 @@ namespace FryPot_DosingSystem.ViewModel { if (materials.Count > 0 && materials.Count <= 8) { - //int lineNum = materials.ElementAt(0).MaterialLoc / 100; - ////桶号正确性验证 - //for (int i = 0; i < materials.Count; i++) - //{ - // if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) - // { - // MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); - // NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); - // ActionManage.GetInstance.Send("CloseNewRecipeView"); - // return; - // } - //} + int lineNum = materials.ElementAt(0).MaterialLoc / 100; + //桶号正确性验证 + for (int i = 0; i < materials.Count; i++) + { + if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) + { + MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); + ActionManage.GetInstance.Send("CloseNewRecipeView"); + return; + } + } bom.materialCollection = materials; bom.RecipeName = RecipeName; bom.UpdateTime = DateTime.Now.ToShortDateString(); + if (bom.FlowProcess != null) + bom.FlowProcess.RecipeName = RecipeName; Json.Save(); MessageNotify.GetInstance.ShowUserLog($"配方【{RecipeName}】修改成功"); NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"修改配方【{RecipeName}】成功"); @@ -181,24 +185,25 @@ namespace FryPot_DosingSystem.ViewModel { if (materials.Count>0&& materials.Count<=8)//验证配方中原料桶数 { - //int lineNum = materials.ElementAt(0).MaterialLoc / 100; - ////桶号正确性验证 - //for (int i = 0; i < materials.Count; i++) - //{ - // if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) - // { - // MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); - // NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); - // ActionManage.GetInstance.Send("CloseNewRecipeView"); - // return; - // } - //} + int lineNum = materials.ElementAt(0).MaterialLoc / 100; + //桶号正确性验证 + for (int i = 0; i < materials.Count; i++) + { + if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) + { + MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); + ActionManage.GetInstance.Send("CloseNewRecipeView"); + return; + } + } prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改 var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); if (res == null) { - Json.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加 + Json.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, DataTime = DateTime.Now.ToShortDateString(), RecipeName = RecipeName, materialCollection = materials,FlowProcess=new FlowProcessManage()});//配方添加 + //Json.Save(); } else { diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs index 76622ed2..2eed55e7 100644 --- a/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs @@ -30,7 +30,7 @@ namespace FryPot_DosingSystem.ViewModel public ObservableCollection Recipes { get; set; } = new ObservableCollection(); public RecipeSetDownViewModel() { - Json.Read(); + //Json.Read(); Recipes =Json.Data.Recipes; RecipeSetDownCommand = new RelayCommand((Id) => { @@ -42,7 +42,7 @@ namespace FryPot_DosingSystem.ViewModel RecipeSetDown(new NewRecipeModel[] { res }); //res.RecipeSetInfo = "配方下发成功"; //Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); - NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); + } else { diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs index 45846932..cd81630e 100644 --- a/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs @@ -49,7 +49,7 @@ namespace FryPot_DosingSystem.ViewModel public RecipeSetViewModel() { - Json.Read(); + // Json.Read(); recipeModels =Json.Data.Recipes; int count = recipeModels.Count; bool sign = false; @@ -70,6 +70,7 @@ namespace FryPot_DosingSystem.ViewModel else { sign = true; + Json.Data.Recipes.RemoveAt(Json.Data.Recipes.Count - 1); } } } @@ -104,9 +105,10 @@ namespace FryPot_DosingSystem.ViewModel var res = recipeModels.FirstOrDefault(p => p.RecipeId == strId); if (res != null && res is NewRecipeModel nes) { - recipeModels.Remove(res);//删除配方 + recipeModels.Remove(nes);//删除配方 Json.Save();//保存配方 count = recipeModels.Count; + MessageNotify.GetInstance.ShowUserLog($"成功删除配方【{nes.RecipeName}】"); } } }); From 68a291231b607efd008d0fde0aaeb20295444dbd Mon Sep 17 00:00:00 2001 From: NXX <447201003@qq> Date: Fri, 11 Nov 2022 17:59:06 +0800 Subject: [PATCH 03/10] MorkBF --- BPASmartClient.Model/大炒/FryPotMessages.cs | 83 +++++ .../大炒/LocalFryPotMessage.cs | 14 + .../大炒/RobotActionModel.cs | 32 ++ BPASmartClient.MorkBF/Control_MorkBF.cs | 296 +++++++++++++++++- .../Convert/FryActionToVisibilityConverter.cs | 127 ++++++++ BPASmartClient.MorkBF/GVL_MorkBF.cs | 62 +++- BPASmartClient.MorkBF/Model/BF_Food.cs | 32 +- BPASmartClient.MorkBF/Model/Global.cs | 14 + BPASmartClient.MorkBF/VIew/DebugView.xaml | 38 ++- BPASmartClient.MorkBF/VIew/DebugView.xaml.cs | 10 +- .../VIew/FoodManagerView.xaml | 91 ++++-- .../VIew/FoodManagerView.xaml.cs | 19 +- .../ViewModel/DebugViewModel.cs | 44 ++- .../ViewModel/FoodManagerViewModel.cs | 93 ++++++ .../ViewModel/MonitorViewModel.cs | 2 +- BPASmartClient.MorkF/Control_MorkF.cs | 5 +- BPASmartClient/App.config | 8 +- 17 files changed, 887 insertions(+), 83 deletions(-) create mode 100644 BPASmartClient.Model/大炒/FryPotMessages.cs create mode 100644 BPASmartClient.Model/大炒/LocalFryPotMessage.cs create mode 100644 BPASmartClient.Model/大炒/RobotActionModel.cs create mode 100644 BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs create mode 100644 BPASmartClient.MorkBF/Model/Global.cs create mode 100644 BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs diff --git a/BPASmartClient.Model/大炒/FryPotMessages.cs b/BPASmartClient.Model/大炒/FryPotMessages.cs new file mode 100644 index 00000000..9ab0da81 --- /dev/null +++ b/BPASmartClient.Model/大炒/FryPotMessages.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.Model.大炒 +{ + public class FryPotMessages + { + public string GoodName { get; set; } + public string GoodKey { get; set; } + public List fryPotProcesses { get; set; } = new List(); + } + + public class FryPotProcess + { + /// + /// 步骤 + /// + public int FryTime { get; set; } + /// + /// 动作 + /// + public FryAction fryActions { get; set; } + /// + /// 加热时间 单位s + /// + public int FryDuration { get; set; } = 0; + /// + /// 加热挡位 1-5 + /// + public int FryGear { get; set; } = 0; + /// + /// 搅拌挡位 小炒1-10 大炒1-5 + /// + public int StirGear { get; set; } = 0; + /// + /// 翻转速度0到800 + /// + public int TurnSpeed { get; set; }= 0; + /// + /// 炒制位置1到4 + /// + public int FryPosition { get; set; } + /// + /// 辅料,调料,或者菜品集合 + /// + public List accessories { get; set; } = new List(); + + } + + public class Accessories + { + /// + /// 位置 + /// + public int Loc { get; set; } + /// + /// 重量 + /// + public int Qry { get; set; } + } + + public enum FryAction + { + 冷锅加热, + 热油, + 加调料, + 加辅料, + 炒制菜品, + + } + + public enum FryRepot + { + 开始, + 热锅, + 炒菜, + 出餐, + 完成, + } +} diff --git a/BPASmartClient.Model/大炒/LocalFryPotMessage.cs b/BPASmartClient.Model/大炒/LocalFryPotMessage.cs new file mode 100644 index 00000000..9f318553 --- /dev/null +++ b/BPASmartClient.Model/大炒/LocalFryPotMessage.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.Model.大炒 +{ + public class LocalFryPotMessage + { + public ObservableCollection FryPotMessage { get; set; } = new ObservableCollection(); + } +} diff --git a/BPASmartClient.Model/大炒/RobotActionModel.cs b/BPASmartClient.Model/大炒/RobotActionModel.cs new file mode 100644 index 00000000..b614cd34 --- /dev/null +++ b/BPASmartClient.Model/大炒/RobotActionModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.Model.大炒 +{ + public class RobotAction_Pot + { + public int Pot { get; set; } + public RobotActionModel robotActionModel { get; set; } + } + + public enum RobotActionModel + { + 无任务, + 取1号炒锅荤菜盆倒1号炒锅, + 取1号炒锅素菜盆1倒1号炒锅, + 取1号炒锅素菜盆2倒1号炒锅, + 取1号炒锅调料盆倒入1号炒锅, + 取1号炒锅辅料盆1倒入1号炒锅, + 取1号空盆出餐, + + 取2号炒锅荤菜盆1倒2号炒锅 = 20, + 取2号炒锅素菜盆1倒2号炒锅 = 21, + 取2号炒锅素菜盆2倒2号炒锅 =22, + 取2号炒锅调料盆倒入2号炒锅 =23, + 取2号炒锅辅料盆1倒入2号炒锅 =24, + 取2号空盆出餐 =25, + } +} diff --git a/BPASmartClient.MorkBF/Control_MorkBF.cs b/BPASmartClient.MorkBF/Control_MorkBF.cs index 76be2fdf..44c179f1 100644 --- a/BPASmartClient.MorkBF/Control_MorkBF.cs +++ b/BPASmartClient.MorkBF/Control_MorkBF.cs @@ -1,10 +1,13 @@ -using BPA.Message; +using BPA.Helper; +using BPA.Message; using BPA.Message.Enum; using BPASmartClient.Business; using BPASmartClient.Device; using BPASmartClient.EventBus; using BPASmartClient.Helper; using BPASmartClient.Model; +using BPASmartClient.Model.大炒; +using BPASmartClient.MorkBF.Model; using BPASmartClient.MorkBF.ViewModel; using System; using System.Collections.Generic; @@ -13,6 +16,9 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using static BPASmartClient.EventBus.EventBus; +using static BPASmartClient.Model.大炒.FryPotMessages; +using ActionManage = BPA.Helper.ActionManage; +using ThreadManage = BPA.Helper.ThreadManage; namespace BPASmartClient.MorkBF { @@ -24,7 +30,8 @@ namespace BPASmartClient.MorkBF public override void DoMain() { - + IsHealth = true; + BPASmartClient.Helper.Json.Read(); MonitorViewModel.DeviceId = DeviceId; CommandRegist();//调试 ServerInit(); @@ -44,8 +51,6 @@ namespace BPASmartClient.MorkBF OrderCount++; DeviceProcessLogShow($"接收到{OrderCount}次订单"); - - } }); @@ -60,7 +65,6 @@ namespace BPASmartClient.MorkBF if (@event is MaterialDeliveryEvent material) { orderMaterialDelivery = material.orderMaterialDelivery; - } }); @@ -132,11 +136,55 @@ namespace BPASmartClient.MorkBF public override void MainTask() { + if(morkBF.FirePan1_Order.Count>0&& morkBF.FirePot1_InitCompleted&&morkBF.FirePot2_IsAuto&&!morkBF.FirePan1_Busy) + { + ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程"); + } + + if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Origin)//机器人在原点为 + { + if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction)) + { + morkBF.Robot_IsBusy =true; + RobotProcess(robotAction); + } + } } private void FirePot1_Process() { + if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result)) + { + morkBF.FirePan1_Busy = true; + foreach (var item in result.fryPotProcesses) + { + switch (item.fryActions) + { + case FryAction.冷锅加热: + FirePot_PotPerHeat(item, 1); + break; + + case FryAction.热油: + FirePot_HeatOil(item,1); + break; + + case FryAction.加调料: + FirePot_AddSeasoning(item, 1); + break; + case FryAction.加辅料: + + break; + case FryAction.炒制菜品: + FirePot_FryFood(item,1); + break; + + default: + break; + } + } + + } } private void FirePot2_Process() @@ -144,6 +192,192 @@ namespace BPASmartClient.MorkBF } + + #region 炒锅流程功能 + /// + /// 冷锅预热 + /// + private void FirePot_PotPerHeat(FryPotProcess item,int i) + { + if(i == 1)//炒锅1 + { + FirePot1_SetFireGear(item.FryGear); + FirePot1_StartFire(true); + + } + else if(i == 2)//炒锅2 + { + FirePot2_SetFireGear(item.FryGear); + FirePot2_StartFire(true); + + } + Thread.Sleep(item.FryDuration); + } + + /// + /// 热油 + /// + private void FirePot_HeatOil(FryPotProcess item, int i) + { + if (item.FryGear != 0) + { + FirePot1_SetFireGear(item.FryGear);//设定加热挡位 + FirePot1_StartFire(true);//开启加热 + } + if (item.StirGear != 0) + { + FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位 + FirePot1_StartFire(true);//开启搅拌 + } + Thread.Sleep(item.FryDuration);//加热时间; + } + + /// + /// 加调料 + /// + private void FirePot_AddSeasoning(FryPotProcess item,int i) + { + if(i == 1) + { + + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot =1,robotActionModel = RobotActionModel.取1号炒锅调料盆倒入1号炒锅}); + Thread.Sleep(item.FryDuration); + + } + + else if(i == 2) + { + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅调料盆倒入2号炒锅 }); + Thread.Sleep(item.FryDuration); + } + + } + + /// + /// 加辅料 + /// + private void FirePot_AddAccessories(FryPotProcess item, int i) + { + if (i == 1) + { + + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 }); + Thread.Sleep(item.FryDuration); + + } + + else if (i == 2) + { + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅辅料盆1倒入2号炒锅 }); + Thread.Sleep(item.FryDuration); + } + + } + + /// + /// 炒制菜品 + /// + private void FirePot_FryFood(FryPotProcess item, int i) + { + if (i == 1) + { + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc }); + while (!morkBF.FirePot1_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成 + { + Thread.Sleep(100); + } + Thread.Sleep(item.FryDuration); + + } + + else if (i == 2) + { + morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = (RobotActionModel)(item.accessories[0].Loc+19) });//炒制菜品位置 + while (!morkBF.FirePot2_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成 + { + Thread.Sleep(100); + } + Thread.Sleep(item.FryDuration); + } + } + #endregion + + /// + /// 机器人进程 + /// + /// + private void RobotProcess(RobotAction_Pot robotAction) + { + Robot_Write("GI0",(int)robotAction.robotActionModel); + while (morkBF.Robot_ActionCallback != (int)robotAction.robotActionModel)//机器人动作执行完动作反馈 + { + Thread.Sleep(100); + } + if(robotAction.Pot == 1)//炒锅1 + { + if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) + { + Robot_Write("GM521", true);//炒锅去投料位置 + while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜 + { + Thread.Sleep(100); + } + FirePot_Write("M11.6", true);//炒锅去出餐倒料位置 + while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 + { + Thread.Sleep(1000); + } + Thread.Sleep(20 * 1000);//等待20s出餐 + + } + else + { + FirePot_Write("M11.7", true);//炒锅去投料位置 + while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料 + { + Thread.Sleep(100); + } + Robot_Write("GM520", true);//机器人投料 + } + + } + else if (robotAction.Pot == 2) + { + if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) + { + Robot_Write("GM531", true);//炒锅去投料位置 + while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜 + { + Thread.Sleep(100); + } + FirePot_Write("M16.6", true);//炒锅去出餐倒料位置 + while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 + { + Thread.Sleep(1000); + } + Thread.Sleep(20 * 1000);//等待20s出餐 + + } + else + { + FirePot_Write("M16.7", true); + while (!morkBF.FirePot2_PotOnIntoFoodPosition) + { + Thread.Sleep(100); + } + Robot_Write("GM530", true); + } + + } + + while(!morkBF.Robot_Origin) + { + Thread.Sleep(1000); + } + morkBF.Robot_IsBusy = false; + MessageLog.GetInstance.Show($"机器人完成[{robotAction.robotActionModel.ToString()}]任务"); + } + public override void ReadData() { GetStatus("M20.0",new Action((o)=> @@ -228,9 +462,10 @@ namespace BPASmartClient.MorkBF if (o == null) return; if (o is bool[] values && values.Length == 7) { - morkBF.Robot_FirePot1OutMeal = values[0]; - morkBF.Robot_FirePot1OutVegetables1 = values[1]; - morkBF.Robot_FirePot1OutVegetables2 = values[2]; + + morkBF.FirePot1_CompleteSingle[0] = values[0]; + morkBF.FirePot1_CompleteSingle[1] = values[1]; + morkBF.FirePot1_CompleteSingle[2] = values[2]; morkBF.Robot_FirePot1OutSeasoning = values[3]; morkBF.Robot_FirePot1OutAccessories = values[4]; morkBF.Robot_ArriveFirePot1 = values[5]; @@ -243,9 +478,9 @@ namespace BPASmartClient.MorkBF if (o == null) return; if (o is bool[] values && values.Length == 7) { - morkBF.Robot_FirePot2OutMeal = values[0]; - morkBF.Robot_FirePot2OutVegetables1 = values[1]; - morkBF.Robot_FirePot2OutVegetables2 = values[2]; + morkBF.FirePot2_CompleteSingle[0] = values[0]; + morkBF.FirePot2_CompleteSingle[1] = values[1]; + morkBF.FirePot2_CompleteSingle[2] = values[2]; morkBF.Robot_FirePot2OutSeasoning = values[3]; morkBF.Robot_FirePot2OutAccessories = values[4]; morkBF.Robot_ArriveFirePot2 = values[5]; @@ -319,7 +554,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW100", value); } - + Thread.Sleep(200); } /// /// 炒锅1加热启停 @@ -332,6 +567,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("M10.0", value); } + Thread.Sleep(200); } /// /// 炒锅1设置搅拌挡位 @@ -344,6 +580,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW102", value); } + Thread.Sleep(200); } /// /// 炒锅1搅拌启停 @@ -356,6 +593,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("M10.1", value); } + Thread.Sleep(200); } /// /// 设置炒锅1翻转速度 @@ -368,6 +606,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW104", value); } + Thread.Sleep(200); } #endregion @@ -383,7 +622,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW130", value); } - + Thread.Sleep(200); } /// /// 炒锅2加热启停 @@ -396,6 +635,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("M15.0", value); } + Thread.Sleep(200); } /// /// 炒锅2设置搅拌挡位 @@ -408,6 +648,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW132", value); } + Thread.Sleep(200); } /// /// 炒锅2搅拌启停 @@ -420,6 +661,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("M15.1", value); } + Thread.Sleep(200); } /// /// 设置炒锅2翻转速度 @@ -432,6 +674,7 @@ namespace BPASmartClient.MorkBF { FirePot_Write("VW134", value); } + Thread.Sleep(200); } #endregion @@ -476,6 +719,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M15.5", true); } } + Thread.Sleep(200); } /// /// 炒锅去位置1 @@ -495,6 +739,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.2", true); } } + Thread.Sleep(200); } /// /// 炒锅去位置2 @@ -514,6 +759,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.3", true); } } + Thread.Sleep(200); } /// /// 炒锅去位置3 @@ -533,6 +779,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.4", true); } } + Thread.Sleep(200); } /// /// 炒锅去位置4 @@ -552,6 +799,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.5", true); } } + Thread.Sleep(200); } /// /// 炒锅去出餐位置 @@ -571,6 +819,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.6", true); } } + Thread.Sleep(200); } /// /// 炒锅去投料位置 @@ -590,6 +839,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.7", true); } } + Thread.Sleep(200); } /// /// 出餐启动 @@ -610,6 +860,7 @@ namespace BPASmartClient.MorkBF } } + Thread.Sleep(200); } /// /// 清洗 @@ -622,13 +873,15 @@ namespace BPASmartClient.MorkBF { if (i == 1) { - FirePot_Write("M10.7", true); + if(morkBF.FirePot1_OnOrigin) FirePot_Write("M10.7", true); + } else if (i == 2) { - FirePot_Write("M15.7", true); + if (morkBF.FirePot2_OnOrigin) FirePot_Write("M15.7", true); } } + Thread.Sleep(200); } /// /// 抽水启动 @@ -648,6 +901,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.0", true); } } + Thread.Sleep(200); } /// /// 抽油启动 @@ -667,6 +921,7 @@ namespace BPASmartClient.MorkBF FirePot_Write("M16.1", true); } } + Thread.Sleep(200); } #endregion @@ -677,6 +932,7 @@ namespace BPASmartClient.MorkBF private void RobotStart() { Robot_Write("GM600",true); + Thread.Sleep(200); } /// /// 机器人停止 @@ -684,6 +940,7 @@ namespace BPASmartClient.MorkBF private void RobotStop() { Robot_Write("GM601", true); + Thread.Sleep(200); } /// /// 机器人复位 @@ -691,6 +948,7 @@ namespace BPASmartClient.MorkBF private void RobotReset() { Robot_Write("GM602", true); + Thread.Sleep(200); } /// /// 机器人程序重启 @@ -698,6 +956,7 @@ namespace BPASmartClient.MorkBF private void RobotProgramStart() { Robot_Write("GM603", true); + Thread.Sleep(200); } /// /// 1号炒锅允许机器人投料(炒锅在投料位给出) @@ -705,6 +964,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot1AllowInMaterail() { Robot_Write("GM520", true); + Thread.Sleep(200); } /// /// 1号炒锅出餐倒料到减速位 @@ -712,6 +972,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot1OutFoodInSlowDown() { Robot_Write("GM621", true); + Thread.Sleep(200); } /// /// 1号炒锅出餐倒料完成 @@ -719,6 +980,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot1OutFood() { Robot_Write("GM522", true); + Thread.Sleep(200); } /// /// 2号炒锅允许机器人投料(炒锅在投料位给出) @@ -726,6 +988,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot2AllowInMaterail() { Robot_Write("GM530", true); + Thread.Sleep(200); } /// /// 2号炒锅出餐倒料到减速位。开始倒菜 @@ -733,6 +996,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot2OutFoodInSlowDown() { Robot_Write("GM531", true); + Thread.Sleep(200); } /// /// 2号炒锅出餐倒料完成 @@ -740,6 +1004,7 @@ namespace BPASmartClient.MorkBF private void Robot_Pot2OutFood() { Robot_Write("GM532", true); + Thread.Sleep(200); } /// /// @@ -751,6 +1016,7 @@ namespace BPASmartClient.MorkBF { Robot_Write("GI0",value); } + Thread.Sleep(200); } #endregion diff --git a/BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs b/BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs new file mode 100644 index 00000000..b6c17e30 --- /dev/null +++ b/BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs @@ -0,0 +1,127 @@ +using BPASmartClient.Model.大炒; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace BPASmartClient.MorkBF.Convert +{ + public class StirToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Visibility visibility = Visibility.Visible; + if (value != null && value is FryAction fryAction) + { + switch (fryAction) + { + case FryAction.冷锅加热: + visibility = Visibility.Collapsed; + break; + case FryAction.热油: + visibility = Visibility.Visible; + break; + case FryAction.加调料: + visibility = Visibility.Collapsed; + break; + case FryAction.加辅料: + visibility = Visibility.Collapsed; + break; + case FryAction.炒制菜品: + visibility = Visibility.Visible; + break; + default: + break; + } + } + return visibility; + } + + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class FirePositionToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Visibility visibility = Visibility.Visible; + if (value != null && value is FryAction fryAction) + { + switch (fryAction) + { + case FryAction.冷锅加热: + visibility = Visibility.Visible; + break; + case FryAction.热油: + visibility = Visibility.Visible; + break; + case FryAction.加调料: + visibility = Visibility.Collapsed; + break; + case FryAction.加辅料: + visibility = Visibility.Collapsed; + break; + case FryAction.炒制菜品: + visibility = Visibility.Visible; + break; + default: + break; + } + } + return visibility; + } + + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + public class AccessoriesToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Visibility visibility = Visibility.Visible; + if (value != null && value is FryAction fryAction) + { + switch (fryAction) + { + case FryAction.冷锅加热: + visibility = Visibility.Collapsed; + break; + case FryAction.热油: + visibility = Visibility.Collapsed; + break; + case FryAction.加调料: + visibility = Visibility.Visible; + break; + case FryAction.加辅料: + visibility = Visibility.Visible; + break; + case FryAction.炒制菜品: + visibility = Visibility.Visible; + break; + default: + break; + } + } + return visibility; + } + + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} + diff --git a/BPASmartClient.MorkBF/GVL_MorkBF.cs b/BPASmartClient.MorkBF/GVL_MorkBF.cs index c802243c..f7a2bcc8 100644 --- a/BPASmartClient.MorkBF/GVL_MorkBF.cs +++ b/BPASmartClient.MorkBF/GVL_MorkBF.cs @@ -1,4 +1,5 @@ using BPASmartClient.Device; +using BPASmartClient.Model.大炒; using BPASmartClient.MorkBF.Model; using System; using System.Collections.Concurrent; @@ -14,11 +15,15 @@ namespace BPASmartClient.MorkBF /// /// 炒锅1订单队列 /// - public ConcurrentQueue FirePan1_Order { get; set; } = new ConcurrentQueue(); + public ConcurrentQueue FirePan1_Order { get; set; } = new ConcurrentQueue(); /// /// 炒锅2订单队列 /// - public ConcurrentQueue FirePan2_Order { get; set; } = new ConcurrentQueue(); + public ConcurrentQueue FirePan2_Order { get; set; } = new ConcurrentQueue(); + /// + /// 机器人队列 + /// + public ConcurrentQueue RobotActinQueue { get; set; } = new ConcurrentQueue(); /// /// 炒锅1忙碌 /// @@ -247,30 +252,39 @@ namespace BPASmartClient.MorkBF #endregion #region 机器人数据读取 + public bool Robot_IsBusy; + + + /// + /// 机器人在原点位 + /// + [VariableMonitor("机器人在原点位", "GM105", "4201")] + public bool Robot_Origin { get; set; } + /// /// 1号锅倒荤菜完成 /// - [VariableMonitor("1号锅倒荤菜完成", "GM500", "4596")] + [VariableMonitor("机器人#1号锅倒荤菜完成", "GM500", "4596")] public bool Robot_FirePot1OutMeal{ get; set; } /// /// 1号炒锅倒素菜1完成 /// - [VariableMonitor("1号炒锅倒素菜1完成", "GM501", "4597")] + [VariableMonitor("机器人#1号炒锅倒素菜1完成", "GM501", "4597")] public bool Robot_FirePot1OutVegetables1{ get; set; } /// /// 1号炒锅倒素菜2完成 /// - [VariableMonitor("1号炒锅倒素菜2完成", "GM502", "4598")] + [VariableMonitor("机器人#1号炒锅倒素菜2完成", "GM502", "4598")] public bool Robot_FirePot1OutVegetables2{ get; set; } /// /// 1号炒锅倒调料完成 /// - [VariableMonitor("1号炒锅倒调料完成", "GM503", "4599")] + [VariableMonitor("机器人#1号炒锅倒调料完成", "GM503", "4599")] public bool Robot_FirePot1OutSeasoning{ get; set; } /// /// 1号炒锅倒辅料完成 /// - [VariableMonitor("1号炒锅倒辅料完成", "GM504", "4600")] + [VariableMonitor("机器人#1号炒锅倒辅料完成", "GM504", "4600")] public bool Robot_FirePot1OutAccessories{ get; set; } /// /// 机器人到位,请求1#炒锅倒菜 @@ -280,7 +294,7 @@ namespace BPASmartClient.MorkBF /// /// 1号炒锅出餐完成 /// - [VariableMonitor("1号炒锅出餐完成", "GM506", "4602")] + [VariableMonitor("机器人#1号炒锅出餐完成", "GM506", "4602")] public bool Robot_FirePot1OutFoodComplete{ get; set; } @@ -290,12 +304,12 @@ namespace BPASmartClient.MorkBF /// /// 2号锅倒荤菜完成 /// - [VariableMonitor("2号锅倒荤菜完成", "GM510", "4606")] + [VariableMonitor("机器人#2号锅倒荤菜完成", "GM510", "4606")] public bool Robot_FirePot2OutMeal { get; set; } /// /// 2号炒锅倒素菜1完成 /// - [VariableMonitor("2号炒锅倒素菜1完成", "GM511", "4607")] + [VariableMonitor("机器人#2号炒锅倒素菜1完成", "GM511", "4607")] public bool Robot_FirePot2OutVegetables1{ get; set; } /// /// 2号炒锅倒素菜2完成 @@ -305,22 +319,22 @@ namespace BPASmartClient.MorkBF /// /// 2号炒锅倒调料完成 /// - [VariableMonitor("2号炒锅倒调料完成", "GM513", "4609")] + [VariableMonitor("机器人#2号炒锅倒调料完成", "GM513", "4609")] public bool Robot_FirePot2OutSeasoning{ get; set; } /// /// 2号炒锅倒辅料完成 /// - [VariableMonitor("2号炒锅倒辅料完成", "GM514", "4610")] + [VariableMonitor("机器人#2号炒锅倒辅料完成", "GM514", "4610")] public bool Robot_FirePot2OutAccessories{ get; set; } /// /// 机器人到位,请求1#炒锅倒菜 /// - [VariableMonitor("机器人到位,请求1#炒锅倒菜", "GM515", "4611")] + [VariableMonitor("机器人#机器人到位,请求1#炒锅倒菜", "GM515", "4611")] public bool Robot_ArriveFirePot2{ get; set; } /// /// 2号炒锅出餐完成 /// - [VariableMonitor("2号炒锅出餐完成", "GM516", "4612")] + [VariableMonitor("机器人#2号炒锅出餐完成", "GM516", "4612")] public bool Robot_FirePot2OutFoodComplete{ get; set; } /// /// 机器人动作反馈 @@ -330,7 +344,27 @@ namespace BPASmartClient.MorkBF #endregion + public Dictionary FirePot1_CompleteSingle { get; set; } + + public Dictionary FirePot2_CompleteSingle { get; set; } + + + public GVL_MorkBF() + { + FirePot1_CompleteSingle = new Dictionary + { + {1,Robot_FirePot1OutMeal }, + {2,Robot_FirePot1OutVegetables1 }, + {3,Robot_FirePot1OutVegetables2 }, + }; + FirePot2_CompleteSingle = new Dictionary + { + {1,Robot_FirePot2OutMeal }, + {2,Robot_FirePot2OutVegetables1 }, + {3,Robot_FirePot2OutVegetables2 }, + }; + } public DateTime FirePan1_Date; public DateTime FirePan2_Date; diff --git a/BPASmartClient.MorkBF/Model/BF_Food.cs b/BPASmartClient.MorkBF/Model/BF_Food.cs index 6891c445..d1d49a4e 100644 --- a/BPASmartClient.MorkBF/Model/BF_Food.cs +++ b/BPASmartClient.MorkBF/Model/BF_Food.cs @@ -17,6 +17,8 @@ namespace BPASmartClient.MorkBF.Model /// public string FoodID { get; set; } + public List PotActions { get; set; } = new List(); + } public class BF_PotAction @@ -40,7 +42,7 @@ namespace BPASmartClient.MorkBF.Model /// /// 动作 /// - public string Actions + public PotAction Actions { get; set; @@ -62,4 +64,32 @@ namespace BPASmartClient.MorkBF.Model set; } } + + + public enum PotAction + { + 加热开启, + 加热关闭, + 搅拌开启, + 搅拌关闭, + + 加调料, + 加菜品, + 加辅料, + 加热时间, + + 抽油启动, + 抽水启动, + 出餐启动, + + 炒锅回原点, + 炒制位置1, + 炒制位置2, + 炒制位置3, + 炒制位置4, + 炒锅去出餐倒料位置, + 炒锅去投料位置, + + + } } diff --git a/BPASmartClient.MorkBF/Model/Global.cs b/BPASmartClient.MorkBF/Model/Global.cs new file mode 100644 index 00000000..4c504caf --- /dev/null +++ b/BPASmartClient.MorkBF/Model/Global.cs @@ -0,0 +1,14 @@ +using BPASmartClient.Model.大炒; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.MorkBF.Model +{ + public class Global + { + public static FryPotMessages GLoFryMessage { get; set; } = new FryPotMessages(); + } +} diff --git a/BPASmartClient.MorkBF/VIew/DebugView.xaml b/BPASmartClient.MorkBF/VIew/DebugView.xaml index 7928442d..2ac694c1 100644 --- a/BPASmartClient.MorkBF/VIew/DebugView.xaml +++ b/BPASmartClient.MorkBF/VIew/DebugView.xaml @@ -21,14 +21,40 @@ + + - - - - +