Commit 2ae1c884 LN

增加AGV满料料架入库处理

1 个父辈 90fd6156
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>Client</name>
</assembly>
<members>
<member name="T:Asa.Common">
<summary>
公用
</summary>
</member>
<member name="F:Asa.Common.PORT">
<summary>
网络连接的端口
</summary>
</member>
<member name="F:Asa.Common.LOG_PATH">
<summary>
日志文件路径
</summary>
</member>
<member name="F:Asa.Common.HEART">
<summary>
心跳包,HEART
</summary>
</member>
<member name="F:Asa.Common.SERVER_OFF">
<summary>
服务器关闭,OFF
</summary>
</member>
<member name="F:Asa.Common.CLIENT_OFF">
<summary>
客户端关闭,OFF
</summary>
</member>
<member name="T:Asa.Common.Connection_Event">
<summary>
连接事件
</summary>
</member>
<member name="T:Asa.Common.String_Event">
<summary>
显示字符串事件
</summary>
<param name="s"></param>
</member>
<member name="T:Asa.Common.Action_Event">
<summary>
小车动作事件
</summary>
<param name="name"></param>
<param name="action"></param>
<returns></returns>
</member>
<member name="T:Asa.Common.ConsoleEventDelegate">
<summary>
控制台事件
</summary>
<param name="eventType"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.SetConsoleCtrlHandler(Asa.Common.ConsoleEventDelegate,System.Boolean)">
<summary>
添加或删除应用程序处理函数列表
</summary>
<param name="callback"></param>
<param name="add"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.CheckRemoteIP(System.String)">
<summary>
检查远程IP地址
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.CheckLocalIP(System.String)">
<summary>
检查IP地址
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.GetLocalIP">
<summary>
获取本地IPv4地址
</summary>
<returns></returns>
</member>
<member name="M:Asa.Common.HexBuff(System.Byte[])">
<summary>
16进制
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.IsHeart(System.Byte[])">
<summary>
是否心跳包
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.IsServerOffline(System.Byte[])">
<summary>
是否服务器断开
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="M:Asa.Common.IsClientOffline(System.Byte[])">
<summary>
是否客户端断开
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="T:Asa.Actions">
<summary>
动作
</summary>
</member>
<member name="F:Asa.Actions.ServerClose">
<summary>
服务器关闭(C)
</summary>
</member>
<member name="F:Asa.Actions.ClientClose">
<summary>
客户端关闭(S)
</summary>
</member>
<member name="F:Asa.Actions.SendRFID">
<summary>
发送RFID信息(CS)
</summary>
</member>
<member name="F:Asa.Actions.ReadyEmpty">
<summary>
准备空车(S)
</summary>
</member>
<member name="F:Asa.Actions.ReadyShelf">
<summary>
准备小车带料架(S)
</summary>
</member>
<member name="F:Asa.Actions.MayEnter">
<summary>
可以进入(S)
</summary>
</member>
<member name="F:Asa.Actions.FinishEnter">
<summary>
完成进入(S)
</summary>
</member>
<member name="F:Asa.Actions.MayOut">
<summary>
可以出去(S)
</summary>
</member>
<member name="F:Asa.Actions.FinishOut">
<summary>
完成出去(C)
</summary>
</member>
<member name="F:Asa.Actions.Arrive">
<summary>
小车到达(C)
</summary>
</member>
<member name="F:Asa.Actions.GetOut">
<summary>
小车离开(S)
</summary>
</member>
<member name="F:Asa.Actions.Usable">
<summary>
是否可用(CS)
</summary>
</member>
<member name="T:Asa.IOInfo">
<summary>
IO设备信息
</summary>
</member>
<member name="F:Asa.IOInfo.IP">
<summary>
IP地址
</summary>
</member>
<member name="F:Asa.IOInfo.DI">
<summary>
DI
</summary>
</member>
<member name="F:Asa.IOInfo.DO">
<summary>
DO
</summary>
</member>
<member name="T:Asa.Register">
<summary>
寄存器
</summary>
</member>
<member name="F:Asa.Register.ID">
<summary>
模块寄存器ID
</summary>
</member>
<member name="F:Asa.Register.Name">
<summary>
号码管名称
</summary>
</member>
<member name="F:Asa.Register.Explain">
<summary>
解释说明
</summary>
</member>
<member name="M:Asa.Register.#ctor(System.String,System.String,System.String)">
<summary>
寄存器
</summary>
<param name="ID">模块寄存器ID</param>
<param name="Name">号码管名称</param>
<param name="Explain">解释说明</param>
</member>
<member name="T:BLL.Client">
<summary>
电脑客户端
</summary>
</member>
<member name="E:BLL.Client.Connected">
<summary>
通信连接
</summary>
</member>
<member name="E:BLL.Client.Info">
<summary>
显示信息
</summary>
</member>
<member name="E:BLL.Client.Log">
<summary>
日志信息
</summary>
</member>
<member name="E:BLL.Client.Action">
<summary>
小车动作
</summary>
</member>
<member name="P:BLL.Client.ErrInfo">
<summary>
错误信息
</summary>
</member>
<member name="P:BLL.Client.IsConn">
<summary>
是否连接服务器
</summary>
</member>
<member name="P:BLL.Client.RFID">
<summary>
RFID的内容
</summary>
</member>
<member name="M:BLL.Client.#ctor(System.String)">
<summary>
电脑客户端
</summary>
<param name="RemoteIP">远程IP地址</param>
</member>
<member name="M:BLL.Client.Connect">
<summary>
连接
</summary>
<returns></returns>
</member>
<member name="M:BLL.Client.Close">
<summary>
关闭
</summary>
</member>
<member name="M:BLL.Client.SetNodeID(System.String[])">
<summary>
连接后设置节点ID
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.ReadyEmpty(System.String)">
<summary>
准备空车
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.SendRFID(System.String,System.Byte[])">
<summary>
发送RFID信息
</summary>
<param name="id"></param>
<param name="content"></param>
</member>
<member name="M:BLL.Client.ReadyShelf(System.String)">
<summary>
准备小车带料架
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.MayEnter(System.String)">
<summary>
可以进入
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.FinishEnter(System.String)">
<summary>
完成进入
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.MayOut(System.String)">
<summary>
可以出去
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.GetOut(System.String)">
<summary>
小车离开
</summary>
<param name="id"></param>
</member>
<member name="M:BLL.Client.Send(System.Byte[])">
<summary>
发送命令
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="M:BLL.Client.ListenNet">
<summary>
监听线程
</summary>
</member>
<member name="M:BLL.Client.Resolve">
<summary>
分析数据包
</summary>
</member>
<member name="M:BLL.Client.Splice(System.Byte,System.String,System.Byte[])">
<summary>
拼接命令
</summary>
<param name="code"></param>
<param name="id"></param>
<param name="content"></param>
<returns></returns>
</member>
</members>
</doc>
......@@ -45,6 +45,8 @@
<add key ="UseBuzzer" value ="1"/>
<!--IO模块是否主动上传-->
<add key ="AIOAutoUpload" value ="1"/>
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="192.168.103.22" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -581,7 +581,7 @@ namespace OnlineStore.ACPackingStore
private void btnStoreStart_Click(object sender, EventArgs e)
{
bool result= BoxBean.StartRun();
bool result= BoxBean.StartRun(true);
if (result)
{
StoreOpenStatus(true);
......
......@@ -72,6 +72,7 @@
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
<Compile Include="util\WaitUtil.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
......
......@@ -98,6 +98,6 @@ namespace OnlineStore.Common
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string AgvServerIp = "AgvServerIp";
}
}
......@@ -16,13 +16,13 @@ namespace OnlineStore.Common
private Thread m_serverThread;
private Socket m_serverSocket;
public delegate void ReviceMsg(Client client, string Msg);
public delegate void ReviceMsg(SocketClient client, string Msg);
/// <summary>
/// 接受到数据事件
/// </summary>
public event ReviceMsg ReviceMsgEvent;
private delegate void ReceiveMessageDelegate(Client client);
private delegate void ReceiveMessageDelegate(SocketClient client);
ReceiveMessageDelegate receiveMessageDelegate;
private bool isRun = true;
private void logLocalIp()
......@@ -95,7 +95,7 @@ namespace OnlineStore.Common
{
while (isRun)
{
Client client = new Client();
SocketClient client = new SocketClient();
try
{
client.ClientSocket = m_serverSocket.Accept();
......@@ -116,7 +116,7 @@ namespace OnlineStore.Common
private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
private int receiveBufferSize = 1024;
private string terminateString = "\r";
public void ReceiveMessages(Client client) //这个函数会被以线程方式运行
public void ReceiveMessages(SocketClient client) //这个函数会被以线程方式运行
{
try
{
......@@ -243,11 +243,11 @@ namespace OnlineStore.Common
/// <summary>
/// 客户端会话信息类
/// </summary>
public class Client
public class SocketClient
{
Socket m_clientSocket;
public Client() { }
public SocketClient() { }
public IPAddress ipAdd { get; set; }
public Socket ClientSocket
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.Common
{
public class WaitUtil
{
public delegate bool IsOk();
/// <summary>
/// 使用异步委托检测超时,防止isOk方法不返回结果导致卡死的问题
/// </summary>
/// <param name="waitName"></param>
/// <param name="timeout"></param>
/// <param name="isOk"></param>
public static bool Wait(int timeout, IsOk isOk, string waitName = "")
{
DateTime startTime = System.DateTime.Now;
TimeSpan timoutSpan = TimeSpan.FromMilliseconds(timeout);
TimeSpan waitSpan = TimeSpan.FromMilliseconds(0);
int sleepTime = 10;
while (true)
{
TimeSpan remainTimes = timoutSpan.Subtract(waitSpan);
if (remainTimes.TotalMilliseconds < 0)
{
//已经超时
throw new TimeoutException(waitName + "超时");
}
try
{
IAsyncResult re = isOk.BeginInvoke(null, null);
var waitResult = re.AsyncWaitHandle.WaitOne(remainTimes);
if (waitResult)
{
bool okResult = isOk.EndInvoke(re);
if (okResult)
{
return true;
}
}
}
catch (Exception ex)
{
LogUtil.error("同步等待出现异常:" + ex.Message);
}
Thread.Sleep(sleepTime);
waitSpan = System.DateTime.Now.Subtract(startTime);
}
}
}
}

using OnlineStore.Common;
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -122,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始运行
/// </summary>
public override bool StartRun()
public override bool StartRun(bool isDebug = false)
{
if (!StoreManager.Store.canStart)
{
......@@ -131,7 +132,14 @@ namespace OnlineStore.DeviceLibrary
return false;
}
LogInfo("开始启动,启动时间:" + StartTime.ToString());
if (IsDebug)
{
//连接AGV调度
if (!AgvClient.ISConnected())
{
AgvClient.Init();
}
}
AutoInout.StopAuto();
mainTimer.Enabled = false;
alarmType = StoreAlarmType.None;
......@@ -377,6 +385,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Axis_Brake, IO_VALUE.HIGH);
return true;
}
/// <summary>
/// 打开所有轴
/// </summary>
......
......@@ -58,10 +58,7 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_14_WaitTake))
{
timeOutMs = 650000;
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -109,6 +106,10 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType.Equals(9))
{
wait.IsEnd = (LastScanCodes.Count > 0);
}else if (wait.WaitType.Equals(10))
{
int agvA = (int)AgvClient.GetAction(Config.AgvNodeName);
wait.IsEnd = agvA.Equals(wait.TargetPosition);
}
if (wait.IsEnd)
{
......@@ -381,7 +382,7 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Busy;
MoveInfo.NewMove(StoreMoveType.OutStore, param);
MoveInfo.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
MoveInfo.NextMoveStep(StoreMoveStep.SO_32_DeviceBack);
InOutStoreLog("出库:SO_02 叉子先运动到P1 ,打开舱门 开始");
//ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1);
......@@ -405,37 +406,37 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (MoveInfo.MoveStep == StoreMoveStep.SO_01_LocationCylinderDown)
if (MoveInfo.MoveStep == StoreMoveStep.SO_31_LocationCylinderDown)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
MoveInfo.NextMoveStep(StoreMoveStep.SO_32_DeviceBack);
InOutStoreLog("出库:SO_02 叉子先运动到P1 ");
InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_02_DeviceBack)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_32_DeviceBack)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
MoveInfo.NextMoveStep(StoreMoveStep.SO_33_ToBagPosition);
InOutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ACAxisMove(Config.Comp_Axis,moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_33_ToBagPosition)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_04_DeviceToBag);
MoveInfo.NextMoveStep(StoreMoveStep.SO_34_DeviceToBag);
InOutStoreLog("出库:SO_04 叉子进入库位中, 进出轴至P3(库位取放料点) ");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_04_DeviceToBag)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_34_DeviceToBag)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
MoveInfo.NextMoveStep(StoreMoveStep.SO_35_BagWareToDevice);
InOutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
ACAxisMove(Config.Comp_Axis,moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.Comp_Axis, moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_35_BagWareToDevice)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_06_BagDeviceBack);
MoveInfo.NextMoveStep(StoreMoveStep.SO_36_BagDeviceBack);
InOutStoreLog("出库:SO_06 叉子从库位返回,进出轴至P1(待机点) ");
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1(moveP.InOut_P1);
......@@ -446,7 +447,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus = StoreStatus.OutStoreBoxEnd;
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_06_BagDeviceBack)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_36_BagDeviceBack)
{
if (IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{
......@@ -455,83 +456,75 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(CodeMsg);
}
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
MoveInfo.NextMoveStep(StoreMoveStep.SO_38_ToShelfPosition);
InOutStoreLog("出库:SO_08 走到料架位置,旋转轴至P101,升降轴至P102, ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_07_LocationCylinder_Up)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_37_LocationCylinder_Up)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
MoveInfo.NextMoveStep(StoreMoveStep.SO_38_ToShelfPosition);
InOutStoreLog("出库:SO_08 走到料架位置,旋转轴至P101,升降轴至P102, ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_08_ToShelfPosition)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_38_ToShelfPosition)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
MoveInfo.NextMoveStep(StoreMoveStep.SO_40_WaitNoTray);
}
//此处需要等待移栽没有工作,才能把盘放入出料口
else if (MoveInfo.MoveStep == StoreMoveStep.SO_09_LocationCylinder_Down)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_39_LocationCylinder_Down)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
MoveInfo.NextMoveStep(StoreMoveStep.SO_40_WaitNoTray);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_091_WaitNoTray)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_40_WaitNoTray)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_10_DeviceToShelf);
MoveInfo.NextMoveStep(StoreMoveStep.SO_41_DeviceToShelf);
InOutStoreLog("出库:SO_10 叉子进出料口,进出轴至P101");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P101, Config.InOutAxis_P101_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_10_DeviceToShelf)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_41_DeviceToShelf)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_11_DevicePutWare);
MoveInfo.NextMoveStep(StoreMoveStep.SO_42_DevicePutWare);
InOutStoreLog("出库:SO_11 放下物品,压紧轴到P1,升降轴至P101 ");
ACAxisMove(Config.Comp_Axis,moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.Comp_Axis, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LP101, Config.UpDownAxis_P101_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_11_DevicePutWare)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_42_DevicePutWare)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_12_DeviceOutFromDoor);
MoveInfo.NextMoveStep(StoreMoveStep.SO_43_DeviceOutFromDoor);
InOutStoreLog("出库:SO_12 叉子从出料口返回,,进出轴动作至P1(待机点) ");
InOutBackToP1(moveP.InOut_P1);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_12_DeviceOutFromDoor)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_43_DeviceOutFromDoor)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_13_GoBack);
InOutStoreLog("出库:SO_13 升降轴返回,轴2至P1(待机点) ,关闭舱门");
MoveInfo.NextMoveStep(StoreMoveStep.SO_44_GoBack);
InOutStoreLog("出库:SO_13 升降轴返回,轴2至P1(待机点) ,");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
//发送消息给流水线
// SendOutStoreEnd(MoveInfo);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_13_GoBack)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_44_GoBack)
{
// int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
// if (OutStoreWaitSeconds <= 0)
// {
// OutStoreWaitSeconds = 600;
// }
// int ms = OutStoreWaitSeconds * 1000;
// MoveInfo.NextMoveStep(StoreMoveStep.SO_14_WaitTake);
// InOutStoreLog("出库:SO_14_WaitTake 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(ms));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
// // StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
// MoveInfo.OneWaitCanEndStep = true;
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SO_14_WaitTake)
//{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
//判断是否需要送出料架
if (waitOutStoreList.Count <= 0)
{
storeStatus = StoreStatus.StoreOnline;
LogInfo(" 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
MoveInfo.EndMove();
storeRunStatus = StoreRunStatus.Runing;
AutoInout.InOutEndProcess(this, StoreMoveType.OutStore);
}
else
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
storeStatus = StoreStatus.StoreOnline;
LogInfo(" 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
MoveInfo.EndMove();
storeRunStatus = StoreRunStatus.Runing;
AutoInout.InOutEndProcess(this, StoreMoveType.OutStore);
}
}
else
{
......
using OnlineStore.Common;
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -17,6 +18,7 @@ namespace OnlineStore.DeviceLibrary
private int ComTargetPosition = 0;
private int LastWidth = 0;
private int LastHeight = 0;
private RFIDData LastShelfData = new RFIDData(0);
private void ClearLastTrayInfo()
{
......@@ -32,64 +34,63 @@ namespace OnlineStore.DeviceLibrary
public void StartShelfInStore()
{
if (storeRunStatus == StoreRunStatus.Runing)
bool canStart = (storeRunStatus.Equals(StoreRunStatus.Runing)
&& MoveInfo.MoveType.Equals(StoreMoveType.None)
&& IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.HIGH));
if (!canStart)
{
if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.HIGH))
{
LogInfo(" 空闲中,检测到入料口有信号,料架入库:入料口移门打开,");
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
EmprtShelfList = new Queue<string>();
return;
}
//读取RFID
RFIDData data = RFIDManager.ReadData(Config.RFID_IP);
//TODO 判断料架是否正确
if (data.RFType.Equals("A"))
{
//读取RFID
RFIDData data = RFIDManager.ReadData(Config.RFID_IP);
//TODO 判断料架是否正确
if (data.RFType.Equals("A"))
{
LastShelfData = data;
AgvClient.SendRFID(Config.AgvNodeName, data.ToData());
}
else
{
LogUtil.error(Name + "检测到入料口有料架,读取RFID数据错误:" + data.ToStr());
return;
}
}
else
{
LogUtil.error(Name + "读取RFID数据错误:" + data.ToStr());
}
MoveInfo.NewMove(StoreMoveType.InStore, new InOutParam());
MoveInfo.MoveParam.MoveP = new LineMoveP();
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
EmprtShelfList = new Queue<string>();
LogInfo(" 空闲中,读取到料架" + data.ToStr() + ",料架入库:入料口移门打开,");
MoveInfo.NewMove(StoreMoveType.InStore, new InOutParam());
MoveInfo.MoveParam.MoveP = new LineMoveP();
MoveInfo.MoveParam.MoveP.ComPress_P1 = Config.CompAxis_P1_Position;
MoveInfo.MoveParam.MoveP.InOut_P1 = Config.InOutAxis_P1_Position;
MoveInfo.MoveParam.MoveP.Middle_P1 = Config.MiddleAxis_P1;
MoveInfo.MoveParam.MoveP.UpDown_P1 = Config.UpDownAxis_P1;
MoveInfo.MoveParam.MoveP.UpDown_P2 = Config.UpDownAxis_P2;
MoveInfo.MoveParam.MoveP.ComPress_P1 = Config.CompAxis_P1_Position;
MoveInfo.MoveParam.MoveP.InOut_P1 = Config.InOutAxis_P1_Position;
MoveInfo.MoveParam.MoveP.Middle_P1 = Config.MiddleAxis_P1;
MoveInfo.MoveParam.MoveP.UpDown_P1 = Config.UpDownAxis_P1;
MoveInfo.MoveParam.MoveP.UpDown_P2 = Config.UpDownAxis_P2;
MoveInfo.ShelfPositionList = new List<string>(ShelfPosList);
MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
MoveInfo.ShelfPositionList = new List<string>(ShelfPosList);
MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
}
}
}
private void ShelfInStoreEnd()
{
MoveInfo.EndMove();
EmprtShelfList = new Queue<string>(ShelfPosList);
storeRunStatus = StoreRunStatus.Runing;
storeStatus = StoreStatus.StoreOnline;
}
private void ShelfInStoreProcess()
{
LineMoveP moveP = MoveInfo.MoveParam.MoveP;
#region 料架移入料仓内部处理
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_01_LineIn_Check))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
InOutStoreLog("料架入库:入料口移门打开");
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_02_DoorOpen))
//if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_01_LineIn_Check))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
// InOutStoreLog("料架入库:入料口移门打开");
// CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
//}
//else
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_02_DoorOpen))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_03_LineRun);
InOutStoreLog("料架入库:线体正转,等待取料位检测到信号");
InOutStoreLog("料架入库:调用AgvClient.MayEnter,线体正转,等待取料位检测到信号");
AgvClient.MayEnter(Config.AgvNodeName);
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
......@@ -99,9 +100,9 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_03_LineRun))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_04_LineStop);
InOutStoreLog("料架入库:取料位检测到信号,停止线体正转");
InOutStoreLog("料架入库:调用AgvClient.FinishEnter,取料位检测到信号,停止线体正转");
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
AgvClient.FinishEnter(Config.AgvNodeName);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_04_LineStop))
{
......@@ -182,7 +183,7 @@ namespace OnlineStore.DeviceLibrary
ComTargetPosition = currPosition;
int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP);
InOutStoreLog("料架取料:检测到料叉压紧确认信号,向下押金【"+ComTargetPosition+"】目标【"+ targetP + "】,记录料盘高度【"+LastHeight+"】");
InOutStoreLog("料架取料:检测到料叉压紧确认信号,向下押金【" + ComTargetPosition + "】目标【" + targetP + "】,记录料盘高度【" + LastHeight + "】");
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
}
......@@ -193,7 +194,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.CompAxis_P1_Speed);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_17_InoutBack))
{
{
if (IOValue(IO_Type.TrayCheck_3).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.TrayCheck_4).Equals(IO_VALUE.HIGH))
{
LastWidth = 13;
......@@ -245,7 +246,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库");
}
else
{
{
StartSendTray("获取入库库位失败");
}
}
......@@ -253,7 +254,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_19_GetPosId))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_20_SetInstoreParam);
InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库");
InOutStoreLog("料架取料: 获取库位号完成,设置位置参数,开始入库");
}
#endregion
......@@ -328,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Comp_Axis, moveP.ComPress_P3, Config.CompAxis_P3_Speed);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_34_UpdownDown))
{
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_35_InoutToP1);
InOutStoreLog("送出料盘:叉子后退到P1");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
......@@ -348,15 +349,15 @@ namespace OnlineStore.DeviceLibrary
#endregion
//料架送出逻辑
else if(MoveInfo.MoveStep>= StoreMoveStep.BS_01_TopCylinder_Down&&MoveInfo.MoveStep >= StoreMoveStep. BS_09_CloseDoor)
else if (MoveInfo.MoveStep >= StoreMoveStep.BS_01_TopCylinder_Down && MoveInfo.MoveStep >= StoreMoveStep.BS_06_WaitTime)
{
SendShelfProcess();
}
else
else
{
LogInfo(" 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
}
}
}
}
private void StartMoveToBag()
{
......@@ -366,15 +367,15 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
}
private void StartSendTray( string str="扫码失败")
{
private void StartSendTray(string str = "扫码失败")
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_31_ToNGDoor);
InOutStoreLog("送出料盘:"+str+",升降轴移动到NG料门口上端,旋转轴移动到NG料门口");
InOutStoreLog("送出料盘:" + str + ",升降轴移动到NG料门口上端,旋转轴移动到NG料门口");
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
private void StartSendShelfOut()
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_01_TopCylinder_Down);
......@@ -392,13 +393,20 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_02_LocatinCylinder_Down))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_03_DoorOpen);
InOutStoreLog("送出料架:打开仓门");
InOutStoreLog("送出料架:打开仓门,调用AgvClient.ReadyEmpty,等待Agv小车到达");
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
AgvClient.ReadyEmpty(Config.AgvNodeName);
//等待小车到达
MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction((int)Asa.Actions.Arrive));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_03_DoorOpen))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_04_LineBack);
InOutStoreLog("送出料架:线体反转");
InOutStoreLog("送出料架:调用AgvClient.SendRFID【" + LastShelfData.ToData() + "】,调用AgvClient.MayOut,线体开始反转");
//TODO AGV到达,发送料架信息,是否需要重新读取?
AgvClient.SendRFID(Config.AgvNodeName, LastShelfData.ToData());
AgvClient.MayOut(Config.AgvNodeName);
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
IOMove(IO_Type.Line_BackRun, IO_VALUE.HIGH);
}
......@@ -412,32 +420,39 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_05_WaitInLineSingle))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_06_WaitTime);
InOutStoreLog("送出料架:再转动300时间");
InOutStoreLog("送出料架:再转动300时间,同时等待收到FinishOut");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
//等到小车离开
MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction((int)Asa.Actions.FinishOut));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_06_WaitTime))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_07_LineStop);
InOutStoreLog("送出料架:停止转动");
//结束
MoveInfo.EndMove();
storeRunStatus = StoreRunStatus.Runing;
storeStatus = StoreStatus.StoreOnline;
EmprtShelfList = new Queue<string>();
InOutStoreLog("送出料架:停止转动,料架入料结束");
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_LineStop))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_08_CallAGV);
InOutStoreLog("送出料架:通知调度系统拿走");
//TODO
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_CallAGV))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_09_CloseDoor);
InOutStoreLog("送出料架:关闭仓门");
CylinderMove(MoveInfo, IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Close);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_CloseDoor))
{
}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_LineStop))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BS_08_CallAGV);
// InOutStoreLog("送出料架:通知调度系统拿走");
// //TODO
//}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_CallAGV))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BS_09_CloseDoor);
// InOutStoreLog("送出料架:关闭仓门");
// CylinderMove(MoveInfo, IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Close);
//}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_CloseDoor))
//{
//}
}
......@@ -447,20 +462,21 @@ namespace OnlineStore.DeviceLibrary
{
string message = "";
string spiltStr = "##";
string codeSize = LastWidth + "x" +LastHeight;
string codeSize = LastWidth + "x" + LastHeight;
foreach (string str in LastScanCodes)
{
if (str.Trim().Equals(""))
{
continue;
}
string code = "=1+0x0-" + codeSize + "=" + str.Trim();
string code = "=1+0x0-" + codeSize + "=" + str.Trim();
if (!String.IsNullOrEmpty(code))
{
message = message + code + spiltStr;
}
}return message;
}
return message;
}
/// <summary>
......@@ -558,7 +574,7 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
#endregion
......@@ -608,5 +624,53 @@ namespace OnlineStore.DeviceLibrary
IsInProcess = false;
}
#endregion
#region AGV
private bool ProcessShelf = false;
internal bool ProcessAGVAction(string name, Actions action)
{
string logN = name + "收到调度【" + name + "】=【" + action + "】";
//状态处理
if (action.Equals(Asa.Actions.Usable))
{
//判断入口是否可用:入口无料架,缓冲工位无料架,不在入料架处理中
bool usable = (storeRunStatus.Equals(StoreRunStatus.Runing) &&
MoveInfo.MoveType.Equals(StoreMoveType.None) &&
ProcessShelf.Equals(false)
&& IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.LineTake_Check).Equals(IO_VALUE.LOW));
LogUtil.info(logN + ":" + usable);
return usable;
}
else if (action.Equals(Asa.Actions.Arrive))
{
if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logN + " ,未检测到:LineIn_Check,不处理");
return false;
}
//小车到达,开始处理
if (storeRunStatus.Equals(StoreRunStatus.Runing) &&
MoveInfo.MoveType.Equals(StoreMoveType.None) &&
ProcessShelf.Equals(false) &&
IOValue(IO_Type.LineTake_Check).Equals(IO_VALUE.LOW))
{
StartShelfInStore();
return true;
}
}
else
{
LogUtil.info(name + logN + " ,未找到相关处理");
}
return false;
}
#endregion
}
}
using log4net;
using Asa;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -58,6 +59,9 @@ namespace OnlineStore.DeviceLibrary
{
AC_BOX_Bean equip = new AC_BOX_Bean(config);
//增加站号名称
AgvClient.NodeList.Add(config.AgvNodeName);
AddDeviceName(ioList, config.DIODeviceNameList);
BoxMap.Add(config.DeviceID, equip);
BoxConfigMap.Add(config.DeviceID, config);
......@@ -110,6 +114,7 @@ namespace OnlineStore.DeviceLibrary
}
private void IoCheckTimerProcess(object sender, ElapsedEventArgs e)
{
......@@ -117,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
#endregion
public override bool StartRun( )
public override bool StartRun(bool isDebug = false)
{
if (!canStart)
{
......@@ -142,18 +147,22 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info( Name + "开始启动,启动时间:" + StartTime.ToString());
storeRunStatus = StoreRunStatus.HomeMoving;
StartTime = DateTime.Now;
//连接AGV调度
if (!AgvClient.ISConnected())
{
AgvClient.Init();
}
mainTimer.Enabled = false;
isInSuddenDown = false;
isNoAirCheck = false;
alarmType = StoreAlarmType.None;
WarnMsg = "";
foreach (AC_BOX_Bean moveEquip in this.BoxMap.Values)
foreach (AC_BOX_Bean box in this.BoxMap.Values)
{
if (!moveEquip.IsDebug)
if (!box.IsDebug)
{
moveEquip.StartRun();
box.StartRun();
}
}
......@@ -227,19 +236,19 @@ namespace OnlineStore.DeviceLibrary
bool isInOut = false;
StoreRunStatus runs = StoreRunStatus.Wait;
foreach (AC_BOX_Bean moveEquip in BoxMap.Values)
foreach (AC_BOX_Bean box in BoxMap.Values)
{
if (!moveEquip.alarmType.Equals(StoreAlarmType.None))
if (!box.alarmType.Equals(StoreAlarmType.None))
{
isNeedAlarmLed = true;
}
if (moveEquip.MoveInfo.MoveType.Equals(StoreMoveType.InStore) || moveEquip.MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
if (box.MoveInfo.MoveType.Equals(StoreMoveType.InStore) || box.MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
isInOut = true;
}
if (moveEquip.storeRunStatus > runs)
if (box.storeRunStatus > runs)
{
runs = moveEquip.storeRunStatus;
runs = box.storeRunStatus;
}
}
......@@ -357,11 +366,11 @@ namespace OnlineStore.DeviceLibrary
// //判断急停
// else if (this.storeRunStatus >= StoreRunStatus.HomeMoving)
// {
// foreach (AC_BOX_Bean moveEquip in this.BoxMap.Values)
// foreach (AC_BOX_Bean box in this.BoxMap.Values)
// {
// if (!moveEquip.IsDebug)
// if (!box.IsDebug)
// {
// moveEquip.TimerProcess();
// box.TimerProcess();
// }
// }
// }
......@@ -395,18 +404,18 @@ namespace OnlineStore.DeviceLibrary
bool isOk = true;
//判断是否所有的已经返回完成
foreach (AC_BOX_Bean moveEquip in this.BoxMap.Values)
foreach (AC_BOX_Bean box in this.BoxMap.Values)
{
if ((moveEquip.storeRunStatus.Equals(StoreRunStatus.HomeMoving) || moveEquip.storeRunStatus.Equals(StoreRunStatus.Reset)) && moveEquip.IsDebug.Equals(false))
if ((box.storeRunStatus.Equals(StoreRunStatus.HomeMoving) || box.storeRunStatus.Equals(StoreRunStatus.Reset)) && box.IsDebug.Equals(false))
{
if (moveEquip.alarmType.Equals(StoreAlarmType.None))
if (box.alarmType.Equals(StoreAlarmType.None))
{
isOk = false;
break;
}
else
{
WarnMsg = moveEquip.Name + "在复位过程中报警,需要重新复位";
WarnMsg = box.Name + "在复位过程中报警,需要重新复位";
}
}
}
......@@ -425,14 +434,17 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + WarnMsg);
}
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
internal bool AGVProcess(string name, Actions action)
{
foreach (AC_BOX_Bean box in this.BoxMap.Values)
{
if (box.Config.AgvNodeName.Equals(name))
{
return box.ProcessAGVAction(name, action);
}
}
return false;
}
protected override void ReturnHomeProcess()
{
}
}
}
\ No newline at end of file
......@@ -9,8 +9,17 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class PackingStoreBean
{
{
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{
}
protected override void ReturnHomeProcess()
{
}
#region 出库
public override bool StartOutStoreMove(InOutParam param)
......
......@@ -42,6 +42,9 @@
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.6995.29021, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\RC1250-AssemblyLine\dll\CodeLibrary.dll</HintPath>
......@@ -70,6 +73,7 @@
<Compile Include="ACPackingStore\PackingStoreBean.cs" />
<Compile Include="ACPackingStore\PackingStoreBean_Partial.cs" />
<Compile Include="ACPackingStore\StoreManager.cs" />
<Compile Include="agvClient\AgvClient.cs" />
<Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="device\IO\IOManager.cs" />
......
......@@ -114,8 +114,9 @@ PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
,,,,,,,,, ,
,,,,,,,,, ,
,,,,,,,,,,
PRO,AGV小车站号名称,AgvNodeName,B1,,,,,,,
,,,,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,, ,
PRO,预警湿度,WarnHumidity,80,,,,,, ,
......
......@@ -115,6 +115,8 @@ PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
,,,,,,,,, ,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
,,,,,,,,,,
PRO,AGV小车站号名称,AgvNodeName,B2,,,,,,,
,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,, ,
PRO,预警湿度,WarnHumidity,80,,,,,, ,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
......
using BLL;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class AgvClient
{
private static string ServerIp = ConfigAppSettings.GetValue(Setting_Init.AgvServerIp);
//private string NodeName = "";
private static Client agvClient = null;
public static Dictionary<string, Asa.Actions> actionMap = new Dictionary<string, Asa.Actions>();
public static List<string> NodeList = new List<string>();
public static void Init( )
{
try
{
// this.NodeName = nodeID;
if (agvClient == null)
{
agvClient = new Client(ServerIp);
}
actionMap = new Dictionary<string, Asa.Actions>();
foreach(string key in NodeList)
{
actionMap.Add(key, Asa.Actions.ClientClose);
}
agvClient.Info += AgvClient_Info;
agvClient.Log += AgvClient_Log;
agvClient.Connected += AgvClient_Connected;
agvClient.Action += AgvClient_Action;
agvClient.Connect();
}
catch (Exception ex)
{
LogUtil.error("初始化agvClient " + ServerIp + " 出错:" + ex.ToString());
}
}
internal static bool ISConnected()
{
if (agvClient == null)
{
return false;
}
return agvClient.IsConn;
}
/// <summary>
///02 发送RFID
/// </summary>
/// <param name="NodeName"></param>
internal static void SendRFID(string NodeName, byte[] data)
{
agvClient.SendRFID(NodeName, data);
}
/// <summary>
/// 10 准备空车
/// </summary>
/// <param name="NodeName"></param>
internal static void ReadyEmpty(string NodeName)
{
agvClient.ReadyEmpty(NodeName);
}
/// <summary>
/// 11 准备小车带料架
/// </summary>
/// <param name="NodeName"></param>
internal static void ReadyShelf(string NodeName)
{
agvClient.ReadyShelf(NodeName);
}
/// <summary>
/// 12 可以进入
/// </summary>
/// <param name="NodeName"></param>
internal static void MayEnter(string NodeName)
{
agvClient.MayEnter(NodeName);
}
/// <summary>
///13 完成进入
/// </summary>
/// <param name="NodeName"></param>
internal static void FinishEnter(string NodeName)
{
agvClient.FinishEnter(NodeName);
}
/// <summary>
/// 14 可以出去
/// </summary>
/// <param name="NodeName"></param>
internal static void MayOut(string NodeName)
{
agvClient.MayOut(NodeName);
}
/// <summary>
///17 小车离开
/// </summary>
/// <param name="NodeName"></param>
internal static void GetOut(string NodeName)
{
agvClient.GetOut(NodeName);
}
private static bool AgvClient_Action(string name, Asa.Actions action)
{
if (actionMap.ContainsKey(name))
{
actionMap[name] = action;
}
else
{
actionMap.Add(name, action);
}
return StoreManager.Store.AGVProcess(name, action);
}
private static void AgvClient_Connected()
{
agvClient.SetNodeID(NodeList.ToArray());
}
private static void AgvClient_Log(string s)
{
LogUtil.info("AGV "+ ServerIp + " Log:" + s);
}
private static void AgvClient_Info(string s)
{
LogUtil.info("AGV "+ ServerIp + " Info:" + s);
}
public static Asa.Actions GetAction(string NodeName)
{
if (actionMap.ContainsKey(NodeName))
{
return actionMap[NodeName];
}
return Asa.Actions.ClientClose;
}
public static void Dispose()
{
try
{
if (agvClient != null)
{
agvClient.Close();
}
}
catch (Exception ex)
{
LogUtil.error("释放 agvClient "+ ServerIp + " 出错:" + ex.ToString());
}
}
}
}
......@@ -135,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
return WriteData(IP, sendData, 3);
}
public static RFIDData ReadData(string IP)
{
{
byte[] reviceData = ReadData(IP, 3);
if (reviceData != null)
{
......@@ -143,6 +143,11 @@ namespace OnlineStore.DeviceLibrary
}
return null;
}
//public static byte[] ReadData(string IP)
//{
// byte[] reviceData = ReadData(IP, 3);
// return reviceData;
//}
public static string SearchIP(string localIp)
{
string ip = "";
......@@ -248,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public int Num = 0;
public RFIDData (int num,char t='E')
public RFIDData (int num,char t='A')
{
this.RFType = t;
this.Num = num;
......
......@@ -76,6 +76,16 @@ namespace OnlineStore.DeviceLibrary
/// 是否是放入锡膏(在线料仓才需要此字段)
/// </summary>
public bool IsSolderPaste { get; set; }
/// <summary>
/// 出入库时需要进入新料架
/// </summary>
public bool NeedEnterShelf = true;
/// <summary>
/// 出入库结束后需要将料架送出
/// </summary>
public bool NeedOutShelf = true;
/// <summary>
/// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
/// </summary>
......
......@@ -202,7 +202,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始运行
/// </summary>
public abstract bool StartRun();
public abstract bool StartRun(bool isDebug = false);
/// <summary>
/// 停止运行
/// </summary>
......@@ -471,7 +471,15 @@ namespace OnlineStore.DeviceLibrary
{
return IOManager.IOValue(IoType, baseConfig.DeviceID);
}
/// <summary>
/// 阻塞等待IO信号,等到返回true,未等到返回false
/// </summary>c
public bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{
return WaitUtil.Wait(timeOut, delegate () {
return value.Equals(IOValue(ioType));
}, errName);
}
public void LogInfo(string logInfo)
{
LogUtil.info(Name + logInfo);
......
......@@ -159,71 +159,94 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
///料仓出库,,定位气缸下降
/// </summary>
SO_01_LocationCylinderDown =10101,
SO_31_LocationCylinderDown =10131,
/// <summary>
///料仓出库:叉子先运动到P1
/// </summary>
SO_02_DeviceBack =10102,
SO_32_DeviceBack =10132,
/// <summary>
/// 料仓出库,,所有轴运行到库位, 轴4( 压紧) 至P3(压紧前点) ,轴1( 转盘) 至P2( 库位点),轴2(上下) 至P5(库位出库前点)
/// </summary>
SO_03_ToBagPosition =10103,
SO_33_ToBagPosition =10133,
/// <summary>
/// 料仓出库,,叉子进入库位中, 轴3( 叉子) 至P3(库位取放料点)
/// </summary>
SO_04_DeviceToBag =10104,
SO_34_DeviceToBag =10134,
/// <summary>
///料仓出库,, 库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点)
/// </summary>
SO_05_BagWareToDevice =10105,
SO_35_BagWareToDevice =10135,
/// <summary>
///料仓出库,,叉子从 库位返回,轴3( 叉子) 至P1( 待机点)
/// </summary>
SO_06_BagDeviceBack =10106,
SO_36_BagDeviceBack =10136,
/// <summary>
/// 料仓出库,定位气缸伸出(有压紧轴的不需要此步骤 )
/// </summary>
SO_07_LocationCylinder_Up =10107,
SO_37_LocationCylinder_Up =10137,
/// <summary>
/// 料仓出库,走到料架位置,旋转轴至P101,升降轴至P102,
/// </summary>
SO_08_ToShelfPosition = 10108,
SO_38_ToShelfPosition = 10138,
/// <summary>
/// 料仓出库,定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回(Y104-1/PCI5O1-84) (Y104-2/PCI5O1-91) (Y104-2/PCI5O1-96) 退回到位
/// </summary>
SO_09_LocationCylinder_Down =10109,
SO_39_LocationCylinder_Down =10139,
/// <summary>
/// 等待门口无料盘
/// </summary>
SO_091_WaitNoTray =10115,
SO_40_WaitNoTray =10140,
/// <summary>
/// 料仓出库,叉子到料架,进出轴至P101
/// /// </summary>
SO_10_DeviceToShelf = 10110,
SO_41_DeviceToShelf = 10141,
/// <summary>
/// 料仓出库,,把物品放下,压紧轴到P1,升降轴至P101
/// </summary>
SO_11_DevicePutWare = 10111,
SO_42_DevicePutWare = 10142,
/// <summary>
/// 料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点)
/// </summary>
SO_12_DeviceOutFromDoor =10112,
SO_43_DeviceOutFromDoor =10143,
/// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary>
SO_13_GoBack =10113,
SO_44_GoBack =10144,
/// <summary>
/// 送出料架:顶升气缸下降
/// </summary>
SO_51_TopCylinder_Down = 10151,
/// <summary>
/// 送出料架:定位气缸下降
/// </summary>
SO_52_LocatinCylinder_Down = 10152,
/// <summary>
/// 送出料架:打开仓门
/// </summary>
SO_53_DoorOpen = 10153,
/// <summary>
/// 送出料架:线体反转
/// </summary>
SO_54_LineBack = 10154,
/// <summary>
/// 送出料架:等待取料工位无信号,入料口有信号
/// </summary>
SO_55_WaitInLineSingle = 10155,
/// <summary>
/// 等待拿走物品
/// 送出料架:再转动300时间
/// </summary>
SO_14_WaitTake =10114,
SO_56_WaitTime = 10156,
#endregion
......@@ -296,7 +319,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 料架入库:检测到线体入料口信号
/// </summary>
BI_01_LineIn_Check= 20001,
BI_01_LineIn_Check = 20001,
/// <summary>
/// 料架入库:入料口移门打开
/// </summary>
......@@ -443,18 +466,18 @@ namespace OnlineStore.DeviceLibrary
/// 送出料架:再转动300时间
/// </summary>
BS_06_WaitTime = 21006,
/// <summary>
/// 送出料架:停止转动
/// </summary>
BS_07_LineStop= 21007,
/// <summary>
/// 送出料架:通知调度系统拿走
/// </summary>
BS_08_CallAGV = 21008,
/// <summary>
/// 送出料架:关闭仓门
/// </summary>
BS_09_CloseDoor= 21009,
///// <summary>
///// 送出料架:停止转动
///// </summary>
//BS_07_LineStop= 21007,
///// <summary>
///// 送出料架:通知调度系统拿走
///// </summary>
//BS_08_CallAGV = 21008,
///// <summary>
///// 送出料架:关闭仓门
///// </summary>
//BS_09_CloseDoor= 21009,
#endregion
}
......
......@@ -266,7 +266,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitAgvAction( int arrive)
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 10;
wait.TargetPosition = arrive;
wait.IsEnd = false;
return wait;
}
public string ToStr()
{
if (WaitType == 1)
......@@ -301,13 +309,16 @@ namespace OnlineStore.DeviceLibrary
return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 ";
}else if (WaitType == 7)
{
return "料盘高度【" + HeightValue + "】 ";
return "料盘高度【" + TargetPosition + "】 ";
}else if (WaitType.Equals(8))
{
return "压紧轴压紧到位";
}else if (WaitType.Equals(9))
{
return "扫码完成";
}else if (WaitType.Equals(10))
{
return "agv小车状态:" + (Asa.Actions)TargetPosition;
}
else
{
......@@ -359,10 +370,8 @@ namespace OnlineStore.DeviceLibrary
/// 是否已经结束
/// </summary>
public bool IsEnd{ get; set; }
/// <summary>
/// 高度
/// </summary>
public int HeightValue { get; set; }
}
public enum StoreMoveType
{
......
......@@ -16,7 +16,13 @@ namespace OnlineStore.LoadCSVLibrary
: base(id, cid, type, filepath)
{
}
/// <summary>
/// PRO,AGV小车站号名称,AgvNodeName,B2,,,,,,,
/// </summary>
[ConfigProAttribute("AgvNodeName")]
public string AgvNodeName { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点目标速度 MiddleAxis_TargetSpeed 30000
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!