Commit 51bf90bb 刘韬

优化X光部分流程逻辑

1 个父辈 8f00002c
...@@ -53,13 +53,14 @@ ...@@ -53,13 +53,14 @@
this.btnScanTest = new System.Windows.Forms.Button(); this.btnScanTest = new System.Windows.Forms.Button();
this.chbZxing = new System.Windows.Forms.CheckBox(); this.chbZxing = new System.Windows.Forms.CheckBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// txtPath // txtPath
// //
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtPath.Location = new System.Drawing.Point(1047, 92); this.txtPath.Location = new System.Drawing.Point(1042, 92);
this.txtPath.Name = "txtPath"; this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(321, 21); this.txtPath.Size = new System.Drawing.Size(321, 21);
this.txtPath.TabIndex = 0; this.txtPath.TabIndex = 0;
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,7 @@
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.BackColor = System.Drawing.Color.White; this.pictureBox1.BackColor = System.Drawing.Color.White;
this.pictureBox1.Location = new System.Drawing.Point(917, 115); this.pictureBox1.Location = new System.Drawing.Point(912, 115);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(451, 313); this.pictureBox1.Size = new System.Drawing.Size(451, 313);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
...@@ -90,7 +91,7 @@ ...@@ -90,7 +91,7 @@
// txtResult // txtResult
// //
this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.txtResult.Location = new System.Drawing.Point(917, 431); this.txtResult.Location = new System.Drawing.Point(912, 431);
this.txtResult.Multiline = true; this.txtResult.Multiline = true;
this.txtResult.Name = "txtResult"; this.txtResult.Name = "txtResult";
this.txtResult.Size = new System.Drawing.Size(450, 290); this.txtResult.Size = new System.Drawing.Size(450, 290);
...@@ -106,9 +107,9 @@ ...@@ -106,9 +107,9 @@
this.hWindowControl1.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480); this.hWindowControl1.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
this.hWindowControl1.Location = new System.Drawing.Point(11, 115); this.hWindowControl1.Location = new System.Drawing.Point(11, 115);
this.hWindowControl1.Name = "hWindowControl1"; this.hWindowControl1.Name = "hWindowControl1";
this.hWindowControl1.Size = new System.Drawing.Size(900, 606); this.hWindowControl1.Size = new System.Drawing.Size(895, 606);
this.hWindowControl1.TabIndex = 8; this.hWindowControl1.TabIndex = 8;
this.hWindowControl1.WindowSize = new System.Drawing.Size(900, 606); this.hWindowControl1.WindowSize = new System.Drawing.Size(895, 606);
// //
// btnbarCode // btnbarCode
// //
...@@ -125,7 +126,7 @@ ...@@ -125,7 +126,7 @@
// //
this.btnLearn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnLearn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLearn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnLearn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLearn.Location = new System.Drawing.Point(1249, 10); this.btnLearn.Location = new System.Drawing.Point(1244, 10);
this.btnLearn.Name = "btnLearn"; this.btnLearn.Name = "btnLearn";
this.btnLearn.Size = new System.Drawing.Size(109, 33); this.btnLearn.Size = new System.Drawing.Size(109, 33);
this.btnLearn.TabIndex = 10; this.btnLearn.TabIndex = 10;
...@@ -212,7 +213,7 @@ ...@@ -212,7 +213,7 @@
// //
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(1249, 49); this.btnExit.Location = new System.Drawing.Point(1244, 49);
this.btnExit.Name = "btnExit"; this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(109, 33); this.btnExit.Size = new System.Drawing.Size(109, 33);
this.btnExit.TabIndex = 18; this.btnExit.TabIndex = 18;
...@@ -224,7 +225,7 @@ ...@@ -224,7 +225,7 @@
// //
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(914, 95); this.label1.Location = new System.Drawing.Point(909, 95);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(127, 17); this.label1.Size = new System.Drawing.Size(127, 17);
this.label1.TabIndex = 19; this.label1.TabIndex = 19;
...@@ -292,7 +293,7 @@ ...@@ -292,7 +293,7 @@
this.txtParamPath.Enabled = false; this.txtParamPath.Enabled = false;
this.txtParamPath.Location = new System.Drawing.Point(205, 92); this.txtParamPath.Location = new System.Drawing.Point(205, 92);
this.txtParamPath.Name = "txtParamPath"; this.txtParamPath.Name = "txtParamPath";
this.txtParamPath.Size = new System.Drawing.Size(706, 21); this.txtParamPath.Size = new System.Drawing.Size(701, 21);
this.txtParamPath.TabIndex = 28; this.txtParamPath.TabIndex = 28;
// //
// label4 // label4
...@@ -335,11 +336,22 @@ ...@@ -335,11 +336,22 @@
this.label5.Size = new System.Drawing.Size(0, 12); this.label5.Size = new System.Drawing.Size(0, 12);
this.label5.TabIndex = 32; this.label5.TabIndex = 32;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(1103, 57);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 33;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// FrmCodeDecode // FrmCodeDecode
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1375, 729); this.ClientSize = new System.Drawing.Size(1370, 729);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
this.Controls.Add(this.chbZxing); this.Controls.Add(this.chbZxing);
this.Controls.Add(this.btnScanTest); this.Controls.Add(this.btnScanTest);
...@@ -403,6 +415,7 @@ ...@@ -403,6 +415,7 @@
private System.Windows.Forms.Button btnScanTest; private System.Windows.Forms.Button btnScanTest;
private System.Windows.Forms.CheckBox chbZxing; private System.Windows.Forms.CheckBox chbZxing;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1;
} }
} }
...@@ -642,5 +642,55 @@ namespace CodeLibrary ...@@ -642,5 +642,55 @@ namespace CodeLibrary
string text = cmbCamera.Text; string text = cmbCamera.Text;
Clipboard.SetDataObject(text); Clipboard.SetDataObject(text);
} }
private void button1_Click_1(object sender, EventArgs e)
{
Task.Run(() => { test(); });
}
void test()
{
var files = Directory.GetFiles(@"d:\批量测试图像","*.bmp");
int t = 0;
for (int i = 0; i < 100; i++)
{
foreach (string s in files)
{
Bitmap bmp = new Bitmap(s);
HObject hoImage;
HDCodeHelper.Bitmap2HObjectBpp24(bmp, out hoImage);
try
{
t++;
List<CodeInfo> tlci = eyemDecode.Decoder(ref bmp);
//HDCodeHelper.DecodeCode(hoImage, "QR Code", GetCodeParamFilePath("QR Code"), 0, 2500);
//HDCodeHelper.DecodeCode(hoImage, "Data Matrix ECC 200", GetCodeParamFilePath("Data Matrix ECC 200"), 0, 2500);
Console.WriteLine(t);
}
catch { }
finally
{
hoImage.Dispose();
bmp.Dispose();
}
}
//GC.Collect();
}
}
public static string GetCodeParamFilePath(string codePath)
{
string appPath = Application.StartupPath;
string path = appPath + "\\CodeParam\\";
string filePath = path + codePath + ".dcm";
if (File.Exists(filePath))
{
return filePath;
}
else
{
return "";
}
}
} }
} }
...@@ -78,8 +78,7 @@ namespace CodeLibrary ...@@ -78,8 +78,7 @@ namespace CodeLibrary
} }
} }
else else
{ {
if (pictureBox1.Image == null) if (pictureBox1.Image == null)
{ {
MessageBox.Show(selImage,title ,MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(selImage,title ,MessageBoxButtons.OK, MessageBoxIcon.Error);
...@@ -100,6 +99,8 @@ namespace CodeLibrary ...@@ -100,6 +99,8 @@ namespace CodeLibrary
private void LoadCamera() private void LoadCamera()
{ {
cmbCamera.Items.Clear(); cmbCamera.Items.Clear();
if (Camera._cam.Name == null)
return;
foreach (string str in Camera._cam.Name) foreach (string str in Camera._cam.Name)
{ {
cmbCamera.Items.Add(str); cmbCamera.Items.Add(str);
......
...@@ -241,7 +241,10 @@ namespace CodeLibrary ...@@ -241,7 +241,10 @@ namespace CodeLibrary
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData srcBmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, bmp.PixelFormat); BitmapData srcBmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, bmp.PixelFormat);
HOperatorSet.GenImageInterleaved(out ho_Image, srcBmpData.Scan0, "bgrx", bmp.Width, bmp.Height, 0, "byte", 0, 0, 0, 0, -1, 0); if (bmp.PixelFormat == PixelFormat.Format8bppIndexed)
HOperatorSet.GenImage1(out ho_Image, "byte", bmp.Width, bmp.Height, srcBmpData.Scan0);
else
HOperatorSet.GenImageInterleaved(out ho_Image, srcBmpData.Scan0, "bgrx", bmp.Width, bmp.Height, 0, "byte", 0, 0, 0, 0, -1, 0);
bmp.UnlockBits(srcBmpData); bmp.UnlockBits(srcBmpData);
return true; return true;
......
...@@ -42,7 +42,11 @@ namespace CodeLibrary ...@@ -42,7 +42,11 @@ namespace CodeLibrary
codeTypeList = new List<string>(); codeTypeList = new List<string>();
try try
{ {
if (codeTypeList.Count <= 0)
{
codeTypeList.Add("Data Matrix ECC 200");
codeTypeList.Add("QR Code");
}
string[] nameArray = nameStr.Split(spiltChar); string[] nameArray = nameStr.Split(spiltChar);
foreach (string str in nameArray) foreach (string str in nameArray)
{ {
...@@ -55,11 +59,7 @@ namespace CodeLibrary ...@@ -55,11 +59,7 @@ namespace CodeLibrary
HDLogUtil.info("加载到二维码类型:" + str.Trim()); HDLogUtil.info("加载到二维码类型:" + str.Trim());
codeTypeList.Add(str.Trim()); codeTypeList.Add(str.Trim());
} }
if (codeTypeList.Count <= 0)
{
codeTypeList.Add("Data Matrix ECC 200");
codeTypeList.Add("QR Code");
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -221,7 +221,7 @@ namespace CodeLibrary ...@@ -221,7 +221,7 @@ namespace CodeLibrary
CodeResultAdd(hv_DecodedDataStrings, codeType, "学习"); CodeResultAdd(hv_DecodedDataStrings, codeType, "学习");
} }
ShowImage(hv_ExpDefaultWinHandle, ho_Image, ho_SymbolXLDs); ShowImage(hv_ExpDefaultWinHandle, ho_Image, ho_SymbolXLDs);
ho_Image.Dispose(); //ho_Image.Dispose();
} }
if (findCode.Count >= codeCount || stopWatch.ElapsedMilliseconds > timeOutMs) if (findCode.Count >= codeCount || stopWatch.ElapsedMilliseconds > timeOutMs)
{ {
......
...@@ -17,7 +17,7 @@ namespace CodeLibrary ...@@ -17,7 +17,7 @@ namespace CodeLibrary
public static List<CodeInfo> Decoder(ref Bitmap bmap) public static List<CodeInfo> Decoder(ref Bitmap bmap)
{ {
List<CodeInfo> codelist = new List<CodeInfo>(); List<CodeInfo> codelist = new List<CodeInfo>();
lock (DecoderLocker) //lock (DecoderLocker)
{ {
try try
{ {
......
 using Asa;
using Asa;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -26,7 +25,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,7 +25,7 @@ namespace OnlineStore.DeviceLibrary
{ {
isInit = true; isInit = true;
agvClient = new Asa.AgvClient(ServerIp); agvClient = new Asa.AgvClient(ServerIp);
agvClient.CancelState = true; agvClient.CancelState = false;
agvClient.Log += AgvClient_Log; agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive; agvClient.Arrive += AgvClient_Arrive;
agvClient.Ready += AgvClient_Ready; agvClient.Ready += AgvClient_Ready;
...@@ -39,7 +38,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -39,7 +38,7 @@ namespace OnlineStore.DeviceLibrary
foreach (string str in NodeList) foreach (string str in NodeList)
{ {
SetStatus(str); SetStatus(str);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -54,6 +53,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -54,6 +53,7 @@ namespace OnlineStore.DeviceLibrary
if (agvClient != null) if (agvClient != null)
{ {
agvClient.CancelState = isCancel; agvClient.CancelState = isCancel;
LogUtil.info($"agvClient.CancelState = {isCancel}");
} }
} }
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false) public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false)
......
...@@ -193,11 +193,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -193,11 +193,9 @@ namespace OnlineStore.DeviceLibrary
if (String.IsNullOrEmpty(MoveInfo.MoveParam.WareCode)) if (String.IsNullOrEmpty(MoveInfo.MoveParam.WareCode))
{ {
MoveInfo.MoveParam.IsNgReel = true; MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = "无有效条码"; MoveInfo.MoveParam.NgMsg = "无有效条码NG";
MoveInfo.MoveParam.TargetPosType = 1; MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 无有效条码,从XRay放到NG箱:" + MoveInfo.MoveParam.ToStr()); WorkLog(" 无有效条码,从XRay放到NG箱:" + MoveInfo.MoveParam.ToStr());
string outF = "无有效条码NG.";
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, outF);
} }
else if (SServerManager.CanConnect()) else if (SServerManager.CanConnect())
{ {
...@@ -215,8 +213,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -215,8 +213,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.TargetPosType = 1; MoveInfo.MoveParam.TargetPosType = 1;
MoveInfo.MoveParam.IsNgReel = true; MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg; MoveInfo.MoveParam.NgMsg = msg;
//RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, MoveInfo.MoveParam.NgMsg);
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, msg);
} }
} }
else { else {
...@@ -267,6 +264,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -267,6 +264,8 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.IB23_ShelfOut)) else if (MoveInfo.IsStep(StepEnum.IB23_ShelfOut))
{ {
WarnMsg = "";
alarmType = AlarmType.None;
WorkLog("上料结束"); WorkLog("上料结束");
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
......
...@@ -96,6 +96,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -96,6 +96,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("Reset 开始重置 "); LogInfo("Reset 开始重置 ");
runStatus = RobotRunStatus.Reset; runStatus = RobotRunStatus.Reset;
MoveInfo.NewMove(RobotMoveType.Reset); MoveInfo.NewMove(RobotMoveType.Reset);
getretry = 0;
StartReset(); StartReset();
SetAllTimer(true); SetAllTimer(true);
return true; return true;
......
...@@ -160,28 +160,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -160,28 +160,32 @@ namespace OnlineStore.DeviceLibrary
getretry = 0; getretry = 0;
MoveInfo.NextMoveStep(StepEnum.IW08_WaitAxisCheck); MoveInfo.NextMoveStep(StepEnum.IW08_WaitAxisCheck);
} }
else if (getretry>3){
WorkLog("取料: 重试失败");
MoveInfo.NextMoveStep(StepEnum.IW08_WaitAxisCheck);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(it, IO_VALUE.LOW));
}
else if (MoveInfo.IsTimeOut(4)) else if (MoveInfo.IsTimeOut(4))
{ {
getretry++; getretry++;
MoveInfo.NextMoveStep(StepEnum.IW50_InOutToP2); if (getretry > 3)
WorkLog("取料: 开始复位 第"+ getretry+"次"); {
var b = LeftBatchMove; WorkLog("取料: 重试失败");
if (MoveInfo.MoveParam.InPosType.Equals(2)) MoveInfo.NextMoveStep(StepEnum.IW08_WaitAxisCheck);
b = RightBatchMove; MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(it, IO_VALUE.LOW));
int xpos = b.BatchAxis.GetAclPosition() - Config.Height_ChangeValue * 50; }
if (xpos < b.BatchAxisP1) else
xpos = b.BatchAxisP1; {
b.BatchAxis.AbsMove(MoveInfo, xpos, Config.BatchAxis_P3Speed); MoveInfo.NextMoveStep(StepEnum.IW50_InOutToP2);
WorkLog("取料: 开始重试 第" + getretry + "次");
var b = LeftBatchMove;
if (MoveInfo.MoveParam.InPosType.Equals(2))
b = RightBatchMove;
int xpos = b.BatchAxis.GetAclPosition() - Config.Height_ChangeValue * 50;
if (xpos < b.BatchAxisP1)
xpos = b.BatchAxisP1;
b.BatchAxis.AbsMove(MoveInfo, xpos, Config.BatchAxis_P3Speed);
}
} }
} }
else if (MoveInfo.IsStep(StepEnum.IW08_WaitAxisCheck)) else if (MoveInfo.IsStep(StepEnum.IW08_WaitAxisCheck))
{ {
getretry = 0;
MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition); MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition);
if (MoveInfo.MoveParam.InPosType.Equals(1)) if (MoveInfo.MoveParam.InPosType.Equals(1))
{ {
...@@ -270,6 +274,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -270,6 +274,9 @@ namespace OnlineStore.DeviceLibrary
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, outF); RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, outF);
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed); MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
} }
if (MoveInfo.MoveParam.IsNgReel) {
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, MoveInfo.MoveParam.NgMsg);
}
// }else if (MoveInfo.IsTimeOut(120)) // }else if (MoveInfo.IsTimeOut(120))
//{ //{
// WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒"; // WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒";
...@@ -333,7 +340,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -333,7 +340,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut)) else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut))
{ {
TickLog("等待XRay可放料", true); //TickLog("等待XRay可放料", true);
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax); MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo(); RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo();
WorkLog("->XRay:夹料气缸放松,更新XRay入口料盘:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr(), 1); WorkLog("->XRay:夹料气缸放松,更新XRay入口料盘:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr(), 1);
...@@ -389,10 +396,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -389,10 +396,11 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
//放料重试复位
else if (MoveInfo.IsStep(StepEnum.IW50_InOutToP2)) else if (MoveInfo.IsStep(StepEnum.IW50_InOutToP2))
{ {
MoveInfo.NextMoveStep(StepEnum.IW51_Clamping_Relax); MoveInfo.NextMoveStep(StepEnum.IW51_Clamping_Relax);
WorkLog("取料: 复位 进出轴上下轴到P2"); WorkLog("取料: 重试复位 进出轴上下轴到P2");
InOutAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Inout_P2(Config), Config.InoutAxis_P2Speed); InOutAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Inout_P2(Config), Config.InoutAxis_P2Speed);
UpdownAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Updown_P5(Config), Config.UpdownAxis_P2Speed); UpdownAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Updown_P5(Config), Config.UpdownAxis_P2Speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
...@@ -400,13 +408,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -400,13 +408,13 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW51_Clamping_Relax)) else if (MoveInfo.IsStep(StepEnum.IW51_Clamping_Relax))
{ {
MoveInfo.NextMoveStep(StepEnum.IW52_InOutToP1); MoveInfo.NextMoveStep(StepEnum.IW52_InOutToP1);
WorkLog("取料: 复位 气缸放松,UpdownAxisPos=" + UpdownAxis.GetAclPosition()); WorkLog("取料: 重试复位 气缸放松,UpdownAxisPos=" + UpdownAxis.GetAclPosition());
CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax); CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
} }
else if (MoveInfo.IsStep(StepEnum.IW52_InOutToP1)) else if (MoveInfo.IsStep(StepEnum.IW52_InOutToP1))
{ {
WorkLog("取料: 复位 升降轴到待机点P1,进出轴返回P1"); WorkLog("取料: 重试复位 升降轴到待机点P1,进出轴返回P1");
MoveInfo.NextMoveStep(StepEnum.IW53_ResetFinish); MoveInfo.NextMoveStep(StepEnum.IW53_ResetFinish);
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed); UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed);
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P1, Config.InoutAxis_P1Speed); InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P1, Config.InoutAxis_P1Speed);
...@@ -422,7 +430,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -422,7 +430,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.IW53_ResetFinish)) else if (MoveInfo.IsStep(StepEnum.IW53_ResetFinish))
{ {
WorkLog("放料复位完成"); WorkLog("放料重试复位完成");
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
} }
......
...@@ -806,7 +806,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -806,7 +806,7 @@ namespace OnlineStore.DeviceLibrary
if (canLabel) if (canLabel)
{ {
ShelfMoveInfo.NextMoveStep(StepEnum.OS_26_LabelOk); ShelfMoveInfo.NextMoveStep(StepEnum.OS_26_LabelOk);
SecTickLog("贴标完成1"); //SecTickLog("贴标完成1");
ShelfWorkLog("贴标完成"); ShelfWorkLog("贴标完成");
} }
} }
...@@ -822,7 +822,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -822,7 +822,7 @@ namespace OnlineStore.DeviceLibrary
//else if (SecMoveInfo.IsStep(StepEnum.OL19_XYRBackToP2)) //else if (SecMoveInfo.IsStep(StepEnum.OL19_XYRBackToP2))
//{ //{
TimeSpan span = DateTime.Now - SecMoveInfo.MoveStartTime; TimeSpan span = DateTime.Now - SecMoveInfo.MoveStartTime;
SecTickLog("贴标完成2"); SecTickLog("贴标完成");
LogUtil.info(SecMoveInfo.Name + " 贴标结束, 耗时(" + FormUtil.GetSpanStr(span) + ")"); LogUtil.info(SecMoveInfo.Name + " 贴标结束, 耗时(" + FormUtil.GetSpanStr(span) + ")");
SecMoveInfo.EndMove(); SecMoveInfo.EndMove();
} }
......
...@@ -326,12 +326,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -326,12 +326,19 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.XW23_OutLineRun)) else if (MoveInfo.IsStep(StepEnum.XW23_OutLineRun))
{ {
MoveInfo.NextMoveStep(StepEnum.XW24_WaitOutCheck); //if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH))
WorkLog("料盘处理:继续转动3秒后,等待出口皮带线检测到料盘", 1); //{
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH); MoveInfo.NextMoveStep(StepEnum.XW24_WaitOutCheck);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH); WorkLog("料盘处理:继续转动3秒后,等待出口皮带线检测到料盘", 1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH)); IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH));
// }
//else if (MoveInfo.IsTimeOut(10)) {
// WorkLog("料盘处理:没有检测到料盘", 1);
// MoveInfo.NextMoveStep(StepEnum.XW24_WaitOutCheck);
//}
} }
else if (MoveInfo.IsStep(StepEnum.XW24_WaitOutCheck)) else if (MoveInfo.IsStep(StepEnum.XW24_WaitOutCheck))
{ {
...@@ -341,7 +348,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -341,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
WorkLog("料盘处理: 中间皮带线先停止,出口皮带线 再转动3秒,挡停先下降"); WorkLog("料盘处理: 中间皮带线先停止,出口皮带线 再转动3秒,挡停先下降");
IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW); IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH,3000);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH));
//CylinderMove(null, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up); //CylinderMove(null, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
...@@ -358,7 +365,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -358,7 +365,7 @@ namespace OnlineStore.DeviceLibrary
Work_ReelInfo = new ReelInfo(); Work_ReelInfo = new ReelInfo();
WorkLog("料盘处理:清空 Work_ReelInfo,更新Out_ReelInfo【" + Out_ReelInfo.ToStr() + "】 ,中间皮带线,出口皮带线停止,出口门关闭,挡停下降"); WorkLog("料盘处理:清空 Work_ReelInfo,更新Out_ReelInfo【" + Out_ReelInfo.ToStr() + "】 ,中间皮带线,出口皮带线停止,出口门关闭,挡停下降");
IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW); IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.LOW); //IOMove(IO_Type.X_OLine_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up); CylinderMove(MoveInfo, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down); CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
} }
...@@ -371,15 +378,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -371,15 +378,6 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.XW26_OutLineStop)) else if (MoveInfo.IsStep(StepEnum.XW26_OutLineStop))
{ {
// MoveInfo.NextMoveStep(StepEnum.XW27_OutDoorClose);
// WorkLog("料盘处理:中间皮带线,出口皮带线停止,出口门关闭,挡停下降");
// IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW);
// IOMove(IO_Type.X_OLine_Run, IO_VALUE.LOW);
// CylinderMove(MoveInfo, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
// CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
//}
//else if (MoveInfo.IsStep(StepEnum.XW27_OutDoorClose))
//{
TimeSpan span = DateTime.Now - MoveInfo.MoveStartTime; TimeSpan span = DateTime.Now - MoveInfo.MoveStartTime;
runStatus = RobotRunStatus.Runing; runStatus = RobotRunStatus.Runing;
TickLog("点料完成"); TickLog("点料完成");
...@@ -684,16 +682,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -684,16 +682,18 @@ namespace OnlineStore.DeviceLibrary
else { else {
count = 0; count = 0;
} }
string resfilename = Path.GetFileNameWithoutExtension(fileP)+ "-Mark.png"; if (result == 0)
string root = Path.Combine(Application.StartupPath, "ResOut"); {
var n = DateTime.Now; string resfilename = Path.GetFileNameWithoutExtension(fileP) + "-Mark.png";
string destdir = Path.Combine(root, n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString()); string root = Path.Combine(Application.StartupPath, "ResOut");
Directory.CreateDirectory(destdir); var n = DateTime.Now;
resfile = Path.Combine(destdir, resfilename); string destdir = Path.Combine(root, n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString());
if (File.Exists(resfile)) Directory.CreateDirectory(destdir);
File.Delete(resfile); resfile = Path.Combine(destdir, resfilename);
Directory.Move(Path.Combine(root, resfilename), resfile); if (File.Exists(resfile))
File.Delete(resfile);
Directory.Move(Path.Combine(root, resfilename), resfile);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary
if (!findRightCode || !nosave) if (!findRightCode || !nosave)
{ {
//SaveImageToFile(deviceName, cameraName, ho_Image); //SaveImageToFile(deviceName, cameraName, ho_Image);
SaveImageToFile(deviceName, cameraName, bmp); SaveImageToFile(deviceName+(!nosave?"eyem":""), cameraName, bmp);
} }
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
...@@ -398,7 +398,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -398,7 +398,12 @@ namespace OnlineStore.DeviceLibrary
string[] codearray = ReplaceCode(cc).Split(';'); string[] codearray = ReplaceCode(cc).Split(';');
if (codearray.Length >= 4) if (codearray.Length >= 4)
{ {
if (codearray[2].StartsWith("B") && codearray[2].Length >= 13 && codearray[3].StartsWith("R")) if (codearray[0].StartsWith("L") &&
codearray[1].StartsWith("E") &&
codearray[2].StartsWith("B") &&
codearray[2].Length >= 13)
// if (codearray[2].StartsWith("B") && codearray[2].Length >= 13 && codearray[3].StartsWith("R"))
{ {
string tc = codearray[2].Substring(1, 12) + ";" + codearray[3]; string tc = codearray[2].Substring(1, 12) + ";" + codearray[3];
if (!targetCode.Contains(tc)) if (!targetCode.Contains(tc))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!