Commit 0d1fe10f LN

出库料放到托盘上时先调用GetLocation判断是否可放

1 个父辈 45eb003b
...@@ -315,11 +315,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -315,11 +315,11 @@ namespace OnlineStore.DeviceLibrary
//前进后退气缸后退以后才可以出库 //前进后退气缸后退以后才可以出库
else if (move.runStatus.Equals(LineRunStatus.Busy) && move.MoveInfo.MoveType.Equals(LineMoveType.OutStore)) else if (move.runStatus.Equals(LineRunStatus.Busy) && move.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{ {
if (move.MoveInfo.MoveStep >= (LineMoveStep.MO_60_CylinderDown)) if (move.MoveInfo.MoveStep >= (LineMoveStep.MO_64_CylinderDown))
{ {
return true; return true;
} }
else if (move.MoveInfo.IsStep(LineMoveStep.MO_59_CylinderAfter) && move.MoveInfo.IsInWait.Equals(false) else if (move.MoveInfo.IsStep(LineMoveStep.MO_63_CylinderAfter) && move.MoveInfo.IsInWait.Equals(false)
&& move.CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After)) && move.CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After))
{ {
return true; return true;
......
...@@ -26,9 +26,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,9 +26,9 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
bool moveOk = (IsBigStore() && MoveInfo.MoveStep >= LineMoveStep.MO_58_WaitTray) || MoveInfo.MoveStep >= LineMoveStep.MO_59_CylinderAfter; bool moveOk = (IsBigStore() && MoveInfo.MoveStep >= LineMoveStep.MO_62_WaitTray) || MoveInfo.MoveStep >= LineMoveStep.MO_63_CylinderAfter;
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && moveOk if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && moveOk
&& (!MoveInfo.IsStep(LineMoveStep.MO_62_CylinderUp))) && (!MoveInfo.IsStep(LineMoveStep.MO_66_CylinderUp)))
{ {
if (isFull.Equals(false)) if (isFull.Equals(false))
{ {
...@@ -45,9 +45,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,9 +45,9 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
bool moveOk = (IsBigStore() && MoveInfo.MoveStep >= LineMoveStep.MO_58_WaitTray) || MoveInfo.MoveStep >= LineMoveStep.MO_59_CylinderAfter; bool moveOk = (IsBigStore() && MoveInfo.MoveStep >= LineMoveStep.MO_62_WaitTray) || MoveInfo.MoveStep >= LineMoveStep.MO_63_CylinderAfter;
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && moveOk if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && moveOk
&& (!MoveInfo.IsStep(LineMoveStep.MO_62_CylinderUp))) && (!MoveInfo.IsStep(LineMoveStep.MO_66_CylinderUp)))
{ {
return true; return true;
} }
...@@ -61,51 +61,57 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,51 +61,57 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
try
{
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);
InOutParam param = tray.InoutPar;
if (tray.InOrOutStore.Equals(2))
{
SecondMoveInfo.MoveParam = param.Clone();
return true;
//string outMsg = "";
//BoxInfo box = LineServer.GetBoxInfo(DeviceID);
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum); //if (box != null && LineServer.BoxConnected(DeviceID))
InOutParam param = tray.InoutPar; //{
if (tray.InOrOutStore.Equals(2)) // OutWareInfo wareInfo = SServerManager.GetLocation(tray.InoutPar.WareCode, box.GetRfids(), out outMsg);
{ // //需要取放料,且料架已准备好
SecondMoveInfo.MoveParam = param.Clone(); // if (outMsg.Equals(""))
return true; // {
//紧急料,分盘料,直接返回 // bool result = box.HasRightRFID( wareInfo, out string targetP);
//if (param.cutReel || param.urgentReel) // if (result)
//{ // {
//return true; // LogUtil.info($"{tray.ToStr()} getLocation 目标料架:" + targetP);
//} // SecondMoveInfo.MoveParam = param.Clone();
//bool isNg = false; // return true;
////工单料获取尺寸 // }
//int robotIndex = 0; // else
//string code = SecondMoveInfo.MoveParam.WareCode; // {
//string result = SServerManager.GetTraySize(Name, robotIndex, code, out LastWidth, out isNg); // LogUtil.error($"{tray.ToStr()} getLocation 未找到可用料架: " + wareInfo.ToStr());
//LogUtil.info(Name + "[" + currTrayNum + "] [" + code + "] 获取尺寸【" + LastWidth + "】【" + result + "】"); // }
//if (LastWidth > 0) // }
//{ // else if (!outMsg.Equals(""))
// SecondMoveInfo.MoveParam = param.Clone(); // {
// return true; // LogUtil.error($"{tray.ToStr()} getLocation " + outMsg);
//} // return false;
//else if (isNg) // }
//{ // SecondMoveInfo.MoveParam = param.Clone();
// TrayManager.UpdateInStoreNG(currTrayNum, true, result); // return true;
// LogInfo("更新工单出库料[" + currTrayNum + "] [" + code + "]为NG料:" + result); //}
// tray = TrayManager.GetTrayInfo(currTrayNum); }
// param = tray.InoutPar; else if (param.IsNG)
// SecondMoveInfo.MoveParam = param.Clone(); {
// return true; SecondMoveInfo.MoveParam = param.Clone();
//} return true;
//else }
//{
// LogUtil.info(Name + "[" + currTrayNum + "] [" + tray.ToStr() + "] 获取尺寸失败,托盘继续流转");
//}
} }
else if (param.IsNG) catch (Exception ex)
{ {
SecondMoveInfo.MoveParam = param.Clone(); LogUtil.error(Name + "CheckIsNeedMove 出错:" + ex.ToString());
return true;
} }
return false; return false;
} }
private bool CheckIsNeedInStore() private bool CheckIsNeedInStore()
{ {
if (currTrayNum <= 0 || if (currTrayNum <= 0 ||
...@@ -281,12 +287,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -281,12 +287,13 @@ namespace OnlineStore.DeviceLibrary
OutLog("出库 " + MoveInfo.MoveStep + ": 等待500毫秒再下降"); OutLog("出库 " + MoveInfo.MoveStep + ": 等待500毫秒再下降");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_52_WaitTime)) { else if (MoveInfo.IsStep(LineMoveStep.MO_52_WaitTime))
{
//重置夹料次数=0 //重置夹料次数=0
ClampCount = 0; ClampCount = 0;
if (CylinderIsOk(IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before)) if (CylinderIsOk(IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_52_CylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_53_CylinderDown);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 "); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 ");
UpdownDownP3Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW); UpdownDownP3Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down); // CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
...@@ -299,18 +306,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,18 +306,18 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_52_CylinderDown)) else if (MoveInfo.IsStep(LineMoveStep.MO_53_CylinderDown))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_53_DownWait); MoveInfo.NextMoveStep(LineMoveStep.MO_54_DownWait);
OutLog("出库 " + MoveInfo.SLog + ": 等待200ms后夹紧"); OutLog("出库 " + MoveInfo.SLog + ": 等待200ms后夹紧");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_53_DownWait)) else if (MoveInfo.IsStep(LineMoveStep.MO_54_DownWait))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_54_CylinderOpen); MoveInfo.NextMoveStep(LineMoveStep.MO_55_CylinderOpen);
ClampEmptyMove = false; ClampEmptyMove = false;
ClampJwa.Push(MoveInfo,true,MoveInfo.MoveParam.WareCode); ClampJwa.Push(MoveInfo, true, MoveInfo.MoveParam.WareCode);
if (ClampCount <= 0) if (ClampCount <= 0)
{ {
OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【MOVING】【" + DeviceID + "】"); OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【MOVING】【" + DeviceID + "】");
...@@ -323,20 +330,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -323,20 +330,20 @@ namespace OnlineStore.DeviceLibrary
OutLog("出库 " + MoveInfo.SLog + ": 再次夹料"); OutLog("出库 " + MoveInfo.SLog + ": 再次夹料");
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_54_CylinderOpen)) else if (MoveInfo.IsStep(LineMoveStep.MO_55_CylinderOpen))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_55_CylinderUp); MoveInfo.NextMoveStep(LineMoveStep.MO_56_CylinderUp);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升"); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升");
UpdownUpMove(); UpdownUpMove();
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_56_ResetClamp)) else if (MoveInfo.IsStep(LineMoveStep.MO_57_ResetClamp))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_52_CylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_53_CylinderDown);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 "); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 ");
UpdownDownP3Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW); UpdownDownP3Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_55_CylinderUp)) else if (MoveInfo.IsStep(LineMoveStep.MO_56_CylinderUp))
{ {
if (UpdownIsUp()) if (UpdownIsUp())
{ {
...@@ -345,12 +352,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -345,12 +352,13 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IsBigStore()) if (IsBigStore())
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_58_WaitTray); //MoveInfo.NextMoveStep(LineMoveStep.MO_62_WaitTray);
OutLog("出库 " + MoveInfo.SLog + ": 等待托盘到达"); //OutLog("出库 " + MoveInfo.SLog + ": 等待托盘到达");
MO_61_WaitCanPut();
} }
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_59_CylinderAfter); MoveInfo.NextMoveStep(LineMoveStep.MO_63_CylinderAfter);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退"); OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
...@@ -360,15 +368,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -360,15 +368,15 @@ namespace OnlineStore.DeviceLibrary
{ {
if (ClampCount <= 0) if (ClampCount <= 0)
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_56_ResetClamp); MoveInfo.NextMoveStep(LineMoveStep.MO_57_ResetClamp);
ClampCount = 1; ClampCount = 1;
OutLog("出库 " + MoveInfo.SLog + ": 第一次未抓到料,重新抓一次,夹爪先放松", 1); OutLog("出库 " + MoveInfo.SLog + ": 第一次未抓到料,重新抓一次,夹爪先放松", 1);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa.Relax(MoveInfo,MoveInfo.MoveParam.WareCode); ClampJwa.Relax(MoveInfo, MoveInfo.MoveParam.WareCode);
} }
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_57_WaitHasReel); MoveInfo.NextMoveStep(LineMoveStep.MO_58_WaitHasReel);
OutLog("出库 " + MoveInfo.SLog + ": 等待夹爪有料", 1); OutLog("出库 " + MoveInfo.SLog + ": 等待夹爪有料", 1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitClampHasReel()); MoveInfo.WaitList.Add(WaitResultInfo.WaitClampHasReel());
MoveInfo.TimeOutSeconds = 5; MoveInfo.TimeOutSeconds = 5;
...@@ -377,31 +385,44 @@ namespace OnlineStore.DeviceLibrary ...@@ -377,31 +385,44 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_55_CylinderUp); MoveInfo.NextMoveStep(LineMoveStep.MO_56_CylinderUp);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升"); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升");
UpdownUpMove(); UpdownUpMove();
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_57_WaitHasReel)) else if (MoveInfo.IsStep(LineMoveStep.MO_58_WaitHasReel))
{ {
if (IsBigStore()) if (IsBigStore())
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_58_WaitTray); //MoveInfo.NextMoveStep(LineMoveStep.MO_62_WaitTray);
OutLog("出库 " + MoveInfo.SLog + ": 等待托盘到达"); //OutLog("出库 " + MoveInfo.SLog + ": 等待托盘到达");
MO_61_WaitCanPut();
} }
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_59_CylinderAfter); MoveInfo.NextMoveStep(LineMoveStep.MO_63_CylinderAfter);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退"); OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_58_WaitTray)) else if (MoveInfo.IsStep(LineMoveStep.MO_61_WaitCanPut))
{
if (checkCanPutTask == null || checkCanPutTask.IsCompleted)
{
MoveInfo.NextMoveStep(LineMoveStep.MO_62_WaitTray);
OutLog("出库 " + MoveInfo.SLog + ": 等待托盘到达");
}
else if (MoveInfo.IsTimeOut(30))
{
MoveTimeOut(MoveInfo, "等待料盘可以放入托盘超时");
}
}
else if (MoveInfo.IsStep(LineMoveStep.MO_62_WaitTray))
{ {
if (TrayIsOk()) if (TrayIsOk())
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_59_CylinderAfter); MoveInfo.NextMoveStep(LineMoveStep.MO_63_CylinderAfter);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退"); OutLog("出库 " + MoveInfo.SLog + ": 前后气缸后退");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
...@@ -410,7 +431,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -410,7 +431,7 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 移载装置,放物品到流水线操作 #region 移载装置,放物品到流水线操作
else if (MoveInfo.IsStep(LineMoveStep.MO_59_CylinderAfter)) else if (MoveInfo.IsStep(LineMoveStep.MO_63_CylinderAfter))
{ {
if (CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After)) if (CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After))
{ {
...@@ -418,7 +439,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -418,7 +439,7 @@ namespace OnlineStore.DeviceLibrary
{ {
int trayNum = SecondMoveInfo.MoveParam.TrayNumber; int trayNum = SecondMoveInfo.MoveParam.TrayNumber;
//去掉直接丢盘处理 //去掉直接丢盘处理
MoveInfo.NextMoveStep(LineMoveStep.MO_60_CylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_64_CylinderDown);
OutLog("出库 " + MoveInfo.SLog + ": 拦截到空托盘【" + trayNum + "】, 上下气缸下降 ,顶升气缸上升"); OutLog("出库 " + MoveInfo.SLog + ": 拦截到空托盘【" + trayNum + "】, 上下气缸下降 ,顶升气缸上升");
if (MoveInfo.MoveParam != null) if (MoveInfo.MoveParam != null)
{ {
...@@ -435,7 +456,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -435,7 +456,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_60_CylinderDown)) else if (MoveInfo.IsStep(LineMoveStep.MO_64_CylinderDown))
{ {
OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸放松,更新托盘【" + MoveInfo.MoveParam.TrayNumber + "】,有料盘,OutStore,【" + MoveInfo.MoveParam.ToStr() + "】"); OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸放松,更新托盘【" + MoveInfo.MoveParam.TrayNumber + "】,有料盘,OutStore,【" + MoveInfo.MoveParam.ToStr() + "】");
//更新料盘位置 //更新料盘位置
...@@ -445,20 +466,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -445,20 +466,20 @@ namespace OnlineStore.DeviceLibrary
TrayInfo tray = TrayManager.GetTrayInfo(trayNum); TrayInfo tray = TrayManager.GetTrayInfo(trayNum);
LogInfo("出库 " + MoveInfo.SLog + ": ,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INLINE】更新托盘【" + trayNum + "】 " + tray.ToStr() + ""); LogInfo("出库 " + MoveInfo.SLog + ": ,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INLINE】更新托盘【" + trayNum + "】 " + tray.ToStr() + "");
//出库全部完成 //出库全部完成
MoveInfo.NextMoveStep(LineMoveStep.MO_61_CylinderRelax); MoveInfo.NextMoveStep(LineMoveStep.MO_65_CylinderRelax);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa.Relax(MoveInfo, MoveInfo.MoveParam.WareCode); ClampJwa.Relax(MoveInfo, MoveInfo.MoveParam.WareCode);
//EDataManager.UpdateParam(DeviceID); //EDataManager.UpdateParam(DeviceID);
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_61_CylinderRelax)) else if (MoveInfo.IsStep(LineMoveStep.MO_65_CylinderRelax))
{ {
this.MoveInfo.NextMoveStep(LineMoveStep.MO_62_CylinderUp); this.MoveInfo.NextMoveStep(LineMoveStep.MO_66_CylinderUp);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升,同时顶升气缸先下降"); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升,同时顶升气缸先下降");
UpdownUpMove(); UpdownUpMove();
CylinderMove(null, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down); CylinderMove(null, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_62_CylinderUp)) else if (MoveInfo.IsStep(LineMoveStep.MO_66_CylinderUp))
{ {
// 减去需要的盘数 // 减去需要的盘数
// TrayManager.DelNeedEmptyTrayNum(); // TrayManager.DelNeedEmptyTrayNum();
...@@ -473,6 +494,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -473,6 +494,38 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
} }
private Task checkCanPutTask = null;
private void MO_61_WaitCanPut()
{
checkCanPutTask = null;
if (MoveInfo.MoveParam.urgentReel)
{
MoveInfo.NextMoveStep(LineMoveStep.MO_62_WaitTray);
OutLog("出库 " + MoveInfo.SLog + ": 紧急料,直接等待托盘到达");
return;
}
MoveInfo.NextMoveStep(LineMoveStep.MO_61_WaitCanPut);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
checkCanPutTask = Task.Factory.StartNew(delegate
{
int getlocationCount = 0;
while (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
getlocationCount++;
if (SServerManager.GetLocation(MoveInfo.MoveParam.WareCode))
{
MoveInfo.NextMoveStep(LineMoveStep.MO_62_WaitTray);
OutLog("出库 " + MoveInfo.SLog + ": GetLocation OK,等待托盘到达");
break;
}
//OutLog("出库 " + MoveInfo.SLog + ": 等待料盘可以放到托盘上,等待3秒后重新判断");
Thread.Sleep(3000);
}
});
}
private bool TrayIsOk() private bool TrayIsOk()
{ {
if (SecondMoveInfo.IsStep(LineMoveStep.MO_11_CodeRember) && !SecondMoveInfo.IsInWait) if (SecondMoveInfo.IsStep(LineMoveStep.MO_11_CodeRember) && !SecondMoveInfo.IsInWait)
...@@ -994,6 +1047,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -994,6 +1047,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SecondMoveInfo.IsStep(LineMoveStep.MIO_04_Wait)) else if (SecondMoveInfo.IsStep(LineMoveStep.MIO_04_Wait))
{ {
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
try try
{ {
//判断是否需要顶升 //判断是否需要顶升
...@@ -1073,7 +1127,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1073,7 +1127,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
else if (SecondMoveInfo.IsStep(LineMoveStep.MIO_06_TopUp)) else if (SecondMoveInfo.IsStep(LineMoveStep.MIO_06_TopUp))
{ {
CheckLog("托盘阻挡*************** 托盘号【" + currTrayNum + "】"); CheckLog("托盘阻挡*************** 托盘号【" + currTrayNum + "】");
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
//托盘号正确 //托盘号正确
......
...@@ -4,7 +4,7 @@ using System.Collections.Generic; ...@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -63,65 +63,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -63,65 +63,7 @@ namespace OnlineStore.DeviceLibrary
} }
return codeStr; return codeStr;
} }
//public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize, out bool isNg)
//{
// outSize = 0;
// isNg = false;
// string msg = "";
// try
// {
// if (String.IsNullOrEmpty(codeStr))
// {
// return msg = deviceName + "未扫到条码";
// }
// string logName = $"GetTraySize [{robotIndex }] [{codeStr}] :";
// if (string.IsNullOrEmpty(serverAddr))
// {
// LogUtil.error(deviceName + $"{logName}未找到服务器地址");
// return msg;
// }
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("robotIndex", robotIndex.ToString());// 参数: robotIndex = 机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
// paramMap.Add("barcode", codeStr);// barcode = 扫到的条码
// string server = GetAddr(Addr_getSize, paramMap);
// DateTime startTime = DateTime.Now;
// bool isTimeOut = false;
// string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 5000, out isTimeOut);
// LogUtil.info("GetTraySize " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// if (isTimeOut)
// {
// return msg = "获取尺寸超时";
// }
// //返回: { "code": 0, "msg":"ok", data: 7}
// ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
// if (serverResult == null)
// {
// return msg = "没有收到服务器反馈";
// }
// else if (serverResult.code.Equals(0).Equals(false))
// {
// // code: 0为正常,其他为异常,
// //code不是0,直接NG
// isNg = true;
// return msg = $" [{ serverResult.code}]:" + serverResult.msg;
// }
// if (!serverResult.data.Equals(""))
// {
// // data:料盘直径,= 7时升起气缸
// outSize = Convert.ToInt32(serverResult.data);
// LogUtil.info(deviceName + $"{ logName} 获得尺寸:" + outSize);
// }
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " ", ex);
// }
// return "";
//}
public static string UpdateTrayLoc(string deviceName, string barcode, string status, string locInfo) public static string UpdateTrayLoc(string deviceName, string barcode, string status, string locInfo)
{ {
...@@ -563,6 +505,52 @@ namespace OnlineStore.DeviceLibrary ...@@ -563,6 +505,52 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private static string Addr_getLocation = "/rest/api/qisda/device/getLocation";
public static bool GetLocation(string barcode )
{
//加参数: onMoving=true 如果返回的code是99,则停留在横移上,下个可放托盘继续判断
//getLocation这个接口传入barcode和rfid列表会分配料架
try
{
string currRFID = "";
BoxInfo box = LineServer.GetBoxInfo(7);
if (box != null && LineServer.BoxConnected(7))
{
currRFID = box.GetRfids();
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
paramMap.Add("rfid", currRFID);
paramMap.Add("onMoving", true.ToString());
string url = GetAddr(Addr_getLocation, paramMap);
string logName = "http :URL:" + url;
DateTime startTime = DateTime.Now;
string json = HttpHelper.Post(url, "", 10000);
LogUtil.info(logName + ": Response:" + json + ",耗时【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(json);
if (data == null)
{
return false;
}
else if (data.code.Equals(99))
{
return false;
}
else
{
return true;
}
}
catch (Exception ex)
{
LogUtil.error("http error : " + ex.ToString());
}
return false ;
}
//14.异常看板 //14.异常看板
// > 地址: // > 地址:
...@@ -618,7 +606,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -618,7 +606,7 @@ namespace OnlineStore.DeviceLibrary
} }
return msg; return msg;
} }
} }
public class AlarmMsg public class AlarmMsg
{ {
...@@ -650,7 +638,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -650,7 +638,7 @@ namespace OnlineStore.DeviceLibrary
public InOutParam Param = null; public InOutParam Param = null;
} }
public class RfidData public class RfidData
{ { //Response:{"code":0,"msg":"ok","data":{"w":"7","realRfid":"","h":"8","rfid":"1-2F","usedRfidList":"F102","rfidLoc":"11","barcode":"985022*35030377*0822*3000*08220350"}}
//{"code":0,"msg":"ok","data":"7"} //{"code":0,"msg":"ok","data":"7"}
public int code { get; set; } public int code { get; set; }
......
...@@ -323,50 +323,55 @@ namespace OnlineStore.DeviceLibrary ...@@ -323,50 +323,55 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 移栽装置出库处理。上下气缸1下降 /// 移栽装置出库处理。上下气缸1下降
/// </summary> /// </summary>
MO_52_CylinderDown, MO_53_CylinderDown,
/// <summary> /// <summary>
/// 移栽装置出库处理。上下气缸1下降后,等待0.3秒再夹紧,防止没有下降到位就夹紧操作 /// 移栽装置出库处理。上下气缸1下降后,等待0.3秒再夹紧,防止没有下降到位就夹紧操作
/// </summary> /// </summary>
MO_53_DownWait, MO_54_DownWait,
/// <summary> /// <summary>
/// 移栽装置出库处理。 夹料气缸1夹紧 /// 移栽装置出库处理。 夹料气缸1夹紧
/// </summary> /// </summary>
MO_54_CylinderOpen, MO_55_CylinderOpen,
/// <summary> /// <summary>
/// 移栽装置出库处理。 上下气缸1上升 /// 移栽装置出库处理。 上下气缸1上升
/// </summary> /// </summary>
MO_55_CylinderUp, MO_56_CylinderUp,
/// <summary> /// <summary>
/// 移栽出库:开始重抓一次 /// 移栽出库:开始重抓一次
/// </summary> /// </summary>
MO_56_ResetClamp, MO_57_ResetClamp,
/// <summary> /// <summary>
/// 移栽出库。 等待夹爪有料 /// 移栽出库。 等待夹爪有料
/// </summary> /// </summary>
MO_57_WaitHasReel, MO_58_WaitHasReel,
/// <summary>
/// 移栽出库:判断料盘能否放到托盘
/// </summary>
MO_61_WaitCanPut,
/// <summary> /// <summary>
/// 移栽出库:开始等待托盘 /// 移栽出库:开始等待托盘
/// </summary> /// </summary>
MO_58_WaitTray, MO_62_WaitTray,
/// <summary> /// <summary>
/// 移栽装置出库处理。 前后气缸1后退 /// 移栽装置出库处理。 前后气缸1后退
/// </summary> /// </summary>
MO_59_CylinderAfter, MO_63_CylinderAfter,
/// <summary> /// <summary>
/// 移载(流水线)装置出库处理,上下气缸1下降 /// 移载(流水线)装置出库处理,上下气缸1下降
/// </summary> /// </summary>
MO_60_CylinderDown, MO_64_CylinderDown,
/// <summary> /// <summary>
/// 移载(流水线)装置出库处理,夹料气缸1放松 /// 移载(流水线)装置出库处理,夹料气缸1放松
/// </summary> /// </summary>
MO_61_CylinderRelax, MO_65_CylinderRelax,
/// <summary> /// <summary>
/// 移载(流水线)装置出库处理,上下气缸1上升 /// 移载(流水线)装置出库处理,上下气缸1上升
/// </summary> /// </summary>
MO_62_CylinderUp, MO_66_CylinderUp,
#region 入料模块,紧急出料移栽处理 #region 入料模块,紧急出料移栽处理
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -85,5 +86,110 @@ namespace OnlineStore.DeviceLibrary ...@@ -85,5 +86,110 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public string rfids = ""; public string rfids = "";
private char rfidSpilt = ';';
public string GetRfids()
{
string str = "";
string[] array = rfids.Split(rfidSpilt);
if (array != null && array.Length > 0)
{
foreach (string obj in array)
{
string realRfid = obj;
string xuniRfid = "";
if (obj.Contains(","))
{
string[] rarray = obj.Split(',');
if (rarray.Length == 2)
{
realRfid = rarray[0];
xuniRfid = rarray[1];
}
}
str += realRfid + rfidSpilt;
}
}
str = str.Substring(0, str.Length - 1);
return str;
}
//internal bool HasRightRFID(OutWareInfo wareInfo, out string TargetRfid)
//{
// TargetRfid = "";
// string[] rfidArray = rfids.Split(rfidSpilt);
// if (rfidArray == null || rfidArray.Length <= 0)
// {
// return false;
// }
// foreach (string obj in rfidArray)
// {
// string realRfid = obj;
// string xuniRfid = "";
// if (obj.Contains(","))
// {
// string[] rarray = obj.Split(',');
// if (rarray.Length == 2)
// {
// realRfid = rarray[0];
// xuniRfid = rarray[1];
// }
// }
// if (realRfid.Equals(wareInfo.realRFID))
// {
// TargetRfid = obj;
// return true;
// }
// else if (String.IsNullOrEmpty(wareInfo.realRFID))
// {
// if ((!xuniRfid.Equals("")) && xuniRfid.Equals(wareInfo.rfid))
// {
// TargetRfid = obj;
// return true;
// }
// if (!String.IsNullOrEmpty(wareInfo.usedRfidList))
// {
// string[] array = wareInfo.usedRfidList.Split(',');
// //若料架已使用过,直接返回false
// if (array.Contains(realRfid))
// {
// return false;
// }
// }
// if (xuniRfid.Equals(""))
// {
// TargetRfid = obj;
// return true;
// }
// }
// }
// return false;
//}
//public Dictionary<string, string> GetRfidMap()
//{
// Dictionary<string, string> map = new Dictionary<string, string>();
// string[] array = rfids.Split(rfidSpilt);
// if (array != null && array.Length > 0)
// {
// foreach (string obj in array)
// {
// string realRfid = obj;
// string xuniRfid = "";
// if (obj.Contains("-"))
// {
// string[] rarray = obj.Split('-');
// if (rarray.Length == 2)
// {
// realRfid = rarray[0];
// xuniRfid = rarray[1];
// }
// }
// map.Add(realRfid, xuniRfid);
// }
// }
// return map;
//}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!