Commit a74df382 LN

RFID修改

1 个父辈 ba43dd79
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
......@@ -55,9 +55,8 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Asa.RFID, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
<Reference Include="ClassLibrary1">
<HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
......@@ -152,12 +151,6 @@
<Compile Include="FrmLineStore.Designer.cs">
<DependentUpon>FrmLineStore.cs</DependentUpon>
</Compile>
<Compile Include="FrmRFIPEdit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmRFIPEdit.Designer.cs">
<DependentUpon>FrmRFIPEdit.cs</DependentUpon>
</Compile>
<Compile Include="FrmPwd.cs">
<SubType>Form</SubType>
</Compile>
......@@ -200,9 +193,6 @@
<EmbeddedResource Include="FrmLineStore.resx">
<DependentUpon>FrmLineStore.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmRFIPEdit.resx">
<DependentUpon>FrmRFIPEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmPwd.resx">
<DependentUpon>FrmPwd.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -51,27 +51,27 @@
this.lblConInfo.Name = "lblConInfo";
this.lblConInfo.Size = new System.Drawing.Size(80, 20);
this.lblConInfo.TabIndex = 0;
this.lblConInfo.Text = "lblConInfo";
this.lblConInfo.Text = "IO连接信息";
//
// lblRFID
//
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.Location = new System.Drawing.Point(309, 73);
this.lblRFID.Location = new System.Drawing.Point(321, 73);
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.Text = "label1";
this.lblRFID.Text = "RFID信息:";
//
// lblBox
//
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.Location = new System.Drawing.Point(549, 73);
this.lblBox.Location = new System.Drawing.Point(627, 73);
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.Text = "label2";
this.lblBox.Text = "料仓连接信息";
//
// lblMsg
//
......@@ -107,7 +107,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
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.btnUpdate);
this.Controls.Add(this.lblMsg);
......
......@@ -38,13 +38,13 @@ namespace OnlineStore.AssemblyLine
}
lblConInfo.Text += msg;
lblRFID.Text = "RFID连接信息:\r\n";
lblRFID.Text = "RFID信息:\r\n";
msg = "";
List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
foreach (string ip in tList)
{
string con = (RFIDManager.IsConnect(ip)) ? " ✔" : " ✘";
msg += ("RFID[" + ip + "]").PadLeft(26, ' ') + con + "\n";
string con = TrayManager.ReadRFID(ip) .ToStr() ;
msg += ("RFID[" + ip + "]").PadLeft(26, ' ') + con + "\n";
}
lblRFID.Text += msg;
......
......@@ -398,61 +398,61 @@
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
//
// 启动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.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
//
// 复位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.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
//
// 停止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.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
//
// 入库模式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.Visible = false;
//
// 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;
//
// 退出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.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1);
//
......@@ -473,7 +473,7 @@
// 扫码测试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.Visible = false;
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
......@@ -481,37 +481,39 @@
// 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;
//
// 二维码学习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.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// 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
//
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.Visible = false;
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
//
// 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
//
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.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click);
//
......@@ -526,7 +528,7 @@
// 版本号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.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
//
......
......@@ -260,7 +260,7 @@ namespace OnlineStore.AssemblyLine
//AIManager.CloseConnect();
ACServerManager.CloseAllPort();
// CodeManager.CloseAllCamera();
RFIDManager.CloseAllConnection();
TrayManager.RfidReader.Close();
//this.Close();
System.Environment.Exit(System.Environment.ExitCode);
}
......@@ -710,8 +710,8 @@ namespace OnlineStore.AssemblyLine
private void 托盘初始化ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmRFIPEdit FRM = new FrmRFIPEdit();
FRM.ShowDialog();
//FrmRFIPEdit FRM = new FrmRFIPEdit();
//FRM.ShowDialog();
}
private void iO模块状态ToolStripMenuItem_Click(object sender, EventArgs e)
......
......@@ -260,6 +260,7 @@
this.groupBox1.TabIndex = 290;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "搜索RFID";
this.groupBox1.Visible = false;
//
// listView1
//
......@@ -311,6 +312,7 @@
this.btnClose.TabIndex = 287;
this.btnClose.Text = "关闭";
this.btnClose.UseVisualStyleBackColor = false;
this.btnClose.Visible = false;
this.btnClose.Click += new System.EventHandler(this.button2_Click);
//
// btnConnect
......@@ -323,6 +325,7 @@
this.btnConnect.TabIndex = 286;
this.btnConnect.Text = "连接";
this.btnConnect.UseVisualStyleBackColor = false;
this.btnConnect.Visible = false;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// FrmRFIPEdit
......

