Commit f50be7f3 顾剑亮
2 个父辈 2afe1e0f 7e0a1634
正在显示 44 个修改的文件 包含 1425 行增加1188 行删除
......@@ -6,19 +6,7 @@
<members>
<member name="T:Asa.IOModule.AIOBOX">
<summary>
AIOBOX操作类
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.SEND_SLEEP">
<summary>
每条命令发送的间隔
不能小于15,会出现IO接收不到的情况
小于30时,会出现接收数据连包的情况
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.PORT">
<summary>
ModBus端口
零点IO模块操作类
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.DIO_Changed">
......@@ -38,77 +26,39 @@
自动读取DO事件触发
</summary>
</member>
<member name="T:Asa.IOModule.AIOBOX.AIO_Changed">
<summary>
自动读取AI委托
</summary>
<param name="box">AIOBOX</param>
<param name="val">所有AI的值</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.AI_Changed_Event">
<summary>
自动读取AI事件触发
</summary>
</member>
<member name="E:Asa.IOModule.AIOBOX.AO_Changed_Event">
<member name="M:Asa.IOModule.AIOBOX.#ctor(Asa.IOModule.Box_Type,System.Int32,Asa.IOModule.Box_Type,System.Int32)">
<summary>
自动读取AO事件触发
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.#ctor">
<summary>
AIOBOX
零点IO模块操作类
</summary>
<param name="input">输入类型</param>
<param name="inputCount">输入数量</param>
<param name="output">输出类型</param>
<param name="outputCount">输出数量</param>
</member>
<member name="P:Asa.IOModule.AIOBOX.IP">
<summary>
IP地址
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IsConn">
<summary>
是否连接
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.ErrInfo">
<summary>
错误信息
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.LogPath(System.String,Asa.IOModule.LogType)">
<summary>
日志路径,连接前设置路径会自动保存日志
</summary>
<param name="path">文件夹路径</param>
<param name="type">输出类型</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)">
<member name="P:Asa.IOModule.AIOBOX.Upload">
<summary>
设置输入端
输入主动上传
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetOutput(Asa.IOModule.Box_Type,System.Int32)">
<member name="P:Asa.IOModule.AIOBOX.IsConn">
<summary>
设置输出端
是否连接
</summary>
<param name="type">类型</param>
<param name="count">数量</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoIP(System.String)">
<member name="P:Asa.IOModule.AIOBOX.MonitorDI">
<summary>
自动获取IP地址,未连接前使用,必须在同一网段
监控DI输入,索引数组
</summary>
<param name="localIP">本地IP地址</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.CheckIP(System.String)">
<member name="P:Asa.IOModule.AIOBOX.MonitorDO">
<summary>
检查IP地址
监控DO输出,索引数组
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Connect">
<summary>
......@@ -120,26 +70,6 @@
关闭连接
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean,System.Int32)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 禁止)
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput(System.Boolean)">
<summary>
自动读取输入端并触发事件(主动上传数据 = 使能)
</summary>
<param name="read">是否自动读取</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput(System.Boolean,System.Int32)">
<summary>
自动读取输出端,触发事件
</summary>
<param name="read">是否自动读取</param>
<param name="sleep">间隔,必须大于等于15ms</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta)">
<summary>
相反状态(ON/OFF)
......@@ -221,75 +151,68 @@
<param name="sta"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.GetLocalIP">
<summary>
获取本地IPv4地址
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Send">
<summary>
发送命令
发送命令线程
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.Receive">
<member name="M:Asa.IOModule.AIOBOX.GetReadDI_Command">
<summary>
接收命令
获取ReadDI的命令
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadSingle(System.Byte[])">
<member name="M:Asa.IOModule.AIOBOX.GetReadDO_Command">
<summary>
读取写入单个DO,功能码5
获取ReadDO的命令
</summary>
<param name="buff"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDO(System.Byte[])">
<member name="M:Asa.IOModule.AIOBOX.Listen">
<summary>
读取所有DO状态,功能码1
监听网络线程
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Byte[])">
<member name="M:Asa.IOModule.AIOBOX.CommandProcess(System.Byte[])">
<summary>
读取所有DI状态,功能码2
接收到的命令处理方法,(task多线程)
</summary>
<param name="cmd"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Byte[])">
<member name="M:Asa.IOModule.AIOBOX.Reconn">
<summary>
读取所有AI的值,功能码4
重连线程
</summary>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.Command">
<member name="M:Asa.IOModule.AIOBOX.Open">
<summary>
命令,前7个字节
打开socket建立连接
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.TriggerDIO">
<summary>
触发DIO改变事件
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadInput">
<member name="M:Asa.IOModule.AIOBOX.CheckIP(System.String)">
<summary>
自动读取输入端线程
检查IP地址
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.AutoReadOutput">
<member name="M:Asa.IOModule.AIOBOX.AutoIP(System.String)">
<summary>
自动读取输出端线程
自动获取IP地址,未连接前使用,必须在同一网段
</summary>
<param name="localIP">本地IP地址</param>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Listen">
<member name="M:Asa.IOModule.AIOBOX.GetIP">
<summary>
监听结果线程
获取IO模块IP地址
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.TestMethod">
<member name="M:Asa.IOModule.AIOBOX.Command">
<summary>
测试方法锁
命令,前7个字节
</summary>
<returns></returns>
</member>
<member name="T:Asa.IOModule.Box_Type">
<summary>
......@@ -331,62 +254,5 @@
闭合,打开,高电平
</summary>
</member>
<member name="T:Asa.IOModule.LogType">
<summary>
日志类型
</summary>
</member>
<member name="F:Asa.IOModule.LogType.OnlyError">
<summary>
仅错误信息
</summary>
</member>
<member name="F:Asa.IOModule.LogType.All">
<summary>
所有
</summary>
</member>
<member name="T:Asa.IOModule.LogFile">
<summary>
日志操作类
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.#ctor(System.String,System.String)">
<summary>
日志
</summary>
<param name="path">文件夹路径</param>
<param name="ip"></param>
</member>
<member name="M:Asa.IOModule.LogFile.Close">
<summary>
关闭文件
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.OutError(System.String)">
<summary>
输出错误
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutInfo(System.String)">
<summary>
输出信息
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String,System.Byte[])">
<summary>
输出数据
</summary>
<param name="tr"></param>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String)">
<summary>
输出数据
</summary>
<param name="s"></param>
</member>
</members>
</doc>
......@@ -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";
}
}
}
......@@ -12,7 +12,7 @@ namespace OnlineStore.DeviceLibrary
{
partial class BatchMoveBean
{
#region 入料处理
#region 入料处理
internal string CurrShelfId = "";
......@@ -34,7 +34,7 @@ namespace OnlineStore.DeviceLibrary
//runStatus = RobotRunStatus.Busy;
MoveInfo.NewMove(RobotMoveType.Working);
MoveInfo.MoveParam = new WorkParam();
//判断是哪个工位有料
//判断是哪个工位有料
IB05_WaitTime();
}
......@@ -54,13 +54,13 @@ namespace OnlineStore.DeviceLibrary
{
try
{
//判断料的编码是否正确
//判断料的编码是否正确
RFIDData rfidD = RFIDManager.ReadRFID(RfidIP);
CurrShelfId = rfidD.NumStr;
//发送料信息给调度系统
//发送料信息给调度系统
// AgvClient.SendRFID(Config.AgvInName, CurrShelfId);
LogUtil.info(Name + "读取到料编号:" + CurrShelfId);
LogUtil.info(Name + "读取到料编号:" + CurrShelfId);
}
catch (Exception ex)
{
......@@ -72,7 +72,7 @@ namespace OnlineStore.DeviceLibrary
private void IB04_LineStart()
{
MoveInfo.NextMoveStep(StepEnum.IB04_LineStart);
WorkLog(" 入口检测到料,流水线转动 3000,等待料串完全进入轨道");
WorkLog(" 入口检测到料,流水线转动 3000,等待料串完全进入轨道");
LineRun(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineIn_Check, IO_VALUE.HIGH));
......@@ -81,9 +81,9 @@ namespace OnlineStore.DeviceLibrary
private void IB05_WaitTime()
{
// 定位工位有料,等待1秒后再次检测
// 定位工位有料,等待1秒后再次检测
MoveInfo.NextMoveStep(StepEnum.IB05_WaitTime);
WorkLog("定位工位检测到料: 链条转动, 3秒再次检测");
WorkLog("定位工位检测到料: 链条转动, 3秒再次检测");
LineRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
......@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
#region 入料:料进入并开始检测托盘
#region 入料:料进入并开始检测托盘
if (MoveInfo.IsStep(StepEnum.IB01_Wait))
{
WorkLog("料串入料 :提升伺服移动到P1,顶升气缸下降");
......@@ -128,7 +128,7 @@ namespace OnlineStore.DeviceLibrary
{
LineStop();
MoveInfo.EndMove();
LogUtil.info(" 未检测到料,入料结束");
LogUtil.info(" 未检测到料,入料结束");
}
}
else if (MoveInfo.IsStep(StepEnum.IB05_WaitTime))
......@@ -139,21 +139,21 @@ namespace OnlineStore.DeviceLibrary
// UpdateShelfId();
//if (CurrShelfId.EndsWith("00"))
//{
// SendShelfOut(" 料号【" + CurrShelfId + "】无效 ");
// SendShelfOut(" 料号【" + CurrShelfId + "】无效 ");
//}
//else
// {
MoveInfo.ShelfNoTray = false;
//定位工位有料,直接开始入料
//定位工位有料,直接开始入料
MoveInfo.NextMoveStep(StepEnum.IB06_LocationUp);
WorkLog("检测到料:链条停止转动,定位气缸上升");
WorkLog("检测到料:链条停止转动,定位气缸上升");
LocationUp(MoveInfo);
// }
}
else
{
MoveInfo.EndMove();
WorkLog(" 未检测到料,链条停止转动,入料结束");
WorkLog(" 未检测到料,链条停止转动,入料结束");
}
}
......@@ -178,14 +178,15 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料串入料 :扫码结束,等待取料机构来取料");
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
WorkLog("料串入料 :扫码结束【"+ MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
}
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{
MoveInfo.NextMoveStep(StepEnum.IB12_BatchAxisToP3);
WorkLog("料串入料 :料盘已拿走,批量轴到P3,测盘高 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
BatchAxisToP3(false);
BatchAxisToP3( );
}
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToP3))
{
......@@ -208,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB22_LocationDown))
{
MoveInfo.NextMoveStep(StepEnum.IB23_ShelfOut);
WorkLog("上料完成 :通知agv来取料,等待料串离开");
WorkLog("上料完成 :通知agv来取料,等待料串离开");
AgvClient.NeedLeave(AgvName, CurrShelfId, ClientLevel.High);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineIn_Check, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
......@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理");
}
}
internal string GetCurrCode()
{
string code = CodeManager.ProcessCode(LastCodeList);
return code;
}
//internal string LCodeStr = "";
//internal string GetCurrCode()
//{
// return LCodeStr = CodeManager.GetValidCode(LastCodeList);
//}
private void FI_21_BatchAxisDown()
{
......@@ -273,13 +274,14 @@ namespace OnlineStore.DeviceLibrary
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
NextCodeList = CodeManager.CameraScan(CameraName, Name);
{
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
NextCodeList = CodeManager.CameraScan(Name, CameraName );
if (NextCodeList.Count <= 0)
{
NextCodeList = CodeManager.CameraScan(CameraName, Name);
NextCodeList = CodeManager.CameraScan(Name, CameraName);
}
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return NextCodeList;
});
}
......@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary
if (NextCodeList.Count > 0)
{
WorkLog("料盘移栽 :开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料盘移栽 :上料横移取料端");
WorkLog("料盘移栽 :使用预扫码【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
//WorkLog("料盘移栽 :上料横移取料端");
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
......@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(CameraName, Name);
LastCodeList = CodeManager.CameraScan(Name, CameraName);
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(CameraName, Name);
LastCodeList = CodeManager.CameraScan(Name, CameraName);
}
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return LastCodeList;
});
}
......@@ -355,7 +360,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
WorkLog("料串入料 :CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘");
MoveInfo.ShelfNoTray = false;
BatchAxisToP3(false);
BatchAxisToP3( );
return;
}
}
......@@ -372,23 +377,11 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.SuddenStop(true);
BatchAxis.AbsMove(MoveInfo, BatchAxisP1, Robot.Config.BatchAxis_P1Speed);
}
private void BatchAxisToP3(bool isFirstMove = true)
private void BatchAxisToP3( )
{
int targetP3 = BatchAxisP3;
int targetSpeed = Robot.Config.BatchAxis_P3Speed;
//if (!isFirstMove)
//{
// int currPosition = BatchAxis.GetAclPosition();
// if (currPosition != -1)
// {
// targetP3 = currPosition + Robot.Config.Height_ChangeValue * 80;
// if (targetP3 > BatchAxisP3)
// {
// targetP3 = BatchAxisP3;
// }
// LogUtil.info(Name + " BatchAxisToP3 目标P3: " + targetP3 + "(" + currPosition + ")");
// }
//}
MoveInfo.TimeOutSeconds = 200;
MoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
......@@ -447,7 +440,7 @@ namespace OnlineStore.DeviceLibrary
}
}
if (LastHeight <= 8) { LastHeight = 8; }
string code = CodeManager.ProcessCode(LastCodeList);
string code = CodeManager.GetValidCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】";
LogUtil.info(msg);
return LastHeight;
......@@ -459,16 +452,27 @@ namespace OnlineStore.DeviceLibrary
#region AGV 处理
private bool ProcessShelfOut = false;
private bool ProcessShelfEnter = false;
internal void ShelfEnterProcess()
internal void AgvReady(string nodeId, string rfid)
{
if (string.IsNullOrEmpty(rfid))
{
ShelfOutProcess(nodeId, rfid);
}
else
{
ShelfEnterProcess(nodeId, rfid);
}
}
internal void ShelfEnterProcess(string nodeId, string rfid)
{
Task.Factory.StartNew(delegate
{
string logName = Name + "AGV料架进入 [" + AgvName + "] ";
string logName = Name + "料串 "+rfid+" [AGV->" + AgvName + "] ";
try
{
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.LOW) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logName + " 开始");
LogUtil.info(logName + " 开始转动线体");
ProcessShelfEnter = true;
LineRun();
......@@ -499,7 +503,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(logName + "等待3000后,停止链条转动");
LineStop();
//料可离开
//料可离开
AgvClient.SetStatus(AgvName, "", ClientAction.FinishEnter, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
......@@ -511,7 +515,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
//入口有料架,暂不处理
//入口有料串,暂不处理
LogUtil.error(logName + ",入口已有料架,暂不处理");
}
}
catch (TimeoutException te)
......@@ -524,39 +529,19 @@ namespace OnlineStore.DeviceLibrary
}
finally
{
LineStop();
ProcessShelfEnter = false;
}
});
}
internal void AgvReady(string nodeId, string rfid)
{
string logN = Name + "收到 AgvReady 事件 [" + nodeId + "] [" + rfid + "] ";
if (string.IsNullOrEmpty(rfid))
{
ShelfOutProcess();
}
else
{
ShelfEnterProcess();
}
}
internal void AgvArrive(string id, string rfid)
{
string logN = Name + "收到 AgvArrive 事件 [" + id + "] [" + rfid + "] ";
}
internal void ShelfOutProcess()
internal void ShelfOutProcess(string nodeId, string rfid)
{
//AGV已到达,将料送入AGV中
//AGV已到达,将料送入AGV中
Task.Factory.StartNew(delegate
{
string logName = Name + "[" + AgvName + "] 料架送入AGV ";
string logName = Name + "料串"+rfid+"[" + AgvName + "->AGV ] ";
try
{
LogUtil.info(logName + "开始,先设置状态为None");
{
AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.None, ClientLevel.High, true);
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) || Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
......@@ -581,11 +566,11 @@ namespace OnlineStore.DeviceLibrary
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空料架[" + CurrShelfId + "], 结束");
LogUtil.info(logName + "结束,停止转动,清空料串[" + CurrShelfId + "] ");
}
else
{
LogUtil.info(logName + "开始,未检测到料架信号,不处理");
LogUtil.info(logName + " 未检测到料架,暂不处理");
}
}
catch (TimeoutException te)
......@@ -603,10 +588,9 @@ namespace OnlineStore.DeviceLibrary
}
});
}
#endregion
protected void WorkLog(string msg)
{
LogUtil.info(Name + " [" + MoveInfo.MoveStep + "]" + msg);
......
......@@ -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
}
}
......@@ -54,12 +54,9 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(MoveInfo.Name + "StartWorking 失败 , MoveInfo 忙碌中=" + MoveInfo.MoveType);
return false;
}
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None).Equals(false))
{
LogUtil.error(MoveInfo.Name + "StartWorking 失败 , 贴标模块忙碌中=" + SecMoveInfo.MoveType);
return false;
}
}
//如果料架在准备状态或送出过程中,不能开始取料
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW))
{
......@@ -67,7 +64,7 @@ namespace OnlineStore.DeviceLibrary
if (param.PlateW > 0 && param.PlateH > 0)
{
MoveInfo.MoveParam = param;
WorkLog(" [" + param.OutStr() + "],准备开始取料,检测到Xray出口有料,且皮带线停止转动");
WorkLog(" 检测到XRay出口料盘[" + param.OutStr() + "],准备开始取料");
}
else
{
......@@ -79,7 +76,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.SetReelInfo(reelInfo);
WorkLog("X光点料机出口检测到料盘[" + reelInfo.ToStr() + "],准备开始取料,检测到Xray出口有料,且皮带线停止转动");
WorkLog(" 检测到XRay出口料盘[" + reelInfo.ToStr() + "],准备开始取料");
}
if (MoveInfo.MoveParam.PlateW <= 0 ||
MoveInfo.MoveParam.PlateH <= 0)
......@@ -118,20 +115,13 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.OT03_MoveXToP2))
{
MoveInfo.NextMoveStep(StepEnum.OT04_CheckNeedImage);
WorkLog("取料:判断是否需要拍照 ");
}
else if (MoveInfo.IsStep(StepEnum.OT04_CheckNeedImage))
{
//MoveInfo.NextMoveStep(StepEnum.OT04_CheckNeedImage);
//WorkLog("取料:判断是否需要拍照 ");
if (MoveInfo.MoveParam.IsNgReel)
{
MoveInfo.NextMoveStep(StepEnum.OT07_MoveZToP2);
WorkLog("取料:取料Z轴到P2 ");
MoveZAxis.AbsMove(MoveInfo, Config.GetMoveZP2(MoveInfo.MoveParam.PlateH), Config.MoveZ_P2Speed);
//MoveInfo.NextMoveStep(StepEnum.OT21_NG_MoveXToP1);
//WorkLog("NG料:取料X轴到P1 ");
//MoveXAxis.AbsMove(MoveInfo, Config.MoveX_P1, Config.MoveX_P1Speed);
}
else
{
......@@ -140,9 +130,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
}
//else if (MoveInfo.IsStep(StepEnum.OT04_CheckNeedImage))
//{
//}
else if (MoveInfo.IsStep(StepEnum.OT05_GetImage))
{
//TODO 记录信息,判断贴标模块当前空闲,此时可以打印标签(取码气缸前进,打印标签,取码气缸后退)
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None))
{
......@@ -154,8 +147,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = MoveInfo.Name + "等待贴标模块空闲 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg);
WarnMsg = MoveInfo.Name + "等待贴标模块空闲 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -189,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
else
{
MoveInfo.NextMoveStep(StepEnum.OT11_WaitShelfOk);
WorkLog("取料完成,等待料可放料 ");
WorkLog("取料完成,等待料可放料 ");
}
}
else if (MoveInfo.IsStep(StepEnum.OT11_WaitShelfOk))
......@@ -199,7 +192,7 @@ namespace OnlineStore.DeviceLibrary
if (shelfOk || debugOk)
{
MoveInfo.NextMoveStep(StepEnum.OT12_MoveXToP3);
WorkLog("放料:料可放料,取料X轴移动到P3 ");
WorkLog("放料:料可放料,取料X轴移动到P3 ");
MoveXAxis.AbsMove(MoveInfo, Config.MoveX_P3, Config.MoveX_P3Speed);
if (shelfOk)
......@@ -217,8 +210,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = MoveInfo.Name + "等待出料料架准备完成(OS_18_ShelfReady)超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]秒";
LogUtil.error(WarnMsg);
WarnMsg = MoveInfo.Name + "等待出料料串准备完成(OS_18_ShelfReady)超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -234,8 +227,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = MoveInfo.Name + "等待出料料架可放料(OS_22_WaitTray)超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]秒";
LogUtil.error(WarnMsg);
WarnMsg = MoveInfo.Name + "等待出料料串可放料(OS_22_WaitTray)超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -256,16 +249,16 @@ namespace OnlineStore.DeviceLibrary
OutReelHeight += MoveInfo.MoveParam.PlateH;
OutReelCount += 1;
ShelfMoveInfo.NextMoveStep(StepEnum.OS_23_TrayOK);
ShelfWorkLog("料盘已放入料,累积出料 【" + OutReelHeight + "】盘共 " + OutReelHeight + " mm");
ShelfWorkLog("料盘已放入料,累积出料 【" + OutReelHeight + "】盘共 " + OutReelHeight + " mm");
}
}
else if (MoveInfo.IsStep(StepEnum.OT15_MoveZToP1))
{
MoveInfo.NextMoveStep(StepEnum.OT16_MoveXToP1);
WorkLog("放料:取料X轴回到P1 ");
MoveXAxis.AbsMove(MoveInfo, Config.MoveX_P1, Config.MoveX_P1Speed);
MoveInfo.NextMoveStep(StepEnum.OT16_MoveXToP2);
WorkLog("放料:取料X轴回到P2 ");
MoveXAxis.AbsMove(MoveInfo, Config.GetMoveXP2(MoveInfo.MoveParam.PlateW), Config.MoveX_P2Speed);
}
else if (MoveInfo.IsStep(StepEnum.OT16_MoveXToP1))
else if (MoveInfo.IsStep(StepEnum.OT16_MoveXToP2))
{
MoveInfo.EndMove();
WorkLog("放料完成");
......@@ -320,11 +313,21 @@ namespace OnlineStore.DeviceLibrary
}
SecMoveInfo.NewMove(RobotMoveType.Labelling, StepEnum.Wait);
SecMoveInfo.MoveParam = param;
NeedPrint = ConfigAppSettings.GetIntValue(Setting_Init.NeedPrintLabel).Equals(1);
SecMoveInfo.NextMoveStep(StepEnum.OL01_Paste_Back);
SecWorkLog(" 启动贴标: 贴标气缸后退,吸盘停止输出,贴标Z轴到待机点P1,取码气缸前进");
IOMove(IO_Type.Nozzle_Work, IO_VALUE.LOW);
CylinderMove(SecMoveInfo, IO_Type.PasteCode_Forward, IO_Type.PasteCode_Back);
CylinderMove(SecMoveInfo, IO_Type.TakeCode_Back, IO_Type.TakeCode_Forward);
if (!LabelZAxis.IsInPosition(Config.LabelZ_P1))
{
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
}
return true;
}
private bool NeedPrint = ConfigAppSettings.GetIntValue(Setting_Init.NeedPrintLabel).Equals(1);
protected override void LabellingProcess()
{
if (SecMoveInfo.IsInWait)
......@@ -335,54 +338,70 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (SecMoveInfo.IsStep(StepEnum.Wait))
{
SecMoveInfo.NextMoveStep(StepEnum.OL01_Paste_Back);
SecWorkLog(" 贴标: 贴标气缸后退,吸盘停止输出,贴标Z轴到待机点P1");
IOMove(IO_Type.Nozzle_Work, IO_VALUE.LOW);
CylinderMove(SecMoveInfo, IO_Type.PasteCode_Forward, IO_Type.PasteCode_Back);
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
}
else if (SecMoveInfo.IsStep(StepEnum.OL01_Paste_Back))
{
SecMoveInfo.NextMoveStep(StepEnum.OL02_TakeForward);
SecWorkLog("贴标: 取码气缸前进,贴标XYR都到待机点P2");
CylinderMove(SecMoveInfo, IO_Type.TakeCode_Back, IO_Type.TakeCode_Forward);
//if (SecMoveInfo.IsStep(StepEnum.Wait))
//{
// SecMoveInfo.NextMoveStep(StepEnum.OL01_Paste_Back);
// SecWorkLog(" 启动贴标: 贴标气缸后退,吸盘停止输出,贴标Z轴到待机点P1,取码气缸前进");
// IOMove(IO_Type.Nozzle_Work, IO_VALUE.LOW);
// CylinderMove(SecMoveInfo, IO_Type.PasteCode_Forward, IO_Type.PasteCode_Back);
// CylinderMove(SecMoveInfo, IO_Type.TakeCode_Back, IO_Type.TakeCode_Forward);
// if (!LabelZAxis.IsInPosition(Config.LabelZ_P1))
// {
// LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
// }
//}
if (SecMoveInfo.IsStep(StepEnum.OL01_Paste_Back))
{
// SecMoveInfo.NextMoveStep(StepEnum.OL02_TakeForward);
// SecWorkLog("贴标: 取码气缸前进,");
// CylinderMove(SecMoveInfo, IO_Type.TakeCode_Back, IO_Type.TakeCode_Forward);
//}
//else if (SecMoveInfo.IsStep(StepEnum.OL02_TakeForward))
//{
SecMoveInfo.NextMoveStep(StepEnum.OL03_PrintLabel);
RobotManager.LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
SecWorkLog("贴标: 重置状态=Unknown,开始打印标签["+NeedPrint+"] ,贴标XYR轴到取标签点P2, 等待1s");
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (NeedPrint)
{
Task.Factory.StartNew(delegate
{
StartPrintLabel(SecMoveInfo.MoveParam.WareCode, SecMoveInfo.MoveParam.WareCount.ToString());
});
}
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
}
else if (SecMoveInfo.IsStep(StepEnum.OL02_TakeForward))
{
SecMoveInfo.NextMoveStep(StepEnum.OL03_PrintLabel);
SecWorkLog("贴标: 开始打印标签 ,等待2000ms");
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
StartPrintLabel(SecMoveInfo.MoveParam.WareCode, SecMoveInfo.MoveParam.WareCount.ToString());
}
else if (SecMoveInfo.IsStep(StepEnum.OL03_PrintLabel))
{
SecMoveInfo.NextMoveStep(StepEnum.OL04_PrintOk);
SecWorkLog("贴标: 等待 贴标机打码OK信号");
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk))
{
SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack);
SecWorkLog("贴标: 取码气缸后退");
CylinderMove(SecMoveInfo, IO_Type.TakeCode_Forward, IO_Type.TakeCode_Back);
// SecMoveInfo.NextMoveStep(StepEnum.OL04_PrintOk);
// SecWorkLog("贴标: 等待 贴标机打码OK信号");
//}
//else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk))
//{
bool isPrintOk = RobotManager.LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle);
bool isTimeOut = SecMoveInfo.IsTimeOut(60);
if (isPrintOk || isTimeOut || (!NeedPrint))
{
SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack);
SecWorkLog("贴标: 打印结束[" + RobotManager.LastPrintStatus + "][" + (isTimeOut ? "超时60秒" : "") + "],取码气缸后退");
CylinderMove(SecMoveInfo, IO_Type.TakeCode_Forward, IO_Type.TakeCode_Back);
}
}
else if (SecMoveInfo.IsStep(StepEnum.OL05_TakeBack))
{
SecMoveInfo.NextMoveStep(StepEnum.OL06_XYRToP2);
SecWorkLog("贴标: 贴标XYR都到待机点P2");
// SecMoveInfo.NextMoveStep(StepEnum.OL06_XYRToP2);
// SecWorkLog("贴标: 贴标XYR轴到取标签点P2");
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
}
else if (SecMoveInfo.IsStep(StepEnum.OL06_XYRToP2))
{
// LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
// LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
// LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
//}
//else if (SecMoveInfo.IsStep(StepEnum.OL06_XYRToP2))
//{
SecMoveInfo.NextMoveStep(StepEnum.OL07_ZToP2);
SecWorkLog("贴标: Z轴到取标签点P2");
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P2, Config.LabelZ_P2Speed);
......@@ -390,20 +409,23 @@ namespace OnlineStore.DeviceLibrary
else if (SecMoveInfo.IsStep(StepEnum.OL07_ZToP2))
{
SecMoveInfo.NextMoveStep(StepEnum.OL08_Nozzle_Work);
SecWorkLog("贴标: 标签吸盘取码");
SecWorkLog("贴标: 标签吸盘取码,等待吸盘信号到位 1.5s");
IOMove(IO_Type.Nozzle_Work, IO_VALUE.HIGH);
}
else if (SecMoveInfo.IsStep(StepEnum.OL08_Nozzle_Work))
{
SecMoveInfo.NextMoveStep(StepEnum.OL09_WaitGetLabel);
SecWorkLog("贴标: 等待吸盘信号到位");
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Nozzle_Work, IO_VALUE.HIGH));
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
SecMoveInfo.OneWaitCanEndStep = true;
}
else if (SecMoveInfo.IsStep(StepEnum.OL09_WaitGetLabel))
else if (SecMoveInfo.IsStep(StepEnum.OL08_Nozzle_Work))
{
// SecMoveInfo.NextMoveStep(StepEnum.OL09_WaitGetLabel);
// SecWorkLog("贴标: 等待吸盘信号到位");
// SecMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Nozzle_Work, IO_VALUE.HIGH));
// SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
// SecMoveInfo.OneWaitCanEndStep = true;
//}
//else if (SecMoveInfo.IsStep(StepEnum.OL09_WaitGetLabel))
//{
SecMoveInfo.NextMoveStep(StepEnum.OL10_ZToP1);
SecWorkLog("贴标: Z轴到P1点");
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
......@@ -417,8 +439,10 @@ namespace OnlineStore.DeviceLibrary
}
else if (SecMoveInfo.IsStep(StepEnum.OL11_WaitCanLabel))
{
bool canLabel = MoveInfo.MoveType.Equals(RobotMoveType.None) && ShelfMoveInfo.IsStep(StepEnum.OS_25_WaitLabel); ;
bool canLabel = (MoveInfo.MoveType.Equals(RobotMoveType.None)||(MoveInfo.MoveType.Equals(RobotMoveType.Working)&& MoveInfo.MoveStep<=(StepEnum.OT11_WaitShelfOk)))
&& ShelfMoveInfo.IsStep(StepEnum.OS_25_WaitLabel ); ;
bool isTest = ShelfMoveInfo.MoveType.Equals(RobotMoveType.None) && MoveInfo.MoveType.Equals(RobotMoveType.None) && SecMoveInfo.MoveParam.IsTest;
if (canLabel || isTest)
{
SecMoveInfo.NextMoveStep(StepEnum.OL12_XYToP3);
......@@ -430,8 +454,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (SecMoveInfo.IsTimeOut(120))
{
WarnMsg = SecMoveInfo.Name + "等待 料盘可贴标(OS_25_WaitLabel) 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg);
WarnMsg = SecMoveInfo.Name + "等待 料盘可贴标(OS_25_WaitLabel) 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg,SecMoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -466,9 +490,9 @@ namespace OnlineStore.DeviceLibrary
else if (SecMoveInfo.IsStep(StepEnum.OL15_ZToP3))
{
SecMoveInfo.NextMoveStep(StepEnum.OL16_Nozzle_Stop);
SecWorkLog("贴标: 放标签到料盘,等待2000");
SecWorkLog("贴标: 放标签到料盘,等待1S");
IOMove(IO_Type.Nozzle_Work, IO_VALUE.LOW);
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (SecMoveInfo.IsStep(StepEnum.OL16_Nozzle_Stop))
{
......@@ -486,20 +510,21 @@ namespace OnlineStore.DeviceLibrary
if (canLabel)
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_26_LabelOk);
ShelfWorkLog("贴标完成");
LogUtil.info(SecMoveInfo.Name + " 贴标结束");
}
}
else if (SecMoveInfo.IsStep(StepEnum.OL18_LableBack))
{
SecMoveInfo.NextMoveStep(StepEnum.OL19_XYRBackToP1);
SecWorkLog("贴标: XYR返回待机点P1");
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P1, Config.LabelR_P1Speed);
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P1, Config.LabelX_P1Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P1, Config.LabelY_P1Speed);
SecMoveInfo.NextMoveStep(StepEnum.OL19_XYRBackToP2);
SecWorkLog("贴标: XYR返回待机点P2,取码气缸前进");
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
CylinderMove(SecMoveInfo, IO_Type.TakeCode_Back, IO_Type.TakeCode_Forward);
}
else if (SecMoveInfo.IsStep(StepEnum.OL19_XYRBackToP1))
else if (SecMoveInfo.IsStep(StepEnum.OL19_XYRBackToP2))
{
SecWorkLog("贴标完成");
LogUtil.info(SecMoveInfo.Name + " 贴标结束");
SecMoveInfo.EndMove();
}
......
using OnlineStore.Common;
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
......@@ -39,7 +41,7 @@ namespace OnlineStore.DeviceLibrary
{
ShelfMoveInfo.NewMove(RobotMoveType.ShelfPro);
ShelfMoveInfo.NextMoveStep(StepEnum.OS_09_WaitInWLine);
ShelfWorkLog("接料线体入口有新料架,空料串阻挡上升,等待2000毫秒料架到达接料线体");
ShelfWorkLog("接料线体入口有新料串,空料串阻挡上升,等待2000毫秒料串到达接料线体");
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.O_ELine_InStop, IO_VALUE.LOW);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
......@@ -53,14 +55,14 @@ namespace OnlineStore.DeviceLibrary
if (TrayFixedIsBack())
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_03_LocationDown);
ShelfWorkLog("空料串入口有新料, 定位气缸下降,工位阻挡上升");
ShelfWorkLog("空料串入口有新料, 定位气缸下降,工位阻挡上升");
CylinderMove(ShelfMoveInfo, IO_Type.O_Work_LocationUp, IO_Type.O_Work_LocationDown);
IOMove(IO_Type.O_WLine_WorkStop, IO_VALUE.LOW);
}
else
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_01_BatchAxisToP2);
ShelfWorkLog("空料串入口有新料,升降盘不在后退端,提升轴回到P2");
ShelfWorkLog("空料串入口有新料,升降盘不在后退端,提升轴回到P2");
BatchAxis.AbsMove(ShelfMoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
}
......@@ -87,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
return;
}
#region 准备空料
#region 准备空料
if (ShelfMoveInfo.IsStep(StepEnum.OS_01_BatchAxisToP2))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_02_TrayL_After);
......@@ -123,7 +125,7 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OS_06_TopUp))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_07_SWLineRun);
ShelfWorkLog("出料料:空料串阻挡下降,空料串链条转动,横移电机运转");
ShelfWorkLog("出料料:空料串阻挡下降,空料串链条转动,横移电机运转");
IOMove(IO_Type.O_ELine_InStop, IO_VALUE.HIGH);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.HIGH);
......@@ -135,12 +137,13 @@ namespace OnlineStore.DeviceLibrary
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_08_WLineInCheck);
ShelfWorkLog("等待入料线进口信号亮");
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.O_WLine_InCheck, IO_VALUE.HIGH));
}
else if (ShelfMoveInfo.IsStep(StepEnum.OS_08_WLineInCheck))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_09_WaitInWLine);
ShelfWorkLog("空料串阻挡上升,等待2000毫秒料架到达接料线体");
ShelfWorkLog("空料串阻挡上升,等待5秒料串到达接料线体");
IOMove(IO_Type.O_ELine_InStop, IO_VALUE.LOW);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.O_WLine_InCheck, IO_VALUE.HIGH));
......@@ -150,6 +153,7 @@ namespace OnlineStore.DeviceLibrary
ShelfMoveInfo.NextMoveStep(StepEnum.OS_10_TopDown);
ShelfWorkLog("空料串阻挡上升,顶升下降,线体停止转动");
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.LOW);
IOMove(IO_Type.O_ELine_InStop, IO_VALUE.LOW);
CylinderMove(ShelfMoveInfo, IO_Type.O_ELine_TopUp, IO_Type.O_ELine_TopDown);
CylinderMove(ShelfMoveInfo, IO_Type.O_WLine_TopUp, IO_Type.O_WLine_TopDown);
......@@ -203,16 +207,16 @@ namespace OnlineStore.DeviceLibrary
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_18_ShelfReady);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
ShelfWorkLog("料准备完成");
ShelfWorkLog("料准备完成");
}
else if (ShelfMoveInfo.IsStep(StepEnum.OS_18_ShelfReady))
{
//判断是否需要送出料
//判断是否需要送出料
if (AutoSendShelfOut && OutReelCount > 0)
{
string msg = " OS_18_ShelfReady,收到AutoSendShelfOut ";
ShelfMoveInfo.NextMoveStep(StepEnum.OS_31_ShendShelfOut);
ShelfWorkLog(msg + "开始送出料");
ShelfWorkLog(msg + "开始送出料");
}
else
{
......@@ -229,7 +233,7 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OS_21_BatchDownH))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_22_WaitTray);
ShelfWorkLog("等待料盘放入料");
ShelfWorkLog("等待料盘放入料");
}
else if (ShelfMoveInfo.IsStep(StepEnum.OS_23_TrayOK))
{
......@@ -253,8 +257,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (SecMoveInfo.IsTimeOut(120))
{
WarnMsg = SecMoveInfo.Name + "等待 贴标结束 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg);
WarnMsg = SecMoveInfo.Name + "等待 贴标结束 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
LogUtil.error(WarnMsg, SecMoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
......@@ -265,7 +269,7 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
#region 送出料
#region 送出料
else if (ShelfMoveInfo.IsStep(StepEnum.OS_31_ShendShelfOut))
{
......@@ -295,7 +299,7 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OS_35_BatchAxisToP1))
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_36_WaitOutNoShelf);
ShelfWorkLog("等待出口无料");
ShelfWorkLog("等待出口无料");
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.O_WLine_WorkOutCheck, IO_VALUE.LOW));
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.O_WLine_OutCheck, IO_VALUE.LOW));
}
......@@ -324,7 +328,7 @@ namespace OnlineStore.DeviceLibrary
ShelfMoveInfo.EndMove();
IOMove(IO_Type.O_WLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.O_WLine_WorkStop, IO_VALUE.LOW);
ShelfWorkLog("送出料完成,链条停止转动,阻挡上升 ");
ShelfWorkLog("送出料完成,链条停止转动,阻挡上升 ");
}
#endregion
......@@ -332,12 +336,12 @@ namespace OnlineStore.DeviceLibrary
private void CheckNeedSendShelf()
{
//判断是否需要送出料
//判断是否需要送出料
bool needSendOut = false;
string msg = "";
if (AutoSendShelfOut)
{
msg = "放料完成自动送出料,";
msg = "放料完成自动送出料,";
needSendOut = true;
}
else
......@@ -346,19 +350,19 @@ namespace OnlineStore.DeviceLibrary
int tp = currPositon - Config.Height_ChangeValue * 40;
if (tp <= Config.BatchAxisP2)
{
msg = "料已满[" + currPositon + "]";
msg = "料已满[" + currPositon + "]";
needSendOut = true;
}
}
if (needSendOut)
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_31_ShendShelfOut);
ShelfWorkLog(msg + "开始送出料");
ShelfWorkLog(msg + "开始送出料");
}
else
{
ShelfMoveInfo.NextMoveStep(StepEnum.OS_18_ShelfReady);
ShelfWorkLog("料准备完成");
ShelfWorkLog("料准备完成");
}
}
......@@ -379,7 +383,150 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
#region AGV
internal void AgvReady(string id, string rfid)
{
if (id.Equals(Config.AgvInName))
{
ShelfEnterProcess(id,rfid);
}
else if (id.Equals(Config.AgvOutName))
{
ShelfOutProcess(id, rfid);
}
}
private bool ProcessShelfEnter = false;
private bool ProcessShelfOut = false;
internal void ShelfEnterProcess(string id, string rfid)
{
string logName = Name + "料串" + rfid + " [AGV ->" + Config.AgvInName + " ] ";
Task.Factory.StartNew(delegate
{
try
{
if (IOValue(IO_Type.O_ELine_InCheck).Equals(IO_VALUE.LOW))
{
ProcessShelfEnter = true;
LogUtil.info(logName + " 阻挡上升,转动链条");
//AgvClient.SetStatus(Config.AgvInName,"",ClientAction.MayEnter,ClientLevel.High);
//转动线体
IOMove(IO_Type.O_ELine_InStop, IO_VALUE.LOW);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH);
//等待进料检测信号
bool result = WaitIo(IO_Type.O_ELine_InCheck, IO_VALUE.HIGH, 60000);
if (!result)
{
LogUtil.info(logName + " 等待 O_ELine_InCheck=High 超时, 等待 5000 后停止 O_ELine_Run");
}
else
{
LogUtil.info(logName + "已收到 O_ELine_InCheck=High , 等待 5000 后停止 O_ELine_Run");
}
//等待500毫秒后停止转动
Thread.Sleep(5000);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.LOW);
//料串可离开
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.FinishEnter, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(5000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfEnter = false;
LogUtil.info(logName + " 结束");
}
else
{
LogUtil.info(logName + " 入口有料架,暂不处理");
}
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
IOMove(IO_Type.O_ELine_Run, IO_VALUE.LOW);
ProcessShelfEnter = false;
}
});
}
internal void ShelfOutProcess(string id, string rfid)
{
string logName = Name + "料串 "+rfid+"[" + Config.AgvOutName + "->AGV ] ";
Task.Factory.StartNew(delegate
{
try
{
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
if (IOValue(IO_Type.O_WLine_OutCheck).Equals(IO_VALUE.HIGH))
{
LogUtil.info(logName + " 出口阻挡下降,转动线体");
ProcessShelfOut = true;
//出口阻挡下降,出口线体转动
IOMove(IO_Type.O_WLine_OutStop, IO_VALUE.HIGH);
IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH);
bool result = WaitIo(IO_Type.O_WLine_OutCheck, IO_VALUE.LOW, 60000);
if (!result)
{
LogUtil.info(logName + " 等待 O_WLine_OutCheck=LOW超时,等待8000后停止转动 ");
}
else
{
LogUtil.info(logName + " 已收到 O_WLine_OutCheck=LOW ,等待8000后停止转动 ");
}
Thread.Sleep(8000);
//停止转动 ,阻挡上升
IOMove(IO_Type.O_WLine_OutStop, IO_VALUE.LOW);
//此处判断是否需要停止接料线体
IOMove(IO_Type.O_WLine_Run, IO_VALUE.LOW);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.FinishLeave, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(5000);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfOut = false;
LogUtil.info(logName + "结束,停止转动 ");
}
else
{
LogUtil.info(logName + " 未检测到出口料串,暂不处理");
}
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
IOMove(IO_Type.O_WLine_OutStop, IO_VALUE.LOW);
ProcessShelfOut = false;
}
});
}
#endregion
}
}
......@@ -16,6 +16,9 @@ namespace OnlineStore.DeviceLibrary
{
public partial class RobotBean : RobotBase
{
#region 初始化
public bool IsDebug = false;
public InputEquip inputEquip;
......@@ -24,8 +27,6 @@ namespace OnlineStore.DeviceLibrary
public Dictionary<int, EquipBase> equipsMap = new Dictionary<int, EquipBase>();
public Robot_Config Config = null;
#region 初始化
private bool canStart = false;
public RobotBean(Robot_Config lineConfig, InputEquip_Config fconfig, XRay_Config xconfig, OutputEquip_Config pconfig)
......@@ -45,7 +46,7 @@ namespace OnlineStore.DeviceLibrary
IsDebug = Config.IsDebug.Equals(1);
AgvClient.Init();
List<string> ioList = new List<string>();
ioList = new List<string>(DeviceConfig.ProIOIpMap.Values);
......@@ -57,8 +58,11 @@ namespace OnlineStore.DeviceLibrary
equipsMap.Add(3, outputEquip);
IOManager.Init();
CodeManager.LoadConfig();
AgvClient.NodeList.Add(outputEquip.Config.AgvInName);
AgvClient.NodeList.Add(outputEquip.Config.AgvOutName);
AgvClient.NodeList.Add(inputEquip.Config.RightAgvName);
AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName);
Task.Factory.StartNew(delegate
{
LogUtil.info(Name + "开始连接IO模块 ");
......@@ -79,6 +83,7 @@ namespace OnlineStore.DeviceLibrary
}
return "";
}
#region 启动和复位
public override bool StartRun()
{
......@@ -104,7 +109,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(5);
mainTimer.Interval = 1000;
maxSeconds = 10;
maxSeconds = 10;
alarmType = AlarmType.None;
mainTimer.Enabled = false;
isInSuddenDown = false;
......@@ -124,7 +129,9 @@ namespace OnlineStore.DeviceLibrary
EquipStartRun(moveEquip);
}
if (runStatus.Equals(RobotRunStatus.Wait))
{ return false; }
{
return false;
}
RFIDManager.Open(new string[] { });
mainTimer.Enabled = true;
return true;
......@@ -142,7 +149,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(60);
}
}
public override bool Reset()
{
......@@ -162,12 +169,12 @@ namespace OnlineStore.DeviceLibrary
//停止运动
MoveInfo.EndMove();
runStatus = RobotRunStatus.Reset;
//重置通用处理
mainTimer.Interval = 1000;
maxSeconds = 10;
// maxSeconds = 10;
alarmType = AlarmType.None;
mainTimer.Enabled = false;
isInSuddenDown = false;
......@@ -207,30 +214,64 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "收到复位信号," + equip.Name + " 正常无报警,不需要复位");
}
}
}
}
internal override void StopMove()
protected override void ResetProcess()
{
MoveInfo.EndMove();
foreach (EquipBase equip in this.equipsMap.Values)
if (MoveInfo.IsInWait)
{
if (!equip.IsDebug)
CheckWait(MoveInfo);
}
if (!MoveInfo.IsInWait)
{
bool isOk = true;
string msg = "";
//判断是否所有的已经返回完成
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
foreach (EquipBase moveEquip in this.equipsMap.Values)
{
equip.StopRun();
if (moveEquip.runStatus.Equals(RobotRunStatus.HomeMoving) || moveEquip.runStatus.Equals(RobotRunStatus.Reset) || moveEquip.runStatus.Equals(RobotRunStatus.Wait))
{
if (moveEquip.NoAlarm())
{
msg = moveEquip.Name + "复位结束";
isOk = false;
break;
}
else
{
//LogUtil.error(Name + " " + moveEquip.Name + "在复位过程中报警,需要重新复位,调用 moveEquip.Reset();");
//moveEquip.Reset();
////如果小于80秒,继续等待
//if (span.TotalSeconds < 80)
//{
// isOk = false;
// break;
//}
}
}
}
if (isOk)
{
runStatus = RobotRunStatus.Runing;
MoveInfo.EndMove();
mainTimer.Interval = 300;
maxSeconds = 3;
AgvClient.SetCancelState(AgvClient.CurrCancelState);
LogUtil.info(Name + "复位完成 [" + FormUtil.GetSpanStr(span) + "]");
}
else if (span.TotalSeconds > 120)
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
}
public override void StopRun()
{
mainTimer.Enabled = false;
StopMove();
AgvClient.SetCancelState(true);
RFIDManager.Close();
runStatus = RobotRunStatus.Wait;
TimeSpan span = DateTime.Now - StartTime;
LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString());
}
}
#endregion
private bool busyPro = false;
private DateTime busyProTime = DateTime.Now;
......@@ -280,59 +321,232 @@ namespace OnlineStore.DeviceLibrary
}
protected override void ResetProcess()
#region 停止运动
internal override void StopMove()
{
if (MoveInfo.IsInWait)
MoveInfo.EndMove();
foreach (EquipBase equip in this.equipsMap.Values)
{
CheckWait(MoveInfo);
if (!equip.IsDebug)
{
equip.StopRun();
}
}
if (!MoveInfo.IsInWait)
}
public override void StopRun()
{
mainTimer.Enabled = false;
StopMove();
AgvClient.SetCancelState(true);
RFIDManager.Close();
runStatus = RobotRunStatus.Wait;
TimeSpan span = DateTime.Now - StartTime;
LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString());
}
#endregion
#region IOTimeOutProcess
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);
}
}
#endregion
#region CheckWait
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;
string msg = "";
//判断是否所有的已经返回完成
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
foreach (EquipBase moveEquip in this.equipsMap.Values)
if (checkWaitInfo.OneWaitCanEndStep)
{
if (moveEquip.runStatus.Equals(RobotRunStatus.HomeMoving) || moveEquip.runStatus.Equals(RobotRunStatus.Reset) || moveEquip.runStatus.Equals(RobotRunStatus.Wait))
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait == null || wait.IsEnd)
{
if (moveEquip.NoAlarm())
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)
{
msg = moveEquip.Name + "复位结束";
isOk = false;
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( WarnMsg, checkWaitInfo.ErrorLogType);
}
//超过报警时长
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
}
else
{
if (!checkWaitInfo.OneWaitCanEndStep)
{
//LogUtil.error(Name + " " + moveEquip.Name + "在复位过程中报警,需要重新复位,调用 moveEquip.Reset();");
//moveEquip.Reset();
////如果小于80秒,继续等待
//if (span.TotalSeconds < 80)
//{
// isOk = false;
// break;
//}
isOk = false;
break;
}
}
}
if (isOk)
{
runStatus = RobotRunStatus.Runing;
MoveInfo.EndMove();
mainTimer.Interval = 300;
maxSeconds = 3;
AgvClient.SetCancelState(AgvClient.CurrCancelState);
LogUtil.info(Name + "复位完成 [" + FormUtil.GetSpanStr(span) + "]");
{
checkWaitInfo.EndStepWait();
}
else if (span.TotalSeconds > 120)
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 903);
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, checkWaitInfo.ErrorLogType);
Alarm(AlarmType.IoSingleTimeOut);
}
}
catch (Exception ex)
{
LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:", ex);
}
}
#endregion
#region 忙碌处理
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);
}
#endregion
public DateTime LastAlarmTime = DateTime.Now;
public override void Alarm(AlarmType alarmType)
{
if (alarmType.Equals(AlarmType.None).Equals(false))
{
LastAlarmTime = DateTime.Now;
}
if (this.alarmType.Equals(alarmType))
{
return;
}
if (alarmType.Equals(AlarmType.SuddenStop))
{
isInSuddenDown = true;
}
else if (alarmType.Equals(AlarmType.NoAirCheck))
{
isNoAirCheck = true;
}
this.alarmType = alarmType;
if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirCheck) || alarmType.Equals(AlarmType.AxisAlarm))
{
StopMove();
}
}
}
}
\ No newline at end of file
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()
......
......@@ -17,64 +17,99 @@ namespace OnlineStore.DeviceLibrary
//http://10.85.17.233/ReturnOne/WebServiceF.asmx?op=Return_Material
private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx?op=VMICheckRLC";
private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx?op=Return_Material";
public static string Get_VMICheckRLC(string deviceName, string codeStr, out bool need)
private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx?op=VMICheckRLC";
private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx?op=Return_Material";
public static string Get_VMICheckRLC(string deviceName, string codeStr, out int targetP)
{
need = false;
//reelID:
//partNum:
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
targetP=0;
string msg = "";
try
{
if (String.IsNullOrEmpty(codeStr))
string[] codeArray = codeStr.Split(';');
if (codeArray.Length != 2)
{
return msg = deviceName + "未扫到条码";
return msg = deviceName + "【" + codeStr + "】未找到有效条码";
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", codeStr);// barcode = 扫到的条码
paramMap.Add("reelID", codeArray[1]);
paramMap.Add("partNum", codeArray[0]);
string server = GetAddr(Addr_VMICheckRLC, paramMap);
if (server.Equals(""))
{
return "获取是否测值失败";
}
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Get_VMICheckRLC " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
//返回: { "code": 0, "msg":"ok", data: 7}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
CheckData dataResult = JsonHelper.DeserializeJsonToObject<CheckData>(resultStr);
if (dataResult == null)
{
return "获取是否测值失败";
}
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("不需要"))
{
targetP=1;
return "";
}
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("需要"))
{
//需要时,component是电容 或者电阻
if (dataResult.component.Equals("电容"))
{
targetP = 2;
}
else
{
targetP = 3;
}
return "";
}
else
{
targetP = 0;
return msg;
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
return ex.ToString();
}
return "";
}
public static string Return_Material(string deviceName, string barcode, int count)
public static string Return_Material(string deviceName, string codeStr, int count)
{
// Parameter Value
//txtQty:
// txtReelId:
string msg = "";
try
{
if (String.IsNullOrEmpty(barcode))
string[] codeArray = codeStr.Split(';');
if (codeArray.Length != 2)
{
return msg;
return msg = deviceName + "【" + codeStr + "】未找到有效条码";
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
paramMap.Add("count", count.ToString());
paramMap.Add("txtQty", count.ToString());
paramMap.Add("txtReelId", codeArray[1]);
string server = GetAddr(Addr_Return_Material, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// 返回: { "code": 0, "msg":"ok", "data":""}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (!msg.Equals(""))
if (server.Equals(""))
{
LogUtil.error(msg);
return "";
}
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
catch (Exception ex)
{
......@@ -85,7 +120,11 @@ namespace OnlineStore.DeviceLibrary
private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{
string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr);
string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr).Trim();
if (server.Equals(""))
{
return "";
}
if (server.EndsWith("/"))
{
server = server.Substring(0, server.Length - 1);
......@@ -100,135 +139,22 @@ namespace OnlineStore.DeviceLibrary
return path;
}
private static string spiltStr = "##";
public static string ProcessCodeList(List<string> codeList)
private static string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr).Trim();
public static bool CanConnect()
{
string codeStr = "";
List<string> list = new List<string>();
foreach (string str in codeList)
{
if (list.Contains(str.Trim()) || String.IsNullOrEmpty(str.Trim()))
{
continue;
}
codeStr = codeStr + str.Trim() + spiltStr;
}
return codeStr;
return !String.IsNullOrEmpty(server);
}
//// 分盘料/紧急料放上料串或料架时调用 /rest/api/qisda/device/afterPutCut
//private static string Addr_afterPutCut = "/rest/api/qisda/device/afterPutCut";
//public static string afterPutCut(string deviceName, string rfid, string barcode, string cid, int rfidLoc, out TaskData afterData)
//{
// afterData = null;
// string msg = "";
// try
// {
// //参数:
// //cid: 料仓cid,流水线可传入空
// //barcode : 条码
// //rfid : RFID
// //rfidLoc: 料架位置,流水线可传-1
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("barcode", barcode); // 参数: barcode=料盘的条码
// paramMap.Add("rfid", rfid); // rfid = 料架的RFID信息
// paramMap.Add("rfidLoc", rfidLoc.ToString()); // rfidLoc=料架的架位信息
// paramMap.Add("cid", cid); // 料仓cid,流水线可传入空
// string server = GetAddr(Addr_afterPutCut, paramMap);
// DateTime startTime = DateTime.Now;
// string resultStr = HttpHelper.Post(server, "");
// if (barcode != "")
// {
// LogUtil.info(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// }
// else
// {
// LogUtil.debug(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// }
// //> 返回:
// //>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
// //>>
// //>> - code: 0为正常,其他为异常,
// //>> - msg:消息,
// //>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
// //>> - cutPackageTask: 表示当前包装仓的分盘任务数
// //>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
// //>> - cutTask: 表示流水线分盘任务数
// //>> - urgentTask: 表示流水线紧急料任务数
// AfterPutData serverResult = JsonHelper.DeserializeJsonToObject<AfterPutData>(resultStr);
// if (serverResult == null)
// {
// return msg = deviceName + "afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】没有收到服务器反馈";
// }
// else if (serverResult.code.Equals(0).Equals(false))
// {
// return msg = deviceName + " afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】 :" + serverResult.msg;
// }
// afterData = serverResult.data;
// return "";
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " " + ex.ToString());
// }
// return msg;
//}
}
public class ServerData
public class CheckData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
public int IFneed { get; set; }
public string iftest { get; set; }
public string component { get; set; }
public string msg { get; set; }
public string data { get; set; }
public int status { get; set; }
}
//public class AfterPutData
//{
// //>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
// //>>
// //>> - code: 0为正常,其他为异常,
// //>> - msg:消息,
// //>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
// //>> - cutPackageTask: 表示当前包装仓的分盘任务数
// //>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
// //>> - cutTask: 表示流水线分盘任务数
// //>> - urgentTask: 表示流水线紧急料任务数
// public int code { get; set; }
// public string msg { get; set; }
// public TaskData data { get; set; }
//}
//public class TaskData
//{
// /// <summary>
// /// urgentPackageTask: 表示当前包装仓的紧急料任务数
// /// </summary>
// public int urgentPackageTask { get; set; }
// /// <summary>
// /// cutPackageTask: 表示当前包装仓的分盘任务数
// /// </summary>
// public int cutPackageTask { get; set; }
// /// <summary>
// /// cutTask: 表示流水线分盘任务数
// /// </summary>
// public int cutTask { get; set; }
// /// <summary>
// /// urgentTask: 表示流水线紧急料任务数
// /// </summary>
// public int urgentTask { get; set; }
// public string ToStr()
// {
// return "[分盘料=" + cutTask + "][紧急料=" + urgentTask+"]";
// }
//}
}
......@@ -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!