Commit 91ea680b 几米阳光

停止重新启动料仓后无法出库修改。扫码修改。

1 个父辈 cb9f8646
...@@ -217,6 +217,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -217,6 +217,8 @@ namespace OnlineStore.DeviceLibrary
#region 原点返回和复位处理 #region 原点返回和复位处理
private void ReturnHome() private void ReturnHome()
{ {
isInSuddenDown = false;
isNoAirCheck = false;
WarnMsg = ""; WarnMsg = "";
CurrInOutACount = 0; CurrInOutACount = 0;
CurrInOutCount = 0; CurrInOutCount = 0;
......
...@@ -6,6 +6,7 @@ using System.Collections.Generic; ...@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -112,6 +113,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -112,6 +113,7 @@ namespace OnlineStore.DeviceLibrary
return bitm; return bitm;
} }
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan( ) public static List<string> CameraScan( )
{ {
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
...@@ -130,32 +132,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -130,32 +132,32 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(" 摄像机【" + cameraName + "】获取图片完成"); LogUtil.info(" 摄像机【" + cameraName + "】获取图片完成");
string path = Application.StartupPath + @"\CodeImage\"; //string path = Application.StartupPath + @"\CodeImage\";
string filePath = path + @"code.png"; //string filePath = path + @"code.png";
if (File.Exists(filePath)) //if (File.Exists(filePath))
{ //{
File.Delete(filePath); // File.Delete(filePath);
} //}
if (!Directory.Exists(path)) //if (!Directory.Exists(path))
{ //{
Directory.CreateDirectory(path); // Directory.CreateDirectory(path);
} //}
bitmap.Save(filePath); //bitmap.Save(filePath);
LogUtil.info(" 摄像机【" + cameraName + "】图片已保存到:"+filePath); //LogUtil.info(" 摄像机【" + cameraName + "】图片已保存到:"+filePath);
//HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
//LogUtil.info(" 摄像机【" + cameraName + "】转换图片完成,开始扫码"); LogUtil.info(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList) foreach (string codeType in codeTypeList)
{ {
//判断是否是一维码 //判断是否是一维码
if (codeType.ToLower().Equals("barcode")) if (codeType.ToLower().Equals("barcode"))
{ {
cc = HDCodeHelper.DecodeBarCode(filePath); cc = HDCodeHelper.DecodeBarCode(ho_Image);
} }
else else
{ {
cc = HDCodeHelper.DecodeCode(filePath, 1, GetCodeParamFilePath(codeType), codeType); cc = HDCodeHelper.DecodeCode(ho_Image, 1, GetCodeParamFilePath(codeType), codeType);
} }
LogUtil.info(" 摄像机【" + cameraName + "】【"+ codeType + "】扫码完成"); LogUtil.info(" 摄像机【" + cameraName + "】【"+ codeType + "】扫码完成");
} }
...@@ -163,6 +165,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -163,6 +165,10 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
catch (AccessViolationException e)
{
LogUtil.error("扫码出现AccessViolationException异常:" + e.ToString());
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("扫码出错:" + ex.ToString()); LogUtil.error("扫码出错:" + ex.ToString());
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!