Commit f7c25fd2 LN

叉子前进前增加验证。

1 个父辈 536c7edc
...@@ -252,7 +252,7 @@ namespace OnlineStore.ACSingleStore ...@@ -252,7 +252,7 @@ namespace OnlineStore.ACSingleStore
string msg = "等待入库:"; string msg = "等待入库:";
foreach (string s in list) foreach (string s in list)
{ {
msg += s + "\t"; msg += s + " ";
} }
lblWarnMsg.Text = msg; lblWarnMsg.Text = msg;
} }
......
...@@ -32,20 +32,20 @@ namespace OnlineStore.Common ...@@ -32,20 +32,20 @@ namespace OnlineStore.Common
return; return;
} }
log.Info(log.Logger.Name + " - " + msg); log.Info( msg);
AddToBox(msg, Color.Black); AddToBox(msg, Color.Black);
//clear(); //clear();
} }
public static void info(ILog log,string msg, Color color) public static void info(ILog log,string msg, Color color)
{ {
log.Info(log.Logger.Name + " - " + msg); log.Info( msg);
AddToBox(msg, color); AddToBox(msg, color);
} }
public static void debug(ILog log, string msg, Color color) public static void debug(ILog log, string msg, Color color)
{ {
log.Debug(log.Logger.Name + " - " + msg); log.Debug( msg);
if (debug_opened) if (debug_opened)
{ {
AddToBox(msg, color); AddToBox(msg, color);
...@@ -53,7 +53,7 @@ namespace OnlineStore.Common ...@@ -53,7 +53,7 @@ namespace OnlineStore.Common
} }
public static void debug(ILog log, string msg) public static void debug(ILog log, string msg)
{ {
log.Debug(log.Logger.Name + " - " + msg); log.Debug( msg);
if (debug_opened) if (debug_opened)
{ {
AddToBox(msg, Color.Gray); AddToBox(msg, Color.Gray);
...@@ -93,7 +93,7 @@ namespace OnlineStore.Common ...@@ -93,7 +93,7 @@ namespace OnlineStore.Common
} }
public static void error(ILog log, string errorMsg) public static void error(ILog log, string errorMsg)
{ {
log.Error(log.Logger.Name + " - " + errorMsg); log.Error( errorMsg);
AddToBox(errorMsg, Color.Red); AddToBox(errorMsg, Color.Red);
} }
private static void AddToBox(string msg, Color color) private static void AddToBox(string msg, Color color)
......
...@@ -406,16 +406,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -406,16 +406,24 @@ namespace OnlineStore.DeviceLibrary
OpenAndCloseSTB(portName, slvAddr); OpenAndCloseSTB(portName, slvAddr);
} }
public static bool isInPosition(ConfigMoveAxis Axis, int PPosition) public static bool isInPosition(ConfigMoveAxis Axis, int PPosition,bool isLog=false )
{ {
int outCount = ACServerManager.GetActualtPosition(Axis.DeviceName, Axis.GetAxisValue()); int outCount = ACServerManager.GetActualtPosition(Axis.DeviceName, Axis.GetAxisValue());
int errorCount = Math.Abs(outCount - PPosition); int errorCount = Math.Abs(outCount - PPosition);
if (errorCount <= Axis.CanErrorCountMin) if (errorCount <= Axis.CanErrorCountMin)
{ {
if (isLog)
{
LogUtil.info("【" + Axis.GetNameStr() + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return true");
}
return true; return true;
} }
else else
{ {
if (isLog)
{
LogUtil.info("【" + Axis.GetNameStr() + "】isInPosition【" + PPosition + "】,当前实时位置:【" + outCount + "】 return false");
}
return false; return false;
} }
} }
......
...@@ -347,6 +347,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,6 +347,22 @@ namespace OnlineStore.DeviceLibrary
} }
private void SI_05_DeviceToDoor() private void SI_05_DeviceToDoor()
{ {
if (!ACServerManager.isInPosition(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P1,true))
{
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog("入库:SI_03已结束,发现升降轴不在待机点,重新运动 升降轴到P1 [" + StoreMove.MoveParam.MoveP.UpDown_P1 + "] ");
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
return;
}
if (!ACServerManager.isInPosition(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P1))
{
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog("入库:SI_03已结束,发现旋转轴不在待机点,重新运动 旋转轴到P1 [" + StoreMove.MoveParam.MoveP.Middle_P1 + "]");
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
return;
}
if (DoorIsOpen()) if (DoorIsOpen())
{ {
//判断仓门是否打开 //判断仓门是否打开
...@@ -412,39 +428,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -412,39 +428,38 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(CodeMsg); LogUtil.error(CodeMsg);
} }
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome); StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
InStoreLog("入库:SI_03 所有轴回到待机点,升降轴到P1 [" + moveP.UpDown_P1 + "],旋转轴到P1 [" + moveP.Middle_P1 + "],,压紧轴到P3 [" + moveP.ComPress_P3 + "]"); InStoreLog("入库:SI_03 所有轴回到待机点,升降轴到P1 [" + moveP.UpDown_P1 + "],旋转轴到P1 [" + moveP.Middle_P1 + "],,压紧轴到P3 [" + moveP.ComPress_P3 + "],打开仓门");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed); ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_03_ReturnHome)
{
if (!ACServerManager.isInPosition(Config.UpDown_Axis, moveP.UpDown_P1)) if (!ACServerManager.isInPosition(Config.UpDown_Axis, moveP.UpDown_P1))
{ {
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog("入库:SI_03已结束,发现升降轴不在待机点,重新运动 升降轴到P1 [" + moveP.UpDown_P1 + "] ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
return; }
else
{
InStoreLog("入库:SI_03 升降轴已在P1[" + moveP.UpDown_P1 + "]");
} }
if (!ACServerManager.isInPosition(Config.Middle_Axis, moveP.Middle_P1)) if (!ACServerManager.isInPosition(Config.Middle_Axis, moveP.Middle_P1))
{ {
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog("入库:SI_03已结束,发现旋转轴不在待机点,重新运动 旋转轴到P1 [" + moveP.Middle_P1 + "]");
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
return;
} }
if (IsHasCompress_Axis) else
{ {
StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare); InStoreLog("入库:SI_03 旋转轴已在P1 [" + moveP.Middle_P1 + "]");
InStoreLog("入库:SI_04_CompressWare 压紧轴至P3(压紧前点)[" + moveP.ComPress_P3 + "] 开始"); }
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
OpenDoor(); OpenDoor();
} }
else else if (StoreMove.MoveStep == StoreMoveStep.SI_03_ReturnHome)
{
//if (IsHasCompress_Axis)
//{
//StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
//InStoreLog("入库:SI_04_CompressWare 压紧轴至P3(压紧前点)[" + moveP.ComPress_P3 + "] 开始");
//ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
//OpenDoor();
//}
//else
{ {
SI_05_DeviceToDoor(); SI_05_DeviceToDoor();
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!