Commit 8d9482bc LN

1

1 个父辈 794fac15
......@@ -284,7 +284,10 @@ namespace OnlineStore.DeviceLibrary
{
if (Line3TurnIsStop() && IOValue(IO_Type.SeparateDevice_Check).Equals(IO_VALUE.LOW) && StationInfo_NG.TrayValue.Equals(IO_VALUE.HIGH))
{
StartNOutStoreMove(new InOutParam());
if (ScanIsEnd() || DeviceID.Equals(302))
{
StartNOutStoreMove(new InOutParam());
}
}
}
else
......@@ -577,14 +580,14 @@ namespace OnlineStore.DeviceLibrary
msg += "LIsRun:" + TrayLine1.IsInTurn() + " " + TrayLine2.IsInTurn() + " " + Line3Turn.InTurn + " " + "\n";
msg += "L3CanRun:" + TrayLine1.Line3CanRun + " " + TrayLine2.Line3CanRun + " " + "\n";
//msg += "LastWidth:" + LastWidth+"\n";
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";
}
//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 += "NG 工位:" + StationInfo_NG.ToStr + "\n";
//msg += "扫码工位:" + StationInfo_Scan.ToStr + "\n";
//msg += "IsInScanCode:" + IsInScanCode;
......
......@@ -280,6 +280,10 @@ namespace OnlineStore.DeviceLibrary
int robotIndex = GetRobotIndex();
string result = SServerManager.GetTraySize(Name, robotIndex, StationInfo_Move.CodeStr, out LastWidth);
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))
{
......
......@@ -137,59 +137,84 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片");
using (Bitmap bitmap = GetCamerImage(cameraName))
{
if (bitmap == null)
HalconDotNet.HObject ho_Image = null;
Bitmap bit = null;
try
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
continue;
}
LogUtil.info(deviceName + " 【" + cameraName + "】取图片完成,开始转换并扫码");
// System.Threading.Thread.Sleep(1);
//转换托盘大概100-150ms,不打印日志
Bitmap bit = new Bitmap(bitmap);
LogUtil.info(deviceName + " 【" + cameraName + "】new Bitmap(bitmap);完成");
HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bit);
LogUtil.info(deviceName + " 【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
if (bitmap == null)
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
continue;
}
else
LogUtil.info(deviceName + " 【" + cameraName + "】取图片完成,开始转换并扫码");
bit = new Bitmap(bitmap);
LogUtil.info(deviceName + " 【" + cameraName + "】new Bitmap(bitmap);完成");
ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bit);
LogUtil.info(deviceName + " 【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeCount, GetCodeParamFilePath(codeType), codeType);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
codeList.Add(str);
r = r + "##" + str;
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeCount, GetCodeParamFilePath(codeType), codeType);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##" + str;
}
}
// LogUtil.debug(" 相机【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
}
if (String.IsNullOrEmpty(r))
{
// SaveImageToFile(deviceName, cameraName, bit);
}
// LogUtil.debug(" 相机【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】:" + r);
}
if (String.IsNullOrEmpty(r))
catch (AccessViolationException e)
{
// SaveImageToFile(deviceName, cameraName, bit);
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();
}
if (ho_Image != null)
{
ho_Image.Dispose();
}
}
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】:" + r);
bit.Dispose();
ho_Image.Dispose();
bitmap.Dispose();
}
}
}
catch (AccessViolationException e)
{
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常:" + e.ToString());
// GC.Collect();
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭所有相机:" + e.ToString());
Camera._cam.CloseAll();
//GC.Collect();
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!