Commit 26d8f298 LN

增加预扫码超时判断

1 个父辈 2e06d2a8
此文件类型无法预览
此文件类型无法预览
...@@ -846,10 +846,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -846,10 +846,11 @@ namespace OnlineStore.DeviceLibrary
InLog("料盘移栽" + MoveInfo.SLog + ":提升轴下降到料盘不溢出(" + (currPositon - Config.Height_ChangeValue * 30) + "):" + targetPosition+",速度"+Config.BatchAxis_P4Speed); InLog("料盘移栽" + MoveInfo.SLog + ":提升轴下降到料盘不溢出(" + (currPositon - Config.Height_ChangeValue * 30) + "):" + targetPosition+",速度"+Config.BatchAxis_P4Speed);
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P4Speed); BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P4Speed);
} }
private Task YuScanTask = null;
private void YuScanCode() private void YuScanCode()
{ {
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1); bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
YuScanTask = null;
//TODO 此处需要等待空托盘 //TODO 此处需要等待空托盘
if (MoveInfo.ShelfNoTray.Equals(false) && isScan) if (MoveInfo.ShelfNoTray.Equals(false) && isScan)
{ {
...@@ -859,8 +860,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -859,8 +860,8 @@ namespace OnlineStore.DeviceLibrary
List<string> bijiaoList = new List<string>(LastCodeList); List<string> bijiaoList = new List<string>(LastCodeList);
try try
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate YuScanTask = Task.Factory.StartNew(delegate
{ {
Thread.Sleep(100); Thread.Sleep(100);
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码"); NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码");
bool isCanUse = true; bool isCanUse = true;
...@@ -916,53 +917,61 @@ namespace OnlineStore.DeviceLibrary ...@@ -916,53 +917,61 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give)) if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give))
{ {
MoveInfo.NextMoveStep(LineMoveStep.FI_18_ScanCode); if (YuScanTask == null || YuScanTask.IsCompleted)
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1); {
ClearTimeoutAlarm("预扫码结束超时");
MoveInfo.NextMoveStep(LineMoveStep.FI_18_ScanCode);
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
LastCodeList = new List<string>(); LastCodeList = new List<string>();
ScanCodeTask = null; ScanCodeTask = null;
if (NextCodeList.Count > 0) if (NextCodeList.Count > 0)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.NextMoveStep(LineMoveStep.FI_21_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
{ {
ScanCodeTask = Task.Factory.StartNew(delegate InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.NextMoveStep(LineMoveStep.FI_21_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
{ {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name); ScanCodeTask = Task.Factory.StartNew(delegate
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
if (!hasRightCode)
{ {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000); LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
} bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
return LastCodeList; if (!hasRightCode)
}); {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
}
return LastCodeList;
});
}
catch (Exception ex)
{
LogUtil.error("" + MoveInfo.SLog + ":扫码出错:", ex);
}
//finally
//{
// MoveInfo.EndStepWait();
//}
} }
catch (Exception ex) else
{ {
LogUtil.error("" + MoveInfo.SLog + ":扫码出错:", ex); InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码");
} }
//finally
//{
// MoveInfo.EndStepWait();
//}
} }
else else if (MoveInfo.IsTimeOut(60))
{ {
InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码"); MoveTimeOut(MoveInfo, "预扫码结束超时");
} }
} }
else else
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!