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,14 +261,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -261,14 +261,23 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
ComTargetPosition = currPosition; if(currPosition==0)
int targetP = currPosition + Config.CompAxis_Down_Position; {
LastHeight = Config.GetComP2PlateH(targetP); InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP; }
MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value; else
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + {
"]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]"); ComTargetPosition = currPosition;
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP);
MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP;
MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value;
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP +
"]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]");
ACServerManager.SuddenStop(Config.Comp_Axis);
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
}
} }
} }
......
...@@ -247,16 +247,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -247,16 +247,24 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
ComTargetPosition = currPosition; if(currPosition==0)
int targetP = currPosition + Config.CompAxis_Down_Position; {
LastHeight = Config.GetComP2PlateH(targetP); InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP; }
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(MoveInfo.MoveParam.PosID); else
MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP; {
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + ComTargetPosition = currPosition;
"]记录ComP2[" + targetP + "]"); int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP);
MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP;
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(MoveInfo.MoveParam.PosID);
MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP;
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + 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);
} }
...@@ -522,9 +530,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -522,9 +530,18 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
int targetP = currPosition + Config.CompAxis_Down_Position; if(currPosition==0)
InOutStoreLog("出库 " + MoveInfo.SLog + ": 再向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + "] "); {
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); InOutStoreLog("出库,当前位置为0,无需再向下压紧");
}
else
{
int targetP = currPosition + Config.CompAxis_Down_Position;
InOutStoreLog("出库 " + MoveInfo.SLog + ": 再向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + "] ");
ACServerManager.SuddenStop(Config.Comp_Axis);
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
}
} }
} }
......
...@@ -151,12 +151,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -151,12 +151,21 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
int ret= bean.SendCommand(data, ref returnData, outTime, reviceLength); int tryTimes = 5;
if (!ret.Equals(reviceLength)) while(tryTimes > 0)
{ {
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【"+reviceLength+"】实际返回【"+ret+"】"); int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength))
{
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)
...@@ -206,15 +215,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,15 +215,22 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength); int tryTimes = 5;
if (!ret.Equals(reviceLength)) while(tryTimes > 0)
{ {
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】"); int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
}else if (!ret.Equals(reviceLength))
{ {
result = true ; tryTimes--;
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}
else
{
result = true;
break;
}
System.Threading.Thread.Sleep(2);
} }
System.Threading.Thread.Sleep(2);
} }
} }
catch (Exception ex) catch (Exception ex)
......
using log4net; using ConfigHelper;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -260,7 +261,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -260,7 +261,7 @@ namespace OnlineStore.DeviceLibrary
msg = ""; msg = "";
string deviceName = moveAxis.DeviceName; string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue(); short axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0); bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo); int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition); int errorCount = Math.Abs(outCount - targetPosition);
...@@ -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!