优化扫码逻辑

master
lhiven 1 year ago
parent 3930298eca
commit ba89149653

@ -719,5 +719,38 @@ namespace Rs.Framework
return SysConfigParam.GetValue<double>(nameof(TestFixtureTrayTestHeightOffsetX));
}
}
/// <summary>
/// 料仓Tray盘取放料偏移X
/// </summary>
public static double StockTrayOffsetX
{
get
{
return SysConfigParam.GetValue<double>(nameof(StockTrayOffsetX));
}
}
/// <summary>
/// 料仓Tray盘取放料偏移Y
/// </summary>
public static double StockTrayOffsetY
{
get
{
return SysConfigParam.GetValue<double>(nameof(StockTrayOffsetY));
}
}
/// <summary>
/// 周转盘是否复检
/// </summary>
public static bool EnableTurnoverTrayRecheck
{
get
{
return SysConfigParam.GetValue<bool>(nameof(EnableTurnoverTrayRecheck));
}
}
}
}

@ -208,40 +208,57 @@ namespace Rs.MotionPlat.Flow.Camera
HOperatorSet.ReduceDomain(image, upCameraScanBarCodeModel.SearchRegion, out searchImg);
else
searchImg = image;
HOperatorSet.GetShapeModelContours(out HObject modelContours, upCameraScanBarCodeModel.ModelID, 1);
HOperatorSet.FindShapeModel(searchImg, upCameraScanBarCodeModel.ModelID,
AngleTool.Deg2Rad(double.Parse(upCameraScanBarCodeModel.AngleStart)),
AngleTool.Deg2Rad(Math.Abs((double.Parse(upCameraScanBarCodeModel.AngleExtent) - double.Parse(upCameraScanBarCodeModel.AngleStart)))),
new HTuple(double.Parse(upCameraScanBarCodeModel.Score)),
1,
0.5,
"least_squares",
0,
0.9,
out HTuple row, out HTuple column, out HTuple angle, out HTuple score);
if (score.Length > 0)
if(GlobalVar.EnableTurnoverTrayRecheck)
{
vr.OffsetX = (column.D-upCameraScanBarCodeModel.ModelMatchResult[1].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetY =-1 * (row.D- upCameraScanBarCodeModel.ModelMatchResult[0].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetR = AngleTool.Rad2Deg((angle.D - upCameraScanBarCodeModel.ModelMatchResult[2].D));
vr.SourceImage = image;
if(vr.OffsetX<GlobalVar.TurnoverTrayLocateXRange && vr.OffsetY<GlobalVar.TurnoverTrayLocateYRange && vr.OffsetR<GlobalVar.TurnoverTrayLocateRRange)
HOperatorSet.GetShapeModelContours(out HObject modelContours, upCameraScanBarCodeModel.ModelID, 1);
HOperatorSet.FindShapeModel(searchImg, upCameraScanBarCodeModel.ModelID,
AngleTool.Deg2Rad(double.Parse(upCameraScanBarCodeModel.AngleStart)),
AngleTool.Deg2Rad(Math.Abs((double.Parse(upCameraScanBarCodeModel.AngleExtent) - double.Parse(upCameraScanBarCodeModel.AngleStart)))),
new HTuple(double.Parse(upCameraScanBarCodeModel.Score)),
1,
0.5,
"least_squares",
0,
0.9,
out HTuple row, out HTuple column, out HTuple angle, out HTuple score);
if (score.Length > 0)
{
vr.SearchModelOK = true;
//只有定位成功的才去扫二维码
string sn = FindCode(image, upCameraScanBarCodeModel.BarCodeRegion);
if(string.IsNullOrEmpty(sn))
vr.OffsetX = (column.D - upCameraScanBarCodeModel.ModelMatchResult[1].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetY = -1 * (row.D - upCameraScanBarCodeModel.ModelMatchResult[0].D) * GlobalVar.UpCameraMmPerPixel;
vr.OffsetR = AngleTool.Rad2Deg((angle.D - upCameraScanBarCodeModel.ModelMatchResult[2].D));
vr.SourceImage = image;
if (vr.OffsetX < GlobalVar.TurnoverTrayLocateXRange && vr.OffsetY < GlobalVar.TurnoverTrayLocateYRange && vr.OffsetR < GlobalVar.TurnoverTrayLocateRRange)
{
vr.ScanBarCodeOK = false;
vr.SearchModelOK = true;
}
else
{
vr.SN = sn;
vr.SearchModelOK = false;
}
}
}
else
{
vr.SearchModelOK = true;
}
//只有定位成功的才去扫二维码
if (vr.SearchModelOK && !GlobalVar.EnableScanBarCodeByDownCamera)
{
string sn = FindCode(image, upCameraScanBarCodeModel.BarCodeRegion);
if (string.IsNullOrEmpty(sn))
{
vr.ScanBarCodeOK = false;
}
else
{
vr.SearchModelOK = false;
if(!Directory.Exists($"d://images/{DateTime.Now.ToString("yyyyMMdd")}"))
{
Directory.CreateDirectory($"d://images/{DateTime.Now.ToString("yyyyMMdd")}");
}
HOperatorSet.WriteImage(image, "bmp", 0, $"d://images/{DateTime.Now.ToString("yyyyMMdd")}//{sn}");
vr.ScanBarCodeOK = true;
vr.SN = sn;
}
}
return vr;
@ -264,7 +281,7 @@ namespace Rs.MotionPlat.Flow.Camera
{
// HOperatorSet.GenRectangle1(out HObject searchRegion, new HTuple(1533), new HTuple(731), new HTuple(1751), new HTuple(1071));
//HOperatorSet.GenRectangle1(out HObject searchRegion,row1, col1, row2, col2);
HOperatorSet.WriteImage(images, "bmp", 0, "d://images//temp");
HOperatorSet.ReduceDomain(images, _barCodeRegion, out HObject imgReduaced);
//HOperatorSet.CropDomain(imgReduaced, out HObject imagePart);
//HOperatorSet.WriteImage(imagePart, "bmp", 0, "d://images/11");
@ -286,7 +303,7 @@ namespace Rs.MotionPlat.Flow.Camera
HTuple decodedDataStrings = "";
HObject xlds = new HObject();
string[] modes = new string[] { "standard_recognition", "enhanced_recognition", "maximum_recognition" };
string[] modes = new string[] { "enhanced_recognition", "maximum_recognition" };
foreach (string mode in modes)
{
HOperatorSet.CreateDataCode2dModel("Data Matrix ECC 200", "default_parameters", mode, out HTuple dataCodeHandle);
@ -305,6 +322,7 @@ namespace Rs.MotionPlat.Flow.Camera
}
}
}
return "";
}
//else

@ -929,17 +929,13 @@ namespace Rs.MotionPlat.Flow
//如果吸嘴是1并且最后一列
downSlot = GlobalTray.MultiTray.GetSlot(ESlotStatus.NotHave);
#region 为了解决第一个吸嘴到不了最后两列的问题,新的料盘已经不存在这个问题
//if(curNozzle.NozzleIndex==1 && downSlot!= null && (downSlot.Column==0 || downSlot.Column==1))
//{
// if(downSlot.Column==0)
// {
// downSlot = GlobalTray.MultiTray.GetSlot(downSlot.Index+2);
// }
// else if(downSlot.Column==1)
// {
// downSlot = GlobalTray.MultiTray.GetSlot(downSlot.Index+1);
// }
//}
if (curNozzle.NozzleIndex == 1 && downSlot != null && (downSlot.Column == 0))
{
if (downSlot.Column == 0)
{
downSlot = GlobalTray.MultiTray.GetSlot(downSlot.Index + 1);
}
}
#endregion
if (downSlot != null)
{
@ -1464,19 +1460,19 @@ namespace Rs.MotionPlat.Flow
{
if(GlobalVar.RunSpace)
{
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, VirtualBarCode.Code);
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex-1, VirtualBarCode.Code);
}
else
{
if(vr.ScanBarCodeOK)
{
//复制二维码
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, vr.SN);
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex-1, vr.SN);
}
else
{
//复制二维码
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, "");
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex-1, "");
}
}
}
@ -1501,14 +1497,34 @@ namespace Rs.MotionPlat.Flow
{
if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
{
if (vr.SearchModelOK && vr.OffsetX < 0.5 && vr.OffsetY < 0.5 && vr.OffsetR < 5)//定位成功
if (vr.SearchModelOK)//定位成功
{
if (vr.ScanBarCodeOK)
if (!GlobalVar.EnableScanBarCodeByDownCamera)
{
//复制二维码
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, vr.SN);
if (GlobalVar.RunSpace)
{
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex-1, VirtualBarCode.Code);
}
else
{
if (vr.ScanBarCodeOK)
{
//复制二维码
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex- 1, vr.SN);
}
else
{
//复制二维码
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex-1, "");
}
}
}
}
else
{
//定位失败,或者超出指定范围
}
}
}
OnUpCameraGrabResult?.Invoke(result);

