Commit 79191892 LN

bug修改

1 个父辈 bfb74392
......@@ -106,8 +106,9 @@ namespace DeviceLibrary
case MoveStep.IN02_ScanCode:
if (ScanCodeTask == null || ScanCodeTask.IsCompleted)
{
MoveInfo.NewMove(MoveStep.IN03_GetPos);
MoveInfo.log("获取库位号");
//MoveInfo.NewMove(MoveStep.IN03_GetPos);
//MoveInfo.log("获取库位号");
IN03_GetPos();
}
else if (MoveInfo.IsTimeOut(60))
{
......
......@@ -649,6 +649,13 @@ namespace DeviceLibrary
}
private void ClearNgPos()
{
//清空ng库位列表
LogUtil.info("ClearNgPos清空NG库位缓存列表");
NgPosMap = new Dictionary<string, ReelParam>();
}
public string getReadyShelf(string split= ",")
{
string rfid = "";
......
......@@ -8,16 +8,17 @@ namespace DeviceLibrary
{
public partial class OutShelfBean: BaseBean
{
public static PuYueRFID_C2S RFID = null;
public PuYueRFID_C2S RFID = null;
/// <summary>
/// 出料口定位气缸,high=up,low=down
/// </summary>
private CylinderManger locationCylinder;
public ShelfInfo CurrShelf;
public ShelfInfo CurrShelf=new ShelfInfo();
public string rfidIp;
public int agvId;
public string agvName;
public bool rfidOpenOk = false;
public OutShelfBean(string name, string ip,int agvid,string agvname)
{
......@@ -44,6 +45,11 @@ namespace DeviceLibrary
{
SetWarnMsg(name + " RFID 打开失败:" + rfidIp);
}
else
{
rfidOpenOk = true;
LogUtil.info($"RFID[{RFID.IP}] 打开成功");
}
#endregion
}
public void Reset()
......@@ -275,7 +281,7 @@ namespace DeviceLibrary
case MoveStep.S04_WaitTime:
//如果料架需要离开,直接离开
if (CurrShelf.IsNeedLeave)
if (CurrShelf!=null&& CurrShelf.IsNeedLeave)
{
S21_ShelfNeedLeave("料架已经是离开状态");
}
......@@ -406,26 +412,53 @@ namespace DeviceLibrary
private bool ReadShelfId()
{
CurrShelf = new ShelfInfo("");
if (RFID.Open())
if (!rfidOpenOk)
{
if (RFID.ReadByte(0x20, 16, out byte[] data))
{
string rfid = Encoding.ASCII.GetString(data).Trim();
CurrShelf = new ShelfInfo(rfid);
LogUtil.info(Name + "RFID["+rfidIp+"]读取到料架号:" + CurrShelf.ToStr());
return true;
rfidOpenOk = RFID.Open();
if (!rfidOpenOk)
{
SetWarnMsg(Name + "RFID[" + RFID.IP + "]打开失败", MsgLevel.alarm);
}
else
}
//if (RFID.Open())
//{
if (RFID.ReadByte(0x20, 16, out byte[] data, out string errmsg))
{
string rfid = Encoding.ASCII.GetString(data).Trim().TrimEnd('\0');
CurrShelf = new ShelfInfo(rfid);
LogUtil.info(Name + "RFID[" + RFID.IP + "]读取到料架号:" + CurrShelf.ToStr());
return true;
}
else
{
//读取失败,重试之类
SetWarnMsg(Name + "RFID[" + RFID.IP + "]读取失败:" + errmsg, MsgLevel.alarm);
}
//}
//else
//{
// SetWarnMsg(Name + "RFID[" + RFID.IP + "]打开失败", MsgLevel.alarm);
//}
return false;
}
public string ReadTest()
{
if (!rfidOpenOk)
{
rfidOpenOk = RFID.Open();
if (!rfidOpenOk)
{
//读取失败,重试之类
SetWarnMsg(Name+ "RFID[" + rfidIp + "]读取失败",MsgLevel.alarm);
return "RFID[" + RFID.IP + "]打开失败";
}
}
else
if (RFID.ReadByte(0x20, 16, out byte[] data, out string errmsg))
{
SetWarnMsg(Name + "RFID[" + rfidIp + "]打开失败", MsgLevel.alarm);
string rfid = Encoding.ASCII.GetString(data).Trim().TrimEnd('\0');
return rfid;
}
return false;
return "RFID["+ RFID.IP + "]读取失败:"+ errmsg;
}
#region IO操作
......
......@@ -43,7 +43,7 @@ namespace DeviceLibrary
}
AgvClient.SetToNone(agvId, agvName);
}
else if (CurrShelf.realRFID.Equals("") && IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.LOW) && IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.LOW))
else if ((CurrShelf==null|| CurrShelf.realRFID.Equals("") )&& IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.LOW) && IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.LOW))
{
if (locationCylinder.IsLow())
{
......
......@@ -4,10 +4,10 @@ AXIS,,升降轴,UpDown_Axis,1,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,,进出轴,InOut_Axis,2,HC,,100000,0,0,0,40000,0,10,700,0,
AXIS,,压紧轴,Comp_Axis,3,HC,,100000,0,0,0,40000,0,10,700,0,0
,,,,,,,,,,,,,,,,
PRO,50,RFID-U1,RFID_U1,192.168.10.1,,,,,,,,,,,,
PRO,50,RFID-U2,RFID_U2,192.168.10.2,,,,,,,,,,,,
PRO,50,RFID-U3,RFID_U3,192.168.10.3,,,,,,,,,,,,
PRO,50,RFID-U4,RFID_U4,192.168.10.4,,,,,,,,,,,,
PRO,50,RFID-U1,RFID_U1,192.168.103.21,,,,,,,,,,,,
PRO,50,RFID-U2,RFID_U2,192.168.103.22,,,,,,,,,,,,
PRO,50,RFID-U3,RFID_U3,192.168.103.23,,,,,,,,,,,,
PRO,50,RFID-U4,RFID_U4,192.168.103.24,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,复位,Reset_BTN,1,HC,X01,,,,,,,,,,
......
......@@ -49,6 +49,7 @@ namespace TheMachine
this.tabc = new System.Windows.Forms.TabControl();
this.tabP1 = new System.Windows.Forms.TabPage();
this.pnl = new System.Windows.Forms.Panel();
this.chbDIsAgv = new System.Windows.Forms.CheckBox();
this.btnDownScan = new System.Windows.Forms.Button();
this.btnUpScan = new System.Windows.Forms.Button();
this.btnResetOut4 = new System.Windows.Forms.Button();
......@@ -62,7 +63,7 @@ namespace TheMachine
this.btn_IgnoreX09 = new System.Windows.Forms.Button();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.chbDIsAgv = new System.Windows.Forms.CheckBox();
this.btnClearNgPos = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.tabc.SuspendLayout();
this.tabP1.SuspendLayout();
......@@ -107,32 +108,32 @@ namespace TheMachine
// btn_run
//
this.btn_run.Name = "btn_run";
this.btn_run.Size = new System.Drawing.Size(180, 26);
this.btn_run.Size = new System.Drawing.Size(176, 26);
this.btn_run.Text = "启动";
this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(173, 6);
//
// btn_stop
//
this.btn_stop.Name = "btn_stop";
this.btn_stop.Size = new System.Drawing.Size(180, 26);
this.btn_stop.Size = new System.Drawing.Size(176, 26);
this.btn_stop.Text = "停止";
this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(173, 6);
//
// 启用调试模式ToolStripMenuItem
//
this.启用调试模式ToolStripMenuItem.Enabled = false;
this.启用调试模式ToolStripMenuItem.Name = "启用调试模式ToolStripMenuItem";
this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.启用调试模式ToolStripMenuItem.Tag = "not";
this.启用调试模式ToolStripMenuItem.Text = "启用配置模式";
this.启用调试模式ToolStripMenuItem.Click += new System.EventHandler(this.启用调试模式ToolStripMenuItem_Click);
......@@ -140,36 +141,36 @@ namespace TheMachine
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(173, 6);
//
// 禁用蜂鸣器ToolStripMenuItem
//
this.禁用蜂鸣器ToolStripMenuItem.Name = "禁用蜂鸣器ToolStripMenuItem";
this.禁用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.禁用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.禁用蜂鸣器ToolStripMenuItem.Text = "禁用蜂鸣器";
this.禁用蜂鸣器ToolStripMenuItem.Click += new System.EventHandler(this.禁用蜂鸣器ToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(173, 6);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem1.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem1.Text = "扫码测试";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(173, 6);
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
//
......@@ -186,7 +187,7 @@ namespace TheMachine
// 简体中文ToolStripMenuItem
//
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
......@@ -194,7 +195,7 @@ namespace TheMachine
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
......@@ -232,6 +233,7 @@ namespace TheMachine
//
// pnl
//
this.pnl.Controls.Add(this.btnClearNgPos);
this.pnl.Controls.Add(this.chbDIsAgv);
this.pnl.Controls.Add(this.btnDownScan);
this.pnl.Controls.Add(this.btnUpScan);
......@@ -250,6 +252,17 @@ namespace TheMachine
this.pnl.Size = new System.Drawing.Size(1000, 576);
this.pnl.TabIndex = 273;
//
// chbDIsAgv
//
this.chbDIsAgv.AutoSize = true;
this.chbDIsAgv.Location = new System.Drawing.Point(862, 263);
this.chbDIsAgv.Name = "chbDIsAgv";
this.chbDIsAgv.Size = new System.Drawing.Size(127, 25);
this.chbDIsAgv.TabIndex = 277;
this.chbDIsAgv.Text = "禁用AGV对接";
this.chbDIsAgv.UseVisualStyleBackColor = true;
this.chbDIsAgv.CheckedChanged += new System.EventHandler(this.chbDIsAgv_CheckedChanged);
//
// btnDownScan
//
this.btnDownScan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
......@@ -416,16 +429,17 @@ namespace TheMachine
this.listView1.TabIndex = 2;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// chbDIsAgv
// btnClearNgPos
//
this.chbDIsAgv.AutoSize = true;
this.chbDIsAgv.Location = new System.Drawing.Point(862, 263);
this.chbDIsAgv.Name = "chbDIsAgv";
this.chbDIsAgv.Size = new System.Drawing.Size(127, 25);
this.chbDIsAgv.TabIndex = 277;
this.chbDIsAgv.Text = "禁用AGV对接";
this.chbDIsAgv.UseVisualStyleBackColor = true;
this.chbDIsAgv.CheckedChanged += new System.EventHandler(this.chbDIsAgv_CheckedChanged);
this.btnClearNgPos.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClearNgPos.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClearNgPos.Location = new System.Drawing.Point(710, 254);
this.btnClearNgPos.Name = "btnClearNgPos";
this.btnClearNgPos.Size = new System.Drawing.Size(130, 32);
this.btnClearNgPos.TabIndex = 278;
this.btnClearNgPos.Text = "清空NG库位";
this.btnClearNgPos.UseVisualStyleBackColor = true;
this.btnClearNgPos.Click += new System.EventHandler(this.btnClearNgPos_Click);
//
// FormMain
//
......@@ -491,6 +505,7 @@ namespace TheMachine
private System.Windows.Forms.Button btnDownScan;
private System.Windows.Forms.Button btnUpScan;
private System.Windows.Forms.CheckBox chbDIsAgv;
private System.Windows.Forms.Button btnClearNgPos;
}
}
......@@ -751,5 +751,10 @@ namespace TheMachine
AgvClient.setDisAgv(chbDIsAgv.Checked);
}
private void btnClearNgPos_Click(object sender, EventArgs e)
{
LogUtil.info("用户点击了【"+btnClearNgPos.Text+"】");
}
}
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ namespace TheMachine
this.btnLocationStop = new System.Windows.Forms.Button();
this.btnDown = new System.Windows.Forms.Button();
this.btnUp = new System.Windows.Forms.Button();
this.btnRfid = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// cb_motolist
......@@ -155,9 +156,23 @@ namespace TheMachine
this.btnUp.UseVisualStyleBackColor = false;
this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
//
// btnRfid
//
this.btnRfid.BackColor = System.Drawing.Color.White;
this.btnRfid.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRfid.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRfid.Location = new System.Drawing.Point(565, 389);
this.btnRfid.Name = "btnRfid";
this.btnRfid.Size = new System.Drawing.Size(126, 33);
this.btnRfid.TabIndex = 7;
this.btnRfid.Text = "RFID读取测试";
this.btnRfid.UseVisualStyleBackColor = false;
this.btnRfid.Click += new System.EventHandler(this.btnRfid_Click);
//
// IOControls
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.btnRfid);
this.Controls.Add(this.btnLocationStop);
this.Controls.Add(this.btnDown);
this.Controls.Add(this.btnUp);
......@@ -185,5 +200,6 @@ namespace TheMachine
private System.Windows.Forms.Button btnLocationStop;
private System.Windows.Forms.Button btnDown;
private System.Windows.Forms.Button btnUp;
private System.Windows.Forms.Button btnRfid;
}
}
......@@ -99,5 +99,16 @@ namespace TheMachine
{
}
private void btnRfid_Click(object sender, EventArgs e)
{
var u = (KeyValuePair<string, string>)cb_motolist.SelectedItem;
string name = "U" + u.Value;
OutShelfBean outShelf = RobotManage.mainMachine.getOutShelf(name);
string rfid = outShelf.ReadTest();
LogUtil.info($"手动点击 U{u.Value} 读取rfid测试 结果:" + rfid);
MessageBox.Show($"U{u.Value} 读取rfid测试 结果:" + rfid);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!