From 5c82ce5ec68e057ebf04c89b9fcad213da2aee44 Mon Sep 17 00:00:00 2001 From: taoye Date: Fri, 26 Aug 2022 10:42:24 +0800 Subject: [PATCH] =?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 --- .../Pages/View/SubPagLoginView.xaml | 2 +- FryPot_DosingSystem/App.xaml.cs | 7 +- .../Control/DosingLogicControl.cs | 208 +++++++++++++++--- FryPot_DosingSystem/View/DebugView.xaml | 2 + FryPot_DosingSystem/ViewModel/AgvViewModel.cs | 1 + .../ViewModel/DebugViewModel.cs | 14 ++ 6 files changed, 195 insertions(+), 39 deletions(-) diff --git a/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml index 99537e94..8f2c876a 100644 --- a/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml @@ -224,8 +224,8 @@ - + diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 2ce646db..1b669855 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -29,6 +29,7 @@ namespace FryPot_DosingSystem protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); + SystemHelper.GetInstance.CreateDesktopShortcut(); MenuInite(); LoginDataInite(); @@ -171,7 +172,7 @@ namespace FryPot_DosingSystem }); DeviceMonitor.Add(new SubMenumodel() { - SubMenuName = "炒锅状态监控", + SubMenuName = "炒锅状态数据监控", SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 }, AssemblyName = "FryPot_DosingSystem", ToggleWindowPath = "View.FryPotMonitorView" @@ -201,7 +202,7 @@ namespace FryPot_DosingSystem UserManager.Add(new SubMenumodel() { SubMenuName = "用户登录", - SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, + SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员,Permission.观察员,Permission.操作员 }, AssemblyName = "BPASmartClient.CustomResource", ToggleWindowPath = "Pages.View.SubPagLoginView" }); @@ -232,7 +233,7 @@ namespace FryPot_DosingSystem MainMenuIcon = "", MainMenuName = "用户管理", Alias = "User Management", - MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, + MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员, Permission.观察员, Permission.操作员 }, subMenumodels = UserManager, }); #endregion diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index b4b7f366..630cb18b 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -201,10 +201,19 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Register(new Action(() => { - EmptyRollerCleanTaskRestart(); + LineOneEmptyRollerCleanTaskRestart(); }), "EmptyRollerCleanTaskRestart"); + ActionManage.GetInstance.Register(new Action(() => + { + LineTwoEmptyRollerCleanTaskRestart(); + }), "LineTwoEmptyRollerCleanTaskRestart"); + ActionManage.GetInstance.Register(new Action(() => + { + LineThreeEmptyRollerCleanTaskRestart(); + + }), "LineThreeEmptyRollerCleanTaskRestart"); #endregion //接口调试 ActionManage.GetInstance.Register(new Action(() => @@ -1290,9 +1299,9 @@ namespace FryPot_DosingSystem.Control })); } - public void EmptyRollerCleanTaskRestart() + public void LineOneEmptyRollerCleanTaskRestart() { - ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() => + ThreadManage.GetInstance().StopTask("滚筒线1空桶清洗任务线程", new Action(() => { globalVar.rollerLineOne.StationEight = 0; globalVar.rollerLineOne.EmptyRollerNums.Clear(); @@ -1300,12 +1309,46 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.IsEpmtyBefore = false; // globalVar.rollerLineOne.CanRun = true; + globalVar.agvArriveLineFour = false; + globalVar.agvArriveCleanLoad = false; + globalVar.rollerLineOne.agvArriveCleanUnLoad = false; + globalVar.agvArriveLineOneLoadEmptyRoller = false; + globalVar.agvArriveLineOneLoadCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线1空桶清洗任务重启成功"); + })); + } + + + public void LineTwoEmptyRollerCleanTaskRestart() + { + ThreadManage.GetInstance().StopTask("滚筒线2空桶清洗任务线程", new Action(() => + { + globalVar.rollerLineTwo.StationEight = 0; globalVar.rollerLineTwo.EmptyRollerNums.Clear(); globalVar.rollerLineTwo.EmptyRollerNums.Add(208); globalVar.rollerLineTwo.IsEpmtyBefore = false; //globalVar.rollerLineTwo.CanRun = true; + + globalVar.agvArriveLineFour = false; + globalVar.agvArriveCleanLoad = false; + + globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; + globalVar.agvArriveLineTwoLoadEmptyRoller = false; + globalVar.agvArriveLineTwoLoadCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线2空桶清洗任务重启成功"); + })); + } + + public void LineThreeEmptyRollerCleanTaskRestart() + { + ThreadManage.GetInstance().StopTask("滚筒线3空桶清洗任务线程", new Action(() => + { + + globalVar.rollerLineThree.StationEight = 0; globalVar.rollerLineThree.EmptyRollerNums.Clear(); globalVar.rollerLineThree.EmptyRollerNums.Add(308); @@ -1314,17 +1357,11 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineFour = false; globalVar.agvArriveCleanLoad = false; - globalVar.rollerLineOne.agvArriveCleanUnLoad = false; - globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; globalVar.rollerLineThree.agvArriveCleanUnLoad = false; - globalVar.agvArriveLineOneLoadEmptyRoller = false; - globalVar.agvArriveLineTwoLoadEmptyRoller = false; globalVar.agvArriveLineThreeLoadEmptyRoller = false; - globalVar.agvArriveLineOneLoadCom = false; - globalVar.agvArriveLineTwoLoadCom = false; globalVar.agvArriveLineThreeLoadCom = false; - ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程"); - MessageLog.GetInstance.ShowUserLog("空桶清洗任务重启成功"); + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线3空桶清洗任务重启成功"); })); } /// @@ -1991,8 +2028,11 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); - ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程"); - + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线1空桶清洗任务线程"); + ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线2空桶清洗任务线程"); + ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeToCleanProcessExecute(); Thread.Sleep(10); }), "滚筒线3空桶清洗任务线程"); + ThreadManage.GetInstance().StartLong(new Action(() => { ToLineFourFromCleanPlate(); Thread.Sleep(10); }), "清洗台空桶回桶任务线程"); + ThreadManage.GetInstance().StartLong(new Action(() => { EmptyRollerToLinFourFromPot(); Thread.Sleep(10); }), "炒锅空桶回桶任务线程"); } @@ -2051,19 +2091,33 @@ namespace FryPot_DosingSystem.Control //} } - private void LineFourProcessExecute() + private void LineOneToCleanProcessExecute() + { + //线体1到清洗台 + AgvFromLineOneToCleanPlate(); + AgvArriveCleanPlateFromLineOne(); + } + public void LineTwoToCleanProcessExecute() + { + //线体1到清洗台 + AgvFromLineTwoToCleanPlate(); + AgvArriveCleanPlateFromLineTwo(); + + } + public void LineThreeToCleanProcessExecute() + { + //线体1到清洗台 + AgvFromLineThreeToCleanPlate(); + AgvArriveCleanPlateFromLineThree(); + + } + private void ToLineFourFromCleanPlate() { - //线体123到清洗台 - AgvFromLineToCleanPlate(); - AgvArriveCleanPlateFromLine(); - //空桶到线体4 CallAgvToLineFour(); CleanPlateUpLoad(); - //清洗台或线体123空桶到线体4 EmptyRollerToLinFourFromClean(); } - private void CleanPlateUpLoad() { if (globalVar.agvArriveCleanLoad) @@ -2074,15 +2128,15 @@ namespace FryPot_DosingSystem.Control // MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); if (globalVar.CleadBarrelExitSingle == 0) { - MessageLog.GetInstance.ShowRunLog("警告:清洗台出桶滚筒未运行!!"); + MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶上料信号已发送,出桶滚筒未运行!!"); } } } /// - /// 线体到清洗台 + /// 线体1到清洗台 /// - private void AgvFromLineToCleanPlate() + private void AgvFromLineOneToCleanPlate() { if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//输送线无故障 { @@ -2112,6 +2166,15 @@ namespace FryPot_DosingSystem.Control AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 } } + + } + + /// + /// 线体2到清洗台 + /// + private void AgvFromLineTwoToCleanPlate() + { + // 线体2到清洗台 if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//输送线无故障 { @@ -2139,6 +2202,14 @@ namespace FryPot_DosingSystem.Control AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 } } + + + } + /// + /// 线体3到清洗台 + /// + private void AgvFromLineThreeToCleanPlate() + { //线体3到清洗台 if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//输送线无故障 { @@ -2169,9 +2240,9 @@ namespace FryPot_DosingSystem.Control } /// - /// AGV从线体123到达清洗台下料位置 + /// AGV从线体1到达清洗台下料位置 /// - private void AgvArriveCleanPlateFromLine() + private void AgvArriveCleanPlateFromLineOne() { if (globalVar.rollerLineOne.agvArriveCleanUnLoad) { @@ -2181,9 +2252,18 @@ namespace FryPot_DosingSystem.Control WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC if (globalVar.CleadBarrelEnterSingle == 0) { - MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); + MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!"); } } + + } + + /// + /// AGV从线体2到达清洗台下料位置 + /// + private void AgvArriveCleanPlateFromLineTwo() + { + if (globalVar.rollerLineTwo.agvArriveCleanUnLoad) { globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; @@ -2193,9 +2273,18 @@ namespace FryPot_DosingSystem.Control WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC if (globalVar.CleadBarrelEnterSingle == 0) { - MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); + MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!"); } } + + + } + /// + /// AGV从线体3到达清洗台下料位置 + /// + private void AgvArriveCleanPlateFromLineThree() + { + if (globalVar.rollerLineThree.agvArriveCleanUnLoad) { globalVar.rollerLineThree.agvArriveCleanUnLoad = false; @@ -2205,12 +2294,11 @@ namespace FryPot_DosingSystem.Control WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC if (globalVar.CleadBarrelEnterSingle == 0) { - MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); + MessageLog.GetInstance.ShowRunLog("警告:清洗台空桶下料就位信号已发送,进桶滚筒未运行!!"); } } - + } - /// /// 呼叫Agv从清洗台运洗好的空桶到四号线体 /// @@ -3038,7 +3126,7 @@ namespace FryPot_DosingSystem.Control } /// - /// 4号线体下料 + /// 清洗台到4号线体下料 /// public void EmptyRollerToLinFourFromClean() { @@ -3051,6 +3139,11 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } + + } + + public void EmptyRollerToLinFourFromPot() + { if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置 { globalVar.rollerLineOne.agvArriveLineFour = false; @@ -3075,11 +3168,56 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - } - - - + ///// + ///// 线体1对应炒锅到4号线体下料 + ///// + //public void EmptyRollerToLinFourFromLineOne() + //{ + + + // if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置 + // { + // globalVar.rollerLineOne.agvArriveLineFour = false; + // //线体四信号交互 + // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶"); + // // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + // } + + + //} + + ///// + /////线体2对应炒锅到4号线体下料 + ///// + //public void EmptyRollerToLinFourFromLineTwo() + //{ + // if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置 + // { + // globalVar.rollerLineTwo.agvArriveLineFour = false; + // //线体四信号交互 + // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶"); + // // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + // } + + //} + ///// + ///// 线体3对应炒锅到4号线体下料 + ///// + //public void EmptyRollerToLinFourFromLineThree() + //{ + // if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置 + // { + // globalVar.rollerLineThree.agvArriveLineFour = false; + // //线体四信号交互 + // WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶"); + // // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + // } + + //} /// /// 炒锅1,4滚筒进料运行到位处理 /// diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml index c882f31f..0602dde1 100644 --- a/FryPot_DosingSystem/View/DebugView.xaml +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -88,6 +88,7 @@ + + public T ToEnumValue(string name) { + return (T)Enum.Parse(typeof(T), name); } #endregion diff --git a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs index 4f8ff62a..836717cd 100644 --- a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs @@ -76,6 +76,10 @@ namespace FryPot_DosingSystem.ViewModel public RelayCommand AgvArriveCleanPlateLocLoad { get; set; }//上料 public RelayCommand AgvArriveCleanPlateLocLoadCom { get; set; }//上料完成 public RelayCommand EmptyRollerCleanTaskRestart { get; set; } + + public RelayCommand LineTwoEmptyRollerCleanTaskRestart { get; set; } + + public RelayCommand LineThreeEmptyRollerCleanTaskRestart { get; set; } public DebugViewModel() { AgvDebug = new RelayCommand(new Action(() => @@ -112,6 +116,16 @@ namespace FryPot_DosingSystem.ViewModel ActionManage.GetInstance.Send("EmptyRollerCleanTaskRestart"); }); + LineTwoEmptyRollerCleanTaskRestart = new RelayCommand(() => + { + + ActionManage.GetInstance.Send("LineTwoEmptyRollerCleanTaskRestart"); + }); + LineThreeEmptyRollerCleanTaskRestart = new RelayCommand(() => + { + + ActionManage.GetInstance.Send("LineThreeEmptyRollerCleanTaskRestart"); + }); AgvLineOneLoadEmptyCom = new RelayCommand(() => { ActionManage.GetInstance.Send("AgvLineOneLoadEmptyCom"); });