Commit fa2fc749 LN

门口取料逻辑优化

1 个父辈 6a0c394d
...@@ -783,67 +783,79 @@ namespace OnlineStore.DeviceLibrary ...@@ -783,67 +783,79 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public TrayInfo CurrTray = null; public TrayInfo CurrTray = null;
private object ProLock = "";
private DateTime LastGTime = DateTime.Now; private DateTime LastGTime = DateTime.Now;
private void InShelfProcess() private void InShelfProcess()
{ {
//2秒钟获取一次 //2秒钟获取一次
TimeSpan span = DateTime.Now - LastGTime; //TimeSpan span = DateTime.Now - LastGTime;
if (span.TotalSeconds < 2) //if (span.TotalSeconds < 2)
//{
// return;
//}
if (Monitor.TryEnter(ProLock, 1))
{ {
return; try
}
try
{
LastGTime = DateTime.Now;
if ((!CanStarInOut()))
{
return;
}
if ((LineConnect.DoorPosInfo == null))
{
return;
}
if (LineConnect.DoorPosInfo.IsNg || LineConnect.DoorPosInfo.barcode.Equals(""))
{
LineConnect.DoorPosInfo.IsNg = true;
StartMove();
return;
}
string shelfRfid = ReadyShelf();
if (String.IsNullOrEmpty(shelfRfid))
{ {
//无可用料架 LastGTime = DateTime.Now;
WarnMsg = $"{LineConnect.DoorPosInfo.ToStr()}暂无可用料架"; if ((!CanStarInOut()))
return;
}
ClearWarnMsg("暂无可用料架");
//获取库位号
string outMsg = "";
CurrTray = HttpServer.GetLocation(LineConnect.DoorPosInfo.barcode, shelfRfid, out outMsg);
//需要取放料,且料架已准备好
if (outMsg.Equals(""))
{
ClearWarnMsg("getLocation");
string targetP = GetShelfPosId();
if (!String.IsNullOrEmpty(targetP))
{ {
LineConnect.DoorPosInfo.ShelfPosId = targetP; return;
}
if ((LineConnect.DoorPosInfo == null))
{
return;
}
if (LineConnect.DoorPosInfo.IsNg || LineConnect.DoorPosInfo.barcode.Equals(""))
{
LineConnect.DoorPosInfo.IsNg = true;
StartMove(); StartMove();
return;
} }
else string shelfRfid = ReadyShelf();
if (String.IsNullOrEmpty(shelfRfid))
{ {
WarnMsg = "未找到可用料架 getLocation " + CurrTray.ToStr(); //无可用料架
WarnMsg = $"{LineConnect.DoorPosInfo.ToStr()}暂无可用料架";
return;
} }
ClearWarnMsg("暂无可用料架");
//获取库位号
string outMsg = "";
CurrTray = HttpServer.GetLocation(LineConnect.DoorPosInfo.barcode, shelfRfid, out outMsg);
//需要取放料,且料架已准备好
if (outMsg.Equals(""))
{
ClearWarnMsg("getLocation");
string targetP = GetShelfPosId();
if (!String.IsNullOrEmpty(targetP))
{
LineConnect.DoorPosInfo.ShelfPosId = targetP;
StartMove();
}
else
{
WarnMsg = "未找到可用料架 getLocation " + CurrTray.ToStr();
}
}
else if (!outMsg.Equals(""))
{
WarnMsg = " getLocation " + outMsg;
}
} }
else if (!outMsg.Equals("")) catch (Exception ex)
{ {
WarnMsg = " getLocation " + outMsg; LogUtil.error(Name + "InShelfProcess:" + ex.ToString());
}
finally
{
Monitor.Exit(ProLock);
} }
} }
catch (Exception ex) else
{ {
LogUtil.error(Name + "InShelfProcess:" + ex.ToString());
} }
} }
......
...@@ -336,11 +336,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -336,11 +336,10 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(MoveStep.SO_11_InOutToP1); MoveInfo.NextMoveStep(MoveStep.SO_11_InOutToP1);
MoveLog("进出轴到P1[" + moveP.InOut_P1 + "]"); MoveLog("进出轴到P1[" + moveP.InOut_P1 + "]");
int outCount = AxisManager.instance.GetActualtPosition(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()); ConfigMoveAxis axis = Config.InOut_Axis;
int errorCount = Math.Abs(outCount - moveP.InOut_P1); if(AxisManager.instance.isInPosition(axis.DeviceName, axis.GetAxisValue(),moveP.InOut_P1, axis.CanErrorCountMin,true))
if (errorCount <= Config.InOut_Axis.CanErrorCountMin)
{ {
LogUtil.error(Name + "进出轴当前位置:" + outCount + ",已经在P1[" + moveP.InOut_P1 + "],不需要再回P1"); LogUtil.error(Name + "进出轴 已经在P1[" + moveP.InOut_P1 + "],不需要再回P1");
} }
else else
{ {
...@@ -398,6 +397,39 @@ namespace OnlineStore.DeviceLibrary ...@@ -398,6 +397,39 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
} }
private void SO_12_AxisToP1()
{
LineMoveP moveP = MoveInfo.MoveParam.MoveP;
if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.ShelfPosId : "";
WarnMsg = "[" + posId + "]叉子去取料前,未检测到进料口有料";
LogUtil.error(WarnMsg);
}
MoveInfo.NextMoveStep(MoveStep.SO_12_AxisToP1);
MoveLog(" 所有轴回到待机点,升降轴到P1 [" + moveP.UpDown_P1 + "],旋转轴到P1 [" + moveP.Middle_P1 + "], 压紧轴到P3 [" + moveP.ComPress_P3 + "]");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ConfigMoveAxis updown = Config.UpDown_Axis;
if (!AxisManager.instance.isInPosition(updown.DeviceName, updown.GetAxisValue(), moveP.UpDown_P1, updown.CanErrorCountMax))
{
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
else
{
MoveLog("升降轴已在P1[" + moveP.UpDown_P1 + "]");
}
ConfigMoveAxis middle = Config.Middle_Axis;
if (!AxisManager.instance.isInPosition(middle.DeviceName, middle.GetAxisValue(), moveP.Middle_P1, middle.GetAxisValue()))
{
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
else
{
MoveLog("旋转轴已在P1 [" + moveP.Middle_P1 + "]");
}
}
protected override void OutProcess() protected override void OutProcess()
{ {
LineMoveP moveP = MoveInfo.MoveParam.MoveP; LineMoveP moveP = MoveInfo.MoveParam.MoveP;
...@@ -413,35 +445,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -413,35 +445,8 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.IsStep(MoveStep.SO_11_InOutToP1)) if (MoveInfo.IsStep(MoveStep.SO_11_InOutToP1))
{ {
if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW)) SO_12_AxisToP1();
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.ShelfPosId : "";
WarnMsg = "[" + posId + "]叉子去取料前,未检测到进料口有料";
LogUtil.error(WarnMsg);
}
MoveInfo.NextMoveStep(MoveStep.SO_12_AxisToP1);
MoveLog(" 所有轴回到待机点,升降轴到P1 [" + moveP.UpDown_P1 + "],旋转轴到P1 [" + moveP.Middle_P1 + "], 压紧轴到P3 [" + moveP.ComPress_P3 + "]");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ConfigMoveAxis updown = Config.UpDown_Axis;
if (!AxisManager.instance.isInPosition(updown.DeviceName, updown.GetAxisValue(), moveP.UpDown_P1, updown.CanErrorCountMax))
{
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
else
{
MoveLog("升降轴已在P1[" + moveP.UpDown_P1 + "]");
}
ConfigMoveAxis middle = Config.Middle_Axis;
if (!AxisManager.instance.isInPosition(middle.DeviceName, middle.GetAxisValue(), moveP.Middle_P1, middle.GetAxisValue()))
{
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
else
{
MoveLog("旋转轴已在P1 [" + moveP.Middle_P1 + "]");
}
} }
else if (MoveInfo.IsStep(MoveStep.SO_12_AxisToP1)) else if (MoveInfo.IsStep(MoveStep.SO_12_AxisToP1))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!