Commit f2d7e2f6 刘韬

分化分料线

修改前: NG阻挡放行后, MSD阻挡检测到盘 NG阻挡就立刻放下
修改后: NG阻挡放行后等待3秒 MSD阻挡检测到盘 NG阻挡就立刻放下
1 个父辈 cb283aa7
...@@ -33,7 +33,7 @@ namespace DeviceLibrary ...@@ -33,7 +33,7 @@ namespace DeviceLibrary
public bool IgnoreGratingSignal { get; set; } 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 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 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 nGBox_Count = 0;
private int mSDBox_Count = 0; private int mSDBox_Count = 0;
......
...@@ -26,7 +26,7 @@ namespace DeviceLibrary ...@@ -26,7 +26,7 @@ namespace DeviceLibrary
{ {
case MoveStep.Filter_01_WaitReel: case MoveStep.Filter_01_WaitReel:
//MoveInfo.log("上料区阻挡上升"); //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; MoveInfo.ReelParam = preReelParam;
preReelParam = null; preReelParam = null;
...@@ -43,11 +43,11 @@ namespace DeviceLibrary ...@@ -43,11 +43,11 @@ namespace DeviceLibrary
{ {
MoveInfo.NextMoveStep(MoveStep.Filter_20_MSDReel_wait); 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); 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); MoveInfo.NextMoveStep(MoveStep.Filter_40_Reel_through_wait);
} }
...@@ -125,20 +125,29 @@ namespace DeviceLibrary ...@@ -125,20 +125,29 @@ namespace DeviceLibrary
case MoveStep.Filter_23_MSDReel_End: case MoveStep.Filter_23_MSDReel_End:
MoveInfo.NextMoveStep(MoveStep.Filter_END); MoveInfo.NextMoveStep(MoveStep.Filter_END);
MoveInfo.log("MSD料推出完毕"); 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; break;
///料穿过 ///料穿过
case MoveStep.Filter_40_Reel_through_wait: 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阻挡上升"); 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.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); 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.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; break;
case MoveStep.Filter_41_Reel_through: case MoveStep.Filter_41_Reel_through:
if (RobotManage.t1Machine.TrayCanIN()) if (RobotManage.t1Machine.TrayCanIN())
{ {
MoveInfo.NextMoveStep(MoveStep.Filter_42_Reel_through_Wait); MoveInfo.NextMoveStep(MoveStep.Filter_42_Reel_through_Wait);
IOMove(IO_Filter_Type.Line3_Run, IO_VALUE.HIGH);
MoveInfo.log("料穿过,MSD阻挡上升,NG,Paper阻挡下降"); 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.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); CylinderMove(MoveInfo, IO_Filter_Type.MSD_TaryStop_Down, IO_Filter_Type.MSD_TaryStop_Up, IO_VALUE.HIGH);
......
...@@ -58,6 +58,14 @@ namespace DeviceLibrary ...@@ -58,6 +58,14 @@ namespace DeviceLibrary
{ {
AlarmLed.LedState = LedState.on; 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(); }); Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
} }
} }
......
...@@ -160,6 +160,7 @@ namespace DeviceLibrary ...@@ -160,6 +160,7 @@ namespace DeviceLibrary
//File.Delete(file + ".temp.bmp"); //File.Delete(file + ".temp.bmp");
var l = JsonConvert.DeserializeObject<List<TextBlock>>(resp); var l = JsonConvert.DeserializeObject<List<TextBlock>>(resp);
List<TextBlock> newlist = new List<TextBlock>(); List<TextBlock> newlist = new List<TextBlock>();
List<TextBlock> highscorelist = new List<TextBlock>();
//过滤合规数据 //过滤合规数据
foreach (var t in l.ToArray()) foreach (var t in l.ToArray())
{ {
...@@ -176,12 +177,15 @@ namespace DeviceLibrary ...@@ -176,12 +177,15 @@ namespace DeviceLibrary
} }
if (s1 > 0.9) if (s1 > 0.9)
{ {
newlist.Clear(); //newlist.Clear();
newlist.Add(t); highscorelist.Add(t);
MoveInfo.log($"s1:{s1}>0.93 , {t.Text}"); MoveInfo.log($"s1:{s1}>0.93 , {t.Text}");
break; //break;
} }
} }
if (highscorelist.Count > 0)
newlist = highscorelist;
//List<Point> RightPoint //List<Point> RightPoint
Point labelPoint = Point.Empty; Point labelPoint = Point.Empty;
double labelAngle = 0; double labelAngle = 0;
......
...@@ -24,7 +24,7 @@ namespace DeviceLibrary ...@@ -24,7 +24,7 @@ namespace DeviceLibrary
//是否允许进入贴标线体 //是否允许进入贴标线体
public bool TrayCanIN() 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); //return IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.LOW);
} }
...@@ -61,7 +61,7 @@ namespace DeviceLibrary ...@@ -61,7 +61,7 @@ namespace DeviceLibrary
var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check); var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check);
//LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}"); //LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}");
if (Tray_Check.Equals(IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null) if (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.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = preReelParam; MoveInfo.ReelParam = preReelParam;
...@@ -108,11 +108,11 @@ namespace DeviceLibrary ...@@ -108,11 +108,11 @@ namespace DeviceLibrary
ReelLocation reelLocation1 = RobotManage.offlinereelLocation; ReelLocation reelLocation1 = RobotManage.offlinereelLocation;
if (!string.IsNullOrEmpty(reelLocation1.isTower)) if (!string.IsNullOrEmpty(reelLocation1.isTower))
{ {
MoveInfo.ReelParam.ReelDest = ReelDest.String; MoveInfo.ReelParam.ReelDest = ReelDest.Tower;
} }
else if (!string.IsNullOrEmpty(reelLocation1.isVTTower)) else if (!string.IsNullOrEmpty(reelLocation1.isVTTower))
{ {
MoveInfo.ReelParam.ReelDest = ReelDest.Paper; MoveInfo.ReelParam.ReelDest = ReelDest.VT_Tower;
} }
else if (!string.IsNullOrEmpty(reelLocation1.isVacuum)) else if (!string.IsNullOrEmpty(reelLocation1.isVacuum))
{ {
...@@ -154,15 +154,15 @@ namespace DeviceLibrary ...@@ -154,15 +154,15 @@ namespace DeviceLibrary
else 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; MoveInfo.ReelParam.ReelDest = ReelDest.MSD;
} }
...@@ -174,13 +174,17 @@ namespace DeviceLibrary ...@@ -174,13 +174,17 @@ namespace DeviceLibrary
MoveInfo.ReelParam.logresult(); MoveInfo.ReelParam.logresult();
MoveInfo.log("服务器没有返回明确目标"); MoveInfo.log("服务器没有返回明确目标");
} }
MoveInfo.log(MoveInfo.ReelParam.ToStr());
if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg) if (RobotManage.offlinemode && !MoveInfo.ReelParam.IsNg)
{ {
printTask = DoPrint(MoveInfo.ReelParam, false); printTask = DoPrint(MoveInfo.ReelParam, false);
} }
//开始吸标 if (!MoveInfo.ReelParam.IsNg)
VacuumMoveInfo.ReelParam = MoveInfo.ReelParam; {
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01); //开始吸标
VacuumMoveInfo.ReelParam = MoveInfo.ReelParam;
VacuumMoveInfo.NewMove(MoveStep.LblVacuum_01);
}
} }
break; break;
case MoveStep.Lbl_03_LineRun: case MoveStep.Lbl_03_LineRun:
...@@ -206,7 +210,8 @@ namespace DeviceLibrary ...@@ -206,7 +210,8 @@ namespace DeviceLibrary
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)}");
RobotManage.Line1.LineStop("label", "Lbl_04_LineStop"); RobotManage.Line1.LineStop("label", "Lbl_04_LineStop");
RobotManage.Line2.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; break;
case MoveStep.Lbl_05_ScanCode: case MoveStep.Lbl_05_ScanCode:
//MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo); //MoveInfo.NextMoveStep(MoveStep.Lbl_06_Get_Reelinfo);
...@@ -216,26 +221,26 @@ namespace DeviceLibrary ...@@ -216,26 +221,26 @@ namespace DeviceLibrary
//Task.Delay(1000).Wait(); //Task.Delay(1000).Wait();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.Lbl_05_Wait: //case MoveStep.Lbl_05_Wait:
if (SendOutMoveInfo.MoveStep == MoveStep.Wait) // if (SendOutMoveInfo.MoveStep == MoveStep.Wait)
{ // {
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);
MoveInfo.log("贴标阻挡上升"); // MoveInfo.log("贴标阻挡上升");
} // }
else // else
{ // {
Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", RobotManage.filterMachine.DeviceName), MsgLevel.warning); // Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}", RobotManage.filterMachine.DeviceName), MsgLevel.warning);
MoveInfo.log("贴标阻挡上升,等待到达分盘线"); // MoveInfo.log("贴标阻挡上升,等待到达分盘线");
} // }
break; // break;
case MoveStep.Lbl05: case MoveStep.Lbl05:
if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_end) if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_end)
{ {
MoveInfo.NextMoveStep(MoveStep.Lbl06); MoveInfo.NextMoveStep(MoveStep.Lbl06);
Label_X_Axis.AbsMove(MoveInfo, Config.Label_X_Base, Config.Label_X_Base_speed); //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_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); //Label_Z_Axis.AbsMove(MoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
MoveInfo.log("Label_XYZ转到贴标准备点."); //MoveInfo.log("Label_XYZ转到贴标准备点.");
} }
else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_failure) else if (VacuumMoveInfo.MoveStep == MoveStep.LblVacuum_failure)
{ {
...@@ -268,20 +273,21 @@ namespace DeviceLibrary ...@@ -268,20 +273,21 @@ namespace DeviceLibrary
case MoveStep.Lbl10: case MoveStep.Lbl10:
break; break;
case MoveStep.Lbl11: case MoveStep.Lbl11:
MoveInfo.NextMoveStep(MoveStep.Lbl13); MoveInfo.NextMoveStep(MoveStep.Lbl12);
var p5 = Config.Label_Z_P5; var p5 = Config.Label_Z_P5;
p5 = p5 - (MoveInfo.ReelParam.PlateRawH - 10) * Config.Label_Z_Axis_ChangeValue; p5 = p5 - (MoveInfo.ReelParam.PlateRawH - 10) * Config.Label_Z_Axis_ChangeValue;
Label_Z_Axis.AbsMove(MoveInfo, p5, Config.Label_Z_P5_speed); 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}.关闭吸气."); MoveInfo.log($"取标气缸下降p5:{p5}={Config.Label_Z_P5}-({MoveInfo.ReelParam.PlateRawH}-10)*{Config.Label_Z_Axis_ChangeValue}.关闭吸气.");
break; break;
case MoveStep.Lbl12: case MoveStep.Lbl12:
MoveInfo.NextMoveStep(MoveStep.Lbl13); 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; break;
case MoveStep.Lbl13: case MoveStep.Lbl13:
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut); 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.ReelParam.LabelState = "Ok";
MoveInfo.log("取标气缸上升."); MoveInfo.log("取标气缸上升.");
break; break;
...@@ -339,6 +345,7 @@ namespace DeviceLibrary ...@@ -339,6 +345,7 @@ namespace DeviceLibrary
{ {
RobotManage.Line2.LineRun("label", 15, "Lbl_BeginOut"); RobotManage.Line2.LineRun("label", 15, "Lbl_BeginOut");
} }
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
} }
else if (MoveInfo.IsTimeOut(30)) else if (MoveInfo.IsTimeOut(30))
{ {
...@@ -372,14 +379,14 @@ namespace DeviceLibrary ...@@ -372,14 +379,14 @@ namespace DeviceLibrary
RobotManage.Line2.LineStop("sendout", "LblSendOut_02"); RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
SendOutMoveInfo.log("完成贴标."); SendOutMoveInfo.log("完成贴标.");
} }
else if (MoveInfo.IsTimeOut(30)) else if (SendOutMoveInfo.IsTimeOut(30))
{ {
SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03); SendOutMoveInfo.NewMove(MoveStep.LblSendOut_03);
RobotManage.Line2.LineStop("sendout", "LblSendOut_02"); RobotManage.Line2.LineStop("sendout", "LblSendOut_02");
RobotManage.filterMachine.preReelParam = null; RobotManage.filterMachine.preReelParam = null;
SendOutMoveInfo.log("等待料盘到达分盘线超时.完成贴标."); 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); Msg.add(crc.GetString("wait_goto_xx", "等待料盘到达{0}",RobotManage.filterMachine.DeviceName), MsgLevel.warning);
SendOutMoveInfo.log("等待到达分盘线"); SendOutMoveInfo.log("等待到达分盘线");
......
...@@ -378,6 +378,11 @@ namespace DeviceLibrary ...@@ -378,6 +378,11 @@ namespace DeviceLibrary
{ {
return IOManager.IOValue(ioType, Config); 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) public void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0)
{ {
if (msTime <= 0) if (msTime <= 0)
......
...@@ -107,6 +107,7 @@ namespace DeviceLibrary ...@@ -107,6 +107,7 @@ namespace DeviceLibrary
Filter_32_PaperReel_PushOut, Filter_32_PaperReel_PushOut,
Filter_33_PaperReel_End, Filter_33_PaperReel_End,
Filter_40_Reel_through_wait, Filter_40_Reel_through_wait,
Filter_41_Reel_through_wait,
Filter_41_Reel_through, Filter_41_Reel_through,
Filter_42_Reel_through_Wait, Filter_42_Reel_through_Wait,
Filter_END, Filter_END,
...@@ -130,6 +131,7 @@ namespace DeviceLibrary ...@@ -130,6 +131,7 @@ namespace DeviceLibrary
LblVacuum_end, LblVacuum_end,
LblVacuum_failure, LblVacuum_failure,
LblVacuum_printfail, LblVacuum_printfail,
T1_08_UpReelOk,
T1_08_UpReelFail, T1_08_UpReelFail,
T1_09_ReleaseReel_Fail, T1_09_ReleaseReel_Fail,
T1_09_ReleaseReel_Test, T1_09_ReleaseReel_Test,
......
...@@ -10,6 +10,7 @@ using System.Text; ...@@ -10,6 +10,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using X_Ray;
namespace DeviceLibrary namespace DeviceLibrary
{ {
...@@ -20,7 +21,7 @@ namespace DeviceLibrary ...@@ -20,7 +21,7 @@ namespace DeviceLibrary
public static LabelMachine labelMachine; public static LabelMachine labelMachine;
public static FilterMachine filterMachine; public static FilterMachine filterMachine;
public static T1Machine t1Machine; 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 XrayImage xrayImage = new Asa.XrayImage("XrayImage", XrayImage.DeviceType.HAOBO);
public static Config_XRay Config; public static Config_XRay Config;
public static bool IsLoadOk = true; public static bool IsLoadOk = true;
...@@ -110,6 +111,7 @@ namespace DeviceLibrary ...@@ -110,6 +111,7 @@ namespace DeviceLibrary
} }
Line1 = new LineRunMonitor("line1", labelMachine.Config.DOList[IO_Label_Type.Line1_Run].GetIOAddr()); 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()); 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); LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msgs);
} }
catch (Exception ex) { catch (Exception ex) {
......
...@@ -52,6 +52,14 @@ namespace DeviceLibrary ...@@ -52,6 +52,14 @@ namespace DeviceLibrary
{ {
AlarmLed.LedState = LedState.on; 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(); }); Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
} }
} }
......
...@@ -31,10 +31,10 @@ namespace DeviceLibrary ...@@ -31,10 +31,10 @@ namespace DeviceLibrary
public bool IgnoreSafecheck { get; set; } public bool IgnoreSafecheck { get; set; }
public bool IgnoreGratingSignal { get; set; } public bool IgnoreGratingSignal { get; set; }
public AxisBean T_Batch_Axis; public AxisBean T_Batch_Axis;
AxisBean T_Pan_Axis; public AxisBean T_Pan_Axis;
AxisBean T_Updown_Axis; public AxisBean T_Updown_Axis;
AxisBean T_TrayPos_Axis; AxisBean T_TrayPos_Axis;
AxisBean T_Y_Axis; public AxisBean T_Y_Axis;
MoveInfo ShelfOutMoveInfo; MoveInfo ShelfOutMoveInfo;
MoveInfo ShelfInMoveInfo; MoveInfo ShelfInMoveInfo;
public LineRunMonitor ShelfOutLine; public LineRunMonitor ShelfOutLine;
......
...@@ -66,23 +66,31 @@ namespace DeviceLibrary ...@@ -66,23 +66,31 @@ namespace DeviceLibrary
{ {
RunningLed.LedState = LedState.blink; RunningLed.LedState = LedState.blink;
} }
if (UserPause) {
if (alarmType != AlarmType.None) AlarmLed.LedState = LedState.off;
{ RunningLed.LedState = LedState.off;
AlarmLed.LedState = LedState.on; StandbyLed.LedState = LedState.blink;
}
if (alarmType != AlarmType.None
|| RobotManage.labelMachine.alarmType != AlarmType.None
|| RobotManage.filterMachine.alarmType != AlarmType.None
|| RobotManage.t1Machine.alarmType != AlarmType.None)
{
AlarmBuzzer.ON();
}
else {
AlarmBuzzer.OFF(); 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(); }); Led.LedGroup[DeviceName].ForEach((x) => { x.run(); });
} }
} }
......
...@@ -52,6 +52,7 @@ namespace DeviceLibrary ...@@ -52,6 +52,7 @@ namespace DeviceLibrary
MoveInfo = new MoveInfo(DeviceName); MoveInfo = new MoveInfo(DeviceName);
ResetMoveInfo = MoveInfo; ResetMoveInfo = MoveInfo;
LedProcessInit(); LedProcessInit();
Asa.XrayImage.setProcessLevel(4.0);
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(); });
AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_XRay_Type.Alarm_Buzzer, IO_VALUE.LOW); }); 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 ...@@ -147,8 +147,8 @@ namespace DeviceLibrary
public enum ReelDest { public enum ReelDest {
NG, NG,
MSD, MSD,
Paper, VT_Tower,
String, Tower,
Unknow Unknow
} }
} }
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
<Reference Include="HuichuanLibrary"> <Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath> <HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net"> <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=x86">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Neotel.Rmaxis"> <Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath> <HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
...@@ -74,13 +75,15 @@ ...@@ -74,13 +75,15 @@
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="X-Ray"> <Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\AutoCountMachine\RC1266-AutoCountMachine\source\AutoCountClient\bin\Debug\X-Ray.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<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\IODebounce.cs" />
<Compile Include="AutoScan\common\Led.cs" /> <Compile Include="AutoScan\common\Led.cs" />
<Compile Include="AutoScan\common\NamedPipeClient.cs" /> <Compile Include="AutoScan\common\NamedPipeClient.cs" />
<Compile Include="AutoScan\common\OcrProcess.cs" /> <Compile Include="AutoScan\common\OcrProcess.cs" />
......
...@@ -61,6 +61,13 @@ namespace DeviceLibrary ...@@ -61,6 +61,13 @@ namespace DeviceLibrary
return true; return true;
} }
else { else {
LogUtil.info("ElectricGripper Clamp busy");
ClosePort();
Thread.Sleep(100);
OpenPort();
Thread.Sleep(100);
axis.ResetError();
axis.Push(50, 5.5f, 50);
return false; return false;
} }
} }
......
...@@ -175,6 +175,13 @@ id =@id"; ...@@ -175,6 +175,13 @@ id =@id";
DataTable dt = sh.ExecuteQuery(sql, para); DataTable dt = sh.ExecuteQuery(sql, para);
return dt; 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) 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"; 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 ...@@ -13,6 +13,17 @@ namespace DeviceLibrary
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [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); 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)] [StructLayout(LayoutKind.Sequential)]
public struct EyemOcsFXYR // 用于表示圆 public struct EyemOcsFXYR // 用于表示圆
{ {
......
...@@ -218,7 +218,7 @@ namespace AutoCountMachine ...@@ -218,7 +218,7 @@ namespace AutoCountMachine
this.tabControl1.Location = new System.Drawing.Point(0, 90); this.tabControl1.Location = new System.Drawing.Point(0, 90);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; 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; this.tabControl1.TabIndex = 6;
// //
// tabPage1 // tabPage1
...@@ -232,26 +232,28 @@ namespace AutoCountMachine ...@@ -232,26 +232,28 @@ namespace AutoCountMachine
this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 30); this.tabPage1.Location = new System.Drawing.Point(4, 30);
this.tabPage1.Name = "tabPage1"; 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.TabIndex = 0;
this.tabPage1.Text = "信息"; this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// label_Productivity // 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.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.TabIndex = 8;
this.label_Productivity.Tag = "not"; this.label_Productivity.Tag = "not";
this.label_Productivity.Text = "产量"; this.label_Productivity.Text = "产量";
// //
// btn_PauseBuzzer // 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.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.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.TabIndex = 7;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声"; this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false; this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
...@@ -260,15 +262,17 @@ namespace AutoCountMachine ...@@ -260,15 +262,17 @@ namespace AutoCountMachine
// //
// boxResetControl1 // 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.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.Location = new System.Drawing.Point(790, 249);
this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5); this.boxResetControl1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.boxResetControl1.Name = "boxResetControl1"; 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; this.boxResetControl1.TabIndex = 5;
// //
// cmb_runmode // 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.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmb_runmode.FormattingEnabled = true; this.cmb_runmode.FormattingEnabled = true;
this.cmb_runmode.Items.AddRange(new object[] { this.cmb_runmode.Items.AddRange(new object[] {
...@@ -277,17 +281,18 @@ namespace AutoCountMachine ...@@ -277,17 +281,18 @@ namespace AutoCountMachine
"MSD", "MSD",
"PAPER", "PAPER",
"TOWER"}); "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.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.TabIndex = 4;
this.cmb_runmode.SelectedIndexChanged += new System.EventHandler(this.cmb_runmode_SelectedIndexChanged); this.cmb_runmode.SelectedIndexChanged += new System.EventHandler(this.cmb_runmode_SelectedIndexChanged);
// //
// btn_releaseshelf // 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.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.TabIndex = 3;
this.btn_releaseshelf.Text = "强制释放料架"; this.btn_releaseshelf.Text = "强制释放料架";
this.btn_releaseshelf.UseVisualStyleBackColor = true; this.btn_releaseshelf.UseVisualStyleBackColor = true;
...@@ -295,10 +300,12 @@ namespace AutoCountMachine ...@@ -295,10 +300,12 @@ namespace AutoCountMachine
// //
// groupBox2 // 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.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.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.TabIndex = 2;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "料盘数据"; this.groupBox2.Text = "料盘数据";
...@@ -312,16 +319,18 @@ namespace AutoCountMachine ...@@ -312,16 +319,18 @@ namespace AutoCountMachine
this.listView_reelnfo.Location = new System.Drawing.Point(3, 25); this.listView_reelnfo.Location = new System.Drawing.Point(3, 25);
this.listView_reelnfo.MultiSelect = false; this.listView_reelnfo.MultiSelect = false;
this.listView_reelnfo.Name = "listView_reelnfo"; 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.TabIndex = 0;
this.listView_reelnfo.UseCompatibleStateImageBehavior = false; this.listView_reelnfo.UseCompatibleStateImageBehavior = false;
// //
// groupBox1 // 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.Controls.Add(this.stateView);
this.groupBox1.Location = new System.Drawing.Point(8, 4); this.groupBox1.Location = new System.Drawing.Point(8, 4);
this.groupBox1.Name = "groupBox1"; 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.TabIndex = 1;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "运行状态"; this.groupBox1.Text = "运行状态";
...@@ -335,7 +344,7 @@ namespace AutoCountMachine ...@@ -335,7 +344,7 @@ namespace AutoCountMachine
this.stateView.Location = new System.Drawing.Point(3, 25); this.stateView.Location = new System.Drawing.Point(3, 25);
this.stateView.MultiSelect = false; this.stateView.MultiSelect = false;
this.stateView.Name = "stateView"; 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.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false; this.stateView.UseCompatibleStateImageBehavior = false;
// //
...@@ -344,8 +353,8 @@ namespace AutoCountMachine ...@@ -344,8 +353,8 @@ namespace AutoCountMachine
this.tabPage2.Controls.Add(this.settingControl1); this.tabPage2.Controls.Add(this.settingControl1);
this.tabPage2.Location = new System.Drawing.Point(4, 30); this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
this.tabPage2.Size = new System.Drawing.Size(1000, 565); this.tabPage2.Size = new System.Drawing.Size(748, 460);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "设置"; this.tabPage2.Text = "设置";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
...@@ -354,9 +363,9 @@ namespace AutoCountMachine ...@@ -354,9 +363,9 @@ namespace AutoCountMachine
// //
this.settingControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.settingControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingControl1.Location = new System.Drawing.Point(3, 3); 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.Name = "settingControl1";
this.settingControl1.Size = new System.Drawing.Size(994, 559); this.settingControl1.Size = new System.Drawing.Size(742, 454);
this.settingControl1.TabIndex = 0; this.settingControl1.TabIndex = 0;
// //
// btn_stop // btn_stop
...@@ -388,11 +397,11 @@ namespace AutoCountMachine ...@@ -388,11 +397,11 @@ namespace AutoCountMachine
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listView1.HideSelection = false; 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.MultiSelect = false;
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.ShowGroups = false; 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.TabIndex = 7;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;
// //
...@@ -401,7 +410,7 @@ namespace AutoCountMachine ...@@ -401,7 +410,7 @@ namespace AutoCountMachine
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White; 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.listView1);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
......
...@@ -155,7 +155,7 @@ namespace AutoCountMachine ...@@ -155,7 +155,7 @@ namespace AutoCountMachine
} }
this.ResumeLayout(true); this.ResumeLayout(true);
label_Productivity.Text = string.Format(crc.GetString("label_Productivity", "产量:{0}\r\n不良数:{1}, 不良率:{2}%").Replace("\\r\\n","\n"), 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(); Application.DoEvents();
} }
...@@ -460,14 +460,14 @@ namespace AutoCountMachine ...@@ -460,14 +460,14 @@ namespace AutoCountMachine
break; break;
case "MSD": case "MSD":
RobotManage.offlinemode = true; RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVacuum = "true"; RobotManage.offlinereelLocation.isVacuum = "1";
break; break;
case "PAPER": case "PAPER":
RobotManage.offlinemode = true; RobotManage.offlinemode = true;
RobotManage.offlinereelLocation.isVTTower = "true"; RobotManage.offlinereelLocation.isVTTower = "1";
break; break;
case "TOWER": case "TOWER":
RobotManage.offlinereelLocation.isTower = "true"; RobotManage.offlinereelLocation.isTower = "1";
RobotManage.offlinemode = true; RobotManage.offlinemode = true;
break; break;
} }
......
...@@ -29,6 +29,18 @@ namespace AutoCountMachine ...@@ -29,6 +29,18 @@ namespace AutoCountMachine
//return; //return;
databaseProc.Current.InsertOrUpdateRI(1, "123", "234", true, "abc", 345, "asd", "fgh", "try"); 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); _ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret) if (!ret)
......
...@@ -78,7 +78,10 @@ ...@@ -78,7 +78,10 @@
<HintPath>..\..\SO827-AutoScanAndLabel\AutoScanAndLabel\bin\Debug\UserFromControl.dll</HintPath> <HintPath>..\..\SO827-AutoScanAndLabel\AutoScanAndLabel\bin\Debug\UserFromControl.dll</HintPath>
</Reference> </Reference>
<Reference Include="WindowsBase" /> <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>
<ItemGroup> <ItemGroup>
<Compile Include="AdvanceConfig.cs"> <Compile Include="AdvanceConfig.cs">
......
...@@ -42,10 +42,13 @@ namespace AutoCountMachine ...@@ -42,10 +42,13 @@ namespace AutoCountMachine
this.rb_datafilter_lastMonth = new System.Windows.Forms.RadioButton(); this.rb_datafilter_lastMonth = new System.Windows.Forms.RadioButton();
this.rb_datafilter_thismonth = new System.Windows.Forms.RadioButton(); this.rb_datafilter_thismonth = new System.Windows.Forms.RadioButton();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btn_setadminpassword = new System.Windows.Forms.Button(); this.btn_setadminpassword = new System.Windows.Forms.Button();
this.cb_autorun = new System.Windows.Forms.CheckBox(); this.cb_autorun = new System.Windows.Forms.CheckBox();
this.cb_EnableBuzzer = 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.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
...@@ -78,6 +81,9 @@ namespace AutoCountMachine ...@@ -78,6 +81,9 @@ namespace AutoCountMachine
// //
// panel1 // 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.label_count);
this.panel1.Controls.Add(this.dateTimePicker_end); this.panel1.Controls.Add(this.dateTimePicker_end);
this.panel1.Controls.Add(this.dateTimePicker_start); this.panel1.Controls.Add(this.dateTimePicker_start);
...@@ -216,6 +222,17 @@ namespace AutoCountMachine ...@@ -216,6 +222,17 @@ namespace AutoCountMachine
this.tabPage1.Text = "设置"; this.tabPage1.Text = "设置";
this.tabPage1.UseVisualStyleBackColor = true; 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 // btn_setadminpassword
// //
this.btn_setadminpassword.Location = new System.Drawing.Point(32, 107); this.btn_setadminpassword.Location = new System.Drawing.Point(32, 107);
...@@ -247,16 +264,35 @@ namespace AutoCountMachine ...@@ -247,16 +264,35 @@ namespace AutoCountMachine
this.cb_EnableBuzzer.UseVisualStyleBackColor = true; this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged); this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
// //
// linkLabel1 // comboBox_searchtype
// //
this.linkLabel1.AutoSize = true; this.comboBox_searchtype.DisplayMember = "PartNumber";
this.linkLabel1.Location = new System.Drawing.Point(20, 500); this.comboBox_searchtype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.linkLabel1.Name = "linkLabel1"; this.comboBox_searchtype.FormattingEnabled = true;
this.linkLabel1.Size = new System.Drawing.Size(14, 14); this.comboBox_searchtype.Items.AddRange(new object[] {
this.linkLabel1.TabIndex = 11; "PartNumber",
this.linkLabel1.TabStop = true; "ReelID"});
this.linkLabel1.Text = "_"; this.comboBox_searchtype.Location = new System.Drawing.Point(384, 423);
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 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 // SettingControl
// //
...@@ -295,5 +331,8 @@ namespace AutoCountMachine ...@@ -295,5 +331,8 @@ namespace AutoCountMachine
private System.Windows.Forms.RadioButton rb_datafilter_custom; private System.Windows.Forms.RadioButton rb_datafilter_custom;
private System.Windows.Forms.Label label_count; private System.Windows.Forms.Label label_count;
private System.Windows.Forms.LinkLabel linkLabel1; 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 ...@@ -22,6 +22,7 @@ namespace AutoCountMachine
RoleManger.RoleChange += RoleManger_RoleChange; RoleManger.RoleChange += RoleManger_RoleChange;
this.VisibleChanged += SettingControl_VisibleChanged; this.VisibleChanged += SettingControl_VisibleChanged;
label_count.Text = ""; label_count.Text = "";
comboBox_searchtype.SelectedIndex = 0;
} }
private void SettingControl_VisibleChanged(object sender, EventArgs e) private void SettingControl_VisibleChanged(object sender, EventArgs e)
...@@ -132,7 +133,10 @@ namespace AutoCountMachine ...@@ -132,7 +133,10 @@ namespace AutoCountMachine
void setData(DateTime startData, DateTime endDate) void setData(DateTime startData, DateTime endDate)
{ {
DataTable dt = databaseProc.Current.GetDatabydate(startData, endDate); DataTable dt = databaseProc.Current.GetDatabydate(startData, endDate);
showData(dt);
}
void showData(DataTable dt)
{
dataGridView1.DataSource = dt; dataGridView1.DataSource = dt;
dataGridView1.Columns[0].HeaderText = "";//crc.GetString("dataGrid_ID", "条码"); dataGridView1.Columns[0].HeaderText = "";//crc.GetString("dataGrid_ID", "条码");
...@@ -176,5 +180,23 @@ namespace AutoCountMachine ...@@ -176,5 +180,23 @@ namespace AutoCountMachine
{ {
ConfigHelper.AdvanceConfigForm.ShowEditDialog(this); 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,8 +39,6 @@ namespace AutoCountMachine ...@@ -39,8 +39,6 @@ namespace AutoCountMachine
InitializeComponent(); InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RoleManger.RoleChange += RoleManger_RoleChange; 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) private void RoleManger_RoleChange(object sender, Role e)
...@@ -90,14 +88,19 @@ namespace AutoCountMachine ...@@ -90,14 +88,19 @@ namespace AutoCountMachine
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
ConfigHelper.Config.Set("findcicyle_p1", int.Parse(txt_p1.Text)); var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterC();
ConfigHelper.Config.Set("findcicyle_p2", int.Parse(txt_p2.Text)); var offset_x = currpos.X - RobotManage.t1Machine.CenterPos.X;
ConfigHelper.Config.SaveChange(); var offset_y = currpos.Y - RobotManage.t1Machine.CenterPos.Y;
var (bitmap, currpos, debugtxt) = RobotManage.t1Machine.GetStringCenterA(); offset_x = offset_x * -1;
var distance = (int)Common.distance(RobotManage.t1Machine.CenterPos, currpos); offset_y = offset_y * -1;
label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance< RobotManage.t1Machine.Config.String_Offset_Range_Px?"OK":"NG")}"; 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) private void btn_Empty_Linerun_Click(object sender, EventArgs e)
...@@ -122,7 +125,7 @@ namespace AutoCountMachine ...@@ -122,7 +125,7 @@ namespace AutoCountMachine
private void button1_Click_1(object sender, EventArgs e) 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); 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")}"; label_eyemMulFuncTool.Text = debugtxt + $"\ndistance:{distance}\nLocation:{(distance < RobotManage.t1Machine.Config.String_Offset_Range_Px ? "OK" : "NG")}";
......
...@@ -84,8 +84,9 @@ namespace AutoCountMachine ...@@ -84,8 +84,9 @@ namespace AutoCountMachine
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnSavePos); this.Controls.Add(this.btnSavePos);
this.Controls.Add(this.groupBox3); 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.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.Load += new System.EventHandler(this.ConfigControl_Load);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
......
...@@ -54,6 +54,7 @@ namespace AutoCountMachine ...@@ -54,6 +54,7 @@ namespace AutoCountMachine
this.btn_ManualCount = new System.Windows.Forms.Button(); this.btn_ManualCount = new System.Windows.Forms.Button();
this.cylinderButton4 = new AutoCountMachine.CylinderButton(); this.cylinderButton4 = new AutoCountMachine.CylinderButton();
this.cylinderButton5 = new AutoCountMachine.CylinderButton(); this.cylinderButton5 = new AutoCountMachine.CylinderButton();
this.btn_Calibration = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
...@@ -220,6 +221,7 @@ namespace AutoCountMachine ...@@ -220,6 +221,7 @@ namespace AutoCountMachine
// panel2 // panel2
// //
this.panel2.Controls.Add(this.pictureBox1); 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_getXrayimage);
this.panel2.Controls.Add(this.btn_openXray); this.panel2.Controls.Add(this.btn_openXray);
this.panel2.Controls.Add(this.btn_closeXray); this.panel2.Controls.Add(this.btn_closeXray);
...@@ -349,6 +351,16 @@ namespace AutoCountMachine ...@@ -349,6 +351,16 @@ namespace AutoCountMachine
this.cylinderButton5.Text = "Entry_Open"; this.cylinderButton5.Text = "Entry_Open";
this.cylinderButton5.UseVisualStyleBackColor = false; 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 // XrayControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -397,5 +409,6 @@ namespace AutoCountMachine ...@@ -397,5 +409,6 @@ namespace AutoCountMachine
private System.Windows.Forms.Label label_tips_scancode; private System.Windows.Forms.Label label_tips_scancode;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_Calibration;
} }
} }
...@@ -7,6 +7,7 @@ using System.ComponentModel; ...@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
...@@ -308,5 +309,78 @@ namespace AutoCountMachine ...@@ -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!