Commit 6595b475 张东亮

进仓门口连续流入两个托盘问题处理

1 个父辈 d0cbcbc9
......@@ -117,6 +117,7 @@
this.启用分流横移2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator();
this.自动保存托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btnOpenRfid = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -250,6 +251,7 @@
//
// panel1
//
this.panel1.Controls.Add(this.btnOpenRfid);
this.panel1.Controls.Add(this.btnIOAutoCon);
this.panel1.Controls.Add(this.btnShunt2Reset);
this.panel1.Controls.Add(this.btnShuntReset);
......@@ -263,11 +265,11 @@
this.btnIOAutoCon.BackColor = System.Drawing.Color.White;
this.btnIOAutoCon.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnIOAutoCon.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnIOAutoCon.Location = new System.Drawing.Point(16, 105);
this.btnIOAutoCon.Location = new System.Drawing.Point(16, 89);
this.btnIOAutoCon.Name = "btnIOAutoCon";
this.btnIOAutoCon.Size = new System.Drawing.Size(133, 40);
this.btnIOAutoCon.Size = new System.Drawing.Size(133, 31);
this.btnIOAutoCon.TabIndex = 202;
this.btnIOAutoCon.Text = "开始重连IO模块";
this.btnIOAutoCon.Text = "重连IO模块";
this.btnIOAutoCon.UseVisualStyleBackColor = false;
this.btnIOAutoCon.Click += new System.EventHandler(this.btnIOAutoCon_Click);
//
......@@ -276,9 +278,9 @@
this.btnShunt2Reset.BackColor = System.Drawing.Color.White;
this.btnShunt2Reset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnShunt2Reset.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnShunt2Reset.Location = new System.Drawing.Point(16, 58);
this.btnShunt2Reset.Location = new System.Drawing.Point(16, 48);
this.btnShunt2Reset.Name = "btnShunt2Reset";
this.btnShunt2Reset.Size = new System.Drawing.Size(133, 40);
this.btnShunt2Reset.Size = new System.Drawing.Size(133, 31);
this.btnShunt2Reset.TabIndex = 201;
this.btnShunt2Reset.Text = "分流横移2复位";
this.btnShunt2Reset.UseVisualStyleBackColor = false;
......@@ -291,7 +293,7 @@
this.btnShuntReset.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnShuntReset.Location = new System.Drawing.Point(16, 11);
this.btnShuntReset.Name = "btnShuntReset";
this.btnShuntReset.Size = new System.Drawing.Size(133, 40);
this.btnShuntReset.Size = new System.Drawing.Size(133, 31);
this.btnShuntReset.TabIndex = 199;
this.btnShuntReset.Text = "分流横移1复位";
this.btnShuntReset.UseVisualStyleBackColor = false;
......@@ -785,7 +787,6 @@
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
this.托盘初始化ToolStripMenuItem.Visible = false;
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
//
// toolStripSeparator14
......@@ -955,6 +956,19 @@
this.自动保存托盘信息ToolStripMenuItem.Text = "自动保存托盘信息";
this.自动保存托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.自动保存托盘信息ToolStripMenuItem_Click);
//
// btnOpenRfid
//
this.btnOpenRfid.BackColor = System.Drawing.Color.White;
this.btnOpenRfid.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOpenRfid.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenRfid.Location = new System.Drawing.Point(16, 126);
this.btnOpenRfid.Name = "btnOpenRfid";
this.btnOpenRfid.Size = new System.Drawing.Size(133, 31);
this.btnOpenRfid.TabIndex = 203;
this.btnOpenRfid.Text = "重启RFID服务";
this.btnOpenRfid.UseVisualStyleBackColor = false;
this.btnOpenRfid.Click += new System.EventHandler(this.btnOpenRfid_Click);
//
// FrmLineStore
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -1085,6 +1099,7 @@
private System.Windows.Forms.ToolStripMenuItem 自动保存托盘信息ToolStripMenuItem;
private System.Windows.Forms.Button btnIOAutoCon;
private System.Windows.Forms.CheckBox chbSaveImg;
private System.Windows.Forms.Button btnOpenRfid;
}
}
......@@ -365,6 +365,7 @@ namespace OnlineStore.AssemblyLine
MessageBox.Show(lineBean.Name + "当前状态:" + lineBean.runStatus + ",不能启动!");
return;
}
RFIDManager.ClearAllBuff();
LogUtil.info("点击 开始启动");
startTimer.Interval = 300;
startTimer.Elapsed += timer_Elapsed;
......@@ -446,6 +447,7 @@ namespace OnlineStore.AssemblyLine
MessageBox.Show(lineBean.Name + "流水线未启动,无法复位");
return;
}
RFIDManager.ClearAllBuff();
LogUtil.info(lineBean.Name + "点击:复位");
lineBean.Reset();
}
......@@ -1365,5 +1367,19 @@ namespace OnlineStore.AssemblyLine
ReelCheckUtil.SaveImage = (chbSaveImg.Checked);
LogUtil.info("勾选 保存视觉图片:ReelCheckUtil.SaveImage =" + ReelCheckUtil.SaveImage);
}
private void btnOpenRfid_Click(object sender, EventArgs e)
{
LogUtil.info("用户点击了:" + btnOpenRfid.Text);
try
{
RFIDManager.Open();
}
catch(Exception ex)
{
LogUtil.error("btnOpenRfid_Click",ex);
}
}
}
}
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRFIPEdit));
this.label1 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
......@@ -40,8 +41,12 @@
this.label4 = new System.Windows.Forms.Label();
this.numNum = new System.Windows.Forms.NumericUpDown();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.btnReadClear = new System.Windows.Forms.Button();
this.lblResult = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label5 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numNum)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
......@@ -62,7 +67,7 @@
//
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.Location = new System.Drawing.Point(264, 241);
this.btnBack.Location = new System.Drawing.Point(303, 308);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(110, 45);
this.btnBack.TabIndex = 274;
......@@ -117,7 +122,7 @@
"C",
"D",
"E"});
this.comType.Location = new System.Drawing.Point(144, 153);
this.comType.Location = new System.Drawing.Point(144, 217);
this.comType.Name = "comType";
this.comType.Size = new System.Drawing.Size(120, 28);
this.comType.TabIndex = 280;
......@@ -127,7 +132,7 @@
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Location = new System.Drawing.Point(70, 156);
this.label3.Location = new System.Drawing.Point(70, 220);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 20);
this.label3.TabIndex = 279;
......@@ -138,9 +143,9 @@
//
this.btnRead.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRead.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRead.Location = new System.Drawing.Point(32, 241);
this.btnRead.Location = new System.Drawing.Point(5, 308);
this.btnRead.Name = "btnRead";
this.btnRead.Size = new System.Drawing.Size(110, 45);
this.btnRead.Size = new System.Drawing.Size(77, 45);
this.btnRead.TabIndex = 281;
this.btnRead.Text = "读取测试";
this.btnRead.UseVisualStyleBackColor = false;
......@@ -151,7 +156,7 @@
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(84, 194);
this.label4.Location = new System.Drawing.Point(84, 258);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(51, 20);
this.label4.TabIndex = 282;
......@@ -161,7 +166,7 @@
// numNum
//
this.numNum.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.numNum.Location = new System.Drawing.Point(144, 192);
this.numNum.Location = new System.Drawing.Point(144, 256);
this.numNum.Name = "numNum";
this.numNum.Size = new System.Drawing.Size(120, 26);
this.numNum.TabIndex = 283;
......@@ -171,6 +176,9 @@
this.groupBox2.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.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.btnReadClear);
this.groupBox2.Controls.Add(this.lblResult);
this.groupBox2.Controls.Add(this.comboxType);
......@@ -185,18 +193,42 @@
this.groupBox2.Controls.Add(this.comType);
this.groupBox2.Location = new System.Drawing.Point(12, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(420, 313);
this.groupBox2.Size = new System.Drawing.Size(420, 370);
this.groupBox2.TabIndex = 291;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "读取RFID";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Location = new System.Drawing.Point(285, 256);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(75, 21);
this.checkBox1.TabIndex = 287;
this.checkBox1.Text = "是否清理";
this.checkBox1.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(189, 308);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(110, 45);
this.button1.TabIndex = 286;
this.button1.Text = "自动读取测试";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btnReadClear
//
this.btnReadClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReadClear.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadClear.Location = new System.Drawing.Point(148, 241);
this.btnReadClear.Location = new System.Drawing.Point(88, 308);
this.btnReadClear.Name = "btnReadClear";
this.btnReadClear.Size = new System.Drawing.Size(110, 45);
this.btnReadClear.Size = new System.Drawing.Size(95, 45);
this.btnReadClear.TabIndex = 285;
this.btnReadClear.Text = "读取并清理";
this.btnReadClear.UseVisualStyleBackColor = false;
......@@ -205,18 +237,33 @@
// lblResult
//
this.lblResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.Location = new System.Drawing.Point(23, 113);
this.lblResult.Location = new System.Drawing.Point(32, 170);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(328, 25);
this.lblResult.TabIndex = 284;
this.lblResult.Text = "读取到数据";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timer1
//
this.timer1.Interval = 300;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label5
//
this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(32, 127);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(328, 25);
this.label5.TabIndex = 288;
this.label5.Text = "读取到数据";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FrmRFIPEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(444, 337);
this.ClientSize = new System.Drawing.Size(444, 394);
this.Controls.Add(this.groupBox2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmRFIPEdit";
......@@ -245,5 +292,9 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.Button btnReadClear;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label5;
}
}
\ No newline at end of file

