diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs index 91b14921..3c19179c 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs @@ -12,45 +12,48 @@ namespace BPASmartClient.CustomResource.Pages.Model { } + /// /// 1 号滚筒线故障 /// - [Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort LOneRollerTrouble { get; set; } /// /// 2 号滚筒线故障 /// - [Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort LTwoRollerTrouble { get; set; } /// /// 3 号滚筒线故障 /// - [Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort LThreeRollerTrouble { get; set; } /// /// 1 号炒锅滚筒运行故障 /// - [Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort FryPotOneRollerTrouble { get; set; } /// /// 2 号炒锅滚筒运行故障 /// - [Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort FryPotTwoRollerTrouble { get; set; } /// /// 3 号炒锅滚筒运行故障 /// - [Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort FryPotThreeRollerTrouble { get; set; } /// /// 4 号炒锅滚筒运行故障 /// - [Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort FryPotFourRollerTrouble { get; set; } /// /// 5 号炒锅滚筒运行故障 /// - [Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + [Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] public ushort FryPotFiveRollerTrouble { get; set; } + + } } diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 21fb032a..334104e0 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -39,7 +39,7 @@ namespace FryPot_DosingSystem mv.Show(); DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取 DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 - HubHelper.GetInstance.Connect("192.168.1.14", 8089); + HubHelper.GetInstance.Connect("192.168.1.40", 8089); AlarmHelper.Init(); } else diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 4078b7f4..46961704 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -217,6 +217,39 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}"); } }), "AgvDebug"); + + ActionManage.GetInstance.Register(() => + { + MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); + + }, "AgvArriveCleanPlateLocCom"); + + ActionManage.GetInstance.Register(() => + { + MessageLog.GetInstance.ShowRunLog("4号线卸桶完成"); + + }, "AgvArriveLineFourLocCom"); + ActionManage.GetInstance.Register(() => + { + MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); + + }, "AgvArriveCleanPlateLocLoadCom"); + + ActionManage.GetInstance.Register(() => + { + globalVar.rollerLineOne.RecipeCompleteSingle = 1; + + }, "LineOneRecipeComSignal"); + ActionManage.GetInstance.Register(() => + { + globalVar.rollerLineTwo.RecipeCompleteSingle = 1; + + }, "LineTwoRecipeComSignal"); + ActionManage.GetInstance.Register(() => + { + globalVar.rollerLineThree.RecipeCompleteSingle = 1; + + }, "LineThreeRecipeComSignal"); ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveLineOneLoadCom = true; @@ -641,7 +674,6 @@ namespace FryPot_DosingSystem.Control Upstreamrequest objData = JsonConvert.DeserializeObject(obj.ToString()); if (objData != null) { - #region 线体到炒锅 //线体1请求上下料 if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 @@ -1027,24 +1059,28 @@ namespace FryPot_DosingSystem.Control if (objData.state == "DONE" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料 { + MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); AgvViewModel.GetInstance().Set小车停止(4); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); } if (objData.state == "DONE" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料 { + MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); AgvViewModel.GetInstance().Set小车停止(4); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); } if (objData.state == "DONE" && objData.robotJobId == LNinerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料 { + MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); AgvViewModel.GetInstance().Set小车停止(4); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); } if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料 { + MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hs_4);//去四号空桶线 @@ -1065,6 +1101,7 @@ namespace FryPot_DosingSystem.Control if (objData.state == "DONE" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料 { + MessageLog.GetInstance.ShowRunLog("【4】号线空桶回桶完成"); AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); AgvViewModel.GetInstance().Set小车停止(4); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); @@ -1355,6 +1392,11 @@ namespace FryPot_DosingSystem.Control globalVar.CleadBarrelEnterSingle = data[0]; })); + GetAddressData("2076", new Action(data => + { + globalVar.CleanComplete = data[0];//洗桶出桶agv呼叫信号 + + })); GetAddressData("D2077", new Action(data => { @@ -1959,10 +2001,11 @@ namespace FryPot_DosingSystem.Control if (globalVar.agvArriveCleanLoad) { globalVar.agvArriveCleanLoad = false; + WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); - MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); + // MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum); - AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_4); } } @@ -2055,7 +2098,7 @@ namespace FryPot_DosingSystem.Control } } } - + /// /// AGV到达清洗台下料位置 /// @@ -2065,12 +2108,13 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveCleanUnLoad = false; MessageLog.GetInstance.ShowRunLog("空桶到达清洗位置,准备卸桶"); - MessageLog.GetInstance.ShowRunLog("卸桶完成"); AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_hj); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum); //plc交互 + WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } } @@ -2100,8 +2144,9 @@ namespace FryPot_DosingSystem.Control /// private void LThreeRecipeDataToPlc() { - if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe) + if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe&&globalVar.rollerLineThree.RecipeCompleteSingle==1) { + globalVar.rollerLineThree.RecipeComMidSingle = 1; if (globalVar.LThreeCurrentRecipeName != string.Empty) { MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); @@ -2120,7 +2165,7 @@ namespace FryPot_DosingSystem.Control Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); } } - if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件 + if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0&&globalVar.rollerLineThree.RecipeComMidSingle==1)//后续添加其它限制条件 { 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(); })); @@ -2161,7 +2206,7 @@ namespace FryPot_DosingSystem.Control } } DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据 - //AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LThreeFryPotSerial, IsRun.Stop); + globalVar.rollerLineThree.RecipeComMidSingle = 0; } } @@ -2174,8 +2219,9 @@ namespace FryPot_DosingSystem.Control /// private void LTwoRecipeDataToPlc() { - if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe) + if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe&&globalVar.rollerLineTwo.RecipeCompleteSingle == 1) { + globalVar.rollerLineTwo.RecipeComMidSingle = 1; if (globalVar.LTwoCurrentRecipeName != string.Empty) { MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); @@ -2206,7 +2252,7 @@ namespace FryPot_DosingSystem.Control } } - if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0)//后续添加其它限制条件 + if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle== 1)//后续添加其它限制条件 { if (globalVar.LTwoFryPotSerial == 2) { @@ -2263,7 +2309,7 @@ namespace FryPot_DosingSystem.Control } } DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据 - + globalVar.rollerLineTwo.RecipeComMidSingle = 0; } } @@ -2276,8 +2322,9 @@ namespace FryPot_DosingSystem.Control /// private void LOneRecipeDataToPlc() { - if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe) + if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe&&globalVar.rollerLineOne.RecipeCompleteSingle==1) { + globalVar.rollerLineOne.RecipeComMidSingle = 1; if (globalVar.LOneCurrentRecipeName != string.Empty) { MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成"); @@ -2307,7 +2354,7 @@ namespace FryPot_DosingSystem.Control Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; }); } } - if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件 + if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0&&globalVar.rollerLineOne.RecipeComMidSingle==1)//后续添加其它限制条件 { if (globalVar.LOneFryPotSerial == 1) { @@ -2362,7 +2409,7 @@ namespace FryPot_DosingSystem.Control } } DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据 - + globalVar.rollerLineOne.RecipeComMidSingle = 0;//配方完成的中转信号置0 } } @@ -2569,11 +2616,13 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotOneOrFourSingleSetDown(); globalVar.agvArriveUnLoad = false; globalVar.PotOneInputMaterialArrive = true; + FryPotOneRollerTroubleCheck(); } } public void LOneFallMaterial() { + if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive) { //if (globalVar.LOneFryPotSerial == 1) @@ -2586,7 +2635,7 @@ 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();//保存数据 //} - FryPotOneRollerTroubleCheck(); + //FryPotOneRollerTroubleCheck(); if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障 { if (globalVar.LOneFryPotSerial == 1) @@ -2607,6 +2656,7 @@ namespace FryPot_DosingSystem.Control globalVar.PotOneOutputRollerArrive = true; } } + } /// /// 线体2的AGV从炒锅送料位置到倒料过程处理 @@ -2751,14 +2801,16 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 globalVar.agvArriveUpLoad = false; globalVar.AgvArrivePot = true; + FryPotOneRollerTroubleCheck(); } } public void LOneEmptyOperate() { + if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFour.EmptyBarrelArrivedSingle == 1) && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) { - FryPotOneRollerTroubleCheck(); + // FryPotOneRollerTroubleCheck(); if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 { if (globalVar.agvFryPotEmptyRollerArrive) @@ -2792,6 +2844,7 @@ namespace FryPot_DosingSystem.Control } } + } /// @@ -2903,12 +2956,13 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveLineFour = false; //线体四信号交互 + WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC MessageLog.GetInstance.ShowRunLog("AGV到达【4】号回收线体,准备卸桶"); - MessageLog.GetInstance.ShowRunLog("卸桶完成"); - AgvViewModel.GetInstance().Set滚筒线状态(4,IsRun.Start); + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(4,IsBool.No); - AgvViewModel.GetInstance().Set小车运动(4,CartMotionTrajectory.hj); + AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); + AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hj); AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); } } @@ -4086,7 +4140,16 @@ namespace FryPot_DosingSystem.Control switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 1: - if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + { + FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); + } + else + { + FryPotAlarm = 1; return; + + } + while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { Thread.Sleep(5); if (globalVar.ExitLineOneTask) return; diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index eb444f1e..52c19054 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -58,7 +58,7 @@ namespace FryPot_DosingSystem.Control /// public ushort PlcInite { get; set; } /// - /// 清洗台清洗完成信号 + /// 清洗台清洗完成信号/洗桶出桶AGV呼叫信号 /// public ushort CleanComplete { get; set; } #region 上位机内部逻辑条件 @@ -250,6 +250,10 @@ namespace FryPot_DosingSystem.Control /// public ushort RecipeCompleteSingle { get; set; } /// + /// 当前配方完成的中转信号 + /// + public ushort RecipeComMidSingle { get; set; } = 1; + /// /// 线体1上空桶确认信号 /// public ushort EmptyRollerConfirmSingle { get; set; } @@ -318,7 +322,10 @@ namespace FryPot_DosingSystem.Control /// 当前线体配方完成信号 /// public ushort RecipeCompleteSingle { get; set; } - + /// + /// 当前配方完成的中转信号 + /// + public ushort RecipeComMidSingle { get; set; } = 1; /// /// 线体1上空桶确认信号 /// @@ -387,7 +394,10 @@ namespace FryPot_DosingSystem.Control /// 当前线体配方完成信号 /// public ushort RecipeCompleteSingle { get; set; } - + /// + /// 当前配方完成的中转信号 + /// + public ushort RecipeComMidSingle { get; set; } = 1; /// /// 线体1上空桶确认信号 /// @@ -457,8 +467,11 @@ namespace FryPot_DosingSystem.Control /// 当前线体配方完成信号 /// public ushort RecipeCompleteSingle { get; set; } + /// + /// 当前配方完成的中转信号 + /// + public ushort RecipeComMidSingle { get; set; } = 1; - } /// /// 炒锅1相关变量 diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml index 5e29cf2e..c882f31f 100644 --- a/FryPot_DosingSystem/View/DebugView.xaml +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -39,6 +39,7 @@ @@ -103,9 +107,11 @@ @@ -139,9 +146,11 @@