Commit fc3aba05 LN

增加AGV调度对接代码

1 个父辈 b4bf1814
正在显示 34 个修改的文件 包含 511 行增加151 行删除
......@@ -23,7 +23,7 @@ namespace ABBRobotTest
internal static string Cmd_moveput = "moveput";
internal static string Cmd_validateP = "validateP";
public static Dictionary<string, Client> ClientMap = new Dictionary<string, Client>();
public static Dictionary<string, TcpClientBean> ClientMap = new Dictionary<string, TcpClientBean>();
//最后一次软件控制移动到的位置
public static string LastSendPoint = "";
......@@ -43,7 +43,7 @@ namespace ABBRobotTest
}
if (!IsStart)
{
ClientMap = new Dictionary<string, Client>();
ClientMap = new Dictionary<string, TcpClientBean>();
if (tcpserver == null)
{
tcpserver = new TcpServer();
......@@ -60,12 +60,12 @@ namespace ABBRobotTest
}
}
private static void Tcpserver_AcceptClientEvent(Client client)
private static void Tcpserver_AcceptClientEvent(TcpClientBean client)
{
SaveRobotClient(client);
}
private static object MapLock = "";
private static void SaveRobotClient( Client client)
private static void SaveRobotClient( TcpClientBean client)
{
lock (MapLock)
{
......@@ -93,7 +93,7 @@ namespace ABBRobotTest
LogUtil.error("关闭 监听出错:" + ex.ToString());
}
}
private static void tcp_ReviceMsgEvent(Client client, string msg)
private static void tcp_ReviceMsgEvent(TcpClientBean client, string msg)
{
try
{
......@@ -110,7 +110,7 @@ namespace ABBRobotTest
}
}
private static bool ProcessMsg(Client client, string msg)
private static bool ProcessMsg(TcpClientBean client, string msg)
{
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
string add = clientipe.Address.ToString();
......@@ -172,7 +172,7 @@ namespace ABBRobotTest
}
private static bool SendMovePoint(string robotIp, string param1, string param2, string param3 = "L", string param4 = "10")
{
Client client = null;
TcpClientBean client = null;
lock (LockObj)
{
if (ClientMap.ContainsKey(robotIp))
......@@ -190,7 +190,7 @@ namespace ABBRobotTest
}
return false;
}
private static bool SendStrToClient(Client client, string sendMsg)
private static bool SendStrToClient(TcpClientBean client, string sendMsg)
{
if (client != null && client.ClientSocket.Connected)
{
......
此文件类型无法预览
此文件的差异被折叠, 点击展开。
......@@ -37,7 +37,9 @@
<add key="UseAIOBOX" value="1" />
<!--流水线监听端口-->
<add key="TCPServerPort" value="5246" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="192.168.103.22" />
<!--IO配置-->
<add key ="DIMS" value ="120"/>
<add key ="DOMS" value ="300"/>
<add key ="LineRunTest" value ="1"/>
......
......@@ -54,6 +54,9 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
......
......@@ -50,6 +50,7 @@
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.lblTrayNum = new System.Windows.Forms.Label();
this.lblInstoreList = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
......@@ -376,9 +377,9 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(6, 59);
this.lblThisSta.Location = new System.Drawing.Point(247, 29);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(770, 120);
this.lblThisSta.Size = new System.Drawing.Size(600, 120);
this.lblThisSta.TabIndex = 246;
this.lblThisSta.Text = "等待启动";
this.lblThisSta.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -481,6 +482,7 @@
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblTrayNum);
this.groupBox6.Controls.Add(this.lblInstoreList);
this.groupBox6.Controls.Add(this.lblThisSta);
......@@ -491,6 +493,17 @@
this.groupBox6.TabStop = false;
this.groupBox6.Text = "消息";
//
// lblMoveInfo
//
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(18, 29);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 279;
this.lblMoveInfo.Text = "运动信息:";
//
// lblTrayNum
//
this.lblTrayNum.AutoSize = true;
......@@ -498,9 +511,8 @@
this.lblTrayNum.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTrayNum.Location = new System.Drawing.Point(29, 29);
this.lblTrayNum.Name = "lblTrayNum";
this.lblTrayNum.Size = new System.Drawing.Size(68, 17);
this.lblTrayNum.Size = new System.Drawing.Size(0, 17);
this.lblTrayNum.TabIndex = 276;
this.lblTrayNum.Text = "托盘编码:";
this.lblTrayNum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblInstoreList
......@@ -508,9 +520,9 @@
this.lblInstoreList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInstoreList.ForeColor = System.Drawing.Color.Green;
this.lblInstoreList.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInstoreList.Location = new System.Drawing.Point(6, 207);
this.lblInstoreList.Location = new System.Drawing.Point(247, 177);
this.lblInstoreList.Name = "lblInstoreList";
this.lblInstoreList.Size = new System.Drawing.Size(770, 184);
this.lblInstoreList.Size = new System.Drawing.Size(600, 184);
this.lblInstoreList.TabIndex = 277;
//
// panel1
......@@ -609,6 +621,7 @@
private System.Windows.Forms.Button btnRun3;
private System.Windows.Forms.Button btnRun1;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblMoveInfo;
}
}
......@@ -78,8 +78,8 @@ namespace OnlineStore.AssemblyLine
{
ReadIOList();
//lblTrayNum.Text = "托盘编码:" + TrayManager.GetTrayNum(equipBean.DeviceID);
}
}
lblMoveInfo.Text = equipBean.GetMoveStr();
// string canOut = LineManager.Line.CanOutStore(equipBean.DeviceID) ? "可出库":"不可出库" ;
lblStoreStatus.Text = KTK_Store.GetRunStr(equipBean.lineStatus, equipBean.runStatus) ;
lblThisSta.Text = equipBean.WarnMsg;
......
......@@ -61,7 +61,8 @@
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lblTrayNum = new System.Windows.Forms.Label();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.lblAgvInfo = new System.Windows.Forms.Label();
this.lblInstoreList = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
......@@ -560,9 +561,9 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(124, 19);
this.lblThisSta.Location = new System.Drawing.Point(216, 19);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(825, 77);
this.lblThisSta.Size = new System.Drawing.Size(733, 77);
this.lblThisSta.TabIndex = 246;
this.lblThisSta.Text = "等待启动";
this.lblThisSta.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -680,7 +681,8 @@
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblTrayNum);
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblAgvInfo);
this.groupBox6.Controls.Add(this.lblInstoreList);
this.groupBox6.Controls.Add(this.lblThisSta);
this.groupBox6.Location = new System.Drawing.Point(403, 527);
......@@ -690,17 +692,27 @@
this.groupBox6.TabStop = false;
this.groupBox6.Text = "消息";
//
// lblTrayNum
// lblMoveInfo
//
this.lblTrayNum.AutoSize = true;
this.lblTrayNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTrayNum.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTrayNum.Location = new System.Drawing.Point(29, 29);
this.lblTrayNum.Name = "lblTrayNum";
this.lblTrayNum.Size = new System.Drawing.Size(68, 17);
this.lblTrayNum.TabIndex = 276;
this.lblTrayNum.Text = "托盘编码:";
this.lblTrayNum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(16, 69);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 278;
this.lblMoveInfo.Text = "运动信息:";
//
// lblAgvInfo
//
this.lblAgvInfo.AutoSize = true;
this.lblAgvInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAgvInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblAgvInfo.Location = new System.Drawing.Point(14, 29);
this.lblAgvInfo.Name = "lblAgvInfo";
this.lblAgvInfo.Size = new System.Drawing.Size(61, 17);
this.lblAgvInfo.TabIndex = 276;
this.lblAgvInfo.Text = "AGV 状态";
//
// lblInstoreList
//
......@@ -709,9 +721,9 @@
this.lblInstoreList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInstoreList.ForeColor = System.Drawing.Color.Green;
this.lblInstoreList.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInstoreList.Location = new System.Drawing.Point(6, 115);
this.lblInstoreList.Location = new System.Drawing.Point(216, 115);
this.lblInstoreList.Name = "lblInstoreList";
this.lblInstoreList.Size = new System.Drawing.Size(944, 81);
this.lblInstoreList.Size = new System.Drawing.Size(733, 109);
this.lblInstoreList.TabIndex = 277;
//
// groupBox7
......@@ -1141,7 +1153,7 @@
internal System.Windows.Forms.TextBox txtP1;
internal System.Windows.Forms.Button btnMoveToP1;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Label lblTrayNum;
private System.Windows.Forms.Label lblAgvInfo;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label lblInstoreList;
private System.Windows.Forms.GroupBox groupBox7;
......@@ -1172,6 +1184,7 @@
internal System.Windows.Forms.TextBox txtBP2;
private System.Windows.Forms.Button btnScan;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblMoveInfo;
}
}
......@@ -105,7 +105,8 @@ namespace OnlineStore.AssemblyLine
ReadIOList();
//lblTrayNum.Text = "托盘编码:" + TrayManager.GetTrayNum(equipBean.DeviceID);
}
lblAgvInfo.Text ="AGV-"+equipBean.Config.AgvInName +" 状态:"+ AgvClient.GetAction(equipBean.Config.AgvInName).ToString()+
"\nAGV-" + equipBean.Config.AgvOutName + " 状态:" + AgvClient.GetAction(equipBean.Config.AgvOutName).ToString() + "";
string canOut =equipBean.Config.IsCanOut.Equals(1) ? "紧急出料模块" : "入料模块";
lblStoreStatus.Text = KTK_Store.GetRunStr(equipBean.lineStatus, equipBean.runStatus) + "(" + canOut + ")";
lblThisSta.Text = equipBean.WarnMsg;
......@@ -122,7 +123,8 @@ namespace OnlineStore.AssemblyLine
if (!lblInstoreList.Text.Equals(text))
{
lblInstoreList.Text = text;
}
}
lblMoveInfo.Text = equipBean.GetMoveStr();
}
catch (Exception ex)
{
......
......@@ -68,6 +68,7 @@
this.txtP2 = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.lblName = new System.Windows.Forms.Label();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -406,9 +407,9 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(6, 59);
this.lblThisSta.Location = new System.Drawing.Point(274, 29);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(770, 120);
this.lblThisSta.Size = new System.Drawing.Size(578, 120);
this.lblThisSta.TabIndex = 246;
this.lblThisSta.Text = "等待启动";
this.lblThisSta.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -525,6 +526,7 @@
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblTrayNum);
this.groupBox6.Controls.Add(this.lblInstoreList);
this.groupBox6.Controls.Add(this.lblThisSta);
......@@ -542,9 +544,8 @@
this.lblTrayNum.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTrayNum.Location = new System.Drawing.Point(29, 29);
this.lblTrayNum.Name = "lblTrayNum";
this.lblTrayNum.Size = new System.Drawing.Size(68, 17);
this.lblTrayNum.Size = new System.Drawing.Size(0, 17);
this.lblTrayNum.TabIndex = 276;
this.lblTrayNum.Text = "托盘编码:";
this.lblTrayNum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblInstoreList
......@@ -552,9 +553,9 @@
this.lblInstoreList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInstoreList.ForeColor = System.Drawing.Color.Green;
this.lblInstoreList.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInstoreList.Location = new System.Drawing.Point(6, 207);
this.lblInstoreList.Location = new System.Drawing.Point(274, 163);
this.lblInstoreList.Name = "lblInstoreList";
this.lblInstoreList.Size = new System.Drawing.Size(770, 184);
this.lblInstoreList.Size = new System.Drawing.Size(578, 184);
this.lblInstoreList.TabIndex = 277;
//
// tabPage2
......@@ -748,6 +749,17 @@
this.lblName.Text = "出料流水线";
this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblMoveInfo
//
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(13, 29);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 280;
this.lblMoveInfo.Text = "运动信息:";
//
// FrmMoveEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -834,6 +846,7 @@
private System.Windows.Forms.Label label5;
private AxisMoveControl axisMoveControl1;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblMoveInfo;
}
}
......@@ -107,7 +107,7 @@ namespace OnlineStore.AssemblyLine
ReadIOList();
//lblTrayNum.Text = "托盘编码:" + TrayManager.GetTrayNum(equipBean.DeviceID);
}
lblMoveInfo.Text = equipBean.GetMoveStr();
string canOut = LineManager.Line.CanOutStore(equipBean.DeviceID) ? "可出库" : "不可出库";
lblStoreStatus.Text = KTK_Store.GetRunStr(equipBean.lineStatus, equipBean.runStatus) + "(" + canOut + ")";
lblThisSta.Text = equipBean.WarnMsg;
......
......@@ -67,6 +67,7 @@
this.axisMoveControl1 = new OnlineStore.AssemblyLine.AxisMoveControl();
this.panel1 = new System.Windows.Forms.Panel();
this.lblName = new System.Windows.Forms.Label();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -405,9 +406,9 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(6, 59);
this.lblThisSta.Location = new System.Drawing.Point(255, 29);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(770, 120);
this.lblThisSta.Size = new System.Drawing.Size(597, 120);
this.lblThisSta.TabIndex = 246;
this.lblThisSta.Text = "等待启动";
this.lblThisSta.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -511,6 +512,7 @@
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblTrayNum);
this.groupBox6.Controls.Add(this.lblInstoreList);
this.groupBox6.Controls.Add(this.lblThisSta);
......@@ -528,9 +530,8 @@
this.lblTrayNum.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTrayNum.Location = new System.Drawing.Point(29, 29);
this.lblTrayNum.Name = "lblTrayNum";
this.lblTrayNum.Size = new System.Drawing.Size(68, 17);
this.lblTrayNum.Size = new System.Drawing.Size(0, 17);
this.lblTrayNum.TabIndex = 276;
this.lblTrayNum.Text = "托盘编码:";
this.lblTrayNum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblInstoreList
......@@ -538,9 +539,9 @@
this.lblInstoreList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInstoreList.ForeColor = System.Drawing.Color.Green;
this.lblInstoreList.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInstoreList.Location = new System.Drawing.Point(6, 207);
this.lblInstoreList.Location = new System.Drawing.Point(255, 177);
this.lblInstoreList.Name = "lblInstoreList";
this.lblInstoreList.Size = new System.Drawing.Size(770, 184);
this.lblInstoreList.Size = new System.Drawing.Size(597, 184);
this.lblInstoreList.TabIndex = 277;
//
// tabPage2
......@@ -733,6 +734,17 @@
this.lblName.Text = "出料流水线";
this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblMoveInfo
//
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(18, 29);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 280;
this.lblMoveInfo.Text = "运动信息:";
//
// FrmProvidingEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -818,6 +830,7 @@
internal System.Windows.Forms.Button btnP2;
internal System.Windows.Forms.TextBox txtP2;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblMoveInfo;
}
}
......@@ -79,9 +79,10 @@ namespace OnlineStore.AssemblyLine
{
ReadIOList();
//lblTrayNum.Text = "托盘编码:" + TrayManager.GetTrayNum(equipBean.DeviceID);
}
// string canOut = LineManager.Line.CanOutStore(equipBean.DeviceID) ? "可出库":"不可出库" ;
}
lblMoveInfo.Text = equipBean.GetMoveStr();
// string canOut = LineManager.Line.CanOutStore(equipBean.DeviceID) ? "可出库":"不可出库" ;
lblStoreStatus.Text = KTK_Store.GetRunStr(equipBean.lineStatus, equipBean.runStatus) ;
lblThisSta.Text = equipBean.WarnMsg;
//string text = "";
......
......@@ -79,7 +79,7 @@ namespace OnlineStore.AssemblyLine
private void button1_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
RFIDData data = RFIDManager.ReadData(ip);
RFIDData data = RFIDManager.ReadRFIDData(ip);
string resul = "";
if (data != null)
{
......
......@@ -18,7 +18,23 @@
agv流程:
D1(上料模块入口)
1.AGV发送Actions.Usable
2.D1 返回true或false
3.小车到达,AGV发送Actions.Arrive
4.D1调用 SendRFID
5.DI 调用 MayEnter 12
5.料架进入入口后,D1调用 FinishEnter 13
D2(上料模块出口)
1.D2调用ReadyEmpty
2.小车到达,AGV发送Actions.Arrive
3.D2调用MayOut
4.料架进入小车后,AGV发送Actions.FinishOut
......
......@@ -76,5 +76,6 @@ namespace OnlineStore.Common
public static string ABBServerPort = "ABBServerPort";
public static string OpenRFIDWrite = "OpenRFIDWrite";
public static string DefaultPWD = "DefaultPWD";
public static string AgvServerIp = "AgvServerIp";
}
}
......@@ -20,14 +20,14 @@ namespace OnlineStore.Common
private Thread m_serverThread;
private Socket m_serverSocket;
public delegate void ReviceMsg(Client client, string Msg);
public delegate void ReviceMsg(TcpClientBean client, string Msg);
public event ReviceMsg ReviceMsgEvent;
private delegate void ReceiveMessageDelegate(Client client);
private delegate void ReceiveMessageDelegate(TcpClientBean client);
public event AcceptClientDelegate AcceptClientEvent;
public delegate void AcceptClientDelegate(Client client);
public delegate void AcceptClientDelegate(TcpClientBean client);
ReceiveMessageDelegate receiveMessageDelegate;
private bool isRun = true;
private void logLocalIp()
......@@ -100,7 +100,7 @@ namespace OnlineStore.Common
{
while (isRun)
{
Client client = new Client();
TcpClientBean client = new TcpClientBean();
try
{
client.ClientSocket = m_serverSocket.Accept();
......@@ -122,7 +122,7 @@ namespace OnlineStore.Common
private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
private int receiveBufferSize = 1024;
private string terminateString = ";";
public void ReceiveMessages(Client client) //这个函数会被以线程方式运行
public void ReceiveMessages(TcpClientBean client) //这个函数会被以线程方式运行
{
try
{
......@@ -249,11 +249,11 @@ namespace OnlineStore.Common
/// <summary>
/// 客户端会话信息类
/// </summary>
public class Client
public class TcpClientBean
{
Socket m_clientSocket;
public Client() { }
public TcpClientBean() { }
public IPAddress ipAdd { get; set; }
public Socket ClientSocket
{
......
......@@ -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">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
......@@ -62,6 +65,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="agvClient\AgvClient.cs" />
<Compile Include="assemblymanager\ALineManager.cs" />
<Compile Include="assemblyLine\DischargeLine.cs" />
<Compile Include="assemblyLine\DischargeLine_Partial.cs" />
......@@ -72,6 +76,7 @@
<Compile Include="assemblymanager\StoreServerManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\WaitUtil.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" />
<Compile Include="deviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" />
......
......@@ -4,6 +4,8 @@ PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,1,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D5,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D6,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,1,COM1,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,10000,,,,,
......
......@@ -4,6 +4,8 @@ PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,0,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D3,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D4,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,3,COM1,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,10000,,,,,
......
......@@ -4,6 +4,8 @@ PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,2,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D1,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D2,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,5,COM1,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,10000,,,,,
......
......@@ -4,6 +4,8 @@ PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,3,,,,,
PRO,0,是否是用来出料,IsCanOut,1,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D7,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D8,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,7,COM1,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,10000,,,,,
......
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 LineManager.Line.FeedAGVProcess(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());
}
}
}
}
......@@ -12,8 +12,7 @@ namespace OnlineStore.DeviceLibrary
public abstract class EquipBase : KTK_Store
{
public bool IsDebug = false;
internal AxisAlarmInfo AxisAlarm = new AxisAlarmInfo();
public bool IsDebug = false;
public bool UseAxis = false;
public List<InOutParam> waitOutStoreList = new List<InOutParam>();
public List<InOutParam> waitInStoreList = new List<InOutParam>();
......@@ -448,5 +447,19 @@ namespace OnlineStore.DeviceLibrary
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
LogUtil.info(Name + "【" + posId + "】" + msg);
}
public string GetMoveStr()
{
string msg = "";
int tLength = 12;
msg += "preTrayNum:".PadRight(tLength, ' ') + preTrayNum + "\n";
msg += "currTrayNum:".PadRight(tLength, ' ') + currTrayNum + "\n";
msg += "MoveType:".PadRight(tLength, ' ') + MoveInfo.MoveType+"\n";
msg += "MoveStep:".PadRight(tLength, ' ') + MoveInfo.MoveStep + "\n";
msg += "SMoveType:".PadRight(tLength, ' ') + SecondMoveInfo.MoveType + "\n";
msg += "SMoveType:".PadRight(tLength, ' ') + SecondMoveInfo.MoveStep + "";
return msg;
}
}
}
......@@ -355,21 +355,34 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 入料流程
private bool StartInStoreP()
{
//若定位工位,阻挡工位,入料口有一个有料架,需要进行处理
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
//若定位工位,阻挡工位,料架,需要进行处理
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
{
StartInStoreMove(null);
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
//小车到达,开始处理
if (runStatus >= (LineRunStatus.Runing) &&
MoveInfo.MoveType.Equals(LineMoveType.None) &&
ProcessReviceShelf.Equals(false) &&
IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.LOW))
{
ShelfEnterProcess();
}
}
else if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
//线体出口检测到料架,需要通知AGV小车
AgvClient.ReadyEmpty(Config.AgvOutName);
// SendShelfToAGV();
}
return false ;
return false;
}
public override bool StartInStoreMove(InOutParam param)
{
......@@ -380,11 +393,7 @@ namespace OnlineStore.DeviceLibrary
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
InStoreLog(" 定位工位检测到料架:FI_07_LocationCylinder_Up缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
FI_07_ShelfLocationUP();
}
else
{
......@@ -394,6 +403,17 @@ namespace OnlineStore.DeviceLibrary
}
return true ;
}
/// <summary>
/// 检测到上料工位有料架,缓冲阻挡上升,定位气缸上升,准备入料
/// </summary>
private void FI_07_ShelfLocationUP()
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
InStoreLog(" 定位工位检测到料架:FI_07_LocationCylinder_Up缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
}
private void LineInStoreProcess()
{
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
......@@ -401,11 +421,7 @@ namespace OnlineStore.DeviceLibrary
//判断是哪个工位有料架
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
InStoreLog(" FI_07_LocationCylinder_Up 定位工位检测到料架:缓冲阻挡上升, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
FI_07_ShelfLocationUP();
}
//阻挡工位有料架,流水线转动一个工位
else if (IOValue(IO_Type.SL_Stop_Check).Equals(IO_VALUE.HIGH))
......@@ -418,25 +434,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FI_03_InLineStart 入料检测:阻挡检测有料架,进料阻挡上升,缓冲阻挡下降,流水线转动2000");
}
else if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.HIGH))
{
//判断料架的编码是否正确
int num = TrayManager.GetShelfNum(DeviceID);
if (num <= 0)
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info(" 入料检测有料架,获取不到正确的料架编号,入料结束");
return;
}
MoveInfo.NextMoveStep(LineMoveStep.FI_03_LineStart);
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.HIGH);//进料阻挡下降
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡上升
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//等待指定时间
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InStoreLog(" FI_03_InLineStart 入料检测:入料检测有料架,进料阻挡下降,缓冲阻挡上升,流水线转动2000");
}
else
{
MoveInfo.EndMove();
......@@ -475,30 +472,7 @@ namespace OnlineStore.DeviceLibrary
{
LineInStoreProcess();
}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_04_LineRunCheck))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_05_LineStart);
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
// IOMove(IO_Type.SL_Entry_Check, IO_VALUE.LOW);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Stop_Check, IO_VALUE.LOW));
// InStoreLog(" FI_05_InLineStart 开始:进料线体运转,进料阻挡上升,等待SL_Stop_Check=0");
// IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_05_LineStart))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_06_LineRunCheck);
// IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Location_Check, IO_VALUE.HIGH));
// InStoreLog(" FI_06_InLineRun 开始:SL_Location_Check=1");
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_06_LineRunCheck))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_07_LocationCylinder_Up);
// InStoreLog(" FI_07_LocationCylinder_Up 开始:进料线体停止,定位气缸上升");
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
// CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
//}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_07_LocationCylinder_Up))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_08_BatchAxisToP2);
......@@ -685,25 +659,28 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_38_TopCylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_39_OutLineRun);
InStoreLog(" FI_39_OutLineRun 上料完成, 出口线体运转,料架到达出口处, 通知AGV取空料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_40_OutLineRun);
InStoreLog(" FI_40_OutLineRun 上料完成, AGV到达,继续转动出口线体,送走出料料架, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_41_OutLineRun);
InStoreLog(" FI_41_OutLineRun 上料完成, 上料完成, 料架送出, ");
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_41_OutLineRun))
{
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
LogUtil.info("空料架已送出,入料结束");
// MoveInfo.NextMoveStep(LineMoveStep.FI_39_OutLineRun);
InStoreLog(" 上料完成, ,料架到达出口处, 通知AGV取空料架, 入料流程结束");
AgvClient.ReadyEmpty(Config.AgvOutName);
}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_40_OutLineRun);
// InStoreLog(" FI_40_OutLineRun 上料完成, AGV到达,继续转动出口线体,送走出料料架, ");
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_40_OutLineRun))
//{
// MoveInfo.NextMoveStep(LineMoveStep.FI_41_OutLineRun);
// InStoreLog(" FI_41_OutLineRun 上料完成, 上料完成, 料架送出, ");
//}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_41_OutLineRun))
//{
// MoveInfo.EndMove();
// runStatus = LineRunStatus.Runing;
// LogUtil.info("空料架已送出,入料结束");
//}
}
private void BatchAxisToP3()
{
......
......@@ -83,6 +83,9 @@ namespace OnlineStore.DeviceLibrary
foreach (FeedingEquip_Config config in feedMap.Values)
{
FeedingEquip equip = new FeedingEquip(lineConfig.CID, config);
//增加AGV小车客户端
AgvClient.NodeList.Add(config.AgvInName);
AgvClient.NodeList.Add(config.AgvOutName);
AddDeviceName(ioList, config.IOIPList);
FeedingEquipMap.Add(config.Id, equip);
......@@ -190,6 +193,13 @@ namespace OnlineStore.DeviceLibrary
else
{
LogUtil.info( Name + "开始启动,启动时间:" + StartTime.ToString());
//连接AGV调度
if (!AgvClient.ISConnected())
{
AgvClient.Init();
}
runStatus = LineRunStatus.HomeMoving;
StartTime = DateTime.Now;
......@@ -205,8 +215,7 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer.Enabled = true;
mainTimer.Enabled = true;
return true;
}
return false;
}
}
private void EquipStartRun(EquipBase moveEquip)
{
......
......@@ -811,7 +811,23 @@ namespace OnlineStore.DeviceLibrary
}
// LogUtil.error("runStatus【" + runStatus + "】,move.MoveInfo.MoveType【" + move.MoveInfo.MoveType + "】,move.runStatus【" + move.runStatus + "】 ");
return false;
}
}
#endregion
#region AGV小车判断
internal bool FeedAGVProcess(string name, Asa.Actions action)
{
foreach (FeedingEquip feed in FeedingEquipMap.Values)
{
if (feed.Config.AgvInName.Equals(name) || feed.Config.AgvOutName.Equals(name))
{
return feed.ProcessAGVAction(name, action);
}
}
LogUtil.error("收到agv调度Actions【" + name + "】=【" + action + "】,未找到对应的设备");
return false;
}
#endregion
}
}
......@@ -199,7 +199,7 @@ namespace OnlineStore.DeviceLibrary
{
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = RFIDManager.ReadData(ip);
RFIDData data = RFIDManager.ReadRFIDData(ip);
if (data != null)
{
if (data.RFType.Equals("E"))
......@@ -217,7 +217,7 @@ namespace OnlineStore.DeviceLibrary
{
string ip = GetRFIP(subType, 1);
//获取盘号
RFIDData data = RFIDManager.ReadData(ip);
RFIDData data = RFIDManager.ReadRFIDData(ip);
if (data != null)
{
if (data.RFType.Equals("B"))
......@@ -231,6 +231,13 @@ namespace OnlineStore.DeviceLibrary
}
return 0;
}
public static byte[] GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
//获取盘号
byte[] data = RFIDManager.ReadData(ip);
return data;
}
public static string GetRFIP(int subType, int rtType = 0)
{
string ip = "";
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
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);
}
}
}
}
......@@ -134,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = obj.ToData();
return WriteData(IP, sendData, 3);
}
public static RFIDData ReadData(string IP)
public static RFIDData ReadRFIDData(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 = "";
......
......@@ -354,6 +354,15 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + logInfo);
}
/// <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);
}
}
}
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
private static int ClientKeepSecond = 10;
public static Dictionary<int, BoxInfo> BoxMap = new Dictionary<int, BoxInfo>();
public static Dictionary<int, Client> ClientMap = new Dictionary<int, Client>();
public static Dictionary<int, TcpClientBean> ClientMap = new Dictionary<int, TcpClientBean>();
public static BoxInfo GetBoxInfo(int id)
{
......@@ -164,7 +164,7 @@ namespace OnlineStore.DeviceLibrary
{
if (!IsStart)
{
ClientMap = new Dictionary<int, Client>();
ClientMap = new Dictionary<int, TcpClientBean>();
BoxMap = new Dictionary<int, BoxInfo>();
if (tcpserver == null)
{
......@@ -203,7 +203,7 @@ namespace OnlineStore.DeviceLibrary
paramList.Add(S_CanOutStore, canOutStore);
paramList.Add(S_IsDebug, isDebug);
string msg = ToParamStr(paramList);
Client client = ClientMap[id];
TcpClientBean client = ClientMap[id];
bool result = SendStrToClient(client, msg);
if (!result)
{
......@@ -225,7 +225,7 @@ namespace OnlineStore.DeviceLibrary
paramList.Add(S_WareCode, param.WareCode);
// string msg = cmd_startIn+cmd_spilt+param.PosId+cmd_spilt+param.PlateH+cmd_spilt+param.PlateW+cmd_spilt+"\r";
string msg = ToParamStr(paramList);
Client client = ClientMap[id];
TcpClientBean client = ClientMap[id];
bool result = SendStrToClient(client, msg);
if (!result)
{
......@@ -266,7 +266,7 @@ namespace OnlineStore.DeviceLibrary
paramList.Add(S_WareCode, param.WareCode);
// string msg = cmd_startIn+cmd_spilt+param.PosId+cmd_spilt+param.PlateH+cmd_spilt+param.PlateW+cmd_spilt+"\r";
string msg = ToParamStr(paramList);
Client client = ClientMap[id];
TcpClientBean client = ClientMap[id];
bool result = SendStrToClient(client, msg);
if (!result)
{
......@@ -289,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
private static bool SendStrToClient(Client client, string sendMsg)
private static bool SendStrToClient(TcpClientBean client, string sendMsg)
{
if (client != null && client.ClientSocket.Connected)
{
......@@ -308,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
return result + "\r";
}
private static object MapLock = "";
private static void SaveBoxClient(int id, BoxInfo box, Client client)
private static void SaveBoxClient(int id, BoxInfo box, TcpClientBean client)
{
lock (MapLock)
{
......@@ -325,7 +325,7 @@ namespace OnlineStore.DeviceLibrary
ClientMap.Add(id, client);
}
}
private static void tcp_ReviceMsgEvent(Client client, string msg)
private static void tcp_ReviceMsgEvent(TcpClientBean client, string msg)
{
try
{
......@@ -342,7 +342,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private static bool ProcessMsg(Client client, string msg)
private static bool ProcessMsg(TcpClientBean client, string msg)
{
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
string add = clientipe.Address.ToString();
......
......@@ -38,6 +38,19 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("SidesWayNum",false)]
public int SidesWayNum { get; set; }
/// <summary>
/// PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D3,,,,,
/// </summary>
[ConfigProAttribute("AgvInName", false)]
public string AgvInName { get; set; }
/// <summary>
/// PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D4,,,,
/// </summary>
[ConfigProAttribute("AgvOutName", false)]
public string AgvOutName { get; set; }
/// <summary>
/// PRO 0 移栽上下运动是否使用伺服 UpDownUseAxis 1
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!