diff --git a/Rs.DeweyTester/Controls/UFixture.cs b/Rs.DeweyTester/Controls/UFixture.cs index 7611713..66e116d 100644 --- a/Rs.DeweyTester/Controls/UFixture.cs +++ b/Rs.DeweyTester/Controls/UFixture.cs @@ -201,7 +201,7 @@ namespace Rs.MotionPlat private void btnReset_Click(object sender, EventArgs e) { - TestFixtureManager.Instance.GetTestFixture(int.Parse(lblIndex.Text)).Home(); + TestFixtureManager.Instance.GetTestFixture(3).Home(); } } } diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index 90bd782..256274d 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -156,9 +156,17 @@ namespace Rs.MotionPlat.Flow int idelNozzleNum = NozzleManager.GetIdleNozzleCount(); if (idelNozzleNum == 1 || GlobalVar.Clear) { - logInfo = GetClassName() + $"空闲吸嘴的数量为{idelNozzleNum},没有空闲的吸嘴了,去治具换料"; - MessageQueue.Instance.Insert(logInfo); - flowStep = EDischargeFlowStep.到治具取料等待位; + if(TestFixtureManager.Instance.GetHasProuctFixtureCount()>0 || NozzleManager.GetToTestNozzle()!=null) + { + logInfo = GetClassName() + $"空闲吸嘴的数量为{idelNozzleNum},没有空闲的吸嘴了,去治具换料"; + MessageQueue.Instance.Insert(logInfo); + flowStep = EDischargeFlowStep.到治具取料等待位; + } + else + { + flowStep = EDischargeFlowStep.工作完成到安全位; + } + //flowStep = EDischargeFlowStep.判断是否需要放料到料仓; //NozzleManager.GetNozzle(1).VacSuction(EIoOperate.Close); @@ -227,7 +235,7 @@ namespace Rs.MotionPlat.Flow } break; case EDischargeFlowStep.进料盘产品定位: - ProductLocationFlow.Instance.Grab(takeSlotIndex); + ProductLocationFlow.Instance.Grab( ETrayType.Input, takeSlotIndex); productLocationResult = OneGrabSixteenManager.Instance.GetResults(); if(productLocationResult != null) { @@ -302,14 +310,14 @@ namespace Rs.MotionPlat.Flow while (!exit) { ProductLocationResult fixtureret = FixedGrabProductFlow.Instance.Grab(ETrayType.Input, ret.SlotIndex); - if (ret.Result == EOneGrabSixteenResult.Ok) + if (fixtureret.Result == EOneGrabSixteenResult.Ok) { ret.Change(fixtureret.SN, fixtureret.OffsetX, fixtureret.OffsetY); takeSlotIndex++; flowStep = EDischargeFlowStep.判断是否需要从料仓取料; exit = true; } - else if (ret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail) + else if (fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail) { Nozzle idleNozzle = NozzleManager.GetIdelNozzle(); StockTakeFlow.Instance.Take(ret.SlotIndex, idleNozzle.NozzleIndex); @@ -332,13 +340,16 @@ namespace Rs.MotionPlat.Flow flowStep = EDischargeFlowStep.判断是否需要从料仓取料; exit = true; } - else if (ret.Result == EOneGrabSixteenResult.Slant) + else if (fixtureret.Result == EOneGrabSixteenResult.Slant) { //报警弹框 EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, $"穴位{ret.SlotIndex}定位失败,请把产品手动取走后点击跳过"); if (buttonSelect == EButtonType.Skip) { + exit = true; GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave); + takeSlotIndex++; + flowStep = EDischargeFlowStep.判断是否需要从料仓取料; } else if (buttonSelect == EButtonType.EndInput) { diff --git a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs index c9b61ef..83778b4 100644 --- a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs @@ -43,7 +43,7 @@ namespace Rs.MotionPlat.Flow.SubFlow } } - public void Grab(int slotIndex) + public void Grab(ETrayType trayType, int slotIndex) { if (finished) finished = false; @@ -60,11 +60,22 @@ namespace Rs.MotionPlat.Flow.SubFlow { case EProductLocationFlowStep.到料仓拍照起始位: //grabEndSlot = GlobalTray.InputTray.GetSlot(ESlotStatus.Have); - grabEndSlot = GlobalTray.InputTray.GetSlot(slotIndex); - grabStartSlot = GlobalTray.InputTray.GetSlot(grabEndSlot.Index + 15); + if(trayType== ETrayType.Grr) + { + grabEndSlot = GlobalTray.InputTray.GetSlot(slotIndex); + grabStartSlot = GlobalTray.InputTray.GetSlot(grabEndSlot.Index + 15); + } + else if(trayType== ETrayType.Input) + { + grabEndSlot = GlobalTray.InputTray.GetSlot(slotIndex); + grabStartSlot = GlobalTray.InputTray.GetSlot(grabEndSlot.Index + 15); + } + //grabEndSlot = GlobalTray.InputTray.GetSlot(slotIndex); + //grabStartSlot = GlobalTray.InputTray.GetSlot(grabEndSlot.Index + 15); if (grabEndSlot != null && grabStartSlot != null) { - SlotPoint sp = TrayPointManager.GetSlotPoint(ETrayType.Input, grabStartSlot.Index); + //SlotPoint sp = TrayPointManager.GetSlotPoint(ETrayType.Input, grabStartSlot.Index); + SlotPoint sp = TrayPointManager.GetSlotPoint(trayType, grabStartSlot.Index); if (sp != null) { targetPosition.X = sp.X; @@ -106,7 +117,8 @@ namespace Rs.MotionPlat.Flow.SubFlow case EProductLocationFlowStep.到料仓拍照结束位: if (grabEndSlot != null) { - SlotPoint sp = TrayPointManager.GetSlotPoint(ETrayType.Input, grabEndSlot.Index); + //SlotPoint sp = TrayPointManager.GetSlotPoint(ETrayType.Input, grabEndSlot.Index); + SlotPoint sp = TrayPointManager.GetSlotPoint(trayType, grabEndSlot.Index); if (sp != null) { VisionHelper.loadTakeProductVision.ClearQueue(); diff --git a/Rs.DeweyTester/SysConfig/CommonConfig.cs b/Rs.DeweyTester/SysConfig/CommonConfig.cs index aa68745..2ea3f9f 100644 --- a/Rs.DeweyTester/SysConfig/CommonConfig.cs +++ b/Rs.DeweyTester/SysConfig/CommonConfig.cs @@ -162,11 +162,11 @@ namespace Rs.MotionPlat.SysConfig if (txt.Name == "txtGrrProductNum" && cboxGRR.Checked) { - GlobalTray.GrrTray.ChangeStatus(ESlotStatus.NotHave); - for (int i = 1; i <= GlobalVar.GrrProductNum; i++) - { - GlobalTray.GrrTray.ChangeStatus(i, ESlotStatus.Have); - } + //GlobalTray.GrrTray.ChangeStatus(ESlotStatus.NotHave); + //for (int i = 1; i <= GlobalVar.GrrProductNum; i++) + //{ + // GlobalTray.GrrTray.ChangeStatus(i, ESlotStatus.Have); + //} } } } diff --git a/Rs.DeweyTester/TestFrm.Designer.cs b/Rs.DeweyTester/TestFrm.Designer.cs index 11e269c..e71f8c3 100644 --- a/Rs.DeweyTester/TestFrm.Designer.cs +++ b/Rs.DeweyTester/TestFrm.Designer.cs @@ -42,6 +42,25 @@ this.button9 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.radioButton4 = new System.Windows.Forms.RadioButton(); + this.radioButton5 = new System.Windows.Forms.RadioButton(); + this.radioButton6 = new System.Windows.Forms.RadioButton(); + this.radioButton7 = new System.Windows.Forms.RadioButton(); + this.radioButton8 = new System.Windows.Forms.RadioButton(); + this.radioButton9 = new System.Windows.Forms.RadioButton(); + this.radioButton10 = new System.Windows.Forms.RadioButton(); + this.radioButton11 = new System.Windows.Forms.RadioButton(); + this.radioButton12 = new System.Windows.Forms.RadioButton(); + this.radioButton13 = new System.Windows.Forms.RadioButton(); + this.radioButton14 = new System.Windows.Forms.RadioButton(); + this.radioButton15 = new System.Windows.Forms.RadioButton(); + this.radioButton16 = new System.Windows.Forms.RadioButton(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // button7 @@ -181,11 +200,242 @@ this.button12.UseVisualStyleBackColor = true; this.button12.Click += new System.EventHandler(this.button12_Click); // + // button13 + // + this.button13.ForeColor = System.Drawing.Color.Black; + this.button13.Location = new System.Drawing.Point(71, 119); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(191, 47); + this.button13.TabIndex = 28; + this.button13.Text = "飞拍整盘验证"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.radioButton16); + this.groupBox1.Controls.Add(this.radioButton6); + this.groupBox1.Controls.Add(this.radioButton15); + this.groupBox1.Controls.Add(this.radioButton5); + this.groupBox1.Controls.Add(this.radioButton14); + this.groupBox1.Controls.Add(this.radioButton3); + this.groupBox1.Controls.Add(this.radioButton13); + this.groupBox1.Controls.Add(this.radioButton8); + this.groupBox1.Controls.Add(this.radioButton12); + this.groupBox1.Controls.Add(this.radioButton4); + this.groupBox1.Controls.Add(this.radioButton11); + this.groupBox1.Controls.Add(this.radioButton7); + this.groupBox1.Controls.Add(this.radioButton10); + this.groupBox1.Controls.Add(this.radioButton2); + this.groupBox1.Controls.Add(this.radioButton9); + this.groupBox1.Controls.Add(this.radioButton1); + this.groupBox1.Controls.Add(this.button13); + this.groupBox1.ForeColor = System.Drawing.Color.White; + this.groupBox1.Location = new System.Drawing.Point(82, 599); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(336, 187); + this.groupBox1.TabIndex = 31; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "飞拍"; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.ForeColor = System.Drawing.Color.White; + this.radioButton1.Location = new System.Drawing.Point(22, 33); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(29, 16); + this.radioButton1.TabIndex = 29; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "1"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.ForeColor = System.Drawing.Color.White; + this.radioButton2.Location = new System.Drawing.Point(57, 33); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(29, 16); + this.radioButton2.TabIndex = 29; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "2"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.ForeColor = System.Drawing.Color.White; + this.radioButton3.Location = new System.Drawing.Point(92, 33); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(29, 16); + this.radioButton3.TabIndex = 29; + this.radioButton3.TabStop = true; + this.radioButton3.Text = "3"; + this.radioButton3.UseVisualStyleBackColor = true; + // + // radioButton4 + // + this.radioButton4.AutoSize = true; + this.radioButton4.ForeColor = System.Drawing.Color.White; + this.radioButton4.Location = new System.Drawing.Point(126, 33); + this.radioButton4.Name = "radioButton4"; + this.radioButton4.Size = new System.Drawing.Size(29, 16); + this.radioButton4.TabIndex = 29; + this.radioButton4.TabStop = true; + this.radioButton4.Text = "4"; + this.radioButton4.UseVisualStyleBackColor = true; + // + // radioButton5 + // + this.radioButton5.AutoSize = true; + this.radioButton5.ForeColor = System.Drawing.Color.White; + this.radioButton5.Location = new System.Drawing.Point(161, 33); + this.radioButton5.Name = "radioButton5"; + this.radioButton5.Size = new System.Drawing.Size(29, 16); + this.radioButton5.TabIndex = 29; + this.radioButton5.TabStop = true; + this.radioButton5.Text = "5"; + this.radioButton5.UseVisualStyleBackColor = true; + // + // radioButton6 + // + this.radioButton6.AutoSize = true; + this.radioButton6.ForeColor = System.Drawing.Color.White; + this.radioButton6.Location = new System.Drawing.Point(196, 33); + this.radioButton6.Name = "radioButton6"; + this.radioButton6.Size = new System.Drawing.Size(29, 16); + this.radioButton6.TabIndex = 29; + this.radioButton6.TabStop = true; + this.radioButton6.Text = "6"; + this.radioButton6.UseVisualStyleBackColor = true; + // + // radioButton7 + // + this.radioButton7.AutoSize = true; + this.radioButton7.ForeColor = System.Drawing.Color.White; + this.radioButton7.Location = new System.Drawing.Point(233, 33); + this.radioButton7.Name = "radioButton7"; + this.radioButton7.Size = new System.Drawing.Size(29, 16); + this.radioButton7.TabIndex = 29; + this.radioButton7.TabStop = true; + this.radioButton7.Text = "7"; + this.radioButton7.UseVisualStyleBackColor = true; + // + // radioButton8 + // + this.radioButton8.AutoSize = true; + this.radioButton8.ForeColor = System.Drawing.Color.White; + this.radioButton8.Location = new System.Drawing.Point(268, 33); + this.radioButton8.Name = "radioButton8"; + this.radioButton8.Size = new System.Drawing.Size(29, 16); + this.radioButton8.TabIndex = 29; + this.radioButton8.TabStop = true; + this.radioButton8.Text = "8"; + this.radioButton8.UseVisualStyleBackColor = true; + // + // radioButton9 + // + this.radioButton9.AutoSize = true; + this.radioButton9.ForeColor = System.Drawing.Color.White; + this.radioButton9.Location = new System.Drawing.Point(22, 76); + this.radioButton9.Name = "radioButton9"; + this.radioButton9.Size = new System.Drawing.Size(29, 16); + this.radioButton9.TabIndex = 29; + this.radioButton9.TabStop = true; + this.radioButton9.Text = "9"; + this.radioButton9.UseVisualStyleBackColor = true; + // + // radioButton10 + // + this.radioButton10.AutoSize = true; + this.radioButton10.ForeColor = System.Drawing.Color.White; + this.radioButton10.Location = new System.Drawing.Point(57, 76); + this.radioButton10.Name = "radioButton10"; + this.radioButton10.Size = new System.Drawing.Size(35, 16); + this.radioButton10.TabIndex = 29; + this.radioButton10.TabStop = true; + this.radioButton10.Text = "10"; + this.radioButton10.UseVisualStyleBackColor = true; + // + // radioButton11 + // + this.radioButton11.AutoSize = true; + this.radioButton11.ForeColor = System.Drawing.Color.White; + this.radioButton11.Location = new System.Drawing.Point(233, 76); + this.radioButton11.Name = "radioButton11"; + this.radioButton11.Size = new System.Drawing.Size(35, 16); + this.radioButton11.TabIndex = 29; + this.radioButton11.TabStop = true; + this.radioButton11.Text = "15"; + this.radioButton11.UseVisualStyleBackColor = true; + // + // radioButton12 + // + this.radioButton12.AutoSize = true; + this.radioButton12.ForeColor = System.Drawing.Color.White; + this.radioButton12.Location = new System.Drawing.Point(126, 76); + this.radioButton12.Name = "radioButton12"; + this.radioButton12.Size = new System.Drawing.Size(35, 16); + this.radioButton12.TabIndex = 29; + this.radioButton12.TabStop = true; + this.radioButton12.Text = "12"; + this.radioButton12.UseVisualStyleBackColor = true; + // + // radioButton13 + // + this.radioButton13.AutoSize = true; + this.radioButton13.ForeColor = System.Drawing.Color.White; + this.radioButton13.Location = new System.Drawing.Point(268, 76); + this.radioButton13.Name = "radioButton13"; + this.radioButton13.Size = new System.Drawing.Size(35, 16); + this.radioButton13.TabIndex = 29; + this.radioButton13.TabStop = true; + this.radioButton13.Text = "16"; + this.radioButton13.UseVisualStyleBackColor = true; + // + // radioButton14 + // + this.radioButton14.AutoSize = true; + this.radioButton14.ForeColor = System.Drawing.Color.White; + this.radioButton14.Location = new System.Drawing.Point(92, 76); + this.radioButton14.Name = "radioButton14"; + this.radioButton14.Size = new System.Drawing.Size(35, 16); + this.radioButton14.TabIndex = 29; + this.radioButton14.TabStop = true; + this.radioButton14.Text = "11"; + this.radioButton14.UseVisualStyleBackColor = true; + // + // radioButton15 + // + this.radioButton15.AutoSize = true; + this.radioButton15.ForeColor = System.Drawing.Color.White; + this.radioButton15.Location = new System.Drawing.Point(161, 76); + this.radioButton15.Name = "radioButton15"; + this.radioButton15.Size = new System.Drawing.Size(35, 16); + this.radioButton15.TabIndex = 29; + this.radioButton15.TabStop = true; + this.radioButton15.Text = "13"; + this.radioButton15.UseVisualStyleBackColor = true; + // + // radioButton16 + // + this.radioButton16.AutoSize = true; + this.radioButton16.ForeColor = System.Drawing.Color.White; + this.radioButton16.Location = new System.Drawing.Point(196, 76); + this.radioButton16.Name = "radioButton16"; + this.radioButton16.Size = new System.Drawing.Size(35, 16); + this.radioButton16.TabIndex = 29; + this.radioButton16.TabStop = true; + this.radioButton16.Text = "14"; + this.radioButton16.UseVisualStyleBackColor = true; + // // 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.groupBox1); this.Controls.Add(this.button12); this.Controls.Add(this.button11); this.Controls.Add(this.button9); @@ -202,6 +452,8 @@ this.Controls.Add(this.button7); this.Name = "TestFrm"; this.Text = "TestFrm"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); } @@ -221,5 +473,23 @@ private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.RadioButton radioButton16; + private System.Windows.Forms.RadioButton radioButton6; + private System.Windows.Forms.RadioButton radioButton15; + private System.Windows.Forms.RadioButton radioButton5; + private System.Windows.Forms.RadioButton radioButton14; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton13; + private System.Windows.Forms.RadioButton radioButton8; + private System.Windows.Forms.RadioButton radioButton12; + private System.Windows.Forms.RadioButton radioButton4; + private System.Windows.Forms.RadioButton radioButton11; + private System.Windows.Forms.RadioButton radioButton7; + private System.Windows.Forms.RadioButton radioButton10; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton9; + private System.Windows.Forms.RadioButton radioButton1; } } \ No newline at end of file diff --git a/Rs.DeweyTester/TestFrm.cs b/Rs.DeweyTester/TestFrm.cs index 322f0d8..87edcda 100644 --- a/Rs.DeweyTester/TestFrm.cs +++ b/Rs.DeweyTester/TestFrm.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.IO.Ports; using System.Linq; using System.Text; @@ -287,5 +288,35 @@ namespace Rs.MotionPlat }); } + + private void button13_Click(object sender, EventArgs e) + { + Task.Run(() => { + + foreach (Control item in groupBox1.Controls) + { + if(item is RadioButton) + { + if(((RadioButton)item).Checked) + { + int index = (int.Parse(item.Text)-1)*16+1; + ProductLocationFlow.Instance.Grab(ETrayType.Grr, index); + ProductLocationResult[] productLocationResult = OneGrabSixteenManager.Instance.GetResults(); + if (productLocationResult != null) + { + //foreach (ProductLocationResult item in productLocationResult) + //{ + // string msg = $"{item.SlotIndex},{item.Result}\r\n"; + // File.AppendAllText("d://flyresult.csv", msg); + //} + } + break; + } + + } + } + + }); + } } }