Commit 1ae60358 LN

增加agv对接

1 个父辈 9ace62a8
......@@ -35,7 +35,6 @@ namespace OnlineStore.DeviceLibrary
actionMap = new Dictionary<string, Asa.ClientAction>();
LogUtil.info(" 开始 agvClient.Connect");
//}
agvClient.Connect();
foreach (string str in NodeList)
{
......@@ -81,49 +80,44 @@ namespace OnlineStore.DeviceLibrary
agvClient.SetStatus(id,mark, shelfId, action, level);
UpdateAction(id, action);
}
private static void AgvClient_CloseDoor(string id, string rfid)
{
LogUtil.info("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] ");
}
private static void AgvClient_Ready(string id, string rfid)
{
UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}else if (RobotManager.robot.outputEquip.Config.AgvInName.Equals(id)|| RobotManager.robot.outputEquip.Config.AgvOutName.Equals(id))
try
{
RobotManager.robot.outputEquip.AgvReady(id, rfid);
UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.outputEquip.Config.AgvInName.Equals(id) || RobotManager.robot.outputEquip.Config.AgvOutName.Equals(id))
{
RobotManager.robot.outputEquip.AgvReady(id, rfid);
}
else
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
}
}
else
catch (Exception ex)
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
LogUtil.error("AgvClient_Ready [" + id + "] [" + rfid + "] 处理出错:" + ex.ToString());
}
}
private static void AgvClient_CloseDoor(string id, string rfid)
{
LogUtil.info("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] 暂无需处理 ");
}
private static void AgvClient_Arrive(string id, string rfid)
{
UpdateAction(id, ClientAction.Arrive);
// RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvArrive(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.RightBatchMove.AgvArrive(id, rfid);
}
else
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
}
// UpdateAction(id, ClientAction.Arrive);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + rfid + "]暂无需处理 ");
}
internal static bool ISConnected()
......
......@@ -186,7 +186,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.IB12_BatchAxisToP3);
WorkLog("料串入料 :料盘已拿走,批量轴到P3,测盘高 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
BatchAxisToP3(false);
BatchAxisToP3( );
}
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToP3))
{
......@@ -360,7 +360,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
WorkLog("料串入料 :CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘");
MoveInfo.ShelfNoTray = false;
BatchAxisToP3(false);
BatchAxisToP3( );
return;
}
}
......@@ -377,23 +377,11 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.SuddenStop(true);
BatchAxis.AbsMove(MoveInfo, BatchAxisP1, Robot.Config.BatchAxis_P1Speed);
}
private void BatchAxisToP3(bool isFirstMove = true)
private void BatchAxisToP3( )
{
int targetP3 = BatchAxisP3;
int targetSpeed = Robot.Config.BatchAxis_P3Speed;
//if (!isFirstMove)
//{
// int currPosition = BatchAxis.GetAclPosition();
// if (currPosition != -1)
// {
// targetP3 = currPosition + Robot.Config.Height_ChangeValue * 80;
// if (targetP3 > BatchAxisP3)
// {
// targetP3 = BatchAxisP3;
// }
// LogUtil.info(Name + " BatchAxisToP3 目标P3: " + targetP3 + "(" + currPosition + ")");
// }
//}
MoveInfo.TimeOutSeconds = 200;
MoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
......@@ -464,16 +452,27 @@ namespace OnlineStore.DeviceLibrary
#region AGV 处理
private bool ProcessShelfOut = false;
private bool ProcessShelfEnter = false;
internal void ShelfEnterProcess()
internal void AgvReady(string nodeId, string rfid)
{
if (string.IsNullOrEmpty(rfid))
{
ShelfOutProcess(nodeId, rfid);
}
else
{
ShelfEnterProcess(nodeId, rfid);
}
}
internal void ShelfEnterProcess(string nodeId, string rfid)
{
Task.Factory.StartNew(delegate
{
string logName = Name + "料串 [AGV->" + AgvName + "] ";
string logName = Name + "料串 "+rfid+" [AGV->" + AgvName + "] ";
try
{
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.LOW) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logName + " 开始");
LogUtil.info(logName + " 开始转动线体");
ProcessShelfEnter = true;
LineRun();
......@@ -517,6 +516,7 @@ namespace OnlineStore.DeviceLibrary
else
{
//入口有料串,暂不处理
LogUtil.error(logName + ",入口已有料架,暂不处理");
}
}
catch (TimeoutException te)
......@@ -529,39 +529,19 @@ namespace OnlineStore.DeviceLibrary
}
finally
{
LineStop();
ProcessShelfEnter = false;
}
});
}
internal void AgvReady(string nodeId, string rfid)
{
string logN = Name + "收到 AgvReady 事件 [" + nodeId + "] [" + rfid + "] ";
if (string.IsNullOrEmpty(rfid))
{
ShelfOutProcess();
}
else
{
ShelfEnterProcess();
}
}
internal void AgvArrive(string id, string rfid)
{
string logN = Name + "收到 AgvArrive 事件 [" + id + "] [" + rfid + "] ";
}
internal void ShelfOutProcess()
internal void ShelfOutProcess(string nodeId, string rfid)
{
//AGV已到达,将料串送入AGV中
Task.Factory.StartNew(delegate
{
string logName = Name + "[" + AgvName + "->AGV ] ";
string logName = Name + "料串"+rfid+"[" + AgvName + "->AGV ] ";
try
{
LogUtil.info(logName + "开始,先设置状态为None");
{
AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.None, ClientLevel.High, true);
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) || Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
......@@ -586,11 +566,11 @@ namespace OnlineStore.DeviceLibrary
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空料串[" + CurrShelfId + "], 结束");
LogUtil.info(logName + "结束,停止转动,清空料串[" + CurrShelfId + "] ");
}
else
{
LogUtil.info(logName + "开始,未检测到料串信号,不处理");
LogUtil.info(logName + " 未检测到料架,暂不处理");
}
}
catch (TimeoutException te)
......@@ -608,10 +588,9 @@ namespace OnlineStore.DeviceLibrary
}
});
}
#endregion
protected void WorkLog(string msg)
{
LogUtil.info(Name + " [" + MoveInfo.MoveStep + "]" + msg);
......
......@@ -162,11 +162,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.WareCount = 99999;
Work_ReelInfo.WareCount = 99999;
}
WorkLog("料盘处理:点料结束,关闭X关机互锁信号");
WorkLog("料盘处理:点料结束,关闭X关机互锁信号,上传点料结果");
IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
Task.Factory.StartNew(delegate {
SServerManager.Return_Material(Name, MoveInfo.MoveParam.WareCode, Work_ReelInfo.WareCount);
string msg= SServerManager.Return_Material(Name, MoveInfo.MoveParam.WareCode, Work_ReelInfo.WareCount);
LogUtil.error(Name + "上传【"+MoveInfo.MoveParam.OutStr()+"】点料结果失败:" + msg);
});
}
#endregion
......
......@@ -109,14 +109,7 @@ namespace OnlineStore.DeviceLibrary
}
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (!msg.Equals(""))
{
LogUtil.error(msg);
}
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!