Commit 4a15362d 刘韬

0707

1 个父辈 305cfba8
正在显示 41 个修改的文件 包含 930 行增加250 行删除
...@@ -29,11 +29,13 @@ namespace DeviceLibrary ...@@ -29,11 +29,13 @@ namespace DeviceLibrary
//public bool UserPause { get; set; } //public bool UserPause { get; set; }
public bool IgnoreSafecheck { get; set; } public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; } public bool IgnoreGratingSignal { get; set; }
public int NGBox_Count { get => nGBox_Count; set { nGBox_Count = value; Properties.Settings1.Default.NGBox_Count = value; Properties.Settings1.Default.Save(); } }
public int MSDBox_Count { get => mSDBox_Count; set { mSDBox_Count = value; Properties.Settings1.Default.MSDBox_Count = value; Properties.Settings1.Default.Save(); } }
public int PaperBox_Count { get => paperBox_Count; set { mSDBox_Count = value; Properties.Settings1.Default.PaperBox_Count = value; Properties.Settings1.Default.Save(); } }
private int nGBox_Count = 0;
public int NGBox_Count=0; private int mSDBox_Count = 0;
public int MSDBox_Count = 0; private int paperBox_Count = 0;
public int PaperBox_Count = 0;
public bool Init(out string msg) public bool Init(out string msg)
{ {
...@@ -46,6 +48,10 @@ namespace DeviceLibrary ...@@ -46,6 +48,10 @@ namespace DeviceLibrary
MoveInfo = new MoveInfo(DeviceName); MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo; ResetMoveInfo = MoveInfo;
NGBox_Count = Properties.Settings1.Default.NGBox_Count;
MSDBox_Count = Properties.Settings1.Default.MSDBox_Count;
PaperBox_Count = Properties.Settings1.Default.PaperBox_Count;
} }
catch (Exception e) catch (Exception e)
{ {
......
using CodeLibrary; using CodeLibrary;
using Newtonsoft.Json;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -14,12 +15,20 @@ namespace DeviceLibrary ...@@ -14,12 +15,20 @@ namespace DeviceLibrary
{ {
public partial class LabelMachine public partial class LabelMachine
{ {
SolidBrush blue = new SolidBrush(Color.BlueViolet);
SolidBrush red = new SolidBrush(Color.Red);
SolidBrush yellow = new SolidBrush(Color.Yellow);
SolidBrush AliceBlue = new SolidBrush(Color.AliceBlue);
Font font = new Font(FontFamily.GenericSansSerif, 60);
Pen Greenpen = new Pen(Color.Green, 10);
//Size pointsize = new Size(15, 15);
int pointsize = 16;
/// <summary> /// <summary>
/// /// 计算贴标位置
/// </summary> /// </summary>
/// <param name="Label_Pix_Point"></param> /// <param name="Label_Pix_Point">二维码坐标</param>
/// <returns>XY轴贴标点,R轴角度</returns> /// <returns>XY轴贴标点,R轴角度,是否反转标签</returns>
public (Point,double,bool) ClacLabel(Point Label_Pix_Point) public (Point, double, bool) ClacLabel(Point Label_Pix_Point)
{ {
bool ReverseLabel = false; bool ReverseLabel = false;
int Right_Batch_X = Config.Right_Batch_X; int Right_Batch_X = Config.Right_Batch_X;
...@@ -36,7 +45,7 @@ namespace DeviceLibrary ...@@ -36,7 +45,7 @@ namespace DeviceLibrary
//二维码坐标 //二维码坐标
//Point Label_Pix_Point = new Point(X, Y); //Point Label_Pix_Point = new Point(X, Y);
//中心点到二维码角度,右侧为0度,+180转换到左侧为0度 //中心点到二维码角度,右侧为0度,+180转换到左侧为0度
var angle = Common.getAngle(Center_Pix_Point, Label_Pix_Point)+180; var angle = Common.getAngle(Center_Pix_Point, Label_Pix_Point) + 180;
//中心点到二维码距离 //中心点到二维码距离
var distance = Common.distance(Center_Pix_Point, Label_Pix_Point); var distance = Common.distance(Center_Pix_Point, Label_Pix_Point);
//中心点到标签中心的角度 //中心点到标签中心的角度
...@@ -49,7 +58,7 @@ namespace DeviceLibrary ...@@ -49,7 +58,7 @@ namespace DeviceLibrary
if (labelCenterAngle < 0) if (labelCenterAngle < 0)
labelCenterAngle = 360 + labelCenterAngle; labelCenterAngle = 360 + labelCenterAngle;
//标签中心的坐标 //标签中心的坐标
var labelCenter =Common.PointWithAngle(Center_Pix_Point, labelCenterAngle - 180, ll); var labelCenter = Common.PointWithAngle(Center_Pix_Point, labelCenterAngle - 180, ll);
/* /*
//从二维码坐标开始, 往中心点坐标推移一定的距离,获得推移后的坐标 //从二维码坐标开始, 往中心点坐标推移一定的距离,获得推移后的坐标
Point AxisPixPoint = Common.PointWithAngle(Label_Pix_Point, angle, Config.Label_R_Offset_Pixel); Point AxisPixPoint = Common.PointWithAngle(Label_Pix_Point, angle, Config.Label_R_Offset_Pixel);
...@@ -66,11 +75,11 @@ namespace DeviceLibrary ...@@ -66,11 +75,11 @@ namespace DeviceLibrary
//贴标位置轴的像素坐标 //贴标位置轴的像素坐标
Point AxisPixPoint = Common.PointWithAngle(labelCenter, labelCenterAngle, Config.Label_R_Offset_Pixel); Point AxisPixPoint = Common.PointWithAngle(labelCenter, labelCenterAngle, Config.Label_R_Offset_Pixel);
//计算贴标角度的脉冲值 //计算贴标角度的脉冲值
if (labelCenterAngle > 335) //if (labelCenterAngle > Config.Label_R_MaxAngle)
{ //{
ReverseLabel = true; // ReverseLabel = true;
labelCenterAngle -= 180; // labelCenterAngle -= 180;
} //}
int labelAxisPos = (int)((double)Config.Label_R_360 / 335 * (double)labelCenterAngle); int labelAxisPos = (int)((double)Config.Label_R_360 / 335 * (double)labelCenterAngle);
MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelCenterAngle},R轴:{labelAxisPos}"); MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelCenterAngle},R轴:{labelAxisPos}");
//计算贴标像素点位与图像中心点的差 //计算贴标像素点位与图像中心点的差
...@@ -95,26 +104,20 @@ namespace DeviceLibrary ...@@ -95,26 +104,20 @@ namespace DeviceLibrary
} }
return (p1, labelAxisPos, ReverseLabel); return (p1, labelAxisPos, ReverseLabel);
} }
void printLabelDebugBitmap(Bitmap srcbitmap, Point Label_Pix_Point, Point Center_Pix_Point, Point AxisPixPoint, double angle, Point AxisP1,double labelAngle,double labelAxisPos, Point labelCenter) { void printLabelDebugBitmap(Bitmap srcbitmap, Point Label_Pix_Point, Point Center_Pix_Point, Point AxisPixPoint, double angle, Point AxisP1, double labelAngle, double labelAxisPos, Point labelCenter)
SolidBrush blue = new SolidBrush(Color.BlueViolet); {
SolidBrush red = new SolidBrush(Color.Red);
SolidBrush yeelow = new SolidBrush(Color.Yellow);
SolidBrush AliceBlue = new SolidBrush(Color.AliceBlue);
Font font = new Font(FontFamily.GenericSansSerif, 60);
Pen Greenpen = new Pen(Color.Green, 10);
Bitmap bitmap = new Bitmap(srcbitmap.Width, srcbitmap.Height, PixelFormat.Format32bppArgb); Bitmap bitmap = new Bitmap(srcbitmap.Width, srcbitmap.Height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap); Graphics g = Graphics.FromImage(bitmap);
Size pointsize = new Size(30, 30);
g.DrawImage(srcbitmap, 0, 0); g.DrawImage(srcbitmap, 0, 0);
srcbitmap.Dispose(); srcbitmap.Dispose();
g.FillEllipse(blue, new Rectangle(Label_Pix_Point, pointsize)); g.FillEllipse(blue, Common.EllipseCenter(Label_Pix_Point, pointsize));
g.FillEllipse(yeelow, new Rectangle(Center_Pix_Point, pointsize)); g.FillEllipse(yellow, Common.EllipseCenter(Center_Pix_Point, pointsize));
g.FillEllipse(red, new Rectangle(AxisPixPoint, pointsize)); g.FillEllipse(red, Common.EllipseCenter(AxisPixPoint, pointsize));
g.FillEllipse(AliceBlue, new Rectangle(labelCenter, pointsize)); g.FillEllipse(AliceBlue, Common.EllipseCenter(labelCenter, pointsize));
g.DrawLine(Greenpen, AxisPixPoint, Label_Pix_Point); g.DrawLine(Greenpen, AxisPixPoint, Label_Pix_Point);
g.DrawString($"angle:{angle}", font, blue, 0, 0); g.DrawString($"angle:{angle}", font, blue, 0, 0);
...@@ -123,9 +126,138 @@ namespace DeviceLibrary ...@@ -123,9 +126,138 @@ namespace DeviceLibrary
g.Save(); g.Save();
Directory.CreateDirectory("/image/LabelDebug/"); Directory.CreateDirectory("/image/LabelDebug/");
bitmap.Save("/image/LabelDebug/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")+".jpg",ImageFormat.Jpeg); bitmap.Save("/image/LabelDebug/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
g.Dispose(); g.Dispose();
} }
NamedPipeClient namedPipeClient = new NamedPipeClient("OcrService", ".");
/// <summary>
/// 计算贴标位置
/// </summary>
/// <param name="Label_Pix_Point">二维码坐标</param>
/// <returns>XY轴贴标点,R轴角度,是否反转标签</returns>
public (Point, double, bool) ClacLabel2(Point Label_Pix_Point, Bitmap bitmap, ReelParam reelParam)
{
OcrProcess.Run();
Point qrcenter = Label_Pix_Point;
//string file = @"D:\853string\Image_20210604173619489.bmp";
//图像剪切范围矩形
var orgCrop = Rectangle.Inflate(new Rectangle(qrcenter, new Size(1, 1)), 410, 410);
//计算剪切后的二维码中心坐标点
qrcenter.X = qrcenter.X - orgCrop.X;
qrcenter.Y = qrcenter.Y - orgCrop.Y;
///var bitmap = new Bitmap(file);
var b1 = Common.ImageCrop(bitmap, orgCrop);
//pictureBox1.Image = b1;// crop(bitmap, new Rectangle(0,0,bitmap.Width,bitmap.Height));
bitmap.Dispose();
Directory.CreateDirectory("/image/LabelDebug/");
string filename = "/image/LabelDebug/" + reelParam.ReeID + "-" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".temp.bmp";
b1.Save(filename);
//调用算法服务
var resp = namedPipeClient.Request(filename);
MoveInfo.log($"贴标OCR file:{filename}, 计算结果:" + resp);
//File.Delete(file + ".temp.bmp");
var l = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
List<TextBlock> newlist = new List<TextBlock>();
//过滤合规数据
foreach (var t in l.ToArray())
{
//Console.WriteLine(Sim(t.Text, "PN+VC63.33034.L0L-018139"));
var s1 = Common.Sim(t.Text.Length >= 27 ? t.Text.Substring(0, 27) : t.Text, "PN+VC:"+ reelParam.PN);
var s2 = Common.Sim(t.Text.Length >= 6 ? t.Text.Substring(0, 6) : t.Text, "PN+VC:");
var s3 = Common.Sim(t.Text.Length >= 7 ? t.Text.Substring(0, 7) : "", "VPN:RTL");
MoveInfo.log($"text:{t.Text}");
MoveInfo.log($"s1:{s1}, s2:{s2}, s3:{s3}");
if ((s1 > 0.7 || s2 > 0.9) && s3 < 0.7 && t.Text.Length < 33)
{
newlist.Add(t);
MoveInfo.log($"s1:{s1}, s2:{s2} , {t.Text}");
}
}
//List<Point> RightPoint
Point labelPoint = Point.Empty;
double labelAngle = 0;
double lastDistance = 0;
TextBlock lasttextBlock = new TextBlock();
if (newlist.Count == 0)
{
MoveInfo.log($"贴标OCR 筛选结果失败");
return ClacLabel(Label_Pix_Point);
}
MoveInfo.log($"贴标OCR 筛选结果:" + JsonConvert.SerializeObject(newlist));
Graphics graphics = Graphics.FromImage(b1);
graphics.FillEllipse(AliceBlue, Common.EllipseCenter(qrcenter,pointsize));
foreach (var lp in newlist)
{
//textBox1.Text += JsonConvert.SerializeObject(lp) + "\r\n";
//字符起始位置左下角定位点
var sp = lp.BoxPoints;
var (dc, topindex) = Common.DistanceWithBoxAndPoint(sp, qrcenter);
if (dc > lastDistance)
{
lastDistance = dc;
lasttextBlock = lp;
var lf = (topindex == 0) ? 3 : topindex - 1;//左下角点位
var ld = (lf == 0) ? 3 : lf - 1;//横向点位
labelPoint = sp[lf];
labelAngle = Common.getAngle(sp[lf], sp[ld]) + 90;
}
for (int i = 0; i < lp.BoxPoints.Count; i++)
{
if (i == 0)
graphics.FillEllipse(blue, Common.EllipseCenter(lp.BoxPoints[i], pointsize));
else
graphics.FillEllipse(red, Common.EllipseCenter(lp.BoxPoints[i], pointsize));
}
}
graphics.FillEllipse(yellow, Common.EllipseCenter(labelPoint, pointsize) );
MoveInfo.log($"贴标OCR lasttextBlock:" + JsonConvert.SerializeObject(lasttextBlock));
//graphics.FillEllipse(red, new Rectangle(lc.X, lc.Y, pointsize.Width, pointsize.Height));
//纵向偏移
labelPoint = Common.PointWithAngle(labelPoint, labelAngle, Config.Label_Offset_Y);
//横向偏移
labelPoint = Common.PointWithAngle(labelPoint, labelAngle - 90, Config.Label_Offset_X);
graphics.FillEllipse(yellow, Common.EllipseCenter(labelPoint, pointsize));
graphics.Save();
graphics.Dispose();
b1.Save(filename+".result.jpg",ImageFormat.Jpeg);
b1.Dispose();
if (labelAngle < 0)
labelAngle = 360 + labelAngle;
//计算贴标角度的脉冲值
if (labelAngle > Config.Label_R_MaxAngle)
{
if (labelAngle > Config.Label_R_MaxAngle + (360 - labelAngle) / 2)
labelAngle = 0;
else
labelAngle = Config.Label_R_MaxAngle;
}
int labelAxisPos = (int)((double)Config.Label_R_360 / Config.Label_R_MaxAngle * (double)labelAngle);
//换算为剪切前的像素位置
labelPoint.Offset(orgCrop.X, orgCrop.Y);
//计算贴标像素点位与图像中心点的差
Point p2 = new Point(labelPoint.X - Config.Right_Batch_X, labelPoint.Y - Config.Right_Batch_Y);
//MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelAngle},R轴:{labelAxisPos},贴标计算像素位置:{labelPoint},换算全图像素位置:{p1}");
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
var x = (int)(p2.X * Config.Cam_Pixel_X_Ratio) + Config.Label_X_Base;
var y = (int)(p2.Y * Config.Cam_Pixel_Y_Ratio) + Config.Label_Y_Base;
Point p1 = new Point(x, y);
MoveInfo.log($"计算结果,Label_R_360:{Config.Label_R_360},贴标角度:{labelAngle},R轴:{labelAxisPos},贴标计算像素位置:{p2},换算伺服脉冲位置:{p1}");
return (p1, labelAxisPos, false);
}
} }
} }
...@@ -59,6 +59,16 @@ namespace DeviceLibrary ...@@ -59,6 +59,16 @@ namespace DeviceLibrary
} }
return true; return true;
} }
public override void Run()
{
base.Run();
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH);
}
public override void Stop()
{
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW);
base.Stop();
}
protected override void LoopProcess() protected override void LoopProcess()
{ {
mstart = true; mstart = true;
...@@ -109,7 +119,6 @@ namespace DeviceLibrary ...@@ -109,7 +119,6 @@ namespace DeviceLibrary
Alarm(AlarmType.SuddenStop); Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning); Msg.add("急停中", MsgLevel.warning);
ok = false; ok = false;
} }
else if (alarmType == AlarmType.SuddenStop) else if (alarmType == AlarmType.SuddenStop)
{ {
......
...@@ -16,7 +16,7 @@ namespace DeviceLibrary ...@@ -16,7 +16,7 @@ namespace DeviceLibrary
public void test() { public void test() {
Console.WriteLine(preReelParam); Console.WriteLine(preReelParam);
} }
double labelAxisPos = 0; double labelRAxisPos = 0;
Point p1; Point p1;
bool ReverseLabel=false; bool ReverseLabel=false;
//是否允许进入贴标线体 //是否允许进入贴标线体
...@@ -47,7 +47,7 @@ namespace DeviceLibrary ...@@ -47,7 +47,7 @@ namespace DeviceLibrary
var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check); var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check);
//LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}"); //LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}");
if (Tray_Check.Equals(IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam!=null) if (Tray_Check.Equals(IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP); MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = preReelParam; MoveInfo.ReelParam = preReelParam;
...@@ -55,14 +55,28 @@ namespace DeviceLibrary ...@@ -55,14 +55,28 @@ namespace DeviceLibrary
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr()); MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
} }
//else if (Tray_Check.Equals(IO_VALUE.HIGH) && MoveInfo.IsTimeOut(30))
//{
// MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
// MoveInfo.ReelParam.IsNg = true;
// MoveInfo.ReelParam.NgMsg = "超时NG:没有等到料盘信息";
// MoveInfo.log("检测到料盘 超时NG:没有等到料盘信息");
//}
else if (Tray_Check.Equals(IO_VALUE.HIGH)) {
Msg.add($"已检测到料盘, 等待料盘数据信息到位", MsgLevel.info);
}
else if (Label_TaryStop_Check.Equals(IO_VALUE.HIGH)) else if (Label_TaryStop_Check.Equals(IO_VALUE.HIGH))
{ {
Msg.add("贴标区有料未送出", MsgLevel.warning); Msg.add("贴标区有料未送出", MsgLevel.warning);
MoveInfo.log("贴标区有料未送出"); MoveInfo.log("贴标区有料未送出");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
} }
else { else
{
Msg.add($"等待上料区进入料盘", MsgLevel.info); Msg.add($"等待上料区进入料盘", MsgLevel.info);
MoveInfo.log("等待上料区进入料盘"); MoveInfo.log("等待上料区进入料盘");
MoveInfo.NextMoveStep(MoveStep.Lbl_01_Wait_ATray);
} }
break; break;
case MoveStep.Lbl_02_StopUP: case MoveStep.Lbl_02_StopUP:
...@@ -80,29 +94,17 @@ namespace DeviceLibrary ...@@ -80,29 +94,17 @@ namespace DeviceLibrary
MoveInfo.log("上料区阻挡上升,贴标区阻挡下降"); MoveInfo.log("上料区阻挡上升,贴标区阻挡下降");
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH); CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.LOW); CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.LOW);
ReelLocation reelLocation;
if (RobotManage.offlinemode)
{
reelLocation = RobotManage.offlinereelLocation;
//printTask = DoPrint(MoveInfo.ReelParam, false);
}
else
{
reelLocation = ServerConn.DetermineReelStorageLocation(MoveInfo.ReelParam.WareCode);
}
var reelLocation = ServerConn.DetermineReelStorageLocation(MoveInfo.ReelParam.WareCode);
//if (reelLocation == null)
//{
// reelLocation = new ReelLocation();
// reelcount++;
// switch (reelcount % 4){
// case 1:
// reelLocation.isTower = "true";
// break;
// case 2:
// reelLocation.isVTTower = "true";
// break;
// case 3:
// reelLocation.isVacuum = "true";
// break;
// case 4:
// break;
// }
//}
//reelLocation = new ReelLocation();
//reelLocation.isTower = "true";
if (reelLocation == null) if (reelLocation == null)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut); MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
...@@ -134,8 +136,10 @@ namespace DeviceLibrary ...@@ -134,8 +136,10 @@ namespace DeviceLibrary
MoveInfo.ReelParam.logresult(); MoveInfo.ReelParam.logresult();
MoveInfo.log("服务器没有返回明确目标"); MoveInfo.log("服务器没有返回明确目标");
} }
//if (!MoveInfo.ReelParam.IsNg) if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg)
// printTask = DoPrint(MoveInfo.ReelParam, false); {
printTask = DoPrint(MoveInfo.ReelParam, false);
}
} }
break; break;
case MoveStep.Lbl_03_LineRun: case MoveStep.Lbl_03_LineRun:
...@@ -153,32 +157,31 @@ namespace DeviceLibrary ...@@ -153,32 +157,31 @@ namespace DeviceLibrary
break; break;
case MoveStep.Lbl_04_LineStopWait: case MoveStep.Lbl_04_LineStopWait:
MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop); MoveInfo.NextMoveStep(MoveStep.Lbl_04_LineStop);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break; break;
case MoveStep.Lbl_04_LineStop: case MoveStep.Lbl_04_LineStop:
MoveInfo.NextMoveStep(MoveStep.Lbl_05_Get_Reelinfo); MoveInfo.NextMoveStep(MoveStep.Lbl_05_ScanCode);
MoveInfo.log($"线体1,2停止运行,阻挡上升,并拍照 Label_TaryStop_Check:{IOValue(IO_Label_Type.Label_TaryStop_Check)}"); MoveInfo.log($"线体1,2停止运行,阻挡上升,并拍照 Label_TaryStop_Check:{IOValue(IO_Label_Type.Label_TaryStop_Check)}");
IOMove(IO_Label_Type.Line1_Run, IO_VALUE.LOW); IOMove(IO_Label_Type.Line1_Run, IO_VALUE.LOW);
IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW); IOMove(IO_Label_Type.Line2_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW) ; CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.LOW) ;
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH); CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
break;
case MoveStep.Lbl_05_ScanCode:
MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
ScanTask = ScanCode(); ScanTask = ScanCode();
break; break;
case MoveStep.Lbl_05_Get_Reelinfo: case MoveStep.Lbl_06_Get_Reelinfo:
if (ScanTask.IsCompleted) if (ScanTask.IsCompleted)
{ {
var sr = ScanTask.Result; var (sr,bitmap) = ScanTask.Result;
if (sr.Count == 0) if (sr.Count == 0)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel); MoveInfo.NextMoveStep(MoveStep.Lbl_WaitCheckLabel);
MoveInfo.log($"未识别到有效二维码"); MoveInfo.log($"未识别到有效二维码");
//MoveInfo.ReelParam.IsNg = true;
//MoveInfo.ReelParam.NgMsg = "贴标区未识别到有效二维码";
//MoveInfo.ReelParam.logresult();
} }
else else
{ {
if (MoveInfo.ReelParam.WareCode != sr[0].CodeStr) if (MoveInfo.ReelParam.WareCode != sr[0].CodeStr)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut); MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
...@@ -204,13 +207,11 @@ namespace DeviceLibrary ...@@ -204,13 +207,11 @@ namespace DeviceLibrary
var y = 3648 - Label_Pix_Point.Y; var y = 3648 - Label_Pix_Point.Y;
Label_Pix_Point.X = x; Label_Pix_Point.X = x;
Label_Pix_Point.Y = y; Label_Pix_Point.Y = y;
(p1, labelAxisPos, ReverseLabel) = ClacLabel(Label_Pix_Point); //图像也旋转180度
//_labelAxisPos = labelAxisPos; bitmap.RotateFlip(RotateFlipType.Rotate180FlipNone);
//MoveInfo.NextMoveStep(MoveStep.Lbl_WaitPrint);
(p1, labelRAxisPos, ReverseLabel) = ClacLabel2(Label_Pix_Point,bitmap, MoveInfo.ReelParam);
} }
} }
else if (MoveInfo.IsTimeOut(20)) else if (MoveInfo.IsTimeOut(20))
{ {
...@@ -261,7 +262,7 @@ namespace DeviceLibrary ...@@ -261,7 +262,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.Lbl11_wait: case MoveStep.Lbl11_wait:
MoveInfo.NextMoveStep(MoveStep.Lbl11); MoveInfo.NextMoveStep(MoveStep.Lbl11);
Label_R_Axis.AbsMove(MoveInfo, (int)labelAxisPos, Config.Label_R_P2_speed); Label_R_Axis.AbsMove(MoveInfo, (int)labelRAxisPos, Config.Label_R_P2_speed);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.log("等待."); MoveInfo.log("等待.");
break; break;
......
...@@ -3,6 +3,7 @@ using OnlineStore.Common; ...@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -79,29 +80,30 @@ namespace DeviceLibrary ...@@ -79,29 +80,30 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 扫码线程 /// 扫码线程
/// </summary> /// </summary>
Task<List<CodeInfo>> ScanTask; Task<(List<CodeInfo>,Bitmap)> ScanTask;
Task<List<CodeInfo>> ScanCode() Task<(List<CodeInfo>, Bitmap)> ScanCode()
{ {
MoveInfo.log("开始贴标扫码线程"); MoveInfo.log("开始贴标扫码线程");
return Task.Run(new Func<List<CodeInfo>>(() => return Task.Run(new Func<(List<CodeInfo>, Bitmap)>(() =>
{ {
try try
{ {
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH); Bitmap bitmap;
Task.Delay(10).Wait(); //IOMove(IO_Label_Type.Camera_Led, IO_VALUE.HIGH);
List<CodeInfo> LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }); //Task.Delay(10).Wait();
List<CodeInfo> LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName },out bitmap);
if (LastCodeList.Count <= 0) if (LastCodeList.Count <= 0)
{ {
Task.Delay(500).Wait(); Task.Delay(500).Wait();
LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }); LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName });
} }
IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW); //IOMove(IO_Label_Type.Camera_Led, IO_VALUE.LOW);
return LastCodeList; return (LastCodeList,bitmap);
} }
catch { catch {
return new List<CodeInfo>(); return (new List<CodeInfo>(),null);
} }
})); }));
......
...@@ -41,7 +41,7 @@ namespace DeviceLibrary ...@@ -41,7 +41,7 @@ namespace DeviceLibrary
/// </summary> /// </summary>
protected bool mstart = false; protected bool mstart = false;
protected int stepDelaytime =300; protected int stepDelaytime =300;
public void Run() public virtual void Run()
{ {
if (!mstart) if (!mstart)
{ {
...@@ -51,7 +51,7 @@ namespace DeviceLibrary ...@@ -51,7 +51,7 @@ namespace DeviceLibrary
LogUtil.info(DeviceName + " 主线程已启动."); LogUtil.info(DeviceName + " 主线程已启动.");
GC.KeepAlive(thread); GC.KeepAlive(thread);
} }
public void Stop() public virtual void Stop()
{ {
LogUtil.info(DeviceName + " 停止设备."); LogUtil.info(DeviceName + " 停止设备.");
mstart = false; mstart = false;
......
...@@ -34,7 +34,8 @@ namespace DeviceLibrary ...@@ -34,7 +34,8 @@ namespace DeviceLibrary
Lbl_03_StopDown_and_wait, Lbl_03_StopDown_and_wait,
Lbl_04_LineStopWait, Lbl_04_LineStopWait,
Lbl_04_LineStop, Lbl_04_LineStop,
Lbl_05_Get_Reelinfo, Lbl_05_ScanCode,
Lbl_06_Get_Reelinfo,
//Lbl_01_StartPrint, //Lbl_01_StartPrint,
Lbl_WaitCheckLabel, Lbl_WaitCheckLabel,
Lbl_WaitPrint, Lbl_WaitPrint,
...@@ -118,7 +119,6 @@ namespace DeviceLibrary ...@@ -118,7 +119,6 @@ namespace DeviceLibrary
T1_09_ReleaseReel, T1_09_ReleaseReel,
T1_10_PutReelFinish, T1_10_PutReelFinish,
} }
......
...@@ -35,6 +35,8 @@ namespace DeviceLibrary ...@@ -35,6 +35,8 @@ namespace DeviceLibrary
public static ElectricGripper electricGripper; public static ElectricGripper electricGripper;
public static List<IRobot> robots = new List<IRobot>(); public static List<IRobot> robots = new List<IRobot>();
public static WistonAgvClient wistonAgvClient; public static WistonAgvClient wistonAgvClient;
public static bool offlinemode = false;
public static ReelLocation offlinereelLocation = new ReelLocation();
//static string baseDir = Application.StartupPath; //static string baseDir = Application.StartupPath;
public static void Init() { public static void Init() {
try try
...@@ -71,13 +73,15 @@ namespace DeviceLibrary ...@@ -71,13 +73,15 @@ namespace DeviceLibrary
else else
LogUtil.info("xray init ok"); LogUtil.info("xray init ok");
Thread.Sleep(500);
if (XRay.SetVC(ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current"))) if (XRay.SetVC(ConfigHelper.Config.Get("XRay_Voltage"), ConfigHelper.Config.Get("XRay_Current")))
{ {
msgs += $"X光电压电流设置失败:{ConfigHelper.Config.Get("XRay_Voltage")},{ConfigHelper.Config.Get("XRay_Current")}\n"; msgs += $"X光电压电流设置失败:{ConfigHelper.Config.Get("XRay_Voltage")},{ConfigHelper.Config.Get("XRay_Current")}\n";
IsLoadOk = false; IsLoadOk = false;
} }
else else
LogUtil.info("xray VC set ok"); LogUtil.info($"xray V:{ConfigHelper.Config.Get("XRay_Voltage")} ,C:{ConfigHelper.Config.Get("XRay_Current")} set ok");
if (!xrayImage.Open()) { if (!xrayImage.Open()) {
msgs += $"图像平板打开失败\n"; msgs += $"图像平板打开失败\n";
...@@ -91,7 +95,7 @@ namespace DeviceLibrary ...@@ -91,7 +95,7 @@ namespace DeviceLibrary
msgs += $"电夹爪通讯失败:{ElectricGripperPort}\n"; msgs += $"电夹爪通讯失败:{ElectricGripperPort}\n";
IsLoadOk = false; IsLoadOk = false;
} }
electricGripper.HomeReset();
//mainMachine = new MainMachine(RobotManage.Config); //mainMachine = new MainMachine(RobotManage.Config);
if (!IOManager.ConnectionIO()) if (!IOManager.ConnectionIO())
{ {
...@@ -136,6 +140,7 @@ namespace DeviceLibrary ...@@ -136,6 +140,7 @@ namespace DeviceLibrary
robots.ForEach((device) => device.Stop()); robots.ForEach((device) => device.Stop());
isRunning = false; isRunning = false;
robots.ForEach((device) => device.UserPause = false);
} }
public static void ShutDown() { public static void ShutDown() {
......
...@@ -35,8 +35,8 @@ namespace DeviceLibrary ...@@ -35,8 +35,8 @@ namespace DeviceLibrary
AxisBean T_TrayPos_Axis; AxisBean T_TrayPos_Axis;
MoveInfo ShelfOutMoveInfo; MoveInfo ShelfOutMoveInfo;
MoveInfo ShelfInMoveInfo; MoveInfo ShelfInMoveInfo;
LineManager ShelfOutLine; public LineManager ShelfOutLine;
LineManager ShelfInLine; public LineManager ShelfInLine;
public event EventHandler<Bitmap> TrayStringLocation; public event EventHandler<Bitmap> TrayStringLocation;
public bool Init(out string msg) public bool Init(out string msg)
...@@ -201,6 +201,7 @@ namespace DeviceLibrary ...@@ -201,6 +201,7 @@ namespace DeviceLibrary
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW); CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.EmptyString_Lift_Down, IO_T1_Type.EmptyString_Lift_Up, IO_VALUE.LOW); CylinderMove(MoveInfo, IO_T1_Type.EmptyString_Lift_Down, IO_T1_Type.EmptyString_Lift_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.HIGH); CylinderMove(MoveInfo, IO_T1_Type.T1_Lift_Down, IO_T1_Type.T1_Lift_Up, IO_VALUE.HIGH);
RobotManage.electricGripper.HomeReset();
//CylinderMove(ResetMoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up); //CylinderMove(ResetMoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up);
//CylinderMove(ResetMoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up); //CylinderMove(ResetMoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up);
break; break;
......
...@@ -7,6 +7,7 @@ using System.Drawing; ...@@ -7,6 +7,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -18,7 +19,8 @@ namespace DeviceLibrary ...@@ -18,7 +19,8 @@ namespace DeviceLibrary
partial class T1Machine partial class T1Machine
{ {
public IO_VALUE End_Line_Tray_Check { get => IOValue(IO_T1_Type.End_Line_Tray_Check); } public IO_VALUE End_Line_Tray_Check { get => IOValue(IO_T1_Type.End_Line_Tray_Check); }
public bool TrayCanIN() { public bool TrayCanIN()
{
return IOValue(IO_T1_Type.End_Line_Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_T1_Type.End_Lift_Cylinder_Down).Equals(IO_VALUE.HIGH); return IOValue(IO_T1_Type.End_Line_Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_T1_Type.End_Lift_Cylinder_Down).Equals(IO_VALUE.HIGH);
} }
public void LineRun(int sec = 0) public void LineRun(int sec = 0)
...@@ -33,7 +35,7 @@ namespace DeviceLibrary ...@@ -33,7 +35,7 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case MoveStep.T1_01_WaitReel: case MoveStep.T1_01_WaitReel:
if (End_Line_Tray_Check.Equals(IO_VALUE.HIGH) && preReelParam!=null) if (End_Line_Tray_Check.Equals(IO_VALUE.HIGH) && preReelParam != null)
{ {
MoveInfo.ReelParam = preReelParam; MoveInfo.ReelParam = preReelParam;
preReelParam = null; preReelParam = null;
...@@ -71,10 +73,16 @@ namespace DeviceLibrary ...@@ -71,10 +73,16 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.T1_05_ClampReel: case MoveStep.T1_05_ClampReel:
if (RobotManage.electricGripper.Clamp(null))
{
MoveInfo.NextMoveStep(MoveStep.T1_06_UpToTop); MoveInfo.NextMoveStep(MoveStep.T1_06_UpToTop);
MoveInfo.log($"夹爪张开"); MoveInfo.log($"夹爪张开");
RobotManage.electricGripper.Clamp(null);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
}
break; break;
case MoveStep.T1_06_UpToTop: case MoveStep.T1_06_UpToTop:
MoveInfo.NextMoveStep(MoveStep.T1_07_PanToOut); MoveInfo.NextMoveStep(MoveStep.T1_07_PanToOut);
...@@ -103,12 +111,17 @@ namespace DeviceLibrary ...@@ -103,12 +111,17 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.T1_09_ReleaseReel: case MoveStep.T1_09_ReleaseReel:
if (RobotManage.electricGripper.Release())
{
MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish); MoveInfo.NextMoveStep(MoveStep.T1_10_PutReelFinish);
MoveInfo.log($"夹爪放松"); MoveInfo.log($"夹爪放松");
RobotManage.electricGripper.Release();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
}
break; break;
case MoveStep.T1_10_PutReelFinish: case MoveStep.T1_10_PutReelFinish:
ShelfInMoveInfo.ReelParam = MoveInfo.ReelParam; ShelfInMoveInfo.ReelParam = MoveInfo.ReelParam;
...@@ -157,7 +170,7 @@ namespace DeviceLibrary ...@@ -157,7 +170,7 @@ namespace DeviceLibrary
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown); ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_10_EmptyIn_Wait_StopDown);
ShelfInMoveInfo.log("入料线体启动, 等待料串到等待位置"); ShelfInMoveInfo.log("入料线体启动, 等待料串到等待位置");
IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 2000); IOMove(IO_T1_Type.EmptyString_In_Stop, IO_VALUE.HIGH, false, 2000);
ShelfInLine.LineRun("n",999, "Shelf_10_EmptyIn_Wait_StopDown"); ShelfInLine.LineRun("n", 999, "Shelf_10_EmptyIn_Wait_StopDown");
ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH)); ShelfInMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.EmptyString_In_Check, IO_VALUE.HIGH));
break; break;
case MoveStep.Shelf_10_EmptyIn_Wait_StopDown: case MoveStep.Shelf_10_EmptyIn_Wait_StopDown:
...@@ -218,7 +231,7 @@ namespace DeviceLibrary ...@@ -218,7 +231,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.Shelf_17_EmptyIn_CheckLocation: case MoveStep.Shelf_17_EmptyIn_CheckLocation:
ShelfOutMoveInfo.log("计算料串中心位置"); ShelfOutMoveInfo.log("计算料串中心位置");
var (Bitmap, distance, debugstring) = GetStringCenter(); var (Bitmap, distance, debugstring) = GetStringCenter(true);
Lastdistance = distance; Lastdistance = distance;
TrayStringLocation?.Invoke(this, Bitmap); TrayStringLocation?.Invoke(this, Bitmap);
if (Lastdistance > Config.String_Offset_Range_Px) if (Lastdistance > Config.String_Offset_Range_Px)
...@@ -232,7 +245,8 @@ namespace DeviceLibrary ...@@ -232,7 +245,8 @@ namespace DeviceLibrary
break; break;
case MoveStep.Shelf_18_EmptyIn_WaitManCheck: case MoveStep.Shelf_18_EmptyIn_WaitManCheck:
Msg.add("料串中心位置偏移, 请手动调整.", MsgLevel.warning); Msg.add("料串中心位置偏移, 请手动调整.", MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH)) { if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_17_EmptyIn_CheckLocation); ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_17_EmptyIn_CheckLocation);
} }
break; break;
...@@ -248,22 +262,24 @@ namespace DeviceLibrary ...@@ -248,22 +262,24 @@ namespace DeviceLibrary
ShelfOutMoveInfo.NewMove(MoveStep.Shelf_Out_Wait); ShelfOutMoveInfo.NewMove(MoveStep.Shelf_Out_Wait);
ShelfInMoveInfo.log($"批量轴已下降到底,料串已满,Left_Batch_P1={Config.BatchAxis_P1},needpos={currpos}"); ShelfInMoveInfo.log($"批量轴已下降到底,料串已满,Left_Batch_P1={Config.BatchAxis_P1},needpos={currpos}");
} }
else if (TrayStringFixTimes < 3 && currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 100) //else if (TrayStringFixTimes < 3 && currpos < Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 100)
{ //{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady); // ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
TrayStringFixTimes++; // TrayStringFixTimes++;
ShelfInMoveInfo.log($"批量轴已下降过半,重新提升料串 TrayStringFixTimes:{TrayStringFixTimes}"); // ShelfInMoveInfo.log($"批量轴已下降过半,重新提升料串 TrayStringFixTimes:{TrayStringFixTimes}");
BatchAxisToP2(false); // BatchAxisToP2(false);
} //}
else else
{ {
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady); ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_20_EmptyIn_ShelfReady);
T_Batch_Axis.AbsMove(ShelfInMoveInfo, currpos, Config.BatchAxis_P1_speed); //T_Batch_Axis.AbsMove(ShelfInMoveInfo, currpos, Config.BatchAxis_P1_speed);
BatchAxisToP1();
ShelfInMoveInfo.log($"批量轴已下降一张料盘位置,等待料盘放入,needpos={currpos},{ShelfInMoveInfo.ReelParam.ToStr()}"); ShelfInMoveInfo.log($"批量轴已下降一张料盘位置,等待料盘放入,needpos={currpos},{ShelfInMoveInfo.ReelParam.ToStr()}");
} }
break; break;
case MoveStep.Shelf_Work_WaitShelfLeave: case MoveStep.Shelf_Work_WaitShelfLeave:
if ((IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW))) { if ((IOValue(IO_T1_Type.T1_Lift_Tray_Check).Equals(IO_VALUE.LOW)))
{
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_EmptyIn_WaitWorkLeave); ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_EmptyIn_WaitWorkLeave);
} }
Msg.add("料串已满等待空料串", MsgLevel.info); Msg.add("料串已满等待空料串", MsgLevel.info);
...@@ -271,8 +287,10 @@ namespace DeviceLibrary ...@@ -271,8 +287,10 @@ namespace DeviceLibrary
} }
} }
public bool ReleaseShelf() { public bool ReleaseShelf()
if (MoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady) { {
if (MoveInfo.MoveStep != MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
return false; return false;
} }
ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_Work_WaitShelfLeave); ShelfInMoveInfo.NextMoveStep(MoveStep.Shelf_Work_WaitShelfLeave);
...@@ -280,7 +298,8 @@ namespace DeviceLibrary ...@@ -280,7 +298,8 @@ namespace DeviceLibrary
ShelfInMoveInfo.log($"用户强制释放料架"); ShelfInMoveInfo.log($"用户强制释放料架");
return true; return true;
} }
void ShelfOutProcess() { void ShelfOutProcess()
{
if (CheckWait(ShelfOutMoveInfo)) if (CheckWait(ShelfOutMoveInfo))
return; return;
...@@ -320,7 +339,7 @@ namespace DeviceLibrary ...@@ -320,7 +339,7 @@ namespace DeviceLibrary
ShelfOutMoveInfo.log("阻挡气缸下降,链条运转"); ShelfOutMoveInfo.log("阻挡气缸下降,链条运转");
//IOMove(IO_T1_Type.Line_Out_Run, IO_VALUE.HIGH); //IOMove(IO_T1_Type.Line_Out_Run, IO_VALUE.HIGH);
ShelfOutLine.LineRun("n",999, "Shelf_34_Out_OutLineRun"); ShelfOutLine.LineRun("n", 999, "Shelf_34_Out_OutLineRun");
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Wait_Check, IO_VALUE.HIGH)); ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Wait_Check, IO_VALUE.HIGH));
break; break;
case MoveStep.Shelf_35_Out_OutLineRun: case MoveStep.Shelf_35_Out_OutLineRun:
...@@ -334,7 +353,8 @@ namespace DeviceLibrary ...@@ -334,7 +353,8 @@ namespace DeviceLibrary
break; break;
} }
} }
void EmptyStringIN() { void EmptyStringIN()
{
this.loginfo($"T1空料串入口感应到料串,EmptyString_In_Check:{IOValue(IO_T1_Type.EmptyString_In_Check)}"); this.loginfo($"T1空料串入口感应到料串,EmptyString_In_Check:{IOValue(IO_T1_Type.EmptyString_In_Check)}");
//if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_T1_Type.EmptyString_In_Check).Equals(IO_VALUE.HIGH))
// return; // return;
...@@ -374,13 +394,40 @@ namespace DeviceLibrary ...@@ -374,13 +394,40 @@ namespace DeviceLibrary
Config.T_Batch_Axis.TargetPosition = targetP2; Config.T_Batch_Axis.TargetPosition = targetP2;
T_Batch_Axis.AbsMove(null, targetP2, targetSpeed); T_Batch_Axis.AbsMove(null, targetP2, targetSpeed);
//开始检测信号 //开始检测信号
T_Batch_Axis.BatchAxisStartCheck(IO_T1_Type.T1_Tray_Check,Config, IO_VALUE.HIGH); T_Batch_Axis.BatchAxisStartCheck(IO_T1_Type.T1_Tray_Check, Config, IO_VALUE.HIGH);
} }
public (Bitmap, int,string) GetStringCenter() {
void BatchAxisToP1()
{
int targetP1 = Config.BatchAxis_P1;
int targetSpeed = Config.BatchAxis_P2_speed;
ShelfOutMoveInfo.TimeOutSeconds = 200;
ShelfOutMoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = T_Batch_Axis.GetAclPosition();
ShelfOutMoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.T_Batch_Axis, targetP1, targetSpeed));
Config.T_Batch_Axis.TargetPosition = targetP1;
T_Batch_Axis.AbsMove(null, targetP1, targetSpeed);
//开始检测信号
T_Batch_Axis.BatchAxisStartCheck(IO_T1_Type.T1_Tray_Check, Config, IO_VALUE.LOW);
}
public (Bitmap, int, string) GetStringCenter(bool isFirst = false)
{
if (isFirst)
return GetStringCenterA();
else
return GetStringCenterB();
}
public (Bitmap, int, string) GetStringCenterA()
{
//return (null, 0, "调试屏蔽");
Bitmap bmap = Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera); Bitmap bmap = Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera);
//Bitmap bmap = new Bitmap("D:\\853string\\Image_20210605142037637.bmp"); //Bitmap bmap = new Bitmap("D:\\853string\\Image_20210605142037637.bmp");
//pictureBox1.Image = (Bitmap)bmap.Clone(); //pictureBox1.Image = (Bitmap)bmap.Clone();
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height); Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
var bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat); var bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
var eyemImage = new EyemImage(); var eyemImage = new EyemImage();
...@@ -393,12 +440,12 @@ namespace DeviceLibrary ...@@ -393,12 +440,12 @@ namespace DeviceLibrary
//创建扫描区域 //创建扫描区域
EyemRect eyemRect = new EyemRect(); EyemRect eyemRect = new EyemRect();
eyemRect.iXs = Config.String_Center_X-200; eyemRect.iXs = Config.String_Center_X - 200;
eyemRect.iYs = Config.String_Center_Y-200; eyemRect.iYs = Config.String_Center_Y - 200;
eyemRect.iWidth = 400; eyemRect.iWidth = 400;
eyemRect.iHeight = 400; eyemRect.iHeight = 400;
EyemOcsFXYR eyemOcsFXYR = new EyemOcsFXYR(); eyemlib.EyemOcsFXYR eyemOcsFXYR = new eyemlib.EyemOcsFXYR();
int result = eyemlib.eyemMulFuncTool(eyemImage, eyemRect, "__func1", 65, 75, ref eyemOcsFXYR, out _); int result = eyemlib.eyemMulFuncTool(eyemImage, eyemRect, "__func1", 65, 75, ref eyemOcsFXYR, out _);
LogUtil.info($"eyemMulFuncTool:result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}"); LogUtil.info($"eyemMulFuncTool:result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}");
...@@ -418,7 +465,7 @@ namespace DeviceLibrary ...@@ -418,7 +465,7 @@ namespace DeviceLibrary
int r = 102; int r = 102;
graphics.DrawEllipse(greenpen, Config.String_Center_X - r, Config.String_Center_Y - r, r * 2, r * 2); graphics.DrawEllipse(greenpen, Config.String_Center_X - r, Config.String_Center_Y - r, r * 2, r * 2);
graphics.DrawEllipse(greenpen, Config.String_Center_X - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2); graphics.DrawEllipse(greenpen, Config.String_Center_X - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2);
Pen redpen = new Pen(Color.FromArgb(255,Color.Red), 10); Pen redpen = new Pen(Color.FromArgb(255, Color.Red), 10);
graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - eyemOcsFXYR.fR, eyemOcsFXYR.fY - eyemOcsFXYR.fR, eyemOcsFXYR.fR * 2, eyemOcsFXYR.fR * 2); graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - eyemOcsFXYR.fR, eyemOcsFXYR.fY - eyemOcsFXYR.fR, eyemOcsFXYR.fR * 2, eyemOcsFXYR.fR * 2);
graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - 5, eyemOcsFXYR.fY - 5, 5 * 2, 5 * 2); graphics.DrawEllipse(redpen, eyemOcsFXYR.fX - 5, eyemOcsFXYR.fY - 5, 5 * 2, 5 * 2);
...@@ -427,18 +474,43 @@ namespace DeviceLibrary ...@@ -427,18 +474,43 @@ namespace DeviceLibrary
SolidBrush blue = new SolidBrush(Color.BlueViolet); SolidBrush blue = new SolidBrush(Color.BlueViolet);
Font font = new Font(FontFamily.GenericSansSerif, 30); Font font = new Font(FontFamily.GenericSansSerif, 30);
graphics.DrawString($"center:X:{Config.String_Center_X},Y:{Config.String_Center_Y}", font, blue, rectx, recty); graphics.DrawString($"center:X:{Config.String_Center_X},Y:{Config.String_Center_Y}", font, blue, rectx, recty);
graphics.DrawString($"result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}", font, blue, rectx, font.Height+ recty); graphics.DrawString($"result:{result},fX:{eyemOcsFXYR.fX},fY:{eyemOcsFXYR.fY},fR:{eyemOcsFXYR.fR}", font, blue, rectx, font.Height + recty);
graphics.DrawString($"distance:{distance}", font, blue, rectx, font.Height*2+ recty); graphics.DrawString($"distance:{distance}", font, blue, rectx, font.Height * 2 + recty);
graphics.Save(); graphics.Save();
bmap.Dispose(); bmap.Dispose();
graphics.Dispose(); graphics.Dispose();
Bitmap newbitmap = bitmap.Clone(new Rectangle(rectx, recty, 1000,1000), PixelFormat.Format24bppRgb); Bitmap newbitmap = bitmap.Clone(new Rectangle(rectx, recty, 1000, 1000), PixelFormat.Format24bppRgb);
bitmap.Dispose(); bitmap.Dispose();
Directory.CreateDirectory("\\image\\TrayString\\"); Directory.CreateDirectory("\\image\\TrayString\\");
newbitmap.Save("\\image\\TrayString\\"+DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")+ ".jpg",ImageFormat.Jpeg); newbitmap.Save("\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
return (newbitmap, distance, debugtxt);
}
public (Bitmap, int, string) GetStringCenterB()
{
//return (null, 0, "调试屏蔽");
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
Bitmap bmap = Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera);
Bitmap newbitmap = new Bitmap(640, 640);
Graphics g = Graphics.FromImage(newbitmap);
Rectangle rectangle = new Rectangle(centerpos.X - newbitmap.Width / 2, centerpos.Y - newbitmap.Height / 2, newbitmap.Width, newbitmap.Height);
g.DrawImage(bmap, rectangle);
g.Save();g.Dispose();
string filename = "\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg";
newbitmap.Save(filename, ImageFormat.Jpeg);
//newbitmap.Dispose();
bmap.Dispose();
float fx = 0, fy = 0;
int r = centerDetector(filename, ref fx, ref fy);
LogUtil.info($"centerDetector r:{r},x:{fx},y:{fy}");
var debugtxt = $"centerDetector:\nresult:{r}\nfX:{fx}\nfY:{fy}";
var currpos = new Point((int)fx+ rectangle.X, (int)fy+ rectangle.Y);
var distance = (int)Common.distance(centerpos, currpos);
return (newbitmap, distance, debugtxt); return (newbitmap, distance, debugtxt);
} }
[DllImport("yolov5.dll", CharSet = CharSet.None)]
public static extern int centerDetector([MarshalAs(UnmanagedType.LPStr)] string filename, ref float x, ref float y);
} }
} }
...@@ -6,6 +6,7 @@ using System.Collections.Generic; ...@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -52,13 +53,13 @@ namespace DeviceLibrary ...@@ -52,13 +53,13 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage); MoveInfo.NextMoveStep(MoveStep.XRay_05_GetImage);
RobotManage.XRay.Start(); RobotManage.XRay.Start();
MoveInfo.log($"打开X光"); MoveInfo.log($"打开X光");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break; break;
case MoveStep.XRay_05_GetImage: case MoveStep.XRay_05_GetImage:
if (GrabImage()) if (GrabImage())
{ {
MoveInfo.NextMoveStep(MoveStep.XRay_08_OpenOutDoor); MoveInfo.NextMoveStep(MoveStep.XRay_08_OpenOutDoor);
MoveInfo.log($"获取图像,开始点料"); MoveInfo.log($"获取图像,开始点料 IsRayOpen:{RobotManage.XRay.IsRayOpen}");
GetResultTask = Task.Run(()=> { GetCountResult(); }); GetResultTask = Task.Run(()=> { GetCountResult(); });
} }
else { else {
...@@ -141,6 +142,7 @@ namespace DeviceLibrary ...@@ -141,6 +142,7 @@ namespace DeviceLibrary
} }
} }
public string xrayImagePath; public string xrayImagePath;
[HandleProcessCorruptedStateExceptions]
public bool GrabImage() public bool GrabImage()
{ {
Bitmap bmp = null; Bitmap bmp = null;
...@@ -199,7 +201,7 @@ namespace DeviceLibrary ...@@ -199,7 +201,7 @@ namespace DeviceLibrary
//StepImage?.Invoke(bmp); //StepImage?.Invoke(bmp);
} }
} }
[HandleProcessCorruptedStateExceptions]
public void GetCountResult() public void GetCountResult()
{ {
//返回的数量是string类型,count = "4000,3000,3500,2000" //返回的数量是string类型,count = "4000,3000,3500,2000"
...@@ -275,14 +277,17 @@ namespace DeviceLibrary ...@@ -275,14 +277,17 @@ namespace DeviceLibrary
if (File.Exists(resfile)) if (File.Exists(resfile))
File.Delete(resfile); File.Delete(resfile);
Directory.Move(Path.Combine(root, resfilename), resfile); Directory.Move(Path.Combine(root, resfilename), resfile);
if (!RobotManage.offlinemode)
{
var cl = ServerConn.inputCounterDataByXRayMachine(MoveInfo.ReelParam.WareCode, count); var cl = ServerConn.inputCounterDataByXRayMachine(MoveInfo.ReelParam.WareCode, count);
if (cl == null) { if (cl == null)
{
MoveInfo.ReelParam.IsNg = true; MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "点料数量上传失败"; MoveInfo.ReelParam.NgMsg = "点料数量上传失败";
MoveInfo.ReelParam.logresult(); MoveInfo.ReelParam.logresult();
} }
} }
}
else { else {
MoveInfo.ReelParam.IsNg = true; MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "点料结果为0"; MoveInfo.ReelParam.NgMsg = "点料结果为0";
......
...@@ -53,6 +53,7 @@ namespace DeviceLibrary ...@@ -53,6 +53,7 @@ namespace DeviceLibrary
LedProcessInit(); LedProcessInit();
IOMonitor.RegisterIO(IO_XRay_Type.Exit_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); }); IOMonitor.RegisterIO(IO_XRay_Type.Exit_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
IOMonitor.RegisterIO(IO_XRay_Type.Entry_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); }); IOMonitor.RegisterIO(IO_XRay_Type.Entry_Open, Config, IO_VALUE.LOW, delegate () { XRayDoorOpen(); });
LogUtil.info(DeviceName + " init end"); LogUtil.info(DeviceName + " init end");
} }
catch (Exception e){ catch (Exception e){
...@@ -61,12 +62,22 @@ namespace DeviceLibrary ...@@ -61,12 +62,22 @@ namespace DeviceLibrary
} }
return true; return true;
} }
public override void Run()
{
base.Run();
IOMove(IO_XRay_Type.Camera_Led, IO_VALUE.HIGH);
}
public override void Stop()
{
IOMove(IO_XRay_Type.Camera_Led, IO_VALUE.LOW);
base.Stop();
}
void XRayDoorOpen() { void XRayDoorOpen() {
if (RobotManage.XRay.IsRayOpen) if (RobotManage.XRay.IsRayOpen)
{ {
LogUtil.info(DeviceName + " X光机防护门打开"); LogUtil.info(DeviceName + " X光机防护门打开");
RobotManage.XRay.Stop(); //RobotManage.XRay.Stop();
IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW); //IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
} }
else { else {
LogUtil.info(DeviceName + " X光没有打开"); LogUtil.info(DeviceName + " X光没有打开");
......
...@@ -3,7 +3,9 @@ using OnlineStore.Common; ...@@ -3,7 +3,9 @@ using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -77,6 +79,21 @@ namespace DeviceLibrary ...@@ -77,6 +79,21 @@ namespace DeviceLibrary
result = Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y)); result = Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y));
return result; return result;
} }
/// <summary>
/// 计算2个坐标的中心点
/// </summary>
/// <param name="p1"></param>
/// <param name="p2"></param>
/// <returns></returns>
public static Point pointCenter(Point p1, Point p2)
{
var x1 = Math.Abs((p1.X - p2.X) / 2);
var y1 = Math.Abs((p1.Y - p2.Y) / 2);
var x = Math.Min(p1.X, p2.X) + x1;
var y = Math.Min(p1.Y, p2.Y) + y1;
return new Point(x, y);
}
/// <summary> /// <summary>
/// 以中心点旋转Angle角度 /// 以中心点旋转Angle角度
...@@ -106,6 +123,42 @@ namespace DeviceLibrary ...@@ -106,6 +123,42 @@ namespace DeviceLibrary
var y2 = p1.Y + distance * Math.Sin(angle / 180 * Math.PI); var y2 = p1.Y + distance * Math.Sin(angle / 180 * Math.PI);
return new Point((int)x2, (int)y2); return new Point((int)x2, (int)y2);
} }
/// <summary>
/// 盒体到点的距离, 返回距离,最远点索引
/// </summary>
/// <param name="lp"></param>
/// <param name="point"></param>
/// <returns></returns>
public static (double,int) DistanceWithBoxAndPoint(List<Point> lp, Point point)
{
Point lc;
if (Common.distance(lp[0], lp[1]) > Common.distance(lp[0], lp[3]))
{
//横着的
lc = Common.pointCenter(lp[0], lp[1]);
}
else {
//竖着的
lc = Common.pointCenter(lp[0], lp[3]);
}
double maxlen=0;
int maxindex = 0; ;
for (int i = 0; i < lp.Count; i++) {
var cc = Common.distance(point, lp[i]);
if (cc > maxlen) {
maxlen = cc;
maxindex = i;
}
}
return (Common.distance(point, lc), maxindex);
}
public static Rectangle EllipseCenter(Point p, int size) {
return new Rectangle(p.X - size / 2, p.Y - size / 2, size, size);
}
/// <summary> /// <summary>
/// 找到无标签角度 /// 找到无标签角度
...@@ -152,6 +205,76 @@ namespace DeviceLibrary ...@@ -152,6 +205,76 @@ namespace DeviceLibrary
var p2 = PointWithAngle(org, labelAngle, widthOffset); var p2 = PointWithAngle(org, labelAngle, widthOffset);
return p2; return p2;
} }
/// <summary>
/// 剪裁图像
/// </summary>
/// <param name="src"></param>
/// <param name="cropRect"></param>
/// <returns></returns>
public static Bitmap ImageCrop(Bitmap src, Rectangle cropRect)
{
//Rectangle cropRect = new Rectangle(0, 0, 400, 400);
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(target))
{
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}
return target;
}
/// <summary>
/// 计算2个文本的相似度
/// </summary>
/// <param name="txt1"></param>
/// <param name="txt2"></param>
/// <returns></returns>
public static double Sim(string txt1, string txt2)
{
List<char> sl1 = txt1.ToCharArray().ToList();
List<char> sl2 = txt2.ToCharArray().ToList();
//去重
List<char> sl = sl1.Union(sl2).ToList<char>();
//获取重复次数
List<int> arrA = new List<int>();
List<int> arrB = new List<int>();
foreach (var str in sl)
{
arrA.Add(sl1.Where(x => x == str).Count());
arrB.Add(sl2.Where(x => x == str).Count());
}
//计算商
double num = 0;
//被除数
double numA = 0;
double numB = 0;
for (int i = 0; i < sl.Count; i++)
{
num += arrA[i] * arrB[i];
numA += Math.Pow(arrA[i], 2);
numB += Math.Pow(arrB[i], 2);
}
double cos = num / (Math.Sqrt(numA) * Math.Sqrt(numB));
return cos;
}
public static T DeepClone<T>(T _object)
{
T dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, _object);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (T)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
} }
public class Msg public class Msg
{ {
......
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading;
/// <summary>
/// 客户端管道
/// </summary>
class NamedPipeClient
{
private NamedPipeClientStream Client { get; set; }
public NamedPipeClient(string serverName, string serverHost)
{
Client = new NamedPipeClientStream(serverHost, serverName);
}
byte[] readBytes = new byte[1024*50];
public string Request(string outPutStr)
{
string inputStr = "";
try
{
this.Client.Connect(1000*5);
var b = Encoding.UTF8.GetBytes(outPutStr);
this.Client.Write(b, 0, b.Length);
this.Client.Flush();
Client.WaitForPipeDrain();
int readlen = Client.Read(readBytes, 0, readBytes.Length);
while (readlen > 0)
{
inputStr += Encoding.UTF8.GetString(readBytes, 0, readlen);
readlen = Client.Read(readBytes, 0, readBytes.Length);
}
}
catch { }
finally
{
if (Client.IsConnected)
Client.Close();
}
//this.Client.Dispose();
return inputStr;
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class OcrProcess
{
static Process p = new Process();
static OcrProcess() {
p.StartInfo = new ProcessStartInfo("OcrLiteOnnx\\OcrLiteOnnxForm.exe");
}
public static void Run() {
var pss = Process.GetProcessesByName("OcrLiteOnnxForm");
if (pss.Length > 0)
return;
p.Start();
}
}
}
...@@ -14,7 +14,7 @@ namespace DeviceLibrary ...@@ -14,7 +14,7 @@ namespace DeviceLibrary
{ {
//string url = host + "/api/inputCounterDataByXRayMachine"; //string url = host + "/api/inputCounterDataByXRayMachine";
string url = host + "/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine"; string url = host + "/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine";
var wc = new MyWebClient(5000); var wc = new MyWebClient(15000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"])) if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8"); wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = Encoding.UTF8; wc.Encoding = Encoding.UTF8;
...@@ -55,7 +55,7 @@ namespace DeviceLibrary ...@@ -55,7 +55,7 @@ namespace DeviceLibrary
{ {
//string url = host + "/api/RLC/DetermineReelStorageLocation"; //string url = host + "/api/RLC/DetermineReelStorageLocation";
string url = host + "/SCTARLC001/api/RLC/DetermineReelStorageLocation"; string url = host + "/SCTARLC001/api/RLC/DetermineReelStorageLocation";
var wc = new MyWebClient(5000); var wc = new MyWebClient(15000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"])) if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8"); wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = Encoding.UTF8; wc.Encoding = Encoding.UTF8;
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public sealed class TextBlock
{
public List<Point> BoxPoints { get; set; }
public float BoxScore { get; set; }
public int AngleIndex { get; set; }
public float AngleScore { get; set; }
public float AngleTime { get; set; }
public string Text { get; set; }
public List<float> CharScores { get; set; }
public float CrnnTime { get; set; }
public float BlockTime { get; set; }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("├─TextBlock");
string textBox = $"│ ├──TextBox[score({BoxScore}),[x: {BoxPoints[0].X}, y: {BoxPoints[0].Y}], [x: {BoxPoints[1].X}, y: {BoxPoints[1].Y}], [x: {BoxPoints[2].X}, y: {BoxPoints[2].Y}], [x: {BoxPoints[3].X}, y: {BoxPoints[3].Y}]]";
sb.AppendLine(textBox);
string header = AngleIndex >= 0 ? "Angle" : "AngleDisabled";
string angle = $"│ ├──{header}[Index({AngleIndex}), Score({AngleScore}), Time({AngleTime}ms)]";
sb.AppendLine(angle);
StringBuilder sbScores = new StringBuilder();
CharScores.ForEach(x => sbScores.Append($"{x},"));
string textLine = $"│ ├──TextLine[Text({Text}),CharScores({sbScores.ToString()}),Time({CrnnTime}ms)]";
sb.AppendLine(textLine);
sb.AppendLine($"│ └──BlockTime({BlockTime}ms)");
return sb.ToString();
}
}
...@@ -16,6 +16,9 @@ PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,, ...@@ -16,6 +16,9 @@ PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,0,,,,,,,,,,,, PRO,30,贴标R轴偏移像素,Label_R_Offset_Pixel,0,,,,,,,,,,,,
PRO,30,贴标R轴原点角度,Label_R_Zero_Angle,0,,,,,,,,,,,, PRO,30,贴标R轴原点角度,Label_R_Zero_Angle,0,,,,,,,,,,,,
PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,10000,,,,,,,,,,,, PRO,30,贴标Z轴高度转换系数(1mm对应的脉冲),Label_Z_Axis_ChangeValue,10000,,,,,,,,,,,,
PRO,30,贴标标签偏移X像素,Label_Offset_X,170,,,,,,,,,,,,
PRO,30,贴标标签偏移Y像素,Label_Offset_Y,210,,,,,,,,,,,,
PRO,30,贴标R轴最大角度,Label_R_MaxAngle,330,,,,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,12,贴标X轴待机点P1,Label_X_P1,90407,,,14000,,,,,,,,, PRO,12,贴标X轴待机点P1,Label_X_P1,90407,,,14000,,,,,,,,,
PRO,12,贴标X轴取标点P2,Label_X_P2,56163,,,14000,,,,,,,,, PRO,12,贴标X轴取标点P2,Label_X_P2,56163,,,14000,,,,,,,,,
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<Reference Include="Neotel.Rmaxis"> <Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath> <HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
...@@ -76,8 +77,11 @@ ...@@ -76,8 +77,11 @@
<Compile Include="AutoScan\common\AxisBean.cs" /> <Compile Include="AutoScan\common\AxisBean.cs" />
<Compile Include="AutoScan\common\Common.cs" /> <Compile Include="AutoScan\common\Common.cs" />
<Compile Include="AutoScan\common\Led.cs" /> <Compile Include="AutoScan\common\Led.cs" />
<Compile Include="AutoScan\common\NamedPipeClient.cs" />
<Compile Include="AutoScan\common\OcrProcess.cs" />
<Compile Include="AutoScan\common\SensorDebounce.cs" /> <Compile Include="AutoScan\common\SensorDebounce.cs" />
<Compile Include="AutoScan\common\ServerConn.cs" /> <Compile Include="AutoScan\common\ServerConn.cs" />
<Compile Include="AutoScan\common\TextBlock.cs" />
<Compile Include="AutoScan\FilterMachine.partial.cs" /> <Compile Include="AutoScan\FilterMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.partial.cs" /> <Compile Include="AutoScan\LabelMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.Ledprocess.cs" /> <Compile Include="AutoScan\LabelMachine.Ledprocess.cs" />
...@@ -110,6 +114,11 @@ ...@@ -110,6 +114,11 @@
<Compile Include="DeviceLibrary\WistonAgvClientcs.cs" /> <Compile Include="DeviceLibrary\WistonAgvClientcs.cs" />
<Compile Include="MsgExtend.cs" /> <Compile Include="MsgExtend.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings1.settings</DependentUpon>
</Compile>
<Compile Include="userControl\AxisMoveControl.cs"> <Compile Include="userControl\AxisMoveControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -158,6 +167,10 @@ ...@@ -158,6 +167,10 @@
</Content> </Content>
<None Include="Config\HBXRAYPLATE.config" /> <None Include="Config\HBXRAYPLATE.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings1.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
</None>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
...@@ -141,11 +141,17 @@ namespace DeviceLibrary ...@@ -141,11 +141,17 @@ namespace DeviceLibrary
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
[HandleProcessCorruptedStateExceptions]
public static List<CodeInfo> CameraScan(List<string> cameraNameList) public static List<CodeInfo> CameraScan(List<string> cameraNameList)
{ {
var x = CameraScan(cameraNameList, out Bitmap bitmap);
bitmap.Dispose();
return x;
}
[HandleProcessCorruptedStateExceptions]
public static List<CodeInfo> CameraScan(List<string> cameraNameList,out Bitmap bitmap)
{
List<CodeInfo> codeList = new List<CodeInfo>(); List<CodeInfo> codeList = new List<CodeInfo>();
bitmap = null;
if (cameraNameList == null || cameraNameList.Count <= 0) if (cameraNameList == null || cameraNameList.Count <= 0)
{ {
throw new Exception("CameraScan方法没有传入相机名称."); throw new Exception("CameraScan方法没有传入相机名称.");
...@@ -168,6 +174,7 @@ namespace DeviceLibrary ...@@ -168,6 +174,7 @@ namespace DeviceLibrary
{ {
bool nohalcon = false; bool nohalcon = false;
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon); ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon);
bitmap = Common.DeepClone(bmp);
if (ho_Image == null && !nohalcon) if (ho_Image == null && !nohalcon)
{ {
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
...@@ -177,14 +184,13 @@ namespace DeviceLibrary ...@@ -177,14 +184,13 @@ namespace DeviceLibrary
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = ""; string r = "";
foreach (int codesize in Code_Block_Size_List) //foreach (int codesize in Code_Block_Size_List)
{ {
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp, null, codesize); List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp, null);
foreach (CodeInfo code in tlci) foreach (CodeInfo code in tlci)
{ {
LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr); LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
//code.CodeStr = CodeManager.ReplaceCode(code.CodeStr);
lock (codeList) lock (codeList)
{ {
if (!codeList.Contains(code) && HasRightCode(code.CodeStr)) if (!codeList.Contains(code) && HasRightCode(code.CodeStr))
...@@ -339,13 +345,13 @@ namespace DeviceLibrary ...@@ -339,13 +345,13 @@ namespace DeviceLibrary
string r = ""; string r = "";
foreach (int codesize in Code_Block_Size_List) foreach (int codesize in Code_Block_Size_List)
{ {
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp, null, codesize); List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
foreach (CodeInfo code in tlci) foreach (CodeInfo code in tlci)
{ {
LogUtil.info("[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr); LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
lock (codeList) lock (codeList)
{ {
if (!codeList.Contains(code)) if (!codeList.Contains(code) && HasRightCode(code.CodeStr))
{ {
codeList.Add(code); codeList.Add(code);
r = r + "##" + code.CodeStr; r = r + "##" + code.CodeStr;
......
...@@ -33,7 +33,7 @@ namespace DeviceLibrary ...@@ -33,7 +33,7 @@ namespace DeviceLibrary
LogUtil.info($"ElectricGripper Clamp"); LogUtil.info($"ElectricGripper Clamp");
if (!IsBusy) if (!IsBusy)
{ {
axis.Push(50, 7, 15); axis.Push(50, 4.5f, 15);
clampTimes++; clampTimes++;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
...@@ -50,12 +50,8 @@ namespace DeviceLibrary ...@@ -50,12 +50,8 @@ namespace DeviceLibrary
LogUtil.info($"ElectricGripper Release"); LogUtil.info($"ElectricGripper Release");
if (!IsBusy) if (!IsBusy)
{ {
if (axis.ErrorCode > 0) {
LogUtil.info($"ElectricGripper ErrCode:{axis.ErrorCode}"); axis.MoveAbsolute(0, 30, 500, 500, 0.1f);
axis.ResetError();
Thread.Sleep(100);
}
axis.GoHome();
clampTimes = 0; clampTimes = 0;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
...@@ -63,6 +59,12 @@ namespace DeviceLibrary ...@@ -63,6 +59,12 @@ namespace DeviceLibrary
} }
else else
{ {
if (axis.ErrorCode > 0)
{
LogUtil.info($"ElectricGripper ErrCode:{axis.ErrorCode}");
axis.ResetError();
Thread.Sleep(100);
}
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪放松")); moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪放松"));
return false; return false;
...@@ -85,8 +87,8 @@ namespace DeviceLibrary ...@@ -85,8 +87,8 @@ namespace DeviceLibrary
get get
{ {
LogUtil.info($"ElectricGripper IsReached:{axis.IsReached},IsMoving:{axis.IsMoving}"); LogUtil.info($"ElectricGripper IsReached:{axis.IsReached},IsMoving:{axis.IsMoving}");
return false; //return false;
return axis.IsMoving; return !axis.IsReached;
} }
} }
public int ErrorCode public int ErrorCode
......
...@@ -15,7 +15,7 @@ namespace DeviceLibrary ...@@ -15,7 +15,7 @@ namespace DeviceLibrary
static List<IOMonitorStrut> iOMonitorStruts = new List<IOMonitorStrut>(); static List<IOMonitorStrut> iOMonitorStruts = new List<IOMonitorStrut>();
readonly static System.Timers.Timer T1 = new System.Timers.Timer(); readonly static System.Timers.Timer T1 = new System.Timers.Timer();
static IOMonitor() { static IOMonitor() {
Thread.Sleep(1000); Thread.Sleep(5000);
T1.Interval = 30; T1.Interval = 30;
T1.Elapsed += T1_Elapsed; T1.Elapsed += T1_Elapsed;
T1.AutoReset = true; T1.AutoReset = true;
......
...@@ -84,7 +84,7 @@ namespace DeviceLibrary ...@@ -84,7 +84,7 @@ namespace DeviceLibrary
} }
} }
} }
public void LineStop(string id = "", string parentname = "") public void LineStop(string id = "n", string parentname = "")
{ {
lock (linrunlist) lock (linrunlist)
{ {
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace DeviceLibrary.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
public static Settings1 Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int NGBox_Count {
get {
return ((int)(this["NGBox_Count"]));
}
set {
this["NGBox_Count"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int MSDBox_Count {
get {
return ((int)(this["MSDBox_Count"]));
}
set {
this["MSDBox_Count"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int PaperBox_Count {
get {
return ((int)(this["PaperBox_Count"]));
}
set {
this["PaperBox_Count"] = value;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="DeviceLibrary.Properties" GeneratedClassName="Settings1">
<Profiles />
<Settings>
<Setting Name="NGBox_Count" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="MSDBox_Count" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="PaperBox_Count" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
...@@ -8,4 +13,17 @@ ...@@ -8,4 +13,17 @@
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<userSettings>
<DeviceLibrary.Properties.Settings1>
<setting name="NGBox_Count" serializeAs="String">
<value>0</value>
</setting>
<setting name="MSDBox_Count" serializeAs="String">
<value>0</value>
</setting>
<setting name="PaperBox_Count" serializeAs="String">
<value>0</value>
</setting>
</DeviceLibrary.Properties.Settings1>
</userSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -118,7 +118,21 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -118,7 +118,21 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_Z_Axis_ChangeValue")] [ConfigProAttribute("Label_Z_Axis_ChangeValue")]
public int Label_Z_Axis_ChangeValue { get; set; } public int Label_Z_Axis_ChangeValue { get; set; }
/// <summary>
/// PRO,30,贴标标签偏移X像素,Label_Offset_X,170,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_X")]
public int Label_Offset_X { get; set; }
/// <summary>
/// PRO,30,贴标标签偏移Y像素,Label_Offset_Y,170,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Y")]
public int Label_Offset_Y { get; set; }
/// <summary>
/// PRO,30,贴标R轴最大角度,Label_R_MaxAngle,330,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_MaxAngle")]
public int Label_R_MaxAngle { get; set; }
/// <summary> /// <summary>
/// PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,, /// PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
......
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections> </configSections>
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
...@@ -10,7 +18,7 @@ ...@@ -10,7 +18,7 @@
<!--二维码参数文件所在路径,文件名与二维码类型名一样--> <!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\" /> <add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" /> <add key="CodeCount" value="3" />
<add key ="Code_Block_Size_List" value ="11"/> <add key="Code_Block_Size_List" value="11" />
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -41,6 +41,7 @@ namespace AutoCountMachine ...@@ -41,6 +41,7 @@ namespace AutoCountMachine
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.cmb_runmode = new System.Windows.Forms.ComboBox();
this.btn_releaseshelf = new System.Windows.Forms.Button(); this.btn_releaseshelf = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listView_reelnfo = new System.Windows.Forms.ListView(); this.listView_reelnfo = new System.Windows.Forms.ListView();
...@@ -49,7 +50,7 @@ namespace AutoCountMachine ...@@ -49,7 +50,7 @@ namespace AutoCountMachine
this.btn_stop = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.boxResetControl1 = new AutoCountMachine.UCCOMMON.BoxResetControl(); this.boxResetControl1 = new AutoCountMachine.BoxResetControl();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
...@@ -143,6 +144,7 @@ namespace AutoCountMachine ...@@ -143,6 +144,7 @@ namespace AutoCountMachine
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.boxResetControl1); this.tabPage1.Controls.Add(this.boxResetControl1);
this.tabPage1.Controls.Add(this.cmb_runmode);
this.tabPage1.Controls.Add(this.btn_releaseshelf); this.tabPage1.Controls.Add(this.btn_releaseshelf);
this.tabPage1.Controls.Add(this.groupBox2); this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.groupBox1);
...@@ -153,6 +155,22 @@ namespace AutoCountMachine ...@@ -153,6 +155,22 @@ namespace AutoCountMachine
this.tabPage1.Text = "信息"; this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// cmb_runmode
//
this.cmb_runmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmb_runmode.FormattingEnabled = true;
this.cmb_runmode.Items.AddRange(new object[] {
"ONLINE",
"NG",
"MSD",
"PAPER",
"TOWER"});
this.cmb_runmode.Location = new System.Drawing.Point(783, 96);
this.cmb_runmode.Name = "cmb_runmode";
this.cmb_runmode.Size = new System.Drawing.Size(159, 29);
this.cmb_runmode.TabIndex = 4;
this.cmb_runmode.SelectedIndexChanged += new System.EventHandler(this.cmb_runmode_SelectedIndexChanged);
//
// btn_releaseshelf // btn_releaseshelf
// //
this.btn_releaseshelf.Location = new System.Drawing.Point(783, 29); this.btn_releaseshelf.Location = new System.Drawing.Point(783, 29);
...@@ -248,12 +266,12 @@ namespace AutoCountMachine ...@@ -248,12 +266,12 @@ namespace AutoCountMachine
// //
// boxResetControl1 // boxResetControl1
// //
this.boxResetControl1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.boxResetControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.boxResetControl1.Location = new System.Drawing.Point(744, 241); this.boxResetControl1.Location = new System.Drawing.Point(731, 202);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5); this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5);
this.boxResetControl1.Name = "boxResetControl1"; this.boxResetControl1.Name = "boxResetControl1";
this.boxResetControl1.Size = new System.Drawing.Size(222, 283); this.boxResetControl1.Size = new System.Drawing.Size(264, 353);
this.boxResetControl1.TabIndex = 4; this.boxResetControl1.TabIndex = 5;
// //
// Form1 // Form1
// //
...@@ -269,7 +287,7 @@ namespace AutoCountMachine ...@@ -269,7 +287,7 @@ namespace AutoCountMachine
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "Form1"; this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "在线点料贴标机"; this.Text = "在线点料贴标机";
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
...@@ -304,7 +322,8 @@ namespace AutoCountMachine ...@@ -304,7 +322,8 @@ namespace AutoCountMachine
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListView listView_reelnfo; private System.Windows.Forms.ListView listView_reelnfo;
private System.Windows.Forms.Button btn_releaseshelf; private System.Windows.Forms.Button btn_releaseshelf;
private UCCOMMON.BoxResetControl boxResetControl1; private System.Windows.Forms.ComboBox cmb_runmode;
private BoxResetControl boxResetControl1;
} }
} }
...@@ -156,7 +156,7 @@ namespace AutoCountMachine ...@@ -156,7 +156,7 @@ namespace AutoCountMachine
listView_reelnfo.View = View.Details; listView_reelnfo.View = View.Details;
ColumnHeader d1 = new ColumnHeader(); ColumnHeader d1 = new ColumnHeader();
d1.Text = "时间"; d1.Text = "时间";
d1.Width = 90; d1.Width = 110;
ColumnHeader d2 = new ColumnHeader(); ColumnHeader d2 = new ColumnHeader();
d2.Text = "ReelID"; d2.Text = "ReelID";
d2.Width = 100; d2.Width = 100;
...@@ -182,6 +182,7 @@ namespace AutoCountMachine ...@@ -182,6 +182,7 @@ namespace AutoCountMachine
m.msgLevel = MsgLevel.info; m.msgLevel = MsgLevel.info;
lm.Add(m); lm.Add(m);
Device_ProcessMsgEvent(null, lm); Device_ProcessMsgEvent(null, lm);
cmb_runmode.Text = "ONLINE";
} }
private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
{ {
...@@ -333,6 +334,7 @@ namespace AutoCountMachine ...@@ -333,6 +334,7 @@ namespace AutoCountMachine
{ {
btn_run.Text = "启动"; btn_run.Text = "启动";
RobotManage.Stop(); RobotManage.Stop();
userpause = false;
} }
private void 二维码识别调试toolStripMenuItem_Click(object sender, EventArgs e) private void 二维码识别调试toolStripMenuItem_Click(object sender, EventArgs e)
...@@ -368,5 +370,31 @@ namespace AutoCountMachine ...@@ -368,5 +370,31 @@ namespace AutoCountMachine
MessageBox.Show("料架释放失败"); MessageBox.Show("料架释放失败");
} }
} }
private void cmb_runmode_SelectedIndexChanged(object sender, EventArgs e)
{
RobotManage.offlinereelLocation = new ReelLocation();
switch (cmb_runmode.Text){
case "ONLINE":
RobotManage.offlinemode = false;
break;
case "NG":
RobotManage.offlinemode = true;
break;
case "MSD":
RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVacuum = "true";
break;
case "PAPER":
RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVTTower = "true";
break;
case "TOWER":
RobotManage.offlinereelLocation.isTower = "true";
RobotManage.offlinemode = true;
break;
}
}
} }
} }
...@@ -44,6 +44,7 @@ namespace AutoCountMachine ...@@ -44,6 +44,7 @@ namespace AutoCountMachine
this.configControl1 = new AutoCountMachine.ConfigControl(); this.configControl1 = new AutoCountMachine.ConfigControl();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl(); this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.checkBox_saveLabelDebugBmp = new System.Windows.Forms.CheckBox(); this.checkBox_saveLabelDebugBmp = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.btn_LabelTest = new System.Windows.Forms.Button(); this.btn_LabelTest = new System.Windows.Forms.Button();
...@@ -53,7 +54,6 @@ namespace AutoCountMachine ...@@ -53,7 +54,6 @@ namespace AutoCountMachine
this.btn_labeledit = new System.Windows.Forms.Button(); this.btn_labeledit = new System.Windows.Forms.Button();
this.cb_labelselect = new System.Windows.Forms.ComboBox(); this.cb_labelselect = new System.Windows.Forms.ComboBox();
this.cb_printerselect = new System.Windows.Forms.ComboBox(); this.cb_printerselect = new System.Windows.Forms.ComboBox();
this.button2 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
...@@ -219,7 +219,7 @@ namespace AutoCountMachine ...@@ -219,7 +219,7 @@ namespace AutoCountMachine
this.configControl1.Config = null; this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(558, 3); this.configControl1.Location = new System.Drawing.Point(558, 3);
this.configControl1.Name = "configControl1"; this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(637, 487); this.configControl1.Size = new System.Drawing.Size(637, 569);
this.configControl1.TabIndex = 0; this.configControl1.TabIndex = 0;
// //
// axisMoveControl1 // axisMoveControl1
...@@ -243,6 +243,16 @@ namespace AutoCountMachine ...@@ -243,6 +243,16 @@ namespace AutoCountMachine
this.tabPage3.Text = "标签设置"; this.tabPage3.Text = "标签设置";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// button2
//
this.button2.Location = new System.Drawing.Point(216, 284);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(121, 42);
this.button2.TabIndex = 5;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// checkBox_saveLabelDebugBmp // checkBox_saveLabelDebugBmp
// //
this.checkBox_saveLabelDebugBmp.AutoSize = true; this.checkBox_saveLabelDebugBmp.AutoSize = true;
...@@ -336,16 +346,6 @@ namespace AutoCountMachine ...@@ -336,16 +346,6 @@ namespace AutoCountMachine
this.cb_printerselect.TabIndex = 0; this.cb_printerselect.TabIndex = 0;
this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged); this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged);
// //
// button2
//
this.button2.Location = new System.Drawing.Point(216, 284);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(121, 42);
this.button2.TabIndex = 5;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// LabelControl // LabelControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......
...@@ -22,6 +22,7 @@ namespace AutoCountMachine ...@@ -22,6 +22,7 @@ namespace AutoCountMachine
[STAThread] [STAThread]
static void Main() static void Main()
{ {
//OcrProcess.Run();
//ServerConn.inputCounterDataByXRayMachine("20.K0784.008-615313|1KQ-2111|5000|A2061531315212446|PANASONIC", 9); //ServerConn.inputCounterDataByXRayMachine("20.K0784.008-615313|1KQ-2111|5000|A2061531315212446|PANASONIC", 9);
//return; //return;
_ = new Mutex(true, Application.ProductName, out bool ret); _ = new Mutex(true, Application.ProductName, out bool ret);
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AutoCountMachine.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
...@@ -174,15 +174,6 @@ ...@@ -174,15 +174,6 @@
</EmbeddedResource> </EmbeddedResource>
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
......
...@@ -40,8 +40,6 @@ namespace AutoCountMachine ...@@ -40,8 +40,6 @@ namespace AutoCountMachine
this.cylinderButton6 = new AutoCountMachine.CylinderButton(); this.cylinderButton6 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton(); this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.cylinderButton4 = new AutoCountMachine.CylinderButton(); this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton3 = new AutoCountMachine.CylinderButton();
this.cylinderButton2 = new AutoCountMachine.CylinderButton();
this.cylinderButton11 = new AutoCountMachine.CylinderButton(); this.cylinderButton11 = new AutoCountMachine.CylinderButton();
this.cylinderButton10 = new AutoCountMachine.CylinderButton(); this.cylinderButton10 = new AutoCountMachine.CylinderButton();
this.cylinderButton9 = new AutoCountMachine.CylinderButton(); this.cylinderButton9 = new AutoCountMachine.CylinderButton();
...@@ -57,6 +55,10 @@ namespace AutoCountMachine ...@@ -57,6 +55,10 @@ namespace AutoCountMachine
this.label_eyemMulFuncTool = new System.Windows.Forms.Label(); this.label_eyemMulFuncTool = new System.Windows.Forms.Label();
this.btn_eyemMulFuncTool = new System.Windows.Forms.Button(); this.btn_eyemMulFuncTool = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_Empty_Linerun = new System.Windows.Forms.Button();
this.btn_Empty_Linestop = new System.Windows.Forms.Button();
this.btn_Full_Linerun = new System.Windows.Forms.Button();
this.btn_Full_Linestop = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
...@@ -79,6 +81,10 @@ namespace AutoCountMachine ...@@ -79,6 +81,10 @@ namespace AutoCountMachine
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.btn_Full_Linestop);
this.tabPage1.Controls.Add(this.btn_Full_Linerun);
this.tabPage1.Controls.Add(this.btn_Empty_Linestop);
this.tabPage1.Controls.Add(this.btn_Empty_Linerun);
this.tabPage1.Controls.Add(this.btn_Reset); this.tabPage1.Controls.Add(this.btn_Reset);
this.tabPage1.Controls.Add(this.btn_release); this.tabPage1.Controls.Add(this.btn_release);
this.tabPage1.Controls.Add(this.btn_clamp); this.tabPage1.Controls.Add(this.btn_clamp);
...@@ -88,8 +94,6 @@ namespace AutoCountMachine ...@@ -88,8 +94,6 @@ namespace AutoCountMachine
this.tabPage1.Controls.Add(this.cylinderButton6); this.tabPage1.Controls.Add(this.cylinderButton6);
this.tabPage1.Controls.Add(this.cylinderButton5); this.tabPage1.Controls.Add(this.cylinderButton5);
this.tabPage1.Controls.Add(this.cylinderButton4); this.tabPage1.Controls.Add(this.cylinderButton4);
this.tabPage1.Controls.Add(this.cylinderButton3);
this.tabPage1.Controls.Add(this.cylinderButton2);
this.tabPage1.Controls.Add(this.cylinderButton11); this.tabPage1.Controls.Add(this.cylinderButton11);
this.tabPage1.Controls.Add(this.cylinderButton10); this.tabPage1.Controls.Add(this.cylinderButton10);
this.tabPage1.Controls.Add(this.cylinderButton9); this.tabPage1.Controls.Add(this.cylinderButton9);
...@@ -214,32 +218,6 @@ namespace AutoCountMachine ...@@ -214,32 +218,6 @@ namespace AutoCountMachine
this.cylinderButton4.Text = "EmptyString_Sliding_Run"; this.cylinderButton4.Text = "EmptyString_Sliding_Run";
this.cylinderButton4.UseVisualStyleBackColor = false; this.cylinderButton4.UseVisualStyleBackColor = false;
// //
// cylinderButton3
//
this.cylinderButton3.BackColor = System.Drawing.Color.White;
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Line_Out_Run";
this.cylinderButton3.IO_LOW = "";
this.cylinderButton3.Location = new System.Drawing.Point(545, 249);
this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(215, 35);
this.cylinderButton3.TabIndex = 300;
this.cylinderButton3.Text = "Line_Out_Run";
this.cylinderButton3.UseVisualStyleBackColor = false;
//
// cylinderButton2
//
this.cylinderButton2.BackColor = System.Drawing.Color.White;
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "Empty_Line_Run";
this.cylinderButton2.IO_LOW = "";
this.cylinderButton2.Location = new System.Drawing.Point(545, 208);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(215, 35);
this.cylinderButton2.TabIndex = 300;
this.cylinderButton2.Text = "Empty_Line_Run";
this.cylinderButton2.UseVisualStyleBackColor = false;
//
// cylinderButton11 // cylinderButton11
// //
this.cylinderButton11.BackColor = System.Drawing.Color.White; this.cylinderButton11.BackColor = System.Drawing.Color.White;
...@@ -407,6 +385,46 @@ namespace AutoCountMachine ...@@ -407,6 +385,46 @@ namespace AutoCountMachine
this.pictureBox1.TabIndex = 0; this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
// //
// btn_Empty_Linerun
//
this.btn_Empty_Linerun.Location = new System.Drawing.Point(545, 209);
this.btn_Empty_Linerun.Name = "btn_Empty_Linerun";
this.btn_Empty_Linerun.Size = new System.Drawing.Size(102, 34);
this.btn_Empty_Linerun.TabIndex = 305;
this.btn_Empty_Linerun.Text = "空料串线体开";
this.btn_Empty_Linerun.UseVisualStyleBackColor = true;
this.btn_Empty_Linerun.Click += new System.EventHandler(this.btn_Empty_Linerun_Click);
//
// btn_Empty_Linestop
//
this.btn_Empty_Linestop.Location = new System.Drawing.Point(658, 209);
this.btn_Empty_Linestop.Name = "btn_Empty_Linestop";
this.btn_Empty_Linestop.Size = new System.Drawing.Size(102, 34);
this.btn_Empty_Linestop.TabIndex = 305;
this.btn_Empty_Linestop.Text = "空料串线体关";
this.btn_Empty_Linestop.UseVisualStyleBackColor = true;
this.btn_Empty_Linestop.Click += new System.EventHandler(this.btn_Empty_Linestop_Click);
//
// btn_Full_Linerun
//
this.btn_Full_Linerun.Location = new System.Drawing.Point(545, 249);
this.btn_Full_Linerun.Name = "btn_Full_Linerun";
this.btn_Full_Linerun.Size = new System.Drawing.Size(102, 34);
this.btn_Full_Linerun.TabIndex = 305;
this.btn_Full_Linerun.Text = "满料串线体开";
this.btn_Full_Linerun.UseVisualStyleBackColor = true;
this.btn_Full_Linerun.Click += new System.EventHandler(this.btn_Full_Linerun_Click);
//
// btn_Full_Linestop
//
this.btn_Full_Linestop.Location = new System.Drawing.Point(658, 249);
this.btn_Full_Linestop.Name = "btn_Full_Linestop";
this.btn_Full_Linestop.Size = new System.Drawing.Size(102, 34);
this.btn_Full_Linestop.TabIndex = 305;
this.btn_Full_Linestop.Text = "满料串线体关";
this.btn_Full_Linestop.UseVisualStyleBackColor = true;
this.btn_Full_Linestop.Click += new System.EventHandler(this.btn_Full_Linestop_Click);
//
// T1Control // T1Control
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -439,8 +457,6 @@ namespace AutoCountMachine ...@@ -439,8 +457,6 @@ namespace AutoCountMachine
private CylinderButton cylinderButton6; private CylinderButton cylinderButton6;
private CylinderButton cylinderButton5; private CylinderButton cylinderButton5;
private CylinderButton cylinderButton4; private CylinderButton cylinderButton4;
private CylinderButton cylinderButton3;
private CylinderButton cylinderButton2;
private CylinderButton cylinderButton11; private CylinderButton cylinderButton11;
private CylinderButton cylinderButton10; private CylinderButton cylinderButton10;
private CylinderButton cylinderButton9; private CylinderButton cylinderButton9;
...@@ -454,5 +470,9 @@ namespace AutoCountMachine ...@@ -454,5 +470,9 @@ namespace AutoCountMachine
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_eyemMulFuncTool; private System.Windows.Forms.Button btn_eyemMulFuncTool;
private System.Windows.Forms.Label label_eyemMulFuncTool; private System.Windows.Forms.Label label_eyemMulFuncTool;
private System.Windows.Forms.Button btn_Full_Linestop;
private System.Windows.Forms.Button btn_Full_Linerun;
private System.Windows.Forms.Button btn_Empty_Linestop;
private System.Windows.Forms.Button btn_Empty_Linerun;
} }
} }
...@@ -50,7 +50,7 @@ namespace AutoCountMachine ...@@ -50,7 +50,7 @@ namespace AutoCountMachine
{ {
Invoke((EventHandler<Bitmap>)delegate{ Invoke((EventHandler<Bitmap>)delegate{
pictureBox1.Image = e; pictureBox1.Image = e;
}); }, sender, e);
} }
private void XrayControl_Load(object sender, EventArgs e) private void XrayControl_Load(object sender, EventArgs e)
...@@ -84,5 +84,25 @@ namespace AutoCountMachine ...@@ -84,5 +84,25 @@ namespace AutoCountMachine
pictureBox1.Image = bitmap; pictureBox1.Image = bitmap;
} }
private void btn_Empty_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfInLine.LineRun();
}
private void btn_Empty_Linestop_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfInLine.LineStop("n");
}
private void btn_Full_Linerun_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfOutLine.LineRun();
}
private void btn_Full_Linestop_Click(object sender, EventArgs e)
{
RobotManage.t1Machine.ShelfOutLine.LineStop("n");
}
} }
} }
 
namespace AutoCountMachine.UCCOMMON namespace AutoCountMachine
{ {
partial class BoxResetControl partial class BoxResetControl
{ {
......
...@@ -10,7 +10,7 @@ using System.Threading; ...@@ -10,7 +10,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AutoCountMachine.UCCOMMON namespace AutoCountMachine
{ {
public partial class BoxResetControl : UserControl public partial class BoxResetControl : UserControl
{ {
...@@ -18,13 +18,21 @@ namespace AutoCountMachine.UCCOMMON ...@@ -18,13 +18,21 @@ namespace AutoCountMachine.UCCOMMON
public BoxResetControl() public BoxResetControl()
{ {
InitializeComponent(); InitializeComponent();
if (GetIsDesignMode())
return;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
timer = new System.Timers.Timer(); timer = new System.Timers.Timer();
timer.Interval = 1000; timer.Interval = 1000;
timer.AutoReset = true; timer.AutoReset = true;
timer.Elapsed += Timer_Elapsed; timer.Elapsed += Timer_Elapsed;
timer.Enabled = false;
GC.KeepAlive(timer); GC.KeepAlive(timer);
} }
private bool GetIsDesignMode()
{
return (this.GetService(typeof(System.ComponentModel.Design.IDesignerHost)) != null
|| LicenseManager.UsageMode == LicenseUsageMode.Designtime);
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
...@@ -48,6 +56,8 @@ namespace AutoCountMachine.UCCOMMON ...@@ -48,6 +56,8 @@ namespace AutoCountMachine.UCCOMMON
{ {
if (state) if (state)
{ {
this.Invoke((EventHandler)delegate
{
NgCountBar.Maximum = RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT; NgCountBar.Maximum = RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT;
MsdCountBar.Maximum = RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT; MsdCountBar.Maximum = RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT;
PaperCountBar.Maximum = RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT; PaperCountBar.Maximum = RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT;
...@@ -56,6 +66,7 @@ namespace AutoCountMachine.UCCOMMON ...@@ -56,6 +66,7 @@ namespace AutoCountMachine.UCCOMMON
PaperCountBar.ForeColor = Color.MediumSeaGreen; PaperCountBar.ForeColor = Color.MediumSeaGreen;
timer.Enabled = true; timer.Enabled = true;
timer.Start(); timer.Start();
});
} }
} }
......
...@@ -35,7 +35,7 @@ namespace AutoCountMachine ...@@ -35,7 +35,7 @@ namespace AutoCountMachine
void LoadPosList() void LoadPosList()
{ {
int maxrow = tableLayoutPanel1.Height / 33; int maxrow = tableLayoutPanel1.Height / 34;
this.tableLayoutPanel1.RowStyles.Clear(); this.tableLayoutPanel1.RowStyles.Clear();
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26)); //this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26));
int r = 0; int r = 0;
......
...@@ -218,7 +218,7 @@ namespace AutoCountMachine ...@@ -218,7 +218,7 @@ namespace AutoCountMachine
LastCountWareCode = RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode; LastCountWareCode = RobotManage.xrayMachine.MoveInfo.ReelParam.WareCode;
countstate?.Invoke(this, "打开X光"); countstate?.Invoke(this, "打开X光");
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH); RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH);
Thread.Sleep(300); Thread.Sleep(1000);
RobotManage.XRay.Start(); RobotManage.XRay.Start();
Thread.Sleep(1000); Thread.Sleep(1000);
countstate?.Invoke(this, "获取图像"); countstate?.Invoke(this, "获取图像");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!