@ -6,6 +6,7 @@ using Rs.MotionPlat.Flow.Space;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
@ -68,6 +69,8 @@ namespace Rs.MotionPlat.Flow
private ETrayType m_fromTray = ETrayType.Empty2;
private ETrayType m_toTray = ETrayType.Ok;
private bool finisehd = true;
double targetX = 0.0;
double targetY = 0.0;
/// <summary>
/// 料盘搬运
/// </summary>
@ -96,14 +99,16 @@ namespace Rs.MotionPlat.Flow
switch (step)
{
case ETakeTrayFlowStep.:
double centerX = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterX");
double centerY = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterY");
double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(centerX + cameraCenterX, GlobalVar.TakeTraySpeed);
//double centerX = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterX");
//double centerY = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterY");
//double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
//double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayY");
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(targetX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
errCode = AxisControl.LoadY.MovePos(centerY + cameraCenterY, GlobalVar.TakeTraySpeed);
errCode = AxisControl.LoadY.MovePos(targetY, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
@ -232,15 +237,18 @@ namespace Rs.MotionPlat.Flow
//{
// Thread.Sleep(2000);
//}
centerX = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterX");
centerY = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterY");
//centerX = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterX");
//centerY = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterY");
cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
errCode = AxisControl.LoadX.MovePos(centerX + cameraCenterX, GlobalVar.TakeTraySpeed);
//cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
//cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayY");
errCode = AxisControl.LoadX.MovePos(targetX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
errCode = AxisControl.LoadY.MovePos(centerY + cameraCenterY - 2, GlobalVar.TakeTraySpeed);
errCode = AxisControl.LoadY.MovePos(targetY - 2, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)

@ -229,15 +229,21 @@ namespace Rs.MotionPlat.Flow.SubFlow
int slotIndex = 0;
foreach (var img in grabImages)
{
VisionResult vr = VisionManager.TurnoverTrayDumpProductOK(img);
if(!isReverse)
int sIndex = 0;
if (!isReverse)
{
vr.SlotIndex = startSlotIndex + slotIndex;
sIndex = startSlotIndex + slotIndex;
}
else
{
vr.SlotIndex = startSlotIndex - slotIndex;
sIndex = startSlotIndex - slotIndex;
}
VisionResult vr = new VisionResult();
if (TurnoverTrayManager.Instance.Slot(sIndex).IsHasProduct)
{
vr = VisionManager.TurnoverTrayDumpProductOK(img);
}
vr.SlotIndex = sIndex;
vReslutList.Add(vr);
slotIndex++;
}

@ -122,17 +122,18 @@ namespace Rs.MotionPlat
}
if (hwin != null)
{
hwin.HobjectToHimage(matchResult.SourceImage);
if (matchResult.SearchModelOK)
{
//hwin.DispObj(matchResult.ContourXld, "green");
hwin.HobjectToHimage(matchResult.SourceImage);
HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, matchResult.SN, 20, 20, "green");
HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"x:{matchResult.OffsetX}", 200, 20, "green");
HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"y:{matchResult.OffsetY}", 400, 20, "green");
//HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"r:{matchResult.OffsetA}", 600, 20, "green");
HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"r:{matchResult.OffsetR}", 600, 20, "green");
}
else
{
hwin.ClearWindow();
HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "NG", 20, 20, "red");
}
}

