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
{
......
......@@ -48,16 +48,16 @@ namespace OnlineStore.DeviceLibrary
UpdateShelf(1);
if (CurrShelf.ShelfState.Equals(3))
{
// bool agvcallresult = AgvClient.NeedLeave(Config.AgvName, CurrShelf.ShelfRfid, ClientLevel.High);
// bool agvcallresult = AgvClient.NeedLeave(Config.AgvName, CurrShelf.ShelfRfid, ClientLevel.High);
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();
......@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
WorkLog("定位工位检测到料串: 链条停止,阻挡气缸上升");
LineStop();
StopUp(MoveInfo);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
private void IB02_BatchAxisToP1()
{
......@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
{
WorkLog("料串入料 :入口有料串,转动料串到位");
MoveInfo.NextMoveStep(StepEnum.IB03_LineStart);
LineRun(MoveInfo);
LineRun(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_Shelf_FrontCheck, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_Shelf_InPlaceCheck, IO_VALUE.HIGH));
}
......@@ -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))
{
......@@ -237,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsTimeOut(10))
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "] " + "等待旋转轴离开料串超时" + "[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
}
}
}
else if (MoveInfo.IsStep(StepEnum.IB11_ScanCode))
{
......@@ -268,8 +269,9 @@ namespace OnlineStore.DeviceLibrary
var span = DateTime.Now - MoveInfo.LastSetpTime;
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();
......@@ -313,7 +321,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.OneWaitCanEndStep = true;
EmptyShelf = true;
//bool agvcallresult = AgvClient.NeedLeave(Config.AgvName, CurrShelf.ShelfRfid, ClientLevel.High);
// WorkLog("上料完成 :通知agv来取料串,等待料串离开Config.AgvName:" + Config.AgvName + ",CurrShelfId:" + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
// WorkLog("上料完成 :通知agv来取料串,等待料串离开Config.AgvName:" + Config.AgvName + ",CurrShelfId:" + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_Shelf_FrontCheck, IO_VALUE.LOW));
}
......@@ -413,22 +421,22 @@ namespace OnlineStore.DeviceLibrary
{
toBatchP4 = false;
//判断扫码点是否可用,可用,运动到扫码点
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);
......@@ -439,7 +447,7 @@ namespace OnlineStore.DeviceLibrary
{
IB11_ScanCode();
}
}
}
}
else
{
......@@ -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;
......@@ -638,8 +646,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.TimeOutSeconds = 40;
MoveInfo.OneWaitCanEndStep = true;
// bool agvcallresult = AgvClient.NeedLeave(Config.AgvName, CurrShelf.ShelfRfid, ClientLevel.High);
// WorkLog("送出出库料串 :通知agv来取料串,等待料串离开Config.AgvName:" + Config.AgvName + ",CurrShelfId:" + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
// bool agvcallresult = AgvClient.NeedLeave(Config.AgvName, CurrShelf.ShelfRfid, ClientLevel.High);
// WorkLog("送出出库料串 :通知agv来取料串,等待料串离开Config.AgvName:" + Config.AgvName + ",CurrShelfId:" + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_Shelf_FrontCheck, IO_VALUE.LOW));
}
......@@ -687,9 +695,9 @@ namespace OnlineStore.DeviceLibrary
}
internal void ReelPutOk()
{
{
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.IsStep(StepEnum.IS13_WaitReel))
{
{
MoveInfo.NextMoveStep(StepEnum.IS14_ReelOK);
WorkLog($"出库{MoveInfo.SLog} 放料完成");
CheckShelfIsFull();
......@@ -701,7 +709,7 @@ namespace OnlineStore.DeviceLibrary
}
private void CheckShelfIsFull()
{
{
int currPositon = BatchAxis.GetAclPosition();
int nextP = currPositon - Robot.Config.Height_ChangeValue * (8 + 20);
if (nextP <= Config.BatchAxisP1)
......@@ -718,7 +726,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
SendOutShelfLeave("料串出满需离开(信号到位)");
SendOutShelfLeave("料串出满需离开(信号到位)");
}
}
else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove))
......@@ -787,7 +795,7 @@ namespace OnlineStore.DeviceLibrary
// LineRun();
// //等待进料检测信号
// bool result = Robot.WaitIo(Config.IO_Shelf_FrontCheck, IO_VALUE.HIGH, 60000);
// bool result = Robot.WaitIo(Config.IO_Shelf_FrontCheck, IO_VALUE.HIGH, 60000);
//
// if (!result)
// {
......@@ -932,7 +940,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.InStore))
{
if (MoveInfo.IsStep(StepEnum.IB16_SaveHight))
{
{
MoveInfo.NextMoveStep(StepEnum.IB17_WaitReelLeave);
WorkLog("当前料盘已离开,开始判断是否有下一盘,开始扫码");
LastHeight = 0;
......@@ -942,7 +950,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayLeave暂不处理");
}
}
}
private bool isFastLoad = true;
public bool UpdateShelf(int state = 0, string xnRfid = "")
......@@ -962,7 +970,7 @@ namespace OnlineStore.DeviceLibrary
{
CurrShelf = new ShelfInfo();
EmptyShelf = false;
// AgvClient.SetStatus(Config.AgvName);
// AgvClient.SetStatus(Config.AgvName);
}
else
{
......
......@@ -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!