Commit 4a15362d 刘韬

0707

1 个父辈 305cfba8
正在显示 41 个修改的文件 包含 687 行增加211 行删除
...@@ -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)
{ {
......
...@@ -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;
//是否允许进入贴标线体 //是否允许进入贴标线体
...@@ -46,23 +46,37 @@ namespace DeviceLibrary ...@@ -46,23 +46,37 @@ namespace DeviceLibrary
case MoveStep.Lbl_01_Wait_ATray: case MoveStep.Lbl_01_Wait_ATray:
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;
preReelParam = null; preReelParam = null;
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);
ScanTask = ScanCode(); break;
case MoveStep.Lbl_05_ScanCode:
MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
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,
...@@ -117,8 +118,7 @@ namespace DeviceLibrary ...@@ -117,8 +118,7 @@ namespace DeviceLibrary
T1_08_DownToShelf, T1_08_DownToShelf,
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
...@@ -70,14 +72,16 @@ namespace DeviceLibrary ...@@ -70,14 +72,16 @@ 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;
......
...@@ -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,12 +277,15 @@ namespace DeviceLibrary ...@@ -275,12 +277,15 @@ 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); {
if (cl == null) { var cl = ServerConn.inputCounterDataByXRayMachine(MoveInfo.ReelParam.WareCode, count);
MoveInfo.ReelParam.IsNg = true; if (cl == null)
MoveInfo.ReelParam.NgMsg = "点料数量上传失败"; {
MoveInfo.ReelParam.logresult(); MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "点料数量上传失败";
MoveInfo.ReelParam.logresult();
}
} }
} }
else { else {
......
...@@ -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,7 +2,15 @@ ...@@ -2,7 +2,15 @@
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections> <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>
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1" />
...@@ -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,14 +56,17 @@ namespace AutoCountMachine.UCCOMMON ...@@ -48,14 +56,17 @@ namespace AutoCountMachine.UCCOMMON
{ {
if (state) if (state)
{ {
NgCountBar.Maximum = RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT; this.Invoke((EventHandler)delegate
MsdCountBar.Maximum = RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT; {
PaperCountBar.Maximum = RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT; NgCountBar.Maximum = RobotManage.filterMachine.Config.NG_BOX_MAXCOUNT;
MsdCountBar.Maximum = RobotManage.filterMachine.Config.MSD_BOX_MAXCOUNT;
PaperCountBar.Maximum = RobotManage.filterMachine.Config.PAPER_BOX_MAXCOUNT;
MsdCountBar.ForeColor = Color.MediumSeaGreen; MsdCountBar.ForeColor = Color.MediumSeaGreen;
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!