Commit a74df382 LN

RFID修改

1 个父辈 ba43dd79
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
...@@ -55,9 +55,8 @@ ...@@ -55,9 +55,8 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup /> <PropertyGroup />
<ItemGroup> <ItemGroup>
<Reference Include="Asa.RFID, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ClassLibrary1">
<SpecificVersion>False</SpecificVersion> <HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
</Reference> </Reference>
<Reference Include="Client"> <Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath> <HintPath>..\..\dll\Client.dll</HintPath>
...@@ -152,12 +151,6 @@ ...@@ -152,12 +151,6 @@
<Compile Include="FrmLineStore.Designer.cs"> <Compile Include="FrmLineStore.Designer.cs">
<DependentUpon>FrmLineStore.cs</DependentUpon> <DependentUpon>FrmLineStore.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmRFIPEdit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmRFIPEdit.Designer.cs">
<DependentUpon>FrmRFIPEdit.cs</DependentUpon>
</Compile>
<Compile Include="FrmPwd.cs"> <Compile Include="FrmPwd.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -200,9 +193,6 @@ ...@@ -200,9 +193,6 @@
<EmbeddedResource Include="FrmLineStore.resx"> <EmbeddedResource Include="FrmLineStore.resx">
<DependentUpon>FrmLineStore.cs</DependentUpon> <DependentUpon>FrmLineStore.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmRFIPEdit.resx">
<DependentUpon>FrmRFIPEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmPwd.resx"> <EmbeddedResource Include="FrmPwd.resx">
<DependentUpon>FrmPwd.cs</DependentUpon> <DependentUpon>FrmPwd.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -51,27 +51,27 @@ ...@@ -51,27 +51,27 @@
this.lblConInfo.Name = "lblConInfo"; this.lblConInfo.Name = "lblConInfo";
this.lblConInfo.Size = new System.Drawing.Size(80, 20); this.lblConInfo.Size = new System.Drawing.Size(80, 20);
this.lblConInfo.TabIndex = 0; this.lblConInfo.TabIndex = 0;
this.lblConInfo.Text = "lblConInfo"; this.lblConInfo.Text = "IO连接信息";
// //
// lblRFID // lblRFID
// //
this.lblRFID.AutoSize = true; this.lblRFID.AutoSize = true;
this.lblRFID.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblRFID.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblRFID.Location = new System.Drawing.Point(309, 73); this.lblRFID.Location = new System.Drawing.Point(321, 73);
this.lblRFID.Name = "lblRFID"; this.lblRFID.Name = "lblRFID";
this.lblRFID.Size = new System.Drawing.Size(50, 20); this.lblRFID.Size = new System.Drawing.Size(82, 20);
this.lblRFID.TabIndex = 1; this.lblRFID.TabIndex = 1;
this.lblRFID.Text = "label1"; this.lblRFID.Text = "RFID信息:";
// //
// lblBox // lblBox
// //
this.lblBox.AutoSize = true; this.lblBox.AutoSize = true;
this.lblBox.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblBox.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBox.Location = new System.Drawing.Point(549, 73); this.lblBox.Location = new System.Drawing.Point(627, 73);
this.lblBox.Name = "lblBox"; this.lblBox.Name = "lblBox";
this.lblBox.Size = new System.Drawing.Size(50, 20); this.lblBox.Size = new System.Drawing.Size(93, 20);
this.lblBox.TabIndex = 2; this.lblBox.TabIndex = 2;
this.lblBox.Text = "label2"; this.lblBox.Text = "料仓连接信息";
// //
// lblMsg // lblMsg
// //
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(961, 708); this.ClientSize = new System.Drawing.Size(980, 708);
this.Controls.Add(this.btnExit); this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnUpdate); this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.lblMsg); this.Controls.Add(this.lblMsg);
......
...@@ -38,13 +38,13 @@ namespace OnlineStore.AssemblyLine ...@@ -38,13 +38,13 @@ namespace OnlineStore.AssemblyLine
} }
lblConInfo.Text += msg; lblConInfo.Text += msg;
lblRFID.Text = "RFID连接信息:\r\n"; lblRFID.Text = "RFID信息:\r\n";
msg = ""; msg = "";
List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values); List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
foreach (string ip in tList) foreach (string ip in tList)
{ {
string con = (RFIDManager.IsConnect(ip)) ? " ✔" : " ✘"; string con = TrayManager.ReadRFID(ip) .ToStr() ;
msg += ("RFID[" + ip + "]").PadLeft(26, ' ') + con + "\n"; msg += ("RFID[" + ip + "]").PadLeft(26, ' ') + con + "\n";
} }
lblRFID.Text += msg; lblRFID.Text += msg;
......
...@@ -398,61 +398,61 @@ ...@@ -398,61 +398,61 @@
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
// //
// 启动AToolStripMenuItem // 启动AToolStripMenuItem
// //
this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem"; this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem";
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.启动AToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启动AToolStripMenuItem.Text = "启动 "; this.启动AToolStripMenuItem.Text = "启动 ";
this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click); this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click);
// //
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
// //
// 复位RToolStripMenuItem // 复位RToolStripMenuItem
// //
this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem"; this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem";
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.复位RToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复位RToolStripMenuItem.Text = "复位"; this.复位RToolStripMenuItem.Text = "复位";
this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click); this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
// //
// 停止TToolStripMenuItem // 停止TToolStripMenuItem
// //
this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem"; this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem";
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.停止TToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.停止TToolStripMenuItem.Text = "停止"; this.停止TToolStripMenuItem.Text = "停止";
this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click); this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click);
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
// //
// 入库模式ToolStripMenuItem // 入库模式ToolStripMenuItem
// //
this.入库模式ToolStripMenuItem.Name = "入库模式ToolStripMenuItem"; this.入库模式ToolStripMenuItem.Name = "入库模式ToolStripMenuItem";
this.入库模式ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.入库模式ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.入库模式ToolStripMenuItem.Text = "入库模式"; this.入库模式ToolStripMenuItem.Text = "入库模式";
this.入库模式ToolStripMenuItem.Visible = false; this.入库模式ToolStripMenuItem.Visible = false;
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator2.Visible = false; this.toolStripSeparator2.Visible = false;
// //
// 退出ToolStripMenuItem // 退出ToolStripMenuItem
// //
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1); this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1);
// //
...@@ -473,7 +473,7 @@ ...@@ -473,7 +473,7 @@
// 扫码测试ToolStripMenuItem // 扫码测试ToolStripMenuItem
// //
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem"; this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(162, 26); this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试"; this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Visible = false; this.扫码测试ToolStripMenuItem.Visible = false;
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click); this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
...@@ -481,37 +481,39 @@ ...@@ -481,37 +481,39 @@
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(159, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Visible = false; this.toolStripSeparator6.Visible = false;
// //
// 二维码学习ToolStripMenuItem // 二维码学习ToolStripMenuItem
// //
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem"; this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(162, 26); this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习"; this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click); this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
// //
// toolStripSeparator7 // toolStripSeparator7
// //
this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(159, 6); this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator7.Visible = false;
// //
// 托盘初始化ToolStripMenuItem // 托盘初始化ToolStripMenuItem
// //
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem"; this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(162, 26); this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码"; this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
this.托盘初始化ToolStripMenuItem.Visible = false;
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click); this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(159, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
// //
// iO模块状态ToolStripMenuItem // iO模块状态ToolStripMenuItem
// //
this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem"; this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem";
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(162, 26); this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.iO模块状态ToolStripMenuItem.Text = "IO模块状态"; this.iO模块状态ToolStripMenuItem.Text = "IO模块状态";
this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click); this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click);
// //
...@@ -526,7 +528,7 @@ ...@@ -526,7 +528,7 @@
// 版本号ToolStripMenuItem // 版本号ToolStripMenuItem
// //
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem"; this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.版本号ToolStripMenuItem.Text = "关于软件"; this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click); this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
// //
......
...@@ -260,7 +260,7 @@ namespace OnlineStore.AssemblyLine ...@@ -260,7 +260,7 @@ namespace OnlineStore.AssemblyLine
//AIManager.CloseConnect(); //AIManager.CloseConnect();
ACServerManager.CloseAllPort(); ACServerManager.CloseAllPort();
// CodeManager.CloseAllCamera(); // CodeManager.CloseAllCamera();
RFIDManager.CloseAllConnection(); TrayManager.RfidReader.Close();
//this.Close(); //this.Close();
System.Environment.Exit(System.Environment.ExitCode); System.Environment.Exit(System.Environment.ExitCode);
} }
...@@ -710,8 +710,8 @@ namespace OnlineStore.AssemblyLine ...@@ -710,8 +710,8 @@ namespace OnlineStore.AssemblyLine
private void 托盘初始化ToolStripMenuItem_Click(object sender, EventArgs e) private void 托盘初始化ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
FrmRFIPEdit FRM = new FrmRFIPEdit(); //FrmRFIPEdit FRM = new FrmRFIPEdit();
FRM.ShowDialog(); //FRM.ShowDialog();
} }
private void iO模块状态ToolStripMenuItem_Click(object sender, EventArgs e) private void iO模块状态ToolStripMenuItem_Click(object sender, EventArgs e)
......
...@@ -260,6 +260,7 @@ ...@@ -260,6 +260,7 @@
this.groupBox1.TabIndex = 290; this.groupBox1.TabIndex = 290;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "搜索RFID"; this.groupBox1.Text = "搜索RFID";
this.groupBox1.Visible = false;
// //
// listView1 // listView1
// //
...@@ -311,6 +312,7 @@ ...@@ -311,6 +312,7 @@
this.btnClose.TabIndex = 287; this.btnClose.TabIndex = 287;
this.btnClose.Text = "关闭"; this.btnClose.Text = "关闭";
this.btnClose.UseVisualStyleBackColor = false; this.btnClose.UseVisualStyleBackColor = false;
this.btnClose.Visible = false;
this.btnClose.Click += new System.EventHandler(this.button2_Click); this.btnClose.Click += new System.EventHandler(this.button2_Click);
// //
// btnConnect // btnConnect
...@@ -323,6 +325,7 @@ ...@@ -323,6 +325,7 @@
this.btnConnect.TabIndex = 286; this.btnConnect.TabIndex = 286;
this.btnConnect.Text = "连接"; this.btnConnect.Text = "连接";
this.btnConnect.UseVisualStyleBackColor = false; this.btnConnect.UseVisualStyleBackColor = false;
this.btnConnect.Visible = false;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
// //
// FrmRFIPEdit // FrmRFIPEdit
......
 