using Asa.RFID;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
......@@ -61,14 +61,14 @@ namespace OnlineStore.AssemblyLine
private void btnNext_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
char type = comType.Text.ToCharArray()[0];
int value = (int)numNum.Value;
DialogResult result = MessageBox.Show( "确定将【"+comboxType.Text+"】当前的托盘编号定为【"+value+"】?", "确定提示", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
RFIDManager.WriteData(ip, new RFIDData(value, type));
}
//string ip = txtIP.Text;
//char type = comType.Text.ToCharArray()[0];
//int value = (int)numNum.Value;
//DialogResult result = MessageBox.Show( "确定将【"+comboxType.Text+"】当前的托盘编号定为【"+value+"】?", "确定提示", MessageBoxButtons.OKCancel);
//if (result.Equals(DialogResult.OK))
//{
// RFIDManager.WriteData(ip, new RFIDData(value, type));
//}
}
private void btnBack_Click(object sender, EventArgs e)
......@@ -80,7 +80,7 @@ namespace OnlineStore.AssemblyLine
private void button1_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
RFIDData data = RFIDManager.ReadData(ip);
RFIDData data = TrayManager.ReadRFID(ip);
string resul = "";
if (data != null)
{
......@@ -105,77 +105,77 @@ namespace OnlineStore.AssemblyLine
{
txtIP.Text = V;
}
if (RFIDManager.RFReaderMap.ContainsKey(V))
{
btnConnect.Enabled = false;
btnClose.Enabled = true;
}
else
{
btnClose.Enabled = false;
btnConnect.Enabled = true;
}
//if (RFIDManager.RFReaderMap.ContainsKey(V))
//{
// btnConnect.Enabled = false;
// btnClose.Enabled = true;
//}
//else
//{
// btnClose.Enabled = false;
// btnConnect.Enabled = true;
//}
}
}
private void btnFind_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
bool result = RFIDManager.FindRFID(ip);
if (result)
{
lblHas.Text = "有标签";
lblHas.ForeColor = Color.Green;
}
else
{
lblHas.Text = "无标签";
lblHas.ForeColor = Color.Red;
}
//string ip = txtIP.Text;
//bool result = RFIDManager.FindRFID(ip);
//if (result)
//{
// lblHas.Text = "有标签";
// lblHas.ForeColor = Color.Green;
//}
//else
//{
// lblHas.Text = "无标签";
// lblHas.ForeColor = Color.Red;
//}
}
private void btnSearch_Click(object sender, EventArgs e)
{
string text = cmbLocalIp.Text;
string[] ip = RFIDManager.SearchIP(text);
foreach(string ipstr in ip)
{
listView1.Items.Add(ipstr);
}
//string text = cmbLocalIp.Text;
//string[] ip = RFIDManager.SearchIP(text);
//foreach(string ipstr in ip)
//{
// listView1.Items.Add(ipstr);
//}
}
private void btnConnect_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
bool result = RFIDManager.ConnectionIP(ip);
if (RFIDManager.RFReaderMap.ContainsKey(ip))
{
btnConnect.Enabled = false;
btnClose.Enabled = true;
}
else
{
btnClose.Enabled = false;
btnConnect.Enabled = true;
}
MessageBox.Show("" + result);
//string ip = txtIP.Text;
//bool result = RFIDManager.ConnectionIP(ip);
//if (RFIDManager.RFReaderMap.ContainsKey(ip))
//{
// btnConnect.Enabled = false;
// btnClose.Enabled = true;
//}
//else
//{
// btnClose.Enabled = false;
// btnConnect.Enabled = true;
//}
//MessageBox.Show("" + result);
}
private void button2_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
RFIDManager.CloseRFID(ip);
if (RFIDManager.RFReaderMap.ContainsKey(ip))
{
btnConnect.Enabled = false;
btnClose.Enabled = true;
}
else
{
btnClose.Enabled = false;
btnConnect.Enabled = true;
}
//string ip = txtIP.Text;
//RFIDManager.CloseRFID(ip);
//if (RFIDManager.RFReaderMap.ContainsKey(ip))
//{
// btnConnect.Enabled = false;
// btnClose.Enabled = true;
//}
//else
//{
// btnClose.Enabled = false;
// btnConnect.Enabled = true;
//}
}
}
}
......@@ -39,8 +39,8 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
<Reference Include="ClassLibrary1">
<HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
......@@ -91,7 +91,6 @@
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="assemblyLine\EquipBase.cs" />
<Compile Include="deviceLibrary\RFID\RFIDManager.cs" />
<Compile Include="model\LineAlarm.cs">
<SubType>Code</SubType>
</Compile>
......
......@@ -177,12 +177,13 @@ namespace OnlineStore.DeviceLibrary
{
IOManager.instance.ConnectionIOList(cioList);
Thread.Sleep(5);
if (!IsDebug)
// if (!IsDebug)
{
Task.Factory.StartNew(delegate
{
string[] rfidArray = new List<string>(DeviceConfig.ProRFIpMap.Values).ToArray();
//连接rfip
RFIDManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values));
TrayManager.RfidReader.Open(rfidArray);
});
}
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
......@@ -318,14 +319,14 @@ namespace OnlineStore.DeviceLibrary
PreIsHasProcess = true;
MoveInfo.NewMove(LineMoveType.Reset);
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);
//NG气缸后退
......@@ -394,7 +395,7 @@ namespace OnlineStore.DeviceLibrary
//调试状态不再重置
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 + " 需要复位");
equip.Reset();
......
......@@ -504,7 +504,7 @@ namespace OnlineStore.DeviceLibrary
{
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currTrayNum + "】没有出入库任务,放盘通过~");
// preTrayNum = currMoveTrayNum;
if (TrayManager.ErrorStoreId.Equals(DeviceID))
if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
......@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary
if (!isNeedMove)
{
//preTrayNum = num;
if (TrayManager.ErrorStoreId.Equals(DeviceID))
if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
......
......@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
currTrayNum = TrayManager.GetTrayNum(DeviceID);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{
if (TrayManager.ErrorStoreId.Equals(DeviceID))
if (TrayManager.ErrorDeviceId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
......
using OnlineStore.Common;
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
......@@ -11,12 +12,13 @@ namespace OnlineStore.DeviceLibrary
{
public class TrayManager
{
public static RFID RfidReader = new RFID();
///// <summary>
///// 出库时,可以不下降直接放料盘的宽度
///// </summary>
//public const int CanPushBagWidth = 7;
/// <summary>
/// 出库时,可以不下降直接放料盘的宽度
/// </summary>
public const int CanPushBagWidth = 7;
/// <summary>
/// 放在公共地方,方便存取,夹料编码盘列表,key=编码(1-6),value=是否有物品,true=有物品
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
private static ConcurrentDictionary<int, TrayInfo> TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
......@@ -35,14 +37,12 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 盘错乱的StoreID
/// </summary>
public static int ErrorStoreId = -1;
public static bool LineRunTest = false;
public static int ErrorDeviceId = -1;
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);
}
......@@ -75,8 +75,8 @@ namespace OnlineStore.DeviceLibrary
{
return TrayInfoMap[trayNum];
}
TrayInfo tray = new TrayInfo(trayNum,false,0);
TrayInfo tray = new TrayInfo(trayNum, false, 0);
return tray;
}
......@@ -99,8 +99,8 @@ namespace OnlineStore.DeviceLibrary
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 + "】");
if (TrayInfoMap.ContainsKey(trayNum))
......@@ -109,12 +109,12 @@ namespace OnlineStore.DeviceLibrary
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 + "】 ");
if (TrayInfoMap.ContainsKey(trayNum))
{
TrayInfoMap[trayNum].EmergencyOut = isEmp;
TrayInfoMap[trayNum].EmergencyOut = isEmp;
}
}
......@@ -171,46 +171,53 @@ namespace OnlineStore.DeviceLibrary
internal static void UpdateTrayNumError(int errorStoreID, string errorMsg)
{
TrayErrorMsg = errorMsg;
ErrorStoreId = errorStoreID;
ErrorDeviceId = errorStoreID;
}
/// <summary>
/// 获取托盘编码
/// </summary>
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;
}
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = RFIDManager.ReadData(ip);
RFIDData data = ReadRFID(ip);
if (data != null)
{
if (data.RFType.Equals("B"))
if (data.RFType.Equals("E"))
{
return data;
return data.Num;
}
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)
......@@ -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))
{
......@@ -259,7 +266,7 @@ namespace OnlineStore.DeviceLibrary
{
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如果报警,可以直接处理移栽
return true;
......@@ -298,10 +305,49 @@ namespace OnlineStore.DeviceLibrary
else
{
SidesWayStateMap.TryAdd(swNum, value);
}
}
}
#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!