Commit c56f264f LN

出库前需要视觉检测无料

1 个父辈 1ae87798
{"CodeOrder":"HalconOnly","Halcon":{"CodeType":"All","Zoom1DCode":1.5,"Zoom2DCode":1.5},"EyemLib":{"CodeType":"All","BlockSize":11,"RangeC":5,"SymbolMin":128,"SymbolMax":215},"Region":[{"CameraName":"monitor","RegionName":"LeftTop","X":76,"Y":172,"Width":416,"Height":479,"Ratio":0.5},{"CameraName":"monitor","RegionName":"RightTop","X":555,"Y":170,"Width":286,"Height":202,"Ratio":0.4},{"CameraName":"monitor","RegionName":"name1","X":526,"Y":424,"Width":640,"Height":375,"Ratio":0.7}],"HIKIPCamera":[{"Name":"monitor","IP":"192.168.1.64","Port":"8000","User":"admin","Pwd":"qwert2asdfg"},{"Name":"photoCamera","IP":"192.168.1.121","Port":"8000","User":"admin","Pwd":"admin123"}]}
\ No newline at end of file \ No newline at end of file
{"CodeOrder":"HalconOnly","Halcon":{"CodeType":"All","Zoom1DCode":1.5,"Zoom2DCode":1.5},"EyemLib":{"CodeType":"All","BlockSize":11,"RangeC":5,"SymbolMin":128,"SymbolMax":215},"Region":[{"CameraName":"monitor","RegionName":"LeftTop","X":952,"Y":268,"Width":416,"Height":479,"Ratio":0.7},{"CameraName":"monitor","RegionName":"RightTop","X":967,"Y":288,"Width":396,"Height":456,"Ratio":0.7},{"CameraName":"monitor","RegionName":"name1","X":526,"Y":424,"Width":640,"Height":375,"Ratio":0.7}],"HIKIPCamera":[{"Name":"monitor","IP":"192.168.102.210","Port":"8000","User":"admin","Pwd":"acc123456"}]}
\ No newline at end of file \ No newline at end of file
...@@ -94,6 +94,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,6 +94,7 @@ namespace OnlineStore.DeviceLibrary
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public bool VisionComp(out Dictionary<string, bool> exist) public bool VisionComp(out Dictionary<string, bool> exist)
{ {
LastCheckTime = DateTime.Now;
bool returnResult = false; bool returnResult = false;
exist = new Dictionary<string, bool>(); exist = new Dictionary<string, bool>();
if (String.IsNullOrEmpty(Config.Camera_Name)) if (String.IsNullOrEmpty(Config.Camera_Name))
...@@ -118,13 +119,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -118,13 +119,13 @@ namespace OnlineStore.DeviceLibrary
{ {
returnResult= true; returnResult= true;
} }
string str = result ? "有料\r\n" : "无料\r\n"; string str = returnResult ? "有料:" : "无料:";
if (exist != null) if (exist != null)
{ {
List<string> keys = new List<string>(exist.Keys); List<string> keys = new List<string>(exist.Keys);
foreach (string key in keys) foreach (string key in keys)
{ {
str += key + "=" + exist[key] + ";\r\n"; str += key + "=" + exist[key] + ";";
} }
} }
LogUtil.info(Name + "VisionComp "+ vcount + " [" + Config.Camera_Name + "] 结果:" + str); LogUtil.info(Name + "VisionComp "+ vcount + " [" + Config.Camera_Name + "] 结果:" + str);
......
...@@ -134,6 +134,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -134,6 +134,7 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
} }
private DateTime preRWTime = DateTime.Now; private DateTime preRWTime = DateTime.Now;
private DateTime LastCheckTime = DateTime.Now;
private void CheckWait() private void CheckWait()
{ {
List<WaitResultInfo> list = MoveInfo.WaitList; List<WaitResultInfo> list = MoveInfo.WaitList;
...@@ -169,7 +170,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -169,7 +170,7 @@ namespace OnlineStore.DeviceLibrary
//如果原点没完成,且原点亮超过5秒,需要报警 //如果原点没完成,且原点亮超过5秒,需要报警
int org = AxisManager.instance.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()); int org = AxisManager.instance.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
if (org.Equals(1) && wait.AxisOrgValue.Equals(1)) if (org.Equals(1) && wait.AxisOrgValue.Equals(1))
{ {
TimeSpan orgSpan = DateTime.Now - wait.LastHasOrgTime; TimeSpan orgSpan = DateTime.Now - wait.LastHasOrgTime;
if (orgSpan.TotalSeconds > 5) if (orgSpan.TotalSeconds > 5)
{ {
...@@ -181,7 +182,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -181,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.AxisOrgValue = org; wait.AxisOrgValue = org;
wait.LastHasOrgTime = DateTime.Now; wait.LastHasOrgTime = DateTime.Now;
} }
} }
} }
else else
...@@ -200,7 +201,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -200,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut; int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_29_WaitTake )) if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_29_WaitTake))
{ {
timeOutMs = 650000; timeOutMs = 650000;
} }
...@@ -223,7 +224,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -223,7 +224,7 @@ namespace OnlineStore.DeviceLibrary
} }
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error( Name + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14); LogUtil.error(Name + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
isOk = false; isOk = false;
break; break;
} }
...@@ -267,9 +268,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -267,9 +268,22 @@ namespace OnlineStore.DeviceLibrary
//{ //{
// LogUtil.debug("等待height=" + wait.HeightValue + "完成"); // LogUtil.debug("等待height=" + wait.HeightValue + "完成");
//} //}
}else if (wait.WaitType == 8) }
else if (wait.WaitType == 8)
{ {
wait.IsEnd = VisionComp( out Dictionary<string, bool> exist); TimeSpan checkSpan = DateTime.Now - LastCheckTime;
if (checkSpan.TotalSeconds > 1)
{
bool result = VisionComp(out Dictionary<string, bool> exist);
if (result && wait.IoValue.Equals(IO_VALUE.HIGH))
{
wait.IsEnd = true;
}
else if ((!result) && wait.IoValue.Equals(IO_VALUE.LOW))
{
wait.IsEnd = true;
}
}
} }
if (wait.IsEnd) if (wait.IsEnd)
{ {
...@@ -603,7 +617,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -603,7 +617,12 @@ namespace OnlineStore.DeviceLibrary
return ""; return "";
} }
string date = Name + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "-Comp"; string date = Name + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "-Comp";
StoreManager.Store.vision.SaveImage(Config.Camera_Name, Application.StartupPath + @"\image\", date, ImageFormat.Png); string dir = @"D:\image\";
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
StoreManager.Store.vision.SaveImage(Config.Camera_Name, dir, date, ImageFormat.Png);
return date; return date;
} }
catch(Exception ex) catch(Exception ex)
...@@ -839,10 +858,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -839,10 +858,15 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW) && VisionComp(out Dictionary<string, bool> exist)) if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW) && VisionComp(out Dictionary<string, bool> exist))
{ {
string fileName = SaveComName( ); string fileName = SaveComName( );
LogUtil.error(Name + "_" + MoveInfo.MoveStep + "_" + MoveInfo.MoveParam.PosInfo.PosId + "出库:门口检测信号无料,但视觉识别有料盘:"+fileName); LogUtil.error(Name + "_" + MoveInfo.MoveStep + "_" + MoveInfo.MoveParam.PosInfo.PosId + "出库:门口检测信号无料,但视觉识别有料盘:"+fileName+",重新等待仓门口无料");
}
SO_53_InoutToP2(); MoveInfo.NextMoveStep(StoreMoveStep.SO_22_WaitNoTray);
MoveInfo.WaitList.Add(WaitResultInfo.WaitVisionComp( IO_VALUE.LOW));
}
else
{
SO_53_InoutToP2();
}
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SO_23_InoutToP2) else if (MoveInfo.MoveStep == StoreMoveStep.SO_23_InoutToP2)
{ {
......
...@@ -215,14 +215,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -215,14 +215,20 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
//public static WaitResultInfo WaitVisionComp() /// <summary>
//{ /// 等待有料
// WaitResultInfo wait = new WaitResultInfo(); /// </summary>
// wait.CanWhileMoveCount = 0; /// <returns></returns>
// wait.WaitType = 8; public static WaitResultInfo WaitVisionComp(IO_VALUE value)
// wait.IsEnd = false; {
// return wait; WaitResultInfo wait = new WaitResultInfo();
//} wait.CanWhileMoveCount = 0;
wait.WaitType = 8;
wait.IoValue = value;
wait.IsEnd = false;
return wait;
}
//public static WaitResultInfo WaitHeight(int height) //public static WaitResultInfo WaitHeight(int height)
//{ //{
// WaitResultInfo wait = new WaitResultInfo(); // WaitResultInfo wait = new WaitResultInfo();
...@@ -268,7 +274,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -268,7 +274,14 @@ namespace OnlineStore.DeviceLibrary
return "料盘高度【" + HeightValue + "】 "; return "料盘高度【" + HeightValue + "】 ";
}else if (WaitType == 8) }else if (WaitType == 8)
{ {
return "视觉识别门口有料"; if (IoValue.Equals(IO_VALUE.LOW))
{
return "视觉识别门口无料";
}
else
{
return "视觉识别门口有料";
}
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!