Commit 9debbf56 张东亮

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

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