Commit 745d7391 LN

预扫码只使用算法扫码,未扫到时不保存照片

1 个父辈 9baad66c
 20200316
环形线RFID用12001
出料机构RFID用13000
环形线电脑
teamviwer 796475033
todesk 874075053 Acc123
20210114 20210114
新建项目,SO827环形线 新建项目,SO827环形线
......
...@@ -101,6 +101,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -101,6 +101,7 @@ namespace OnlineStore.DeviceLibrary
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500) public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500)
{ {
bool isPreScan = deviceName.EndsWith("预扫码");
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0) if (cameraList == null || cameraList.Count <= 0)
{ {
...@@ -153,52 +154,55 @@ namespace OnlineStore.DeviceLibrary ...@@ -153,52 +154,55 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
List<CodeInfo> cc = new List<CodeInfo>(); if (!isPreScan)
if (!findRightCode)
{ {
eyemNoCode = true; if (!findRightCode)
foreach (string codeType in codeTypeList)
{ {
//判断是否是一维码 List<CodeInfo> cc = new List<CodeInfo>();
if (codeType.ToLower().Equals("barcode")) eyemNoCode = true;
foreach (string codeType in codeTypeList)
{ {
cc = HDCodeHelper.DecodeBarCode(ho_Image); //判断是否是一维码
} if (codeType.ToLower().Equals("barcode"))
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{ {
codeList.Add(str); cc = HDCodeHelper.DecodeBarCode(ho_Image);
r = r + "##halcon|" + codeType + "|" + str; }
if (!findRightCode) else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{ {
findRightCode = HasRightCode(str); codeList.Add(str);
r = r + "##halcon|" + codeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
} }
} }
}
if (findRightCodeBreak && findRightCode) if (findRightCodeBreak && findRightCode)
{ {
break; break;
}
} }
} }
} //if (!findRightCode && SaveErrorImageToFile.Equals(1))
//if (!findRightCode && SaveErrorImageToFile.Equals(1)) if ((!findRightCode) || eyemNoCode)
if ( (!findRightCode) || eyemNoCode)
{
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
{ {
nameStr = "eyem"; //如果halcon没扫出的,
} string nameStr = "";
if (findRightCode && eyemNoCode)
{
nameStr = "eyem";
}
SaveImageToFile(deviceName, cameraName + nameStr, bmp); SaveImageToFile(deviceName, cameraName + nameStr, bmp);
}
} }
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
{ {
...@@ -240,7 +244,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,7 +244,7 @@ namespace OnlineStore.DeviceLibrary
} }
return codeList; return codeList;
} }
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile); private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap) private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!