Commit f2d7e2f6 刘韬

分化分料线

修改前: NG阻挡放行后, MSD阻挡检测到盘 NG阻挡就立刻放下
修改后: NG阻挡放行后等待3秒 MSD阻挡检测到盘 NG阻挡就立刻放下
1 个父辈 cb283aa7
......@@ -33,7 +33,7 @@ namespace DeviceLibrary
public bool IgnoreGratingSignal { get; set; }
public int NGBox_Count { get => nGBox_Count; set { nGBox_Count = value; ConfigHelper.Config.Set("NGBox_Count", value); ConfigHelper.Config.SaveChange(); } }
public int MSDBox_Count { get => mSDBox_Count; set { mSDBox_Count = value; ConfigHelper.Config.Set("MSDBox_Count", value); ConfigHelper.Config.SaveChange(); } }
public int PaperBox_Count { get => paperBox_Count; set { mSDBox_Count = value; ConfigHelper.Config.Set("PaperBox_Count", value); ConfigHelper.Config.SaveChange(); } }
public int PaperBox_Count { get => paperBox_Count; set { paperBox_Count = value; ConfigHelper.Config.Set("PaperBox_Count", value); ConfigHelper.Config.SaveChange(); } }
private int nGBox_Count = 0;
private int mSDBox_Count = 0;
......
......@@ -26,7 +26,7 @@ namespace DeviceLibrary
{
case MoveStep.Filter_01_WaitReel:
//MoveInfo.log("上料区阻挡上升");
if (IOValue(IO_Filter_Type.NG_TaryStop_Check).Equals(IO_VALUE.HIGH) && preReelParam != null)
if (IOValue(IO_Filter_Type.NG_TaryStop_Check,IO_VALUE.HIGH) && preReelParam != null)
{
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
......@@ -43,11 +43,11 @@ namespace DeviceLibrary
{
MoveInfo.NextMoveStep(MoveStep.Filter_20_MSDReel_wait);
}
else if (MoveInfo.ReelParam.ReelDest == ReelDest.Paper)
else if (MoveInfo.ReelParam.ReelDest == ReelDest.VT_Tower)
{
MoveInfo.NextMoveStep(MoveStep.Filter_30_PaperReel_wait);
}
else if (MoveInfo.ReelParam.ReelDest == ReelDest.String)
else if (MoveInfo.ReelParam.ReelDest == ReelDest.Tower)
{
MoveInfo.NextMoveStep(MoveStep.Filter_40_Reel_through_wait);
}
......@@ -125,20 +125,29 @@ namespace DeviceLibrary
case MoveStep.Filter_23_MSDReel_End:
MoveInfo.NextMoveStep(MoveStep.Filter_END);
MoveInfo.log("MSD料推出完毕");
CylinderMove(MoveInfo, IO_Filter_Type.MSD_GetOut_Bck, IO_Filter_Type.MSD_GetOut_Fwd, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.MSD_GetOut_Bck, IO_Filter_Type.MSD_GetOut_Fwd, IO_VALUE.LOW);
break;
///料穿过
case MoveStep.Filter_40_Reel_through_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_41_Reel_through);
MoveInfo.NextMoveStep(MoveStep.Filter_41_Reel_through_wait);
MoveInfo.log("料穿过,NG,Paper阻挡上升");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.HIGH);
CylinderMove(MoveInfo, IO_Filter_Type.Paper_TaryStop_Down, IO_Filter_Type.Paper_TaryStop_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Filter_Type.MSD_TaryStop_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break;
case MoveStep.Filter_41_Reel_through_wait:
MoveInfo.NextMoveStep(MoveStep.Filter_41_Reel_through);
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.LOW);
MoveInfo.log("料穿过,NG阻挡下降");
break;
case MoveStep.Filter_41_Reel_through:
if (RobotManage.t1Machine.TrayCanIN())
{
MoveInfo.NextMoveStep(MoveStep.Filter_42_Reel_through_Wait);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH);
MoveInfo.log("料穿过,MSD阻挡上升,NG,Paper阻挡下降");
CylinderMove(MoveInfo, IO_Filter_Type.NG_TaryStop_Down, IO_Filter_Type.NG_TaryStop_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.HIGH);
......
......@@ -58,6 +58,14 @@ namespace DeviceLibrary
{
AlarmLed.LedState = LedState.on;
}
if (UserPause)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.blink;
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
......
......@@ -160,6 +160,7 @@ namespace DeviceLibrary
//File.Delete(file + ".temp.bmp");
var l = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
List<TextBlock> newlist = new List<TextBlock>();
List<TextBlock> highscorelist = new List<TextBlock>();
//过滤合规数据
foreach (var t in l.ToArray())
{
......@@ -176,12 +177,15 @@ namespace DeviceLibrary
}
if (s1 > 0.9)
{
newlist.Clear();
newlist.Add(t);
//newlist.Clear();
highscorelist.Add(t);
MoveInfo.log($"s1:{s1}>0.93 , {t.Text}");
break;
//break;
}
}
if (highscorelist.Count > 0)
newlist = highscorelist;
//List<Point> RightPoint
Point labelPoint = Point.Empty;
double labelAngle = 0;
......
......@@ -24,7 +24,7 @@ namespace DeviceLibrary
//是否允许进入贴标线体
public bool TrayCanIN()
{
return IOValue(IO_Label_Type.Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Label_Type.TrayStop_Down).Equals(IO_VALUE.HIGH);
return IOValue(IO_Label_Type.Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Label_Type.TrayStop_Down).Equals(IO_VALUE.HIGH) && preReelParam==null;
//return IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.LOW);
}
......@@ -61,7 +61,7 @@ namespace DeviceLibrary
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}");
if (Tray_Check.Equals(IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
if (IOValue(IO_Label_Type.Tray_Check,IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = preReelParam;
......@@ -108,11 +108,11 @@ namespace DeviceLibrary
ReelLocation reelLocation1 = RobotManage.offlinereelLocation;
if (!string.IsNullOrEmpty(reelLocation1.isTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.String;
MoveInfo.ReelParam.ReelDest = ReelDest.Tower;
}
else if (!string.IsNullOrEmpty(reelLocation1.isVTTower))
{
MoveInfo.ReelParam.ReelDest = ReelDest.Paper;
MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
}
else if (!string.IsNullOrEmpty(reelLocation1.isVacuum))
{
......@@ -154,15 +154,15 @@ namespace DeviceLibrary
else
{
if (!string.IsNullOrEmpty(reelLocation.isTower))
if (reelLocation.isTower=="1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.String;
MoveInfo.ReelParam.ReelDest = ReelDest.Tower;
}
else if (!string.IsNullOrEmpty(reelLocation.isVTTower))
else if (reelLocation.isVTTower == "1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.Paper;
MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
}
else if (!string.IsNullOrEmpty(reelLocation.isVacuum))
else if (reelLocation.isVacuum == "1")
{
MoveInfo.ReelParam.ReelDest = ReelDest.MSD;
}
......@@ -174,13 +174,17 @@ namespace DeviceLibrary
MoveInfo.ReelParam.logresult();
MoveInfo.log("服务器没有返回明确目标");
}
MoveInfo.log(MoveInfo.ReelParam.ToStr());
if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg)
{
printTask = DoPrint(MoveInfo.ReelParam, false);
}
//开始吸标
VacuumMoveInfo.ReelParam = MoveInfo.ReelParam;
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
if (!MoveInfo.ReelParam.IsNg)
{
//开始吸标
VacuumMoveInfo.ReelParam = MoveInfo.ReelParam;
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
}
}
break;
case MoveStep.Lbl_03_LineRun:
......@@ -206,7 +210,8 @@ namespace DeviceLibrary
MoveInfo.log($"线体1,2停止运行,并拍照 Label_TaryStop_Check:{IOValue(IO_Label_Type.Label_TaryStop_Check)}");
RobotManage.Line1.LineStop("label", "Lbl_04_LineStop");
RobotManage.Line2.LineStop("label", "Lbl_04_LineStop");
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);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.Lbl_05_ScanCode:
//MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
......@@ -216,26 +221,26 @@ namespace DeviceLibrary
//Task.Delay(1000).Wait();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.Lbl_05_Wait:
if (SendOutMoveInfo.MoveStep == MoveStep.Wait)
{
CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
MoveInfo.log("贴标阻挡上升");
}
else
{
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", RobotManage.filterMachine.DeviceName), MsgLevel.warning);
MoveInfo.log("贴标阻挡上升,等待到达分盘线");
}
break;
//case MoveStep.Lbl_05_Wait:
// if (SendOutMoveInfo.MoveStep == MoveStep.Wait)
// {
// CylinderMove(MoveInfo, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
// MoveInfo.log("贴标阻挡上升");
// }
// else
// {
// Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", RobotManage.filterMachine.DeviceName), MsgLevel.warning);
// MoveInfo.log("贴标阻挡上升,等待到达分盘线");
// }
// break;
case MoveStep.Lbl05:
if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_end)
{
MoveInfo.NextMoveStep(MoveStep.Lbl06);
Label_X_Axis.AbsMove(MoveInfo, Config.Label_X_Base, Config.Label_X_Base_speed);
Label_Y_Axis.AbsMove(MoveInfo, Config.Label_Y_Base, Config.Label_X_Base_speed);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
MoveInfo.log("Label_XYZ转到贴标准备点.");
//Label_X_Axis.AbsMove(MoveInfo, Config.Label_X_Base, Config.Label_X_Base_speed);
//Label_Y_Axis.AbsMove(MoveInfo, Config.Label_Y_Base, Config.Label_X_Base_speed);
//Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
//MoveInfo.log("Label_XYZ转到贴标准备点.");
}
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_failure)
{
......@@ -268,20 +273,21 @@ namespace DeviceLibrary
case MoveStep.Lbl10:
break;
case MoveStep.Lbl11:
MoveInfo.NextMoveStep(MoveStep.Lbl13);
MoveInfo.NextMoveStep(MoveStep.Lbl12);
var p5 = Config.Label_Z_P5;
p5 = p5 - (MoveInfo.ReelParam.PlateRawH - 10) * Config.Label_Z_Axis_ChangeValue;
Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed);
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.log($"取标气缸下降p5:{p5}={Config.Label_Z_P5}-({MoveInfo.ReelParam.PlateRawH}-10)*{Config.Label_Z_Axis_ChangeValue}.关闭吸气.");
break;
case MoveStep.Lbl12:
MoveInfo.NextMoveStep(MoveStep.Lbl13);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
IOMove(IO_Label_Type.LabelCylinder_Work, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.Lbl13:
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
Label_Z_Axis.AbsMove(null, Config.Label_Z_P2, Config.Label_Z_P2_speed);
Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
MoveInfo.ReelParam.LabelState = "Ok";
MoveInfo.log("取标气缸上升.");
break;
......@@ -339,6 +345,7 @@ namespace DeviceLibrary
{
RobotManage.Line2.LineRun("label", 15, "Lbl_BeginOut");
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (MoveInfo.IsTimeOut(30))
{
......@@ -372,14 +379,14 @@ namespace DeviceLibrary
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
SendOutMoveInfo.log("完成贴标.");
}
else if (MoveInfo.IsTimeOut(30))
else if (SendOutMoveInfo.IsTimeOut(30))
{
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
RobotManage.filterMachine.preReelParam = null;
SendOutMoveInfo.log("等待料盘到达分盘线超时.完成贴标.");
}
else if (MoveInfo.IsTimeOut(5))
else if (SendOutMoveInfo.IsTimeOut(5))
{
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.filterMachine.DeviceName), MsgLevel.warning);
SendOutMoveInfo.log("等待到达分盘线");
......
......@@ -378,6 +378,11 @@ namespace DeviceLibrary
{
return IOManager.IOValue(ioType, Config);
}
public bool IOValue(string ioType, IO_VALUE Test_VALUE, int DebounceCount=3)
{
return IODebounce<bool>.Test(ioType, IOManager.IOValue(ioType, Config), Test_VALUE, DebounceCount);
//return IOManager.IOValue(ioType, Config);
}
public void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0)
{
if (msTime <= 0)
......
......@@ -107,6 +107,7 @@ namespace DeviceLibrary
Filter_32_PaperReel_PushOut,
Filter_33_PaperReel_End,
Filter_40_Reel_through_wait,
Filter_41_Reel_through_wait,
Filter_41_Reel_through,
Filter_42_Reel_through_Wait,
Filter_END,
......@@ -130,6 +131,7 @@ namespace DeviceLibrary
LblVacuum_end,
LblVacuum_failure,
LblVacuum_printfail,
T1_08_UpReelOk,
T1_08_UpReelFail,
T1_09_ReleaseReel_Fail,
T1_09_ReleaseReel_Test,
......
......@@ -10,6 +10,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using X_Ray;
namespace DeviceLibrary
{
......@@ -20,7 +21,7 @@ namespace DeviceLibrary
public static LabelMachine labelMachine;
public static FilterMachine filterMachine;
public static T1Machine t1Machine;
public static XRay XRay=new Asa.XRay("XRay");
public static XRay XRay=new XRay("XRay");
public static XrayImage xrayImage = new Asa.XrayImage("XrayImage", XrayImage.DeviceType.HAOBO);
public static Config_XRay Config;
public static bool IsLoadOk = true;
......@@ -110,6 +111,7 @@ namespace DeviceLibrary
}
Line1 = new LineRunMonitor("line1", labelMachine.Config.DOList[IO_Label_Type.Line1_Run].GetIOAddr());
Line2 = new LineRunMonitor("line2", labelMachine.Config.DOList[IO_Label_Type.Line2_Run].GetIOAddr());
LogUtil.info($"XRay StartDate:{UseData.GetStartDateTime},TotalSecond:{UseData.GetTotalUseSeconds},TotalTimes:{UseData.GetTimes}");
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msgs);
}
catch (Exception ex) {
......
......@@ -52,6 +52,14 @@ namespace DeviceLibrary
{
AlarmLed.LedState = LedState.on;
}
if (UserPause)
{
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.blink;
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
......
......@@ -31,10 +31,10 @@ namespace DeviceLibrary
public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; }
public AxisBean T_Batch_Axis;
AxisBean T_Pan_Axis;
AxisBean T_Updown_Axis;
public AxisBean T_Pan_Axis;
public AxisBean T_Updown_Axis;
AxisBean T_TrayPos_Axis;
AxisBean T_Y_Axis;
public AxisBean T_Y_Axis;
MoveInfo ShelfOutMoveInfo;
MoveInfo ShelfInMoveInfo;
public LineRunMonitor ShelfOutLine;
......
......@@ -38,7 +38,7 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep)
{
case MoveStep.T1_01_WaitReel:
if (End_Line_Tray_Check.Equals(IO_VALUE.HIGH) && preReelParam != null)
if (IOValue(IO_T1_Type.End_Line_Tray_Check,IO_VALUE.HIGH) && preReelParam != null)
{
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
......@@ -102,9 +102,9 @@ namespace DeviceLibrary
case MoveStep.T1_07_PanToOut:
if (IOValue(IO_T1_Type.End_Lift_Tray_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(MoveStep.T1_08_DownToShelf);
MoveInfo.NextMoveStep(MoveStep.T1_08_UpReelOk);
MoveInfo.log($"横移到料串");
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P2, Config.Pan_P2_speed);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.LOW);
}
else if (MoveInfo.IsTimeOut(2))
......@@ -113,6 +113,18 @@ namespace DeviceLibrary
}
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_08_UpReelOk:
if (ShelfInMoveInfo.MoveStep == MoveStep.Shelf_20_EmptyIn_ShelfReady)
{
MoveInfo.NextMoveStep(MoveStep.T1_08_DownToShelf);
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P2, Config.Pan_P2_speed);
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_shelf_ready", "等待料串准备完成"), MsgLevel.warning);
}
break;
case MoveStep.T1_08_UpReelFail:
Msg.add(crc.GetString("T1_grip_fail","出料机构抓料失败,请人工处理"), MsgLevel.warning);
if (IOValue(IO_T1_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
......@@ -128,18 +140,18 @@ namespace DeviceLibrary
var offset_x = LastStringCenter.X - CenterPos.X;
var offset_y = LastStringCenter.Y - CenterPos.Y;
offset_x = offset_x * -1;
offset_y = offset_y * -1;
var Y = Config.Y_P2 + offset_y * Config.Cam_Pixel_Y_Ratio;
var Pan_X = Config.Pan_P2 + offset_x * Config.Cam_Pixel_X_Ratio;
T_Pan_Axis.AbsMove(MoveInfo, Pan_X, Config.Pan_P2_speed);
T_Y_Axis.AbsMove(MoveInfo, Y, Config.Y_P2_speed);
int p3pos = Config.UpdownAxis_P3 - (MoveInfo.ReelParam.PlateRawH - 8) * Config.UpdownAxis_ChangeValue;
T_Updown_Axis.AbsMove(MoveInfo, p3pos, Config.UpdownAxis_P3_speed);
MoveInfo.log($"下降到料串 CenterPos:{CenterPos}, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},p3pos:{p3pos}");
MoveInfo.log($"下降到料串 CenterPos:{CenterPos},AxisBase:{Config.Pan_P2},{Config.Y_P2},, StringCenter:{LastStringCenter}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)},p3pos:{p3pos}");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(30))
......@@ -518,16 +530,17 @@ namespace DeviceLibrary
}
public (Bitmap, Point, string) GetStringCenter(bool isFirst = false)
{
if (isFirst)
return GetStringCenterA();
else
return GetStringCenterB();
//if (isFirst)
// return GetStringCenterA();
//else
return GetStringCenterC();
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterA()
{
//return (null, 0, "调试屏蔽");
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
//Bitmap bmap = new Bitmap(@"D:\logs\853\Image_20210921151717963.bmp");
Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height);
......@@ -605,6 +618,127 @@ namespace DeviceLibrary
return (newbitmap, currpos, debugtxt);
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterC()
{
Directory.CreateDirectory("\\image\\TrayString\\");
//return (null, 0, "调试屏蔽");
Bitmap bmap = Common.DeepClone(Camera._cam.GrabOneImage(RobotManage.t1Machine.Config.String_Camera));
bmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
Bitmap bitmap = new Bitmap(bmap.Width, bmap.Height);
var rectx = Config.String_Center_X - 500;
var recty = Config.String_Center_Y - 500;
var file = "\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".Png";
bmap.Save(file, ImageFormat.Png);
//bmap.Dispose();
string debugtxt = "";
var currpos = Point.Empty;
//bmap = new Bitmap("D:\\料串\\2021-10-28-14-25-01.jpg");
//pictureBox1.Image = (Bitmap)bmap.Clone();
try
{
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
//var bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
var eyemImage = new EyemImage();
//eyemImage.ucpImage = bitmapData.Scan0;
//eyemImage.iWidth = rect.Width;
//eyemImage.iHeight = rect.Height;
//eyemImage.iChannels = 1;
//eyemImage.iDepth = 0;
var a = eyemImageRead(file, -1, out eyemImage);
//创建扫描区域
EyemRect eyemRect = new EyemRect();
eyemRect.iXs = Config.String_Center_X - 175;
eyemRect.iYs = Config.String_Center_Y - 175;
eyemRect.iWidth = 175 * 2;
eyemRect.iHeight = 175 * 2;
//创建中心识别区域
EyemRect limRect = new EyemRect();
limRect.iXs = Config.String_Center_X - 175;
limRect.iYs = Config.String_Center_Y - 175;
limRect.iWidth = 175 * 2;
limRect.iHeight = 175 * 2;
eyemlib.EyemOcsDXYR eyemOcsDXYR = new eyemlib.EyemOcsDXYR();
double dp = ConfigHelper.Config.Get("DetectCircle_dp", 1);
double dMinDist = ConfigHelper.Config.Get("DetectCircle_dMinDist", 80);
double dParam1 = ConfigHelper.Config.Get("DetectCircle_dParam1", 100);
double dParam2 = ConfigHelper.Config.Get("DetectCircle_dParam2", 50);
double dMinRadius = ConfigHelper.Config.Get("DetectCircle_dMinRadius", 30);
double dMaxRadius = ConfigHelper.Config.Get("DetectCircle_dMaxRadius", 42);
int result = eyemlib.eyemDetectCircleUseHough(eyemImage, eyemRect, limRect,out eyemOcsDXYR, out _, dp, dMinDist, dParam1, dParam2, dMinRadius, dMaxRadius, 3,true);
LogUtil.info($"eyemDetectCircleUseHough:result:{result},fX:{eyemOcsDXYR.fX},fY:{eyemOcsDXYR.fY},fR:{eyemOcsDXYR.fR}");
debugtxt = $"eyemDetectCircleUseHough:\nresult:{result}\nfX:{eyemOcsDXYR.fX}\nfY:{eyemOcsDXYR.fY}\nfR:{eyemOcsDXYR.fR}";
//bmap.UnlockBits(bitmapData);
eyemImageFree(ref eyemImage);
currpos = new Point((int)eyemOcsDXYR.fX, (int)eyemOcsDXYR.fY);
var centerpos = new Point(Config.String_Center_X, Config.String_Center_Y);
var distance = (int)Common.distance(centerpos, currpos);
//try
//{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(bmap, new PointF(0, 0));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen greenpen = new Pen(Color.Green, 15);
Pen redpen = new Pen(Color.FromArgb(255, Color.Red), 10);
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 - 8, Config.String_Center_Y - 8, 8 * 2, 8 * 2);
graphics.DrawEllipse(redpen, (float)(eyemOcsDXYR.fX - eyemOcsDXYR.fR), (float)(eyemOcsDXYR.fY - eyemOcsDXYR.fR), (float)(eyemOcsDXYR.fR * 2), (float)(eyemOcsDXYR.fR * 2));
graphics.DrawEllipse(redpen, (float)(eyemOcsDXYR.fX - 5), (float)(eyemOcsDXYR.fY - 5), 5 * 2, 5 * 2);
SolidBrush blue = new SolidBrush(Color.BlueViolet);
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($"result:{result},dX:{eyemOcsDXYR.fX},dY:{eyemOcsDXYR.fY},dR:{eyemOcsDXYR.fR}", font, blue, rectx, font.Height + recty);
graphics.DrawString($"distance:{distance}", font, blue, rectx, font.Height * 2 + recty);
graphics.Save();
bmap.Dispose();
graphics.Dispose();
}
catch (Exception e)
{
LogUtil.info("GetStringCenterC" + e.ToString());
debugtxt = "GetStringCenterC" + e.ToString();
}
Bitmap newbitmap = bitmap.Clone(new Rectangle(rectx, recty, 1000, 1000), PixelFormat.Format24bppRgb);
newbitmap.Save("\\image\\TrayString\\" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg", ImageFormat.Jpeg);
//newbitmap.Dispose();
bitmap.Dispose();
return (newbitmap, currpos, debugtxt);
}
private static Bitmap ConvertTo24(Bitmap bmpIn)
{
Bitmap converted = new Bitmap(bmpIn.Width, bmpIn.Height, PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(converted))
{
// Prevent DPI conversion
g.PageUnit = GraphicsUnit.Pixel;
// Draw the image
g.DrawImageUnscaled(bmpIn,0,0);
}
return converted;
}
[HandleProcessCorruptedStateExceptions]
public (Bitmap, Point, string) GetStringCenterB()
{
......@@ -638,5 +772,7 @@ namespace DeviceLibrary
}
[DllImport("yolov5.dll", CharSet = CharSet.Ansi)]
public static extern int centerDetector([MarshalAs(UnmanagedType.LPStr)] string filename, ref float x, ref float y);
}
}
......@@ -66,23 +66,31 @@ namespace DeviceLibrary
{
RunningLed.LedState = LedState.blink;
}
if (alarmType != AlarmType.None)
{
AlarmLed.LedState = LedState.on;
}
if (alarmType != AlarmType.None
|| RobotManage.labelMachine.alarmType != AlarmType.None
|| RobotManage.filterMachine.alarmType != AlarmType.None
|| RobotManage.t1Machine.alarmType != AlarmType.None)
{
AlarmBuzzer.ON();
}
else {
if (UserPause) {
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
StandbyLed.LedState = LedState.blink;
AlarmBuzzer.OFF();
}
else
{
if (alarmType != AlarmType.None)
{
AlarmLed.LedState = LedState.on;
}
if (alarmType != AlarmType.None
|| RobotManage.labelMachine.alarmType != AlarmType.None
|| RobotManage.filterMachine.alarmType != AlarmType.None
|| RobotManage.t1Machine.alarmType != AlarmType.None)
{
AlarmBuzzer.ON();
}
else
{
AlarmBuzzer.OFF();
}
}
Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
}
}
......
......@@ -52,6 +52,7 @@ namespace DeviceLibrary
MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo;
LedProcessInit();
Asa.XrayImage.setProcessLevel(4.0);
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(); });
AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.LOW); });
......
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class IODebounce<T>
{
static Dictionary<string, iovaluet> iolist = new Dictionary<string, iovaluet>();
public static bool Test(string ioType, IO_VALUE Current_VALUE, IO_VALUE Test_VALUE, int DebounceCount)
{
return GetDict(ioType).PushAndTest(Current_VALUE, Test_VALUE, DebounceCount);
}
static iovaluet GetDict(string ioType) {
if (!iolist.ContainsKey(ioType))
{
iolist.Add(ioType, new iovaluet());
}
return iolist[ioType];
}
class iovaluet {
IO_VALUE[] iO_VALUEs = new IO_VALUE[50];
int lastIndex=0;
void pushdata(IO_VALUE iO_VALUE) {
if (lastIndex == iO_VALUEs.Length)
lastIndex = 0;
iO_VALUEs[lastIndex] = iO_VALUE;
lastIndex++;
}
bool testdata(IO_VALUE Test_VALUE, int DebounceCount)
{
int currentIndex = lastIndex;
for (int i=0;i< DebounceCount;i++) {
currentIndex--;
if (currentIndex < 0) currentIndex = iO_VALUEs.Length-1;
if (iO_VALUEs[currentIndex] != Test_VALUE)
return false;
}
return true;
}
internal bool PushAndTest(IO_VALUE Current_VALUE, IO_VALUE Test_VALUE, int DebounceCount) {
pushdata(Current_VALUE);
return testdata(Test_VALUE, DebounceCount);
}
}
}
}
......@@ -147,8 +147,8 @@ namespace DeviceLibrary
public enum ReelDest {
NG,
MSD,
Paper,
String,
VT_Tower,
Tower,
Unknow
}
}
......@@ -51,8 +51,9 @@
<Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
......@@ -74,13 +75,15 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="X-Ray">
<HintPath>..\..\AutoCountMachine\RC1266-AutoCountMachine\source\AutoCountClient\bin\Debug\X-Ray.dll</HintPath>
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AutoScan\common\AxisBean.cs" />
<Compile Include="AutoScan\common\Common.cs" />
<Compile Include="AutoScan\common\IODebounce.cs" />
<Compile Include="AutoScan\common\Led.cs" />
<Compile Include="AutoScan\common\NamedPipeClient.cs" />
<Compile Include="AutoScan\common\OcrProcess.cs" />
......
......@@ -61,6 +61,13 @@ namespace DeviceLibrary
return true;
}
else {
LogUtil.info("ElectricGripper Clamp busy");
ClosePort();
Thread.Sleep(100);
OpenPort();
Thread.Sleep(100);
axis.ResetError();
axis.Push(50, 5.5f, 50);
return false;
}
}
......
......@@ -175,6 +175,13 @@ id =@id";
DataTable dt = sh.ExecuteQuery(sql, para);
return dt;
}
public DataTable GetDatabyWhereString(string where)
{
string sql = @"SELECT * FROM ReelInfo WHERE "+ where + " ORDER BY datetime ASC";
DataTable dt = sh.ExecuteQuery(sql);
return dt;
}
public DataTable GetLogbydate(DateTime startData, DateTime endDate)
{
string sql = @"select device,action,state,log,datetime from logs WHERE datetime BETWEEN @startData AND @endDate ORDER BY datetime desc";
......
......@@ -13,6 +13,17 @@ namespace DeviceLibrary
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
public static extern int eyemMulFuncTool(EyemImage tpImage, EyemRect tpRoi, string funcName, double dThreshold,int iNumToIgnore, ref EyemOcsFXYR tpCircle, out EyemImage tpDstImg);
[DllImport("eyemLib.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int eyemDetectCircleUseHough(EyemImage tpImage, EyemRect tpRoi, EyemRect limRoi, out EyemOcsDXYR tpCircle, out EyemImage tpDstImg, double dp, double dMinDist, double dParam1, double dParam2, double dMinRadius, double dMaxRadius, int iMethod, bool useValLimit);
[StructLayout(LayoutKind.Sequential)]
public struct EyemOcsDXYR // 用于表示圆
{
public double fX; // X坐标
public double fY; // Y坐标
public double fR; // 半径
}
[StructLayout(LayoutKind.Sequential)]
public struct EyemOcsFXYR // 用于表示圆
{
......
......@@ -218,7 +218,7 @@ namespace AutoCountMachine
this.tabControl1.Location = new System.Drawing.Point(0, 90);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1008, 599);
this.tabControl1.Size = new System.Drawing.Size(1008, 640);
this.tabControl1.TabIndex = 6;
//
// tabPage1
......@@ -232,26 +232,28 @@ namespace AutoCountMachine
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 30);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(1000, 565);
this.tabPage1.Size = new System.Drawing.Size(1000, 606);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// label_Productivity
//
this.label_Productivity.Location = new System.Drawing.Point(743, 195);
this.label_Productivity.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_Productivity.Location = new System.Drawing.Point(802, 191);
this.label_Productivity.Name = "label_Productivity";
this.label_Productivity.Size = new System.Drawing.Size(228, 53);
this.label_Productivity.Size = new System.Drawing.Size(194, 53);
this.label_Productivity.TabIndex = 8;
this.label_Productivity.Tag = "not";
this.label_Productivity.Text = "产量";
//
// btn_PauseBuzzer
//
this.btn_PauseBuzzer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(767, 88);
this.btn_PauseBuzzer.Location = new System.Drawing.Point(817, 82);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(175, 40);
this.btn_PauseBuzzer.Size = new System.Drawing.Size(152, 40);
this.btn_PauseBuzzer.TabIndex = 7;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
......@@ -260,15 +262,17 @@ namespace AutoCountMachine
//
// boxResetControl1
//
this.boxResetControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
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(731, 253);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5);
this.boxResetControl1.Location = new System.Drawing.Point(790, 249);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.boxResetControl1.Name = "boxResetControl1";
this.boxResetControl1.Size = new System.Drawing.Size(264, 279);
this.boxResetControl1.Size = new System.Drawing.Size(207, 279);
this.boxResetControl1.TabIndex = 5;
//
// cmb_runmode
//
this.cmb_runmode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmb_runmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmb_runmode.FormattingEnabled = true;
this.cmb_runmode.Items.AddRange(new object[] {
......@@ -277,17 +281,18 @@ namespace AutoCountMachine
"MSD",
"PAPER",
"TOWER"});
this.cmb_runmode.Location = new System.Drawing.Point(767, 153);
this.cmb_runmode.Location = new System.Drawing.Point(817, 147);
this.cmb_runmode.Name = "cmb_runmode";
this.cmb_runmode.Size = new System.Drawing.Size(175, 29);
this.cmb_runmode.Size = new System.Drawing.Size(152, 29);
this.cmb_runmode.TabIndex = 4;
this.cmb_runmode.SelectedIndexChanged += new System.EventHandler(this.cmb_runmode_SelectedIndexChanged);
//
// btn_releaseshelf
//
this.btn_releaseshelf.Location = new System.Drawing.Point(767, 29);
this.btn_releaseshelf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_releaseshelf.Location = new System.Drawing.Point(817, 23);
this.btn_releaseshelf.Name = "btn_releaseshelf";
this.btn_releaseshelf.Size = new System.Drawing.Size(175, 37);
this.btn_releaseshelf.Size = new System.Drawing.Size(152, 37);
this.btn_releaseshelf.TabIndex = 3;
this.btn_releaseshelf.Text = "强制释放料架";
this.btn_releaseshelf.UseVisualStyleBackColor = true;
......@@ -295,10 +300,12 @@ namespace AutoCountMachine
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.listView_reelnfo);
this.groupBox2.Location = new System.Drawing.Point(8, 271);
this.groupBox2.Location = new System.Drawing.Point(8, 260);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(715, 261);
this.groupBox2.Size = new System.Drawing.Size(773, 199);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "料盘数据";
......@@ -312,16 +319,18 @@ namespace AutoCountMachine
this.listView_reelnfo.Location = new System.Drawing.Point(3, 25);
this.listView_reelnfo.MultiSelect = false;
this.listView_reelnfo.Name = "listView_reelnfo";
this.listView_reelnfo.Size = new System.Drawing.Size(709, 233);
this.listView_reelnfo.Size = new System.Drawing.Size(767, 171);
this.listView_reelnfo.TabIndex = 0;
this.listView_reelnfo.UseCompatibleStateImageBehavior = false;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.stateView);
this.groupBox1.Location = new System.Drawing.Point(8, 4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(715, 261);
this.groupBox1.Size = new System.Drawing.Size(773, 250);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "运行状态";
......@@ -335,7 +344,7 @@ namespace AutoCountMachine
this.stateView.Location = new System.Drawing.Point(3, 25);
this.stateView.MultiSelect = false;
this.stateView.Name = "stateView";
this.stateView.Size = new System.Drawing.Size(709, 233);
this.stateView.Size = new System.Drawing.Size(767, 222);
this.stateView.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false;
//
......@@ -344,8 +353,8 @@ namespace AutoCountMachine
this.tabPage2.Controls.Add(this.settingControl1);
this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1000, 565);
this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
this.tabPage2.Size = new System.Drawing.Size(748, 460);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "设置";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -354,9 +363,9 @@ namespace AutoCountMachine
//
this.settingControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingControl1.Location = new System.Drawing.Point(3, 3);
this.settingControl1.Margin = new System.Windows.Forms.Padding(5);
this.settingControl1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.settingControl1.Name = "settingControl1";
this.settingControl1.Size = new System.Drawing.Size(994, 559);
this.settingControl1.Size = new System.Drawing.Size(742, 454);
this.settingControl1.TabIndex = 0;
//
// btn_stop
......@@ -388,11 +397,11 @@ namespace AutoCountMachine
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(413, 0);
this.listView1.Location = new System.Drawing.Point(348, 0);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.ShowGroups = false;
this.listView1.Size = new System.Drawing.Size(595, 118);
this.listView1.Size = new System.Drawing.Size(660, 111);
this.listView1.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false;
//
......@@ -401,7 +410,7 @@ namespace AutoCountMachine
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1008, 689);
this.ClientSize = new System.Drawing.Size(1008, 729);
this.Controls.Add(this.listView1);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.tabControl1);
......
......@@ -155,7 +155,7 @@ namespace AutoCountMachine
}
this.ResumeLayout(true);
label_Productivity.Text = string.Format(crc.GetString("label_Productivity", "产量:{0}\r\n不良数:{1}, 不良率:{2}%").Replace("\\r\\n","\n"),
RobotManage.ProductivityCount, RobotManage.DefectiveCount, (RobotManage.ProductivityCount == 0 ? 0 : (RobotManage.DefectiveCount / RobotManage.ProductivityCount) * 100));
RobotManage.ProductivityCount, RobotManage.DefectiveCount, (RobotManage.ProductivityCount == 0 ? 0 : ((double)RobotManage.DefectiveCount / (double)RobotManage.ProductivityCount) * 100d).ToString("0.00"));
Application.DoEvents();
}
......@@ -460,14 +460,14 @@ namespace AutoCountMachine
break;
case "MSD":
RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVacuum = "true";
RobotManage.offlinereelLocation.isVacuum = "1";
break;
case "PAPER":
RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVTTower = "true";
RobotManage.offlinereelLocation.isVTTower = "1";
break;
case "TOWER":
RobotManage.offlinereelLocation.isTower = "true";
RobotManage.offlinereelLocation.isTower = "1";
RobotManage.offlinemode = true;
break;
}
......
......@@ -29,6 +29,18 @@ namespace AutoCountMachine
//return;
databaseProc.Current.InsertOrUpdateRI(1, "123", "234", true, "abc", 345, "asd", "fgh", "try");
//bool x;
//x=IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH,3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, OnlineStore.LoadCSVLibrary.IO_VALUE.HIGH, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, 3);
//x = IODebounce.Test("123", OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, OnlineStore.LoadCSVLibrary.IO_VALUE.LOW, 3);
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
......
......@@ -78,7 +78,10 @@
<HintPath>..\..\SO827-AutoScanAndLabel\AutoScanAndLabel\bin\Debug\UserFromControl.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AdvanceConfig.cs">
......
......@@ -42,10 +42,13 @@ namespace AutoCountMachine
this.rb_datafilter_lastMonth = new System.Windows.Forms.RadioButton();
this.rb_datafilter_thismonth = new System.Windows.Forms.RadioButton();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.comboBox_searchtype = new System.Windows.Forms.ComboBox();
this.textBox_search = new System.Windows.Forms.TextBox();
this.btn_search = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -78,6 +81,9 @@ namespace AutoCountMachine
//
// panel1
//
this.panel1.Controls.Add(this.btn_search);
this.panel1.Controls.Add(this.textBox_search);
this.panel1.Controls.Add(this.comboBox_searchtype);
this.panel1.Controls.Add(this.label_count);
this.panel1.Controls.Add(this.dateTimePicker_end);
this.panel1.Controls.Add(this.dateTimePicker_start);
......@@ -216,6 +222,17 @@ namespace AutoCountMachine
this.tabPage1.Text = "设置";
this.tabPage1.UseVisualStyleBackColor = true;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(20, 500);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(14, 14);
this.linkLabel1.TabIndex = 11;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "_";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// btn_setadminpassword
//
this.btn_setadminpassword.Location = new System.Drawing.Point(32, 107);
......@@ -247,16 +264,35 @@ namespace AutoCountMachine
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
//
// linkLabel1
// comboBox_searchtype
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(20, 500);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(14, 14);
this.linkLabel1.TabIndex = 11;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "_";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
this.comboBox_searchtype.DisplayMember = "PartNumber";
this.comboBox_searchtype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_searchtype.FormattingEnabled = true;
this.comboBox_searchtype.Items.AddRange(new object[] {
"PartNumber",
"ReelID"});
this.comboBox_searchtype.Location = new System.Drawing.Point(384, 423);
this.comboBox_searchtype.Name = "comboBox_searchtype";
this.comboBox_searchtype.Size = new System.Drawing.Size(98, 20);
this.comboBox_searchtype.TabIndex = 4;
//
// textBox_search
//
this.textBox_search.Location = new System.Drawing.Point(384, 448);
this.textBox_search.Name = "textBox_search";
this.textBox_search.Size = new System.Drawing.Size(204, 21);
this.textBox_search.TabIndex = 5;
//
// btn_search
//
this.btn_search.Location = new System.Drawing.Point(513, 474);
this.btn_search.Name = "btn_search";
this.btn_search.Size = new System.Drawing.Size(75, 23);
this.btn_search.TabIndex = 6;
this.btn_search.Text = "Search";
this.btn_search.UseVisualStyleBackColor = true;
this.btn_search.Click += new System.EventHandler(this.btn_search_Click);
//
// SettingControl
//
......@@ -295,5 +331,8 @@ namespace AutoCountMachine
private System.Windows.Forms.RadioButton rb_datafilter_custom;
private System.Windows.Forms.Label label_count;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.ComboBox comboBox_searchtype;
private System.Windows.Forms.Button btn_search;
private System.Windows.Forms.TextBox textBox_search;
}
}
......@@ -22,6 +22,7 @@ namespace AutoCountMachine
RoleManger.RoleChange += RoleManger_RoleChange;
this.VisibleChanged += SettingControl_VisibleChanged;
label_count.Text = "";
comboBox_searchtype.SelectedIndex = 0;
}
private void SettingControl_VisibleChanged(object sender, EventArgs e)
......@@ -132,7 +133,10 @@ namespace AutoCountMachine
void setData(DateTime startData, DateTime endDate)
{
DataTable dt = databaseProc.Current.GetDatabydate(startData, endDate);
showData(dt);
}
void showData(DataTable dt)
{
dataGridView1.DataSource = dt;
dataGridView1.Columns[0].HeaderText = "";//crc.GetString("dataGrid_ID", "条码");
......@@ -176,5 +180,23 @@ namespace AutoCountMachine
{
ConfigHelper.AdvanceConfigForm.ShowEditDialog(this);
}
private void btn_search_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(textBox_search.Text))
return;
string searchtype = comboBox_searchtype.SelectedItem.ToString();
string sql = "";
if (searchtype == "PartNumber")
{
sql = "PN LIKE '%" + textBox_search.Text.Trim() + "%'";
}
else {
sql = "RI LIKE '%" + textBox_search.Text.Trim() + "%'";
}
DataTable dt = databaseProc.Current.GetDatabyWhereString(sql);
showData(dt);
}
}
}
......@@ -39,6 +39,17 @@ namespace AutoCountMachine
this.btn_Reset = new System.Windows.Forms.Button();
this.btn_release = new System.Windows.Forms.Button();
this.btn_clamp = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label_eyemMulFuncTool = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btn_eyemMulFuncTool1 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.btn_agvout = new System.Windows.Forms.Button();
this.btn_agvin = new System.Windows.Forms.Button();
this.cylinderButton14 = new AutoCountMachine.CylinderButton();
this.cylinderButton13 = new AutoCountMachine.CylinderButton();
this.cylinderButton12 = new AutoCountMachine.CylinderButton();
......@@ -52,22 +63,7 @@ namespace AutoCountMachine
this.cylinderButton7 = new AutoCountMachine.CylinderButton();
this.cylinderButton1 = new AutoCountMachine.CylinderButton();
this.ioControl1 = new AutoCountMachine.IOControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.configControl1 = new AutoCountMachine.ConfigControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label_eyemMulFuncTool = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btn_eyemMulFuncTool = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.btn_agvout = new System.Windows.Forms.Button();
this.btn_agvin = new System.Windows.Forms.Button();
this.txt_p2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txt_p1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -202,6 +198,124 @@ namespace AutoCountMachine
this.btn_clamp.UseVisualStyleBackColor = true;
this.btn_clamp.Click += new System.EventHandler(this.btn_clamp_Click);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1016, 530);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1010, 524);
this.panel1.TabIndex = 2;
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(556, 402);
this.axisMoveControl1.TabIndex = 1;
this.axisMoveControl1.Tag = "not";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.label_eyemMulFuncTool);
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.btn_eyemMulFuncTool1);
this.tabPage3.Controls.Add(this.pictureBox1);
this.tabPage3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1016, 530);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "料串定位";
this.tabPage3.UseVisualStyleBackColor = true;
this.tabPage3.Click += new System.EventHandler(this.tabPage3_Click);
//
// label_eyemMulFuncTool
//
this.label_eyemMulFuncTool.Location = new System.Drawing.Point(831, 277);
this.label_eyemMulFuncTool.Name = "label_eyemMulFuncTool";
this.label_eyemMulFuncTool.Size = new System.Drawing.Size(128, 173);
this.label_eyemMulFuncTool.TabIndex = 2;
this.label_eyemMulFuncTool.Text = "信息:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(833, 45);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 40);
this.button1.TabIndex = 1;
this.button1.Text = "料串中心检测";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btn_eyemMulFuncTool1
//
this.btn_eyemMulFuncTool1.Location = new System.Drawing.Point(833, 108);
this.btn_eyemMulFuncTool1.Name = "btn_eyemMulFuncTool1";
this.btn_eyemMulFuncTool1.Size = new System.Drawing.Size(136, 40);
this.btn_eyemMulFuncTool1.TabIndex = 1;
this.btn_eyemMulFuncTool1.Text = "伺服定位";
this.btn_eyemMulFuncTool1.UseVisualStyleBackColor = true;
this.btn_eyemMulFuncTool1.Click += new System.EventHandler(this.button1_Click);
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(6, 6);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(819, 521);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btn_agvout);
this.tabPage4.Controls.Add(this.btn_agvin);
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1016, 530);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "AGV";
this.tabPage4.UseVisualStyleBackColor = true;
this.tabPage4.Click += new System.EventHandler(this.tabPage4_Click);
//
// btn_agvout
//
this.btn_agvout.Location = new System.Drawing.Point(62, 138);
this.btn_agvout.Name = "btn_agvout";
this.btn_agvout.Size = new System.Drawing.Size(122, 29);
this.btn_agvout.TabIndex = 0;
this.btn_agvout.Text = "取满料串";
this.btn_agvout.UseVisualStyleBackColor = true;
this.btn_agvout.Click += new System.EventHandler(this.btn_agvout_Click);
//
// btn_agvin
//
this.btn_agvin.Location = new System.Drawing.Point(62, 79);
this.btn_agvin.Name = "btn_agvin";
this.btn_agvin.Size = new System.Drawing.Size(122, 29);
this.btn_agvin.TabIndex = 0;
this.btn_agvin.Text = "送空料串";
this.btn_agvin.UseVisualStyleBackColor = true;
this.btn_agvin.Click += new System.EventHandler(this.btn_agvin_Click);
//
// cylinderButton14
//
this.cylinderButton14.BackColor = System.Drawing.Color.White;
......@@ -381,169 +495,15 @@ namespace AutoCountMachine
this.ioControl1.TabIndex = 0;
this.ioControl1.Tag = "not";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1016, 530);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服配置";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1010, 524);
this.panel1.TabIndex = 2;
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(556, 402);
this.axisMoveControl1.TabIndex = 1;
this.axisMoveControl1.Tag = "not";
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(562, 3);
this.configControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.configControl1.Location = new System.Drawing.Point(565, 12);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(627, 483);
this.configControl1.Size = new System.Drawing.Size(688, 422);
this.configControl1.TabIndex = 0;
this.configControl1.Tag = "not";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.label2);
this.tabPage3.Controls.Add(this.label1);
this.tabPage3.Controls.Add(this.txt_p1);
this.tabPage3.Controls.Add(this.txt_p2);
this.tabPage3.Controls.Add(this.label_eyemMulFuncTool);
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.btn_eyemMulFuncTool);
this.tabPage3.Controls.Add(this.pictureBox1);
this.tabPage3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1016, 530);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "料串定位";
this.tabPage3.UseVisualStyleBackColor = true;
this.tabPage3.Click += new System.EventHandler(this.tabPage3_Click);
//
// label_eyemMulFuncTool
//
this.label_eyemMulFuncTool.Location = new System.Drawing.Point(831, 277);
this.label_eyemMulFuncTool.Name = "label_eyemMulFuncTool";
this.label_eyemMulFuncTool.Size = new System.Drawing.Size(128, 173);
this.label_eyemMulFuncTool.TabIndex = 2;
this.label_eyemMulFuncTool.Text = "信息:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(831, 138);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 40);
this.button1.TabIndex = 1;
this.button1.Text = "料串中心检测(有料盘)";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btn_eyemMulFuncTool
//
this.btn_eyemMulFuncTool.Location = new System.Drawing.Point(831, 92);
this.btn_eyemMulFuncTool.Name = "btn_eyemMulFuncTool";
this.btn_eyemMulFuncTool.Size = new System.Drawing.Size(136, 40);
this.btn_eyemMulFuncTool.TabIndex = 1;
this.btn_eyemMulFuncTool.Text = "料串中心检测(无料盘)";
this.btn_eyemMulFuncTool.UseVisualStyleBackColor = true;
this.btn_eyemMulFuncTool.Click += new System.EventHandler(this.button1_Click);
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(6, 6);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(819, 521);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btn_agvout);
this.tabPage4.Controls.Add(this.btn_agvin);
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1016, 530);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "AGV";
this.tabPage4.UseVisualStyleBackColor = true;
this.tabPage4.Click += new System.EventHandler(this.tabPage4_Click);
//
// btn_agvout
//
this.btn_agvout.Location = new System.Drawing.Point(62, 138);
this.btn_agvout.Name = "btn_agvout";
this.btn_agvout.Size = new System.Drawing.Size(122, 29);
this.btn_agvout.TabIndex = 0;
this.btn_agvout.Text = "取满料串";
this.btn_agvout.UseVisualStyleBackColor = true;
this.btn_agvout.Click += new System.EventHandler(this.btn_agvout_Click);
//
// btn_agvin
//
this.btn_agvin.Location = new System.Drawing.Point(62, 79);
this.btn_agvin.Name = "btn_agvin";
this.btn_agvin.Size = new System.Drawing.Size(122, 29);
this.btn_agvin.TabIndex = 0;
this.btn_agvin.Text = "送空料串";
this.btn_agvin.UseVisualStyleBackColor = true;
this.btn_agvin.Click += new System.EventHandler(this.btn_agvin_Click);
//
// txt_p2
//
this.txt_p2.Location = new System.Drawing.Point(860, 61);
this.txt_p2.Name = "txt_p2";
this.txt_p2.Size = new System.Drawing.Size(56, 25);
this.txt_p2.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(831, 64);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 15);
this.label1.TabIndex = 4;
this.label1.Text = "p2";
//
// txt_p1
//
this.txt_p1.Location = new System.Drawing.Point(860, 30);
this.txt_p1.Name = "txt_p1";
this.txt_p1.Size = new System.Drawing.Size(56, 25);
this.txt_p1.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(831, 33);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(23, 15);
this.label2.TabIndex = 4;
this.label2.Text = "p1";
//
// T1Control
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -556,7 +516,6 @@ namespace AutoCountMachine
this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
......@@ -589,7 +548,7 @@ namespace AutoCountMachine
private System.Windows.Forms.Button btn_Reset;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_eyemMulFuncTool;
private System.Windows.Forms.Button btn_eyemMulFuncTool1;
private System.Windows.Forms.Label label_eyemMulFuncTool;
private System.Windows.Forms.Button btn_Full_Linestop;
private System.Windows.Forms.Button btn_Full_Linerun;
......@@ -600,9 +559,5 @@ namespace AutoCountMachine
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button btn_agvout;
private System.Windows.Forms.Button btn_agvin;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txt_p1;
private System.Windows.Forms.TextBox txt_p2;
}
}
......@@ -39,8 +39,6 @@ namespace AutoCountMachine
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RoleManger.RoleChange += RoleManger_RoleChange;
txt_p1.Text = ConfigHelper.Config.Get("findcicyle_p1", 95).ToString();
txt_p2.Text = ConfigHelper.Config.Get("findcicyle_p2", 75).ToString();
}
private void RoleManger_RoleChange(object sender, Role e)
......@@ -90,14 +88,19 @@ namespace AutoCountMachine
private void button1_Click(object sender, EventArgs e)
{
ConfigHelper.Config.Set("findcicyle_p1", int.Parse(txt_p1.Text));
ConfigHelper.Config.Set("findcicyle_p2", int.Parse(txt_p2.Text));
ConfigHelper.Config.SaveChange();
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterA();
var distance = (int)Common.distance(RobotManage.t1Machine.CenterPos, currpos);
label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance< RobotManage.t1Machine.Config.String_Offset_Range_Px?"OK":"NG")}";
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterC();
var offset_x = currpos.X - RobotManage.t1Machine.CenterPos.X;
var offset_y = currpos.Y - RobotManage.t1Machine.CenterPos.Y;
offset_x = offset_x * -1;
offset_y = offset_y * -1;
var Y = RobotManage.t1Machine.Config.Y_P2 + offset_y * RobotManage.t1Machine.Config.Cam_Pixel_Y_Ratio;
var Pan_X = RobotManage.t1Machine.Config.Pan_P2 + offset_x * RobotManage.t1Machine.Config.Cam_Pixel_X_Ratio;
pictureBox1.Image = bitmap;
RobotManage.t1Machine.T_Pan_Axis.AbsMove(null, Pan_X, RobotManage.t1Machine.Config.Pan_P2_speed);
RobotManage.t1Machine.T_Y_Axis.AbsMove(null, Y, RobotManage.t1Machine.Config.Y_P2_speed);
RobotManage.t1Machine.MoveInfo.log($"下降到料串 CenterPos:{RobotManage.t1Machine.CenterPos}, StringCenter:{currpos}, Offset:{new Point(offset_x, offset_y)}, AXIS:{new Point(Pan_X, Y)}");
}
private void btn_Empty_Linerun_Click(object sender, EventArgs e)
......@@ -122,7 +125,7 @@ namespace AutoCountMachine
private void button1_Click_1(object sender, EventArgs e)
{
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterB();
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterC();
var distance = (int)Common.distance(RobotManage.t1Machine.CenterPos, currpos);
label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance < RobotManage.t1Machine.Config.String_Offset_Range_Px ? "OK" : "NG")}";
......
......@@ -84,8 +84,9 @@ namespace AutoCountMachine
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnSavePos);
this.Controls.Add(this.groupBox3);
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "ConfigControl";
this.Size = new System.Drawing.Size(1096, 504);
this.Size = new System.Drawing.Size(639, 504);
this.Load += new System.EventHandler(this.ConfigControl_Load);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
......
......@@ -54,6 +54,7 @@ namespace AutoCountMachine
this.btn_ManualCount = new System.Windows.Forms.Button();
this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.btn_Calibration = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -220,6 +221,7 @@ namespace AutoCountMachine
// panel2
//
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Controls.Add(this.btn_Calibration);
this.panel2.Controls.Add(this.btn_getXrayimage);
this.panel2.Controls.Add(this.btn_openXray);
this.panel2.Controls.Add(this.btn_closeXray);
......@@ -349,6 +351,16 @@ namespace AutoCountMachine
this.cylinderButton5.Text = "Entry_Open";
this.cylinderButton5.UseVisualStyleBackColor = false;
//
// btn_Calibration
//
this.btn_Calibration.Location = new System.Drawing.Point(510, 424);
this.btn_Calibration.Name = "btn_Calibration";
this.btn_Calibration.Size = new System.Drawing.Size(129, 33);
this.btn_Calibration.TabIndex = 1;
this.btn_Calibration.Text = "Calibration";
this.btn_Calibration.UseVisualStyleBackColor = true;
this.btn_Calibration.Click += new System.EventHandler(this.btn_Calibration_Click);
//
// XrayControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -397,5 +409,6 @@ namespace AutoCountMachine
private System.Windows.Forms.Label label_tips_scancode;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_Calibration;
}
}
......@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
......@@ -308,5 +309,78 @@ namespace AutoCountMachine
{
}
private void btn_Calibration_Click(object sender, EventArgs e)
{
if (RobotManage.isRunning)
{
Invoke(new Action(() => MessageBox.Show("Machine is running, Please stop.")));
return;
}
Thread td = new Thread(new ThreadStart(Calibration));
td.Start();
}
void Calibration() {
if (ManualCountRunning)
return;
ManualCountRunning = true;
countstate?.Invoke(this, crc.GetString("xmanual_close_door", "关闭防护门"));
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Entry_Close, IO_XRay_Type.Entry_Open, IO_VALUE.LOW);
RobotManage.xrayMachine.CylinderMove(null, IO_XRay_Type.Exit_Close, IO_XRay_Type.Exit_Open, IO_VALUE.LOW);
int wait = 0;
while (true)
{
if (RobotManage.xrayMachine.IOValue(IO_XRay_Type.Entry_Close).Equals(IO_VALUE.HIGH)
&& RobotManage.xrayMachine.IOValue(IO_XRay_Type.Exit_Close).Equals(IO_VALUE.HIGH))
{
break;
}
wait++;
Thread.Sleep(500);
//countstate?.Invoke(this, crc.GetString("xmanual_wait_close_door", "等待关闭防护门"));
if (wait > 10)
{
//countstate?.Invoke(this, crc.GetString("xmanual_wait_close_door_timeout", "等待关闭防护门超时"));
ManualCountRunning = false;
return;
}
}
Invoke(new Action(() =>MessageBox.Show("Start Calibration. Wait 30s, Please")));
if (Directory.Exists("template"))
Directory.Delete("template", true);
var a = RobotManage.xrayImage.GenerateTemplate(1);
a.Wait();
if (a.Result)
{
LogUtil.info("暗场校准成功");
try
{
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.HIGH);
Task.Delay(1000).Wait();
RobotManage.XRay.Start();
Task.Delay(2000).Wait();
var b = RobotManage.xrayImage.GenerateTemplate(2);
b.Wait();
if (b.Result)
{
LogUtil.info("亮场校准成功");
}
}
finally
{
RobotManage.XRay.Stop();
RobotManage.xrayMachine.IOMove(IO_XRay_Type.Xray_Lock, IO_VALUE.LOW);
}
}
RobotManage.xrayImage.Close();
Task.Delay(1000).Wait();
RobotManage.xrayImage.Open();
Invoke(new Action(() => MessageBox.Show("Calibration Finish.")));
ManualCountRunning = false;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!