Commit 4f5363ed 张东亮

1

1 个父辈 4b88f2d0
......@@ -281,7 +281,7 @@ namespace OnlineStore.Common
if (_serialPort.IsOpen)
{
if (Monitor.TryEnter(lockObj, 10))
if (Monitor.TryEnter(lockObj, 300))
{
//Monitor.Enter(lockObj);
try
......
......@@ -261,14 +261,23 @@ namespace OnlineStore.DeviceLibrary
}
else
{
ComTargetPosition = currPosition;
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 + "]");
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
if(currPosition==0)
{
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
}
else
{
ComTargetPosition = currPosition;
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
}
else
{
ComTargetPosition = currPosition;
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 + "]");
if(currPosition==0)
{
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,当前位置为0,无需再向下压紧");
}
else
{
ComTargetPosition = currPosition;
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
}
else
{
int targetP = currPosition + Config.CompAxis_Down_Position;
InOutStoreLog("出库 " + MoveInfo.SLog + ": 再向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + "] ");
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
if(currPosition==0)
{
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
}
else
{
int ret= bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength))
int tryTimes = 5;
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)
......@@ -206,15 +215,22 @@ namespace OnlineStore.DeviceLibrary
}
else
{
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength))
int tryTimes = 5;
while(tryTimes > 0)
{
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}else
{
result = true ;
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength))
{
tryTimes--;
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}
else
{
result = true;
break;
}
System.Threading.Thread.Sleep(2);
}
System.Threading.Thread.Sleep(2);
}
}
catch (Exception ex)
......
using log4net;
using ConfigHelper;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -260,7 +261,7 @@ namespace OnlineStore.DeviceLibrary
msg = "";
string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
......@@ -277,6 +278,7 @@ namespace OnlineStore.DeviceLibrary
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
MoveInfo.CanWhileCount--;
Thread.Sleep(100);
}
else
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!