Commit 2795400b LN

增加接驳台横移

1 个父辈 0c1f0ca5
......@@ -94,12 +94,6 @@
<Compile Include="agvtest\FrmAgvTest.Designer.cs">
<DependentUpon>FrmAgvTest.cs</DependentUpon>
</Compile>
<Compile Include="FrmIOMsg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmIOMsg.Designer.cs">
<DependentUpon>FrmIOMsg.cs</DependentUpon>
</Compile>
<Compile Include="FrmHYEquip.cs">
<SubType>Form</SubType>
</Compile>
......@@ -184,9 +178,6 @@
<EmbeddedResource Include="agvtest\FrmAgvTest.resx">
<DependentUpon>FrmAgvTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmIOMsg.resx">
<DependentUpon>FrmIOMsg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmHYEquip.resx">
<DependentUpon>FrmHYEquip.cs</DependentUpon>
</EmbeddedResource>
......
namespace OnlineStore.AssemblyLine
{
partial class FrmIOMsg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblBox = new System.Windows.Forms.Label();
this.lblMsg = new System.Windows.Forms.Label();
this.btnUpdate = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 10000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lblBox
//
this.lblBox.AutoSize = true;
this.lblBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBox.Location = new System.Drawing.Point(570, 62);
this.lblBox.Name = "lblBox";
this.lblBox.Size = new System.Drawing.Size(80, 17);
this.lblBox.TabIndex = 2;
this.lblBox.Text = "料仓连接信息";
//
// lblMsg
//
this.lblMsg.AutoSize = true;
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMsg.Location = new System.Drawing.Point(56, 26);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(94, 17);
this.lblMsg.TabIndex = 3;
this.lblMsg.Text = "10秒钟刷新一次";
//
// btnUpdate
//
this.btnUpdate.Location = new System.Drawing.Point(383, 18);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(115, 33);
this.btnUpdate.TabIndex = 4;
this.btnUpdate.Text = "刷新";
this.btnUpdate.UseVisualStyleBackColor = true;
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(504, 18);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(115, 33);
this.btnExit.TabIndex = 5;
this.btnExit.Text = "退出";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// FrmIOMsg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(990, 708);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.lblMsg);
this.Controls.Add(this.lblBox);
this.Name = "FrmIOMsg";
this.Text = "IO连接状态";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmIOMsg_FormClosed);
this.Load += new System.EventHandler(this.FrmIOMsg_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lblBox;
private System.Windows.Forms.Label lblMsg;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.Button btnExit;
}
}
\ No newline at end of file
using Asa.RFID;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AssemblyLine
{
internal partial class FrmIOMsg : FrmBase
{
public FrmIOMsg()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Visible)
{
UpdateData();
}
}
private void UpdateData()
{
lblMsg.Text = "自动刷新时间:" + timer1.Interval + "毫秒,最后更新时间:" + DateTime.Now.ToLongTimeString();
//lblConInfo.Text = "IO连接信息:\r\n";
string msg = "";
List<string> tList = new List<string>(LineManager.Line.cioList);
foreach (string ip in tList)
{
//string con = (IOManager.instance.IsConnect(ip)) ? " ✔" : " ✘";
//msg += ("IO模块[" + ip + "]").PadLeft(26, ' ') + con + "\n";
}
//lblConInfo.Text += msg;
//lblRFID.Text = "RFID信息:\r\n";
//msg = "";
//List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
//foreach (string ip in rfidList)
//{
// string errorCode = "?";
// if (RFIDAutoReader.rfidErrorMap.ContainsKey(ip))
// {
// errorCode = "" + RFIDAutoReader.rfidErrorMap[ip];
// }
// // string con = RFIDManager.ReadRFID(ip) .NumStr() ;
// msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + "ErrorCode=" + errorCode + "\n";
//}
//lblRFID.Text += msg;
lblBox.Text = "料仓连接信息:\r\n";
msg = "";
List<int> list = new List<int>(LineManager.Line.MoveEquipMap.Keys);
foreach (int storeId in list)
{
if (LineServer. BoxConnected(storeId))
{
string doorTray = "仓门口:未知";
BoxInfo box= LineServer.GetBoxInfo(storeId);
if (box != null )
{
if (box.HasTray.Equals(1))
{
doorTray = "仓门口:有料";
}
else
{
doorTray = "仓门口:无料";
}
}
msg += ("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✔ "+LineServer.ClientMap[storeId].AddStr + " "+doorTray+"\n";
}
else
{
msg += ("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✘ " + "\n";
}
}
lblBox.Text += msg;
}
private void FrmIOMsg_Load(object sender, EventArgs e)
{
UpdateData();
timer1.Start();
}
private void btnExit_Click(object sender, EventArgs e)
{
timer1.Stop();
this.Close();
}
private void btnUpdate_Click(object sender, EventArgs e)
{
UpdateData();
}
private void FrmIOMsg_FormClosed(object sender, FormClosedEventArgs e)
{
timer1.Stop();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -839,9 +839,9 @@
this.toolStripSeparator7,
this.托盘初始化ToolStripMenuItem,
this.toolStripSeparator9,
this.iO模块状态ToolStripMenuItem,
this.toolStripSeparator13,
this.toolStripMenuItem2,
this.toolStripSeparator13,
this.iO模块状态ToolStripMenuItem,
this.toolStripSeparator14,
this.查看托盘信息ToolStripMenuItem,
this.toolStripSeparator12,
......@@ -853,73 +853,73 @@
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Visible = false;
//
// 二维码学习ToolStripMenuItem
//
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6);
//
// 托盘初始化ToolStripMenuItem
//
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
//
// iO模块状态ToolStripMenuItem
//
this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem";
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.iO模块状态ToolStripMenuItem.Text = "IO模块状态";
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.iO模块状态ToolStripMenuItem.Text = "查看料仓状态";
this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click);
//
// toolStripSeparator13
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator13.Size = new System.Drawing.Size(177, 6);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem2.Text = "AGV调试";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripSeparator14
//
this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6);
//
// 查看托盘信息ToolStripMenuItem
//
this.查看托盘信息ToolStripMenuItem.Name = "查看托盘信息ToolStripMenuItem";
this.查看托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.查看托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.查看托盘信息ToolStripMenuItem.Text = "查看托盘信息";
this.查看托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.btnTrayInfo_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6);
//
// 清空托盘信息ToolStripMenuItem
//
this.清空托盘信息ToolStripMenuItem.Name = "清空托盘信息ToolStripMenuItem";
this.清空托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.清空托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.清空托盘信息ToolStripMenuItem.Text = "清空托盘信息";
this.清空托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.清空托盘信息ToolStripMenuItem_Click);
//
......
......@@ -790,8 +790,42 @@ namespace OnlineStore.AssemblyLine
private void iO模块状态ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmIOMsg frm = new FrmIOMsg();
frm.ShowDialog();
//FrmIOMsg frm = new FrmIOMsg();
//frm.ShowDialog();
string msg = "";
List<int> list = new List<int>(LineManager.Line.MoveEquipMap.Keys);
LogUtil.info("-------------------开始打印料仓连接信息:");
foreach (int storeId in list)
{
string storeMsg = "";
if (LineServer.BoxConnected(storeId))
{
string doorTray = "仓门口:未知";
BoxInfo box = LineServer.GetBoxInfo(storeId);
if (box != null)
{
if (box.HasTray.Equals(1))
{
doorTray = "仓门口:有料";
}
else
{
doorTray = "仓门口:无料";
}
}
storeMsg=("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✔ " + LineServer.ClientMap[storeId].AddStr + " " + doorTray + "\n";
}
else
{
storeMsg=("BOX[" + storeId + "]").PadLeft(16, ' ') + " ✘ " + "\n";
}
LogUtil.info(storeMsg);
msg += storeMsg;
}
LogUtil.info("-------------------结束打印料仓连接信息");
MessageBox.Show(msg, "料仓连接状态");
}
private void btnTrayInfo_Click(object sender, EventArgs e)
......
......@@ -103,7 +103,7 @@
this.lblDebug.AutoSize = true;
this.lblDebug.BackColor = System.Drawing.Color.Transparent;
this.lblDebug.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblDebug.Location = new System.Drawing.Point(182, 4);
this.lblDebug.Location = new System.Drawing.Point(179, 4);
this.lblDebug.Name = "lblDebug";
this.lblDebug.Size = new System.Drawing.Size(51, 20);
this.lblDebug.TabIndex = 5;
......@@ -119,7 +119,7 @@
this.lblBox.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblBox.Location = new System.Drawing.Point(2, 73);
this.lblBox.Name = "lblBox";
this.lblBox.Size = new System.Drawing.Size(246, 24);
this.lblBox.Size = new System.Drawing.Size(245, 24);
this.lblBox.TabIndex = 6;
this.lblBox.Text = "BOX状态:";
this.lblBox.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
......@@ -128,12 +128,13 @@
//
this.panName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panName.BackColor = System.Drawing.Color.Lime;
this.panName.BackColor = System.Drawing.Color.Transparent;
this.panName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panName.Controls.Add(this.lblDebug);
this.panName.Controls.Add(this.lblName);
this.panName.Location = new System.Drawing.Point(1, 1);
this.panName.Name = "panName";
this.panName.Size = new System.Drawing.Size(247, 28);
this.panName.Size = new System.Drawing.Size(246, 28);
this.panName.TabIndex = 7;
//
// EquipControl
......
......@@ -53,12 +53,14 @@ namespace OnlineStore.AssemblyLine
else if (equip is FeedingEquip)
{
panName.BackColor = Color.Lime;
panName.BackColor = Color.MediumSpringGreen;
lblBox.Visible = false ;
lblBox.Text = "";
}
else
{
panName.BackColor = Color.Aqua;
panName.BackColor = Color.DarkTurquoise;
lblBox.Visible = false ;
lblBox.Text = "";
}
......@@ -78,12 +80,15 @@ namespace OnlineStore.AssemblyLine
if (equip.MoveInfo.MoveType.Equals(LineMoveType.InStore))
{
lblMoveInfo.Text = "入库中:" + equip.MoveInfo.MoveParam.PosId + "_" + equip.MoveInfo.MoveParam.WareCode;
}
else if (equip.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
lblMoveInfo.Text = "出库中:" + equip.MoveInfo.MoveParam.PosId + "_" + equip.MoveInfo.MoveParam.WareCode;
}
else if (equip.SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{
lblMoveInfo.Text = "托盘[" + equip.currTrayNum + "]处理中";
}
else
{
lblMoveInfo.Text = "暂无出入库";
......@@ -124,13 +129,21 @@ namespace OnlineStore.AssemblyLine
}
else
{
if (equip.MoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
if (equip.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
lblMoveInfo.Text = "托盘[" + equip.currTrayNum + "]送料:" + equip.MoveInfo.MoveParam.PosId + "_" + equip.MoveInfo.MoveParam.WareCode;
}
else if (equip.MoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{
lblMoveInfo.Text = "托盘[" + equip.currTrayNum + "]处理中";
}
else if (equip.SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{
lblMoveInfo.Text = "托盘["+equip.currTrayNum+"]处理中";
lblMoveInfo.Text = "托盘[" + equip.currTrayNum + "]处理中";
}
else
{
lblMoveInfo.Text = "暂无托盘横移";
lblMoveInfo.Text = "暂无托盘处理";
}
}
this.BackColor = equip.GetShowColor();
......
......@@ -21,8 +21,8 @@
上料机构,入料判断托盘是否到位,放行托盘,从lineBean里调用
紧急出料,开始紧急出库横移主动调用开始 托盘出库方法。放行从lineBean里调用
HY,T3C1,只使用MoveInfo,SecondMoveInfo暂不使用,托盘处理MoveType=CheckFixture;
HY,T3C1,只使用MoveInfo,暂不使用,托盘处理MoveType=CheckFixture;
接驳台横移,托盘处理用SecondMoveInfo,料盘移栽用MoveInfo
出料与托盘关联
......
......@@ -68,6 +68,7 @@
<Compile Include="assemblyLine\FeedingEquip_OutStore.cs" />
<Compile Include="assemblyLine\HY\HYEquipBase.cs" />
<Compile Include="assemblyLine\HY\HY_C1_SLStation.cs" />
<Compile Include="assemblyLine\HY\HY_Coveryor_Partial.cs" />
<Compile Include="assemblyLine\HY\HY_OutLine.cs" />
<Compile Include="assemblyLine\HY\HY_C1Line.cs" />
<Compile Include="assemblyLine\LineBean_T3-C1.cs" />
......
......@@ -22,24 +22,15 @@ namespace OnlineStore.DeviceLibrary
public List<InOutParam> waitInStoreList = new List<InOutParam>();
internal object waitInListLock = "";
protected int trayCount = 0;
/// <summary>
/// 上一个盘号
/// </summary>
internal int preTrayNum = 0;
/// <summary>
/// 当前正在通过的托盘号
/// </summary>
public int currTrayNum = 0;
/// <summary>
/// 升降轴
/// </summary>
protected int trayCount = 0;
internal int preTrayNum = 0;
public int currTrayNum = 0;
public AxisBean UpdownAxis = null;
public delegate void TrayProcessEnd(int swNum, int trayNum);
protected abstract void BaseTimerProcess();
protected abstract void CheckFixtureProcess();
protected abstract void FixtureProcess();
protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimerProcess();
......@@ -137,6 +128,40 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("IOTimeOutProcess出错:",ex);
}
}
protected override void BusyMoveProcess()
{
try
{
if (MoveStop)
{
return;
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{
FixtureProcess();
}
if (MoveInfo.MoveType.Equals(LineMoveType.InStore) || this.SecondMoveInfo.MoveType.Equals(LineMoveType.InStore))
{
InStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) || SecondMoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
OutStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.ReturnHome))
{
ResetProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.Reset))
{
ResetProcess();
}
}catch(Exception ex)
{
LogUtil.error(Name + " BusyMoveProcess 出错:" + ex.ToString());
}
}
protected void ClearTimeoutAlarm(string msg)
{
if (isInSuddenDown || isNoAirCheck)
......@@ -527,58 +552,32 @@ namespace OnlineStore.DeviceLibrary
protected void CheckLog(string msg)
{
LogUtil.debug(Name + msg);
LogUtil.debug(Name +"" +msg);
}
protected void InLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
string posId = MoveInfo.MoveParam != null ? "[" + MoveInfo.MoveParam.PosId + "][" + MoveInfo.MoveParam.WareCode + "]" : "";
//baseConfig.DType.Equals(DeviceType.HYEquip)
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
if (String.IsNullOrEmpty(posId))
{
LogUtil.debug(Name + " " + msg);
}
else
{
LogUtil.debug(Name + " " + "[" + posId + "]" + msg);
}
LogUtil.debug(Name + " " + posId + msg);
}
else
{
if (String.IsNullOrEmpty(posId))
{
LogUtil.info(Name + " " + msg);
}
else
{
LogUtil.info(Name + " " + "[" + posId + "]" + msg);
}
LogUtil.info(Name + " " + posId + msg);
}
}
protected void OutLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
if (baseConfig.DType.Equals(DeviceType.HYEquip) || baseConfig.DType.Equals(DeviceType.MoveEquip))
string posId = MoveInfo.MoveParam != null ? "[" + MoveInfo.MoveParam.PosId + "][" + MoveInfo.MoveParam.WareCode + "]" : "";
//baseConfig.DType.Equals(DeviceType.HYEquip)
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
if (String.IsNullOrEmpty(posId))
{
LogUtil.debug(Name + " " + msg);
}
else
{
LogUtil.debug(Name + " " + "[" + posId + "] " + msg);
}
LogUtil.debug(Name + " " + posId + msg);
}
else
{
if (String.IsNullOrEmpty(posId))
{
LogUtil.info(Name + " " + msg);
}
else
{
LogUtil.info(Name + " " + "[" + posId + "] " + msg);
}
LogUtil.info(Name + " " + posId + msg);
}
}
protected string RFIDIP="";
......
......@@ -344,19 +344,17 @@ namespace OnlineStore.DeviceLibrary
if (!isInSuddenDown)
{
LogUtil.error(Name + "收到急停信号,等待300后再次验证急停");
//Task.Factory.StartNew(delegate
//{
Thread.Sleep(300);
if (IOValue(IO_Type.SL_SuddenStop_BTN).Equals(IO_VALUE.LOW))
Thread.Sleep(300);
if (IOValue(IO_Type.SL_SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
SetWarnMsg(Name + "收到急停信号,急停报警");
if (isInSuddenDown.Equals(false))
{
SetWarnMsg(Name + "收到急停信号,急停报警");
if (isInSuddenDown.Equals(false))
{
Alarm(LineAlarmType.SuddenStop);
}
return;
Alarm(LineAlarmType.SuddenStop);
}
//});
return;
}
}
}
else if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH))
......@@ -401,18 +399,18 @@ namespace OnlineStore.DeviceLibrary
//{
// if (Config.IsCanOut.Equals(0))
// {
// StartCheckFixture();
// CheckFixture();
// }
// else if (LineManager.Line.runStatus <= LineRunStatus.Wait)
// {
// StartCheckFixture();
// CheckFixture();
// }
//}
if (NoErrorAlarm())
{
if (IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH))
{
if (TrayManager.checkWatch(needLeaveWatch, 3000))
if (CheckStopWatch(needLeaveWatch, 3000))
{
ClientLevel level = ClientLevel.Low;
if (Config.IsCanOut.Equals(1))
......@@ -435,7 +433,7 @@ namespace OnlineStore.DeviceLibrary
//入口无料架,mayEnter
if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW))
{
if (TrayManager.checkWatch(needEnterWatch, 3000))
if (CheckStopWatch(needEnterWatch, 3000))
{
ClientLevel level = ClientLevel.Low;
if (Config.IsCanOut.Equals(1))
......
......@@ -63,11 +63,11 @@ namespace OnlineStore.DeviceLibrary
#region 托盘检测
private void StartCheckFixture()
private void CheckFixture()
{
}
protected override void CheckFixtureProcess()
protected override void FixtureProcess()
{
}
......
......@@ -153,7 +153,7 @@ namespace OnlineStore.DeviceLibrary
{
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
CheckFixture();
}
}
else
......@@ -164,9 +164,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
TrayManager.checkWatch(trayCheck2LowWait, 30000, false);
CheckStopWatch(trayCheck2LowWait, 30000, false);
}
CheckFixtureProcess();
FixtureProcess();
}
}
......@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch trayCheckWait = new Stopwatch();//检测到托盘的时间
private Stopwatch trayCheck2LowWait = new Stopwatch();//上一个托盘离开的时间
private object lockObj = "";
private void StartCheckFixture()
private void CheckFixture()
{
if (Monitor.TryEnter(lockObj, 100))
{
......@@ -182,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + " StartCheckFixture " + " 不在空闲中,直接返回 ");
LogUtil.error(Name + " CheckFixture " + " 不在空闲中,直接返回 ");
return;
}
if (MoveInfo.MoveType.Equals(LineMoveType.None))
......@@ -190,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.HY_TrayCheck).Equals(IO_VALUE.HIGH))
{
trayCheck2LowWait.Stop();
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
if (CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{
//托盘在工位阻挡处
MoveInfo.NewMove(LineMoveType.CheckFixture);
......@@ -205,8 +205,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (Config.DIList.ContainsKey(IO_Type.HY_FrontStopCheck) && IOValue(IO_Type.HY_FrontStopCheck).Equals(IO_VALUE.HIGH))
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk)
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk)
{
//托盘在前阻挡处
trayCheckWait.Stop();
......@@ -225,8 +225,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (Config.IsOutLineOut.Equals(1) && IOValue(IO_Type.HY_OL_Tray_Check).Equals(IO_VALUE.HIGH))
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk)
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk)
{
//托盘在前阻挡处
trayCheckWait.Stop();
......@@ -241,7 +241,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
trayCheckWait.Stop();
}
......@@ -249,7 +249,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -258,11 +258,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
protected override void CheckFixtureProcess()
protected override void FixtureProcess()
{
if (MoveInfo.IsInWait)
{
......@@ -352,6 +352,11 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.HY_TopCylinder_Up, IO_Type.HY_TopCylinder_Down);
HY_StopCylinderUp(MoveInfo);
OL_StopCylinderUp(MoveInfo);
int lineId = DeviceID % 100;
LogInfo("C1线->出料线 【" + MoveInfo.MoveParam.ToShortStr() + "】" + MoveInfo.SLog + " 更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INBELT】【" + lineId + "】");
//更新料盘位置
SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INBELT, lineId.ToString());
}
else if (MoveInfo.IsStep(LineMoveStep.HY35_IOL_TopDown))
{
......@@ -660,7 +665,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("TrayNeed 出错:" + ex.ToString());
LogUtil.error(Name+"TrayNeed 出错:" + ex.ToString());
}
return false;
}
......@@ -695,18 +700,20 @@ namespace OnlineStore.DeviceLibrary
SServerManager.cancelPutInTask(Name, trayInfo.InoutPar.WareCode);
}
MoveInfo.MoveParam = inoup;
return true ;
}
else if (trayInfo.InOrOutStore.Equals(ReelType.OutStore) && inoup.urgentReel.Equals(false) && inoup.cutReel.Equals(false))
{
LogInfo(" 托盘需要横移到出料线:工单出库料" + "" + inoup.ToStr());
MoveInfo.MoveParam = inoup;
return true;
}
}
}
}
catch (Exception ex)
{
LogUtil.error("TrayNeed 出错:" + ex.ToString());
LogUtil.error(Name+"TrayNeedToOutLine 出错:" + ex.ToString());
}
return false;
}
......
......@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
{
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
CheckFixture();
}
}
else
......@@ -162,9 +162,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
TrayManager.checkWatch(trayCheck2LowWait, 30000, false);
CheckStopWatch(trayCheck2LowWait, 30000, false);
}
CheckFixtureProcess();
FixtureProcess();
}
}
......@@ -172,7 +172,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch trayCheckWait = new Stopwatch();
private Stopwatch trayCheck2LowWait = new Stopwatch();
private object lockObj = "";
private void StartCheckFixture()
private void CheckFixture()
{
if (Monitor.TryEnter(lockObj, 100))
{
......@@ -180,7 +180,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + " StartCheckFixture " + " 不在空闲中,直接返回 ");
LogUtil.error(Name + " CheckFixture " + " 不在空闲中,直接返回 ");
return;
}
if (MoveInfo.MoveType.Equals(LineMoveType.None))
......@@ -188,7 +188,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.HY_TrayCheck).Equals(IO_VALUE.HIGH))
{
trayCheck2LowWait.Stop();
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
if (CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{
MoveInfo.NewMove(LineMoveType.CheckFixture);
if (Config.IsSideWayIn.Equals(1))
......@@ -216,10 +216,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (IOValue(IO_Type.HY_FrontStopCheck).Equals(IO_VALUE.HIGH))
{
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk)
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk)
{
trayCheckWait.Stop();
trayCheck2LowWait.Stop();
......@@ -243,7 +243,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -252,11 +252,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
protected override void CheckFixtureProcess()
protected override void FixtureProcess()
{
if (MoveInfo.IsInWait)
{
......
using OnlineStore.LoadCSVLibrary;
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
{
/// <summary>
/// 接驳台横移
/// 接驳台横移, SMove处理托盘,Move处理料盘移栽
/// </summary>
public class HY_Coveryor:HYEquipBase
public partial class HY_Coveryor : HYEquipBase
{
public HY_Coveryor(string cid, HYEquip_Config config) : base(cid, config)
{
Name = (" JHY" + (DeviceID % 100).ToString().PadLeft(2, '0') + " ").ToUpper();
}
public override bool StartRun(bool isDebug = false)
{
if (CanStartRun().Equals(false))
......@@ -32,7 +34,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
runStatus = LineRunStatus.HomeMoving;
LogInfo("开始 原点返回 ");
MoveInfo.NewMove(LineMoveType.ReturnHome);
StartReset();
if (isDebug)
......@@ -48,7 +49,6 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
LogInfo("开始重置: 升降轴回原点,阻挡气缸上升 ");
runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove();
MoveInfo.NewMove(LineMoveType.Reset);
......@@ -58,24 +58,16 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
ResetClearData();
MoveInfo.NextMoveStep(LineMoveStep.HY_R_01StopMove);
if (IsDebug)
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.HIGH);
IOMove(IO_Type.HY_StopDown, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
IOMove(IO_Type.HY_StopDown, IO_VALUE.LOW);
}
LineStop();
ResetClearData();
MoveInfo.NextMoveStep(LineMoveStep.JHY_R01_UpdownHome);
LogInfo(MoveInfo.MoveType + " " + MoveInfo.MoveStep + ": 电机停止,升降轴回原点,阻挡上升,定位气缸下降,顶升气缸下降");
LineStop(MoveInfo);
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.HY_TopCylinder_Up, IO_Type.HY_TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.HY_LocationCylinder_Up, IO_Type.HY_LocationCylinder_Down);
CylinderMove(MoveInfo, IO_Type.HY_StopCylinder_Down, IO_Type.HY_StopCylinder_Up);
LocationCylinderDown(MoveInfo);
UpdownAxis.HomeMove(MoveInfo);
isInPro = false;
}
......@@ -84,53 +76,58 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (!MoveInfo.IsInWait )
}
if (!MoveInfo.IsInWait)
{
//流水线各装置复原位,夹料气缸状态不变
//阻挡气缸全部=0
//上下气缸上升,、
//上升到位,顶升气缸下降,前后气缸回退
//复位时夹紧气缸需要发送,不然后面出入库会有问题
switch (MoveInfo.MoveStep)
if (MoveInfo.IsStep(LineMoveStep.JHY_R01_UpdownHome))
{
MoveInfo.NextMoveStep(LineMoveStep.JHY_R02_UpdownUp);
LogInfo(MoveInfo.MoveType + " " + MoveInfo.MoveStep + ": 升降轴到P1");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.IsStep(LineMoveStep.JHY_R02_UpdownUp))
{
MoveInfo.NextMoveStep(LineMoveStep.JHY_R03_LocationDown);
LogInfo(MoveInfo.MoveType + " " + MoveInfo.MoveStep + ": 接驳台取料端");
CylinderMove(MoveInfo, IO_Type.HY_MoveCylinder_Give, IO_Type.HY_MoveCylinder_Take);
}
else if (MoveInfo.IsStep(LineMoveStep.JHY_R03_LocationDown))
{
MoveInfo.NextMoveStep(LineMoveStep.JHY_R04_TopDown);
LogInfo(MoveInfo.MoveType + " " + MoveInfo.MoveStep + ": 夹紧气缸放松");
CylinderMove(MoveInfo, IO_Type.HY_ClampCylinder_Work, IO_Type.HY_ClampCylinder_Relax);
}
else if (MoveInfo.IsStep(LineMoveStep.JHY_R04_TopDown))
{
case LineMoveStep.HY_R_01StopMove:
LogInfo(MoveInfo.MoveType + " 完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
break;
default: break;
MoveInfo.NextMoveStep(LineMoveStep.JHY_R05_ClampCheck);
LogInfo(MoveInfo.MoveType + " " + MoveInfo.MoveStep + ": 等待夹爪无信号");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.LOW));
}
else if (MoveInfo.IsStep(LineMoveStep.JHY_R05_ClampCheck))
{
LogInfo(MoveInfo.MoveType + " 完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
}
else
{
LogUtil.error(Name + " ResetProcess 未找到[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]的处理");
}
}
}
/// <summary>
/// 停止运动
/// </summary>
internal override void StopMove()
{
//trayCheck2LowWait.Stop();
//trayCheckWait.Stop();
//如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
DebugInfo("停止运动时出库执行中,减去托盘数;");
//减去需要的盘数
// TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
}
runStatus = LineRunStatus.Busy;
LogInfo("停止运动:电机停止,阻挡上升,定位气缸下降,顶升气缸下降 ");
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
LogInfo("停止运动:上下气缸上升端,阻挡气缸上升 ");
//UpdownUpMove();
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
IOMove(IO_Type.StopDown1, IO_VALUE.LOW);
IOMove(IO_Type.StopDown2, IO_VALUE.LOW);
}
LineStop();
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
CylinderMove(null, IO_Type.HY_LocationCylinder_Up, IO_Type.HY_LocationCylinder_Down);
CylinderMove(null, IO_Type.HY_TopCylinder_Up, IO_Type.HY_TopCylinder_Down);
}
public override void StopRun()
{
if (mainTimer != null)
......@@ -138,47 +135,39 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = false;
}
StopMove();
//停止运行时,把所有IO 置零
CheckAndMove(IO_Type.StopDown1, IO_VALUE.LOW);
CheckAndMove(IO_Type.StopDown2, IO_VALUE.LOW);
CheckAndMove(IO_Type.TopCylinder_Up, IO_VALUE.LOW);
CheckAndMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
CheckAndMove(IO_Type.BeforeAfterCylinder_Before, IO_VALUE.LOW);
CheckAndMove(IO_Type.BeforeAfterCylinder_After, IO_VALUE.LOW);
if (UseAxis.Equals(false))
{
CheckAndMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
CheckAndMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW);
}
CheckAndMove(IO_Type.ClampCylinder_Work, IO_VALUE.LOW);
CheckAndMove(IO_Type.ClampCylinder_Relax, IO_VALUE.LOW);
runStatus = LineRunStatus.Wait;
}
private int GetRobotIndex()
{
int robotIndex = 1;
if (DeviceID.Equals(212))
{
robotIndex = 2;
}
return robotIndex;
}
protected override void BaseTimerProcess()
{
if (isInSuddenDown || isNoAirCheck)
{
return;
}
IOTimeOutProcess();
}
IOTimeOutProcess();
BusyMoveProcess();
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
{
CheckFixture();
}
}
}
}
private void StartCheckFixture()
{
}
protected override void CheckFixtureProcess()
{
}
}
}
......@@ -118,7 +118,7 @@ namespace OnlineStore.DeviceLibrary
{
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
CheckFixture();
}
}
else
......@@ -129,9 +129,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
TrayManager.checkWatch(trayCheck2LowWait, 30000, false);
CheckStopWatch(trayCheck2LowWait, 30000, false);
}
CheckFixtureProcess();
FixtureProcess();
}
}
......@@ -139,7 +139,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch trayCheckWait = new Stopwatch();//检测到托盘的时间
private Stopwatch trayCheck2LowWait = new Stopwatch();//上一个托盘离开的时间
private object lockObj = "";
private void StartCheckFixture()
private void CheckFixture()
{
if (Monitor.TryEnter(lockObj, 100))
{
......@@ -147,7 +147,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + " StartCheckFixture " + " 不在空闲中,直接返回 ");
LogUtil.error(Name + " CheckFixture " + " 不在空闲中,直接返回 ");
return;
}
if (MoveInfo.MoveType.Equals(LineMoveType.None))
......@@ -163,8 +163,8 @@ namespace OnlineStore.DeviceLibrary
{
if (Config.DIList.ContainsKey(IO_Type.HY_LongL_StopCheck) && IOValue(IO_Type.HY_LongL_StopCheck).Equals(IO_VALUE.HIGH))
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk)
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk)
{
//托盘在前阻挡处
trayCheckWait.Stop();
......@@ -178,8 +178,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (Config.DIList.ContainsKey(IO_Type.HY_ShortL_StopCheck) && IOValue(IO_Type.HY_ShortL_StopCheck).Equals(IO_VALUE.HIGH))
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk)
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk)
{
//托盘在前阻挡处
trayCheckWait.Stop();
......@@ -193,7 +193,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
trayCheckWait.Stop();
}
}
......@@ -201,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -210,11 +210,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
protected override void CheckFixtureProcess()
protected override void FixtureProcess()
{
if (MoveInfo.IsInWait)
{
......
......@@ -196,15 +196,15 @@ namespace OnlineStore.DeviceLibrary
//System.IndexOutOfRangeException: 索引超出了数组界限。
// 在 System.Collections.Generic.List`1.Enumerator.MoveNext()
// 在 OnlineStore.DeviceLibrary.LineBean.CheckWait(LineMoveInfo checkWaitInfo) 位置 E:\VSSource\RC1250_佳士达\RC1250-AssemblyLine\source\DeviceLibrary\assemblyLine\LineBean_Partial.cs:行号 89
if (ex is System.IndexOutOfRangeException)
{
if (checkWaitInfo.IsStep(LineMoveStep.SW06_TopCylinderUp))
{
LogUtil.error(checkWaitInfo.Name + " 当前步骤:SW06_TopCylinderUp,IndexOutOfRangeException异常,自动回到上一个步骤 SW05_LocationDown,等待500 重新开始 ");
checkWaitInfo.NextMoveStep(LineMoveStep.SW05_LocationDown);
checkWaitInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
}
//if (ex is System.IndexOutOfRangeException)
//{
// if (checkWaitInfo.IsStep(LineMoveStep.SW06_TopCylinderUp))
// {
// LogUtil.error(checkWaitInfo.Name + " 当前步骤:SW06_TopCylinderUp,IndexOutOfRangeException异常,自动回到上一个步骤 SW05_LocationDown,等待500 重新开始 ");
// checkWaitInfo.NextMoveStep(LineMoveStep.SW05_LocationDown);
// checkWaitInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
// }
//}
}
}
#endregion
......
......@@ -60,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
TrayManager.checkWatch(trayCheck2LowWait, 30000, false);
CheckStopWatch(trayCheck2LowWait, 30000, false);
}
T3C1_BusyProcess();
}
......@@ -91,7 +91,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.HY_TrayCheck).Equals(IO_VALUE.HIGH))
{
trayCheck2LowWait.Stop();
if ( TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
if ( CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{
T3C1_MoveInfo.NewMove(LineMoveType.CheckFixture);
T3C1_MoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopUp);
......@@ -106,10 +106,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (IOValue(IO_Type.HY_FrontStopCheck).Equals(IO_VALUE.HIGH))
{
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk )
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk )
{
trayCheckWait.Stop();
trayCheck2LowWait.Stop();
......@@ -133,7 +133,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -142,7 +142,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
......
......@@ -222,34 +222,7 @@ namespace OnlineStore.DeviceLibrary
CheckAndMove(IO_Type.ClampCylinder_Relax, IO_VALUE.LOW);
runStatus = LineRunStatus.Wait;
}
protected override void BusyMoveProcess()
{
if (MoveStop)
{
return;
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{
CheckFixtureProcess();
}
if (MoveInfo.MoveType.Equals(LineMoveType.InStore) || this.SecondMoveInfo.MoveType.Equals(LineMoveType.InStore))
{
InStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) || SecondMoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
OutStoreProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.ReturnHome))
{
ResetProcess();
}
else if (MoveInfo.MoveType.Equals(LineMoveType.Reset))
{
ResetProcess();
}
}
protected override void BaseTimerProcess()
{
if (isInSuddenDown || isNoAirCheck)
......@@ -262,9 +235,8 @@ namespace OnlineStore.DeviceLibrary
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{
if (LineManager.Line.CanProcessLine())
{
// LogUtil.info("StartCheckFixture");
StartCheckFixture();
{
CheckFixture();
}
}
OutStoreListPro();
......@@ -304,10 +276,7 @@ namespace OnlineStore.DeviceLibrary
waitOutStoreList.Enqueue(param);
}
}
/// <summary>
/// 判断上料横移机构是否可以横移运动
/// </summary>
/// <returns></returns>
public bool CanBeforeAfter()
{
if (UseAxis)
......
......@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
{
int num = MoveInfo.MoveParam.TrayNumber;
MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox);
LogInfo("入库【" + posId + "】 " + MoveInfo.SLog + ": 等待box可入库,更新托盘【" + num + "】为空盘,删除入库任务");
LogInfo("入库【" + posId + "】 " + MoveInfo.SLog + ": 物品已移走,更新托盘【" + num + "】为空盘,删除入库任务");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateTrayInfo(num);
RemoveInStore(MoveInfo.MoveParam);
......@@ -620,7 +620,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch trayCheckWait = new Stopwatch();
private Stopwatch trayCheck2LowWait = new Stopwatch();
private object lockObj = "";
private void StartCheckFixture()
private void CheckFixture()
{
if (Monitor.TryEnter(lockObj, 100))
{
......@@ -634,9 +634,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
TrayManager.checkWatch(trayCheck2LowWait, 30000, false);
CheckStopWatch(trayCheck2LowWait, 30000, false);
}
LogUtil.error(Name + " StartCheckFixture " + " 不在空闲中,直接返回 ");
LogUtil.error(Name + " CheckFixture " + " 不在空闲中,直接返回 ");
return;
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
......@@ -646,7 +646,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.StopCheck2).Equals(IO_VALUE.HIGH))
{
trayCheck2LowWait.Stop();
if (canpro && TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
if (canpro && CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopUp);
......@@ -658,10 +658,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
bool check2IsOk = CheckStopWatch(trayCheck2LowWait, TrayWaitTime, false);
if (IOValue(IO_Type.StopCheck1).Equals(IO_VALUE.HIGH))
{
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk && canpro)
if (CheckStopWatch(trayCheckWait, TrayWaitTime, false) && check2IsOk && canpro)
{
trayCheckWait.Stop();
trayCheck2LowWait.Stop();
......@@ -685,7 +685,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -694,10 +694,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
protected override void CheckFixtureProcess()
protected override void FixtureProcess()
{
if (!LineManager.Line.LineCanRun())
{
......
......@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
LineBean lineBean = LineManager.Line;
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
CheckFixture();
}
}
}
......
......@@ -35,7 +35,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch trayCheckWait = new Stopwatch();
private Stopwatch trayCheck2LowWait = new Stopwatch();
private object lockObj = "";
private void StartCheckFixture()
private void CheckFixture()
{
if (Monitor.TryEnter(lockObj, 100))
{
......@@ -43,7 +43,7 @@ namespace OnlineStore.DeviceLibrary
{
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + " StartCheckFixture " + " 不在空闲中,直接返回 ");
LogUtil.error(Name + " CheckFixture " + " 不在空闲中,直接返回 ");
return;
}
//int num = TrayManager.GetTrayNum(DeviceID);
......@@ -91,7 +91,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(Name + " StartCheckFixture " + " 出错:" + ex.ToString());
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
finally
{
......@@ -100,7 +100,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " StartCheckFixture " + "失败,未得到锁");
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
}
}
private void MO_14_TopCylinder_Down()
......
......@@ -13,8 +13,6 @@ namespace OnlineStore.DeviceLibrary
{
public class TrayManager
{
public static int SwTrayWaitTime = 500;
public static int StopDownWaitTime = 500;
/// <summary>
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
......@@ -176,60 +174,8 @@ namespace OnlineStore.DeviceLibrary
{
TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
}
#region 横移状态缓存
//internal static bool LineCanMoveSW(int swNum)
//{
// //若此横移对应的设备未启动,直接可处理
// foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values)
// {
// if (equip.Config.SidesWayNum.Equals(swNum))
// {
// if (equip.runStatus <= LineRunStatus.Wait || equip.isInSuddenDown || equip.isNoAirCheck)
// {
// return true;
// }
// if (swNum.Equals(2).Equals(false)&& equip.SecondMoveInfo.MoveType.Equals(LineMoveType.None))
// {
// return true;
// }
// break;
// }
// }
// foreach (HYEquipBase equip in LineManager.Line.HYEquipMap.Values)
// {
// if (equip.Config.SidesWayNum.Equals(swNum))
// {
// if (equip.runStatus <= LineRunStatus.Wait || equip.isInSuddenDown || equip.isNoAirCheck)
// {
// return true;
// }
// if (swNum.Equals(4).Equals(false) && equip.SecondMoveInfo.MoveType.Equals(LineMoveType.None))
// {
// return true;
// }
// break;
// }
// }
// return false;
//}
#endregion
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;
}
}
}
......@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
......@@ -10,31 +11,26 @@ using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 康泰克单台自动料仓
/// </summary>
{
public abstract class KTK_Store
{
/// <summary>
/// 料仓状态
/// </summary>
public LineRunStatus runStatus = LineRunStatus.Wait;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public string WarnMsg = "";
public DeviceConfig baseConfig = null;
public string Name { get; set; }
public int DeviceID { get; set; }
/// <summary>
/// 定时器
/// </summary>
protected System.Timers.Timer mainTimer;
private bool isInit = false;
/// <summary>
/// 托盘检测信号需要持续时间
/// </summary>
protected static int TrayWaitTime = 500;
public KTK_Store()
{
}
......@@ -55,11 +51,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压
/// </summary>
public bool isNoAirCheck = false;
//protected int NeedCheckSafetyLight = 0;
/// <summary>
/// 是否再报警中
/// </summary>
public LineAlarmType alarmType = LineAlarmType.None;
public AlarmInfo alarmInfo = new AlarmInfo();
......@@ -93,12 +85,9 @@ namespace OnlineStore.DeviceLibrary
/// 运动处理
/// </summary>
protected bool isInPro = false;
protected virtual void BusyMoveProcess()
{
//if (isInPro)
//{
// return;
//}
{
isInPro = true;
try
{
......@@ -194,39 +183,19 @@ namespace OnlineStore.DeviceLibrary
return true ;
}
return false ;
}
/// <summary>
/// 开始运行
/// </summary>
}
public abstract bool StartRun(bool isDebug = false);
/// <summary>
/// 停止运行
/// </summary>
public abstract void StopRun();
/// <summary>
/// 报警
/// </summary>
/// <param name="alarmType"></param>
public abstract void Alarm(LineAlarmType alarmType );
/// <summary>
/// 重置(夹料装置状态不变)
/// </summary>
public abstract bool Reset();
/// <summary>
/// 停止所有运动
/// </summary>
internal abstract void StopMove( );
/// <summary>
/// 重置处理
/// </summary>
protected abstract void ResetProcess();
/// <summary>
/// 初始化
/// </summary>
protected abstract void ResetProcess();
protected virtual void Init()
{
if (!isInit)
......@@ -239,15 +208,9 @@ namespace OnlineStore.DeviceLibrary
isInit = true;
}
}
/// <summary>
/// 移动信息
/// </summary>
public LineMoveInfo MoveInfo = null;
/// <summary>
/// 定时处理,监听信号,监听IO
/// </summary>
protected abstract void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e);
#region 出库
......@@ -555,7 +518,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 阻塞等待IO信号,等到返回true,未等到返回false
/// </summary>c
public bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{
try
{
......@@ -570,6 +533,23 @@ namespace OnlineStore.DeviceLibrary
return false;
}
}
protected static bool CheckStopWatch(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;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!