Commit d3f82a30 LN

1

1 个父辈 b2a13516
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
<add key ="LineRunTest" value ="1"/> <add key ="LineRunTest" value ="1"/>
<!--ABB机器人服务器--> <!--ABB机器人服务器-->
<add key ="ABBServerPort" value ="21"/> <add key ="ABBServerPort" value ="21"/>
<!--是否打开托盘编码界面-->
<add key ="OpenRFIDWrite" value ="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -113,6 +113,7 @@ namespace OnlineStore.AssemblyLine ...@@ -113,6 +113,7 @@ namespace OnlineStore.AssemblyLine
int autoValue = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun); int autoValue = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
chbAutoRun.Checked = autoValue.Equals(1); chbAutoRun.Checked = autoValue.Equals(1);
LoadListView(); LoadListView();
托盘初始化ToolStripMenuItem.Visible = ConfigAppSettings.GetIntValue(Setting_Init.OpenRFIDWrite).Equals(1);
LoadOk = true; LoadOk = true;
HideForm(); HideForm();
timer1.Start(); timer1.Start();
...@@ -252,7 +253,7 @@ namespace OnlineStore.AssemblyLine ...@@ -252,7 +253,7 @@ namespace OnlineStore.AssemblyLine
IOManager.instance.CloseAllDO(); IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection(); IOManager.instance.CloseAllConnection();
AIManager.CloseConnect(); //AIManager.CloseConnect();
ACServerManager.CloseAllPort(); ACServerManager.CloseAllPort();
//this.Close(); //this.Close();
System.Environment.Exit(System.Environment.ExitCode); System.Environment.Exit(System.Environment.ExitCode);
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
this.btnBack.Anchor = System.Windows.Forms.AnchorStyles.Top; this.btnBack.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(383, 392); this.btnBack.Location = new System.Drawing.Point(420, 392);
this.btnBack.Name = "btnBack"; this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(120, 45); this.btnBack.Size = new System.Drawing.Size(120, 45);
this.btnBack.TabIndex = 274; this.btnBack.TabIndex = 274;
...@@ -119,8 +119,8 @@ ...@@ -119,8 +119,8 @@
this.comType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.comType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comType.FormattingEnabled = true; this.comType.FormattingEnabled = true;
this.comType.Items.AddRange(new object[] { this.comType.Items.AddRange(new object[] {
"L", "流水线托盘",
"R"}); "料架"});
this.comType.Location = new System.Drawing.Point(222, 187); this.comType.Location = new System.Drawing.Point(222, 187);
this.comType.Name = "comType"; this.comType.Name = "comType";
this.comType.Size = new System.Drawing.Size(120, 28); this.comType.Size = new System.Drawing.Size(120, 28);
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(167, 25); this.label3.Size = new System.Drawing.Size(167, 25);
this.label3.TabIndex = 279; this.label3.TabIndex = 279;
this.label3.Text = "读卡器类型:"; this.label3.Text = "类型:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// button1 // button1
......
...@@ -42,7 +42,7 @@ namespace OnlineStore.AssemblyLine ...@@ -42,7 +42,7 @@ namespace OnlineStore.AssemblyLine
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))
{ {
RFIPManager.WriteData(ip, new RFIPData(value, type)); RFIDManager.WriteData(ip, new RFIDData(value, type));
} }
} }
...@@ -55,7 +55,7 @@ namespace OnlineStore.AssemblyLine ...@@ -55,7 +55,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;
RFIPData data= RFIPManager.ReadData(ip); RFIDData data = RFIDManager.ReadData(ip);
string resul = ""; string resul = "";
if (data != null) if (data != null)
{ {
...@@ -79,7 +79,7 @@ namespace OnlineStore.AssemblyLine ...@@ -79,7 +79,7 @@ namespace OnlineStore.AssemblyLine
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 = RFIPManager.FindRFID(ip); bool result = RFIDManager.FindRFID(ip);
if (result) if (result)
{ {
lblHas.Text = "有标签"; lblHas.Text = "有标签";
......
...@@ -43,7 +43,7 @@ namespace StoreServer ...@@ -43,7 +43,7 @@ namespace StoreServer
} }
IOManager.instance.CloseAllDO(); IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection(); IOManager.instance.CloseAllConnection();
AIManager.CloseConnect(); //AIManager.CloseConnect();
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop."); LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop.");
} }
} }
......
...@@ -74,5 +74,6 @@ namespace OnlineStore.Common ...@@ -74,5 +74,6 @@ namespace OnlineStore.Common
public static string ConfigPath_DischargeLine= "ConfigPath_DischargeLine"; public static string ConfigPath_DischargeLine= "ConfigPath_DischargeLine";
public static string ABBServerPort = "ABBServerPort"; public static string ABBServerPort = "ABBServerPort";
public static string OpenRFIDWrite = "OpenRFIDWrite";
} }
} }
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
<Compile Include="assemblyLine\FeedingEquip.cs" /> <Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblyLine\TrayManager.cs" /> <Compile Include="assemblyLine\TrayManager.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" /> <Compile Include="deviceLibrary\halcon\CodeManager.cs" />
<Compile Include="deviceLibrary\IO\AIManager.cs" />
<Compile Include="deviceLibrary\IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="deviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" /> <Compile Include="deviceLibrary\IO\IOManager.cs" />
<Compile Include="assemblyLine\LineBean.cs" /> <Compile Include="assemblyLine\LineBean.cs" />
......
...@@ -118,11 +118,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -118,11 +118,11 @@ namespace OnlineStore.DeviceLibrary
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
//连接rfip //连接rfip
RFIPManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values)); RFIDManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values));
Thread.Sleep(5); Thread.Sleep(5);
IOManager.instance.ConnectionIOList(ioList); IOManager.instance.ConnectionIOList(ioList);
Thread.Sleep(10); //Thread.Sleep(10);
AIManager.ConnectionIP(Config.AIDevice_IP); //AIManager.ConnectionIP(Config.AIDevice_IP);
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check)); addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN)); addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN));
......
...@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string ip = GetRFIP(subType, rtType); string ip = GetRFIP(subType, rtType);
//获取盘号 //获取盘号
RFIPData data = RFIPManager.ReadData(ip); RFIDData data = RFIDManager.ReadData(ip);
if (data != null) if (data != null)
{ {
return data.Num; return data.Num;
......
...@@ -9,7 +9,7 @@ using System.Threading.Tasks; ...@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
public class RFIPManager public class RFIDManager
{ {
public static Dictionary<string, Reader> RFReaderMap = new Dictionary<string, Reader>(); public static Dictionary<string, Reader> RFReaderMap = new Dictionary<string, Reader>();
...@@ -68,40 +68,40 @@ namespace OnlineStore.DeviceLibrary ...@@ -68,40 +68,40 @@ namespace OnlineStore.DeviceLibrary
isProcess = false; isProcess = false;
} }
internal static void ConnectionIP(string rfip) internal static void ConnectionIP(string rfid)
{ {
Reader rfipReader = null; Reader rfidReader = null;
if (RFReaderMap.ContainsKey(rfip)) if (RFReaderMap.ContainsKey(rfid))
{ {
rfipReader = RFReaderMap[rfip]; rfidReader = RFReaderMap[rfid];
if (null != rfipReader) if (null != rfidReader)
{ {
rfipReader.Close(); rfidReader.Close();
rfipReader = null; rfidReader = null;
} }
RFReaderMap.Remove(rfip); RFReaderMap.Remove(rfid);
} }
string logName = "RFIP模块[" + rfip + "] "; string logName = "RFIP模块[" + rfid + "] ";
try try
{ {
rfipReader = new Reader(); rfidReader = new Reader();
rfipReader.LocalIP = "192.168.100.101"; // rfidReader.LocalIP = "192.168.100.101";
rfipReader.RemoteIP = rfip; rfidReader.RemoteIP = rfid;
RFReaderMap.Add(rfip, rfipReader); RFReaderMap.Add(rfid, rfidReader);
LogUtil.debug("开始连接" + logName + ",尝试重连3次"); LogUtil.debug("开始连接" + logName + ",尝试重连3次");
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
bool result = rfipReader.Connect(); bool result = rfidReader.Connect();
if (result) if (result)
{ {
LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:"); LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:");
Thread.Sleep(10); Thread.Sleep(10);
if (RfIPList.Contains(rfip)) if (RfIPList.Contains(rfid))
{ {
RfIPList.Remove(rfip); RfIPList.Remove(rfid);
} }
break; break;
} }
...@@ -126,25 +126,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -126,25 +126,25 @@ namespace OnlineStore.DeviceLibrary
reader.Close(); reader.Close();
} }
} }
public static bool WriteData(string rfIp, RFIPData obj) public static bool WriteData(string IP, RFIDData obj)
{ {
byte[] sendData = obj.ToData(); byte[] sendData = obj.ToData();
return WriteData(rfIp, sendData, 3); return WriteData(IP, sendData, 3);
} }
public static RFIPData ReadData(string rfIp) public static RFIDData ReadData(string IP)
{ {
byte[] reviceData = ReadData(rfIp, 3); byte[] reviceData = ReadData(IP, 3);
if (reviceData != null) if (reviceData != null)
{ {
return new RFIPData(reviceData); return new RFIDData(reviceData);
} }
return null; return null;
} }
public static bool FindRFID(string rfIp) public static bool FindRFID(string IP)
{ {
try try
{ {
Reader rfReader = getRfReader(rfIp); Reader rfReader = getRfReader(IP);
if (rfReader != null) if (rfReader != null)
{ {
return rfReader.FindRFID(); return rfReader.FindRFID();
...@@ -152,15 +152,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,15 +152,15 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("RFIP FindRFID [" + rfIp + "] 出错 :" + ex.ToString()); LogUtil.error("RFIP FindRFID [" + IP + "] 出错 :" + ex.ToString());
} }
return false; return false;
} }
public static byte[] ReadData(string rfIp, int reReadCount = 1,int startIndex=0,int readLength=10) public static byte[] ReadData(string IP, int reReadCount = 1,int startIndex=0,int readLength=10)
{ {
try try
{ {
Reader rfReader = getRfReader(rfIp); Reader rfReader = getRfReader(IP);
if (rfReader == null) if (rfReader == null)
{ {
return null; return null;
...@@ -172,20 +172,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -172,20 +172,20 @@ namespace OnlineStore.DeviceLibrary
{ {
return reviceData; return reviceData;
} }
LogUtil.error("RFIP ReadData [" + rfIp + "] 第" + i + "次失败 "); LogUtil.error("RFIP ReadData [" + IP + "] 第" + i + "次失败 ");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("RFIP ReadData [" + rfIp + "] 出错 :" + ex.ToString()); LogUtil.error("RFIP ReadData [" + IP + "] 出错 :" + ex.ToString());
} }
return null; return null;
} }
public static bool WriteData(string rfIp, byte[] data, int reWriteCount = 1) public static bool WriteData(string IP, byte[] data, int reWriteCount = 1)
{ {
try try
{ {
Reader rfReader = getRfReader(rfIp); Reader rfReader = getRfReader(IP);
if (rfReader == null) if (rfReader == null)
{ {
return false; return false;
...@@ -197,30 +197,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -197,30 +197,30 @@ namespace OnlineStore.DeviceLibrary
{ {
return result; return result;
} }
LogUtil.error("RFIP WriteData [" + rfIp + "] 第" + i + "次失败:"); LogUtil.error("RFIP WriteData [" + IP + "] 第" + i + "次失败:");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("RFIP WriteData [" + rfIp + "] 出错 :" + ex.ToString()); LogUtil.error("RFIP WriteData [" + IP + "] 出错 :" + ex.ToString());
} }
return false; return false;
} }
private static Reader getRfReader(string rfIp) private static Reader getRfReader(string IP)
{ {
Reader rfReader = null; Reader rfReader = null;
if (RFReaderMap.ContainsKey(rfIp)) if (RFReaderMap.ContainsKey(IP))
{ {
rfReader = RFReaderMap[rfIp]; rfReader = RFReaderMap[IP];
} }
else else
{ {
LogUtil.error("getRfReader 没有连接RFIP模块:" + rfIp); LogUtil.error("getRfReader 没有连接RFIP模块:" + IP);
} }
return rfReader; return rfReader;
} }
} }
public class RFIPData public class RFIDData
{ {
/// <summary> /// <summary>
/// RFID类型,区分是料架还是托盘,托盘=L /// RFID类型,区分是料架还是托盘,托盘=L
...@@ -231,13 +231,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -231,13 +231,13 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int Num = 0; public int Num = 0;
public RFIPData (int num,int t=1) public RFIDData (int num,int t=1)
{ {
this.RFType = t; this.RFType = t;
this.Num = num; this.Num = num;
} }
public RFIPData(byte[] data) public RFIDData(byte[] data)
{ {
try try
{ {
......
...@@ -59,59 +59,59 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -59,59 +59,59 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("IO_DOLength")] [ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; } public string IO_DOLength { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟量IO模块的IP地址 AIDevice_IP 192.168.200.11 ///// PRO 模拟量IO模块的IP地址 AIDevice_IP 192.168.200.11
/// </summary> ///// </summary>
[ConfigProAttribute("AIDevice_IP", true)] //[ConfigProAttribute("AIDevice_IP", true)]
public string AIDevice_IP { get; set; } //public string AIDevice_IP { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟量测高1mm对应的转换值 AI_ConvertPosition 55 ///// PRO 模拟量测高1mm对应的转换值 AI_ConvertPosition 55
/// </summary> ///// </summary>
[ConfigProAttribute("AI_ConvertPosition", true)] //[ConfigProAttribute("AI_ConvertPosition", true)]
public int AI_ConvertPosition { get; set; } //public int AI_ConvertPosition { get; set; }
/// <summary> ///// <summary>
/// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,, ///// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,,
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI1_DefaultPosition", true)] //[ConfigProAttribute("AIDI1_DefaultPosition", true)]
public double AIDI1_DefaultPosition { get; set; } //public double AIDI1_DefaultPosition { get; set; }
/// <summary> ///// <summary>
/// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,, ///// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,,
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI2_DefaultPosition", true)] //[ConfigProAttribute("AIDI2_DefaultPosition", true)]
public double AIDI2_DefaultPosition { get; set; } //public double AIDI2_DefaultPosition { get; set; }
/// <summary> ///// <summary>
/// PRO,模拟信号3默认高度,AIDI3_DefaultPosition,1,,,,,,, ///// PRO,模拟信号3默认高度,AIDI3_DefaultPosition,1,,,,,,,
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI3_DefaultPosition", true)] //[ConfigProAttribute("AIDI3_DefaultPosition", true)]
public double AIDI3_DefaultPosition { get; set; } //public double AIDI3_DefaultPosition { get; set; }
/// <summary> ///// <summary>
/// PRO,模拟信号4默认高度,AIDI4_DefaultPosition,1,,,,,,, ///// PRO,模拟信号4默认高度,AIDI4_DefaultPosition,1,,,,,,,
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI4_DefaultPosition", true)] //[ConfigProAttribute("AIDI4_DefaultPosition", true)]
public double AIDI4_DefaultPosition { get; set; } //public double AIDI4_DefaultPosition { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟信号1的地址 AIDI1_Addr 7 ///// PRO 模拟信号1的地址 AIDI1_Addr 7
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI1_Addr", true)] //[ConfigProAttribute("AIDI1_Addr", true)]
public int AIDI1_Addr { get; set; } //public int AIDI1_Addr { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟信号2的地址 AIDI2_Addr 8 ///// PRO 模拟信号2的地址 AIDI2_Addr 8
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI2_Addr", true)] //[ConfigProAttribute("AIDI2_Addr", true)]
public int AIDI2_Addr { get; set; } //public int AIDI2_Addr { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟信号3的地址 AIDI3_Addr 5 ///// PRO 模拟信号3的地址 AIDI3_Addr 5
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI3_Addr", true)] //[ConfigProAttribute("AIDI3_Addr", true)]
public int AIDI3_Addr { get; set; } //public int AIDI3_Addr { get; set; }
/// <summary> ///// <summary>
/// PRO 模拟信号4的地址 AIDI4_Addr 6 ///// PRO 模拟信号4的地址 AIDI4_Addr 6
/// </summary> ///// </summary>
[ConfigProAttribute("AIDI4_Addr", true)] //[ConfigProAttribute("AIDI4_Addr", true)]
public int AIDI4_Addr { get; set; } //public int AIDI4_Addr { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!