Commit 9debbf56 张东亮

调试模式下入库上报正常、扫码异常

1 个父辈 a8e81f8e
...@@ -131,7 +131,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -131,7 +131,7 @@ namespace OnlineStore.DeviceLibrary
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
if (deviceName != "") if (deviceName != "")
{ {
LogUtil.debug(deviceName + " 【" + cameraName + "】开始取图片"); LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片");
} }
Bitmap bmp = null; Bitmap bmp = null;
HalconDotNet.HObject ho_Image = null; HalconDotNet.HObject ho_Image = null;
...@@ -147,75 +147,53 @@ namespace OnlineStore.DeviceLibrary ...@@ -147,75 +147,53 @@ namespace OnlineStore.DeviceLibrary
continue; continue;
} }
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.info(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
string r = ""; string r = "";
bool eyemNoCode = false;
if (!isPreScan) if (!isPreScan)
{ {
if (!findRightCode) try
{ {
try List<CodeInfo> cc = new List<CodeInfo>();
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{ {
List<CodeInfo> cc = new List<CodeInfo>(); codeTypeList = codeTypeList.ToArray(),
// eyemNoCode = true; codeCount = codeCount,
timeout = codeTimeout
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam };
{ cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
codeTypeList = codeTypeList.ToArray(), if (cc != null)
codeCount = codeCount, {
timeout = codeTimeout foreach (CodeInfo c in cc)
};
cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
if (cc != null)
{ {
foreach (CodeInfo c in cc) string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{ {
string str = CodeManager.ReplaceCode(c.CodeStr); codeList.Add(str);
if (!codeList.Contains(str)) r = r + "##remote|" + c.CodeType + "|" + str;
if (!findRightCode)
{ {
codeList.Add(str); findRightCode = HasRightCode(str);
r = r + "##remote|" + c.CodeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
} }
} }
} }
} }
catch (Exception ex) if (!findRightCode)
{ {
LogUtil.error(deviceName + " RemoteDecodeHelper扫码出错:" + ex.ToString()); SaveNGImageToFile(deviceName, cameraName, bmp);
} }
} else
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if ((!findRightCode) || eyemNoCode)
{
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
{ {
nameStr = "eyem"; SaveOKImageToFile(deviceName, cameraName, bmp);
} }
//if (!taskResult)
//{
// nameStr = "eyemTimeOut";
//}
SaveNGImageToFile(deviceName, cameraName + nameStr, bmp);
} }
else catch (Exception ex)
{ {
SaveOKImageToFile(deviceName, cameraName, bmp); LogUtil.error(deviceName + " RemoteDecodeHelper扫码出错:" + ex.ToString());
} }
} }
if (deviceName != "" || r != "") LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r);
{
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r);
}
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
...@@ -410,7 +388,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -410,7 +388,7 @@ namespace OnlineStore.DeviceLibrary
} }
return (codeList, bitmapfilename); return (codeList, bitmapfilename);
} }
static int CntImgs = ConfigAppSettings.GetIntValue("SaveImgCnt", 100); static int CntImgs = ConfigAppSettings.GetIntValue("SaveImgCnt", 100);
private static string SaveNGImageToFile(string deviceName, string cameraName, Bitmap bitmap) private static string SaveNGImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{ {
string date = DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond; string date = DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond;
...@@ -446,11 +424,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -446,11 +424,11 @@ namespace OnlineStore.DeviceLibrary
{ {
Directory.CreateDirectory(dire); Directory.CreateDirectory(dire);
} }
using(Bitmap bit = (Bitmap)bitmap.Clone()) using (Bitmap bit = (Bitmap)bitmap.Clone())
{ {
deleteFiles(dire); deleteFiles(dire);
bit.Save(dire + iamgeName, ImageFormat.Bmp); bit.Save(dire + iamgeName, ImageFormat.Bmp);
// bit.Dispose(); // bit.Dispose();
} }
LogUtil.info(deviceName + " 【" + cameraName + "】保存OK图片到【" + dire + iamgeName + "】成功"); LogUtil.info(deviceName + " 【" + cameraName + "】保存OK图片到【" + dire + iamgeName + "】成功");
......
...@@ -387,7 +387,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -387,7 +387,7 @@ namespace OnlineStore.DeviceLibrary
{ {
ConfigIO io = baseConfig.getWaitIO(wait.IoType); ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒"; WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
if (moveInfo.IsStep(StepEnum.Line_02_WaitReduceSig)) if (moveInfo.IsStep(StepEnum.Line_02_WaitReduceSig) || moveInfo.IsStep(StepEnum.Line_03_ReelArriveStop))
{ {
SServerManager.DisablePos("仓内长皮带线", moveInfo.MoveParam.PosInfo.barcode, moveInfo.MoveParam.PosInfo.PosId,$"在长皮带线{timeOutSeconds}S内未检测到料盘"); SServerManager.DisablePos("仓内长皮带线", moveInfo.MoveParam.PosInfo.barcode, moveInfo.MoveParam.PosInfo.PosId,$"在长皮带线{timeOutSeconds}S内未检测到料盘");
wait.IsEnd=true; wait.IsEnd=true;
......
...@@ -107,7 +107,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,7 +107,8 @@ namespace OnlineStore.DeviceLibrary
{ {
boxStatus.status = (int)DeviceStatus.Debugging; boxStatus.status = (int)DeviceStatus.Debugging;
} }
else if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd))
if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd))
{ {
boxStatus.data.Add(ParamDefine.posId, lastPosId); boxStatus.data.Add(ParamDefine.posId, lastPosId);
boxStatus.data.Add(ParamDefine.barcode,lastBarcode); boxStatus.data.Add(ParamDefine.barcode,lastBarcode);
......
...@@ -51,7 +51,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -51,7 +51,8 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns> /// <returns></returns>
private bool PreInStoreCheck(InOutParam param) private bool PreInStoreCheck(InOutParam param)
{ {
if (IsDebug) return true; //调试模式开启
//if (IsDebug) return true;
if (!AutoInout.autoNext && !InDoorCheck(param)) if (!AutoInout.autoNext && !InDoorCheck(param))
{ {
if (param == null || param.PosInfo == null) if (param == null || param.PosInfo == null)
...@@ -107,8 +108,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,8 +108,8 @@ namespace OnlineStore.DeviceLibrary
{ {
if (posinfo == null) if (posinfo == null)
return false; return false;
LogUtil.error(Name + $" 启动入库出错,入口料盘无入库信息[barcode={posinfo.barcode},PosSide={posinfo.GetPosSide()}], 任务取消"); LogUtil.error(Name + $" 启动入库出错,入口料盘入库信息和检测信号不符合条件[barcode={posinfo.barcode},PosSide={posinfo.GetPosSide()}]");
SServerManager.cancelPutInTask(Name, posinfo.barcode); //SServerManager.cancelPutInTask(Name, posinfo.barcode);
return false; return false;
} }
......
...@@ -373,11 +373,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -373,11 +373,15 @@ namespace OnlineStore.DeviceLibrary
{ {
Robot.IOMove(IO_Type.CameraLed, IO_VALUE.HIGH); Robot.IOMove(IO_Type.CameraLed, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(Config.CameraName, Name); List<string> codes = CodeManager.CameraScan(Config.CameraName, Name);
if (LastCodeList.Count <= 0) if (codes.Count <= 0)
{ {
LastCodeList = CodeManager.CameraScan(Config.CameraName, Name); LastCodeList = CodeManager.CameraScan(Config.CameraName, Name);
} }
else
{
LastCodeList = new List<string>(codes);
}
//TODO 需要判断是否和上次的条码重复,重复的条码不可用 //TODO 需要判断是否和上次的条码重复,重复的条码不可用
bool isCanUse = true; bool isCanUse = true;
//判断是否可用 //判断是否可用
......
...@@ -165,10 +165,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -165,10 +165,10 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.II06_WaitHeight)) else if (MoveInfo.IsStep(StepEnum.II06_WaitHeight))
{ {
BatchMoveBean moveBean = BatchMove; BatchMoveBean moveBean = BatchMove;
//if (moveBean.LastHeight > 0) if (moveBean.LastHeight > 0)
{ {
ClearTimeoutAlarm("获取料盘高度完成超时"); ClearTimeoutAlarm("获取料盘高度完成超时");
int Height = 8;//moveBean.LastHeight; int Height = moveBean.LastHeight;
int width = 7; int width = 7;
//if (IOValue(IO_Type.Feeding_Reel_13_Check).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_Type.Feeding_Reel_13_Check).Equals(IO_VALUE.HIGH))
//{ //{
...@@ -180,10 +180,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -180,10 +180,10 @@ namespace OnlineStore.DeviceLibrary
MoveLog($"入库取料{shelf}{MoveInfo.SLog}: 料盘尺寸{width}X{Height}"); MoveLog($"入库取料{shelf}{MoveInfo.SLog}: 料盘尺寸{width}X{Height}");
II13_GetPosId(); II13_GetPosId();
} }
//else if (MoveInfo.IsTimeOut(60)) else if (MoveInfo.IsTimeOut(60))
//{ {
// MoveTimeOut(MoveInfo, "" + moveBean.Name + "获取料盘高度完成"); MoveTimeOut(MoveInfo, "" + moveBean.Name + "获取料盘高度完成");
//} }
} }
else if (MoveInfo.IsStep(StepEnum.II08_GetPosId)) else if (MoveInfo.IsStep(StepEnum.II08_GetPosId))
{ {
......
...@@ -590,7 +590,7 @@ namespace OnlineStore.XLRStore ...@@ -590,7 +590,7 @@ namespace OnlineStore.XLRStore
{ {
if (Camera._cam != null) if (Camera._cam != null)
{ {
Camera._cam.CloseAll(); Camera._cam?.CloseAll();
} }
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode(false); CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode(false);
frm.ShowDialog(); frm.ShowDialog();
......
...@@ -254,8 +254,8 @@ namespace OnlineStore.XLRStore ...@@ -254,8 +254,8 @@ namespace OnlineStore.XLRStore
return Write(fileName, DumpType.MiniDumpWithFullMemory); return Write(fileName, DumpType.MiniDumpWithFullMemory);
} }
public static bool Write(string fileName, DumpType dumpType) public static bool Write(string fileName, DumpType dumpType)
{ {
using (var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None)) using (var fs = new System.IO.FileStream(fileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.None))
{ {
MiniDumpExceptionInformation exp; MiniDumpExceptionInformation exp;
exp.ThreadId = GetCurrentThreadId(); exp.ThreadId = GetCurrentThreadId();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!