Commit 745d7391 LN

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

1 个父辈 9baad66c

20200316
环形线RFID用12001
出料机构RFID用13000
环形线电脑
teamviwer 796475033
todesk 874075053 Acc123
20210114
新建项目,SO827环形线
......
......@@ -101,6 +101,7 @@ namespace OnlineStore.DeviceLibrary
[HandleProcessCorruptedStateExceptions]
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>();
if (cameraList == null || cameraList.Count <= 0)
{
......@@ -153,52 +154,55 @@ namespace OnlineStore.DeviceLibrary
}
}
}
List<CodeInfo> cc = new List<CodeInfo>();
if (!findRightCode)
if (!isPreScan)
{
eyemNoCode = true;
foreach (string codeType in codeTypeList)
if (!findRightCode)
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
List<CodeInfo> cc = new List<CodeInfo>();
eyemNoCode = true;
foreach (string codeType in codeTypeList)
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
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))
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
codeList.Add(str);
r = r + "##halcon|" + codeType + "|" + str;
if (!findRightCode)
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
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)
{
break;
if (findRightCodeBreak && findRightCode)
{
break;
}
}
}
}
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if ( (!findRightCode) || eyemNoCode)
{
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
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 != "")
{
......@@ -240,7 +244,7 @@ namespace OnlineStore.DeviceLibrary
}
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)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!