Commit 2a3343e8 张东亮

入库空抓料盘时取消入库任务

1 个父辈 9e9d9777
......@@ -108,6 +108,7 @@ namespace OnlineStore.DeviceLibrary
{
LogInfo("复位前,清理出库高度:" + OutStoreHeight);
}
lastcode = "";
//复位时设置状态为none
AgvClient.SetStatus(Config.AgvInName);
AgvClient.SetStatus(Config.AgvOutName);
......
......@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class FeedingEquip
{
{
protected override bool CheckWaitResult(LineMoveInfo moveInfo, WaitResultInfo wait)
{
if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
......@@ -119,13 +119,13 @@ namespace OnlineStore.DeviceLibrary
swWaitWatch.Stop();
lastStopDown = DateTime.Now;
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
LogUtil.debug(Name + " [" + trayCount + "] 检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待 SW_StopCheck=0,清理托盘RFID");
ClearTrayRFID();
ClearTrayRFID();
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH, 1200);
SecondMoveInfo.OneWaitCanEndStep = true;
SecondMoveInfo.OneWaitCanEndStep = true;
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopCheck, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_TrayCheck, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_TrayCheck, IO_VALUE.HIGH));
}
}
else
......@@ -159,7 +159,7 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.OneWaitCanEndStep = true;
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCheck, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_TrayCheck, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_TrayCheck, IO_VALUE.HIGH));
/// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
}
}
......@@ -347,7 +347,7 @@ namespace OnlineStore.DeviceLibrary
{
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);
bool isfull = tray.IsFull;
if (tray!=null&& tray.InoutPar.Corrected)
if (tray != null && tray.InoutPar.Corrected)
{
LogInfo(SecondMoveInfo.MoveNum + SecondMoveInfo.SLog + " 入库中,需拦截空托盘【 " + currTrayNum + "】托盘已纠正,不再验证料盘检测信号");
}
......@@ -365,7 +365,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.ReelCheck));
}
LogInfo(SecondMoveInfo.MoveNum + SecondMoveInfo.SLog + " 入库中,需拦截空托盘【 " + currTrayNum + "】,空托盘料盘检测信号亮,禁用托盘,暂时放托盘离开");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮", 2,DeviceID);
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮", 2, DeviceID);
TrayMoveOk();
return;
}
......@@ -485,7 +485,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo_2))
{
CylinderMove(null, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
CylinderMove(null, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
CheckLog("托盘放行 SecondStoreMove:(托盘放行结束)横移顶升先上升 ");
SMoveEnd();
}
......@@ -551,7 +551,7 @@ namespace OnlineStore.DeviceLibrary
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
}
private void TrayMoveOk(bool needCheck = false)
{
if (needCheck && (!SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_CodeRember)))
......@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary
return;
}
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_MoveOk);
InLog("料盘移栽" + MoveInfo.SLog + ","+SecondMoveInfo.SLog+":托盘开始放行");
InLog("料盘移栽" + MoveInfo.SLog + "," + SecondMoveInfo.SLog + ":托盘开始放行");
if (Config.SidesWayNum > 0)
{
if (CylinderIsOk(IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down))
......@@ -641,10 +641,10 @@ namespace OnlineStore.DeviceLibrary
{
//若定位工位,阻挡工位,有 料架,需要进行处理
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
{
//升降盘需要在后退端
if (IsTrayLCylinderAfter())
{
{
StartInStoreMove(null);
}
}
......@@ -680,7 +680,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.FI_01_TrayLocation_After);
InLog("检测到料架, " + MoveInfo.MoveStep + " :升降盘定位气缸下降");
TrayLCylinderAfter(MoveInfo);
}else
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.FI_00_BatchAxisToP2);
OutLog("检测到料架,升降盘不在后退端 " + MoveInfo.SLog + " :提升伺服先回到P2");
......@@ -704,7 +705,7 @@ namespace OnlineStore.DeviceLibrary
private void LineInStoreProcess()
{
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
......@@ -724,7 +725,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Line_Run, IO_VALUE.HIGH));
} else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_03_LineStart);
InLog("入料检测: " + MoveInfo.SLog + " 进料口有新料架,进料阻挡上升,缓冲阻挡前进1000,流水线转动 1000");
......@@ -787,16 +789,16 @@ namespace OnlineStore.DeviceLibrary
if (CurrShelfId.EndsWith("00"))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_041_ResetRFID);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
string ip = RFIDManager.GetRFIP(DeviceID, 1);
InLog("料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 等待30秒后重新读取");
string msg = "";
bool result=RFIDManager.ResetRFID(ip, out msg);
bool result = RFIDManager.ResetRFID(ip, out msg);
if (!result)
{
LogUtil.error(Name+ "料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 失败:"+msg);
{
LogUtil.error(Name + "料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 失败:" + msg);
}
//MoveInfo.NextMoveStep(LineMoveStep.FI_53_BatchAxisToP1);
......@@ -827,7 +829,7 @@ namespace OnlineStore.DeviceLibrary
ReadShelfId();
if (CurrShelfId.EndsWith("00"))
{
{
MoveInfo.NextMoveStep(LineMoveStep.FI_53_BatchAxisToP1);
InLog("ResetRFID 后,料架号【" + CurrShelfId + "】无效,送出料架," + MoveInfo.SLog + ":提升伺服到P1点,定位气缸下降");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
......@@ -983,7 +985,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否检测到
if (IOValue(IO_Type.SL_AxisLocationCheck).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_18_GetReelSize);
MoveInfo.NextMoveStep(LineMoveStep.FI_18_GetReelSize);
InLog("料盘移栽" + MoveInfo.SLog + ":SL_AxisLocationCheck=HIGH, 从服务器获取尺寸 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
string code = CodeManager.ProcessCode(LastCodeList);
......@@ -1337,12 +1339,12 @@ namespace OnlineStore.DeviceLibrary
{
CylinderMove(null, IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give);
}
}
private void FI_25_WaitTray()
{
if ((getPosTask==null|| getPosTask.IsCompleted) && LastPosParam != null)
if ((getPosTask == null || getPosTask.IsCompleted) && LastPosParam != null)
{
MoveInfo.NextMoveStep(LineMoveStep.FI_25_WaitTray);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
......@@ -1373,7 +1375,7 @@ namespace OnlineStore.DeviceLibrary
FI_24_GetPosID();
}
private Task getPosTask = null;
private InOutParam LastPosParam = null;
private InOutParam LastPosParam = null;
private string getPosIdMsg = "";
private void FI_24_GetPosID()
{
......@@ -1381,15 +1383,55 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
LastPosParam = null;
string code = CodeManager.ProcessCode(LastCodeList);
if (!string.IsNullOrEmpty(lastcode) && !string.IsNullOrEmpty(code))
{
if (lastcode.Equals(code))
{
InLog($"【{code}】与上一盘的条码相同【{lastcode}】,认为空抓,取消该入库任务,直接NG不需要获取库位号");
getPosTask = null;
LastPosParam = new InOutParam(0, lastcode, "", LastHeight, LastWidth, true);
LastPosParam.NgMsg = $"入库:与上一盘的条码相同,认为空抓";
LastPosParam.InStoreNg = true;
LastPosParam.rfid = CurrShelfId;
LastPosParam.WareCode = lastcode;
LastPosParam.ManualJudgeNG = true;
//如果没有宽度,默认最宽料盘
if (LastWidth <= 0)
{
LastWidth = 15;
LastHeight = 56;
LastPosParam.PlateH = LastHeight;
LastPosParam.PlateW = LastWidth;
InLog($"【{code}】宽度为0,默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
}
else
{
if (LastWidth.Equals(7))
{
LastHeight = 16;
}
else
{
LastHeight = 56;
}
LastPosParam.PlateH = LastHeight;
InLog($"【{code}】宽度为{LastWidth},默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
}
SServerManager.cancelPutInTask(Name, LastPosParam.WareCode, false);
return;
}
}
lastcode = code;
//如果尺寸或者高度为0,不需要获取库位号
if (LastWidth <= 0 || LastHeight <= 0)
{
InLog($"【" + code + "】清空LastPosResult,料盘尺寸 {LastWidth}X{LastHeight} 尺寸不完整,直接NG不需要获取库位号");
getPosTask = null;
LastPosParam = new InOutParam(0,lastcode,"",LastHeight,LastWidth,true) ;
LastPosParam.NgMsg =$"入库:{LastWidth}X{LastHeight} 尺寸不完整";
LastPosParam = new InOutParam(0, lastcode, "", LastHeight, LastWidth, true);
LastPosParam.NgMsg = $"入库:{LastWidth}X{LastHeight} 尺寸不完整";
LastPosParam.InStoreNg = true;
LastPosParam.rfid = CurrShelfId;
LastPosParam.WareCode = lastcode;
......@@ -1400,28 +1442,28 @@ namespace OnlineStore.DeviceLibrary
LastWidth = 15;
LastHeight = 56;
LastPosParam.PlateH = LastHeight;
LastPosParam.PlateW = LastWidth;
InLog($"【{ code }】宽度为0,默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
LastPosParam.PlateW = LastWidth;
InLog($"【{code}】宽度为0,默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
}
else
{
if (LastWidth.Equals(7))
{
LastHeight = 16;
LastHeight = 16;
}
else
{
LastHeight = 56;
}
LastPosParam.PlateH = LastHeight;
InLog($"【{ code }】宽度为{LastWidth},默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
InLog($"【{code}】宽度为{LastWidth},默认最大料盘尺寸 {LastPosParam.PlateW}X{LastPosParam.PlateH} ,标记 ManualJudgeNG=true");
}
return;
}
InLog("清空LastPosResult,从服务器获取入库库位");
getPosTask = Task.Factory.StartNew(delegate
{
//更新托盘条码信息
......@@ -1434,16 +1476,16 @@ namespace OnlineStore.DeviceLibrary
//从服务器获取库位号
GetPosResult result = SServerManager.GetPosId(Name, LastCodeList, LastHeight, LastWidth, CurrShelfId, DeviceID);
if (result.IsTimeOut)
{
{
if (count < 5)
{
ms = 2000;
}
Thread.Sleep(ms);
}
Thread.Sleep(ms);
LogUtil.error(Name + "【" + code + "】第[" + count + "]次 FI_23_GetPosID 超时,等待" + ms + "后重新获取");
}
else if (result.Result.Equals(99) || result.Result.Equals(100))
{
{
if (count < 5)
{
ms = 3000;
......@@ -1464,14 +1506,14 @@ namespace OnlineStore.DeviceLibrary
break;
}
count++;
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + "【" + code + "】获取库位号报错:" + ex.ToString());
}
});
});
}
private void FI_31_CylinderUp()
......@@ -1485,8 +1527,8 @@ namespace OnlineStore.DeviceLibrary
{
upLog = " ,7X8盘,升降轴到待机位P1 ";
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移机构上升 " + upLog);
}
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移机构上升 " + upLog);
}
private void TrayPreMove()
{
......@@ -1511,7 +1553,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private void FI_BatchAxisDown()
{
{
// MoveInfo.NextMoveStep(LineMoveStep.FI_21_BatchAxisDown);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
int maxtPosition = Config.BatchAxisP3 - Config.Height_ChangeValue * 30; //在上料位置基础上下降30mm
......@@ -1526,7 +1568,7 @@ namespace OnlineStore.DeviceLibrary
{
targetPosition = maxtPosition;
}
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);
}
......@@ -1547,7 +1589,7 @@ namespace OnlineStore.DeviceLibrary
YuScanTask = Task.Factory.StartNew(delegate
{
Thread.Sleep(100);
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码");
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim() + "预扫码");
bool isCanUse = true;
//判断是否可用
foreach (string nC in NextCodeList)
......@@ -1561,7 +1603,7 @@ namespace OnlineStore.DeviceLibrary
break;
}
}
}
}
if (!isCanUse)
{
NextCodeList = new List<string>();
......@@ -1674,7 +1716,7 @@ namespace OnlineStore.DeviceLibrary
}
private int LoopCount = 0;
private void CheckHasTray()
{
{
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (alarmType.Equals(LineAlarmType.IoSingleTimeOut) && MoveInfo.IsInWait.Equals(false) && SecondMoveInfo.IsInWait.Equals(false))
{
......@@ -1689,7 +1731,7 @@ namespace OnlineStore.DeviceLibrary
else
{
if (MoveInfo.ShelfNoTray.Equals(false))
{
{
//判断当前位置是否在指定的位置
int currP = BatchAxis.GetAclPosition();
int chaz = Math.Abs(currP - Config.BatchAxisP3);
......@@ -1706,9 +1748,9 @@ namespace OnlineStore.DeviceLibrary
}
if (LoopCount < 10)
{
{
MoveInfo.NextMoveStep(LineMoveStep.FI_10_AxisUpMove);
InLog("料架入库" + MoveInfo.SLog + ":CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘,LoopCount="+LoopCount);
InLog("料架入库" + MoveInfo.SLog + ":CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘,LoopCount=" + LoopCount);
MoveInfo.ShelfNoTray = false;
BatchAxisToP3(false);
}
......@@ -1772,7 +1814,7 @@ namespace OnlineStore.DeviceLibrary
private List<string> LastCodeList = new List<string>();
private List<string> NextCodeList = new List<string>();
private int TrayLCylinderMoveCount=0;//升降盘气缸已运动次数
private int TrayLCylinderMoveCount = 0;//升降盘气缸已运动次数
private int GetHeight()
{
LastHeight = 0;
......@@ -1804,7 +1846,7 @@ namespace OnlineStore.DeviceLibrary
LastHeight = 8;
}
else
{
{
List<int> heightList = LineManager.GetTrayList();
heightList = (from m in heightList orderby m descending select m).ToList<int>();
float minCha = height;
......@@ -1821,11 +1863,11 @@ namespace OnlineStore.DeviceLibrary
}
if (LastHeight <= 8) { LastHeight = 8; }
string code = CodeManager.ProcessCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后"+buchongStr+"[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【"+code+"】";
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】";
LogUtil.info(msg);
return LastHeight;
}
public int GetWidth()
public int GetWidth()
{
int width = 15;
if (IOValue(IO_Type.SL_TrayCheck4).Equals(IO_VALUE.HIGH))
......@@ -1843,7 +1885,8 @@ namespace OnlineStore.DeviceLibrary
else if (IOValue(IO_Type.SL_TrayCheck1).Equals(IO_VALUE.HIGH))
{
width = 7;
}else
}
else
{
LogUtil.error(Name + "GetWidth :1234都未检测到,默认为7寸盘");
width = 7;
......@@ -1957,8 +2000,8 @@ namespace OnlineStore.DeviceLibrary
if (trayCanUse && runStatus.Equals(LineRunStatus.Busy) && MoveInfo.MoveType.Equals(LineMoveType.InStore))
{
//入料执行中, 且需要空托盘
if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_25_WaitTray) ||
MoveInfo.MoveStep.Equals(LineMoveStep.FI_22_BatchAxisDown)||
if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_25_WaitTray) ||
MoveInfo.MoveStep.Equals(LineMoveStep.FI_22_BatchAxisDown) ||
MoveInfo.MoveStep.Equals(LineMoveStep.FI_21_CylinderGive))
//if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_25_WaitTray) && MoveInfo.IsInWait.Equals(false))
{
......@@ -1998,7 +2041,7 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
}
internal bool WaitEmptyTray()
{
try
......@@ -2044,7 +2087,7 @@ namespace OnlineStore.DeviceLibrary
List<int> moveIds = new List<int>() { };
if (DeviceID.Equals(102))
{
moveIds = new List<int>() { 7, 8, 19, 20 };
moveIds = new List<int>() { 7, 8, 19, 20 };
//MoveEquip moveEquip7 = LineManager.Line.GetMoveByDId(7);
//if (moveEquip7.IsWaitEmptyTray())
//{
......@@ -2080,7 +2123,7 @@ namespace OnlineStore.DeviceLibrary
return true;
}
}
}
}
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!