Commit 4f5363ed 张东亮

1

1 个父辈 4b88f2d0
...@@ -281,7 +281,7 @@ namespace OnlineStore.Common ...@@ -281,7 +281,7 @@ namespace OnlineStore.Common
if (_serialPort.IsOpen) if (_serialPort.IsOpen)
{ {
if (Monitor.TryEnter(lockObj, 10)) if (Monitor.TryEnter(lockObj, 300))
{ {
//Monitor.Enter(lockObj); //Monitor.Enter(lockObj);
try try
......
...@@ -261,6 +261,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -261,6 +261,12 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if(currPosition==0)
{
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
}
else
{
ComTargetPosition = currPosition; ComTargetPosition = currPosition;
int targetP = currPosition + Config.CompAxis_Down_Position; int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP); LastHeight = Config.GetComP2PlateH(targetP);
...@@ -268,10 +274,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -268,10 +274,13 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value; MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value;
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP +
"]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]"); "]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]");
ACServerManager.SuddenStop(Config.Comp_Axis);
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
} }
} }
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_16_ComDownMove)) else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_16_ComDownMove))
{ {
MoveInfo.NextMoveStep(StoreMoveStep.BI_17_InoutBack); MoveInfo.NextMoveStep(StoreMoveStep.BI_17_InoutBack);
......
...@@ -247,6 +247,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -247,6 +247,12 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if(currPosition==0)
{
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
}
else
{
ComTargetPosition = currPosition; ComTargetPosition = currPosition;
int targetP = currPosition + Config.CompAxis_Down_Position; int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP); LastHeight = Config.GetComP2PlateH(targetP);
...@@ -255,10 +261,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -255,10 +261,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP; MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP;
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP +
"]记录ComP2[" + targetP + "]"); "]记录ComP2[" + targetP + "]");
ACServerManager.SuddenStop(Config.Comp_Axis);
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
} }
}
} }
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_PreCheck_07_ComDownMove)) else if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_PreCheck_07_ComDownMove))
...@@ -522,12 +530,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -522,12 +530,21 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if(currPosition==0)
{
InOutStoreLog("出库,当前位置为0,无需再向下压紧");
}
else
{
int targetP = currPosition + Config.CompAxis_Down_Position; int targetP = currPosition + Config.CompAxis_Down_Position;
InOutStoreLog("出库 " + MoveInfo.SLog + ": 再向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + "] "); InOutStoreLog("出库 " + MoveInfo.SLog + ": 再向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + "] ");
ACServerManager.SuddenStop(Config.Comp_Axis);
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
} }
} }
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_07_ComDownMove) else if (MoveInfo.MoveStep == StoreMoveStep.SO_07_ComDownMove)
{ {
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutBack); MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutBack);
......
...@@ -151,14 +151,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -151,14 +151,23 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
int ret= bean.SendCommand(data, ref returnData, outTime, reviceLength); int tryTimes = 5;
while(tryTimes > 0)
{
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength)) if (!ret.Equals(reviceLength))
{ {
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【"+reviceLength+"】实际返回【"+ret+"】"); tryTimes--;
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}
else
{
break;
} }
System.Threading.Thread.Sleep(2); System.Threading.Thread.Sleep(2);
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.info(ex.ToString()); LogUtil.info(ex.ToString());
...@@ -206,17 +215,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,17 +215,24 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
int tryTimes = 5;
while(tryTimes > 0)
{
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength); int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength)) if (!ret.Equals(reviceLength))
{ {
tryTimes--;
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】"); LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}else }
else
{ {
result = true ; result = true;
break;
} }
System.Threading.Thread.Sleep(2); System.Threading.Thread.Sleep(2);
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.info(ex.ToString()); LogUtil.info(ex.ToString());
......
using log4net; using ConfigHelper;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -277,6 +278,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -277,6 +278,7 @@ namespace OnlineStore.DeviceLibrary
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
Thread.Sleep(100);
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!