@ -68,13 +68,17 @@
this.txtMark2CenterDistY = new System.Windows.Forms.TextBox();
this.txtMark2CenterDistX = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txttxtStockTrayOffsetY = new System.Windows.Forms.TextBox();
this.txtMarkY2 = new System.Windows.Forms.TextBox();
this.txtMarkY1 = new System.Windows.Forms.TextBox();
this.txtStockTrayOffsetX = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtMarkX2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.txtMarkX1 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
@ -338,13 +342,17 @@
this.groupBox1.Controls.Add(this.txtMark2CenterDistY);
this.groupBox1.Controls.Add(this.txtMark2CenterDistX);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txttxtStockTrayOffsetY);
this.groupBox1.Controls.Add(this.txtMarkY2);
this.groupBox1.Controls.Add(this.txtMarkY1);
this.groupBox1.Controls.Add(this.txtStockTrayOffsetX);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtMarkX2);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.txtMarkX1);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
@ -412,7 +420,7 @@
this.txtTeachMarkY2.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.txtTeachMarkY2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.txtTeachMarkY2.ForeColor = System.Drawing.Color.White;
this.txtTeachMarkY2.Location = new System.Drawing.Point(176, 113);
this.txtTeachMarkY2.Location = new System.Drawing.Point(344, 177);
this.txtTeachMarkY2.Name = "txtTeachMarkY2";
this.txtTeachMarkY2.Size = new System.Drawing.Size(79, 25);
this.txtTeachMarkY2.TabIndex = 51;
@ -428,7 +436,7 @@
this.btnTeachMarkY1.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnTeachMarkY1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnTeachMarkY1.ForeColor = System.Drawing.Color.White;
this.btnTeachMarkY1.Location = new System.Drawing.Point(176, 46);
this.btnTeachMarkY1.Location = new System.Drawing.Point(215, 46);
this.btnTeachMarkY1.Name = "btnTeachMarkY1";
this.btnTeachMarkY1.Size = new System.Drawing.Size(79, 25);
this.btnTeachMarkY1.TabIndex = 51;
@ -476,7 +484,7 @@
this.txtTeachMarkX2.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.txtTeachMarkX2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.txtTeachMarkX2.ForeColor = System.Drawing.Color.White;
this.txtTeachMarkX2.Location = new System.Drawing.Point(176, 82);
this.txtTeachMarkX2.Location = new System.Drawing.Point(344, 146);
this.txtTeachMarkX2.Name = "txtTeachMarkX2";
this.txtTeachMarkX2.Size = new System.Drawing.Size(79, 25);
this.txtTeachMarkX2.TabIndex = 52;
@ -492,7 +500,7 @@
this.btnTeachMarkX1.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnTeachMarkX1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnTeachMarkX1.ForeColor = System.Drawing.Color.White;
this.btnTeachMarkX1.Location = new System.Drawing.Point(176, 15);
this.btnTeachMarkX1.Location = new System.Drawing.Point(215, 15);
this.btnTeachMarkX1.Name = "btnTeachMarkX1";
this.btnTeachMarkX1.Size = new System.Drawing.Size(79, 25);
this.btnTeachMarkX1.TabIndex = 52;
@ -508,7 +516,7 @@
this.btnCreateMatrix.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnCreateMatrix.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCreateMatrix.ForeColor = System.Drawing.Color.White;
this.btnCreateMatrix.Location = new System.Drawing.Point(641, 173);
this.btnCreateMatrix.Location = new System.Drawing.Point(631, 172);
this.btnCreateMatrix.Name = "btnCreateMatrix";
this.btnCreateMatrix.Size = new System.Drawing.Size(133, 50);
this.btnCreateMatrix.TabIndex = 49;
@ -523,7 +531,7 @@
this.btnMoveMarkY2.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnMoveMarkY2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMoveMarkY2.ForeColor = System.Drawing.Color.White;
this.btnMoveMarkY2.Location = new System.Drawing.Point(285, 113);
this.btnMoveMarkY2.Location = new System.Drawing.Point(442, 179);
this.btnMoveMarkY2.Name = "btnMoveMarkY2";
this.btnMoveMarkY2.Size = new System.Drawing.Size(79, 25);
this.btnMoveMarkY2.TabIndex = 49;
@ -539,7 +547,7 @@
this.btnMoveMarkY1.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnMoveMarkY1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMoveMarkY1.ForeColor = System.Drawing.Color.White;
this.btnMoveMarkY1.Location = new System.Drawing.Point(285, 46);
this.btnMoveMarkY1.Location = new System.Drawing.Point(324, 46);
this.btnMoveMarkY1.Name = "btnMoveMarkY1";
this.btnMoveMarkY1.Size = new System.Drawing.Size(79, 25);
this.btnMoveMarkY1.TabIndex = 49;
@ -554,7 +562,7 @@
this.btnMoveMarkX2.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnMoveMarkX2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMoveMarkX2.ForeColor = System.Drawing.Color.White;
this.btnMoveMarkX2.Location = new System.Drawing.Point(285, 82);
this.btnMoveMarkX2.Location = new System.Drawing.Point(442, 148);
this.btnMoveMarkX2.Name = "btnMoveMarkX2";
this.btnMoveMarkX2.Size = new System.Drawing.Size(79, 25);
this.btnMoveMarkX2.TabIndex = 50;
@ -570,7 +578,7 @@
this.btnMoveMarkX1.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.btnMoveMarkX1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMoveMarkX1.ForeColor = System.Drawing.Color.White;
this.btnMoveMarkX1.Location = new System.Drawing.Point(285, 15);
this.btnMoveMarkX1.Location = new System.Drawing.Point(324, 15);
this.btnMoveMarkX1.Name = "btnMoveMarkX1";
this.btnMoveMarkX1.Size = new System.Drawing.Size(79, 25);
this.btnMoveMarkX1.TabIndex = 50;
@ -651,13 +659,28 @@
this.label4.TabIndex = 47;
this.label4.Text = "SlotOffsetY:";
//
// txttxtStockTrayOffsetY
//
this.txttxtStockTrayOffsetY.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.txttxtStockTrayOffsetY.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txttxtStockTrayOffsetY.Font = new System.Drawing.Font("宋体", 9F);
this.txttxtStockTrayOffsetY.ForeColor = System.Drawing.Color.White;
this.txttxtStockTrayOffsetY.Location = new System.Drawing.Point(106, 116);
this.txttxtStockTrayOffsetY.Name = "txttxtStockTrayOffsetY";
this.txttxtStockTrayOffsetY.Size = new System.Drawing.Size(85, 21);
this.txttxtStockTrayOffsetY.TabIndex = 53;
this.txttxtStockTrayOffsetY.Tag = "";
this.txttxtStockTrayOffsetY.Text = "0.01";
this.txttxtStockTrayOffsetY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txttxtStockTrayOffsetY.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtSysParam_KeyUp);
//
// txtMarkY2
//
this.txtMarkY2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.txtMarkY2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtMarkY2.Font = new System.Drawing.Font("宋体", 9F);
this.txtMarkY2.ForeColor = System.Drawing.Color.White;
this.txtMarkY2.Location = new System.Drawing.Point(67, 117);
this.txtMarkY2.Location = new System.Drawing.Point(235, 181);
this.txtMarkY2.Name = "txtMarkY2";
this.txtMarkY2.ReadOnly = true;
this.txtMarkY2.Size = new System.Drawing.Size(85, 21);
@ -673,7 +696,7 @@
this.txtMarkY1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtMarkY1.Font = new System.Drawing.Font("宋体", 9F);
this.txtMarkY1.ForeColor = System.Drawing.Color.White;
this.txtMarkY1.Location = new System.Drawing.Point(67, 50);
this.txtMarkY1.Location = new System.Drawing.Point(106, 50);
this.txtMarkY1.Name = "txtMarkY1";
this.txtMarkY1.ReadOnly = true;
this.txtMarkY1.Size = new System.Drawing.Size(85, 21);
@ -682,6 +705,21 @@
this.txtMarkY1.Text = "0.01";
this.txtMarkY1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtStockTrayOffsetX
//
this.txtStockTrayOffsetX.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.txtStockTrayOffsetX.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtStockTrayOffsetX.Font = new System.Drawing.Font("宋体", 9F);
this.txtStockTrayOffsetX.ForeColor = System.Drawing.Color.White;
this.txtStockTrayOffsetX.Location = new System.Drawing.Point(106, 85);
this.txtStockTrayOffsetX.Name = "txtStockTrayOffsetX";
this.txtStockTrayOffsetX.Size = new System.Drawing.Size(85, 21);
this.txtStockTrayOffsetX.TabIndex = 54;
this.txtStockTrayOffsetX.Tag = "";
this.txtStockTrayOffsetX.Text = "0.01";
this.txtStockTrayOffsetX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtStockTrayOffsetX.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtSysParam_KeyUp);
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -699,7 +737,7 @@
this.txtMarkX2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtMarkX2.Font = new System.Drawing.Font("宋体", 9F);
this.txtMarkX2.ForeColor = System.Drawing.Color.White;
this.txtMarkX2.Location = new System.Drawing.Point(67, 86);
this.txtMarkX2.Location = new System.Drawing.Point(235, 150);
this.txtMarkX2.Name = "txtMarkX2";
this.txtMarkX2.ReadOnly = true;
this.txtMarkX2.Size = new System.Drawing.Size(85, 21);
@ -719,13 +757,22 @@
this.label3.TabIndex = 48;
this.label3.Text = "SlotOffsetX:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(26, 120);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(77, 12);
this.label10.TabIndex = 47;
this.label10.Text = "取放料补偿Y:";
//
// txtMarkX1
//
this.txtMarkX1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16)))));
this.txtMarkX1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtMarkX1.Font = new System.Drawing.Font("宋体", 9F);
this.txtMarkX1.ForeColor = System.Drawing.Color.White;
this.txtMarkX1.Location = new System.Drawing.Point(67, 19);
this.txtMarkX1.Location = new System.Drawing.Point(106, 19);
this.txtMarkX1.Name = "txtMarkX1";
this.txtMarkX1.ReadOnly = true;
this.txtMarkX1.Size = new System.Drawing.Size(85, 21);
@ -737,13 +784,22 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(18, 121);
this.label8.Location = new System.Drawing.Point(186, 185);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(47, 12);
this.label8.TabIndex = 47;
this.label8.Text = "MarkY2:";
this.label8.Visible = false;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(26, 89);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(77, 12);
this.label9.TabIndex = 48;
this.label9.Text = "取放料补偿X:";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -758,7 +814,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(18, 90);
this.label7.Location = new System.Drawing.Point(186, 154);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(47, 12);
this.label7.TabIndex = 48;
@ -768,7 +824,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(18, 54);
this.label6.Location = new System.Drawing.Point(57, 54);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(47, 12);
this.label6.TabIndex = 47;
@ -777,7 +833,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(18, 23);
this.label5.Location = new System.Drawing.Point(57, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(47, 12);
this.label5.TabIndex = 48;
@ -1202,5 +1258,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewLinkColumn dataGridViewLinkColumn1;
private System.Windows.Forms.TextBox txttxtStockTrayOffsetY;
private System.Windows.Forms.TextBox txtStockTrayOffsetX;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
}
}

