diff --git a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs index b16aa22..95b849b 100644 --- a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs @@ -28,6 +28,7 @@ namespace Rs.MotionPlat.Flow public enum EDischargeFlowStep { 等待任务, + /*取料*/ 到取料位上方, 等待到取料位上方, 到取料位下方, @@ -37,12 +38,14 @@ namespace Rs.MotionPlat.Flow 取料失败报警, 取料完成抬起, 等待取料完成抬起, + /*拍照*/ 到下相机拍照起始位, 等待到下相机拍照起始位, 到下相机拍照结束位, 等待到下相机拍照结束位, 等待相机拍照完成, 等待视觉处理结果, + /*放料*/ 到放料位上方, 等待到放料位上方, 丢料检测, @@ -53,8 +56,8 @@ namespace Rs.MotionPlat.Flow 周转盘放料位真空检测, 放料完成抬起, 等待放料完成抬起, - 放料真空检测, 粘料检测, + 放料真空检测, 周转盘放料真空报警, 放料任务完成, 任务结束到安全位, @@ -1312,6 +1315,7 @@ namespace Rs.MotionPlat.Flow } else { + //异常处理 bool exit = false; Dictionary buttons = new Dictionary() { @@ -1322,6 +1326,7 @@ namespace Rs.MotionPlat.Flow while (!exit) { alarmInfo = $"周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常"; + MessageQueue.Instance.Warn(GetClassName() + alarmInfo); TestCenterMessageBox.Show(AlarmConstID.TurnoverDumpFailAlarm, alarmInfo, ETipButton.Retry | ETipButton.Skip | ETipButton.Yes, buttons); msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.TurnoverDumpFailAlarm); if (msgBox != null) @@ -1342,16 +1347,25 @@ namespace Rs.MotionPlat.Flow case ETipButton.Skip://跳过 logInfo = GetClassName() + $"选择了跳过"; MessageQueue.Instance.Insert(logInfo); - //logInfo = $"{nameof(DischargeFlow)}-通知强力吸头到{curNozzle.ToType}盘{curNozzle.ToIndex}穴位处理异常料"; - //MessageQueue.Instance.Insert(logInfo); - //WarningSuckerNgFlow.Instance.Start(ETrayType.Turnover, curNozzle.ToIndex); - //WarningSuckerNgFlow.Instance.Wait(); - if (!UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null, curNozzle.ToIndex + 1)) + if (GlobalVar.EnableExceptionHandlingNozzle) { - VacManager.TurnoverTrayVacSuction(EVacOperator.Close,curNozzle.ToIndex+1); - exit = true; + //排料轴先回到安全位,等待异常处理吸嘴过来处理这颗异常料 + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + WarningSuckerNgFlow.Instance.DealNgProduct(ETrayType.Turnover, curNozzle.ToIndex + 1); + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, curNozzle.ToIndex + 1); curNozzle.Reset(); flowStep = EDischargeFlowStep.放料任务完成; + exit = true; + } + else + { + if (!UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null, curNozzle.ToIndex + 1)) + { + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, curNozzle.ToIndex + 1); + curNozzle.Reset(); + flowStep = EDischargeFlowStep.放料任务完成; + exit = true; + } } break; case ETipButton.Yes://移动到安全位 diff --git a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs index 2793588..65763a7 100644 --- a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs @@ -4,6 +4,7 @@ using Rs.Framework; using Rs.MotionPlat.Commom; using Rs.MotionPlat.Entitys.Trays; using Rs.MotionPlat.Flow.Camera; +using Rs.MotionPlat.Flow.NgFlow; using Rs.MotionPlat.Flow.SafePosFlow; using Rs.MotionPlat.Flow.SubFlow; using System; @@ -178,32 +179,38 @@ namespace Rs.MotionPlat.Flow } break; case ETurnoverFlowStep.到周转盘取料位上方: - targetPos = SysConfigParam.GetValue("TurnoverTakeX"); - errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed); - if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) + if(CanGoTurnoverTrayPos()) { - targetPos = SysConfigParam.GetValue("TurnoverTakeY"); - errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed); + targetPos = SysConfigParam.GetValue("TurnoverTakeX"); + errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed); if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) { - if (GlobalVar.VirtualAxis) + targetPos = SysConfigParam.GetValue("TurnoverTakeY"); + errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed); + if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) { - Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + if (GlobalVar.VirtualAxis) + { + Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + } + logInfo = GetClassName() + $"到周转盘取料位上方"; + MessageQueue.Instance.Insert(logInfo); + Step = ETurnoverFlowStep.等待运动到周转盘取料位上方; + } + else + { + MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverY, errCode); } - logInfo = GetClassName() + $"到周转盘取料位上方"; - MessageQueue.Instance.Insert(logInfo); - Step = ETurnoverFlowStep.等待运动到周转盘取料位上方; } else { - MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverY, errCode); + MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverX, errCode); } } else { - MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverX, errCode); + Msg.ShowError("turnovery axis move is unsafe"); } - break; case ETurnoverFlowStep.等待运动到周转盘取料位上方: if (Ops.IsStop(AxisControl.TurnoverX,AxisControl.TurnoverY) || GlobalVar.VirtualAxis) @@ -246,7 +253,15 @@ namespace Rs.MotionPlat.Flow MessageQueue.Instance.Insert(logInfo); if (GlobalVar.EnableExceptionHandlingNozzle) { - //周转吸头过来取料 + foreach (TurnoverTraySlot slot in untestSlots) + { + WarningSuckerNgFlow.Instance.DealNgProduct(ETrayType.Turnover, slot.Index); + slot.ClearProduct(); + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, slot.Index); + GlobalTray.TurnoverTray.ChangeStatus(slot.Index, ESlotStatus.NotHave); + } + exit = true; + Step = ETurnoverFlowStep.到测试放料位上方; } else { @@ -255,6 +270,7 @@ namespace Rs.MotionPlat.Flow { if (!LaserFlow.Instance.HasProduct(ETrayType.Turnover, slot.Index)) { + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, slot.Index); slot.ClearProduct(); GlobalTray.TurnoverTray.ChangeStatus(slot.Index, ESlotStatus.NotHave); } @@ -270,7 +286,7 @@ namespace Rs.MotionPlat.Flow case ETipButton.Yes: logInfo = $"选择了移动到安全位"; MessageQueue.Instance.Insert(logInfo); - TransitModuleSafePosFlow.Instance.GoSafePostion( EExceptionSafePos.TurnoverTray); + TransitModuleSafePosFlow.Instance.GoSafePostion(EExceptionSafePos.TurnoverTray); break; default: break; @@ -398,7 +414,7 @@ namespace Rs.MotionPlat.Flow undealTasks = LoadAndUnloadTask.Instance.GetTurnoverToTestTasks(ETaskDealStatus.Undeal); foreach (TurnoverInfo task in undealTasks) { - if (Ops.IsOn($"周转{task.FromIndex+1}号吸嘴真空吸检测") || GlobalVar.VirtualAxis || GlobalVar.RunSpace) + if (Ops.IsOn($"周转{task.FromIndex + 1}号吸嘴真空吸检测") || GlobalVar.VirtualAxis || GlobalVar.RunSpace) { //如果真空检测OK,带料产品已经吸上了 TransitNozzleManager.Instance.Nozzle(task.ToIndex + 1).AddProduct(task); @@ -409,7 +425,7 @@ namespace Rs.MotionPlat.Flow } } hasProductNozzles = TransitNozzleManager.Instance.GetHasProductNozzles(); - if (hasProductNozzles.Count > 0||GlobalVar.RunSpace || GlobalVar.VirtualAxis) + if (hasProductNozzles.Count > 0) { logInfo = GetClassName()+ $"周转吸头{hasProductNozzles.Select(n => n.NozzleIndex).ToJoinString()}真空检测OK"; MessageQueue.Instance.Insert(logInfo); @@ -691,17 +707,56 @@ namespace Rs.MotionPlat.Flow } break; case ETurnoverFlowStep.测试位放料完成真空检测: - //如果不启用光纤检测,先通过真空来判断穴位中是否放料,如果真空值达到说明有产品,如果真空值未达到,说明未放好,先用强力吸嘴压一下 - //ngList = TestVacCheck(); - if(GlobalVar.EnableTestFixtureFiberCheck) - { - - } - else + /*检测逻辑(光纤优先原则) + 1 先用光纤检测是否叠料,如果光纤跌料,则报警,如果光纤检测没有叠料,再用真空检测 + 2 真空检测正常则继续,真空检测异常,报真空报警 + */ + foreach (var nozzle in TransitNozzleManager.Instance.GetHasProductNozzles()) { - foreach (var nozzle in TransitNozzleManager.Instance.GetHasProductNozzles()) + //先检测光纤 + if(GlobalVar.EnableTestFixtureFiberCheck)//如果启用光纤 { - if(Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测") || GlobalVar.RunSpace) + if (Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位光纤检测") || GlobalVar.RunSpace) + { + bool exit = false; + while (!exit) + { + alarmInfo = $"测试治具{nozzle.NozzleIndex}号光纤异常,有可能叠料,请处理"; + MessageQueue.Instance.Warn(GetClassName() + alarmInfo); + TestCenterMessageBox.Show(AlarmConstID.NozzlesLoseMaterialAlarm, alarmInfo, MessageButtonManager.GetRetry_Skip_MoveToSafe_Button(), MessageButtonManager.GetRetry_Skip_MoveToSafe_ButtonText()); + msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.NozzlesLoseMaterialAlarm); + switch (msgBox.Button) + { + case ETipButton.Retry: + VacManager.TestTrayVacSuction(EVacOperator.Open, nozzle.NozzleIndex); + if (!Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位光纤检测") || GlobalVar.RunSpace) + { + //GlobalTray.TestTray.ChangeStatus(nozzle.NozzleIndex, ESlotStatus.Have); + //TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle); + //nozzle.Clear(); + exit = true; + } + break; + case ETipButton.Skip: + //镭射头过来复检,有产品则继续报警, + if (!LaserFlow.Instance.HasProduct(ETrayType.Test, nozzle.NozzleIndex)) + { + VacManager.TestTrayVacSuction(EVacOperator.Close, nozzle.NozzleIndex); + nozzle.Clear(); + exit = true; + } + break; + case ETipButton.Yes://移动到安全位 + VacManager.TestTrayVacSuction(EVacOperator.Close, nozzle.NozzleIndex); + TransitModuleSafePosFlow.Instance.GoSafePostion(EExceptionSafePos.Socket); + break; + } + } + } + } + if(nozzle.IsHasProduct) + { + if (Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测") || GlobalVar.RunSpace) { GlobalTray.TestTray.ChangeStatus(nozzle.NozzleIndex, ESlotStatus.Have); TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle); @@ -713,6 +768,7 @@ namespace Rs.MotionPlat.Flow while (!exit) { alarmInfo = $"测试治具{nozzle.NozzleIndex}号真空吸异常"; + MessageQueue.Instance.Warn(GetClassName() + alarmInfo); TestCenterMessageBox.Show(AlarmConstID.NozzlesLoseMaterialAlarm, alarmInfo, MessageButtonManager.GetRetry_Skip_MoveToSafe_Button(), MessageButtonManager.GetRetry_Skip_MoveToSafe_ButtonText()); msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.NozzlesLoseMaterialAlarm); switch (msgBox.Button) @@ -726,10 +782,10 @@ namespace Rs.MotionPlat.Flow nozzle.Clear(); exit = true; } - break; + break; case ETipButton.Skip: //镭射头过来复检,有产品则继续报警, - if(!LaserFlow.Instance.HasProduct(ETrayType.Test, nozzle.NozzleIndex)) + if (!LaserFlow.Instance.HasProduct(ETrayType.Test, nozzle.NozzleIndex)) { nozzle.Clear(); exit = true; @@ -737,24 +793,23 @@ namespace Rs.MotionPlat.Flow break; case ETipButton.Yes://移动到安全位 VacManager.TestTrayVacSuction(EVacOperator.Close, nozzle.NozzleIndex); - TransitModuleSafePosFlow.Instance.GoSafePostion( EExceptionSafePos.Socket); + TransitModuleSafePosFlow.Instance.GoSafePostion(EExceptionSafePos.Socket); break; } } - - } } - if (!turnoverTakeFinishe) - { - Step = ETurnoverFlowStep.到周转盘取料位上方; - } - else - { - Step = ETurnoverFlowStep.到测试保压位上方; - } + } - + if (!turnoverTakeFinishe) + { + Step = ETurnoverFlowStep.到周转盘取料位上方; + } + else + { + Step = ETurnoverFlowStep.到测试保压位上方; + } + break; case ETurnoverFlowStep.到测试保压位上方: targetPos = SysConfigParam.GetValue("PressDumpX"); @@ -932,9 +987,15 @@ namespace Rs.MotionPlat.Flow case ETurnoverFlowStep.等待测试完成抬起安全位: if (Ops.IsStop(AxisControl.PressZ) || GlobalVar.VirtualAxis) { - logInfo = GetClassName() + $"测试完成已抬起到安全位 PressZ at:{Ops.GetCurPosition(AxisAlias.PressZ)}"; - MessageQueue.Instance.Insert(logInfo); - Step = ETurnoverFlowStep.测试完成到治具取料位上方; + //AxisControl.PressZ.Get_Target_Position(out double pos); + //double tpos = Ops.GetCurPosition(AxisControl.PressZ); + //AxisControl.PressZ.IsArrived(out bool isArrived); + if (Ops.IsArrived(AxisAlias.PressZ)) + { + logInfo = GetClassName() + $"测试完成已抬起到安全位 PressZ at:{Ops.GetCurPosition(AxisAlias.PressZ)}"; + MessageQueue.Instance.Insert(logInfo); + Step = ETurnoverFlowStep.测试完成到治具取料位上方; + } } break; case ETurnoverFlowStep.测试完成到治具取料位上方: @@ -1242,30 +1303,37 @@ namespace Rs.MotionPlat.Flow } break; case ETurnoverFlowStep.到周转盘放料位上方: - targetPos = SysConfigParam.GetValue("TurnoverDumpX"); - errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed); - if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) + if(CanGoTurnoverTrayPos()) { - targetPos = SysConfigParam.GetValue("TurnoverDumpY"); - errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed); + targetPos = SysConfigParam.GetValue("TurnoverDumpX"); + errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed); if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) { - if (GlobalVar.VirtualAxis) + targetPos = SysConfigParam.GetValue("TurnoverDumpY"); + errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed); + if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) { - Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + if (GlobalVar.VirtualAxis) + { + Thread.Sleep(GlobalVar.VirtualAxisMoveTime); + } + logInfo = GetClassName() + $"到周转盘放料位上方"; + MessageQueue.Instance.Insert(logInfo); + Step = ETurnoverFlowStep.等待到周转盘放料位上方; + } + else + { + MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverY, errCode); } - logInfo = GetClassName() + $"到周转盘放料位上方"; - MessageQueue.Instance.Insert(logInfo); - Step = ETurnoverFlowStep.等待到周转盘放料位上方; } else { - MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverY, errCode); + MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverX, errCode); } } else { - MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverX, errCode); + Msg.ShowError("turnovery axis move is unsafe"); } break; case ETurnoverFlowStep.等待到周转盘放料位上方: @@ -1583,12 +1651,25 @@ namespace Rs.MotionPlat.Flow case ETipButton.Skip: logInfo = GetClassName() + "选择了跳过"; MessageQueue.Instance.Insert(logInfo); - //检测穴位中还是否有料 - if (!UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null, slot.Index, true)) + if(GlobalVar.EnableExceptionHandlingNozzle)//启用大力吸嘴 { - exit = true; + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + WarningSuckerNgFlow.Instance.DealNgProduct(ETrayType.Turnover, slot.Index); nozzle.Clear(); + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, slot.Index); + exit = true; + } + else + { + //检测穴位中还是否有料 + if (!UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null, slot.Index, true)) + { + nozzle.Clear(); + VacManager.TurnoverTrayVacSuction(EVacOperator.Close, slot.Index); + exit = true; + } } + break; case ETipButton.Yes: logInfo = GetClassName() + "选择了移动到安全位"; @@ -1599,7 +1680,6 @@ namespace Rs.MotionPlat.Flow break; } } - } else { @@ -1611,9 +1691,9 @@ namespace Rs.MotionPlat.Flow } } } - - DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); //排料轴回安全位 + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + //检测治具盘中是否还有待取的料,如果有继续取,如果没有回安全位 if (TestTrayManager.Instance.GetSlots( ETestTraySlotStatus.Have).Count>0) { retakeNum++; @@ -1714,5 +1794,18 @@ namespace Rs.MotionPlat.Flow return Step.ToString(); } + /// + /// 检测周转Y轴是否可以到周转盘位置 + /// + /// + private bool CanGoTurnoverTrayPos() + { + double curPos = Ops.GetCurPosition(AxisControl.LoadY); + if(Math.Abs(GlobalVar.LoadYStartPos-curPos)<0.5) + { + return true; + } + return false; + } } } diff --git a/Rs.SkyLine/Flow/SubFlow/LaserFlow.cs b/Rs.SkyLine/Flow/SubFlow/LaserFlow.cs index e2a933b..8d3fa98 100644 --- a/Rs.SkyLine/Flow/SubFlow/LaserFlow.cs +++ b/Rs.SkyLine/Flow/SubFlow/LaserFlow.cs @@ -124,11 +124,11 @@ namespace Rs.MotionPlat.Flow.SubFlow MessageQueue.Instance.Insert(logInfo); if(trayType== ETrayType.Turnover) { - hasProduct = !(Math.Abs(GlobalVar.TurnoverCheckBaseHeight-heightVal) < 0.5); + hasProduct = !(Math.Abs(GlobalVar.TurnoverCheckBaseHeight-heightVal) < 0.7); } else if(trayType== ETrayType.Test) { - hasProduct = !(Math.Abs(GlobalVar.TestFixtureCheckBaseHeight - heightVal) < 0.5); + hasProduct = !(Math.Abs(GlobalVar.TestFixtureCheckBaseHeight - heightVal) < 0.7); } finished = true; diff --git a/Rs.SkyLine/Flow/SubFlow/WarningSuckerNgFlow.cs b/Rs.SkyLine/Flow/SubFlow/WarningSuckerNgFlow.cs index 691fa1e..7d5e244 100644 --- a/Rs.SkyLine/Flow/SubFlow/WarningSuckerNgFlow.cs +++ b/Rs.SkyLine/Flow/SubFlow/WarningSuckerNgFlow.cs @@ -2,6 +2,7 @@ using Rs.Motion; using Rs.Motion.Base; using Rs.MotionPlat.Commom; +using Rs.MotionPlat.Entitys.Trays; using Rs.MotionPlat.Flow.SafePosFlow; using Rs.MotionPlat.Flow.SubFlow; using System; @@ -93,9 +94,14 @@ namespace Rs.MotionPlat.Flow.NgFlow switch (step) { case EWarningSuckerNgFlowStep.等待测试完成: - logInfo = GetClassName() + "测试工位已完成"; - MessageQueue.Instance.Insert(logInfo); - step = EWarningSuckerNgFlowStep.到取料位上方; + if(TurnoverFlow.Instance.GetStep()=="等待任务" + || TurnoverFlow.Instance.GetStep() == "取料异常报警" + || TurnoverFlow.Instance.GetStep()== "周转盘放料完成后真空检测") + { + logInfo = GetClassName() + "测试工位已完成"; + MessageQueue.Instance.Insert(logInfo); + step = EWarningSuckerNgFlowStep.到取料位上方; + } break; case EWarningSuckerNgFlowStep.到取料位上方: if (exceptionTray == ETrayType.Turnover) @@ -167,9 +173,9 @@ namespace Rs.MotionPlat.Flow.NgFlow case EWarningSuckerNgFlowStep.等待到取料位下方: if (Ops.IsStop(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis) { + Thread.Sleep(100); if (Ops.IsArrived(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis) { - Thread.Sleep(100); logInfo = GetClassName() + "已运动到异常处理位下方"; MessageQueue.Instance.Insert(logInfo); //打开强力吸嘴真空 @@ -262,7 +268,15 @@ namespace Rs.MotionPlat.Flow.NgFlow } break; case EWarningSuckerNgFlowStep.到放报警料穴位上方: - targetSlot = TrayPointManager.GetExceptiontTrayPoint(exceptionSlotIndex); + int exceptionRow = TurnoverTrayManager.Instance.Slot(exceptionSlotIndex).Row; + if(exceptionRow % 2 == 0) + { + targetSlot = TrayPointManager.GetExceptiontTrayPoint(1); + } + else + { + targetSlot = TrayPointManager.GetExceptiontTrayPoint(2); + } errCode = AxisControl.TurnoverX.MovePos(targetSlot.X, GlobalVar.WholeSpeed); if(errCode== ErrorCode.Ok ||GlobalVar.VirtualAxis) { @@ -394,11 +408,12 @@ namespace Rs.MotionPlat.Flow.NgFlow else { alarmInfo = "NG料盘中有产品,请手动取出!"; + MessageQueue.Instance.Warn(GetClassName() + alarmInfo); msgBox = MsgBox.ShowDialog(AlarmConstID.NgProductFiberCheckAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetRetry_Skip_MoveToSafe_ButtonText()); switch (msgBox.Button) { case ETipButton.Skip: - logInfo = "选择了跳过按钮"; + logInfo = GetClassName()+ "选择了跳过按钮"; MessageQueue.Instance.Insert(logInfo); break; case ETipButton.Yes://移动到安全位 diff --git a/Rs.SkyLine/Home.cs b/Rs.SkyLine/Home.cs index 6b35a8c..79bb2c5 100644 --- a/Rs.SkyLine/Home.cs +++ b/Rs.SkyLine/Home.cs @@ -128,11 +128,7 @@ namespace Rs.MotionPlat form.ShowMax = false; form.ShowMin = false; form.ShowInTaskbar = false; - //form.StartPosition = FormStartPosition.CenterScreen; - //MessageBox.Show(form.Width.ToString()); - //MessageBox.Show(form.Height.ToString()); - //form.Location= new Point(this.Width-form.Width, this.Height-form.Height); - //form.mov = new Point(0,0); + form.Location = new Point(this.Width - form.Width, this.Height - form.Height); form.Show(this); } else if (button == btnPermission) diff --git a/Rs.SkyLine/Rs.SkyLine.csproj b/Rs.SkyLine/Rs.SkyLine.csproj index c7290b2..fe87ee0 100644 --- a/Rs.SkyLine/Rs.SkyLine.csproj +++ b/Rs.SkyLine/Rs.SkyLine.csproj @@ -468,6 +468,12 @@ VarConfig.cs + + Form + + + TestFrm.cs + Form @@ -637,6 +643,9 @@ VarConfig.cs + + TestFrm.cs + UserForm.cs diff --git a/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs b/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs index 5381bd7..aabf44a 100644 --- a/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs +++ b/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs @@ -56,6 +56,8 @@ this.label6 = new System.Windows.Forms.Label(); this.cboxVirtualAxis = new System.Windows.Forms.CheckBox(); this.cboxCheckSafeEnable = new System.Windows.Forms.CheckBox(); + this.cboxEnableScanBarCodeByDownCamera = new System.Windows.Forms.CheckBox(); + this.cboxEnableExceptionHandlingNozzle = new System.Windows.Forms.CheckBox(); this.cboxRunSpace = new System.Windows.Forms.CheckBox(); this.panelEx1 = new Rs.Controls.PanelEx(); this.btnSaveSpeedParam = new System.Windows.Forms.Button(); @@ -77,8 +79,8 @@ this.label27 = new System.Windows.Forms.Label(); this.txtControlCenterIP = new System.Windows.Forms.TextBox(); this.label26 = new System.Windows.Forms.Label(); - this.cboxEnableExceptionHandlingNozzle = new System.Windows.Forms.CheckBox(); - this.cboxEnableScanBarCodeByDownCamera = new System.Windows.Forms.CheckBox(); + this.txtQifuValue = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); this.tableLayoutPanel1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox10.SuspendLayout(); @@ -319,6 +321,8 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.txtQifuValue); + this.groupBox1.Controls.Add(this.label9); this.groupBox1.Controls.Add(this.comboBox1); this.groupBox1.Controls.Add(this.panel1); this.groupBox1.Controls.Add(this.label2); @@ -354,7 +358,7 @@ this.groupBox1.Size = new System.Drawing.Size(778, 432); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; - this.groupBox1.Text = "参数设定"; + this.groupBox1.Text = "系统配置"; // // comboBox1 // @@ -441,6 +445,26 @@ this.cboxCheckSafeEnable.Text = "安全检查"; this.cboxCheckSafeEnable.UseVisualStyleBackColor = true; // + // cboxEnableScanBarCodeByDownCamera + // + this.cboxEnableScanBarCodeByDownCamera.AutoSize = true; + this.cboxEnableScanBarCodeByDownCamera.Location = new System.Drawing.Point(112, 277); + this.cboxEnableScanBarCodeByDownCamera.Name = "cboxEnableScanBarCodeByDownCamera"; + this.cboxEnableScanBarCodeByDownCamera.Size = new System.Drawing.Size(84, 16); + this.cboxEnableScanBarCodeByDownCamera.TabIndex = 8; + this.cboxEnableScanBarCodeByDownCamera.Text = "下相机扫码"; + this.cboxEnableScanBarCodeByDownCamera.UseVisualStyleBackColor = true; + // + // cboxEnableExceptionHandlingNozzle + // + this.cboxEnableExceptionHandlingNozzle.AutoSize = true; + this.cboxEnableExceptionHandlingNozzle.Location = new System.Drawing.Point(332, 240); + this.cboxEnableExceptionHandlingNozzle.Name = "cboxEnableExceptionHandlingNozzle"; + this.cboxEnableExceptionHandlingNozzle.Size = new System.Drawing.Size(96, 16); + this.cboxEnableExceptionHandlingNozzle.TabIndex = 8; + this.cboxEnableExceptionHandlingNozzle.Text = "启用强力吸嘴"; + this.cboxEnableExceptionHandlingNozzle.UseVisualStyleBackColor = true; + // // cboxRunSpace // this.cboxRunSpace.AutoSize = true; @@ -666,25 +690,29 @@ this.label26.TabIndex = 0; this.label26.Text = "中控IP:"; // - // cboxEnableExceptionHandlingNozzle - // - this.cboxEnableExceptionHandlingNozzle.AutoSize = true; - this.cboxEnableExceptionHandlingNozzle.Location = new System.Drawing.Point(332, 240); - this.cboxEnableExceptionHandlingNozzle.Name = "cboxEnableExceptionHandlingNozzle"; - this.cboxEnableExceptionHandlingNozzle.Size = new System.Drawing.Size(96, 16); - this.cboxEnableExceptionHandlingNozzle.TabIndex = 8; - this.cboxEnableExceptionHandlingNozzle.Text = "启用强力吸嘴"; - this.cboxEnableExceptionHandlingNozzle.UseVisualStyleBackColor = true; - // - // cboxEnableScanBarCodeByDownCamera - // - this.cboxEnableScanBarCodeByDownCamera.AutoSize = true; - this.cboxEnableScanBarCodeByDownCamera.Location = new System.Drawing.Point(112, 277); - this.cboxEnableScanBarCodeByDownCamera.Name = "cboxEnableScanBarCodeByDownCamera"; - this.cboxEnableScanBarCodeByDownCamera.Size = new System.Drawing.Size(84, 16); - this.cboxEnableScanBarCodeByDownCamera.TabIndex = 8; - this.cboxEnableScanBarCodeByDownCamera.Text = "下相机扫码"; - this.cboxEnableScanBarCodeByDownCamera.UseVisualStyleBackColor = true; + // txtQifuValue + // + this.txtQifuValue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); + this.txtQifuValue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.txtQifuValue.Font = new System.Drawing.Font("宋体", 9F); + this.txtQifuValue.ForeColor = System.Drawing.Color.White; + this.txtQifuValue.Location = new System.Drawing.Point(370, 325); + this.txtQifuValue.Name = "txtQifuValue"; + this.txtQifuValue.Size = new System.Drawing.Size(85, 21); + this.txtQifuValue.TabIndex = 51; + this.txtQifuValue.Tag = "PressZ"; + this.txtQifuValue.Text = "0.01"; + this.txtQifuValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.txtQifuValue.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtQifuValue_KeyUp); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(308, 329); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(47, 12); + this.label9.TabIndex = 50; + this.label9.Text = "气压值:"; // // CommonConfig // @@ -768,5 +796,7 @@ private System.Windows.Forms.Label label2; private System.Windows.Forms.CheckBox cboxEnableExceptionHandlingNozzle; private System.Windows.Forms.CheckBox cboxEnableScanBarCodeByDownCamera; + private System.Windows.Forms.TextBox txtQifuValue; + private System.Windows.Forms.Label label9; } } \ No newline at end of file diff --git a/Rs.SkyLine/SysConfig/CommonConfig.cs b/Rs.SkyLine/SysConfig/CommonConfig.cs index 4eac59a..b9776e9 100644 --- a/Rs.SkyLine/SysConfig/CommonConfig.cs +++ b/Rs.SkyLine/SysConfig/CommonConfig.cs @@ -68,7 +68,7 @@ namespace Rs.MotionPlat.SysConfig } } - //LoadSysParam(groupBox2); + txtQifuValue.Text = SysConfigParam.GetValue(txtQifuValue.Name.Replace("txt", "")); PositionHelper.BindPosition(groupBox9,"int"); PositionHelper.BindPosition(groupBox10, "int"); } @@ -103,7 +103,7 @@ namespace Rs.MotionPlat.SysConfig } } - Msg.ShowInfo("Save camera param success!"); + Msg.ShowInfo("Save success!"); } private void tbarWholeSpeed_ValueChanged(object sender, EventArgs e) @@ -130,5 +130,16 @@ namespace Rs.MotionPlat.SysConfig { UpdateSysParam((TextBox)sender); } + private void txtQifuValue_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + TextBox txt = (TextBox)sender; + string value = txt.Text; + QifuManager.Instance.Write(float.Parse(value)); + SysConfigParam.Update(txt.Name.Replace("txt", ""), value); + } + } + } } diff --git a/Rs.SkyLine/TestFrm.Designer.cs b/Rs.SkyLine/TestFrm.Designer.cs new file mode 100644 index 0000000..3487e21 --- /dev/null +++ b/Rs.SkyLine/TestFrm.Designer.cs @@ -0,0 +1,112 @@ +namespace Rs.MotionPlat +{ + partial class TestFrm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnTurnoverSlotException = new System.Windows.Forms.Button(); + this.btnDischargeGoSafePoint = new System.Windows.Forms.Button(); + this.btnSocketExceptionGoSafePoint = new System.Windows.Forms.Button(); + this.btnTransiteNozzleExceptionGoSafePoint = new System.Windows.Forms.Button(); + this.btnTurnoverTrayExceptionGoSafePoint = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnTurnoverSlotException + // + this.btnTurnoverSlotException.Location = new System.Drawing.Point(12, 12); + this.btnTurnoverSlotException.Name = "btnTurnoverSlotException"; + this.btnTurnoverSlotException.Size = new System.Drawing.Size(152, 37); + this.btnTurnoverSlotException.TabIndex = 0; + this.btnTurnoverSlotException.Text = "周转盘穴位异常处理"; + this.btnTurnoverSlotException.UseVisualStyleBackColor = true; + this.btnTurnoverSlotException.Click += new System.EventHandler(this.btnTurnoverSlotException_Click); + // + // btnDischargeGoSafePoint + // + this.btnDischargeGoSafePoint.Location = new System.Drawing.Point(202, 12); + this.btnDischargeGoSafePoint.Name = "btnDischargeGoSafePoint"; + this.btnDischargeGoSafePoint.Size = new System.Drawing.Size(152, 37); + this.btnDischargeGoSafePoint.TabIndex = 0; + this.btnDischargeGoSafePoint.Text = "排料到安全位"; + this.btnDischargeGoSafePoint.UseVisualStyleBackColor = true; + this.btnDischargeGoSafePoint.Click += new System.EventHandler(this.btnDischargeGoSafePoint_Click); + // + // btnSocketExceptionGoSafePoint + // + this.btnSocketExceptionGoSafePoint.Location = new System.Drawing.Point(391, 12); + this.btnSocketExceptionGoSafePoint.Name = "btnSocketExceptionGoSafePoint"; + this.btnSocketExceptionGoSafePoint.Size = new System.Drawing.Size(152, 37); + this.btnSocketExceptionGoSafePoint.TabIndex = 0; + this.btnSocketExceptionGoSafePoint.Text = "Socket异常到安全位"; + this.btnSocketExceptionGoSafePoint.UseVisualStyleBackColor = true; + this.btnSocketExceptionGoSafePoint.Click += new System.EventHandler(this.btnSocketExceptionGoSafePoint_Click); + // + // btnTransiteNozzleExceptionGoSafePoint + // + this.btnTransiteNozzleExceptionGoSafePoint.Location = new System.Drawing.Point(562, 12); + this.btnTransiteNozzleExceptionGoSafePoint.Name = "btnTransiteNozzleExceptionGoSafePoint"; + this.btnTransiteNozzleExceptionGoSafePoint.Size = new System.Drawing.Size(152, 37); + this.btnTransiteNozzleExceptionGoSafePoint.TabIndex = 0; + this.btnTransiteNozzleExceptionGoSafePoint.Text = "周转吸嘴异常到安全位"; + this.btnTransiteNozzleExceptionGoSafePoint.UseVisualStyleBackColor = true; + this.btnTransiteNozzleExceptionGoSafePoint.Click += new System.EventHandler(this.btnTransiteNozzleExceptionGoSafePoint_Click); + // + // btnTurnoverTrayExceptionGoSafePoint + // + this.btnTurnoverTrayExceptionGoSafePoint.Location = new System.Drawing.Point(730, 12); + this.btnTurnoverTrayExceptionGoSafePoint.Name = "btnTurnoverTrayExceptionGoSafePoint"; + this.btnTurnoverTrayExceptionGoSafePoint.Size = new System.Drawing.Size(152, 37); + this.btnTurnoverTrayExceptionGoSafePoint.TabIndex = 0; + this.btnTurnoverTrayExceptionGoSafePoint.Text = "周转吸嘴异常到安全位"; + this.btnTurnoverTrayExceptionGoSafePoint.UseVisualStyleBackColor = true; + this.btnTurnoverTrayExceptionGoSafePoint.Click += new System.EventHandler(this.btnTurnoverTrayExceptionGoSafePoint_Click); + // + // TestFrm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1336, 854); + this.Controls.Add(this.btnTurnoverTrayExceptionGoSafePoint); + this.Controls.Add(this.btnTransiteNozzleExceptionGoSafePoint); + this.Controls.Add(this.btnSocketExceptionGoSafePoint); + this.Controls.Add(this.btnDischargeGoSafePoint); + this.Controls.Add(this.btnTurnoverSlotException); + this.Name = "TestFrm"; + this.Text = "TestFrm"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button btnTurnoverSlotException; + private System.Windows.Forms.Button btnDischargeGoSafePoint; + private System.Windows.Forms.Button btnSocketExceptionGoSafePoint; + private System.Windows.Forms.Button btnTransiteNozzleExceptionGoSafePoint; + private System.Windows.Forms.Button btnTurnoverTrayExceptionGoSafePoint; + } +} \ No newline at end of file diff --git a/Rs.SkyLine/TestFrm.cs b/Rs.SkyLine/TestFrm.cs new file mode 100644 index 0000000..9d66a54 --- /dev/null +++ b/Rs.SkyLine/TestFrm.cs @@ -0,0 +1,49 @@ +using Rs.MotionPlat.Flow.NgFlow; +using Rs.MotionPlat.Flow.SafePosFlow; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Rs.MotionPlat +{ + public partial class TestFrm : BaseForm + { + public TestFrm() + { + InitializeComponent(); + } + + private void btnTurnoverSlotException_Click(object sender, EventArgs e) + { + Task.Run(() => { + WarningSuckerNgFlow.Instance.DealNgProduct(Commom.ETrayType.Turnover, 1); + }); + } + + private void btnTransiteNozzleExceptionGoSafePoint_Click(object sender, EventArgs e) + { + TransitModuleSafePosFlow.Instance.GoSafePostion(Commom.EExceptionSafePos.TransitNozzle); + } + + private void btnSocketExceptionGoSafePoint_Click(object sender, EventArgs e) + { + TransitModuleSafePosFlow.Instance.GoSafePostion(Commom.EExceptionSafePos.Socket); + } + + private void btnDischargeGoSafePoint_Click(object sender, EventArgs e) + { + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + } + + private void btnTurnoverTrayExceptionGoSafePoint_Click(object sender, EventArgs e) + { + TransitModuleSafePosFlow.Instance.GoSafePostion(Commom.EExceptionSafePos.TurnoverTray); + } + } +} diff --git a/Rs.SkyLine/TestFrm.resx b/Rs.SkyLine/TestFrm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Rs.SkyLine/TestFrm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file