Commit 5bc9fae6 LN

1.门口料盘状态发送给服务器doorReelSignal。

2.合并墨西哥料仓机器人对接功能。
3.光栅被遮挡时不扫码.
4.循环点位测试功能。
1 个父辈 86f90bf4
......@@ -18,6 +18,8 @@
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnCDLed = new System.Windows.Forms.Button();
this.btnDevideLed = new System.Windows.Forms.Button();
this.btnCloseLed = new System.Windows.Forms.Button();
this.txtSlaveId = new System.Windows.Forms.TextBox();
this.btnOpenLed = new System.Windows.Forms.Button();
......@@ -35,8 +37,8 @@
this.btnReadAllDi = new System.Windows.Forms.Button();
this.cmbWriteValue = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.btnReadAllDo = new System.Windows.Forms.Button();
this.cmbWriteIO = new System.Windows.Forms.ComboBox();
this.btnReadAllDo = new System.Windows.Forms.Button();
this.btnCloseDoor = new System.Windows.Forms.Button();
this.btnOpenDoor = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
......@@ -78,6 +80,8 @@
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.btnCDLed);
this.groupBox1.Controls.Add(this.btnDevideLed);
this.groupBox1.Controls.Add(this.btnCloseLed);
this.groupBox1.Controls.Add(this.txtSlaveId);
this.groupBox1.Controls.Add(this.btnOpenLed);
......@@ -100,21 +104,44 @@
this.groupBox1.Controls.Add(this.btnCloseDoor);
this.groupBox1.Controls.Add(this.btnOpenDoor);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(518, 197);
this.groupBox1.Location = new System.Drawing.Point(527, 201);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(332, 366);
this.groupBox1.Size = new System.Drawing.Size(343, 402);
this.groupBox1.TabIndex = 105;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DO写入";
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
//
// btnCDLed
//
this.btnCDLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCDLed.Location = new System.Drawing.Point(173, 338);
this.btnCDLed.Name = "btnCDLed";
this.btnCDLed.Size = new System.Drawing.Size(144, 43);
this.btnCDLed.TabIndex = 258;
this.btnCDLed.Text = "关闭设备照明";
this.btnCDLed.UseVisualStyleBackColor = true;
this.btnCDLed.Click += new System.EventHandler(this.btnCDLed_Click);
//
// btnDevideLed
//
this.btnDevideLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDevideLed.Location = new System.Drawing.Point(173, 292);
this.btnDevideLed.Name = "btnDevideLed";
this.btnDevideLed.Size = new System.Drawing.Size(144, 43);
this.btnDevideLed.TabIndex = 257;
this.btnDevideLed.Text = "打开设备照明";
this.btnDevideLed.UseVisualStyleBackColor = true;
this.btnDevideLed.Click += new System.EventHandler(this.btnDevideLed_Click);
//
// btnCloseLed
//
this.btnCloseLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseLed.Location = new System.Drawing.Point(168, 317);
this.btnCloseLed.Location = new System.Drawing.Point(16, 338);
this.btnCloseLed.Name = "btnCloseLed";
this.btnCloseLed.Size = new System.Drawing.Size(144, 34);
this.btnCloseLed.Size = new System.Drawing.Size(144, 43);
this.btnCloseLed.TabIndex = 256;
this.btnCloseLed.Text = "关闭照明";
this.btnCloseLed.Text = "关闭相机照明";
this.btnCloseLed.UseVisualStyleBackColor = true;
this.btnCloseLed.Click += new System.EventHandler(this.btnCloseLed_Click);
//
......@@ -131,11 +158,11 @@
// btnOpenLed
//
this.btnOpenLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenLed.Location = new System.Drawing.Point(19, 317);
this.btnOpenLed.Location = new System.Drawing.Point(16, 292);
this.btnOpenLed.Name = "btnOpenLed";
this.btnOpenLed.Size = new System.Drawing.Size(144, 34);
this.btnOpenLed.Size = new System.Drawing.Size(144, 43);
this.btnOpenLed.TabIndex = 255;
this.btnOpenLed.Text = "打开照明";
this.btnOpenLed.Text = "打开相机照明";
this.btnOpenLed.UseVisualStyleBackColor = true;
this.btnOpenLed.Click += new System.EventHandler(this.btnOpenLed_Click);
//
......@@ -173,9 +200,9 @@
// btnCloseAxisBreak
//
this.btnCloseAxisBreak.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseAxisBreak.Location = new System.Drawing.Point(168, 283);
this.btnCloseAxisBreak.Location = new System.Drawing.Point(173, 236);
this.btnCloseAxisBreak.Name = "btnCloseAxisBreak";
this.btnCloseAxisBreak.Size = new System.Drawing.Size(144, 34);
this.btnCloseAxisBreak.Size = new System.Drawing.Size(144, 43);
this.btnCloseAxisBreak.TabIndex = 253;
this.btnCloseAxisBreak.Text = "关闭刹车";
this.btnCloseAxisBreak.UseVisualStyleBackColor = true;
......@@ -195,9 +222,9 @@
// btnReadIO
//
this.btnReadIO.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadIO.Location = new System.Drawing.Point(19, 133);
this.btnReadIO.Location = new System.Drawing.Point(16, 133);
this.btnReadIO.Name = "btnReadIO";
this.btnReadIO.Size = new System.Drawing.Size(144, 34);
this.btnReadIO.Size = new System.Drawing.Size(144, 43);
this.btnReadIO.TabIndex = 243;
this.btnReadIO.Text = "读取IO状态";
this.btnReadIO.UseVisualStyleBackColor = true;
......@@ -206,9 +233,9 @@
// btnOpenAxisBreak
//
this.btnOpenAxisBreak.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenAxisBreak.Location = new System.Drawing.Point(19, 283);
this.btnOpenAxisBreak.Location = new System.Drawing.Point(173, 189);
this.btnOpenAxisBreak.Name = "btnOpenAxisBreak";
this.btnOpenAxisBreak.Size = new System.Drawing.Size(144, 34);
this.btnOpenAxisBreak.Size = new System.Drawing.Size(144, 43);
this.btnOpenAxisBreak.TabIndex = 252;
this.btnOpenAxisBreak.Text = "打开刹车";
this.btnOpenAxisBreak.UseVisualStyleBackColor = true;
......@@ -228,9 +255,9 @@
// btnWriteSingleDO
//
this.btnWriteSingleDO.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnWriteSingleDO.Location = new System.Drawing.Point(168, 133);
this.btnWriteSingleDO.Location = new System.Drawing.Point(173, 133);
this.btnWriteSingleDO.Name = "btnWriteSingleDO";
this.btnWriteSingleDO.Size = new System.Drawing.Size(144, 34);
this.btnWriteSingleDO.Size = new System.Drawing.Size(144, 43);
this.btnWriteSingleDO.TabIndex = 232;
this.btnWriteSingleDO.Text = "写入DO";
this.btnWriteSingleDO.UseVisualStyleBackColor = true;
......@@ -260,12 +287,13 @@
// btnReadAllDi
//
this.btnReadAllDi.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadAllDi.Location = new System.Drawing.Point(19, 168);
this.btnReadAllDi.Location = new System.Drawing.Point(69, 126);
this.btnReadAllDi.Name = "btnReadAllDi";
this.btnReadAllDi.Size = new System.Drawing.Size(144, 34);
this.btnReadAllDi.Size = new System.Drawing.Size(111, 26);
this.btnReadAllDi.TabIndex = 244;
this.btnReadAllDi.Text = "读取所有DI";
this.btnReadAllDi.UseVisualStyleBackColor = true;
this.btnReadAllDi.Visible = false;
this.btnReadAllDi.Click += new System.EventHandler(this.btnReadAllDi_Click);
//
// cmbWriteValue
......@@ -294,17 +322,6 @@
this.label6.Text = "写入值:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnReadAllDo
//
this.btnReadAllDo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadAllDo.Location = new System.Drawing.Point(168, 168);
this.btnReadAllDo.Name = "btnReadAllDo";
this.btnReadAllDo.Size = new System.Drawing.Size(144, 34);
this.btnReadAllDo.TabIndex = 245;
this.btnReadAllDo.Text = "读取所有DO";
this.btnReadAllDo.UseVisualStyleBackColor = true;
this.btnReadAllDo.Click += new System.EventHandler(this.btnReadAllDo_Click);
//
// cmbWriteIO
//
this.cmbWriteIO.DisplayMember = "ProName";
......@@ -320,12 +337,24 @@
this.cmbWriteIO.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbWriteIO_DrawItem);
this.cmbWriteIO.SelectedIndexChanged += new System.EventHandler(this.cmbWriteIO_SelectedIndexChanged);
//
// btnReadAllDo
//
this.btnReadAllDo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadAllDo.Location = new System.Drawing.Point(226, 126);
this.btnReadAllDo.Name = "btnReadAllDo";
this.btnReadAllDo.Size = new System.Drawing.Size(111, 26);
this.btnReadAllDo.TabIndex = 245;
this.btnReadAllDo.Text = "读取所有DO";
this.btnReadAllDo.UseVisualStyleBackColor = true;
this.btnReadAllDo.Visible = false;
this.btnReadAllDo.Click += new System.EventHandler(this.btnReadAllDo_Click);
//
// btnCloseDoor
//
this.btnCloseDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseDoor.Location = new System.Drawing.Point(168, 213);
this.btnCloseDoor.Location = new System.Drawing.Point(16, 236);
this.btnCloseDoor.Name = "btnCloseDoor";
this.btnCloseDoor.Size = new System.Drawing.Size(144, 34);
this.btnCloseDoor.Size = new System.Drawing.Size(144, 43);
this.btnCloseDoor.TabIndex = 249;
this.btnCloseDoor.Text = "关闭仓门";
this.btnCloseDoor.UseVisualStyleBackColor = true;
......@@ -334,9 +363,9 @@
// btnOpenDoor
//
this.btnOpenDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenDoor.Location = new System.Drawing.Point(19, 213);
this.btnOpenDoor.Location = new System.Drawing.Point(16, 189);
this.btnOpenDoor.Name = "btnOpenDoor";
this.btnOpenDoor.Size = new System.Drawing.Size(144, 34);
this.btnOpenDoor.Size = new System.Drawing.Size(144, 43);
this.btnOpenDoor.TabIndex = 248;
this.btnOpenDoor.Text = "打开仓门";
this.btnOpenDoor.UseVisualStyleBackColor = true;
......@@ -345,7 +374,7 @@
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Location = new System.Drawing.Point(686, 569);
this.button1.Location = new System.Drawing.Point(694, 607);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(144, 34);
this.button1.TabIndex = 254;
......@@ -360,7 +389,7 @@
this.chbAutoRead.Checked = true;
this.chbAutoRead.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbAutoRead.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAutoRead.Location = new System.Drawing.Point(588, 577);
this.chbAutoRead.Location = new System.Drawing.Point(588, 613);
this.chbAutoRead.Name = "chbAutoRead";
this.chbAutoRead.Size = new System.Drawing.Size(75, 21);
this.chbAutoRead.TabIndex = 244;
......@@ -374,7 +403,7 @@
this.groupBox4.Controls.Add(this.tableLayoutPanel2);
this.groupBox4.Location = new System.Drawing.Point(269, 8);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(252, 603);
this.groupBox4.Size = new System.Drawing.Size(252, 639);
this.groupBox4.TabIndex = 104;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "DO列表";
......@@ -391,7 +420,7 @@
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(241, 583);
this.tableLayoutPanel2.Size = new System.Drawing.Size(241, 619);
this.tableLayoutPanel2.TabIndex = 103;
//
// groupBox3
......@@ -401,7 +430,7 @@
this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(12, 8);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(252, 603);
this.groupBox3.Size = new System.Drawing.Size(252, 639);
this.groupBox3.TabIndex = 103;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "DI列表";
......@@ -418,7 +447,7 @@
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 17F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(241, 583);
this.tableLayoutPanel1.Size = new System.Drawing.Size(241, 619);
this.tableLayoutPanel1.TabIndex = 102;
//
// groupBox2
......@@ -440,9 +469,9 @@
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.txtAI1);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(518, 8);
this.groupBox2.Location = new System.Drawing.Point(527, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(332, 189);
this.groupBox2.Size = new System.Drawing.Size(343, 189);
this.groupBox2.TabIndex = 245;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "高度传感器";
......@@ -496,7 +525,7 @@
//
this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label10.Location = new System.Drawing.Point(164, 159);
this.label10.Location = new System.Drawing.Point(167, 159);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(93, 17);
this.label10.TabIndex = 255;
......@@ -518,9 +547,9 @@
//
this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label9.Location = new System.Drawing.Point(0, 159);
this.label9.Location = new System.Drawing.Point(6, 159);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(93, 17);
this.label9.Size = new System.Drawing.Size(90, 17);
this.label9.TabIndex = 253;
this.label9.Text = "料盘高度:";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
......@@ -643,7 +672,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(882, 621);
this.ClientSize = new System.Drawing.Size(882, 657);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
......@@ -717,6 +746,8 @@
private System.Windows.Forms.TextBox txtAI4;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox txtAIResult3;
private System.Windows.Forms.Button btnCDLed;
private System.Windows.Forms.Button btnDevideLed;
}
}
......@@ -50,13 +50,8 @@ namespace OnlineStore.ACSingleStore
foreach (ConfigIO ioValue in boxBean.Config.StoreDIList.Values)
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl();
control.IOName = ioValue.ElectricalDefinition + "_" + ResourceCulture.GetString(ioValue.ElectricalDefinition, ioValue.Explain);
control.IOValue = 0;
control.isCanClick = false;
control.Name = "IO_" + ioValue.ProName;
control.Size = new System.Drawing.Size(200, 25);
control.TabIndex = 0;
IOTextControl control = new IOTextControl(ioValue.DisplayName, ioValue.ProName);
control.Click += Control_Click;
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
DIControlList.Add(ioValue.ProName, control);
......@@ -68,14 +63,8 @@ namespace OnlineStore.ACSingleStore
foreach (ConfigIO ioValue in boxBean.Config.StoreDOList.Values)
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl();
control.IOName = ioValue.ElectricalDefinition + "_" + ResourceCulture.GetString(ioValue.ElectricalDefinition, ioValue.Explain);
control.IOValue = 0;
control.isCanClick = true;
//control.Location = new System.Drawing.Point(0, 25*roleindex);
control.Name = "IO_" + ioValue.ProName;
control.Size = new System.Drawing.Size(200, 25);
control.TabIndex = 0;
IOTextControl control = new IOTextControl(ioValue.DisplayName, ioValue.ProName);
control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
DOControlList.Add(ioValue.ProName, control);
......@@ -87,6 +76,17 @@ namespace OnlineStore.ACSingleStore
cmbWriteIO.DisplayMember = "DisplayStr";
cmbWriteValue.SelectedIndex = 0;
}
private void Control_Click(object sender, EventArgs e)
{
IOTextControl control = (IOTextControl)sender;
string name = control.Name.Substring(3, control.Name.Length - 3);
List<string> keyList = new List<string>(DOControlList.Keys);
int index = keyList.IndexOf(name);
if (index >= 0)
{
cmbWriteIO.SelectedIndex = index;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
......@@ -149,10 +149,12 @@ namespace OnlineStore.ACSingleStore
{
// txtIp.Text = io.DeviceName;
txtDOIndex.Text = io.GetIOAddr().ToString();
txtDoName.Text = io.DeviceName;
txtSlaveId.Text = io.SlaveID.ToString();
txtDoName.Text = io.IO_IP;
IOTextControl newControl = DOControlList[io.ProName];
if (selectControl != null) { selectControl.BackColor = Color.White; }
newControl.BackColor = Color.SkyBlue;
selectControl = newControl;
}
}
}
......@@ -160,6 +162,16 @@ namespace OnlineStore.ACSingleStore
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
AIManager.Instance.NeedShow = true;
if (boxBean.Config.StoreDOList.ContainsKey(IO_Type.Device_Led))
{
btnDevideLed.Visible = true;
btnCDLed.Visible = true;
}
else
{
btnDevideLed.Visible = false;
btnCDLed.Visible = false;
}
}
private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e)
......@@ -259,11 +271,13 @@ namespace OnlineStore.ACSingleStore
}
private void btnOpenDoor_Click(object sender, EventArgs e)
{
LogUtil.info("点击按钮:" + btnOpenDoor.Text);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
}
private void btnCloseDoor_Click(object sender, EventArgs e)
{
LogUtil.info("点击按钮:" + btnCloseDoor.Text);
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
......@@ -297,5 +311,22 @@ namespace OnlineStore.ACSingleStore
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
}
private void btnDevideLed_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
}
private void btnCDLed_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.LOW);
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
}
}
......@@ -78,7 +78,6 @@
this.txtPwd.PasswordChar = '*';
this.txtPwd.Size = new System.Drawing.Size(215, 33);
this.txtPwd.TabIndex = 276;
this.txtPwd.Text = "123456";
this.txtPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPwd_KeyDown);
//
// FrmPwd
......
......@@ -92,6 +92,19 @@
this.label27 = new System.Windows.Forms.Label();
this.btnTempClose = new System.Windows.Forms.Button();
this.btnTempInit = new System.Windows.Forms.Button();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtTSpeed = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.lblTmsg = new System.Windows.Forms.Label();
this.cmbTest = new System.Windows.Forms.ComboBox();
this.txtB = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtA = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.btnTStop = new System.Windows.Forms.Button();
this.btnTStart = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblWarnMsg = new System.Windows.Forms.Label();
this.lblThisSta = new System.Windows.Forms.Label();
......@@ -181,6 +194,8 @@
this.groupCode.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupHistory.SuspendLayout();
this.tabPage7.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupInout.SuspendLayout();
this.menuStrip1.SuspendLayout();
......@@ -522,6 +537,7 @@
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Location = new System.Drawing.Point(542, 89);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
......@@ -611,7 +627,7 @@
this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(7, 9);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(553, 429);
this.richTextBox1.Size = new System.Drawing.Size(534, 429);
this.richTextBox1.TabIndex = 256;
this.richTextBox1.Text = "";
//
......@@ -976,6 +992,159 @@
this.btnTempInit.UseVisualStyleBackColor = true;
this.btnTempInit.Click += new System.EventHandler(this.btnTempInit_Click);
//
// tabPage7
//
this.tabPage7.Controls.Add(this.groupBox1);
this.tabPage7.Location = new System.Drawing.Point(4, 29);
this.tabPage7.Name = "tabPage7";
this.tabPage7.Size = new System.Drawing.Size(547, 618);
this.tabPage7.TabIndex = 3;
this.tabPage7.Text = "点位循环测试";
this.tabPage7.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.txtTSpeed);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.lblTmsg);
this.groupBox1.Controls.Add(this.cmbTest);
this.groupBox1.Controls.Add(this.txtB);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtA);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.btnTStop);
this.groupBox1.Controls.Add(this.btnTStart);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(7, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(534, 290);
this.groupBox1.TabIndex = 273;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "循环跑点位测试";
//
// txtTSpeed
//
this.txtTSpeed.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtTSpeed.Location = new System.Drawing.Point(112, 62);
this.txtTSpeed.MaxLength = 10;
this.txtTSpeed.Name = "txtTSpeed";
this.txtTSpeed.Size = new System.Drawing.Size(87, 26);
this.txtTSpeed.TabIndex = 252;
this.txtTSpeed.Text = "55";
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(4, 70);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(102, 17);
this.label1.TabIndex = 251;
this.label1.Text = "速度:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblTmsg
//
this.lblTmsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblTmsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTmsg.ForeColor = System.Drawing.Color.Red;
this.lblTmsg.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTmsg.Location = new System.Drawing.Point(2, 178);
this.lblTmsg.Name = "lblTmsg";
this.lblTmsg.Size = new System.Drawing.Size(528, 106);
this.lblTmsg.TabIndex = 250;
this.lblTmsg.Text = "未开始测试";
//
// cmbTest
//
this.cmbTest.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTest.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbTest.FormattingEnabled = true;
this.cmbTest.ItemHeight = 17;
this.cmbTest.Location = new System.Drawing.Point(112, 30);
this.cmbTest.Name = "cmbTest";
this.cmbTest.Size = new System.Drawing.Size(278, 25);
this.cmbTest.TabIndex = 249;
this.cmbTest.SelectedIndexChanged += new System.EventHandler(this.cmbTest_SelectedIndexChanged);
//
// txtB
//
this.txtB.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtB.Location = new System.Drawing.Point(112, 128);
this.txtB.MaxLength = 10;
this.txtB.Name = "txtB";
this.txtB.Size = new System.Drawing.Size(87, 26);
this.txtB.TabIndex = 247;
this.txtB.Text = "8888";
//
// label6
//
this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label6.Location = new System.Drawing.Point(4, 132);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(102, 17);
this.label6.TabIndex = 246;
this.label6.Text = "B点位置:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtA
//
this.txtA.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtA.Location = new System.Drawing.Point(112, 95);
this.txtA.MaxLength = 10;
this.txtA.Name = "txtA";
this.txtA.Size = new System.Drawing.Size(87, 26);
this.txtA.TabIndex = 245;
this.txtA.Text = "999";
//
// label7
//
this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label7.Location = new System.Drawing.Point(4, 101);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(102, 17);
this.label7.TabIndex = 244;
this.label7.Text = "A点位置:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label8
//
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label8.Location = new System.Drawing.Point(4, 39);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(102, 17);
this.label8.TabIndex = 242;
this.label8.Text = "轴:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnTStop
//
this.btnTStop.Location = new System.Drawing.Point(244, 116);
this.btnTStop.Name = "btnTStop";
this.btnTStop.Size = new System.Drawing.Size(134, 33);
this.btnTStop.TabIndex = 89;
this.btnTStop.Text = "停止";
this.btnTStop.UseVisualStyleBackColor = true;
this.btnTStop.Click += new System.EventHandler(this.btnTStop_Click);
//
// btnTStart
//
this.btnTStart.Location = new System.Drawing.Point(244, 78);
this.btnTStart.Name = "btnTStart";
this.btnTStart.Size = new System.Drawing.Size(134, 33);
this.btnTStart.TabIndex = 88;
this.btnTStart.Text = "开始";
this.btnTStart.UseVisualStyleBackColor = true;
this.btnTStart.Click += new System.EventHandler(this.btnTStart_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.lblWarnMsg);
......@@ -1865,8 +2034,7 @@
this.轴卡点动ToolStripMenuItem,
this.toolStripSeparator9,
this.扫码测试ToolStripMenuItem,
this.toolStripSeparator10
});
this.toolStripSeparator10});
this.设备调试ToolStripMenuItem.Name = "设备调试ToolStripMenuItem";
this.设备调试ToolStripMenuItem.Size = new System.Drawing.Size(100, 29);
this.设备调试ToolStripMenuItem.Text = "设备调试";
......@@ -1874,27 +2042,26 @@
// 轴卡点动ToolStripMenuItem
//
this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem";
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(179, 30);
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(160, 30);
this.轴卡点动ToolStripMenuItem.Text = "轴卡点动";
this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(176, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(157, 6);
//
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(179, 30);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(160, 30);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(176, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(157, 6);
//
// 配置信息ToolStripMenuItem
//
......@@ -1977,6 +2144,9 @@
this.groupBox7.PerformLayout();
this.groupHistory.ResumeLayout(false);
this.groupHistory.PerformLayout();
this.tabPage7.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupInout.ResumeLayout(false);
......@@ -2135,6 +2305,19 @@
private System.Windows.Forms.Button btnUpdown;
private System.Windows.Forms.Button btnLan;
private System.Windows.Forms.CheckBox chbIsDebug;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtB;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtA;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button btnTStop;
private System.Windows.Forms.Button btnTStart;
private System.Windows.Forms.ComboBox cmbTest;
private System.Windows.Forms.Label lblTmsg;
private System.Windows.Forms.TextBox txtTSpeed;
private System.Windows.Forms.Label label1;
}
}
......@@ -161,6 +161,9 @@ namespace OnlineStore.ACSingleStore
}
this.tabControl1.TabPages.Remove(tabPage3);
groupCode.Visible = false;
loadTest();
tabControl1.TabPages.Remove(tabPage7);
}
private string WaitStart = ResourceCulture.GetString("等待启动");
private string dooropen = ResourceCulture.GetString("前门未关");
......@@ -183,6 +186,7 @@ namespace OnlineStore.ACSingleStore
{
return;
}
showTestMsg();
lblTempStr.Text = store.currTempStr;
ShowMsg();
//ReadPosistion();
......@@ -952,7 +956,8 @@ namespace OnlineStore.ACSingleStore
{
this.ShowInTaskbar = false;
this.notifyIcon1.Visible = true;
this.Hide();
//this.Hide();
this.WindowState = FormWindowState.Minimized ;
DebugStatus(false);
}
private void FrmStoreBox_FormClosed(object sender, FormClosedEventArgs e)
......@@ -1096,6 +1101,7 @@ namespace OnlineStore.ACSingleStore
ConfigAppSettings.SaveValue(Setting_Init.UseBuzzer, 0);
store.UseBuzzer = false;
LogUtil.info("去掉:启用蜂鸣器");
IOManager.IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
}
}
......@@ -1190,5 +1196,151 @@ namespace OnlineStore.ACSingleStore
StoreManager.UpdateBoxConfig(store.Config);
}
}
private void loadTest()
{
List<ConfigMoveAxis> axisList = new List<ConfigMoveAxis>(store.moveAxisList);
if (axisList.Count > 0)
{
cmbTest.Items.Clear();
foreach (ConfigMoveAxis a in axisList)
{
cmbTest.Items.Add(a.DisplayStr);
}
cmbTest.SelectedIndex = 0;
PortName = axisList[0].DeviceName;
SlvAddr = axisList[0].GetAxisValue();
}
}
private string PortName = "";
private int SlvAddr = 0;
private bool StartTest = false;
private string testInfo = "";
private string currInfo = "";
private int moveCount = 0;
private int speed = 1000;
private int A;
private int B;
private void btnTStart_Click(object sender, EventArgs e)
{
if (cmbTest.SelectedIndex >= 0)
{
DialogResult result=MessageBox.Show("确定开始循环测试?","确定提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (!result.Equals(DialogResult.Yes))
{
return;
}
ConfigMoveAxis axis = store.moveAxisList[cmbTest.SelectedIndex];
PortName = axis.DeviceName;
SlvAddr = axis.GetAxisValue();
A = FormUtil.GetIntValue(txtA);
B=FormUtil.GetIntValue(txtB);
speed = FormUtil.GetIntValue(txtTSpeed);
moveCount = 0;
testInfo = DateTime.Now.ToString()+" "+ axis.DisplayStr + " 循环中:从 [" + A + "] 到 [" +B + "] " ;
LogUtil.info($"{cmbTest.Text} 开始测试:" + testInfo);
StartTest = true;
System.Threading.Tasks.Task.Run(() =>
{
TestRun();
});
FromStart(StartTest);
}
else
{
MessageBox.Show("请选择运动轴");
}
}
private void btnTStop_Click(object sender, EventArgs e)
{
StartTest = false;
FromStart(StartTest);
LogUtil.info($"{cmbTest.Text} 停止测试:" );
ACServerManager.SuddenStop(PortName, SlvAddr);
Thread.Sleep(200);
testInfo = "已停止测试";
currInfo = "";
}
private void TestRun()
{
while(StartTest)
{
try
{
Thread.Sleep(200);
if (!ACServerManager.ServerOnStatus(PortName, SlvAddr))
{
currInfo = DateTime.Now.ToString() + " " + $"第{moveCount}次移动,伺服还未打开,请先打开伺服";
}
else if (ACServerManager.GetAlarmStatus(PortName, SlvAddr) > 0)
{
currInfo = DateTime.Now.ToString() + " " + $"第{moveCount}次移动,伺服报警,请检查";
}
else
{
bool isOk = ACServerManager.GetBusyStatus(PortName, SlvAddr).Equals(0);
if (isOk)
{
bool useA = (moveCount % 2 == 0);
if (useA)
{
ACServerManager.AbsMove(PortName, SlvAddr, A, speed);
currInfo = DateTime.Now.ToString() + " " + $"第{moveCount}次移动,目标A点:{A}";
}
else
{
ACServerManager.AbsMove(PortName, SlvAddr, B, speed);
currInfo = DateTime.Now.ToString() + " " + $"第{moveCount}次移动,目标B点:{B}";
}
moveCount++;
LogUtil.info($"循环测试:{cmbTest.Text} " + currInfo);
}
}
}
catch(Exception ex)
{
LogUtil.error(" testRun 出错:" + ex.ToString());
}
}
}
private void FromStart(bool start)
{
cmbTest.Enabled = !start;
txtA.Enabled = !start;
txtB.Enabled = !start;
txtTSpeed.Enabled = !start;
btnTStart.Enabled = !start;
btnTStop.Enabled = start;
}
private void cmbTest_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbTest.SelectedIndex >= 0)
{
ConfigMoveAxis axis = store.moveAxisList[cmbTest.SelectedIndex];
PortName = axis.DeviceName;
SlvAddr = axis.GetAxisValue();
txtTSpeed.Text = axis.TargetSpeed / 2+"";
}
}
private void showTestMsg()
{
lblTmsg.Text = testInfo + "\r\n" + currInfo;
}
}
}
......@@ -56,7 +56,7 @@ namespace OnlineStore
//string chinaPath = Application.StartupPath + @"\resource\zh-CN.resource";
//Dictionary<string, string> ChinaMap = LoadDataMap(chinaPath);
//Dictionary<string, string> EnglishMap = LoadDataMap(englishPath);
string rPath = Application.StartupPath + @"\resource\language.resource";
string rPath= Application.StartupPath + @"\resource\language.resource";
ResourceMap = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, string> ChinaMap = new Dictionary<string, string>();
Dictionary<string, string> EnglishMap = new Dictionary<string, string>();
......@@ -103,10 +103,9 @@ namespace OnlineStore
// EnglishMap.Add(key, eng);
}
}
}
catch (Exception ex)
}catch(Exception ex)
{
LogUtil.error("读取文件【" + rPath + "】【" + line + "】出错:" + ex.ToString());
LogUtil.error("读取文件【"+ rPath + "】【"+ line + "】出错:" + ex.ToString());
}
}
}
......@@ -139,7 +138,7 @@ namespace OnlineStore
EnglishMap.Add(key, englistr);
}
}
string str = key + spilt + chinastr.Replace(spilt, '&') + spilt + englistr.Replace(spilt, '&');
string str = key + spilt + chinastr.Replace( spilt, '&') + spilt + englistr.Replace( spilt, '&');
allList.Add(str);
}
if (isNeedUpE)
......@@ -164,7 +163,7 @@ namespace OnlineStore
//FileUtil.SaveListToFile(allList.ToArray(), Application.StartupPath + "\\a.txt");
}
private static Dictionary<string, string> LoadRMap()
private static Dictionary<string,string> LoadRMap()
{
string path = Application.StartupPath + @"\resource\ResourceMap.csv";
Dictionary<string, string> map = new Dictionary<string, string>();
......@@ -203,7 +202,7 @@ namespace OnlineStore
}
catch (Exception ex)
{
LogUtil.error("加载 " + path + " 出错:" + ex.ToString());
LogUtil.error("加载 "+ path + " 出错:" + ex.ToString());
}
return map;
}
......@@ -273,7 +272,7 @@ namespace OnlineStore
string strCurLanguage = gets(English, id);
return String.Format(strCurLanguage, param);
}
private static string gets(string language, string id, string defaultStr = "")
private static string gets(string language,string id,string defaultStr="")
{
if (String.IsNullOrEmpty(defaultStr))
{
......@@ -287,7 +286,7 @@ namespace OnlineStore
{
if (ShowMsg)
{
LogUtil.error("No Language Resources:[" + id + "], please add");
LogUtil.debug ("No Language Resources:[" + id + "], please add");
}
return defaultStr;
}
......@@ -307,10 +306,9 @@ namespace OnlineStore
catch (Exception ex)
{
NoIdLog(id, defaultStr);
}return defaultStr;
}
return defaultStr;
}
public static string GetString(string id, string defaultStr = "")
public static string GetString(string id, string defaultStr="")
{
string strCurLanguage = defaultStr;
if (string.IsNullOrEmpty(defaultStr))
......@@ -325,7 +323,7 @@ namespace OnlineStore
{
if (ShowMsg)
{
LogUtil.error("No Language Resources:[" + id + "], please add");
LogUtil.debug("No Language Resources:[" + id + "], please add");
}
return defaultStr;
}
......@@ -361,9 +359,9 @@ namespace OnlineStore
{
return;
}
if (ShowMsg)
// if (ShowMsg)
{
LogUtil.info("No id:[" + id + "], please add,use default string :" + defaultStr);
LogUtil.debug("No id:[" + id + "], please add,use default string :" + defaultStr);
}
if (!defaultMap.ContainsKey(id))
{
......@@ -379,8 +377,8 @@ namespace OnlineStore
foreach (string key in defaultMap.Keys)
{
string value = defaultMap[key];
LogUtil.info("" + key + spilt + value + spilt + "");
LogUtil.RLog("" + key + spilt + value.Replace(spilt, '&') + spilt + "");
LogUtil.info("" + key + spilt + value +spilt +"");
LogUtil.RLog("" + key + spilt + value.Replace(spilt,'&') + spilt+"");
}
LogUtil.info("结束打印缺少的文字配置");
......@@ -417,7 +415,7 @@ namespace OnlineStore
string showMsg = ResourceCulture.GetString(msg, msg, param);
string showTitle = ResourceCulture.GetString("提示");
return MessageBox.Show(showMsg, showTitle);
return MessageBox.Show( showMsg,showTitle);
}
public static DialogResult Show(string msg, string title, MessageBoxButtons but, params object[] param)
{
......
......@@ -207,5 +207,9 @@ namespace OnlineStore.Common
/// 温度报警值
/// </summary>
public static string maxTemperature = "temp";
/// <summary>
/// 门口料盘检测信号,1或者0
/// </summary>
public static string doorReelSignal = "doorReelSignal";
}
}
......@@ -135,19 +135,26 @@ namespace OnlineStore.DeviceLibrary
public override double GetAIValue(string ioiP, int index)
{
for (int i = 1; i <= 3; i++)
{
try
{
if (AIValList != null && index >= 0 && AIValList.Count > index)
{
return AIValList[index];
}
}
catch (Exception ex)
{
if (i > 1)
{
LogUtil.error("GetAIValue第【" + i + "】次获取 " + ioiP + "_" + index + "出错:" + ex.ToString());
}
}
Thread.Sleep(1);
}
return 0;
}
//public override double ConvertAI(double aiValue, double defaultValue)
//{
// double xishu = (double)ConfigAppSettings.GetNumValue(Setting_Init.AI_ConvertPosition);
// double result = Math.Round((aiValue - defaultValue) / xishu, 2);
// return result;
//}
}
}
......@@ -9,19 +9,17 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System.Threading.Tasks;
using Asa.IOModule;
using System.Collections.Concurrent;
namespace OnlineStore.DeviceLibrary
{
public class AIOBOXManager : IOManager
{
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
public Dictionary<string, List<Box_Sta>> DOValueMap = new Dictionary<string, List<Box_Sta>>();
public ConcurrentDictionary<string, List<Box_Sta>> DIValueMap = new ConcurrentDictionary<string, List<Box_Sta>>();
public ConcurrentDictionary<string, List<Box_Sta>> DOValueMap = new ConcurrentDictionary<string, List<Box_Sta>>();
private object DIMapLock = "";
private object DOMapLock = "";
......@@ -87,13 +85,14 @@ namespace OnlineStore.DeviceLibrary
}
AIOMap.Remove(ioIp);
}
List<Box_Sta> list = new List<Box_Sta>();
if (DIValueMap.ContainsKey(ioIp))
{
DIValueMap.Remove(ioIp);
DIValueMap.TryRemove(ioIp,out list);
}
if (DOValueMap.ContainsKey(ioIp))
{
DOValueMap.Remove(ioIp);
DOValueMap.TryRemove(ioIp, out list);
}
int DIMS = ConfigAppSettings.GetIntValue("DIMS");
if (DIMS < 20)
......@@ -221,14 +220,6 @@ namespace OnlineStore.DeviceLibrary
}
else
{
//foreach(Box_Sta s in sta)
//{
// updateDi += s.ToString() + ",";
//}
//if (ip.Equals("192.168.201.61"))
//{
// LogUtil.info(updateDi);
//}
for (int i = 0; i < newList.Count; i++)
{
if (!(oldList[i].Equals(newList[i])))
......@@ -240,13 +231,15 @@ namespace OnlineStore.DeviceLibrary
}
if (needUpdate)
{
lock (DILock)
// lock (DILock)
{
if (DIValueMap.ContainsKey(ip))
{
DIValueMap.Remove(ip);
List<Box_Sta> s = new List<Box_Sta>();
DIValueMap.TryRemove(ip,out s);
}
DIValueMap.Add(ip, newList);
DIValueMap.TryAdd(ip, newList);
}
}
}
......@@ -261,12 +254,7 @@ namespace OnlineStore.DeviceLibrary
newList.AddRange(sta);
List<Box_Sta> oldList = null;
DOValueMap.TryGetValue(ip, out oldList);
//string result = "UpdateAllDO ip[" + ip + "], sta :";
//for (int i = 0; i < newList.Count; i++)
//{
// result += newList[i] + ",";
//}
//LogUtil.info(result);
if (oldList == null || oldList.Count.Equals(newList.Count).Equals(false))
{
needUpdate = true;
......@@ -284,27 +272,17 @@ namespace OnlineStore.DeviceLibrary
}
if (needUpdate)
{
lock (DOLock)
// lock (DOLock)
{
if (DOValueMap.ContainsKey(ip))
{
DOValueMap.Remove(ip);
List<Box_Sta> list = new List<Box_Sta>();
DOValueMap.TryRemove(ip,out list);
}
DOValueMap.Add(ip, newList);
DOValueMap.TryAdd(ip, newList);
}
}
}
//else
//{
// if (sta == null)
// {
// LogUtil.error("UpdateAllDO ip[" + ip + "], sta=null");
// }
// else
// {
// LogUtil.error(" UpdateAllDO ip[" + ip + "], sta.Length=" + sta.Length);
// }
//}
}
......@@ -331,12 +309,19 @@ namespace OnlineStore.DeviceLibrary
public override void CloseAllConnection()
{
try
{
foreach (AIOBOX aio in AIOMap.Values)
{
aio.Close();
}
AIOMap.Clear();
}
catch (Exception ex)
{
LogUtil.error("CloseAllConnection 出错:" + ex.ToString());
}
}
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
{
try
......@@ -422,7 +407,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("ReadAllDI出错:" + ioIp);
LogUtil.error("ReadAllDI [" + ioIp + "] 出错:" + ex.ToString());
}
}
public override void ReadAllDO(string ioIp, byte slaveId)
......@@ -439,21 +424,20 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("ReadAllDO出错:" + ioIp);
LogUtil.error("ReadAllDO ["+ioIp+"] 出错:" + ex.ToString());
}
}
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
{
IO_VALUE value = IO_VALUE.LOW;
for (int i = 1; i <= 3; i++)
{
try
{
AIOBOX aioBox = getAIO(ioIP);
if (aioBox != null)
{
Box_Sta sta = Box_Sta.Off;
// Box_Addr addr = GetAddr(StartAddress);
// int index = (int)StartAddress - (int)StoreManager.Config.GetDILength(ioIP);
if (DOValueMap.ContainsKey(ioIP) && DOValueMap[ioIP].Count > StartAddress)
{
sta = DOValueMap[ioIP][StartAddress];
......@@ -464,11 +448,13 @@ namespace OnlineStore.DeviceLibrary
{
value = IO_VALUE.HIGH;
}
break;
}
}
catch (Exception ex)
{
LogUtil.error("GetDOValue 出错:" + ex.ToString());
LogUtil.error("GetDOValue [" + ioIP + "] [" + StartAddress + "] [" + i + "] 出错:" + ex.ToString());
}
}
return value;
}
......@@ -476,6 +462,8 @@ namespace OnlineStore.DeviceLibrary
public override IO_VALUE GetDIValue(string ioIP, byte slaveId, ushort StartAddress)
{
IO_VALUE value = IO_VALUE.LOW;
for (int i = 1; i <= 3; i++)
{
try
{
AIOBOX aioBox = getAIO(ioIP);
......@@ -496,11 +484,13 @@ namespace OnlineStore.DeviceLibrary
{
value = IO_VALUE.HIGH;
}
break;
}
}
catch (Exception ex)
{
LogUtil.error("GetDIValue 出错:" + ex.ToString());
LogUtil.error("GetDIValue [" + ioIP + "] ["+StartAddress+"] [" + i+"] 出错:" + ex.ToString());
}
}
return value;
}
......
......@@ -48,6 +48,7 @@ namespace OnlineStore.DeviceLibrary
//public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
private int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
public AC_SA_BoxBean(AC_SA_Config config)
{
// int value= CalHeight(37);
......@@ -58,7 +59,7 @@ namespace OnlineStore.DeviceLibrary
serverConnectTimer.Enabled = false;
serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200;
IoCheckTimer.Interval = 400;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
......@@ -113,6 +114,8 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
LogUtil.info(StoreName + " 初始化完成,OutStoreWaitSeconds=" + OutStoreWaitSeconds);
}
private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
......@@ -124,6 +127,12 @@ namespace OnlineStore.DeviceLibrary
{
if (isInSuddenDown.Equals(false))
{
LogUtil.error(StoreName + "收到急停信号,等待100后再次验证急停");
Task.Factory.StartNew(delegate
{
Thread.Sleep(100);
if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
// WarnMsg = StoreName + "收到急停信号,报警急停";
......@@ -131,6 +140,8 @@ namespace OnlineStore.DeviceLibrary
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", StoreMoveType.None);
}
});
}
}
else
{
......@@ -244,8 +255,6 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
ACAxisHomeMove(Config.InOut_Axis);
LogUtil.info(LOGGER, StoreName + "开始原点返回,先把进出轴回原点");
//设置速度
//SetShuokeSpeed();
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
public void MoveToP1()
......@@ -271,22 +280,18 @@ namespace OnlineStore.DeviceLibrary
{
CurrInOutCount = 0;
CurrInOutACount = 0;
ClearInoutFail();
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
//复位之前先停止运行
if (isNeedClearAuto)
{
autoNext = false;
}
ACServerManager.SuddenStop(Config.Middle_Axis.DeviceName, Config.Middle_Axis.GetAxisValue());
ACServerManager.SuddenStop(Config.UpDown_Axis.DeviceName, Config.UpDown_Axis.GetAxisValue());
ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
ACServerManager.SuddenStop(Config.Middle_Axis);
ACServerManager.SuddenStop(Config.UpDown_Axis);
ACServerManager.SuddenStop(Config.InOut_Axis);
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
isInSuddenDown = false;
isNoAirCheck = false;
alarmType = StoreAlarmType.None;
......@@ -294,27 +299,33 @@ namespace OnlineStore.DeviceLibrary
storeStatus = StoreStatus.ResetMove;
StoreMove.NewMove(StoreMoveType.StoreReset);
SetWarnMsg();
if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
LogUtil.info(LOGGER, StoreName + "复位失败,急停未开");
return;
}
if (IOManager.IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(LOGGER, StoreName + "复位失败,没有气压信号");
return;
}
if (!RunAxis(true))
////打开四个轴
//if (!OpenAllAxis())
{
LogUtil.info(LOGGER, StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位");
return;
}
mainTimer.Enabled = false;
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
InoutStartReset();
//硕科压紧轴回原点
//SetShuokeSpeed();
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else
{
LogUtil.info(LOGGER, StoreName + "开始复位:先定位气缸下降");
// 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
LocationDownAndWait();
}
mainTimer.Enabled = true;
isInPro = false;
}
private void InoutStartReset()
......@@ -323,9 +334,9 @@ namespace OnlineStore.DeviceLibrary
int slvAddr = Config.InOut_Axis.GetAxisValue();
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回");
ACAxisHomeMove(Config.InOut_Axis);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
/// <summary>
/// 复位处理
......@@ -343,39 +354,32 @@ namespace OnlineStore.DeviceLibrary
switch (StoreMove.MoveStep)
{
case StoreMoveStep.BOX_H_LocationCylinderBack:
//StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
//ACAxisHomeMove(Config.InOut_Axis);
//LogUtil.info(LOGGER, StoreName + "复位中:进出轴回原点。。");
//StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
InoutStartReset();
break;
case StoreMoveStep.BOX_H_InOutMove:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
ACAxisHomeMove(Config.InOut_Axis);
LogUtil.info(LOGGER, StoreName + "复位中:进出轴开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
break;
//case StoreMoveStep.BOX_H_InOutMove:
// InoutStartReset();
// break;
case StoreMoveStep.BOX_H_InOutBack:
Thread.Sleep(200);
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1);
LogUtil.info(LOGGER, StoreName + "复位中:进出轴到待机点P1,关闭舱门");
LogUtil.info(LOGGER, StoreName + "复位中:进出轴到待机点P1,关闭仓门");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear(Config.InOut_Axis);
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
// ComBeforeHomeMove();
//判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
CloseDoorAndWait();
break;
case StoreMoveStep.BOX_H_InOutToP1:
//如果此时轴三还在报警,需要提示错误并等待
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
{
LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!");
LogUtil.error(LOGGER,StoreName+ "复位[" + StoreMove.MoveStep+"]过程中,进出轴报警!复位失败,请检查!");
return;
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil.info(LOGGER, StoreName + "复位中: 压紧轴,旋转轴,上下轴开始 原点返回");
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (IsHasCompress_Axis)
{
ACAxisHomeMove(Config.Comp_Axis);
......@@ -386,6 +390,7 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
......@@ -404,17 +409,18 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_M_H_TOP1_InOutToP1:
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_CompressHome);
LogUtil.info(LOGGER, StoreName + "到待机状态,压紧轴回原点,关闭门");
LogUtil.info(LOGGER, StoreName + "到待机状态,压紧轴回原点,关闭门");
if (IsHasCompress_Axis)
{
ACAxisHomeMove(Config.Comp_Axis);
}
//关闭
//关闭
CloseDoorAndWait();
break;
case StoreMoveStep.BOX_M_H_TOP1_CompressHome:
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1);
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position,Config.CompAxis_P1_Speed);
......@@ -450,6 +456,15 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
private bool DoorIsOpen()
{
if (IOManager.IOValue(IO_Type.Door_Down).Equals(IO_VALUE.LOW) &&
IOManager.IOValue(IO_Type.Door_Up).Equals(IO_VALUE.HIGH))
{
return true;
}
return false;
}
private void OpenDoorAndWait()
{
Thread.Sleep(60);
......@@ -829,7 +844,7 @@ namespace OnlineStore.DeviceLibrary
}
bool isNeedAlarmLed = false;
//报警灯
if (!alarmType.Equals(StoreAlarmType.None) || isTemp30M|| InStoreFail)
if (!alarmType.Equals(StoreAlarmType.None) || isTemp30M || InStoreFail)
{
isNeedAlarmLed = true;
}
......@@ -857,14 +872,20 @@ namespace OnlineStore.DeviceLibrary
{
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
}
if (UseBuzzer && IOManager.IOValue(IO_Type.Alarm_Buzzer).Equals(IO_VALUE.LOW))
//if (UseBuzzer && IOManager.IOValue(IO_Type.Alarm_Buzzer).Equals(IO_VALUE.LOW))
//{
// IOManager.IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH);
//}
//return;
}
if (UseBuzzer && isNeedAlarmLed)
{
if (IOManager.IOValue(IO_Type.Alarm_Buzzer).Equals(IO_VALUE.LOW))
{
IOManager.IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH);
}
return;
}
if (!UseBuzzer)
else if (IOManager.IOValue(IO_Type.Alarm_Buzzer).Equals(IO_VALUE.HIGH))
{
IOManager.IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
}
......@@ -900,6 +921,45 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
}
}
//仓门打开,打开照明
if (Config.StoreDOList.ContainsKey(IO_Type.Device_Led))
{
bool doorIsOpen = false;
if (IOManager.IOValue(IO_Type.Door_Limit).Equals(IO_VALUE.LOW))
{
doorIsOpen = true;
}
else if (Config.StoreDIList.ContainsKey(IO_Type.Door_LeftLimit) && IOManager.IOValue(IO_Type.Door_LeftLimit).Equals(IO_VALUE.LOW))
{
doorIsOpen = true;
}
else if (Config.StoreDIList.ContainsKey(IO_Type.Door_RightLimit) && IOManager.IOValue(IO_Type.Door_RightLimit).Equals(IO_VALUE.LOW))
{
doorIsOpen = true;
}
else if (!doorIsOpen)
{
doorIsOpen = true;
}
if (doorIsOpen)
{
if (IOManager.IOValue(IO_Type.Device_Led).Equals(IO_VALUE.LOW))
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
}
}
else
{
if (IOManager.IOValue(IO_Type.Device_Led).Equals(IO_VALUE.HIGH))
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.LOW);
}
}
}
}
catch (Exception ex)
{
......@@ -1060,15 +1120,16 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.MoveType.Equals(StoreMoveType.None) && alarmType.Equals(StoreAlarmType.None))
{
IO_VALUE checkIO = IOManager.IOValue(IO_Type.TrayCheck_Door);
IO_VALUE safeIO = IOManager.IOValue(IO_Type.SafetyLightCurtains);
int height = GetHeight();
//判断料门口是否有料
if ((checkIO.Equals(IO_VALUE.HIGH)) && height > 0 )
if ((checkIO.Equals(IO_VALUE.HIGH)) && height > 0 && safeIO.Equals(IO_VALUE.HIGH))
{
if (!CanStartCode() || IsDebug || InStoreFail || IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
return;
}
//检测到料盘,等待1.5秒后扫码
//检测到料盘,等待1秒后扫码
if (isWaitScan)
{
TimeSpan span = DateTime.Now - StartWaitScanTime;
......@@ -1077,7 +1138,7 @@ namespace OnlineStore.DeviceLibrary
isWaitScan = false;
IsScanCode = true;
CurrScanCount++;
LogUtil.info(StoreName + "[" + CurrScanCount + "]检测到" + height + "料盘,开始扫码");
LogUtil.info(StoreName + "[" + CurrScanCount + "]检测到" + height + "mm料盘,开始扫码");
// GetCameraCode();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now;
......@@ -1322,7 +1383,10 @@ namespace OnlineStore.DeviceLibrary
if (isInSuddenDown || isNoAirCheck ||
(!storeRunStatus.Equals(StoreRunStatus.Runing))
|| storeStatus.Equals(StoreStatus.InStoreExecute) || storeStatus.Equals(StoreStatus.OutStoreExecute)
|| storeStatus.Equals(StoreStatus.InStoreEnd) || storeStatus.Equals(StoreStatus.OutStoreBoxEnd))
|| storeStatus.Equals(StoreStatus.InStoreEnd)
|| storeStatus.Equals(StoreStatus.OutStoreBoxEnd)
|| storeStatus.Equals(StoreStatus.OutStorEnd)
)
{
return false;
}
......@@ -1361,7 +1425,8 @@ namespace OnlineStore.DeviceLibrary
//发送扫码内容到服务器进行入库操作
Operation operationT = getLineBoxStatus();
operationT.op = 1;
operationT.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
int dInfo = (int)IOManager.IOValue(IO_Type.TrayCheck_Door);
operationT.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() }, { ParamDefine.doorReelSignal, dInfo.ToString() } };
HttpHelper.Post(StoreManager.GetPostApi(server), operationT, false);
}
else
......@@ -1384,7 +1449,8 @@ namespace OnlineStore.DeviceLibrary
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
int doorReelSignal = (int)IOManager.IOValue(IO_Type.TrayCheck_Door);
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() }, { ParamDefine.doorReelSignal, doorReelSignal.ToString() } };
// string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
......@@ -1482,6 +1548,7 @@ namespace OnlineStore.DeviceLibrary
}
private void ClearInoutFail()
{
CodeMsg = "";
CurrScanCount = 0;
InStoreFail = false;
IsScanCode = false;
......@@ -1825,7 +1892,7 @@ namespace OnlineStore.DeviceLibrary
lineOperation.status = 1;
if (WarnObj.WarnMsg != "")
{
lineOperation.status = (int)StoreStatus.Warning;
//lineOperation.status = (int)StoreStatus.Warning;
lineOperation.msg = WarnObj.WarnMsg;
lineOperation.msgEn = WarnObj.WarnMsgEn;
}
......@@ -1835,6 +1902,15 @@ namespace OnlineStore.DeviceLibrary
}
lineOperation.status = (int)StoreStatus.StoreOnline;
//判断如果是等待料盘拿走超时,状态改为4Warning
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut) && StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_15_WaitTake) || StoreMove.MoveStep.Equals(StoreMoveStep.SO_16_CheckIsTake))
{
lineOperation.status = (int)StoreStatus.Warning;
}
}
BoxStatus boxStatus = new BoxStatus();
boxStatus.boxId = StoreID;
......@@ -1850,15 +1926,16 @@ namespace OnlineStore.DeviceLibrary
lineOperation.msg = WarnObj.WarnMsg;
lineOperation.msgEn = WarnObj.WarnMsgEn;
if (WarnObj.WarnMsg.Equals(""))
{
boxStatus.msg = CodeMsg;
boxStatus.msgEn = CodeMsgEn;
//if (WarnObj.WarnMsg.Equals(""))
//{
// boxStatus.msg = CodeMsg;
// boxStatus.msgEn = CodeMsgEn;
// // lineOperation.msg = CodeMsg;
// lineOperation.msg = CodeMsg;
lineOperation.msg = CodeMsg;
lineOperation.msgEn = CodeMsgEn;
}
if (CodeMsg.Equals(""))
// lineOperation.msgEn = CodeMsgEn;
//}
//if (CodeMsg.Equals(""))
if(WarnObj.WarnMsg.Equals(""))
{
if (storeRunStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
......@@ -1868,6 +1945,11 @@ namespace OnlineStore.DeviceLibrary
lineOperation.msgEn = ResourceControl.GetEnglishString("叉子料盘检测有料,请检查");
}
}
//else
//{
// //如果是扫码入库失败,也发4
// lineOperation.status = (int)StoreStatus.Warning;
//}
CodeMsg = "";
//SetWarnMsg();
//状态
......@@ -1876,7 +1958,8 @@ namespace OnlineStore.DeviceLibrary
{
boxStatus.status = (int)StoreStatus.Debugging;
}
else if (storeStatus.Equals(StoreStatus.OutStoreBoxEnd) || storeStatus.Equals(StoreStatus.InStoreEnd))
else if (storeStatus.Equals(StoreStatus.OutStoreBoxEnd) || storeStatus.Equals(StoreStatus.InStoreEnd)
|| storeStatus.Equals(StoreStatus.OutStorEnd))
{
boxStatus.data.Add(ParamDefine.posId, lastPosId);
}
......@@ -1891,6 +1974,14 @@ namespace OnlineStore.DeviceLibrary
lastPosId = "";
}
if (boxStatus.status.Equals((int)StoreStatus.StoreOnline))
{
if (InStoreFail)
{
boxStatus.status = (int)StoreStatus.InStoreError;
}
}
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.Temperate_Serveraddress);
ASTemperateParam param = HumitureController.LastData;
......@@ -1905,11 +1996,8 @@ namespace OnlineStore.DeviceLibrary
{
lineOperation.alarmList.Add(alarmInfo);
}
if (lineOperation.data == null)
{
lineOperation.data = new Dictionary<string, string>();
}
lineOperation.data.Add(IO_Type.TrayCheck_Door, IOManager.IOValue(IO_Type.TrayCheck_Door).ToString());
int doorReelSignal = (int)IOManager.IOValue(IO_Type.TrayCheck_Door);
lineOperation.data = new Dictionary<string, string> { { ParamDefine.doorReelSignal, doorReelSignal.ToString() } };
return lineOperation;
}
......@@ -1950,7 +2038,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("收到服务器命令:op=" + resultOperation.op + ",未找到对应处理");
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 100)
if (span.TotalMilliseconds > 200)
{
LogUtil.info(StoreName + "TimerProcess[" + span.TotalMilliseconds + "]");
}
......@@ -2039,9 +2127,9 @@ namespace OnlineStore.DeviceLibrary
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
if (span.TotalMilliseconds > 100)
{
LogUtil.info(StoreName + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
LogUtil.info(StoreName + "执行 ReviceOutStoreProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
}
}
}
......
......@@ -27,6 +27,7 @@ namespace OnlineStore.DeviceLibrary
public int autoPositionIndex = 0;
public string autoMsg = "";
public int AutoStartIndex = -1;
public bool IsInOutStoreAuto = false; //是否开启自动出入库
#endregion
#region 出入库参数
......@@ -155,6 +156,36 @@ namespace OnlineStore.DeviceLibrary
{
timeOutMs = 650000;
}
//如果是门开关信号,增加重写功能
if (!wait.IsEnd && span.TotalSeconds < StoreMove.TimeOutSeconds)
{
if (((wait.IoType.Equals(IO_Type.Door_Down) && wait.IoValue.Equals(IO_VALUE.HIGH))) ||
((wait.IoType.Equals(IO_Type.Door_Up) && wait.IoValue.Equals(IO_VALUE.LOW))))
{
//关门
if ((!IOManager.DOValue(IO_Type.Door_Down).Equals(IO_VALUE.HIGH)) ||
(!IOManager.DOValue(IO_Type.Door_Up).Equals(IO_VALUE.LOW)))
{
LogUtil.error("等待[" + NotOkMsg + "],重写关门指令( Door_Down = HIGH ,Door_Up=LOW )");
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
}
else if (((wait.IoType.Equals(IO_Type.Door_Down) && wait.IoValue.Equals(IO_VALUE.LOW))) ||
((wait.IoType.Equals(IO_Type.Door_Up) && wait.IoValue.Equals(IO_VALUE.HIGH))))
{
//开门
if ((!IOManager.DOValue(IO_Type.Door_Down).Equals(IO_VALUE.LOW)) ||
(!IOManager.DOValue(IO_Type.Door_Up).Equals(IO_VALUE.HIGH)))
{
LogUtil.error("等待[" + NotOkMsg + "],重写开门指令( Door_Down = LOW ,Door_Up=HIGH )");
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.HIGH);
}
}
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -177,7 +208,8 @@ namespace OnlineStore.DeviceLibrary
//wait.IsEnd = ShuoKeIsEnd(wait, out msg);
// NotOkMsg = NotOkMsg +" "+ msg;
wait.IsEnd = false;
}else if (wait.WaitType == 6)
}
else if (wait.WaitType == 6)
{
IO_VALUE value = (IO_VALUE)ACServerManager.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
wait.IsEnd = wait.IoValue.Equals(value);
......@@ -185,6 +217,18 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == 7)
{
wait.IsEnd = (wait.HeightValue.Equals(GetHeight()));
if (wait.IsEnd && (StoreMove.MoveStep == StoreMoveStep.SO_15_WaitTake) && wait.HeightValue.Equals(0))
{
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
LogUtil.info(StoreMove.MoveStep + " 等待height=" + wait.HeightValue + "完成,且当前TrayCheck_Door=LOW");
}
else
{
LogUtil.info(StoreMove.MoveStep + " 等待height=" + wait.HeightValue + "完成,但当前TrayCheck_Door=High,继续等待门口无料盘信号");
wait.IsEnd = false;
}
}
if (wait.IsEnd)
{
LogUtil.debug("等待height=" + wait.HeightValue + "完成");
......@@ -200,7 +244,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (!StoreMove.OneWaitCanEndStep )
if (!StoreMove.OneWaitCanEndStep)
{
isOk = false;
break;
......@@ -215,8 +259,8 @@ namespace OnlineStore.DeviceLibrary
{
// WarnMsg = StoreName + "【" + StoreMove.MoveType + "】【" + StoreMove.MoveStep + "】等待超时 [" + NotOkMsg
// + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
SetWarnMsg(ResourceControl.MoveTimeOut, StoreMove.MoveStep + "", NotOkMsg, Math.Round(span.TotalSeconds, 1)+"");
LogUtil.error(LOGGER, WarnObj.WarnMsg,100);
SetWarnMsg(ResourceControl.MoveTimeOut, StoreMove.MoveStep + "", NotOkMsg, Math.Round(span.TotalSeconds, 1) + "");
LogUtil.error(LOGGER, WarnObj.WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", StoreMove.MoveType);
}
}
......@@ -261,7 +305,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
SI_02_Move(param.MoveP);
SI_02_OpenDoor(param.MoveP);
}
else
{
......@@ -284,10 +328,11 @@ namespace OnlineStore.DeviceLibrary
{
StartInStoreMove(param, false);
}
private void SI_02_Move(LineMoveP moveP)
private void SI_02_OpenDoor(LineMoveP moveP)
{
InStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1,打开舱门");
StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
InStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1, 打开仓门");
StoreMove.NextMoveStep(StoreMoveStep.SI_02_OpenDoor);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(200));
OpenDoorAndWait();
InOutBackToP1(moveP.InOut_P1);
}
......@@ -317,7 +362,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
SI_02_Move(moveP);
SI_02_OpenDoor(moveP);
}
else
{
......@@ -328,31 +373,30 @@ namespace OnlineStore.DeviceLibrary
}
if (StoreMove.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
{
SI_02_Move(moveP);
SI_02_OpenDoor(moveP);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
else if (StoreMove.MoveStep == StoreMoveStep.SI_02_OpenDoor)
{
if (DoorIsOpen())
{
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
else
{
SI_02_OpenDoor(moveP);
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_03_ReturnHome)
{
if (IsHasCompress_Axis)
{
InStoreLog("入库:SI_04_CompressWare 压紧物品(有压紧轴的才需要此步骤),压紧轴至P3(压紧前点) 开始");
StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
//ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
//StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed); }
else
{
SI_05_DeviceToDoor();
......@@ -360,9 +404,6 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_04_CompressWare)
{
//InStoreLog("入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) ");
//StoreMove.NextMoveStep(StoreMoveStep.SI_05_DeviceToDoor);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
SI_05_DeviceToDoor();
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_05_DeviceToDoor)
......@@ -371,12 +412,6 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
// System.Threading.Thread.Sleep(600);
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
}
......@@ -389,22 +424,29 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
{
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
if (Config.IsUse_Tray_Check.Equals(1))
{
InStoreLog("入库:SI_08 检测叉子料盘检测信号 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_08_CheckTray);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.HIGH));
}
else
//if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
InStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点),升降轴至P3(库位入库前点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
//关闭
//关闭
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
else
{
InStoreLog("入库:SI_08 检测叉子料盘检测信号 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_08_CheckTray);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.HIGH));
}
//else
//{
// InStoreLog("入库:SI_08 检测叉子料盘检测信号 ");
// StoreMove.NextMoveStep(StoreMoveStep.SI_08_CheckTray);
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.HIGH));
//}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_08_CheckTray)
{
......@@ -412,7 +454,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
//关闭
//关闭
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
......@@ -466,7 +508,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{
InStoreLog("入库:SI_15 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
InStoreLog("入库:SI_15 返回待机点,轴2/轴1/轴4动作至P1(待机点)),关闭仓门");
StoreMove.NextMoveStep(StoreMoveStep.SI_15_GoBack);
ComMoveToPosition(moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
......@@ -482,7 +524,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_14_CheckTray)
{
InStoreLog("入库:SI_15 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
InStoreLog("入库:SI_15 返回待机点,轴2/轴1/轴4动作至P1(待机点)),关闭仓门");
StoreMove.NextMoveStep(StoreMoveStep.SI_15_GoBack);
ComMoveToPosition(moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
......@@ -525,12 +567,12 @@ namespace OnlineStore.DeviceLibrary
if (!LoadParamPosition(param))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,找不到库位信息");
return false ;
return false;
}
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,叉子料盘检测有料");
return false ;
return false;
}
storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ", storeMoveColor);
......@@ -539,11 +581,8 @@ namespace OnlineStore.DeviceLibrary
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
StoreMove.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
OutStoreLog("出库:SO_02 叉子先运动到P1 ,打开舱门 开始");
//ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed);
OutStoreLog("出库:SO_02 叉子先运动到P1 开始");
InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
//OpenDoorAndWait();
}
else
{
......@@ -585,11 +624,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
//}
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
}
......@@ -622,36 +657,25 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_06_BagDeviceBack)
{
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
//if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
if(Config.IsUse_Tray_Check.Equals(1))
{
StoreMove.NextMoveStep(StoreMoveStep.SO_07_CheckTray);
OutStoreLog("出库:SO_07 等待TrayCheck_Fixture=High ");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.HIGH));
//string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
//CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料盘有料";
//CodeMsgEn = ResourceControl.GetEnglishString("出库{0}叉子从库位退出后,未检测到料盘有料", posId);
//LogUtil.error(CodeMsg);
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
OutStoreLog("出库:SO_08 走到料门口,旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门 ");
OutStoreLog("出库:SO_08 走到料门口,旋转轴至P1(待机点)升降轴至P2(进料口出料前点), ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//打开舱门
//OpenDoorAndWait();
}
//else
//{
// StoreMove.NextMoveStep(StoreMoveStep.SO_07_LocationCylinder_Up);
// OutStoreLog("出库:SO_07 定位气缸伸出 ");
// LocationUpAndWait();
//}
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_07_CheckTray)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
OutStoreLog("出库:SO_08 走到料门口,旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门 ");
OutStoreLog("出库:SO_08 走到料门口,旋转轴至P1(待机点)升降轴至P2(进料口出料前点), ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
......@@ -659,12 +683,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
//SO_10_DeviceToDoorPro();
StoreMove.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
OpenDoorAndWait();
SO_091_WaitNoTray();
}
else
{
......@@ -676,28 +695,27 @@ namespace OnlineStore.DeviceLibrary
//此处需要等待移栽没有工作,才能把盘放入出料口
else if (StoreMove.MoveStep == StoreMoveStep.SO_09_LocationCylinder_Down)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
OutStoreLog("出库:SO_091 打开仓门,等待门口无料盘 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
OpenDoorAndWait();
SO_091_WaitNoTray();
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_091_WaitNoTray)
{
if (DoorIsOpen())
{
SO_10_DeviceToDoorPro();
}
else
{
SO_091_WaitNoTray();
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_10_DeviceToDoor)
{
OutStoreLog("出库:SO_11 放下物品,升降轴至P8(进料口出料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_11_DevicePutWare);
NeedCheckSafetyLight = 0;
ComMoveToPosition(moveP.ComPress_P1, Config.CompAxis_P1_Speed);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_11_DevicePutWare)
......@@ -726,29 +744,52 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_14_GoBack)
{
int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
if (OutStoreWaitSeconds <= 0)
StoreMove.NextMoveStep(StoreMoveStep.SO_15_WaitTake);
if (!IsInOutStoreAuto)
{
if (OutStoreWaitSeconds > 0)
{
OutStoreWaitSeconds = 600;
}
int ms = OutStoreWaitSeconds * 1000;
StoreMove.NextMoveStep(StoreMoveStep.SO_15_WaitTake);
OutStoreLog("出库:SO_14_WaitTake 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
OutStoreLog("出库:SO_15_WaitTake 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(ms));
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
StoreMove.OneWaitCanEndStep = true;
}
else
{
OutStoreLog("出库:SO_15_WaitTake 等待拿走物品 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
}
}
else
{
OutStoreLog("出库:SO_15_WaitTake 自动出入库中,等待3秒后继续");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(3000));
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_15_WaitTake)
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
//如果配置是0,再次验证是否拿走物品
if (OutStoreWaitSeconds <= 0)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_16_CheckIsTake);
OutStoreLog("出库:SO_16_CheckIsTake 再次等待物品是否已拿走 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(200));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
//需要等待光栅断开一次
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SafetyLightCurtains,IO_VALUE.LOW));
}
else
{
OutStoreEnd();
}
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】出库结束[" + FormUtil.GetSpanStr(span) + "]", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
}else if (StoreMove.MoveStep == StoreMoveStep.SO_16_CheckIsTake)
{
OutStoreEnd();
}
else
{
......@@ -756,11 +797,28 @@ namespace OnlineStore.DeviceLibrary
}
}
private void SO_091_WaitNoTray()
{
StoreMove.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
OutStoreLog("出库:SO_091 打开仓门,等待门口无料盘 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
OpenDoorAndWait();
}
private void OutStoreEnd()
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】出库结束[" + FormUtil.GetSpanStr(span) + "]", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
}
private void SO_14_GoBack()
{
StoreMove.NextMoveStep(StoreMoveStep.SO_14_GoBack);
OutStoreLog("出库:SO_13 升降轴返回,轴2至P1(待机点) ,关闭舱门,更改状态为出库完成");
OutStoreLog("出库:SO_14 升降轴返回,轴2至P1(待机点) ,关闭仓门,更改状态为出库完成");
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoorAndWait();
......@@ -770,7 +828,6 @@ namespace OnlineStore.DeviceLibrary
lastPosIdStatus = StoreStatus.OutStorEnd;
storeStatus = StoreStatus.OutStorEnd;
}
private void SO_10_DeviceToDoorPro()
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
......@@ -831,6 +888,7 @@ namespace OnlineStore.DeviceLibrary
waitOutStoreList.Add(code);
}
}
private void InOutEndProcess(StoreMoveType storeMoveType)
{
try
......@@ -887,7 +945,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!");
}
}
if(autoNext)
if (autoNext)
{
autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex];
......@@ -920,7 +978,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, ex.ToString());
}
}
private void InStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
......@@ -931,5 +988,45 @@ namespace OnlineStore.DeviceLibrary
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
}
public bool NeedShowBtn()
{
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_07_CheckTray))
{
return true;
}
else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_08_CheckTray))
{
return true;
}
}
return false;
}
public bool BtnNextPro()
{
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_07_CheckTray))
{
StoreMove.NextMoveStep(StoreMoveStep.SO_07_CheckTray);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(100));
InStoreLog("出库:SO_07 等待TrayCheck_Fixture=High,BtnNextPro 忽略夹爪检测信号 ");
return true;
}
else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_08_CheckTray))
{
StoreMove.NextMoveStep(StoreMoveStep.SI_08_CheckTray);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(100));
InStoreLog("入库:SI_08 检测叉子料盘检测信号,BtnNextPro 忽略夹爪检测信号 ");
return true;
}
}
return false;
}
}
}
......@@ -68,7 +68,10 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if (scannerSocket != null)
{
scannerSocket.close();
}
isScannerRun = false;
}
catch (Exception ex)
......
......@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
OutStoreExecute = 9,
/// <summary>
///10= 出仓位完成( 料盘已经放到Box门口)
///10= 出仓位完成 ,从仓位中拿走
/// </summary>
OutStoreBoxEnd = 10,
/// <summary>
......@@ -104,6 +104,10 @@ namespace OnlineStore.DeviceLibrary
/// 重置中(原点返回和重置都发此状态)
/// </summary>
ResetMove=13,
/// <summary>
/// 扫码入库失败
/// </summary>
InStoreError=14,
}
/// <summary>
......@@ -121,10 +125,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
BOX_H_LocationCylinderBack=010,
/// <summary>
/// 料仓原点返回和重置步骤,轴三先相对走3000
/// </summary>
BOX_H_InOutMove=011,
///// <summary>
///// 料仓原点返回和重置步骤,等待开始原点返回
///// </summary>
//BOX_H_InOutMove=011,
/// <summary>
/// 料仓原点返回和重置步骤,,轴三进出轴先返回原点
/// </summary>
......@@ -249,6 +253,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
SO_15_WaitTake=115,
/// <summary>
/// 料仓出库。。。等待200毫秒再次验证料盘是否拿走
/// </summary>
SO_16_CheckIsTake=116,
#endregion
#region 料仓内部入库步骤
......@@ -263,7 +272,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 入库。。进出轴(叉子)先返回P1
/// </summary>
SI_02_InOutAxisHome = 202,
SI_02_OpenDoor = 202,
/// <summary>
/// 入库。。所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3
/// </summary>
......
......@@ -253,6 +253,16 @@ namespace OnlineStore.LoadCSVLibrary
{
}
}
public string DisplayName
{
get
{
return ElectricalDefinition + "_" + CSVResourceControl.GetString(ElectricalDefinition, Explain);
}
set
{
}
}
public override int GetValue()
{
return GetIOValue();
......
......@@ -560,6 +560,12 @@ namespace OnlineStore.LoadCSVLibrary
/// /// </summary>
[ConfigProAttribute("AI_ConvertPosition")]
public int AI_ConvertPosition { get; set; }
/// <summary>
/// PRO,大盘宽度(13寸或15寸),Big_TrayWidth,15,,,,,,,
/// /// </summary>
[ConfigProAttribute("Big_TrayWidth",false)]
public int Big_TrayWidth { get; set; }
private Dictionary<string, string> CodeSizeMap =null ;
private static char codeSpilt= '#';
......
......@@ -113,6 +113,10 @@ namespace OnlineStore.LoadCSVLibrary
/// DO 相机照明开 Camera_Led Y10
/// </summary>
public static string Camera_Led = "Camera_Led";
/// <summary>
/// DO 设备照明开 Device_Led Y11
/// </summary>
public static string Device_Led = "Device_Led";
}
public enum IO_VALUE
{
......
......@@ -45,6 +45,7 @@
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 0;
this.label1.Text = "测试一下";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// pictureBox1
//
......@@ -57,6 +58,7 @@
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick);
//
// pictureBox2
//
......@@ -69,6 +71,7 @@
this.pictureBox2.TabIndex = 2;
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
this.pictureBox2.DoubleClick += new System.EventHandler(this.pictureBox2_DoubleClick);
//
// IOTextControl
//
......
......@@ -21,7 +21,7 @@ namespace UserFromControl
public IOTextControl()
{
InitializeComponent();
if (ImageManager.IsInit==false)
if (ImageManager.IsInit == false)
{
ImageManager.Init();
}
......@@ -31,7 +31,26 @@ namespace UserFromControl
pictureBox2.Visible = false;
isCanClick = false;
}
public IOTextControl(string ioName, string name, int widht = 220, int height = 25, int ioValue = -1, bool canClick = false, int tabIndex = 0)
{
InitializeComponent();
if (ImageManager.IsInit == false)
{
ImageManager.Init();
}
this.pictureBox1.BackgroundImage = ImageManager.imgGrey;
this.pictureBox2.BackgroundImage = ImageManager.imgGreen;
pictureBox1.Visible = true;
pictureBox2.Visible = false;
isCanClick = false;
IOName = ioName;
IOValue = IOValue;
isCanClick = canClick;
Name = "IO_" + name;
Size = new System.Drawing.Size(widht, height);
TabIndex = tabIndex;
}
public void ShowData()
{
label1.Text = IOName;
......@@ -41,11 +60,17 @@ namespace UserFromControl
pictureBox1.Visible = true;
pictureBox2.Visible = false;
}
else
else if (IOValue == 1)
{
pictureBox1.Visible = false;
pictureBox2.Visible = true;
}
else
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
}
}
private void IOStatusControl_Load(object sender, EventArgs e)
......@@ -55,20 +80,36 @@ namespace UserFromControl
private void pictureBox2_Click(object sender, EventArgs e)
{
if (isCanClick)
this.OnClick(e);
}
private void pictureBox1_Click(object sender, EventArgs e)
{
pictureBox2.Visible = true;
pictureBox1.Visible = false;
this.OnClick(e);
}
private void label1_DoubleClick(object sender, EventArgs e)
{
this.OnDoubleClick(e);
}
private void pictureBox1_Click(object sender, EventArgs e)
private void pictureBox2_DoubleClick(object sender, EventArgs e)
{
if (isCanClick)
this.OnDoubleClick(e);
}
private void pictureBox1_DoubleClick(object sender, EventArgs e)
{
pictureBox2.Visible = false;
pictureBox1.Visible = true;
this.OnDoubleClick(e);
}
private void label1_Click(object sender, EventArgs e)
{
this.OnClick(e);
}
}
}
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!