@ -52,6 +52,8 @@ namespace Rs.MotionPlat.Recipe
{
dgvRunPoints.DataSource = dtRunPoints;
}
PositionHelper.BindSinglePosition(txtStockTrayOffsetX);
PositionHelper.BindSinglePosition(txttxtStockTrayOffsetY);
}
private void StockTrayLocationRecipe_Load(object sender, EventArgs e)
@ -103,8 +105,8 @@ namespace Rs.MotionPlat.Recipe
//double yBase = double.Parse(dt.Rows[0]["MarkY1"].ToString()) + double.Parse(dt.Rows[0]["Mark2CenterDistY"].ToString()) + (i * double.Parse(dt.Rows[0]["SlotOffsetDistY"].ToString()));
//double xRun = double.Parse(dt.Rows[0]["MarkX1"].ToString()) + double.Parse(dt.Rows[0]["Mark2CenterDistX"].ToString()) + (j * double.Parse(dt.Rows[0]["SlotOffsetDistX"].ToString()));
//double yRun = double.Parse(dt.Rows[0]["MarkY1"].ToString()) + double.Parse(dt.Rows[0]["Mark2CenterDistY"].ToString()) + (i * double.Parse(dt.Rows[0]["SlotOffsetDistY"].ToString()));
double xRun = double.Parse(txtMarkX1.Text) + (j * double.Parse(txtSlotOffsetDistX.Text));
double yRun = double.Parse(txtMarkY1.Text) + (i * double.Parse(txtSlotOffsetDistY.Text));
double xRun = double.Parse(txtMarkX1.Text) + (j * double.Parse(txtSlotOffsetDistX.Text))+GlobalVar.StockTrayOffsetX;
double yRun = double.Parse(txtMarkY1.Text) + (i * double.Parse(txtSlotOffsetDistY.Text))+GlobalVar.StockTrayOffsetY;
string insertRunSql = $"insert into TrayPoints(trayid,recipename,trayname,slotindex,x,y) values('{dt.Rows[0]["id"]}','{dt.Rows[0]["recipename"]}','{dt.Rows[0]["TrayName"]}',{tempIndex},{xRun},{yRun})";
db.ExecuteNonQuery(insertRunSql);
index++;
@ -314,5 +316,10 @@ namespace Rs.MotionPlat.Recipe
}
}
}
public void txtSysParam_KeyUp(object sender, KeyEventArgs e)
{
UpdateSysParam((TextBox)sender);
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,5 +1,6 @@
using Rs.Controls;
using Rs.Framework;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Flow;
using System;
using System.Collections.Generic;
@ -22,6 +23,12 @@ namespace Rs.MotionPlat.SysConfig
private void ClampConfig_Load(object sender, EventArgs e)
{
PositionHelper.BindPosition(groupBox2);
PositionHelper.BindPosition(groupBox4);
PositionHelper.BindPosition(groupBox6);
PositionHelper.BindPosition(groupBox7);
PositionHelper.BindPosition(groupBox8);
PositionHelper.BindPosition(groupBox9);
FormIO2 formIO = new FormIO2("龙门");
formIO.Dock = DockStyle.Fill;
formIO.Visible = true;
@ -61,5 +68,26 @@ namespace Rs.MotionPlat.SysConfig
return;
}
}
public void txtSysParam_KeyUp(object sender, KeyEventArgs e)
{
UpdateSysParam((TextBox)sender);
}
private void Teach_Click(object sender, EventArgs e)
{
PositionHelper.Teach(this, sender);
}
private void Move_Click(object sender, EventArgs e)
{
PositionHelper.Move2This(this, sender);
}
private void button14_Click(object sender, EventArgs e)
{
}
}
}

Loading…
Cancel
Save