using Asa.RFID;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System; using System;
...@@ -61,14 +61,14 @@ namespace OnlineStore.AssemblyLine ...@@ -61,14 +61,14 @@ namespace OnlineStore.AssemblyLine
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
{ {
string ip = txtIP.Text; //string ip = txtIP.Text;
char type = comType.Text.ToCharArray()[0]; //char type = comType.Text.ToCharArray()[0];
int value = (int)numNum.Value; //int value = (int)numNum.Value;
DialogResult result = MessageBox.Show( "确定将【"+comboxType.Text+"】当前的托盘编号定为【"+value+"】?", "确定提示", MessageBoxButtons.OKCancel); //DialogResult result = MessageBox.Show( "确定将【"+comboxType.Text+"】当前的托盘编号定为【"+value+"】?", "确定提示", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK)) //if (result.Equals(DialogResult.OK))
{ //{
RFIDManager.WriteData(ip, new RFIDData(value, type)); // RFIDManager.WriteData(ip, new RFIDData(value, type));
} //}
} }
private void btnBack_Click(object sender, EventArgs e) private void btnBack_Click(object sender, EventArgs e)
...@@ -80,7 +80,7 @@ namespace OnlineStore.AssemblyLine ...@@ -80,7 +80,7 @@ namespace OnlineStore.AssemblyLine
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
string ip = txtIP.Text; string ip = txtIP.Text;
RFIDData data = RFIDManager.ReadData(ip); RFIDData data = TrayManager.ReadRFID(ip);
string resul = ""; string resul = "";
if (data != null) if (data != null)
{ {
...@@ -105,77 +105,77 @@ namespace OnlineStore.AssemblyLine ...@@ -105,77 +105,77 @@ namespace OnlineStore.AssemblyLine
{ {
txtIP.Text = V; txtIP.Text = V;
} }
if (RFIDManager.RFReaderMap.ContainsKey(V)) //if (RFIDManager.RFReaderMap.ContainsKey(V))
{ //{
btnConnect.Enabled = false; // btnConnect.Enabled = false;
btnClose.Enabled = true; // btnClose.Enabled = true;
} //}
else //else
{ //{
btnClose.Enabled = false; // btnClose.Enabled = false;
btnConnect.Enabled = true; // btnConnect.Enabled = true;
} //}
} }
} }
private void btnFind_Click(object sender, EventArgs e) private void btnFind_Click(object sender, EventArgs e)
{ {
string ip = txtIP.Text; //string ip = txtIP.Text;
bool result = RFIDManager.FindRFID(ip); //bool result = RFIDManager.FindRFID(ip);
if (result) //if (result)
{ //{
lblHas.Text = "有标签"; // lblHas.Text = "有标签";
lblHas.ForeColor = Color.Green; // lblHas.ForeColor = Color.Green;
} //}
else //else
{ //{
lblHas.Text = "无标签"; // lblHas.Text = "无标签";
lblHas.ForeColor = Color.Red; // lblHas.ForeColor = Color.Red;
} //}
} }
private void btnSearch_Click(object sender, EventArgs e) private void btnSearch_Click(object sender, EventArgs e)
{ {
string text = cmbLocalIp.Text; //string text = cmbLocalIp.Text;
string[] ip = RFIDManager.SearchIP(text); //string[] ip = RFIDManager.SearchIP(text);
foreach(string ipstr in ip) //foreach(string ipstr in ip)
{ //{
listView1.Items.Add(ipstr); // listView1.Items.Add(ipstr);
} //}
} }
private void btnConnect_Click(object sender, EventArgs e) private void btnConnect_Click(object sender, EventArgs e)
{ {
string ip = txtIP.Text; //string ip = txtIP.Text;
bool result = RFIDManager.ConnectionIP(ip); //bool result = RFIDManager.ConnectionIP(ip);
if (RFIDManager.RFReaderMap.ContainsKey(ip)) //if (RFIDManager.RFReaderMap.ContainsKey(ip))
{ //{
btnConnect.Enabled = false; // btnConnect.Enabled = false;
btnClose.Enabled = true; // btnClose.Enabled = true;
} //}
else //else
{ //{
btnClose.Enabled = false; // btnClose.Enabled = false;
btnConnect.Enabled = true; // btnConnect.Enabled = true;
} //}
MessageBox.Show("" + result); //MessageBox.Show("" + result);
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
string ip = txtIP.Text; //string ip = txtIP.Text;
RFIDManager.CloseRFID(ip); //RFIDManager.CloseRFID(ip);
if (RFIDManager.RFReaderMap.ContainsKey(ip)) //if (RFIDManager.RFReaderMap.ContainsKey(ip))
{ //{
btnConnect.Enabled = false; // btnConnect.Enabled = false;
btnClose.Enabled = true; // btnClose.Enabled = true;
} //}
else //else
{ //{
btnClose.Enabled = false; // btnClose.Enabled = false;
btnConnect.Enabled = true; // btnConnect.Enabled = true;
} //}
} }
} }
} }
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.RFID"> <Reference Include="ClassLibrary1">
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath> <HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
</Reference> </Reference>
<Reference Include="Client"> <Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath> <HintPath>..\..\dll\Client.dll</HintPath>
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" /> <Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="assemblyLine\EquipBase.cs" /> <Compile Include="assemblyLine\EquipBase.cs" />
<Compile Include="deviceLibrary\RFID\RFIDManager.cs" />
<Compile Include="model\LineAlarm.cs"> <Compile Include="model\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
...@@ -177,12 +177,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -177,12 +177,13 @@ namespace OnlineStore.DeviceLibrary
{ {
IOManager.instance.ConnectionIOList(cioList); IOManager.instance.ConnectionIOList(cioList);
Thread.Sleep(5); Thread.Sleep(5);
if (!IsDebug) // if (!IsDebug)
{ {
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
string[] rfidArray = new List<string>(DeviceConfig.ProRFIpMap.Values).ToArray();
//连接rfip //连接rfip
RFIDManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values)); TrayManager.RfidReader.Open(rfidArray);
}); });
} }
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check)); addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
...@@ -318,14 +319,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -318,14 +319,14 @@ namespace OnlineStore.DeviceLibrary
PreIsHasProcess = true; PreIsHasProcess = true;
MoveInfo.NewMove(LineMoveType.Reset); MoveInfo.NewMove(LineMoveType.Reset);
MoveInfo.NextMoveStep(LineMoveStep.Wait); MoveInfo.NextMoveStep(LineMoveStep.Wait);
if (TrayManager.ErrorStoreId > 0) if (TrayManager.ErrorDeviceId > 0)
{ {
if (MoveEquipMap.ContainsKey(TrayManager.ErrorStoreId)) if (MoveEquipMap.ContainsKey(TrayManager.ErrorDeviceId))
{ {
MoveEquipMap[TrayManager.ErrorStoreId].preTrayNum = 0; MoveEquipMap[TrayManager.ErrorDeviceId].preTrayNum = 0;
} }
} }
TrayManager.ErrorStoreId = -1; TrayManager.ErrorDeviceId = -1;
WriteDrivetMotorRun( IO_VALUE.LOW); WriteDrivetMotorRun( IO_VALUE.LOW);
//NG气缸后退 //NG气缸后退
...@@ -394,7 +395,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -394,7 +395,7 @@ namespace OnlineStore.DeviceLibrary
//调试状态不再重置 //调试状态不再重置
if (!equip.IsDebug) if (!equip.IsDebug)
{ {
if (isNeedAllReset || TrayManager.ErrorStoreId.Equals(equip.DeviceID) || (!equip.alarmType.Equals(LineAlarmType.None))) if (isNeedAllReset || TrayManager.ErrorDeviceId.Equals(equip.DeviceID) || (!equip.alarmType.Equals(LineAlarmType.None)))
{ {
LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位"); LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位");
equip.Reset(); equip.Reset();
......
...@@ -504,7 +504,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -504,7 +504,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currTrayNum + "】没有出入库任务,放盘通过~"); LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currTrayNum + "】没有出入库任务,放盘通过~");
// preTrayNum = currMoveTrayNum; // preTrayNum = currMoveTrayNum;
if (TrayManager.ErrorStoreId.Equals(DeviceID)) if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{ {
TrayManager.UpdateTrayNumError(-1, ""); TrayManager.UpdateTrayNumError(-1, "");
} }
...@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary
if (!isNeedMove) if (!isNeedMove)
{ {
//preTrayNum = num; //preTrayNum = num;
if (TrayManager.ErrorStoreId.Equals(DeviceID)) if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{ {
TrayManager.UpdateTrayNumError(-1, ""); TrayManager.UpdateTrayNumError(-1, "");
} }
......
...@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
currTrayNum = TrayManager.GetTrayNum(DeviceID); currTrayNum = TrayManager.GetTrayNum(DeviceID);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false)) if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{ {
if (TrayManager.ErrorStoreId.Equals(DeviceID)) if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{ {
TrayManager.UpdateTrayNumError(-1, ""); TrayManager.UpdateTrayNumError(-1, "");
} }
......
using OnlineStore.Common; using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
...@@ -11,12 +12,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,12 +12,13 @@ namespace OnlineStore.DeviceLibrary
{ {
public class TrayManager public class TrayManager
{ {
public static RFID RfidReader = new RFID();
///// <summary>
///// 出库时,可以不下降直接放料盘的宽度
///// </summary>
//public const int CanPushBagWidth = 7;
/// <summary> /// <summary>
/// 出库时,可以不下降直接放料盘的宽度 /// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
public const int CanPushBagWidth = 7;
/// <summary>
/// 放在公共地方,方便存取,夹料编码盘列表,key=编码(1-6),value=是否有物品,true=有物品
/// </summary> /// </summary>
private static ConcurrentDictionary<int, TrayInfo> TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>(); private static ConcurrentDictionary<int, TrayInfo> TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
...@@ -35,14 +37,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -35,14 +37,12 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 盘错乱的StoreID /// 盘错乱的StoreID
/// </summary> /// </summary>
public static int ErrorStoreId = -1; public static int ErrorDeviceId = -1;
public static bool LineRunTest = false;
static TrayManager() static TrayManager()
{ {
LineRunTest = ConfigAppSettings.GetIntValue(Setting_Init.LineRunTest).Equals(1);
} }
public static List<TrayInfo> getTrayList() public static List<TrayInfo> getTrayList()
{ {
return new List<TrayInfo>(TrayInfoMap.Values); return new List<TrayInfo>(TrayInfoMap.Values);
} }
...@@ -75,8 +75,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -75,8 +75,8 @@ namespace OnlineStore.DeviceLibrary
{ {
return TrayInfoMap[trayNum]; return TrayInfoMap[trayNum];
} }
TrayInfo tray = new TrayInfo(trayNum,false,0); TrayInfo tray = new TrayInfo(trayNum, false, 0);
return tray; return tray;
} }
...@@ -99,8 +99,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -99,8 +99,8 @@ namespace OnlineStore.DeviceLibrary
TrayInfoMap.TryAdd(trayNum, fixture); TrayInfoMap.TryAdd(trayNum, fixture);
} }
} }
internal static void UpdateInStoreNG(int trayNum, bool isNg ,string msg) internal static void UpdateInStoreNG(int trayNum, bool isNg, string msg)
{ {
LogUtil.info("更新托盘【" + trayNum + "】InStoreNG=【" + isNg + "】NgMsg=【" + msg + "】"); LogUtil.info("更新托盘【" + trayNum + "】InStoreNG=【" + isNg + "】NgMsg=【" + msg + "】");
if (TrayInfoMap.ContainsKey(trayNum)) if (TrayInfoMap.ContainsKey(trayNum))
...@@ -109,12 +109,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -109,12 +109,12 @@ namespace OnlineStore.DeviceLibrary
TrayInfoMap[trayNum].NgMsg = msg; TrayInfoMap[trayNum].NgMsg = msg;
} }
} }
internal static void UpdateEmergencyOut(int trayNum, bool isEmp ) internal static void UpdateEmergencyOut(int trayNum, bool isEmp)
{ {
LogUtil.info("更新托盘【" + trayNum + "】EmergencyOut=【" + isEmp + "】 "); LogUtil.info("更新托盘【" + trayNum + "】EmergencyOut=【" + isEmp + "】 ");
if (TrayInfoMap.ContainsKey(trayNum)) if (TrayInfoMap.ContainsKey(trayNum))
{ {
TrayInfoMap[trayNum].EmergencyOut = isEmp; TrayInfoMap[trayNum].EmergencyOut = isEmp;
} }
} }
...@@ -171,46 +171,53 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,46 +171,53 @@ namespace OnlineStore.DeviceLibrary
internal static void UpdateTrayNumError(int errorStoreID, string errorMsg) internal static void UpdateTrayNumError(int errorStoreID, string errorMsg)
{ {
TrayErrorMsg = errorMsg; TrayErrorMsg = errorMsg;
ErrorStoreId = errorStoreID; ErrorDeviceId = errorStoreID;
} }
/// <summary> /// <summary>
/// 获取托盘编码 /// 获取托盘编码
/// </summary> /// </summary>
public static int GetTrayNum(int subType) public static int GetTrayNum(int subType)
{ {
//string ip = GetRFIP(subType);
////获取盘号
//RFIDData data = RFIDManager.ReadData(ip);
//if (data != null)
//{
// if (data.RFType.Equals("E"))
// {
// return data.Num;
// }
// else
// {
// LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
// }
//}
return 9; return 9;
} string ip = GetRFIP(subType);
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
//获取盘号 //获取盘号
RFIDData data = RFIDManager.ReadData(ip); RFIDData data = ReadRFID(ip);
if (data != null) if (data != null)
{ {
if (data.RFType.Equals("B")) if (data.RFType.Equals("E"))
{ {
return data; return data.Num;
} }
else else
{ {
LogUtil.error("读取料架RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr()); LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
} }
} }
return data; return 0;
}
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
return ReadRFID(ip);
}
public static RFIDData ReadRFID(string ip)
{
try
{
//获取盘号
byte[] data = RfidReader.Read(ip);
if (data != null && data.Length >= 2)
{
RFIDData d = new RFIDData(data);
return d;
}
}catch(Exception ex)
{
LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData(-1,'X');
} }
public static string GetRFIP(int subType, int rtType = 0) public static string GetRFIP(int subType, int rtType = 0)
...@@ -251,7 +258,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -251,7 +258,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
//若此横移对应的设备未启动,直接可处理 //若此横移对应的设备未启动,直接可处理
foreach(FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values) foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values)
{ {
if (equip.Config.SidesWayNum.Equals(swNum)) if (equip.Config.SidesWayNum.Equals(swNum))
{ {
...@@ -259,7 +266,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -259,7 +266,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
if (status.Equals(0)&& swNum.Equals(2) && (equip.isInSuddenDown||equip.isNoAirCheck)) if (status.Equals(0) && swNum.Equals(2) && (equip.isInSuddenDown || equip.isNoAirCheck))
{ {
//上料3如果报警,可以直接处理移栽 //上料3如果报警,可以直接处理移栽
return true; return true;
...@@ -298,10 +305,49 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,10 +305,49 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
SidesWayStateMap.TryAdd(swNum, value); SidesWayStateMap.TryAdd(swNum, value);
} }
} }
#endregion #endregion
} }
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘=E
/// </summary>
public char RFType = 'E';
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public int Num = 0;
public RFIDData(int num, char t = 'E')
{
this.RFType = t;
this.Num = num;
}
public RFIDData(byte[] data)
{
try
{
RFType = (char)data[0];
Num = Convert.ToInt32(data[1]);
}
catch (Exception ex)
{
LogUtil.error("RFIP 数据【" + data + "】 获取编码失败");
}
}
public byte[] ToData()
{
return new byte[] { (byte)RFType, (byte)Num };
}
public string ToStr()
{
return " [" + RFType + "],[" + Num + "] ";
}
}
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!