Commit 8eccf70f 几米阳光

1

1 个父辈 85436596
......@@ -22,17 +22,12 @@ namespace URSoldering.Common
public static string Robot_Type = "Robot_Type";
public static string AOIFileConfig = "AOIFileConfig";
/// <summary>
/// 检测焊点文件
/// </summary>
public static string AOICheckPointFile = "AOICheckPointFile";
public static string ISDebug = "ISDebug";
public static string WorkCount_ConfigPath = "WorkCount_ConfigPath";
#region 焊接机器人配置
public static string ScanCodeConfig = "ScanCodeConfig";
/// <summary>
/// 元器件库目录
/// </summary>
......@@ -71,9 +66,8 @@ namespace URSoldering.Common
/// 机械臂最小范围
/// </summary>
public static string Soldering_RobotMax = "Soldering_RobotMax";
public static string Soldering_LIM_Z = "Soldering_LIM_Z";
public static string SendWire_Change = "SendWire_Change";
public static string Slave_ID = "Slave_ID";
/// <summary>
......@@ -90,21 +84,10 @@ namespace URSoldering.Common
/// </summary>
public static string SendWireRecoverSeconds = "SendWireRecoverSeconds";
public static string ReverseSendWireSpeed = "ReverseSendWireSpeed";
public static string ReverseSendWireTime = "ReverseSendWireTime";
/// <summary>
/// 摄像机名称,多个中间使用#分割
/// </summary>
public static string CameraName = "CameraName";
/// <summary>
/// 需要识别的条码类型,多个中间使用#分割
/// </summary>
public static string CodeType = "CodeType";
/// <summary>
/// 配置文件路径 Data Matrix ECC 200.dcm
/// </summary>
public static string CodeParamPath = "CodeParamPath";
public static string VideoCameraName = "VideoCameraName";
......@@ -115,6 +98,5 @@ namespace URSoldering.Common
public static string HasSoldering = "HasSoldering";
public static string Config_Pwd = "Config_Pwd";
public static object ShuoKe_Control_SerialPort { get; set; }
}
}
......@@ -25,7 +25,6 @@ namespace URSoldering.DeviceLibrary
public static URPointValue RobotMax = new URPointValue();
public static int SendWireXiShu = ConfigAppSettings.GetIntValue(Setting_Init.SendWire_Change);
//休眠的秒数,<=0不需要休眠
public static int SleepSeconds = ConfigAppSettings.GetIntValue(Setting_Init.SleepSeconds);
public static bool isHighSpeed = ConfigAppSettings.GetIntValue(Setting_Init.Robot_IsHigh) == 1;
......
......@@ -286,7 +286,7 @@ namespace URSoldering.DeviceLibrary
double time = WeldMoveStep.CurrPoint.startSendWireTime;
if (time > 0)
{
int speed = (int)WeldMoveStep.CurrPoint.startSendWireSpeed * SendWireXiShu;
double speed = WeldMoveStep.CurrPoint.startSendWireSpeed;
WeldLog(" 慢速送丝,速度:" + speed + " :" + time.ToString() + "秒");
SendWireManager.SendWire( time, speed);
int ms = (int)(time * 1000+100);
......@@ -301,7 +301,7 @@ namespace URSoldering.DeviceLibrary
{
SetTemp(false, false);
double time = WeldMoveStep.CurrPoint.sendWireTime;
int speed = (int)WeldMoveStep.CurrPoint.sendWireSpeed * SendWireXiShu;
double speed =WeldMoveStep.CurrPoint.sendWireSpeed ;
WeldLog(" 送丝,速度:" + speed + " :" + time.ToString() + "秒");
if (time > 0)
{
......@@ -480,7 +480,7 @@ namespace URSoldering.DeviceLibrary
WeldMoveStep.ResetCount++;
SendWireManager.Reset();
//反向送丝
int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed) * SendWireXiShu;
int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed) ;
double time = (double)ConfigAppSettings.GetNumValue(Setting_Init.ReverseSendWireTime);
if (speed.Equals(0) || time <= 0)
{
......@@ -495,7 +495,7 @@ namespace URSoldering.DeviceLibrary
SendWireManager.SendWireBack(time, speed);
int ms = (int)((time * 1000) + 100);
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms, false));
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms, true));
isOk = false;
}
}
......
......@@ -148,14 +148,14 @@ namespace URSoldering.DeviceLibrary
}
return false;
}
public static void SendWireBack(double time, int speed)
public static void SendWireBack(double time, double speed)
{
setSpeed(speed);
double length = (time * speed);
setLength(length);
StartBSend();
}
public static void SendWire(double time, int speed)
public static void SendWire(double time, double speed)
{
setSpeed(speed);
double length = (time * speed);
......
......@@ -13,7 +13,6 @@
<!--AOI检测文件-->
<add key="VideoCameraName" value="[0] Integrated Camera" />
<add key="AOIFileConfig" value="\RobotConfig\AOIConfig\AOIProgram.vscf" />
<add key="AOICheckPointFile" value="\RobotConfig\AOIConfig\AOIPointProgram.vscf" />
<add key="AOIWaitSeconds" value="1000" />
<!--送丝器消除报警需要持续的秒数-->
<add key="SendWireRecoverSeconds" value="5" />
......@@ -39,10 +38,9 @@
<add key="Board_Image_Path" value="\RobotConfig\config" />
<!--程序默认图片-->
<add key="BOARD_IMAGE_DEFAULT" value="defaultBoard.jpg" />
<!--送丝1mm对应的脉冲数-->
<add key="SendWire_Change" value="-305" />
<!--报警时反转送丝速度-->
<add key="ReverseSendWireSpeed" value="-10" />
<add key="ReverseSendWireSpeed" value="10" />
<!--报警时反转送丝时间-->
<add key="ReverseSendWireTime" value="3" />
<add key="ISDebug" value="1" />
......
......@@ -12,8 +12,8 @@ namespace URSoldering.Client
{
InitializeComponent();
}
private static string VideoCameraName = ConfigAppSettings.GetValue(Setting_Init.VideoCameraName);
//private static string CodeCameraName = ConfigAppSettings.GetValue(Setting_Init.CodeCameraName);
//private static string VideoCameraName = ConfigAppSettings.GetValue(Setting_Init.VideoCameraName);
private void btnOpen_Click(object sender, EventArgs e)
{
string name = cmbCamera.Text;
......@@ -38,7 +38,7 @@ namespace URSoldering.Client
private void FrmCamera_Load(object sender, EventArgs e)
{
cmbCamera.Items.Add(VideoCameraName);
//cmbCamera.Items.Add(VideoCameraName);
//cmbCamera.Items.Add(CodeCameraName);
cmbCamera.SelectedIndex = 0;
FormStatus(false);
......
......@@ -46,13 +46,6 @@
this.gbEpsonSetting = new System.Windows.Forms.GroupBox();
this.txtLimZ = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.gbBoardSetting = new System.Windows.Forms.GroupBox();
this.cmbBoardList = new System.Windows.Forms.ComboBox();
this.txtOriginY = new System.Windows.Forms.TextBox();
this.txtOriginX = new System.Windows.Forms.TextBox();
this.lblOriginY = new System.Windows.Forms.Label();
this.lblOriginX = new System.Windows.Forms.Label();
this.lblBoardID = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.maxControl = new UserFromControl.URRobotMControl();
this.minControl = new UserFromControl.URRobotMControl();
......@@ -61,7 +54,6 @@
this.groupBox4.SuspendLayout();
this.groupBox1.SuspendLayout();
this.gbEpsonSetting.SuspendLayout();
this.gbBoardSetting.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
......@@ -69,9 +61,9 @@
//
this.groupBox3.Controls.Add(this.clear2Control);
this.groupBox3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox3.Location = new System.Drawing.Point(715, 5);
this.groupBox3.Location = new System.Drawing.Point(499, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(199, 265);
this.groupBox3.Size = new System.Drawing.Size(217, 265);
this.groupBox3.TabIndex = 40;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "焊接清洗点2配置";
......@@ -88,9 +80,9 @@
//
this.groupBox2.Controls.Add(this.clear1Control);
this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(510, 5);
this.groupBox2.Location = new System.Drawing.Point(260, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(199, 265);
this.groupBox2.Size = new System.Drawing.Size(217, 265);
this.groupBox2.TabIndex = 12;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "焊接清洗点1配置";
......@@ -112,7 +104,7 @@
this.groupBox4.Controls.Add(this.lblWirdFeedingTime);
this.groupBox4.Controls.Add(this.txtsendWireTime);
this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(22, 178);
this.groupBox4.Location = new System.Drawing.Point(440, 282);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(276, 118);
this.groupBox4.TabIndex = 11;
......@@ -175,9 +167,9 @@
//
this.groupBox1.Controls.Add(this.homeControl);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(305, 5);
this.groupBox1.Location = new System.Drawing.Point(21, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(199, 265);
this.groupBox1.Size = new System.Drawing.Size(217, 265);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "机器人待机点配置";
......@@ -193,7 +185,7 @@
// btnClose
//
this.btnClose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClose.Location = new System.Drawing.Point(797, 364);
this.btnClose.Location = new System.Drawing.Point(599, 502);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(117, 35);
this.btnClose.TabIndex = 7;
......@@ -204,7 +196,7 @@
// btnSaveSetting
//
this.btnSaveSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveSetting.Location = new System.Drawing.Point(797, 322);
this.btnSaveSetting.Location = new System.Drawing.Point(458, 502);
this.btnSaveSetting.Name = "btnSaveSetting";
this.btnSaveSetting.Size = new System.Drawing.Size(117, 35);
this.btnSaveSetting.TabIndex = 6;
......@@ -217,7 +209,7 @@
this.gbEpsonSetting.Controls.Add(this.txtLimZ);
this.gbEpsonSetting.Controls.Add(this.label8);
this.gbEpsonSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.gbEpsonSetting.Location = new System.Drawing.Point(22, 299);
this.gbEpsonSetting.Location = new System.Drawing.Point(440, 404);
this.gbEpsonSetting.Name = "gbEpsonSetting";
this.gbEpsonSetting.Size = new System.Drawing.Size(276, 80);
this.gbEpsonSetting.TabIndex = 1;
......@@ -240,87 +232,21 @@
this.label8.TabIndex = 6;
this.label8.Text = "最高Z点:";
//
// gbBoardSetting
//
this.gbBoardSetting.Controls.Add(this.cmbBoardList);
this.gbBoardSetting.Controls.Add(this.txtOriginY);
this.gbBoardSetting.Controls.Add(this.txtOriginX);
this.gbBoardSetting.Controls.Add(this.lblOriginY);
this.gbBoardSetting.Controls.Add(this.lblOriginX);
this.gbBoardSetting.Controls.Add(this.lblBoardID);
this.gbBoardSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.gbBoardSetting.Location = new System.Drawing.Point(22, 5);
this.gbBoardSetting.Name = "gbBoardSetting";
this.gbBoardSetting.Size = new System.Drawing.Size(276, 167);
this.gbBoardSetting.TabIndex = 0;
this.gbBoardSetting.TabStop = false;
this.gbBoardSetting.Text = "程序配置";
//
// cmbBoardList
//
this.cmbBoardList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbBoardList.FormattingEnabled = true;
this.cmbBoardList.Location = new System.Drawing.Point(107, 37);
this.cmbBoardList.Name = "cmbBoardList";
this.cmbBoardList.Size = new System.Drawing.Size(144, 25);
this.cmbBoardList.TabIndex = 10;
//
// txtOriginY
//
this.txtOriginY.Location = new System.Drawing.Point(118, 118);
this.txtOriginY.Name = "txtOriginY";
this.txtOriginY.Size = new System.Drawing.Size(133, 23);
this.txtOriginY.TabIndex = 5;
//
// txtOriginX
//
this.txtOriginX.Location = new System.Drawing.Point(118, 79);
this.txtOriginX.Name = "txtOriginX";
this.txtOriginX.Size = new System.Drawing.Size(133, 23);
this.txtOriginX.TabIndex = 4;
//
// lblOriginY
//
this.lblOriginY.AutoSize = true;
this.lblOriginY.Location = new System.Drawing.Point(17, 121);
this.lblOriginY.Name = "lblOriginY";
this.lblOriginY.Size = new System.Drawing.Size(87, 17);
this.lblOriginY.TabIndex = 3;
this.lblOriginY.Text = "固定点Y坐标:";
//
// lblOriginX
//
this.lblOriginX.AutoSize = true;
this.lblOriginX.Location = new System.Drawing.Point(17, 82);
this.lblOriginX.Name = "lblOriginX";
this.lblOriginX.Size = new System.Drawing.Size(88, 17);
this.lblOriginX.TabIndex = 2;
this.lblOriginX.Text = "固定点X坐标:";
//
// lblBoardID
//
this.lblBoardID.AutoSize = true;
this.lblBoardID.Location = new System.Drawing.Point(17, 43);
this.lblBoardID.Name = "lblBoardID";
this.lblBoardID.Size = new System.Drawing.Size(68, 17);
this.lblBoardID.TabIndex = 1;
this.lblBoardID.Text = "当前程序:";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.maxControl);
this.groupBox5.Controls.Add(this.minControl);
this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox5.Location = new System.Drawing.Point(305, 270);
this.groupBox5.Location = new System.Drawing.Point(21, 282);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(404, 260);
this.groupBox5.Size = new System.Drawing.Size(400, 249);
this.groupBox5.TabIndex = 42;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "机械臂活动范围";
//
// maxControl
//
this.maxControl.Location = new System.Drawing.Point(212, 25);
this.maxControl.Location = new System.Drawing.Point(199, 25);
this.maxControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.maxControl.Name = "maxControl";
this.maxControl.Size = new System.Drawing.Size(168, 226);
......@@ -338,7 +264,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(996, 545);
this.ClientSize = new System.Drawing.Size(750, 555);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
......@@ -347,7 +273,6 @@
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnSaveSetting);
this.Controls.Add(this.gbEpsonSetting);
this.Controls.Add(this.gbBoardSetting);
this.Name = "FrmSolderingSetting";
this.Text = "设备配置";
this.Load += new System.EventHandler(this.FrmRobotSetting_Load);
......@@ -358,26 +283,16 @@
this.groupBox1.ResumeLayout(false);
this.gbEpsonSetting.ResumeLayout(false);
this.gbEpsonSetting.PerformLayout();
this.gbBoardSetting.ResumeLayout(false);
this.gbBoardSetting.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox gbBoardSetting;
private System.Windows.Forms.GroupBox gbEpsonSetting;
private System.Windows.Forms.Label lblBoardID;
private System.Windows.Forms.Button btnSaveSetting;
private System.Windows.Forms.TextBox txtOriginY;
private System.Windows.Forms.TextBox txtOriginX;
private System.Windows.Forms.Label lblOriginY;
private System.Windows.Forms.Label lblOriginX;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox cmbBoardList;
private System.Windows.Forms.TextBox txtLimZ;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.GroupBox groupBox4;
......
......@@ -26,22 +26,22 @@ namespace URSoldering.Client
}
private void getValue()
{
int index = -1;
foreach (BoardInfo obj in BoardManager.boardList)
{
index++;
if (obj.boardId.Equals(BoardManager.CurrBoardId))
{
break;
}
}
if (index >= 0)
{
cmbBoardList.SelectedIndex = index;
}
this.txtOriginX.Text = ConfigAppSettings.GetValue(Setting_Init.BOARD_ORIGIN_X);
this.txtOriginY.Text = ConfigAppSettings.GetValue(Setting_Init.BOARD_ORIGIN_Y);
int ch = WeldRobotBean.SendWireXiShu;
//int index = -1;
//foreach (BoardInfo obj in BoardManager.boardList)
//{
// index++;
// if (obj.boardId.Equals(BoardManager.CurrBoardId))
// {
// break;
// }
//}
//if (index >= 0)
//{
// cmbBoardList.SelectedIndex = index;
//}
//this.txtOriginX.Text = ConfigAppSettings.GetValue(Setting_Init.BOARD_ORIGIN_X);
//this.txtOriginY.Text = ConfigAppSettings.GetValue(Setting_Init.BOARD_ORIGIN_Y);
//int ch = WeldRobotBean.SendWireXiShu;
txtLimZ.Text = ((double)ConfigAppSettings.GetNumValue(Setting_Init.Soldering_LIM_Z)).ToString();
txtsendWireSpeed.Text = ConfigAppSettings.GetValue(Setting_Init.ReverseSendWireSpeed);
......@@ -59,8 +59,8 @@ namespace URSoldering.Client
{
try
{
int boardId = ((BoardInfo)cmbBoardList.SelectedItem).boardId;
BoardManager.UpdateCurrBoard(boardId);
//int boardId = ((BoardInfo)cmbBoardList.SelectedItem).boardId;
//BoardManager.UpdateCurrBoard(boardId);
int limz = FormUtil.GetIntValue(txtLimZ);
......@@ -154,8 +154,8 @@ namespace URSoldering.Client
ConfigAppSettings.SaveValue(Setting_Init.Soldering_LIM_Z, limz.ToString());
URRobotControl.Robot_LIM_Z = limz;
ConfigAppSettings.SaveValue(Setting_Init.Default_BoardID, boardId);
BoardManager.UpdateCurrBoard(boardId);
//ConfigAppSettings.SaveValue(Setting_Init.Default_BoardID, boardId);
//BoardManager.UpdateCurrBoard(boardId);
ConfigAppSettings.SaveValue(Setting_Init.ReverseSendWireSpeed, sendWireSpeed);
ConfigAppSettings.SaveValue(Setting_Init.ReverseSendWireTime, sendWireTime);
......@@ -175,16 +175,16 @@ namespace URSoldering.Client
private void FrmRobotSetting_Load(object sender, EventArgs e)
{
LoadCom();
//LoadCom();
getValue();
}
private void LoadCom()
{
cmbBoardList.DataSource = null;
cmbBoardList.DataSource = BoardManager.boardList;
cmbBoardList.DisplayMember = "boardName";
cmbBoardList.ValueMember = "boardId";
}
//private void LoadCom()
//{
// cmbBoardList.DataSource = null;
// cmbBoardList.DataSource = BoardManager.boardList;
// cmbBoardList.DisplayMember = "boardName";
// cmbBoardList.ValueMember = "boardId";
//}
private void btnClose_Click(object sender, EventArgs e)
{
......
......@@ -47,7 +47,6 @@
this.logBox = new System.Windows.Forms.RichTextBox();
this.lblRobot = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.axCKVisionCtrl1 = new AxCKVisionCtrlLib.AxCKVisionCtrl();
this.lblCodeResult = new System.Windows.Forms.Label();
......@@ -168,7 +167,7 @@
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.axCKVisionCtrl1);
this.groupBox2.Controls.Add(this.lblCodeResult);
......@@ -181,17 +180,7 @@
this.groupBox2.Size = new System.Drawing.Size(99, 595);
this.groupBox2.TabIndex = 269;
this.groupBox2.TabStop = false;
//
// button2
//
this.button2.Location = new System.Drawing.Point(486, 14);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(79, 26);
this.button2.TabIndex = 308;
this.button2.Text = "扫码测试";
this.button2.UseVisualStyleBackColor = true;
this.button2.Visible = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
......@@ -821,7 +810,7 @@
private System.Windows.Forms.Button btnBlow;
private System.Windows.Forms.Label lblCodeResult;
private AxCKVisionCtrlLib.AxCKVisionCtrl axCKVisionCtrl1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label3;
......
......@@ -19,7 +19,7 @@ namespace URSoldering.Client
{
public partial class FrmWork : FrmBase
{
private static string VideoCameraName = ConfigAppSettings.GetValue(Setting_Init.VideoCameraName);
//private static string VideoCameraName = ConfigAppSettings.GetValue(Setting_Init.VideoCameraName);
private URSolderingRobot Robot = null;
public FrmWork()
{
......@@ -38,9 +38,7 @@ namespace URSoldering.Client
Robot = RobotManager.SolderingRobot;
WeldRobotBean.AOICheckFun += AOICheck;
//WeldRobotBean.GetCodeFun += GetCode;
//Robot.AOICheckFun += AOICheck;
Robot.GetCodeFun += GetCode;
//Robot.GetCodeFun += GetCode;
LogUtil.logBox = this.logBox;
LogUtil.showCount = 1;
this.WindowState = FormWindowState.Maximized;
......@@ -59,7 +57,6 @@ namespace URSoldering.Client
this.Text = "程序【" + BoardManager.CurrBoard.boardName + "】工作";
LoadPoint(BoardManager.CurrBoard, -1);
this.btnChange.Focus();
btnStart.Text = "启动";
btnStart.Enabled = true;
......@@ -167,7 +164,7 @@ namespace URSoldering.Client
chartSolder.Series[0].Points[ShowPointIndex - 1].SetValueY(solderCount);
}
private string codeFile = "";
private string aoiCheckFile = "";
private string currAOIFile = "";
private void LoadAOI()
......@@ -175,10 +172,7 @@ namespace URSoldering.Client
//位置配置到文件中
string appPath = Application.StartupPath;
string strFilePathName = ConfigAppSettings.GetValue(Setting_Init.AOIFileConfig);
string codeFilePathName = ConfigAppSettings.GetValue(Setting_Init.ScanCodeConfig);
//string filePath = appPath + strFilePathName;
aoiCheckFile = appPath + strFilePathName;
codeFile = appPath + codeFilePathName;
LoadAOIFile(aoiCheckFile);
}
......@@ -372,7 +366,6 @@ namespace URSoldering.Client
btnStart.Text = "复位";
btnWeld.Enabled = true;
btnStop.Enabled = true;
OpenUsbCamera();
}
timer.Start();
}else
......@@ -537,7 +530,6 @@ namespace URSoldering.Client
}
}
Robot.StopRun();
CloseUsbCamera();
btnStart.Text = "启动";
}
......@@ -622,111 +614,89 @@ namespace URSoldering.Client
WeldRobotBean.StopWeld();
}
}
private void OpenUsbCamera()
{
//UsbCameraHDevelop.CloseCamera(VideoCameraName);
//if (UsbCameraHDevelop.OpenCamera(VideoCameraName))
//{
// usbTimer.Enabled = true;
//}
//else
//{
// LogUtil.error("打开焊接监控摄像机失败!");
// usbTimer.Enabled = false;
//}
}
private void CloseUsbCamera()
{
//UsbCameraHDevelop.CloseCamera(VideoCameraName);
//usbTimer.Close();
}
private void GetCode()
{
try
{
this.label1.Text = "视觉/扫码";
//try
//{
// this.label1.Text = "视觉/扫码";
lblCodeResult.Text = "焊点自动识别中。。。";
lblCodeResult.ForeColor = Color.Blue;
lblCodeResult.Visible = true;
// lblCodeResult.Text = "焊点自动识别中。。。";
// lblCodeResult.ForeColor = Color.Blue;
// lblCodeResult.Visible = true;
LoadAOIFile(aoiCheckFile);
//lblAOIResult.Visible = false;
// LoadAOIFile(aoiCheckFile);
// //lblAOIResult.Visible = false;
for (int i = 0; i < 5; i++)
{
bool result = RunAOI(2);
//if (result)
// for (int i = 0; i < 5; i++)
// {
// bool result = RunAOI(2);
// //if (result)
// //{
// string code = getResult("Code",101);
// if (!code.Equals(""))
// {
// Robot.WareCode = code;
// lblCodeResult.ForeColor = Color.Blue;
// lblCodeResult.Text = "识别成功,共找到【" + BoardManager.CurrBoard.pointList.Count + "】个焊点";
// LogUtil.info("扫码成功:" + code);
// lblCodeResult.Visible = true;
// UpdateBoard(code);
// break;
// }
// else
// {
// lblCodeResult.ForeColor = Color.Red;
// lblCodeResult.Text = "焊点识别失败,即将重新识别";
// LogUtil.info("扫码失败,即将重新扫码");
// lblCodeResult.Visible = true;
// }
// //}
// Thread.Sleep(500);
// }
// lblCodeResult.ForeColor = Color.Blue;
// lblCodeResult.Text = "识别成功,共找到【" + BoardManager.CurrBoard.pointList.Count + "】个焊点";
// lblCodeResult.Visible = true;
// if (lblCodeResult.Visible.Equals(false))
// {
// lblCodeResult.ForeColor = Color.Blue;
// //lblCodeResult.Text = "扫码成功:1000001" ;
// LogUtil.info("扫码成功:1000001");
// }
//}
//catch (Exception ex)
//{
string code = getResult("Code",101);
if (!code.Equals(""))
{
Robot.WareCode = code;
lblCodeResult.ForeColor = Color.Blue;
lblCodeResult.Text = "识别成功,共找到【" + BoardManager.CurrBoard.pointList.Count + "】个焊点";
LogUtil.info("扫码成功:" + code);
lblCodeResult.Visible = true;
UpdateBoard(code);
break;
}
else
{
lblCodeResult.ForeColor = Color.Red;
lblCodeResult.Text = "焊点识别失败,即将重新识别";
LogUtil.info("扫码失败,即将重新扫码");
lblCodeResult.Visible = true;
}
// LogUtil.error("读取条码出错:" + ex.ToString());
//}
Thread.Sleep(500);
}
lblCodeResult.ForeColor = Color.Blue;
lblCodeResult.Text = "识别成功,共找到【" + BoardManager.CurrBoard.pointList.Count + "】个焊点";
lblCodeResult.Visible = true;
if (lblCodeResult.Visible.Equals(false))
{
lblCodeResult.ForeColor = Color.Blue;
//lblCodeResult.Text = "扫码成功:1000001" ;
LogUtil.info("扫码成功:1000001");
}
}
catch (Exception ex)
{
LogUtil.error("读取条码出错:" + ex.ToString());
}
}
/// <summary>
/// 切换程序
/// </summary>
/// <param name="code"></param>
private void UpdateBoard(string code)
{
string[] str = code.Split('@');
if (str.Length >= 1)
{
string boardCode = str[0];
if (BoardManager.CurrBoard.WareCode.Equals(boardCode))
{
return;
}
else
{
BoardInfo board = BoardManager.getBoardByCode(boardCode);
if (board == null)
{
LogUtil.error("条码【"+code+"】未找到匹配的程序,使用之前的程序【"+BoardManager.CurrBoard.boardName+"】");
}
else
{
LogUtil.error("条码【" + code + "】切换新程序【" + board.boardName + "】");
BoardManager.UpdateCurrBoard(board.boardId);
LoadPoint(board, -3);
}
}
}
//string[] str = code.Split('@');
//if (str.Length >= 1)
//{
// string boardCode = str[0];
// if (BoardManager.CurrBoard.WareCode.Equals(boardCode))
// {
// return;
// }
// else
// {
// BoardInfo board = BoardManager.getBoardByCode(boardCode);
// if (board == null)
// {
// LogUtil.error("条码【"+code+"】未找到匹配的程序,使用之前的程序【"+BoardManager.CurrBoard.boardName+"】");
// }
// else
// {
// LogUtil.error("条码【" + code + "】切换新程序【" + board.boardName + "】");
// BoardManager.UpdateCurrBoard(board.boardId);
// LoadPoint(board, -3);
// }
// }
//}
}
private void AOICheck()
......@@ -741,7 +711,6 @@ namespace URSoldering.Client
if (result.Equals(1))
{
LogUtil.info("AOI检测OK");
//RobotBean.KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.LOW);
lblAOIResult.ForeColor = Color.Blue;
lblAOIResult.Text = "检测OK";
WorkCountManager.AddOKCount();
......@@ -749,7 +718,6 @@ namespace URSoldering.Client
else
{
LogUtil.info("AOI检测NG");
//RobotBean.KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.HIGH);
lblAOIResult.ForeColor = Color.Red;
lblAOIResult.Text = "检测NG";
WorkCountManager.AddNGCount();
......@@ -814,32 +782,28 @@ namespace URSoldering.Client
return 0;
}
}
private string getResult(string name,int DataId)
{
string result = "";
try
{
int idTool = axCKVisionCtrl1.GetTool(name);
//private string getResult(string name,int DataId)
//{
// string result = "";
// try
// {
// int idTool = axCKVisionCtrl1.GetTool(name);
// string value = "";
// object objValue = new VariantWrapper(value);
// if (axCKVisionCtrl1.GetValue(idTool, DataId, 0, ref objValue) == true)
// {
// result = objValue.ToString();
// }
// LogUtil.info("获取【" + name + "】:" + result);
// }
// catch (Exception ex)
// {
// LogUtil.error("获取【" + name + "】出错:" + ex.ToString());
// }
// return result;
//}
string value = "";
object objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, DataId, 0, ref objValue) == true)
{
result = objValue.ToString();
}
LogUtil.info("获取【" + name + "】:" + result);
}
catch (Exception ex)
{
LogUtil.error("获取【" + name + "】出错:" + ex.ToString());
}
return result;
}
private void logBox_TextChanged(object sender, EventArgs e)
{
logBox.SelectionStart = logBox.Text.Length;
logBox.ScrollToCaret();
}
private void btnLook_Click(object sender, EventArgs e)
{
......@@ -851,13 +815,6 @@ namespace URSoldering.Client
{
Robot.IsAutoRun = chbXunHuan.Checked;
}
private void button2_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(delegate ()
{
GetCode();
});
}
private void button1_Click(object sender, EventArgs e)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!