From 7ab3cb19d2f051e84d64080213526a9d9bdcb691 Mon Sep 17 00:00:00 2001 From: lhiven Date: Fri, 23 Aug 2024 16:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=A8=E7=A9=BA=E8=B7=91?= =?UTF-8?q?=E6=97=B6=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=E6=96=99=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.DeweyTester/Commom/GlobalVar.cs | 13 ++ .../Flow/NormalFlow/DischargeFlow.cs | 165 ++++++++---------- .../SysConfig/CommonConfig.Designer.cs | 10 ++ Rs.DeweyTester/SysConfig/CommonConfig.cs | 2 +- Rs.DeweyTester/SysConfig/CommonConfig.resx | 37 +++- 5 files changed, 129 insertions(+), 98 deletions(-) diff --git a/Rs.DeweyTester/Commom/GlobalVar.cs b/Rs.DeweyTester/Commom/GlobalVar.cs index 6e5693a..c1306ee 100644 --- a/Rs.DeweyTester/Commom/GlobalVar.cs +++ b/Rs.DeweyTester/Commom/GlobalVar.cs @@ -22,6 +22,19 @@ namespace Rs.Framework { #region newpro + /// + /// 启用料仓 + /// + [ParameterInit("bool", "true", "system", "启用料仓")] + public static bool EnableStock + { + get + { + return SysConfigParam.GetValue(nameof(EnableStock)); + } + } + + public static ECardMode CardMode { get; diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index cb66760..7e298c1 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -189,7 +189,16 @@ namespace Rs.MotionPlat.Flow GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave); GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave); GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); - flowStep = EDischargeFlowStep.工作前准备; + if(GlobalVar.RunSpace&&!GlobalVar.EnableStock) + { + GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); + flowStep = EDischargeFlowStep.判断是否需要从料仓取料; + } + else + { + flowStep = EDischargeFlowStep.工作前准备; + } + } else if(button== EButtonType.Cancel) { @@ -274,106 +283,55 @@ namespace Rs.MotionPlat.Flow } else { - //换料盘 - //GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); - //先判断是否时最后一盘料,如果时最后一盘料,则提示客户换料 - //if(Stock2Flow.Instance.GetCurrentLayer()==1) - if(StockManager.GetCurrentLayer(2)==1) + if(GlobalVar.RunSpace&&!GlobalVar.EnableStock) { - EButtonType btn = Msgbox.ShowTipDialog( EButtonType.Retry| EButtonType.EndInput,"Please change tray","tip",true); - if(btn== EButtonType.Retry) + GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); + takeSlotIndex = 1; + } + else + { + //换料盘 + //GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); + //先判断是否时最后一盘料,如果时最后一盘料,则提示客户换料 + //if(Stock2Flow.Instance.GetCurrentLayer()==1) + if (StockManager.GetCurrentLayer(2) == 1) + { + EButtonType btn = Msgbox.ShowTipDialog(EButtonType.Retry | EButtonType.EndInput, "Please change tray", "tip", true); + if (btn == EButtonType.Retry) + { + //先把轴移动到安全位 + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + //TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty); + //Stock2Flow.Instance.PrepareTray(); + StockManager.PrepareTray(2); + TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty); + } + else if (btn == EButtonType.EndInput) + { + GlobalVar.Clear = true; + } + } + else { //先把轴移动到安全位 DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); - //TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty); - //Stock2Flow.Instance.PrepareTray(); - StockManager.PrepareTray(2); TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty); - } - else if(btn== EButtonType.EndInput) - { - GlobalVar.Clear = true; + GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); + takeSlotIndex = 1; } } - else - { - //先把轴移动到安全位 - DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); - TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty); - GlobalTray.InputTray.ChangeStatus(ESlotStatus.Have); - takeSlotIndex = 1; - } + } } break; case EDischargeFlowStep.进料盘产品定位: - if(GlobalVar.RunSpace) + ProductLocationFlow.Instance.Grab(ETrayType.Input, takeSlotIndex); + productLocationResult = OneGrabSixteenManager.Instance.GetResults(); + if (productLocationResult != null || GlobalVar.RunSpace) { + //对结果进行处理 flowStep = EDischargeFlowStep.料仓取料; - productLocationResult = OneGrabSixteenManager.Instance.GetResults(); - } - else - { - ProductLocationFlow.Instance.Grab(ETrayType.Input, takeSlotIndex); - productLocationResult = OneGrabSixteenManager.Instance.GetResults(); - if (productLocationResult != null) - { - //foreach (ProductLocationResult item in results) - //{ - // if(item.Result== EOneGrabSixteenResult.Slant || item.Result== EOneGrabSixteenResult.LocationOkScanBarcodeFail) - // { - // bool exit = false; - // while (!exit) - // { - // //凡是定位失败的,需要定位重拍 - // ProductLocationResult vr = FixedGrabProductFlow.Instance.Grab(ETrayType.Input, item.SlotIndex); - // if (vr.Result == EOneGrabSixteenResult.Ok)//拍照OK - // { - // item.Change(vr.SN, vr.OffsetX, vr.OffsetY); - // exit = true; - // } - // else if (vr.Result == EOneGrabSixteenResult.Slant)//拍照失败 - // { - // //报警弹框 - // EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip| EButtonType.Retry, $"穴位{item.SlotIndex}定位失败,请把产品手动取走后点击跳过"); - // if (buttonSelect == EButtonType.Skip) - // { - // GlobalTray.InputTray.ChangeStatus(item.SlotIndex, ESlotStatus.NotHave); - // exit = true; - // } - // } - // else if (vr.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)//定位成功,拍照失败 - // { - // //这里需要把产品取到拍照NG料盘中 - // //取料 - // Nozzle idleNozzle = NozzleManager.GetIdelNozzle(); - // StockTakeFlow.Instance.Take(item.SlotIndex, idleNozzle.NozzleIndex); - // //放料 - // TraySlot noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave); - // if (noProductSlot != null) - // { - // StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex); - // } - // else - // { - // Msgbox.ShowDialog(EButtonType.Ok, "Retest料盘已放满,请更换料盘,更换完成后点击确定"); - // GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave); - // ThreePointLocationFlow.Instance.Location(ETrayType.ReTest); - // //放料 - // noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave); - // StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex); - // } - // exit = true; - // } - // } - - // } - //} - //对结果进行处理 - flowStep = EDischargeFlowStep.料仓取料; - } } - break; case EDischargeFlowStep.料仓取料: ProductLocationResult ret = productLocationResult.Where(r => r.SlotIndex == takeSlotIndex).FirstOrDefault(); @@ -720,10 +678,19 @@ namespace Rs.MotionPlat.Flow //{ // DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock); //} - DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); - TakeTrayFlow.Instance.Take(ETrayType.Empty, ETrayType.Ok, true, true); - GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); - ThreePointLocationFlow.Instance.Location(ETrayType.Ok); + if(GlobalVar.RunSpace&& !GlobalVar.EnableStock) + { + GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); + ThreePointLocationFlow.Instance.Location(ETrayType.Ok); + } + else + { + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); + TakeTrayFlow.Instance.Take(ETrayType.Empty, ETrayType.Ok, true, true); + GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); + ThreePointLocationFlow.Instance.Location(ETrayType.Ok); + } + //料盘已满 } } @@ -768,10 +735,18 @@ namespace Rs.MotionPlat.Flow } else { - //提示更换料盘 - Msgbox.ShowTipDialog(EButtonType.Ok, "NG tray full,please change tray and click ok button", "tip", true); - ThreePointLocationFlow.Instance.Location(ETrayType.Ng); - GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave); + if (GlobalVar.RunSpace && !GlobalVar.EnableStock) + { + GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave); + } + else + { + //提示更换料盘 + Msgbox.ShowTipDialog(EButtonType.Ok, "NG tray full,please change tray and click ok button", "tip", true); + ThreePointLocationFlow.Instance.Location(ETrayType.Ng); + GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave); + } + } } } diff --git a/Rs.DeweyTester/SysConfig/CommonConfig.Designer.cs b/Rs.DeweyTester/SysConfig/CommonConfig.Designer.cs index 2354fd6..128b844 100644 --- a/Rs.DeweyTester/SysConfig/CommonConfig.Designer.cs +++ b/Rs.DeweyTester/SysConfig/CommonConfig.Designer.cs @@ -39,6 +39,7 @@ this.cboxVirtualAxis = new System.Windows.Forms.CheckBox(); this.cboxCheckSafeEnable = new System.Windows.Forms.CheckBox(); this.cboxEnableIndexTimeStatistics = new System.Windows.Forms.CheckBox(); + this.cboxEnableStock = new System.Windows.Forms.CheckBox(); this.cboxRunSpace = new System.Windows.Forms.CheckBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.btnSaveRelCategory = new System.Windows.Forms.Button(); @@ -149,6 +150,7 @@ this.groupBox8.Controls.Add(this.cboxVirtualAxis); this.groupBox8.Controls.Add(this.cboxCheckSafeEnable); this.groupBox8.Controls.Add(this.cboxEnableIndexTimeStatistics); + this.groupBox8.Controls.Add(this.cboxEnableStock); this.groupBox8.Controls.Add(this.cboxRunSpace); resources.ApplyResources(this.groupBox8, "groupBox8"); this.groupBox8.ForeColor = System.Drawing.Color.White; @@ -215,6 +217,13 @@ this.cboxEnableIndexTimeStatistics.UseVisualStyleBackColor = true; this.cboxEnableIndexTimeStatistics.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged); // + // cboxEnableStock + // + resources.ApplyResources(this.cboxEnableStock, "cboxEnableStock"); + this.cboxEnableStock.Name = "cboxEnableStock"; + this.cboxEnableStock.UseVisualStyleBackColor = true; + this.cboxEnableStock.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged); + // // cboxRunSpace // resources.ApplyResources(this.cboxRunSpace, "cboxRunSpace"); @@ -934,5 +943,6 @@ private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button btnSaveRelCategory; + private System.Windows.Forms.CheckBox cboxEnableStock; } } \ No newline at end of file diff --git a/Rs.DeweyTester/SysConfig/CommonConfig.cs b/Rs.DeweyTester/SysConfig/CommonConfig.cs index 5d1478a..768880e 100644 --- a/Rs.DeweyTester/SysConfig/CommonConfig.cs +++ b/Rs.DeweyTester/SysConfig/CommonConfig.cs @@ -94,7 +94,7 @@ namespace Rs.MotionPlat.SysConfig PositionHelper.BindPosition(groupBox8); if(GlobalUser.IsVender() || GlobalUser.IsSuper()) { - cboxRunSpace.Visible = cboxVirtualAxis.Visible = cboxEnableVirtuleBarCode.Visible = cboxInputTrayLoop.Visible = cboxCheckSafeEnable.Visible = cboxEnableIndexTimeStatistics.Visible = true; + cboxEnableStock.Visible = cboxRunSpace.Visible = cboxVirtualAxis.Visible = cboxEnableVirtuleBarCode.Visible = cboxInputTrayLoop.Visible = cboxCheckSafeEnable.Visible = cboxEnableIndexTimeStatistics.Visible = true; } dataGridView1.AutoGenerateColumns = false; BindMenu(); diff --git a/Rs.DeweyTester/SysConfig/CommonConfig.resx b/Rs.DeweyTester/SysConfig/CommonConfig.resx index 83c8feb..fbcd482 100644 --- a/Rs.DeweyTester/SysConfig/CommonConfig.resx +++ b/Rs.DeweyTester/SysConfig/CommonConfig.resx @@ -384,6 +384,39 @@ 7 + + True + + + NoControl + + + 174, 224 + + + 96, 16 + + + 8 + + + 是否启用料仓 + + + False + + + cboxEnableStock + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 8 + True @@ -415,7 +448,7 @@ groupBox8 - 8 + 9 Fill @@ -2686,6 +2719,6 @@ CommonConfig - Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=1.20.24.9, Culture=neutral, PublicKeyToken=null + Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=1.20.24.10, Culture=neutral, PublicKeyToken=null \ No newline at end of file