Commit f50be7f3 顾剑亮
2 个父辈 2afe1e0f 7e0a1634
正在显示 44 个修改的文件 包含 684 行增加609 行删除
......@@ -8,8 +8,7 @@
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="自动点料机" />
<!--<add key="ServerAddr" value="http://10.85.17.233"/>-->
<!--<add key="ServerAddr" value="http://10.85.17.233"/>-->
<add key="ConfigPath_Robot" value="\RobotConfig\Config_Robot.csv" />
<add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" />
......@@ -28,7 +27,7 @@
<!--流水线监听端口-->
<add key="TCPServerPort" value="5246" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.160.20" />
<add key="AgvServerIp" value="10.85.199.20" />
<!--IO配置-->
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
......@@ -46,6 +45,8 @@
<add key ="LabelName" value ="test2"/>
<!--打印机名称-->
<add key ="PrinterName" value ="ZDesigner GT800-300dpi EPL"/>
<!--是否启用打印标签-->
<add key ="NeedPrintLabel" value ="0"/>
</appSettings>
<log4net>
......
......@@ -312,7 +312,7 @@
this.chbAutoIn.Name = "chbAutoIn";
this.chbAutoIn.Size = new System.Drawing.Size(154, 24);
this.chbAutoIn.TabIndex = 289;
this.chbAutoIn.Text = "检测到料自动取料";
this.chbAutoIn.Text = "检测到料自动取料";
this.chbAutoIn.UseVisualStyleBackColor = true;
this.chbAutoIn.CheckedChanged += new System.EventHandler(this.chbAutoIn_CheckedChanged);
//
......@@ -364,8 +364,8 @@
this.comTP.FormattingEnabled = true;
this.comTP.Items.AddRange(new object[] {
"XRay入口",
"工位高层",
"工位低层"});
"电容测值工位",
"电阻测值工位"});
this.comTP.Location = new System.Drawing.Point(752, 66);
this.comTP.Name = "comTP";
this.comTP.Size = new System.Drawing.Size(108, 28);
......@@ -423,7 +423,7 @@
this.btnUpdateShelf.Name = "btnUpdateShelf";
this.btnUpdateShelf.Size = new System.Drawing.Size(110, 40);
this.btnUpdateShelf.TabIndex = 281;
this.btnUpdateShelf.Text = "更改料号";
this.btnUpdateShelf.Text = "更改料号";
this.btnUpdateShelf.UseVisualStyleBackColor = false;
this.btnUpdateShelf.Visible = false;
this.btnUpdateShelf.Click += new System.EventHandler(this.btnUpdateShelf_Click);
......@@ -1018,7 +1018,7 @@
this.btnip4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnip4.Size = new System.Drawing.Size(163, 34);
this.btnip4.TabIndex = 319;
this.btnip4.Text = "进出轴人工工位放料点P4:";
this.btnip4.Text = "进出轴测值工位放料点P4:";
this.btnip4.UseVisualStyleBackColor = false;
this.btnip4.Click += new System.EventHandler(this.btnip4_Click);
//
......@@ -1048,7 +1048,7 @@
this.btnMP4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnMP4.Size = new System.Drawing.Size(163, 34);
this.btnMP4.TabIndex = 320;
this.btnMP4.Text = "旋转轴人工工位放料点P4:";
this.btnMP4.Text = "旋转轴测值工位放料点P4:";
this.btnMP4.UseVisualStyleBackColor = false;
this.btnMP4.Click += new System.EventHandler(this.btnMP4_Click);
//
......
......@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient
private void btnScan_Click(object sender, EventArgs e)
{
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.LeftCamera, equipBean.Name);
string msg = CodeManager.ProcessCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.LeftCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:" + msg);
}
......@@ -526,10 +528,10 @@ namespace OnlineStore.AutoCountClient
private void btnUpdateShelf_Click(object sender, EventArgs e)
{
//string shel = txtShelfID.Text.Trim();
//DialogResult result = MessageBox.Show("确定更改当前料号为:" + shel + "?", "", MessageBoxButtons.YesNo);
//DialogResult result = MessageBox.Show("确定更改当前料号为:" + shel + "?", "", MessageBoxButtons.YesNo);
//if (result.Equals(DialogResult.Yes))
//{
// LogUtil.info(equipBean.Name + "旧料架号【" + equipBean.CurrShelfId + "】手动更改料架号为【" + shel + "】");
// LogUtil.info(equipBean.Name + "旧料串号【" + equipBean.CurrShelfId + "】手动更改料串号为【" + shel + "】");
// equipBean.CurrShelfId = shel;
//}
}
......@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient
private void btnRScan_Click(object sender, EventArgs e)
{
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.RightCamera, equipBean.Name);
string msg = CodeManager.ProcessCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.RightCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:" + msg);
}
......@@ -689,6 +693,7 @@ namespace OnlineStore.AutoCountClient
private void btnPutTray_Click(object sender, EventArgs e)
{
LogUtil.info(equipBean.Name + "点击 取料测试");
if (equipBean.runStatus.Equals(RobotRunStatus.Runing) && equipBean.MoveInfo.MoveType.Equals(RobotMoveType.None))
{
int inp = comInP.SelectedIndex + 1;
......@@ -735,7 +740,7 @@ namespace OnlineStore.AutoCountClient
bool isCheck = chbAutoIn.Checked;
equipBean.AutoInput = isCheck;
ConfigAppSettings.SaveValue(Setting_Init.AutoInput, (isCheck ? 1 : 0));
LogUtil.info(equipBean.Name + "用户切换 检测到料自动取料 =" + isCheck);
LogUtil.info(equipBean.Name + "用户切换 检测到料自动取料 =" + isCheck);
}
}
......
......@@ -900,7 +900,7 @@
this.chbAutoSend.Name = "chbAutoSend";
this.chbAutoSend.Size = new System.Drawing.Size(140, 24);
this.chbAutoSend.TabIndex = 290;
this.chbAutoSend.Text = "放料完成送出料";
this.chbAutoSend.Text = "放料完成送出料";
this.chbAutoSend.UseVisualStyleBackColor = true;
this.chbAutoSend.CheckedChanged += new System.EventHandler(this.chbAutoSend_CheckedChanged);
//
......@@ -1432,7 +1432,7 @@
this.groupBox9.Controls.Add(this.btnBP1);
this.groupBox9.Controls.Add(this.btnBP2);
this.groupBox9.Controls.Add(this.txtBP2);
this.groupBox9.Location = new System.Drawing.Point(451, 313);
this.groupBox9.Location = new System.Drawing.Point(451, 325);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(268, 152);
this.groupBox9.TabIndex = 321;
......@@ -1534,7 +1534,7 @@
this.btnOpenAllAxis.BackColor = System.Drawing.Color.White;
this.btnOpenAllAxis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOpenAllAxis.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenAllAxis.Location = new System.Drawing.Point(12, 320);
this.btnOpenAllAxis.Location = new System.Drawing.Point(12, 332);
this.btnOpenAllAxis.Name = "btnOpenAllAxis";
this.btnOpenAllAxis.Size = new System.Drawing.Size(166, 40);
this.btnOpenAllAxis.TabIndex = 319;
......@@ -1547,7 +1547,7 @@
this.btnBSave.BackColor = System.Drawing.Color.White;
this.btnBSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBSave.ForeColor = System.Drawing.Color.Black;
this.btnBSave.Location = new System.Drawing.Point(260, 351);
this.btnBSave.Location = new System.Drawing.Point(260, 363);
this.btnBSave.Name = "btnBSave";
this.btnBSave.Size = new System.Drawing.Size(166, 40);
this.btnBSave.TabIndex = 310;
......@@ -1560,7 +1560,7 @@
this.btnCloseAxis.BackColor = System.Drawing.Color.White;
this.btnCloseAxis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCloseAxis.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseAxis.Location = new System.Drawing.Point(12, 362);
this.btnCloseAxis.Location = new System.Drawing.Point(12, 374);
this.btnCloseAxis.Name = "btnCloseAxis";
this.btnCloseAxis.Size = new System.Drawing.Size(166, 40);
this.btnCloseAxis.TabIndex = 320;
......@@ -1827,10 +1827,10 @@
//
// axisMoveControl1
//
this.axisMoveControl1.Location = new System.Drawing.Point(3, 4);
this.axisMoveControl1.Location = new System.Drawing.Point(3, 5);
this.axisMoveControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(728, 305);
this.axisMoveControl1.Size = new System.Drawing.Size(728, 310);
this.axisMoveControl1.TabIndex = 0;
//
// btnStop
......
......@@ -727,7 +727,7 @@ namespace OnlineStore.AutoCountClient
{
bool isCheck = chbAutoSend.Checked;
equipBean.AutoSendShelfOut = isCheck;
LogUtil.info(equipBean.Name + "用户切换 放料完成送出料 =" + isCheck);
LogUtil.info(equipBean.Name + "用户切换 放料完成送出料 =" + isCheck);
}
}
......
......@@ -105,9 +105,9 @@ namespace OnlineStore.AutoCountClient
this.listView1.Columns.Clear();
AddHealder("设备名称", 90);
AddHealder("启用", 50);
AddHealder("报警", 110);
AddHealder("报警", 130);
AddHealder("状态", 110);
AddHealder("料盘信息", listView1.Size.Width - 110 - 110 - 50 - 90 - 10);
AddHealder("料盘信息", listView1.Size.Width - 110 - 130 - 50 - 90 - 10);
//AddHealder("BOX状态", listView1.Size.Width - 100 - 80 - 80 - 100 - 100 - 100 -40- 8);
AddRow(robot.inputEquip, robot.inputEquip.IsDebug);
......@@ -454,6 +454,17 @@ namespace OnlineStore.AutoCountClient
SetItemText(i, item_debug_index, equip.IsDebug ? "✘" : "✔");
SetItemText(i, item_alarm_index, equip.alarmType.ToString());
SetItemText(i, item_runStr_index, equip.GetRunStr());
string trayInfo = "";
if (equip.MoveInfo.MoveType.Equals(RobotMoveType.Working) || equip.MoveInfo.MoveType.Equals(RobotMoveType.Labelling))
{
trayInfo = equip.MoveInfo.MoveParam.OutStr();
}
else if (equip.SecMoveInfo.MoveType.Equals(RobotMoveType.Working) || equip.SecMoveInfo.MoveType.Equals(RobotMoveType.Labelling))
{
trayInfo = equip.SecMoveInfo.MoveParam.OutStr();
}
SetItemText(i,item_move_info_index, trayInfo);
SetItemColor(i, equip.runStatus, equip.alarmType);
i++;
}
......@@ -564,6 +575,7 @@ namespace OnlineStore.AutoCountClient
private void 二维码学习ToolStripMenuItem_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
if (Camera._cam != null)
{
Camera._cam.CloseAll();
......@@ -571,6 +583,7 @@ namespace OnlineStore.AutoCountClient
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.ShowDialog();
frm.Dispose();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
}
......
......@@ -74,6 +74,8 @@
this.txtAxisValue = new System.Windows.Forms.TextBox();
this.txtAxisDeviceName = new System.Windows.Forms.TextBox();
this.lblServerOn = new System.Windows.Forms.Label();
this.txtStb = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.groupAxis.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -89,15 +91,17 @@
this.groupAxis.Controls.Add(this.panel1);
this.groupAxis.Controls.Add(this.lblServerOn);
this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupAxis.Location = new System.Drawing.Point(9, 4);
this.groupAxis.Location = new System.Drawing.Point(4, 3);
this.groupAxis.Name = "groupAxis";
this.groupAxis.Size = new System.Drawing.Size(716, 297);
this.groupAxis.Size = new System.Drawing.Size(724, 302);
this.groupAxis.TabIndex = 218;
this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtStb);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtBusyStatus);
this.groupBox1.Controls.Add(this.label11);
this.groupBox1.Controls.Add(this.txtHomeStatus);
......@@ -113,9 +117,9 @@
this.groupBox1.Controls.Add(this.txtLimit1);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtHomeSingle);
this.groupBox1.Location = new System.Drawing.Point(553, 11);
this.groupBox1.Location = new System.Drawing.Point(553, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(154, 277);
this.groupBox1.Size = new System.Drawing.Size(154, 282);
this.groupBox1.TabIndex = 302;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "状态";
......@@ -123,7 +127,7 @@
// txtBusyStatus
//
this.txtBusyStatus.Enabled = false;
this.txtBusyStatus.Location = new System.Drawing.Point(120, 80);
this.txtBusyStatus.Location = new System.Drawing.Point(120, 104);
this.txtBusyStatus.Name = "txtBusyStatus";
this.txtBusyStatus.Size = new System.Drawing.Size(25, 23);
this.txtBusyStatus.TabIndex = 288;
......@@ -131,7 +135,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(6, 113);
this.label11.Location = new System.Drawing.Point(6, 135);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(105, 17);
this.label11.TabIndex = 292;
......@@ -140,7 +144,7 @@
// txtHomeStatus
//
this.txtHomeStatus.Enabled = false;
this.txtHomeStatus.Location = new System.Drawing.Point(120, 110);
this.txtHomeStatus.Location = new System.Drawing.Point(120, 132);
this.txtHomeStatus.Name = "txtHomeStatus";
this.txtHomeStatus.Size = new System.Drawing.Size(25, 23);
this.txtHomeStatus.TabIndex = 291;
......@@ -148,7 +152,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(45, 83);
this.label10.Location = new System.Drawing.Point(45, 107);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(66, 17);
this.label10.TabIndex = 289;
......@@ -157,7 +161,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(52, 53);
this.label3.Location = new System.Drawing.Point(52, 51);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 17);
this.label3.TabIndex = 286;
......@@ -166,7 +170,7 @@
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(40, 203);
this.label24.Location = new System.Drawing.Point(40, 219);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(71, 17);
this.label24.TabIndex = 316;
......@@ -176,7 +180,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(54, 23);
this.label5.Location = new System.Drawing.Point(52, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(59, 17);
this.label5.TabIndex = 328;
......@@ -186,7 +190,7 @@
//
this.btnGetAlarm.BackColor = System.Drawing.Color.White;
this.btnGetAlarm.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnGetAlarm.Location = new System.Drawing.Point(35, 233);
this.btnGetAlarm.Location = new System.Drawing.Point(35, 245);
this.btnGetAlarm.Name = "btnGetAlarm";
this.btnGetAlarm.Size = new System.Drawing.Size(110, 34);
this.btnGetAlarm.TabIndex = 284;
......@@ -197,7 +201,7 @@
// txtAlarmStatus
//
this.txtAlarmStatus.Enabled = false;
this.txtAlarmStatus.Location = new System.Drawing.Point(120, 50);
this.txtAlarmStatus.Location = new System.Drawing.Point(120, 48);
this.txtAlarmStatus.Name = "txtAlarmStatus";
this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23);
this.txtAlarmStatus.TabIndex = 285;
......@@ -205,7 +209,7 @@
// txtLimit2
//
this.txtLimit2.Enabled = false;
this.txtLimit2.Location = new System.Drawing.Point(120, 200);
this.txtLimit2.Location = new System.Drawing.Point(120, 216);
this.txtLimit2.Name = "txtLimit2";
this.txtLimit2.Size = new System.Drawing.Size(25, 23);
this.txtLimit2.TabIndex = 313;
......@@ -221,7 +225,7 @@
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(40, 173);
this.label22.Location = new System.Drawing.Point(40, 191);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(71, 17);
this.label22.TabIndex = 312;
......@@ -231,7 +235,7 @@
// txtLimit1
//
this.txtLimit1.Enabled = false;
this.txtLimit1.Location = new System.Drawing.Point(120, 170);
this.txtLimit1.Location = new System.Drawing.Point(120, 188);
this.txtLimit1.Name = "txtLimit1";
this.txtLimit1.Size = new System.Drawing.Size(25, 23);
this.txtLimit1.TabIndex = 309;
......@@ -239,7 +243,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(52, 143);
this.label6.Location = new System.Drawing.Point(52, 163);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(59, 17);
this.label6.TabIndex = 300;
......@@ -248,7 +252,7 @@
// txtHomeSingle
//
this.txtHomeSingle.Enabled = false;
this.txtHomeSingle.Location = new System.Drawing.Point(120, 140);
this.txtHomeSingle.Location = new System.Drawing.Point(120, 160);
this.txtHomeSingle.Name = "txtHomeSingle";
this.txtHomeSingle.Size = new System.Drawing.Size(25, 23);
this.txtHomeSingle.TabIndex = 297;
......@@ -654,12 +658,29 @@
this.lblServerOn.Size = new System.Drawing.Size(0, 19);
this.lblServerOn.TabIndex = 268;
//
// txtStb
//
this.txtStb.Enabled = false;
this.txtStb.Location = new System.Drawing.Point(120, 76);
this.txtStb.Name = "txtStb";
this.txtStb.Size = new System.Drawing.Size(25, 23);
this.txtStb.TabIndex = 329;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(54, 79);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 17);
this.label2.TabIndex = 330;
this.label2.Text = "STB状态:";
//
// AxisMoveControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupAxis);
this.Name = "AxisMoveControl";
this.Size = new System.Drawing.Size(731, 305);
this.Size = new System.Drawing.Size(731, 310);
this.groupAxis.ResumeLayout(false);
this.groupAxis.PerformLayout();
this.groupBox1.ResumeLayout(false);
......@@ -718,5 +739,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox comjSpeed;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.TextBox txtStb;
private System.Windows.Forms.Label label2;
}
}
......@@ -158,6 +158,7 @@ namespace OnlineStore.AutoCountClient
{
this.txtAlarmStatus.Text = ACServerManager.GetAlarmStatus(PortName, SlvAddr).ToString();
this.txtBusyStatus.Text = ACServerManager.GetBusyStatus(PortName, SlvAddr).ToString();
this.txtStb.Text = ACServerManager.GetSTBState(PortName, SlvAddr).ToString();
this.txtHomeStatus.Text = ACServerManager.GetHomeEndStatus(PortName, SlvAddr).ToString();
this.txtHomeSingle.Text = ACServerManager.GetHomeSingle(PortName, SlvAddr).ToString();
this.txtLimit1.Text = ACServerManager.GetLimitPositiveSingle(PortName, SlvAddr).ToString();
......
......@@ -6,9 +6,24 @@
2.入料模块上料BUG:批量轴上料功能完善。
1.检测到料自动入库时,取料测试按钮不可用。
1.检测到料自动入库时,取料测试按钮不可用。
2.自动入库时,目标位置在界面上可选。
3.X光机互锁信号增加验证。
4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。
去掉X56
20200526
增加入料照明
增加条码解析
增加接口代码
IO模块更新。
复位时Z轴报94.0
尺寸信息传到出口
复位是Xray入口若有料,入口皮带线不转。
出料料串最后一个料盘,没有贴标就把料串送出了。
......@@ -68,7 +68,7 @@ namespace OnlineStore.Common
public static string ServerAddr = "ServerAddr";
/// <summary>
/// 检测到料自动入料
/// 检测到料自动入料
/// </summary>
public static string AutoInput = "AutoInput";
/// <summary>
......@@ -78,5 +78,6 @@ namespace OnlineStore.Common
public static string LabelName = "LabelName";
public static string PrinterName = "PrinterName";
public static string NeedPrintLabel = "NeedPrintLabel";
}
}
......@@ -236,15 +236,15 @@ namespace OnlineStore.Common
/// </summary>
public static string cutReel = "cutReel";
/// <summary>
/// smallReel: true 小料(7x8),放置到小料
/// smallReel: true 小料(7x8),放置到小料
/// </summary>
public static string smallReel = "smallReel";
/// <summary>
/// rfid: 分配的料RFID
/// rfid: 分配的料RFID
/// </summary>
public static string rfid = "rfid";
/// <summary>
/// rfidLoc: 料的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// rfidLoc: 料的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
/// </summary>
public static string rfidLoc = "rfidLoc";
......
......@@ -71,19 +71,14 @@ namespace OnlineStore.Common
}
}
return true;
}
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData, int timeOut = 2000)
}
public static string Post(string url, string paramData, int timeOut = 10000)
{
return Post(url, paramData, Encoding.UTF8, timeOut);
}
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding, int timeOut = 2000)
{
//if (PingURLIP(url, 100).Equals(false))
//{
// return "";
//}
public static string Post(string url, string paramData, Encoding encoding, int timeOut = 10000)
{
if (isLog == 1)
{
LogUtil.info("给服务器发送数据【" + paramData + "】 ");
......
......@@ -96,7 +96,6 @@
<Compile Include="deviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" />
<Compile Include="bean\RobotBean.cs" />
<Compile Include="bean\RobotBean_Partial.cs" />
<Compile Include="bean\X_RAY_Equip.cs" />
<Compile Include="bean\X_RAY_Equip_Partial.cs" />
<Compile Include="bean\EquipBase.cs" />
......
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,
PRO,0,左入料线体相机名称,LeftCamera,GigE:MV-CE200-10GC (00E02588201),,,,,
PRO,0,右入料线体相机名称,RightCamera,GigE:MV-CE200-10GC (00E02588199),,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
,,,,,,,,,
PRO,0,左侧上料口AGV站号名称,LeftAgvName,F1,,,,,
PRO,0,右侧上料口AGV站号名称,RightAgvName,F2,,,,,
PRO,0,左侧上料口AGV站号名称,LeftAgvName,D4,,,,,
PRO,0,右侧上料口AGV站号名称,RightAgvName,D3,,,,,
,,,,,,,,,
PRO,0,左侧提升轴待机点 P1,L_BatchAxisP1,100,,,,,
,0,左侧提升轴下降位置P2,L_BatchAxisP2,-48000,,,,,
......
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,
,,,,,,,,,
PRO,0,空料架入口AGV站号名称,AgvInName,F3,,,,,
PRO,0,料架出口AGV站号名称,AgvOutName,F4,,,,,
PRO,0,空料串入口AGV站号名称,AgvInName,D1,,,,,
PRO,0,料串出口AGV站号名称,AgvOutName,D2,,,,,
,,,,,,,,,
PRO,0,相机名称,CameraName,GigE:MV-CE200-10GC (00E02588177),,,,,
,,,,,,,,,
PRO,0,出料提升轴上升待机点 P1,BatchAxisP1,6332000,,,,,
PRO,0,出料提升轴下降位置P2,BatchAxisP2,-65841,,,,,
PRO,0,出料提升轴下降位置P2,BatchAxisP2,-80000,,,,,
PRO,0,出料提升轴缓慢上升目标位置P3,BatchAxisP3,5610528,,,,,
,,,,,,,,,
PRO,0,出料提升轴P1速度,BatchAxis_P1Speed,4000,,,,,
PRO,0,出料提升轴P2速度,BatchAxis_P2Speed,4000,,,,,
PRO,0,出料提升轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,出料提升轴P1速度,BatchAxis_P1Speed,3000,,,,,
PRO,0,出料提升轴P2速度,BatchAxis_P2Speed,3000,,,,,
PRO,0,出料提升轴P3速度,BatchAxis_P3Speed,1500,,,,,
PRO,0,出料提升轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,10446,,,,,
,,,,,,,,,
PRO,0,取料X轴待机点-P1,MoveX_P1,2001,,,,,
PRO,0,取料X轴-取料点-P2集合,MoveX_P2List,0=150000;8=150000;12=150000;16=150000;24=150000;32=140000;44=120000;56=100000;13=4710;15=1350;11=10120;7=15900,,,,,
PRO,0,取料X轴-取料点-P2集合,MoveX_P2List,0=15900;8=150000;12=150000;16=150000;24=150000;32=140000;44=120000;56=100000;13=4710;15=1350;11=10120;7=15900,,,,,
PRO,0,取料X轴-放料点-P3,MoveX_P3,77100,,,,,
PRO,0,取料X轴P1速度,MoveX_P1Speed,500,,,,,
PRO,0,取料X轴P2速度,MoveX_P2Speed,500,,,,,
PRO,0,取料X轴P3速度,MoveX_P3Speed,500,,,,,
,,,,,,,,,
PRO,0,取料Z轴待机点-P1,MoveZ_P1,2000,,,,,
PRO,0,取料Z轴-取料点-P2集合,MoveZ_P2List,0=120000;8=448700;12=443900;16=440000;24=429900;32=420100;44=409000;56=398620,,,,,
PRO,0,取料Z轴-取料点-P2集合,MoveZ_P2List,0=448700;8=448700;12=443900;16=440000;24=429900;32=420100;44=409000;56=398620,,,,,
PRO,0,取料Z轴-放料点-P3集合,MoveZ_P3List,0=108750;8=109700;12=100000;16=99000;24=93000;32=89000;44=74000;56=63500,,,,,
PRO,0,取料Z轴P1速度,MoveZ_P1Speed,500,,,,,
PRO,0,取料Z轴P2速度,MoveZ_P2Speed,500,,,,,
PRO,0,取料Z轴P3速度,MoveZ_P3Speed,500,,,,,
PRO,0,取料Z轴P1速度,MoveZ_P1Speed,1500,,,,,
PRO,0,取料Z轴P2速度,MoveZ_P2Speed,1500,,,,,
PRO,0,取料Z轴P3速度,MoveZ_P3Speed,1500,,,,,
,,,,,,,,,
PRO,0,贴标机构X轴待机点-P1,LabelX_P1,2000,,,,,
PRO,0,贴标机构X轴取标签点P2,LabelX_P2,5751,,,,,
PRO,0,贴标机构X轴贴标点P3,LabelX_P3,533032,,,,,
PRO,0,贴标机构X轴P1速度,LabelX_P1Speed,500,,,,,
PRO,0,贴标机构X轴P2速度,LabelX_P2Speed,500,,,,,
PRO,0,贴标机构X轴P3速度,LabelX_P3Speed,500,,,,,
PRO,0,贴标机构X轴P1速度,LabelX_P1Speed,1500,,,,,
PRO,0,贴标机构X轴P2速度,LabelX_P2Speed,1500,,,,,
PRO,0,贴标机构X轴P3速度,LabelX_P3Speed,1500,,,,,
,,,,,,,,,
PRO,0,贴标机构Y轴待机点-P1,LabelY_P1,2000,,,,,
PRO,0,贴标机构Y轴取标签点P2,LabelY_P2,123731,,,,,
PRO,0,贴标机构Y轴贴标点P3,LabelY_P3,4253,,,,,
PRO,0,贴标机构Y轴P1速度,LabelY_P1Speed,500,,,,,
PRO,0,贴标机构Y轴P2速度,LabelY_P2Speed,500,,,,,
PRO,0,贴标机构Y轴P3速度,LabelY_P3Speed,500,,,,,
PRO,0,贴标机构Y轴P1速度,LabelY_P1Speed,1500,,,,,
PRO,0,贴标机构Y轴P2速度,LabelY_P2Speed,1500,,,,,
PRO,0,贴标机构Y轴P3速度,LabelY_P3Speed,1500,,,,,
,,,,,,,,,
PRO,0,贴标机构Z轴待机点-P1,LabelZ_P1,2000,,,,,
PRO,0,贴标机构Z轴取标签点P2,LabelZ_P2,35935,,,,,
PRO,0,贴标机构Z轴贴标点P3,LabelZ_P3,174174,,,,,
PRO,0,贴标机构Z轴P1速度,LabelZ_P1Speed,500,,,,,
PRO,0,贴标机构Z轴P2速度,LabelZ_P2Speed,500,,,,,
PRO,0,贴标机构Z轴P3速度,LabelZ_P3Speed,500,,,,,
PRO,0,贴标机构Z轴P1速度,LabelZ_P1Speed,1500,,,,,
PRO,0,贴标机构Z轴P2速度,LabelZ_P2Speed,1500,,,,,
PRO,0,贴标机构Z轴P3速度,LabelZ_P3Speed,1500,,,,,
,,,,,,,,,
PRO,0,贴标机构R轴待机点-P1,LabelR_P1,0,,,,,
PRO,0,贴标机构R轴取标签点P2,LabelR_P2,0,,,,,
......@@ -56,4 +56,3 @@ PRO,0,贴标机构R轴贴标点P3,LabelR_P3,500,,,,,
PRO,0,贴标机构R轴P1速度,LabelR_P1Speed,20,,,,,
PRO,0,贴标机构R轴P2速度,LabelR_P2Speed,20,,,,,
PRO,0,贴标机构R轴P3速度,LabelR_P3Speed,20,,,,,
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,
......@@ -35,7 +35,6 @@ namespace OnlineStore.DeviceLibrary
actionMap = new Dictionary<string, Asa.ClientAction>();
LogUtil.info(" 开始 agvClient.Connect");
//}
agvClient.Connect();
foreach (string str in NodeList)
{
......@@ -73,7 +72,7 @@ namespace OnlineStore.DeviceLibrary
int index = shelfId.IndexOf(',');
if (index > 0)
{
//紧急出料模块,料架离开时,mark=紧急料或者分配料,rfid=料架
//紧急出料模块,料串离开时,mark=紧急料或者分配料,rfid=料串
mark = shelfId.Substring(index + 1, shelfId.Length - index - 1);
shelfId = shelfId.Substring(0, index);
}
......@@ -81,46 +80,44 @@ namespace OnlineStore.DeviceLibrary
agvClient.SetStatus(id,mark, shelfId, action, level);
UpdateAction(id, action);
}
private static void AgvClient_CloseDoor(string id, string rfid)
{
LogUtil.info("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] ");
}
private static void AgvClient_Ready(string id, string rfid)
{
UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
private static void AgvClient_Ready(string id, string rfid)
{
try
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
}
else if (RobotManager.robot.outputEquip.Config.AgvInName.Equals(id) || RobotManager.robot.outputEquip.Config.AgvOutName.Equals(id))
{
RobotManager.robot.outputEquip.AgvReady(id, rfid);
}
else
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
}
}
else
catch (Exception ex)
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
LogUtil.error("AgvClient_Ready [" + id + "] [" + rfid + "] 处理出错:" + ex.ToString());
}
}
private static void AgvClient_CloseDoor(string id, string rfid)
{
LogUtil.info("收到 AgvClient_CloseDoor [" + id + "] [" + rfid + "] 暂无需处理 ");
}
private static void AgvClient_Arrive(string id, string rfid)
{
UpdateAction(id, ClientAction.Arrive);
// RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] ");
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvArrive(id, rfid);
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.RightBatchMove.AgvArrive(id, rfid);
}
else
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
}
// UpdateAction(id, ClientAction.Arrive);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + rfid + "]暂无需处理 ");
}
internal static bool ISConnected()
......
......@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -24,10 +25,10 @@ namespace OnlineStore.DeviceLibrary
private InputEquip Robot
{
get { return RobotManager.robot.inputEquip; }
}
}
public BatchMoveBean(InputEquip_Config config, AxisBean axis, int inType = 1)
{
this.EquipType = inType;
this.BatchAxis = axis;
string ioAdd = "L_";
......@@ -78,7 +79,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (Robot.AutoInput&& Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
if (Robot.AutoInput && Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{
StartWorking(new WorkParam());
}
......@@ -92,8 +93,26 @@ namespace OnlineStore.DeviceLibrary
{
WorkingProcess();
}
}
//判断是否无料串
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.LOW)
&& Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.LOW)
&& Robot.CylinderIsOk(IO_LocationUp_1, IO_LocationDown_1)
&& Robot.CylinderIsOk(IO_LocationUp_2, IO_LocationDown_2))
{
if (RobotManager.checkWatch(shelfWatch, 3000, true))
{
AgvClient.NeedEnter(AgvName, "", Asa.ClientLevel.High);
}
}
else
{
shelfWatch.Stop();
AgvClient.SetToNone(AgvName);
}
}
private Stopwatch shelfWatch = new Stopwatch();
public bool Reset(bool needStop = false)
{
if (Robot.CanStartRun())
......@@ -102,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
{
StopMove();
}
MoveInfo.NewMove(RobotMoveType.Reset, StepEnum.IBR01_LocationDown);
MoveInfo.NewMove(RobotMoveType.Reset, StepEnum.IBR01_LocationDown);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
WorkLog("开始复位,定位气缸下降");
LocationDown(MoveInfo);
......@@ -132,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
if (Robot.IOValue(IO_LineIn_Check).Equals(Robot.IOValue(IO_LineEnd_Check)))
{
LineStop();
MoveInfo.NextMoveStep( StepEnum.IBR03_BatchHome);
MoveInfo.NextMoveStep(StepEnum.IBR03_BatchHome);
WorkLog("复位:批量轴开始回原点");
BatchAxis.HomeMove(MoveInfo);
}
......@@ -154,8 +173,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.IBR04_WaitTime);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
// WorkLog("复位:顶升气缸下降");
// LocationDown(MoveInfo);
// WorkLog("复位:顶升气缸下降");
// LocationDown(MoveInfo);
}
else if (MoveInfo.IsStep(StepEnum.IBR04_WaitTime))
{
......@@ -177,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.SuddenStop();
}
public DateTime LastAlarmTime = DateTime.Now;
public DateTime LastAlarmTime = DateTime.Now;
public AlarmType alarmType = AlarmType.None;
internal void Alarm(AlarmType alarmType)
{
......@@ -324,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - moveInfo.LastSetpTime;
string NotOkMsg = "";
bool isOk = !moveInfo.OneWaitCanEndStep;
bool isOk = !moveInfo.OneWaitCanEndStep;
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd)
......@@ -350,17 +369,17 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals(""))
{
isOk = false;
WarnMsg = Name + msg;
WarnMsg = Name + msg;
Alarm(AlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
LogUtil.error(WarnMsg, moveInfo.ErrorLogType);
break;
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
NotOkMsg = " [" + IOManager.GetDI(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]";
wait.IsEnd = Robot. IOValue(wait.IoType).Equals(wait.IoValue);
NotOkMsg = " [" + IOManager.GetIO(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]";
wait.IsEnd = Robot.IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd)
{
......@@ -371,7 +390,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = Robot.Config.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
LogUtil.error( WarnMsg, moveInfo.ErrorLogType);
if (alarmType.Equals(AlarmType.None))
{
Alarm(AlarmType.IoSingleTimeOut);
......@@ -398,19 +417,20 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(msg);
}
}
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W003_Time))
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
}
else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
{
//等待信号亮或者走到绝对位置才停止
if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue))
{
LogUtil.debug(Name + "CheckWaitResult 检测到" + BatchAxis.TargetIoType + "=" + BatchAxis.TargetIoValue + ",停止运行");
BatchAxis.AxisStopCheckMove();
BatchAxis.AxisStopCheckMove();
if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{
BatchAxis.SuddenStop();
......@@ -418,14 +438,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = true;
}
else
{
{
if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0))
{
{
BatchAxis.AxisStopCheckMove();
wait.IsEnd = true;
}
}
}else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
}
else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
{
if (LastCodeList.Count > 0)
{
......@@ -471,7 +492,7 @@ namespace OnlineStore.DeviceLibrary
{
second = 10;
}
LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
LogUtil.error(WarnMsg, moveInfo.ErrorLogType, second);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -482,5 +503,11 @@ namespace OnlineStore.DeviceLibrary
}
public string GetMoveStr()
{
string code = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.WareCode : "";
return MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + code + "\n";
}
}
}
......@@ -329,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = Name + msg;
Alarm(AlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
LogUtil.error(WarnMsg, moveInfo.ErrorLogType);
break;
}
}
......@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
LogUtil.error( WarnMsg, moveInfo.ErrorLogType);
if (NoAlarm())
{
Alarm(AlarmType.IoSingleTimeOut);
......@@ -424,7 +424,7 @@ namespace OnlineStore.DeviceLibrary
{
second = 10;
}
LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
LogUtil.error(WarnMsg, moveInfo.ErrorLogType, second);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -452,13 +452,13 @@ namespace OnlineStore.DeviceLibrary
code = "[" + MoveInfo.MoveParam.WareCode + "]";
}
}
LogUtil.info(MoveInfo.Name + " ["+ MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] " + msg);
LogUtil.info(MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + msg);
}
protected void SecWorkLog(string msg)
{
LogUtil.info(SecMoveInfo.Name + " [" + SecMoveInfo.MoveType + "][" + SecMoveInfo.MoveStep + "] " + msg);
LogUtil.info(SecMoveInfo.Name + "[" + SecMoveInfo.MoveStep + "] " + msg);
}
public virtual string GetMoveStr()
......
......@@ -105,7 +105,7 @@ namespace OnlineStore.DeviceLibrary
AgvClient.SetStatus(Config.LeftAgvName);
AgvClient.SetStatus(Config.RightAgvName);
TimerMaxSeconds = 10;
// TimerMaxSeconds = 10;
SetWarnMsg("");
alarmType = AlarmType.None;
isInSuddenDown = false;
......@@ -139,6 +139,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IR03_InoutToP1))
{
MoveInfo.NextMoveStep(StepEnum.IR04_UpdownAxisHome);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
WorkLog("复位:升降轴原点返回,左右批量轴开始回原点");
UpdownAxis.HomeMove(MoveInfo);
LeftBatchMove.Reset();
......@@ -187,7 +188,7 @@ namespace OnlineStore.DeviceLibrary
if (!LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.None))
{
WarnMsg =Name+ "等待" + LeftBatchMove.Name + "复位完成超时[" + MoveInfo.TimeOutSeconds + "]秒";
LogUtil.error( WarnMsg);
LogUtil.error( WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
else
......@@ -240,12 +241,14 @@ namespace OnlineStore.DeviceLibrary
{
//若左侧或右侧在等待扫码结束的状态,需要开始去取料
if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{
StartWorking(new WorkParam(1, 0, LeftBatchMove.GetCurrCode()));
{
string code = LeftBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(1, 0, code));
}
else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{
StartWorking(new WorkParam(2, 0, RightBatchMove.GetCurrCode()));
string code = RightBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(2, 0, code));
}
}
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm())
......@@ -360,7 +363,7 @@ namespace OnlineStore.DeviceLibrary
string msg = "";
int tLength = 15;
msg += "左侧料架:" + LeftBatchMove.CurrShelfId + " 右侧料架:"+RightBatchMove.CurrShelfId+" \r\n";
msg += "左侧料串:" + LeftBatchMove.CurrShelfId + " 右侧料串:"+RightBatchMove.CurrShelfId+" \r\n";
msg += "runS: " + runStatus + "\n";
msg += "alarm: " + alarmType + " " + LeftBatchMove.alarmType +" " + RightBatchMove.alarmType +"\n";
......@@ -373,8 +376,8 @@ namespace OnlineStore.DeviceLibrary
{
msg+= "\n";
}
msg += "左侧上料 :" + LeftBatchMove.MoveInfo.MoveType + " "+LeftBatchMove.MoveInfo.MoveStep + "\n";
msg += "右侧上料:" + RightBatchMove.MoveInfo.MoveType + " " + RightBatchMove.MoveInfo.MoveStep + "\n";
msg += "左侧上料 :" + LeftBatchMove.GetMoveStr()+"\n";
msg += "右侧上料:" + RightBatchMove.GetMoveStr() + "\n";
return msg;
}
}
......
......@@ -175,28 +175,62 @@ namespace OnlineStore.DeviceLibrary
if (moveBean.LastHeight > 0 || isOk)
{
MoveInfo.NextMoveStep(StepEnum.IW10_SaveSize);
WorkLog(" 测宽度,记录条码高度宽度,开始下一盘预扫码");
MoveInfo.MoveParam.PlateH = moveBean.LastHeight;
MoveInfo.MoveParam.PlateW = GetWidth();
WorkLog("测高结束, 记录尺寸【"+ MoveInfo.MoveParam.PlateW + "X"+ MoveInfo.MoveParam.PlateH + "】,开始下一盘预扫码");
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg =Name+ "等待" + moveBean.Name + "测高结束超时[" + MoveInfo.TimeOutSeconds + "]秒";
LogUtil.error(Name + WarnMsg);
LogUtil.error( WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsStep(StepEnum.IW10_SaveSize))
{
MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition);
if (MoveInfo.MoveParam.TargetPosType.Equals(0))
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (String.IsNullOrEmpty(MoveInfo.MoveParam.WareCode))
{
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = "无有效条码";
MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 无有效条码,从XRay放到NG箱:" + MoveInfo.MoveParam.ToStr());
}
else if (SServerManager.CanConnect())
{
Task task = Task.Factory.StartNew(delegate
{
int needPosition = 0;
string msg = SServerManager.Get_VMICheckRLC(Name, MoveInfo.MoveParam.WareCode, out needPosition);
if (needPosition >= 1 && needPosition <= 3)
{
MoveInfo.MoveParam.TargetPosType = needPosition;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】通过接口获取目标位置:" + needPosition);
}
// else if (!msg.Equals("") || needPosition.Equals(0))
else
{
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】获取是否测值失败:" + msg);
MoveInfo.MoveParam.TargetPosType = 1;
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg;
}
});
}
else
{
if (DefautTargetP > 0)
{
MoveInfo.MoveParam.TargetPosType = DefautTargetP;
if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{
if (DefautTargetP > 0)
{
MoveInfo.MoveParam.TargetPosType = DefautTargetP;
}
}
WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr());
}
WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr());
}
#endregion
......@@ -204,22 +238,36 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{
//随机目标地址
Random r = new Random();
int targetP = r.Next(1, 100) % 3 + 1;
MoveInfo.MoveParam.TargetPosType = targetP;
WorkLog(" 随机放料目标:" + targetP);
if (SServerManager.CanConnect())
{
if (MoveInfo.IsTimeOut(120))
{
WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒";
LogUtil.error( WarnMsg,MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
return;
}
else
{
//随机目标地址
Random r = new Random();
int targetP = r.Next(1, 100) % 3 + 1;
MoveInfo.MoveParam.TargetPosType = targetP;
WorkLog(" 随机放料目标:" + targetP);
}
}
if (MoveInfo.MoveParam.TargetPosType.Equals(1))
{
MoveInfo.NextMoveStep(StepEnum.IW21_MiddleToP3);
WorkLog(" 开始放料到XRay皮带线,旋转轴到P3");
WorkLog(" 开始放料到XRay入口,旋转轴到P3");
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P3, Config.MiddleAxis_P3Speed);
}
else
{
MoveInfo.NextMoveStep(StepEnum.IW31_MIddleToP4);
WorkLog(" 开始放料到人工工位,旋转轴到P4");
WorkLog(" 开始放料到测值工位,旋转轴到P4");
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
}
}
......@@ -227,20 +275,20 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW21_MiddleToP3))
{
MoveInfo.NextMoveStep(StepEnum.IW22_UpdownToP3);
WorkLog(" 放料到XRay: 升降轴到P3");
WorkLog("->XRay: 升降轴到P3");
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P3, Config.UpdownAxis_P3Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW22_UpdownToP3))
{
MoveInfo.NextMoveStep(StepEnum.IW23_InoutToP3);
WorkLog(" 放料到XRay:进出轴到P3");
WorkLog("->XRay:进出轴到P3");
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P3, Config.InoutAxis_P3Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW23_InoutToP3))
{
MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut);
WorkLog(" 放料到XRay:等待XRay可放料");
WorkLog("->XRay:等待XRay可放料");
MoveInfo.TimeOutSeconds = 120;
//TODO
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check, IO_VALUE.LOW));
......@@ -249,52 +297,51 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut))
{
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
RobotManager.robot.XrayBean.In_ReelInfo = new ReelInfo(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH);
WorkLog(" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr());
RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo();
WorkLog("->XRay:夹料气缸放松,更新XRay入口料盘:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr());
CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax);
}
else if (MoveInfo.IsStep(StepEnum.IW31_MIddleToP4))
{
MoveInfo.NextMoveStep(StepEnum.IW32_UpdownToP4);
WorkLog(" 放料到工位:升降轴到P4");
WorkLog("->测值工位:升降轴到P4");
UpdownAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Updown_PutP(Config), Config.UpdownAxis_P4Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW32_UpdownToP4))
{
MoveInfo.NextMoveStep(StepEnum.IW33_InoutToP4);
WorkLog(" 放料到工位:进出轴到P4");
WorkLog("->测值工位:进出轴到P4");
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P4, Config.InoutAxis_P4Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW33_InoutToP4))
{
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
WorkLog(" 放料到工位:夹料气缸放松");
WorkLog("->测值工位:夹料气缸放松");
CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax);
}
else if (MoveInfo.IsStep(StepEnum.IW41_Clamping_Relax))
{
MoveInfo.NextMoveStep(StepEnum.IW42_InoutToP1);
WorkLog(" 放料完成:进出轴返回P1");
WorkLog("放料完成:进出轴返回P1");
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P1, Config.InoutAxis_P1Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW42_InoutToP1))
{
MoveInfo.NextMoveStep(StepEnum.IW43_UpdownToP1);
WorkLog(" 放料完成:升降轴旋转轴返回P1");
WorkLog("放料完成:升降轴返回P1");
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW43_UpdownToP1))
{
MoveInfo.NextMoveStep(StepEnum.IW44_MiddleToP2);
WorkLog(" 放料完成:旋转轴返回P2");
WorkLog("放料完成:旋转轴返回P2");
MiddleAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Middle_P2(Config), Config.MiddleAxis_P2Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW44_MiddleToP2))
{
MoveInfo.EndMove();
WorkLog(" 放料完成");
WorkLog("放料完成");
}
}
......
......@@ -3,6 +3,7 @@ using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
......@@ -35,10 +36,11 @@ namespace OnlineStore.DeviceLibrary
baseConfig = config;
this.DeviceID = config.Id;
this.Config = config;
IsDebug = config.IsDebug.Equals(1);
baseConfig = config;
IsDebug = config.IsDebug.Equals(1);
Name = (" " + "出料模块" + " ").ToUpper();
Init();
Init();
ledProcessTimer.Elapsed += LedProcess;
IoCheckTimer.Elapsed += IoCheckTimerProcess;
MoveInfo = new RobotMoveInfo(" 取放料 ");
SecMoveInfo = new RobotMoveInfo( " 贴标 ");
ShelfMoveInfo = new RobotMoveInfo(" ShelfMove ");
......@@ -110,17 +112,19 @@ namespace OnlineStore.DeviceLibrary
AgvClient.SetStatus(Config.AgvInName);
AgvClient.SetStatus(Config.AgvOutName);
TimerMaxSeconds = 10;
//TimerMaxSeconds = 10;
SetWarnMsg("");
alarmType = AlarmType.None;
isInSuddenDown = false;
isNoAirCheck = false;
MoveInfo.NextMoveStep(StepEnum.OMR01_MoveZHome);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
WorkLog("取料Z轴原点返回");
MoveZAxis.HomeMove(MoveInfo);
SecMoveInfo.NextMoveStep(StepEnum.OLR01_LabelZHome);
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
SecWorkLog("贴标Z轴原点返回,标签吸码停止输出,贴标气缸后退");
LabelZAxis.HomeMove(SecMoveInfo);
IOMove(IO_Type.Nozzle_Work, IO_VALUE.LOW);
......@@ -136,6 +140,8 @@ namespace OnlineStore.DeviceLibrary
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.O_WLine_WorkStop, IO_VALUE.LOW));
isInPro = false;
}
protected override void ResetProcess()
{
if (MoveInfo.MoveType.Equals(RobotMoveType.Reset) || MoveInfo.MoveType.Equals(RobotMoveType.RHome))
......@@ -279,7 +285,7 @@ namespace OnlineStore.DeviceLibrary
protected void ShelfWorkLog(string msg)
{
LogUtil.info(ShelfMoveInfo.Name + " [" + ShelfMoveInfo.MoveType + "][" + ShelfMoveInfo.MoveStep + "] " + msg);
LogUtil.info(ShelfMoveInfo.Name + "[" + ShelfMoveInfo.MoveStep + "] " + msg);
}
private void BatchResetMovePro()
......@@ -303,16 +309,17 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OBR02_CylinderBack))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OBR03_LineRun); ;
ShelfWorkLog(" :链条先转动3秒钟,横移电机停止");
ShelfWorkLog(" :链条先转动8秒钟,横移电机停止");
IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW);
}
else if (ShelfMoveInfo.IsStep(StepEnum.OBR03_LineRun))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OBR04_BatchAxisHome); ;
ShelfWorkLog(" :链条停止转动,批量轴原点返回");
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
IOMove(IO_Type.O_WLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.LOW);
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW);
......@@ -374,21 +381,24 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
WorkingProcess();
}
if (SecMoveInfo.MoveType.Equals(RobotMoveType.Labelling))
{
LabellingProcess();
}
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
WorkingProcess();
}
if (ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro))
{
ShelfMoveProcess();
}
}
}
private Stopwatch needEnterWatch = new Stopwatch();
private Stopwatch needLeaveWatch = new Stopwatch();
protected override void BaseTimerProcess()
{
if (isInSuddenDown || isNoAirCheck)
......@@ -414,13 +424,45 @@ namespace OnlineStore.DeviceLibrary
{
if (NoErrorAlarm() && IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW))
{
//料架准备好才能取料
if (OutReelCount >= 0&& SecMoveInfo.MoveType.Equals(RobotMoveType.None))
//料串准备好才能取料
if (OutReelCount >= 0)
//if (OutReelCount >= 0 && SecMoveInfo.MoveType.Equals(RobotMoveType.None))
{
StartWorking(new WorkParam());
}
}
}
}
//入口无信号NeedEnter
if (IOValue(IO_Type.O_ELine_InCheck).Equals(IO_VALUE.LOW) && IOValue(IO_Type.O_WLine_InCheck).Equals(IO_VALUE.LOW) && CylinderIsOk(IO_Type.O_ELine_TopUp, IO_Type.O_ELine_TopDown))
{
if (RobotManager.checkWatch(needEnterWatch, 3000))
{
AgvClient.NeedEnter(Config.AgvInName, "", Asa.ClientLevel.High);
}
}
else
{
needEnterWatch.Stop();
AgvClient.SetToNone(Config.AgvInName);
}
//出口有信号NeedLeave
if (IOValue(IO_Type.O_WLine_OutCheck).Equals(IO_VALUE.HIGH))
{
if (RobotManager.checkWatch(needLeaveWatch, 3000))
{
AgvClient.NeedEnter(Config.AgvOutName, "", Asa.ClientLevel.High);
}
}
else
{
needLeaveWatch.Stop();
AgvClient.SetToNone(Config.AgvOutName);
}
if (NoErrorAlarm())
{
......@@ -473,14 +515,20 @@ namespace OnlineStore.DeviceLibrary
msg += "alarm: " + alarmType + "\n";
msg += "取料状态:" + MoveInfo.MoveType + " " + MoveInfo.MoveStep + "\n";
msg += "贴标状态:" + SecMoveInfo.MoveType + " " + SecMoveInfo.MoveStep + "\n";
msg += "料状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n";
msg += "料状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n";
//msg += "料盘信息:" + MoveInfo.MoveParam.ToStr() + " \r\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
msg += "当前料架:" + WorkShelfId + ",累积出料 "+OutReelCount+" 盘共 "+OutReelHeight+" mm \r\n";
msg += "打印机["+RobotManager.PrintName+"]:" + RobotManager.LastPrintStatus + "\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
msg += "当前料串:" + WorkShelfId + ",累积出料 " + OutReelCount + " 盘共 " + OutReelHeight + " mm \r\n";
msg += "打印机[" + RobotManager.PrintName + "]:" + RobotManager.LastPrintStatus + "\n";
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
msg += "取放料盘:" + MoveInfo.MoveParam.OutStr() + " \r\n";
}
else if (SecMoveInfo.MoveType.Equals(RobotMoveType.Labelling))
{
msg += "贴标料盘:" + SecMoveInfo.MoveParam.OutStr() + " \r\n";
}
return msg;
}
......@@ -647,5 +695,8 @@ namespace OnlineStore.DeviceLibrary
#endregion
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
partial class RobotBean
{
#region 定时处理方法
private DateTime preIoTimerOutTime = DateTime.Now;
private void IOTimeOutProcess()
{
try
{
TimeSpan span = DateTime.Now - preIoTimerOutTime;
if (span.TotalSeconds > 1 && alarmType.Equals(AlarmType.IoSingleTimeOut))
{
preIoTimerOutTime = DateTime.Now;
if (runStatus < RobotRunStatus.Runing || isInSuddenDown || isNoAirCheck)
{
return;
}
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
// if (MoveInfo.IsInWait.Equals(false) && SW41_MoveInfo.IsInWait.Equals(false) && SW23_MoveInfo.IsInWait.Equals(false))
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = AlarmType.None;
SetWarnMsg("");
}
}
}
catch (Exception ex)
{
LogUtil.error("IOTimeOutProcess出错:", ex);
}
}
private DateTime preRWTime = DateTime.Now;
private void CheckWait(RobotMoveInfo checkWaitInfo)
{
try
{
List<WaitResultInfo> list = checkWaitInfo.WaitList;
if (list.Count <= 0)
{
checkWaitInfo.EndStepWait();
return;
}
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - checkWaitInfo.LastSetpTime;
string NotOkMsg = "";
bool isOk = true;
if (checkWaitInfo.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait == null || wait.IsEnd)
{
continue;
}
NotOkMsg = " [" + wait.ToStr() + "] ";
if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
NotOkMsg = " [" + IOManager.GetDI(wait.IoType, DeviceID).DisplayStr + "=" + wait.IoValue + "] ";
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd)
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalSeconds > RobotManager.Config.IOSingle_TimerOut && NoAlarm())
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时";
Alarm(AlarmType.IoSingleTimeOut);
LogUtil.error(MoveInfo.Name + WarnMsg, 901);
}
//超过报警时长
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < RobotManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
string msg = checkWaitInfo.Name + " " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds,1) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{
if (ww != null && ww.WaitType.Equals(2) && baseConfig.DOList.ContainsKey(ww.IoType))
{
if (IOManager.DOValue(ww.IoType, baseConfig.Id).Equals(ww.IoValue).Equals(false))
{
isLog = true;
IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ",";
}
}
}
if (isLog)
{
LogUtil.error(msg);
}
}
if (!checkWaitInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W003_Time))
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
if (wait.IsEnd)
{
if (checkWaitInfo.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else
{
if (!checkWaitInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
if (isOk)
{
checkWaitInfo.EndStepWait();
}
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
{
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 900);
Alarm(AlarmType.IoSingleTimeOut);
}
}
catch (Exception ex)
{
LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:", ex);
}
}
#endregion
public override bool StartLabelling(WorkParam param)
{
return true;
}
protected override void LabellingProcess()
{
}
public override bool StartWorking(WorkParam param)
{
return true;
}
protected override void WorkingProcess()
{
}
private void InOutLog(string msg)
{
LogUtil.debug(Name + msg);
}
public override void Alarm(AlarmType alarmType)
{
}
}
}
......@@ -26,7 +26,9 @@ namespace OnlineStore.DeviceLibrary
IsDebug = config.IsDebug.Equals(1);
Name = (" " + "XRay" + " ").ToUpper();
Init();
Init();
ledProcessTimer.Elapsed += LedProcess;
IoCheckTimer.Elapsed += IoCheckTimerProcess;
MoveInfo = new RobotMoveInfo(Name);
SecMoveInfo = new RobotMoveInfo( Name.Trim() + "-SMove");
}
......@@ -63,7 +65,7 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
TimerMaxSeconds = 10;
//TimerMaxSeconds = 10;
SetWarnMsg("");
alarmType = AlarmType.None;
isInSuddenDown = false;
......@@ -88,9 +90,18 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.IsStep(StepEnum.XR01_CloseXLock))
{
MoveInfo.NextMoveStep(StepEnum.XR02_DoorOpen);
WorkLog("XRay复位 :左侧们打开,右侧门打开,挡停不动作");
CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
if (IOValue(IO_Type.X_ReelCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH))
{
WorkLog("XRay复位 :左侧们打开,右侧门打开,挡停下降");
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
}
else
{
WorkLog("XRay复位 :左侧们打开,右侧门打开,挡停不动作");
}
}
else if (MoveInfo.IsStep(StepEnum.XR02_DoorOpen))
{
......@@ -121,8 +132,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.XR05_DoorClose);
WorkLog(" XRay复位: 左右门关闭,挡停下降 ");
CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_InDoor_Down, IO_Type.X_InDoor_Up);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
}
else if (MoveInfo.IsStep(StepEnum.XR05_DoorClose))
......@@ -166,20 +177,38 @@ namespace OnlineStore.DeviceLibrary
}
BusyMoveProcess();
IOTimeOutProcess();
//判断流水线打开了才可以运行
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None))
{
if (NoAlarm() && MoveInfo.MoveType.Equals(RobotMoveType.None))
{
if (IOValue(IO_Type.X_ReelCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.X_InLine_Check).Equals(IO_VALUE.HIGH))
{
StartWorking(new WorkParam());
}
}
}
LockOnProcess();
}
if(NoAlarm()&& MoveInfo.MoveType.Equals(RobotMoveType.None))
private void LockOnProcess()
{
//不在复位,可以验证是否打开互锁信号
if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.HIGH))
{
if (IOValue(IO_Type.X_ReelCheck).Equals(IO_VALUE.HIGH)||IOValue(IO_Type.X_InLine_Check ).Equals(IO_VALUE.HIGH))
if (!LockOnCanMove())
{
StartWorking(new WorkParam());
IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW);
}
}
else
{
if ((!MoveInfo.MoveType.Equals(RobotMoveType.Reset)) && (!MoveInfo.MoveType.Equals(RobotMoveType.RHome)))
{
if (LockOnCanMove() && (!isInSuddenDown) && (!isNoAirCheck))
{
IOMove(IO_Type.X_Lock_On, IO_VALUE.HIGH);
}
}
}
}
......
......@@ -49,7 +49,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.SetReelInfo(Work_ReelInfo);
MoveInfo.NextMoveStep(StepEnum.XW06_WaitTime);
WorkLog("扫描区有料["+Work_ReelInfo.ToStr()+"],还未进行点料,开始处理");
IOMove(IO_Type.X_InLine_Run, IO_VALUE.HIGH);
//IOMove(IO_Type.X_InLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_ReelCheck, IO_VALUE.HIGH));
......@@ -69,7 +69,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(RobotMoveType.Working);
MoveInfo.MoveParam.SetReelInfo(In_ReelInfo);
MoveInfo.NextMoveStep(StepEnum.XW01_WaitInReel);
WorkLog("入口皮带线有料[" + In_ReelInfo.ToStr() + "],开始准备点料");
WorkLog("入口皮带线有料[" + In_ReelInfo.ToStr() + "],开始处理");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check,IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_ReelCheck, IO_VALUE.LOW));
......@@ -90,17 +90,18 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.IsStep(StepEnum.XW01_WaitInReel))
{
MoveInfo.NextMoveStep(StepEnum.XW02_InDoorOpen);
WorkLog("料盘处理:左侧门打开");
WorkLog("料盘处理:左侧门打开,挡停下降");
CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down);
}
else if (MoveInfo.IsStep(StepEnum.XW02_InDoorOpen))
{
MoveInfo.NextMoveStep(StepEnum.XW03_StopCylinderDown);
WorkLog("料盘处理:挡停下降");
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
}
else if (MoveInfo.IsStep(StepEnum.XW03_StopCylinderDown))
else if (MoveInfo.IsStep(StepEnum.XW02_InDoorOpen))
{
// MoveInfo.NextMoveStep(StepEnum.XW03_StopCylinderDown);
// WorkLog("料盘处理:挡停下降");
// CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
//}
//else if (MoveInfo.IsStep(StepEnum.XW03_StopCylinderDown))
//{
MoveInfo.NextMoveStep(StepEnum.XW04_InLineRun);
WorkLog("料盘处理:入口和中间皮带线转动,");
IOMove(IO_Type.X_InLine_Run, IO_VALUE.HIGH);
......@@ -117,12 +118,13 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.XW05_WaitMCheck))
{
MoveInfo.NextMoveStep(StepEnum.XW06_WaitTime);
WorkLog("料盘处理:更新Work_ReelInfo,清空 In_ReelInfo,再转动3秒钟");
Work_ReelInfo = new ReelInfo(In_ReelInfo.WareCode, In_ReelInfo.PlateW, In_ReelInfo.PlateH);
Work_ReelInfo = In_ReelInfo.GetReelInfo();
In_ReelInfo = new ReelInfo();
WorkLog("料盘处理:更新Work_ReelInfo【" + Work_ReelInfo.ToStr() + "】,清空 In_ReelInfo,再转动2秒钟");
IOMove(IO_Type.X_InLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_ReelCheck, IO_VALUE.HIGH));
}
else if (MoveInfo.IsStep(StepEnum.XW06_WaitTime))
......@@ -136,8 +138,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.XW08_DoorClose);
WorkLog("料盘处理:左侧门关闭,右侧门关闭,准备开始点料");
CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_InDoor_Down, IO_Type.X_InDoor_Up);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_DoorLimit_Down, IO_VALUE.HIGH));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_DoorLimit_Up, IO_VALUE.HIGH));
......@@ -157,16 +159,22 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XW12_EndCount);
if (Work_ReelInfo.WareCount <= 0)
{
MoveInfo.MoveParam.WareCount = 99999;
Work_ReelInfo.WareCount = 99999;
}
WorkLog("料盘处理:点料结束,关闭X关机互锁信号");
WorkLog("料盘处理:点料结束,关闭X关机互锁信号,上传点料结果");
IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
Task.Factory.StartNew(delegate {
string msg= SServerManager.Return_Material(Name, MoveInfo.MoveParam.WareCode, Work_ReelInfo.WareCount);
LogUtil.error(Name + "上传【"+MoveInfo.MoveParam.OutStr()+"】点料结果失败:" + msg);
});
}
#endregion
else if (MoveInfo.IsStep(StepEnum.XW12_EndCount))
{
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
MoveInfo.TimeOutSeconds = 120;
WorkLog("料盘处理:等待出口无料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW));
}
......@@ -195,9 +203,10 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.XW24_WaitOutCheck))
{
MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime);
WorkLog("料盘处理:清空 Work_ReelInfo,更新 再转动3秒");
Out_ReelInfo = new ReelInfo(Work_ReelInfo.WareCode, Work_ReelInfo.PlateW, Work_ReelInfo.PlateH, Work_ReelInfo.WareCount);
Out_ReelInfo = Work_ReelInfo.GetReelInfo();
Work_ReelInfo = new ReelInfo();
WorkLog("料盘处理:清空 Work_ReelInfo,更新Out_ReelInfo【"+ Out_ReelInfo .ToStr()+ "】 再转动3秒");
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
......
......@@ -65,37 +65,29 @@ namespace OnlineStore.DeviceLibrary
{
DOValueMap.Remove(ioIp);
}
int DIMS = ConfigAppSettings.GetIntValue("DIMS");
if (DIMS < 20)
{
DIMS = 20;
}
int DOMS = ConfigAppSettings.GetIntValue("DOMS");
if (DOMS < 200)
{
DOMS = 200;
}
int DILength = RobotManager.Config.GetDILength(ioIp);
int DOLength = RobotManager.Config.GetDOLength(ioIp);
string logName = "IO模块[" + ioIp + "] DI[" + DILength + "] DO[" + DOLength + "],[" + DIMS + "] [" + DOMS + "]";
string logName = "IO模块[" + ioIp + "] DI[" + DILength + "] DO[" + DOLength + "] ";
try
{
aioBox = new AIOBOX();
aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
{
//aioBox = new AIOBOX();
//aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
//aioBox.IP = ioIp;
//aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
//aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
////DI主动上传
//aioBox.AutoReadInput(true);
//aioBox.AutoReadOutput(false, DOMS);
aioBox = new AIOBOX(Asa.IOModule.Box_Type.DI, DILength, Asa.IOModule.Box_Type.DO, DOLength);
aioBox.IP = ioIp;
aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传
aioBox.AutoReadInput(true);
aioBox.AutoReadOutput(false, DOMS);
aioBox.Upload = true;
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
aioBox.DO_Changed_Event += AioBox_DO_Changed_Event;
LogUtil.info("开始连接:" + logName + ":" + aioBox.ErrInfo);
LogUtil.info("开始连接:" + logName + ":" );
aioBox.Connect();
AIOMap.Add(ioIp, aioBox);
......@@ -263,7 +255,7 @@ namespace OnlineStore.DeviceLibrary
bool result = aioBox.WriteDO(StartAddress, GetBox_Sta(onOff));
if (!result)
{
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 失败:" + aioBox.ErrInfo);
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 失败:" );
}
}
else
......
......@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
}
private static void LoadCamera(bool isReLoad)
{
if (isReLoad|| Camera._cam==null)
if (isReLoad || Camera._cam == null)
{
try
{
......@@ -59,13 +59,13 @@ namespace OnlineStore.DeviceLibrary
{
Camera._cam.CloseAll();
}
Camera.Type = CameraType.HIK;
Camera.Type = CameraType.HIK;
Camera._cam.Load();
}
catch (Exception ex)
{
LogUtil.error("加载HIK相机出错:", ex);
}
}
}
string[] names = Camera._cam.Name;
......@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info("加载到HIK相机:" + name);
}
}
}
}
public static void CloseCamera(string cameraName)
......@@ -92,22 +92,17 @@ namespace OnlineStore.DeviceLibrary
Camera._cam.Close(cameraName);
}
public static void CloseAllCamera()
{
Camera._cam.CloseAll();
}
public static List<string> CameraScan(string camera, string deviceName, bool findRightCodeBreak = false)
{
List<string> cameraList = new List<string>();
cameraList.Add(camera);
return CameraScan(cameraList, deviceName, findRightCodeBreak);
Camera._cam.CloseAll();
}
private static int ScanCount = 0;
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false)
{
public static List<string> CameraScan( string deviceName ,params string[] cameraList)
{
List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0)
if (cameraList == null || cameraList.Length <= 0)
{
return codeList;
}
......@@ -120,23 +115,23 @@ namespace OnlineStore.DeviceLibrary
continue;
}
ScanCount++;
DateTime startTime = DateTime.Now;
DateTime startTime = DateTime.Now;
if (deviceName != "")
{
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片");
LogUtil.debug (deviceName + " 【" + cameraName + "】开始取图片");
}
HalconDotNet.HObject ho_Image = null;
bool findRightCode = false;
try
{
ho_Image = Camera._cam.CaptureOnImage(cameraName);
ho_Image = Camera._cam.CaptureOnImage(cameraName);
if (ho_Image == null)
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
continue;
}
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
......@@ -157,18 +152,10 @@ namespace OnlineStore.DeviceLibrary
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##" + str;
if (!findRightCode)
{
findRightCode = IsRightCode(str);
}
r = r + "##" + str;
}
}
if (findRightCodeBreak&&findRightCode)
{
break;
}
}
if (String.IsNullOrEmpty(r))
{
......@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
}
if (deviceName != "" || r != "")
{
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r);
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】" + ScanCount + " :" + r);
}
}
catch (AccessViolationException e)
......@@ -190,13 +177,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
}
finally
{
{
if (ho_Image != null)
{
ho_Image.Dispose();
}
}
}
}
}
catch (AccessViolationException e)
{
......@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetCodeParamFilePath(string codePath)
{
string appPath = Application.StartupPath;
......@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary
message = asciiEncoding.GetString(newBytes.ToArray());
return message;
}
public static string ProcessCode(List<string> codeList)
private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetValidCode(List<string> codeList)
{
string code = "";
List<string> targetCode = new List<string>();
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
......@@ -310,7 +299,48 @@ namespace OnlineStore.DeviceLibrary
}
code += cc + "##";
}
return ReplaceCode(code);
code = ReplaceCode(code);
if (String.IsNullOrEmpty(code))
{
return "";
}
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
{
continue;
}
//L0000000000360K003732; E20200311 0365; B6D.49925.551014212020031105000; R014212020031103159##B29
string[] codearray = ReplaceCode(cc).Split(';');
if (codearray.Length >= 4)
{
if (codearray[2].StartsWith("B") && codearray[2].Length >= 13 && codearray[3].StartsWith("R"))
{
string tc = codearray[2].Substring(1, 12) + ";" + codearray[3];
if (!targetCode.Contains(tc))
{
targetCode.Add(tc);
}
}
}
}
if (targetCode.Count == 1)
{
LogUtil.info("解析条码【" + code + "】结果【" + targetCode[0] + "】");
return targetCode[0];
}
else if (targetCode.Count <= 0)
{
LogUtil.info("解析条码【" + code + "】失败:未找到有效条码");
}
else
{
LogUtil.info("解析条码【" + code + "】失败:有多个(" + targetCode.Count + ")有效条码");
}
return "";
}
}
}
......@@ -92,7 +92,7 @@ namespace OnlineStore.DeviceLibrary
}
internal static bool IsRealRfid(string shelfRfid)
{
//判断料架号是否是真实的料架
//判断料串号是否是真实的料串
if (shelfRfid.StartsWith("C") || shelfRfid.StartsWith("D"))
{
int num = -1;
......
......@@ -4,6 +4,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
......@@ -176,6 +177,24 @@ namespace OnlineStore.DeviceLibrary
}
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true)
{
if (!watch.IsRunning)
{
watch.Restart();
return false;
}
else if (watch.ElapsedMilliseconds >= targetMs)
{
if (isStop)
{
watch.Stop();
}
return true;
}
return false;
}
private static List<int> trayHeightList = new List<int>() { 8, 12, 16, 24, 32, 44, 56 };
public static List<int> GetTrayList()
......
......@@ -145,7 +145,7 @@ namespace OnlineStore.DeviceLibrary
{
msg = " " + MoveInfo.MoveStep + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警";
LogUtil.error(msg, 600);
LogUtil.error(msg, MoveInfo.ErrorLogType);
}
}
return false;
......@@ -274,9 +274,9 @@ namespace OnlineStore.DeviceLibrary
lastOkTime = DateTime.Now;
if (IOManager.IOValue(TargetIoType, 0).Equals(TargetIoValue))
{
LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动");
SuddenStop();
AxisStopCheckMove();
LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动");
SuddenStop();
}
}
catch (Exception ex)
......
......@@ -243,7 +243,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
IB04_LineStart,
/// <summary>
/// 料串入料:等待料稳定
/// 料串入料:等待料稳定
/// </summary>
IB05_WaitTime,
/// <summary>
......@@ -291,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
IB22_LocationDown,
/// <summary>
/// 入料结束:通知agv来拉料
/// 入料结束:通知agv来拉料
/// </summary>
IB23_ShelfOut,
#endregion
......@@ -331,10 +331,10 @@ namespace OnlineStore.DeviceLibrary
/// XRay点料:左侧门打开,
/// </summary>
XW02_InDoorOpen,
/// <summary>
/// XRay点料:挡停下降
/// </summary>
XW03_StopCylinderDown,
///// <summary>
///// XRay点料:挡停下降
///// </summary>
//XW03_StopCylinderDown,
/// <summary>
/// XRay点料:入口和中间皮带线转动
/// </summary>
......@@ -421,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
//取料Z,贴标Z回原点,批量轴开始回原点
//
#region 取料模块复位
#region 取料模块复位3000开始
/// <summary>
/// 取料模块复位: 取料Z轴回原点
......@@ -446,7 +446,7 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 贴标模块复位
#region 贴标模块复位3100开始
/// <summary>
/// 贴标模块复位: 贴标Z轴回原点
/// </summary>
......@@ -481,7 +481,7 @@ namespace OnlineStore.DeviceLibrary
OLR08_LabelRToP1,
#endregion
#region 架批量轴模块复位
#region 串批量轴模块复位 3200开始
/// <summary>
/// 出料模块复位: 阻挡气缸上升
......@@ -536,10 +536,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
OT03_MoveXToP2,
/// <summary>
/// 取料: 判断是否需要拍照,
/// </summary>
OT04_CheckNeedImage,
///// <summary>
///// 取料: 判断是否需要拍照,
///// </summary>
//OT04_CheckNeedImage,
/// <summary>
/// 取料: 拍照并开始识别
......@@ -565,11 +565,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 取料: 取料完成,等待料可放料
/// 取料: 取料完成,等待料可放料
/// </summary>
OT11_WaitShelfOk,
/// <summary>
/// 取料: 料可放料,取料X轴移动到P3,提升轴下降指定高度
/// 取料: 料可放料,取料X轴移动到P3,提升轴下降指定高度
/// </summary>
OT12_MoveXToP3,
/// <summary>
......@@ -587,7 +587,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 取料: 取料X轴回到P1
/// </summary>
OT16_MoveXToP1,
OT16_MoveXToP2,
/// <summary>
/// 取料: NG料,取料X轴到P1
......@@ -642,29 +642,29 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 贴标: 贴标气缸后退,吸盘停止输出,贴标Z轴到待机点P1
/// 贴标: 贴标气缸后退,吸盘停止输出,贴标Z轴到待机点P1,取码气缸前进
/// </summary>
OL01_Paste_Back = 3601,
/// <summary>
/// 贴标: 取码气缸前进,贴标XYR都到待机点P2
/// </summary>
OL02_TakeForward,
///// <summary>
///// 贴标: 取码气缸前进,贴标XYR都到待机点P2
///// </summary>
//OL02_TakeForward,
/// <summary>
/// 贴标: 打印标签,
/// </summary>
OL03_PrintLabel,
/// <summary>
/// 贴标: 等待 贴标机打码OK信号
/// </summary>
OL04_PrintOk,
///// <summary>
///// 贴标: 等待 贴标机打码OK信号
///// </summary>
//OL04_PrintOk,
/// <summary>
/// 贴标: 取码气缸后退
/// </summary>
OL05_TakeBack,
/// <summary>
/// 贴标: 贴标XYR都到待机点P2
/// </summary>
OL06_XYRToP2,
///// <summary>
///// 贴标: 贴标XYR都到待机点P2
///// </summary>
//OL06_XYRToP2,
/// <summary>
/// 贴标: Z轴到取标签点P2
/// </summary>
......@@ -673,10 +673,10 @@ namespace OnlineStore.DeviceLibrary
/// 贴标: 标签吸盘取码
/// </summary>
OL08_Nozzle_Work,
/// <summary>
/// 贴标: 等待吸盘信号到位
/// </summary>
OL09_WaitGetLabel,
///// <summary>
///// 贴标: 等待吸盘信号到位
///// </summary>
//OL09_WaitGetLabel,
/// <summary>
/// 贴标: Z轴到P1点
/// </summary>
......@@ -717,84 +717,85 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 贴标: XYR返回待机点P1
/// </summary>
OL19_XYRBackToP1,
OL19_XYRBackToP2,
#endregion
#region 出料模块料架处理 3701 开始
#region 出料模块料串处理 3701 开始
/// <summary>
/// 出料料:升降盘不在后退端,提升伺服到P2
/// 出料料:升降盘不在后退端,提升伺服到P2
/// </summary>
OS_01_BatchAxisToP2 = 3701,
/// <summary>
/// 出料料:升降盘定位气缸后退
/// 出料料:升降盘定位气缸后退
/// </summary>
OS_02_TrayL_After,
/// <summary>
/// 出料料:定位气缸下降
/// 出料料:定位气缸下降
/// </summary>
OS_03_LocationDown,
/// <summary>
/// 出料料:提升轴移动到高处待机点P1
/// 出料料:提升轴移动到高处待机点P1
/// </summary>
OS_04_BatchAxisToP1,
/// <summary>
/// 出料料,等待空料串入料口有信号
/// 出料料,等待空料串入料口有信号
/// </summary>
OS_05_WaitECheck,
/// <summary>
/// 出料料:空料串,接料线体,入口顶升上升
/// 出料料:空料串,接料线体,入口顶升上升
/// </summary>
OS_06_TopUp,
/// <summary>
/// 出料料:空料串阻挡下降,横移电机运转
/// 出料料:空料串阻挡下降,横移电机运转
/// </summary>
OS_07_SWLineRun,
/// <summary>
/// 出料料:等待入料线进口信号亮
/// 出料料:等待入料线进口信号亮
/// </summary>
OS_08_WLineInCheck,
/// <summary>
/// 出料料架:空料串阻挡上升,等待1000毫秒料架到达接料线体
/// 出料料串:空料串阻挡上升,等待1000毫秒料串到达接料线体
/// </summary>
OS_09_WaitInWLine,
/// <summary>
/// 出料料:空料串阻挡上升,顶升下降,线体停止转动,
/// 出料料:空料串阻挡上升,顶升下降,线体停止转动,
/// </summary>
OS_10_TopDown,
/// <summary>
/// 出料料:接料线体工位阻挡上升,接料线体转动,等待工位检测信号,
/// 出料料:接料线体工位阻挡上升,接料线体转动,等待工位检测信号,
/// </summary>
OS_11_WLineRun,
/// <summary>
/// 出料料:工位检测信号亮,,在转动3000ms,
/// 出料料:工位检测信号亮,,在转动3000ms,
/// </summary>
OS_12_WorkCheck,
/// <summary>
/// 出料料:接料线体停止转动,
/// 出料料:接料线体停止转动,
/// </summary>
OS_13_StopLineRun,
/// <summary>
/// 出料料:工位定位气缸上升,
/// 出料料:工位定位气缸上升,
/// </summary>
OS_14_WLocationUp,
/// <summary>
/// 出料料:提升轴下降到P2,
/// 出料料:提升轴下降到P2,
/// </summary>
OS_15_BatchAxisToP2,
/// <summary>
/// 出料料:托盘定位前进,
/// 出料料:托盘定位前进,
/// </summary>
OS_16_WTrayLForward,
/// <summary>
/// 出料料:批量轴匀速到P3点,
/// 出料料:批量轴匀速到P3点,
/// </summary>
OS_17_BatchAxisToP3,
/// <summary>
/// 出料料架:料架准备完成,
/// 出料料串:料串准备完成,
/// </summary>
OS_18_ShelfReady,
......@@ -804,11 +805,11 @@ namespace OnlineStore.DeviceLibrary
OS_21_BatchDownH,
/// <summary>
/// 放料:等待料盘放入料
/// 放料:等待料盘放入料
/// </summary>
OS_22_WaitTray,
/// <summary>
/// 放料:等待料盘放入料
/// 放料:等待料盘放入料
/// </summary>
OS_23_TrayOK,
/// <summary>
......@@ -828,43 +829,43 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 送出料架:开始送出料架
/// 送出料串:开始送出料串
/// </summary>
OS_31_ShendShelfOut,
/// <summary>
/// 送出料:批量轴下降到P2,
/// 送出料:批量轴下降到P2,
/// </summary>
OS_32_BatchToP2,
/// <summary>
/// 送出料:托盘定位气缸后退,
/// 送出料:托盘定位气缸后退,
/// </summary>
OS_33_TrayFixedBack,
/// <summary>
/// 送出料:定位气缸下降,
/// 送出料:定位气缸下降,
/// </summary>
OS_34_LocationDown,
/// <summary>
/// 送出料:批量轴到P1,
/// 送出料:批量轴到P1,
/// </summary>
OS_35_BatchAxisToP1,
/// <summary>
/// 送出料架:等待出口无料架
/// 送出料串:等待出口无料串
/// </summary>
OS_36_WaitOutNoShelf,
/// <summary>
/// 送出料:出口阻挡上升
/// 送出料:出口阻挡上升
/// </summary>
OS_37_OutStopUp,
/// <summary>
/// 送出料:链条正转到出口有检测信号
/// 送出料:链条正转到出口有检测信号
/// </summary>
OS_38_LineRun,
......
......@@ -230,7 +230,7 @@ namespace OnlineStore.DeviceLibrary
ledProcessTimer.Enabled = false;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200;
IoCheckTimer.Interval = 300;
// IoCheckTimer.Elapsed += IoCheckTimerProcess;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
......
......@@ -11,22 +11,28 @@ namespace OnlineStore.DeviceLibrary
{
public class RobotMoveInfo
{
private static int MaxMoveId=1;
/// <summary>
/// 超时时间
/// </summary>
public int TimeOutSeconds = 60;
public string Name = "";
public bool ShelfNoTray = false;
public RobotMoveInfo( string name)
public int MoveID = 0;
public RobotMoveInfo(string name)
{
this.Name = name;
moveType = RobotMoveType.None;
MoveParam = new WorkParam();
moveType = RobotMoveType.None;
MoveParam = new WorkParam();
this.moveStep = StepEnum.Wait;
IsInWait = false;
MoveNum = 0;
MoveID = MaxMoveId++;
}
public int ErrorLogType
{
get { return MaxMoveId * 100000 + (int)MoveStep; }
}
public int MoveNum { get; set; }
public DateTime LastSetpTime { get; set; }
......@@ -465,7 +471,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
Labelling = 4,
/// <summary>
/// 料处理
/// 料处理
/// </summary>
ShelfPro = 5,
}
......
......@@ -26,24 +26,16 @@ namespace OnlineStore.DeviceLibrary
this.PlateH = plateH;
this.IsTest = test;
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode = "";
/// <summary>
/// 当前状态
/// </summary>
public int TrayStatus = -1;
/// <summary>
/// 料盘高度
/// </summary>
public int PlateH = 0;
/// <summary>
/// 料盘宽度
/// </summary>
public int PlateW = 0;
/// <summary>
......@@ -57,14 +49,12 @@ namespace OnlineStore.DeviceLibrary
public int InPosType = 0;
/// <summary>
/// 目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层
/// 目标位置:1=XRay入口,2=测值工位上层 电容,3=测值工位下层 电阻
/// </summary>
public int TargetPosType = 0;
/// <summary>
/// 取料时判断是否是NG料
/// </summary>
public bool IsNgReel = false;
public string NgMsg = "";
/// <summary>
/// 是否是测试步骤
/// </summary>
......@@ -75,21 +65,21 @@ namespace OnlineStore.DeviceLibrary
string tP = "";
if (TargetPosType.Equals(1))
{
tP = "[XRay入口]";
tP = "XRay入口";
}
else if (TargetPosType.Equals(2))
{
tP = "[工位上层]";
tP = "电容测值";
}
else if (TargetPosType.Equals(3))
{
tP = "[工位下层]";
tP = "电阻测值";
}
return " [" + WareCode + "] " + "[" + PlateW + " X " + PlateH + "] " + "[" + (InPosType.Equals(1) ? "左侧入口" : "右侧入口") + "]-->" + tP;
return " [" + WareCode + "] " + "[" + PlateW + " X " + PlateH + "] " + "[" + (InPosType.Equals(1) ? "左侧入口" : "右侧入口") + "-->" + tP+ "]";
}
public string OutStr()
{
return "[" + WareCode + "]:[" + PlateW + "]X[" + PlateH + "][" + WareCount + "]";
return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] [" + WareCount + "]" + (IsNgReel ? "[NG料:" + NgMsg + "]" : "") + "";
}
public int Get_Inout_P2(InputEquip_Config config)
{
......@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = reel.PlateW;
this.WareCode = reel.WareCode;
this.WareCount = reel.WareCount;
this.IsNgReel = reel.IsNgReel;
this.NgMsg = reel.NgMsg;
}
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
}
}
......@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary
public class ReelInfo
{
public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0)
public ReelInfo(string code = "", int plateW = 0, int plateH = 0,int count=0,bool IsNg=false,string msg="")
{
this.WareCode = code;
this.PlateH = plateH;
this.PlateW = plateW;
this.WareCount = count;
this.IsNgReel = IsNg;
this.NgMsg = msg;
}
/// <summary>
/// 物品二维码信息
......@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary
public int WareCount = 0;
public bool IsNgReel = false;
public string NgMsg = "";
public string ToStr()
{
return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]";
return "[" + WareCode + "] [" + PlateW + "X" + PlateH + "] ["+WareCount+"]"+(IsNgReel?"[NG料:"+NgMsg+"]":"")+"";
}
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
}
}
}
......@@ -132,7 +132,7 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("UpdownAxis_P2_R")]
public int UpdownAxis_P2_R { get; set; }
/// <summary>
/// PRO,0,取料升降轴料上方P3取料/放料位置,UpdownAxis_P3,20000,,,,,
/// PRO,0,取料升降轴料上方P3取料/放料位置,UpdownAxis_P3,20000,,,,,
/// </summary>
[ConfigProAttribute("UpdownAxis_P3", true)]
public int UpdownAxis_P3 { get; set; }
......
......@@ -29,12 +29,12 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// PRO,0,空料入口AGV站号名称,AgvInName,F3,,,,,
/// PRO,0,空料入口AGV站号名称,AgvInName,F3,,,,,
/// </summary>
[ConfigProAttribute("AgvInName")]
public string AgvInName { get; set; }
/// <summary>
/// PRO,0,料出口AGV站号名称,AgvOutName,F4,,,,,
/// PRO,0,料出口AGV站号名称,AgvOutName,F4,,,,,
/// </summary>
[ConfigProAttribute("AgvOutName")]
public string AgvOutName { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!