Commit 8d9482bc LN

1

1 个父辈 794fac15
...@@ -284,9 +284,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -284,9 +284,12 @@ namespace OnlineStore.DeviceLibrary
{ {
if (Line3TurnIsStop() && IOValue(IO_Type.SeparateDevice_Check).Equals(IO_VALUE.LOW) && StationInfo_NG.TrayValue.Equals(IO_VALUE.HIGH)) if (Line3TurnIsStop() && IOValue(IO_Type.SeparateDevice_Check).Equals(IO_VALUE.LOW) && StationInfo_NG.TrayValue.Equals(IO_VALUE.HIGH))
{ {
if (ScanIsEnd() || DeviceID.Equals(302))
{
StartNOutStoreMove(new InOutParam()); StartNOutStoreMove(new InOutParam());
} }
} }
}
else else
{ {
//皮带线3出口有料,分盘定位装置无料 //皮带线3出口有料,分盘定位装置无料
...@@ -577,14 +580,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -577,14 +580,14 @@ namespace OnlineStore.DeviceLibrary
msg += "LIsRun:" + TrayLine1.IsInTurn() + " " + TrayLine2.IsInTurn() + " " + Line3Turn.InTurn + " " + "\n"; msg += "LIsRun:" + TrayLine1.IsInTurn() + " " + TrayLine2.IsInTurn() + " " + Line3Turn.InTurn + " " + "\n";
msg += "L3CanRun:" + TrayLine1.Line3CanRun + " " + TrayLine2.Line3CanRun + " " + "\n"; msg += "L3CanRun:" + TrayLine1.Line3CanRun + " " + TrayLine2.Line3CanRun + " " + "\n";
//msg += "LastWidth:" + LastWidth+"\n"; //msg += "LastWidth:" + LastWidth+"\n";
if (IsNewType) //if (IsNewType)
{ //{
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + LastWidth + "=" + StationInfo_Move.CodeStr + "\n";
}
else
{
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + LastWidth + "=" + StationInfo_Move.CodeStr + "\n"; msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + LastWidth + "=" + StationInfo_Move.CodeStr + "\n";
} //}
//else
//{
// msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + LastWidth + "=" + StationInfo_Move.CodeStr + "\n";
//}
//msg += "NG 工位:" + StationInfo_NG.ToStr + "\n"; //msg += "NG 工位:" + StationInfo_NG.ToStr + "\n";
//msg += "扫码工位:" + StationInfo_Scan.ToStr + "\n"; //msg += "扫码工位:" + StationInfo_Scan.ToStr + "\n";
//msg += "IsInScanCode:" + IsInScanCode; //msg += "IsInScanCode:" + IsInScanCode;
......
...@@ -280,6 +280,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -280,6 +280,10 @@ namespace OnlineStore.DeviceLibrary
int robotIndex = GetRobotIndex(); int robotIndex = GetRobotIndex();
string result = SServerManager.GetTraySize(Name, robotIndex, StationInfo_Move.CodeStr, out LastWidth); string result = SServerManager.GetTraySize(Name, robotIndex, StationInfo_Move.CodeStr, out LastWidth);
LogUtil.info(hengyiName + MoveInfo.SLog + "送料: [" + StationInfo_Move.CodeStr + "] 获取尺寸【" + LastWidth + "】【" + result + "】"); LogUtil.info(hengyiName + MoveInfo.SLog + "送料: [" + StationInfo_Move.CodeStr + "] 获取尺寸【" + LastWidth + "】【" + result + "】");
if (MoveInfo.MoveStep.Equals(LineMoveStep.DON_03_GetTraySize))
{
MoveInfo.EndStepWait();
}
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DON_03_GetTraySize)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.DON_03_GetTraySize))
{ {
......
...@@ -137,19 +137,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -137,19 +137,20 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片"); LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片");
using (Bitmap bitmap = GetCamerImage(cameraName)) using (Bitmap bitmap = GetCamerImage(cameraName))
{ {
HalconDotNet.HObject ho_Image = null;
Bitmap bit = null;
try
{
if (bitmap == null) if (bitmap == null)
{ {
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName); CloseCamera(cameraName);
continue; continue;
} }
LogUtil.info(deviceName + " 【" + cameraName + "】取图片完成,开始转换并扫码"); LogUtil.info(deviceName + " 【" + cameraName + "】取图片完成,开始转换并扫码");
// System.Threading.Thread.Sleep(1); bit = new Bitmap(bitmap);
//转换托盘大概100-150ms,不打印日志
Bitmap bit = new Bitmap(bitmap);
LogUtil.info(deviceName + " 【" + cameraName + "】new Bitmap(bitmap);完成"); LogUtil.info(deviceName + " 【" + cameraName + "】new Bitmap(bitmap);完成");
HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bit); ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bit);
LogUtil.info(deviceName + " 【" + cameraName + "】转换图片完成,开始扫码"); LogUtil.info(deviceName + " 【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
string r = ""; string r = "";
...@@ -180,16 +181,40 @@ namespace OnlineStore.DeviceLibrary ...@@ -180,16 +181,40 @@ namespace OnlineStore.DeviceLibrary
// SaveImageToFile(deviceName, cameraName, bit); // SaveImageToFile(deviceName, cameraName, bit);
} }
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】:" + r); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】:" + r);
}
catch (AccessViolationException e)
{
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
// GC.Collect();
}
catch (Exception ex)
{
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
}
finally
{
if (bitmap != null)
{
bitmap.Dispose();
}
if (bit != null)
{
bit.Dispose(); bit.Dispose();
}
if (ho_Image != null)
{
ho_Image.Dispose(); ho_Image.Dispose();
bitmap.Dispose(); }
}
} }
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常:" + e.ToString()); LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭所有相机:" + e.ToString());
// GC.Collect(); Camera._cam.CloseAll();
//GC.Collect();
} }
catch (Exception ex) catch (Exception ex)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!