diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 9e031370..3a74e5ec 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -513,7 +513,7 @@ namespace FryPot_DosingSystem.Control catch (Exception) { - // throw; + // throw; } } /// @@ -1752,7 +1752,7 @@ namespace FryPot_DosingSystem.Control using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe,Time= DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; + PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -2133,7 +2133,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.CleanOutputRollerRunning == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -2164,10 +2164,17 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处 LSevenrobotJobId.Add(id); - Thread.Sleep(500); - LineToCleanCarryTaskErrorCodeAnalysis(info, 1); - globalVar.rollerLineOne.IsEpmtyBefore = true; - // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 + // Thread.Sleep(500); + if (LineToCleanCarryTaskErrorCodeAnalysis(info, 1)) + { + + globalVar.rollerLineOne.IsEpmtyBefore = true; + } + else + { + LSevenrobotJobId.Remove(id); + } + // AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 } } else @@ -2199,10 +2206,17 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处 LEightrobotJobId.Add(id); - Thread.Sleep(500); - LineToCleanCarryTaskErrorCodeAnalysis(info, 2); - globalVar.rollerLineTwo.IsEpmtyBefore = true; - + //Thread.Sleep(500); + if (LineToCleanCarryTaskErrorCodeAnalysis(info, 2)) + { + + globalVar.rollerLineTwo.IsEpmtyBefore = true; + } + else + { + LEightrobotJobId.Remove(id); + } + //AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处 } } @@ -2234,10 +2248,17 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处 LNinerobotJobId.Add(id); - Thread.Sleep(500); - LineToCleanCarryTaskErrorCodeAnalysis(info, 3); - globalVar.rollerLineThree.IsEpmtyBefore = true; - + //Thread.Sleep(500); + if (LineToCleanCarryTaskErrorCodeAnalysis(info, 3))//呼叫成功 + { + + globalVar.rollerLineThree.IsEpmtyBefore = true; + } + else//呼叫失败 + { + LNinerobotJobId.Remove(id); + } + //AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处 } } @@ -2257,18 +2278,18 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineOne.agvArriveCleanUnLoad = false; MessageLog.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); - - erp: if (AlarmHelper.Alarm.CleanEnterRollerRunning == 0) + + erp: if (AlarmHelper.Alarm.CleanEnterRollerRunning == 0) { //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC - + } else//有故障 { while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -2300,7 +2321,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -2331,7 +2352,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.CleanEnterRollerRunning == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -2363,9 +2384,13 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id); LTenrobotJobId.Add(id); - Thread.Sleep(500); + //Thread.Sleep(500); MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶"); - CleanToLineCarryTaskErrorCodeAnalysis(info, 4); + if (!CleanToLineCarryTaskErrorCodeAnalysis(info, 4)) + { + LTenrobotJobId.Remove(id); + MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶失败"); + } } } /// @@ -2863,7 +2888,7 @@ namespace FryPot_DosingSystem.Control // Sqlite.GetInstance.Save();//保存数据 //} //FryPotOneRollerTroubleCheck(); - if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1 )|| (FryPotFourAlarm == 1&& globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障 + if ((FryPotAlarm == 1 && globalVar.LOneFryPotSerial == 1) || (FryPotFourAlarm == 1 && globalVar.LOneFryPotSerial == 4))//炒锅滚筒无故障 { if (globalVar.LOneFryPotSerial == 1) { @@ -2877,10 +2902,14 @@ namespace FryPot_DosingSystem.Control //炒锅滚筒进料运行到位处理 FryPotOneOrFourInputMaterialRollerOperate(); - AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start); - globalVar.InOrOutputLock = true; - globalVar.PotOneOutputRollerArrive = true; + //上游下发搬运任务给AGV + if (AgvFromFryPotOneOrFourToClean()) + { + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LOneFryPotSerial, IsRun.Start); + globalVar.InOrOutputLock = true; + globalVar.PotOneOutputRollerArrive = true; + } + } } @@ -2921,8 +2950,8 @@ 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();//保存数据 //} - - if ((FryPotTwoAlarm == 1&& globalVar.LTwoFryPotSerial == 2) ||( FryPotFiveAlarm == 1&& globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障 + + if ((FryPotTwoAlarm == 1 && globalVar.LTwoFryPotSerial == 2) || (FryPotFiveAlarm == 1 && globalVar.LTwoFryPotSerial == 5))//炒锅滚筒无故障 { if (globalVar.LTwoFryPotSerial == 2) { @@ -2938,10 +2967,14 @@ namespace FryPot_DosingSystem.Control //炒锅滚筒进料运行到位处理 FryPotTwoOrFiveInputMaterialRollerOperate(); - AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV - AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start); - globalVar.LTwoInOrOutputLock = true; - globalVar.LTwoPotOutputRollerArrive = true; + //上游下发搬运任务给AGV + if (AgvFromFryPotTwoOrFiveToClean()) + { + AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Start); + globalVar.LTwoInOrOutputLock = true; + globalVar.LTwoPotOutputRollerArrive = true; + } + } } } @@ -2967,18 +3000,21 @@ namespace FryPot_DosingSystem.Control { //Sqlite.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 //Sqlite.GetInstance.Save();//保存数据 - + 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 }); })); //炒锅滚筒进料运行到位处理 FryPotThreeInputMaterialRollerOperate(); - AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV - AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start); - globalVar.LThreeInOrOutputLock = true; - globalVar.LThreePotOutputRollerArrive = true; + //上游下发搬运任务给AGV + if (AgvFromFryPotThreeToClean()) + { + AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Start); + globalVar.LThreeInOrOutputLock = true; + globalVar.LThreePotOutputRollerArrive = true; + } + } } } @@ -3040,8 +3076,8 @@ namespace FryPot_DosingSystem.Control { // FryPotOneRollerTroubleCheck(); - if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 - { + //if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 + //{ if (globalVar.agvFryPotEmptyRollerArrive) { FryPotOneOrFourOutEmpetyRollerOperate(); @@ -3069,7 +3105,7 @@ namespace FryPot_DosingSystem.Control } } - } + //} } @@ -3087,6 +3123,7 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 globalVar.agvArriveLTwoUpLoad = false; globalVar.LTwoAgvArrivePot = true; + FryPotTwoRollerTroubleCheck(); } } @@ -3094,9 +3131,9 @@ namespace FryPot_DosingSystem.Control { if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot) { - FryPotTwoRollerTroubleCheck(); - if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障 - { + + //if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障 + //{ if (globalVar.LTwoagvFryPotEmptyRollerArrive) { FryPotTwoOrFiveOutEmpetyRollerOperate(); @@ -3125,7 +3162,7 @@ namespace FryPot_DosingSystem.Control } } - } + //} } } @@ -3140,6 +3177,7 @@ namespace FryPot_DosingSystem.Control AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 globalVar.agvArriveLThreeUpLoad = false; globalVar.LThreeAgvArrivePot = true; + FryPotThreeRollerTroubleCheck(); } } @@ -3147,9 +3185,8 @@ namespace FryPot_DosingSystem.Control { if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot) { - FryPotThreeRollerTroubleCheck(); - if (FryPotThreeAlarm == 1)//无故障 - { + //if (FryPotThreeAlarm == 1)//无故障 + //{ if (globalVar.LThreeagvFryPotEmptyRollerArrive) { FryPotThreeOutEmpetyRollerOperate(); @@ -3171,7 +3208,7 @@ namespace FryPot_DosingSystem.Control } } - } + // } } } @@ -3562,8 +3599,9 @@ namespace FryPot_DosingSystem.Control /// /// AGV离开炒锅1,4运送空桶任务 /// - public void AgvFromFryPotOneOrFourToClean() + public bool AgvFromFryPotOneOrFourToClean() { + bool result = true; switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 1: @@ -3575,7 +3613,13 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务"); string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id); LFourrobotJobId = id; - FryCarryTaskErrorCodeAnalysis(info, 1); break; + + if (!FryCarryTaskErrorCodeAnalysis(info, 1)) + { + id = String.Empty; + result = false; + } + break; case 4: erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id3) != null || LEightrobotJobId.FirstOrDefault(p => p == id3) != null || LNinerobotJobId.FirstOrDefault(p => p == id3) != null || LTenrobotJobId.FirstOrDefault(p => p == id3) != null) @@ -3585,14 +3629,22 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务"); string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3); LFourrobotJobId = id3; - FryCarryTaskErrorCodeAnalysis(info3, 4); break; + if (!FryCarryTaskErrorCodeAnalysis(info3, 4)) + { + id3 = String.Empty; + result = false; + } + + break; } + return result; } /// /// AGV离开炒锅2,5运送空桶任务 /// - public void AgvFromFryPotTwoOrFiveToClean() + public bool AgvFromFryPotTwoOrFiveToClean() { + bool result = true; switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 2: @@ -3604,7 +3656,13 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务"); string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1); LFiverobotJobId = id1; - FryCarryTaskErrorCodeAnalysis(info1, 2); break; + + if (!FryCarryTaskErrorCodeAnalysis(info1, 2)) + { + id1 = String.Empty; + result = false; + } + break; case 5: erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id4) != null || LEightrobotJobId.FirstOrDefault(p => p == id4) != null || LNinerobotJobId.FirstOrDefault(p => p == id4) != null || LTenrobotJobId.FirstOrDefault(p => p == id4) != null) @@ -3614,14 +3672,22 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务"); string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4); LFiverobotJobId = id4; - FryCarryTaskErrorCodeAnalysis(info4, 5); break; + + if (!FryCarryTaskErrorCodeAnalysis(info4, 5)) + { + id4 = String.Empty; + result = false; + } + break; } + return result; } /// /// AGV离开炒锅3运送空桶任务 /// - public void AgvFromFryPotThreeToClean() + public bool AgvFromFryPotThreeToClean() { + bool result = true; erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id2) != null || LEightrobotJobId.FirstOrDefault(p => p == id2) != null || LNinerobotJobId.FirstOrDefault(p => p == id2) != null || LTenrobotJobId.FirstOrDefault(p => p == id2) != null) { @@ -3630,7 +3696,13 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务"); string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2); LSixrobotJobId = id2; - FryCarryTaskErrorCodeAnalysis(info2, 3); + + if (!FryCarryTaskErrorCodeAnalysis(info2, 3)) + { + id2 = string.Empty; + result = false; + } + return result; } /// /// 处理agv从线体1到送料到炒锅的条件 @@ -3662,7 +3734,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LOneRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -3700,7 +3772,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LOneRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -3741,7 +3813,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) return; } @@ -3780,7 +3852,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -3821,7 +3893,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineThreeTask) return; } @@ -3861,7 +3933,7 @@ namespace FryPot_DosingSystem.Control { while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) { - Thread.Sleep(5); + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } @@ -3876,20 +3948,22 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num) + public bool LineCarryTaskErrorCodeAnalysis(string errorCode, int num) { if (errorCode == "SUCCESS") { MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶"); - globalVar.AllowAgvToLineLoadRoller = false; + return true; } else if (errorCode == "Analysis Error") { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文"); + return false; } else { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}"); + return false; } } /// @@ -3897,20 +3971,22 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num) + public bool LineToCleanCarryTaskErrorCodeAnalysis(string errorCode, int num) { if (errorCode == "SUCCESS") { - - MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶"); + MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装空桶"); + return true; } else if (errorCode == "Analysis Error") { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文"); + return false; } else { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}"); + return false; } } /// @@ -3918,20 +3994,22 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num) + public bool CleanToLineCarryTaskErrorCodeAnalysis(string errorCode, int num) { if (errorCode == "SUCCESS") { - - MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线卸桶"); + MessageLog.GetInstance.ShowRunLog($"AGV从清洗台到{num}号滚筒线卸桶"); + return true; } else if (errorCode == "Analysis Error") { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文"); + return false; } else { MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}"); + return false; } } /// @@ -3939,19 +4017,22 @@ namespace FryPot_DosingSystem.Control /// /// /// - public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num) + public bool FryCarryTaskErrorCodeAnalysis(string errorCode, int num) { if (errorCode == "SUCCESS") { MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅"); + return true; } else if (errorCode == "Analysis Error") { MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查"); + return false; } else { MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}"); + return false; } } @@ -3964,15 +4045,18 @@ namespace FryPot_DosingSystem.Control if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶 { globalVar.rollerLineOne.CanRun = false; - e: string id = Guid.NewGuid().ToString("N"); + e: string id = Guid.NewGuid().ToString("N");//32位 if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); LOnerobotJobId = id; - Thread.Sleep(500); - LineCarryTaskErrorCodeAnalysis(info, 1); - globalVar.LoadRoller = true; + if (LineCarryTaskErrorCodeAnalysis(info, 1)) + { + globalVar.AllowAgvToLineLoadRoller = false; + globalVar.LoadRoller = true; + } + } //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) //{ @@ -4028,9 +4112,13 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id); LTworobotJobId = id; - Thread.Sleep(500); - LineCarryTaskErrorCodeAnalysis(info, 2); - globalVar.LTwoLoadRoller = true; + //Thread.Sleep(500); + if (LineCarryTaskErrorCodeAnalysis(info, 2)) + { + globalVar.LTwoLoadRoller = true; + globalVar.AllowAgvToLineTwoLoadRoller = false; + } + } //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) //{ @@ -4079,9 +4167,13 @@ namespace FryPot_DosingSystem.Control string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id); LThreerobotJobId = id; - Thread.Sleep(500); - LineCarryTaskErrorCodeAnalysis(info, 3); - globalVar.LThreeLoadRoller = true; + //Thread.Sleep(500); + if (LineCarryTaskErrorCodeAnalysis(info, 3)) + { + globalVar.LThreeLoadRoller = true; + globalVar.AllowAgvToLineThreeLoadRoller = false; + } + } //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) //{ @@ -4371,7 +4463,7 @@ namespace FryPot_DosingSystem.Control } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitLineOneTask) + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); @@ -4379,7 +4471,7 @@ namespace FryPot_DosingSystem.Control case 4: if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitLineOneTask) + Thread.Sleep(1000); if (globalVar.ExitLineOneTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); @@ -4399,7 +4491,7 @@ namespace FryPot_DosingSystem.Control case 2: if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitLineTwoTask) + Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); @@ -4407,7 +4499,7 @@ namespace FryPot_DosingSystem.Control case 5: if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitLineTwoTask) + Thread.Sleep(1000); if (globalVar.ExitLineTwoTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); @@ -4422,7 +4514,7 @@ namespace FryPot_DosingSystem.Control FryPotThreeAlarm = 0; if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitLineThreeTask) + Thread.Sleep(1000); if (globalVar.ExitLineThreeTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");