using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
......@@ -47,7 +47,7 @@ namespace OnlineStore.AssemblyLine
if (LineManager.Line.runStatus <= LineRunStatus.Wait)
{
RFIDManager.Open();
RFIDManager.Open();
}
string hostN = Dns.GetHostName();
......@@ -120,5 +120,85 @@ namespace OnlineStore.AssemblyLine
RFIDManager.Close();
}
}
private void button1_Click_1(object sender, EventArgs e)
{
if (button1.Text.Equals("自动读取测试"))
{
button1.Text = "关闭读取测试";
preRfid = "";
timer1.Start();
}
else
{
button1.Text = "自动读取测试";
preRfid = "";
timer1.Stop();
}
}
object locObj = new object();
string preRfid = "";
private void timer1_Tick(object sender, EventArgs e)
{
if (!this.IsHandleCreated) return;
if (System.Threading.Monitor.TryEnter(locObj, 200))
{
try
{
string ip = txtIP.Text;
RFIDData data = RFIDManager.ReadRFID(ip, checkBox1.Checked);
string resul = "";
if (data != null)
{
resul = data.NumStr();
numNum.Value = data.Num;
//int selIndex = data.RFType - 64;
//if (selIndex >= 0 && selIndex <= comboxType.Items.Count)
//{
// comboxType.SelectedIndex = selIndex;
//}
}
if (checkBox1.Checked)
{
this.Invoke(new Action(() =>
{
label5.Text = ("[" + ip + "]读取到数据:" + preRfid);
lblResult.Text = ("[" + ip + "]读取到数据:" + resul);
}));
if (!preRfid.Equals(resul))
{
preRfid = resul;
LogUtil.info("RFID[" + ip + "]读取数据并清理测试,结果:" + resul);
}
}
else
{
this.Invoke(new Action(() =>
{
label5.Text = ("[" + ip + "]读取到数据:" + preRfid);
lblResult.Text = ("[" + ip + "]读取到数据:" + resul);
}));
if (!preRfid.Equals(resul))
{
preRfid = resul;
LogUtil.info("RFID[" + ip + "]读取数据测试,结果:" + resul);
}
}
}
catch (Exception ex)
{
LogUtil.error("自动读取RFID异常", ex);
}
finally
{
System.Threading.Monitor.Exit(locObj);
}
}
}
}
}
......@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -1699,7 +1699,7 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
if (TrayDisableManager.DisableTray(currTrayNum))
if (TrayDisableManager.DisableTray(trayNum))
{
return false;
}
......
......@@ -1103,7 +1103,7 @@ namespace OnlineStore.DeviceLibrary
conIsPro = true;
conLastTime = DateTime.Now;
List<AlarmMsg> alarmList = new List<AlarmMsg>();
if (!alarmType.Equals(LineAlarmType.None))
if (!alarmType.Equals(LineAlarmType.None) && !alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{
alarmList.Add(new AlarmMsg(Name, "line." + alarmType, WarnMsg));
}
......@@ -1119,18 +1119,19 @@ namespace OnlineStore.DeviceLibrary
alarmList.Add(new AlarmMsg(Name, "line.IO" , IOErrorMsg));
}
int num = TrayDisableManager.GetDisableList().Count;
if (num >= 5)
{
alarmList.Add(new AlarmMsg(Name, "line.Tray", "已有[" + num + "]个托盘被禁用,请尽快处理"));
}
else if (num >= 1)
{
alarmList.Add(new AlarmMsg(Name, "line.Tray", "已有[" + num + "]个托盘被禁用,请尽快处理"));
}
//int num = TrayDisableManager.GetDisableList().Count;
//if (num >= 5)
//{
// alarmList.Add(new AlarmMsg(Name, "line.Tray", "已有[" + num + "]个托盘被禁用,请尽快处理"));
//}
//else if (num >= 1)
//{
// alarmList.Add(new AlarmMsg(Name, "line.Tray", "已有[" + num + "]个托盘被禁用,请尽快处理"));
//}
foreach (EquipBase equip in AllEquipMap.Values)
{
if (equip.alarmType.Equals(LineAlarmType.None) || equip.WarnMsg.Contains("获取库位号超时"))
if (equip.alarmType.Equals(LineAlarmType.None) || equip.WarnMsg.Contains("获取库位号超时")||
equip.alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{
continue;
}
......
......@@ -858,10 +858,10 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
CheckLog(" 托盘检测:料盘检测StopCylinder_Check1 " + SecondMoveInfo.SLog + "阻挡气缸1-1下降 , 等待 StopCylinder_Check1=0,清理托盘RFID");
ClearTrayRFID();
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH, TrayManager.StopDTime);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);//TrayManager.StopDTime
SecondMoveInfo.OneWaitCanEndStep = true;
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
}
}
......@@ -911,11 +911,14 @@ namespace OnlineStore.DeviceLibrary
else
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopDownWait);
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待前阻挡检测消失或托盘到达");
SecondMoveInfo.OneWaitCanEndStep = true;
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
//CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待前阻挡检测消失或托盘到达");
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 300ms后StopCylinder_Check1上升");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
// SecondMoveInfo.OneWaitCanEndStep = true;
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_StopDownWait))
......@@ -1137,8 +1140,8 @@ namespace OnlineStore.DeviceLibrary
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Stop2Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_WaitTime);
CheckLog("托盘放行 " + SecondMoveInfo.SLog + " , 等待300ms后阻挡2上升");
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
CheckLog("托盘放行 " + SecondMoveInfo.SLog + " , 等待1000ms后阻挡2上升");
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_WaitTime))
{
......@@ -1150,9 +1153,17 @@ namespace OnlineStore.DeviceLibrary
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_19_StopCylinder_Back))
{
CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove();
if(RFIDManager.CheckHasSecond(DeviceID))
{
CheckLog("连续托盘流入处理,仓门口还有一个托盘需要放行");
MIO_02_FixtureCheck();
}
else
{
CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove();
}
}
#endregion
}
......
......@@ -14,11 +14,11 @@ namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum);
private static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum);
private static ReadAll readAll = new ReadAll("TheRFID");
private static bool IsOpen = false;
private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
public static void Open( )
public static void Open()
{
if (IsOpen)
{
......@@ -39,13 +39,60 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("Open 出错:" + ex.ToString());
}
}
}
public static ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>> RfidBuff = new ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>>();
static int getFirstTrayNum(string ip, int curNum)
{
RFIDBuff rFIDBuff = new RFIDBuff() { TrayNum = curNum, UpdateTime = DateTime.Now };
if (!RfidBuff.ContainsKey(ip))
{
RfidBuff.TryAdd(ip, new ConcurrentQueue<RFIDBuff>());
RfidBuff[ip].Enqueue(rFIDBuff);
}
else
{
if (!RfidBuff[ip].Contains(rFIDBuff))
RfidBuff[ip].Enqueue(rFIDBuff);
}
LogUtil.info($"[{ip}]加入缓存:{JsonHelper.SerializeObject(rFIDBuff)}");
if (RfidBuff[ip].TryDequeue(out RFIDBuff rFID))
{
LogUtil.info($"[{ip}]取第一个RFID:{JsonHelper.SerializeObject(rFID)}");
return rFID.TrayNum;
}
else
return 0;
}
static void clearTrayNumBuff(string ip)
{
//if (RfidBuff.ContainsKey(ip))
//{
// if (RfidBuff[ip].Count>0)
// RfidBuff[ip] = new ConcurrentQueue<RFIDBuff>();
//}
//LogUtil.info($"[{ip}]清除RFID缓存");
}
public static void ClearAllBuff()
{
//RfidBuff = new ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>>();
//LogUtil.info($"清除所有RFID缓存");
}
public static bool CheckHasSecond(int subType)
{
//string ip = GetRFIP(subType);
//if (RfidBuff.ContainsKey(ip))
//{
// if (RfidBuff[ip].Count > 0)
// return true;
//}
return false;
}
public static int GetTrayNum(int subType, bool isClear = false)
{
if (DefaultTrayNum > 0)
{
return DefaultTrayNum;
}
}
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
......@@ -62,7 +109,7 @@ namespace OnlineStore.DeviceLibrary
{
if (data.RFType.Equals('E'))
{
return data.Num;
return data.Num;// return getFirstTrayNum(ip, data.Num);
}
else if (data.RFType > 0)
{
......@@ -92,6 +139,7 @@ namespace OnlineStore.DeviceLibrary
string ip = GetRFIP(subType);
RFIDData data = ReadRFID(ip, true);
clearTrayNumBuff(ip);
}
catch (Exception ex)
{
......@@ -103,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
string ip = GetRFIP(subType, 1);
return ReadRFID(ip, true);
}
public static string GetRFIP(int subType, int rtType = 0)
{
string ip = "";
......@@ -145,11 +193,12 @@ namespace OnlineStore.DeviceLibrary
}
return new RFIDData();
}
public static void Close()
{
try
{
IsOpen = false;
readAll.Stop();
}
catch (Exception ex)
......@@ -159,6 +208,19 @@ namespace OnlineStore.DeviceLibrary
}
}
public class RFIDBuff
{
public int TrayNum { get; set; }
public DateTime UpdateTime { get; set; }
public override bool Equals(object obj)
{
RFIDBuff buf = obj as RFIDBuff;
if (buf == null)
return false;
return this.TrayNum.Equals(buf.TrayNum);
}
}
public class RFIDData
{
public string StrData = "";
......@@ -166,19 +228,19 @@ namespace OnlineStore.DeviceLibrary
public char RFType
{
get
{
{
char[] charArray = StrData.ToCharArray();
if (charArray.Length > 0)
{
return charArray[0];
}
}
return '0';
}
}
public int Num
{
get
{
{
try
{
if (StrData.Length >= 2)
......
......@@ -28,7 +28,7 @@ namespace OnlineStore.DeviceLibrary
}
public static int StopDTime = 2000;
public static int StopDTime = 1500;//2000
public static int mTimeOut = 20;
public static int SwTrayWaitTime = 500;
public static int StopDownWaitTime = 500;
......
......@@ -48,7 +48,7 @@ namespace Asa.IOModule
private readonly byte[] _addressOutput; //输出地址
private const int SEND_SLEEP = 60; //每条命令发送的间隔,不能小于15,会出现IO接收不到的情况,小于30时,会出现接收数据连包的情况
private const int PORT = 502; //端口
private const int UPLOAD_TIME = 3000; //8
private const int UPLOAD_TIME = 1000; //3秒改为1
private Thread tRecon; //重连线程
private Thread tSend; //发送命令处理
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!