Commit b7aece47 张东亮

扫码数量和超时以配置形式

1 个父辈 35d87eae
......@@ -79,6 +79,7 @@ namespace OnlineStore.Common
public static string NeedScanCode = "NeedScanCode";
public static string CodeCount = "CodeCount";
public static string ScanCodeTimeout = "ScanCodeTimeout";
public static string DefaultTrayNum = "DefaultTrayNum";
public static string MaxTrayNum = "MaxTrayNum";
......
......@@ -107,7 +107,8 @@ namespace OnlineStore.DeviceLibrary
return CameraScan(nameList, deviceName, findRightCodeBreak, timeOut);
}
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount, 4);
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount, 3);
private static int codeTimeout = ConfigAppSettings.GetIntValue(Setting_Init.ScanCodeTimeout, 3000);
[HandleProcessCorruptedStateExceptions]
static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500)
{
......@@ -142,6 +143,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
LoadCamera(true);
continue;
}
......@@ -186,8 +188,8 @@ namespace OnlineStore.DeviceLibrary
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
codeTypeList = codeTypeList.ToArray(),
codeCount = 3,
timeout = 3000
codeCount = codeCount,
timeout = codeTimeout
};
cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
if (cc != null)
......@@ -272,6 +274,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
LoadCamera(true);
// GC.Collect();
}
catch (Exception ex)
......@@ -342,6 +345,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
LoadCamera(true);
continue;
}
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
......@@ -368,8 +372,8 @@ namespace OnlineStore.DeviceLibrary
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
codeTypeList = codeTypeList.ToArray(),
codeCount = 3,
timeout = 3000
codeCount = codeCount,
timeout = codeTimeout
};
cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
if (cc != null)
......@@ -428,6 +432,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(" 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
LoadCamera(true);
// GC.Collect();
}
catch (Exception ex)
......
......@@ -225,8 +225,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveParam.PosInfoBack != null)//料叉有料,忽略当前入料口,直接入库
{
MoveInfo.NextMoveStep(StepEnum.SI_07_MiddleToP3);
LogInfo($"入库 {MoveInfo.SLog}:入口料盘无入库信息,另一面料叉有料。先将当前移栽旋转轴到抽屉库位垂直取放料点P3,然后对另一面入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MiddleAxis_To_P3();
LogInfo($"入库 {MoveInfo.SLog}:入口料盘无入库信息,另一面料叉有料对另一面入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
//MiddleAxis_To_P3();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.MoveParam.PosInfo = MoveInfo.MoveParam.PosInfoBack.ToCopy();
MoveInfo.MoveParam.MoveP = new LineMoveP(Config, MoveInfo.MoveParam.PosInfo.PosId);
......@@ -237,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.SI_03_VerifyBufferState);
BuffAreaInstoreDoor(true);
LogInfo($"入库 {MoveInfo.SLog}:入料口入库信息确认,入料防护门打开[barcode={MoveInfo.MoveParam.PosInfo.barcode}][posId={MoveInfo.MoveParam.PosInfo.PosId}][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面],开始取料");
LogInfo($"入库 {MoveInfo.SLog}:入料口入库信息确认[barcode={MoveInfo.MoveParam.PosInfo.barcode}][posId={MoveInfo.MoveParam.PosInfo.PosId}][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面],开始取料");
}
break;
case StepEnum.SI_03_VerifyBufferState:
......@@ -296,7 +296,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.SI_07_MiddleToP3);
//MiddleAxis_To_P3();
BuffAreaInstoreDoor(false);
LogInfo($"入库 {MoveInfo.SLog}:另一面无料,关闭入料防护门,直接入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");//移栽旋转轴到料屉库位垂直取放料点P3
LogInfo($"入库 {MoveInfo.SLog}:另一面无料,直接入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");//移栽旋转轴到料屉库位垂直取放料点P3
}
}
else //另一个料叉已有料,进行入库
......@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.SI_07_MiddleToP3);
//MiddleAxis_To_P3();
BuffAreaInstoreDoor(false);
LogInfo($"入库 {MoveInfo.SLog}:另一个料叉已有料,关闭入料防护门,进行入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");//移栽旋转轴到料屉库位垂直取放料点P3
LogInfo($"入库 {MoveInfo.SLog}:另一个料叉已有料,进行入库[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");//移栽旋转轴到料屉库位垂直取放料点P3
}
break;
......@@ -421,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
break;
case StepEnum.SI_18_PutTrayDown:
MoveInfo.NextMoveStep(StepEnum.SI_19_InoutBack);
LogInfo($"入库 {MoveInfo.SLog}:抽屉拉取进出轴到拍照点,同时检测{trayAColumns[GetPosColumn()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
LogInfo($"入库 {MoveInfo.SLog}:抽屉拉取进出轴到拍照点,移栽X轴去待机点,同时检测{trayAColumns[GetPosColumn()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
if (CheckASide())
{
if (!GetShieldState(sheidAColmns[GetPosColumn()]))
......@@ -432,6 +432,7 @@ namespace OnlineStore.DeviceLibrary
if (!GetShieldState(sheidBColmns[GetPosColumn()]))
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayBColumns[GetPosColumn()], IO_VALUE.HIGH));
}
BothXAxis_To_P1();
PullAxis_Inout_To_Cam();
break;
case StepEnum.SI_19_InoutBack:
......@@ -440,12 +441,12 @@ namespace OnlineStore.DeviceLibrary
if (InDoorSigCheck()|| InputInstoreCheck())
{
MoveInfo.NextMoveStep(StepEnum.SI_20_ToStandby);
LogInfo($"入库 {MoveInfo.SLog}:入料口有料,行走机构去待机点,料斗升降轴去待机点,移栽升降轴到上暂存区入库取料低点P3,移栽X轴去待机点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
LogInfo($"入库 {MoveInfo.SLog}:入料口有料,行走机构去待机点,料斗升降轴去待机点,移栽升降轴到上暂存区入库取料低点P3[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P3_P9();
//XAxis_To_P1();
BothXAxis_To_P1();
//BothXAxis_To_P1();
}
else
{
......
......@@ -52,12 +52,12 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "StartInstore 失败,料串" + CurrShelf.ToStr() + "需要离开,NeedLeave:" + Config.AgvName + "," + CurrShelf.ShelfRfid);
return false;
}
else if (Robot.IOValue(Config.IO_Shelf_FrontCheck).Equals(IO_VALUE.HIGH) )
else if (Robot.IOValue(Config.IO_Shelf_FrontCheck).Equals(IO_VALUE.HIGH))
{
MoveInfo.NewMove(MoveType.InStore,new InOutParam());
MoveInfo.NewMove(MoveType.InStore, new InOutParam());
IB03_LineStart();
}
else if(Robot.IOValue(Config.IO_Shelf_InPlaceCheck).Equals(IO_VALUE.HIGH))
else if (Robot.IOValue(Config.IO_Shelf_InPlaceCheck).Equals(IO_VALUE.HIGH))
{
MoveInfo.NewMove(MoveType.InStore, new InOutParam());
IB04_LineWait();
......@@ -215,7 +215,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove))
{
CheckHasTray();
}else if (MoveInfo.IsStep(StepEnum.IB08_BatchAxisToP4))
}
else if (MoveInfo.IsStep(StepEnum.IB08_BatchAxisToP4))
{
if (Robot.AxisIsInShelfUp(ShelfType))
{
......@@ -269,7 +270,8 @@ namespace OnlineStore.DeviceLibrary
WorkLog("料串入料 :扫码结束【" + code + "】,等待取料机构来取料," + MoveInfo.MoveParam.PosInfo.ToStr());
}
}else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToReelPosition))
}
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToReelPosition))
{
string code = CodeManager.ProcessCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB13_ScanOK);
......@@ -289,6 +291,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
LastHeight = GetHeight();
}
else if (MoveInfo.IsStep(StepEnum.IB16_SaveHight))
{
MoveInfo.NextMoveStep(StepEnum.IB17_WaitReelLeave);
WorkLog("当前料盘已离开,开始判断是否有下一盘,开始扫码");
LastHeight = 0;
}
else if (MoveInfo.IsStep(StepEnum.IB17_WaitReelLeave))
{
CheckHasTray();
......@@ -417,18 +425,18 @@ namespace OnlineStore.DeviceLibrary
//判断扫码点是否可用,可用,运动到扫码点
int currP = BatchAxis.GetAclPosition();
int targetPosition = currP + Config.BatchAxisP4;
if (Config.BatchAxisP4 > 0 &&(targetPosition<Config.BatchAxisP2 ))
if (Config.BatchAxisP4 > 0 && (targetPosition < Config.BatchAxisP2))
{
batchAxisReelPosition = currP;
toBatchP4 = true;
MoveInfo.NextMoveStep(StepEnum.IB08_BatchAxisToP4);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
BatchAxis.AbsMove(MoveInfo, targetPosition, Robot.Config.BatchAxis_P4Speed);
WorkLog("料盘已到位,批量轴当前位置【"+currP+ "】,扫码上升高度P4【" + Config.BatchAxisP4+"】可用,批量轴走到扫码点【"+ targetPosition + "】");
WorkLog("料盘已到位,批量轴当前位置【" + currP + "】,扫码上升高度P4【" + Config.BatchAxisP4 + "】可用,批量轴走到扫码点【" + targetPosition + "】");
}
else
{
LogUtil.info(Name + "料盘已到位,批量轴当前位置【" + currP + "】扫码上升高度P4【" + Config.BatchAxisP4 + "】扫码点【" + targetPosition + "】P2【"+ Config.BatchAxisP2 + "】,可直接扫码");
LogUtil.info(Name + "料盘已到位,批量轴当前位置【" + currP + "】扫码上升高度P4【" + Config.BatchAxisP4 + "】扫码点【" + targetPosition + "】P2【" + Config.BatchAxisP2 + "】,可直接扫码");
if (Robot.AxisIsInShelfUp(ShelfType))
{
MoveInfo.NextMoveStep(StepEnum.IB09_WaitCanScan);
......@@ -464,7 +472,7 @@ namespace OnlineStore.DeviceLibrary
}
private void SendInShelfLeave(string msg = "")
{
WorkLog(" SendInShelfLeave :" + msg+",清空条码");
WorkLog(" SendInShelfLeave :" + msg + ",清空条码");
LastCodeList = new List<string>();
preCodeList = new List<string>();
bool needLeave = true;
......
......@@ -284,9 +284,9 @@ namespace OnlineStore.DeviceLibrary
{
// int shelf = MoveInfo.MoveParam.ShelfType;
// if (shelf.Equals(1))
{
BatchMove.GetTrayStartLeave();
}
//{
// BatchMove.GetTrayStartLeave();
//}
}
string getSideName(int shelf)
{
......
......@@ -239,11 +239,11 @@ namespace OnlineStore.DeviceLibrary
if (!CheckLabel())
{
MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
MoveLog($"打标:剥纸器上无标签");
MoveLog($"打标:出口无标签");
}
else
{
SetWarnMsg($"剥纸器上有标签,无法打印");
SetWarnMsg($"出口有标签,无法打印");
Thread.Sleep(2000);
}
}
......@@ -266,11 +266,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.Label05_WaitPrintOK);
MoveLog($"打标:5秒超时,认为出标完成");
}
//else if (MoveInfo.IsTimeOut(15))
//{
// MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
// MoveLog($"打标:出标超时15秒,重新发送打印任务");
//}
Thread.Sleep(1000);
}
else if (MoveInfo.IsStep(StepEnum.Label05_WaitPrintOK))
......@@ -289,9 +284,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
MoveLog($"打标:未检测到标签在平台上,标签平台后退,准备重新打印");
Label_CylinderBack(MoveInfo);
SetWarnMsg("标签未在平台上,请处理");
//MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
//MoveLog($"打标:未检测到标签在平台上,标签平台后退,准备重新打印");
//Label_CylinderBack(MoveInfo);
}
}
else if (MoveInfo.IsStep(StepEnum.Label07_CheckLabelInPos))
......@@ -379,6 +375,9 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
bool checkLabelInPos()
{
bool useLabelCheck = ConfigAppSettings.GetBoolValue(Setting_Init.UseLabelCheck, false);
if (useLabelCheck)
return IOValue(IO_Type.Printer_LabelCheck).Equals(IO_VALUE.HIGH);
return true;
}
public void SetWarnMsg(string msg = "")
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!