Commit a215ee24 几米阳光

原来的出入库增加批量操作的判定

1 个父辈 6522a61a
......@@ -6,7 +6,7 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="料仓_自动上下料" />
<add key="App_Title" value="料仓_批量上下料" />
<add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" />
......
......@@ -33,7 +33,7 @@ namespace OnlineStore.AutoInOutStore
updown = boxBean.Config.UpDown_Axis;
compress_Slv = boxBean.Config.CompressAxis_Slv;
inout = boxBean.Config.InOut_Axis;
auto = boxBean.Config.Auto_Axis;
auto = boxBean.Config.Batch_Axis;
InitializeComponent();
txtComSpeed.Text = boxBean.Config.CompressAxis_EndSpeed.ToString();
this.Text = boxBean.StoreName + "_轴点动调试";
......
......@@ -299,14 +299,14 @@ namespace OnlineStore.AutoInOutStore
private void btnDOpen_Click(object sender, EventArgs e)
{
KND.IOMove(IO_Type.AutoDoor_Close, IO_VALUE.LOW);
KND.IOMove(IO_Type.AutoDoor_Open, IO_VALUE.HIGH);
KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.LOW);
KND.IOMove(IO_Type.BatchDoor_Open, IO_VALUE.HIGH);
}
private void btnDClose_Click(object sender, EventArgs e)
{
KND.IOMove(IO_Type.AutoDoor_Open, IO_VALUE.LOW);
KND.IOMove(IO_Type.AutoDoor_Close, IO_VALUE.HIGH);
KND.IOMove(IO_Type.BatchDoor_Open, IO_VALUE.LOW);
KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.HIGH);
}
private void btnSXi_Click(object sender, EventArgs e)
......
......@@ -200,11 +200,13 @@
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button6 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.btnBatchOutTest = new System.Windows.Forms.Button();
this.btnBatchOutEnd = new System.Windows.Forms.Button();
this.btnStartBatchInStore = new System.Windows.Forms.Button();
this.btnGetOutTray = new System.Windows.Forms.Button();
this.lblDoorStatus = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.btnBatchInStore = new System.Windows.Forms.Button();
this.lblBatchStatus = new System.Windows.Forms.Label();
this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
......@@ -1358,7 +1360,7 @@
this.btnInStore.Name = "btnInStore";
this.btnInStore.Size = new System.Drawing.Size(105, 38);
this.btnInStore.TabIndex = 102;
this.btnInStore.Text = "入库测试";
this.btnInStore.Text = "单个入库测试";
this.btnInStore.UseVisualStyleBackColor = true;
this.btnInStore.Click += new System.EventHandler(this.btnInStore_Click);
//
......@@ -1369,7 +1371,7 @@
this.btnOutStore.Name = "btnOutStore";
this.btnOutStore.Size = new System.Drawing.Size(105, 38);
this.btnOutStore.TabIndex = 101;
this.btnOutStore.Text = "出库测试";
this.btnOutStore.Text = "单个出库测试";
this.btnOutStore.UseVisualStyleBackColor = true;
this.btnOutStore.Click += new System.EventHandler(this.btnOutStore_Click);
//
......@@ -2244,69 +2246,97 @@
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button6);
this.groupBox6.Controls.Add(this.button5);
this.groupBox6.Controls.Add(this.button4);
this.groupBox6.Controls.Add(this.lblBatchStatus);
this.groupBox6.Controls.Add(this.btnBatchOutTest);
this.groupBox6.Controls.Add(this.btnBatchOutEnd);
this.groupBox6.Controls.Add(this.btnStartBatchInStore);
this.groupBox6.Controls.Add(this.btnGetOutTray);
this.groupBox6.Controls.Add(this.lblDoorStatus);
this.groupBox6.Controls.Add(this.button3);
this.groupBox6.Controls.Add(this.btnBatchInStore);
this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox6.Location = new System.Drawing.Point(7, 128);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(497, 209);
this.groupBox6.TabIndex = 302;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "自动上下料操作";
//
// button6
//
this.button6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button6.Location = new System.Drawing.Point(171, 112);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(105, 38);
this.button6.TabIndex = 227;
this.button6.Text = "关闭门锁";
this.button6.UseVisualStyleBackColor = true;
//
// button5
//
this.button5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button5.Location = new System.Drawing.Point(171, 68);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(105, 38);
this.button5.TabIndex = 226;
this.button5.Text = "批量入库开始";
this.button5.UseVisualStyleBackColor = true;
//
// button4
//
this.button4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button4.Location = new System.Drawing.Point(39, 112);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(105, 38);
this.button4.TabIndex = 225;
this.button4.Text = "打开门锁";
this.button4.UseVisualStyleBackColor = true;
this.groupBox6.Text = "批量上下料操作";
//
// btnBatchOutTest
//
this.btnBatchOutTest.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBatchOutTest.Location = new System.Drawing.Point(39, 156);
this.btnBatchOutTest.Name = "btnBatchOutTest";
this.btnBatchOutTest.Size = new System.Drawing.Size(237, 38);
this.btnBatchOutTest.TabIndex = 228;
this.btnBatchOutTest.Text = "对选中仓位进行批量出库测试";
this.btnBatchOutTest.UseVisualStyleBackColor = true;
this.btnBatchOutTest.Click += new System.EventHandler(this.btnBatchOutTest_Click);
//
// btnBatchOutEnd
//
this.btnBatchOutEnd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBatchOutEnd.Location = new System.Drawing.Point(171, 112);
this.btnBatchOutEnd.Name = "btnBatchOutEnd";
this.btnBatchOutEnd.Size = new System.Drawing.Size(105, 38);
this.btnBatchOutEnd.TabIndex = 227;
this.btnBatchOutEnd.Text = "取出完成";
this.btnBatchOutEnd.UseVisualStyleBackColor = true;
this.btnBatchOutEnd.Click += new System.EventHandler(this.btnBatchOutEnd_Click);
//
// btnStartBatchInStore
//
this.btnStartBatchInStore.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStartBatchInStore.Location = new System.Drawing.Point(39, 112);
this.btnStartBatchInStore.Name = "btnStartBatchInStore";
this.btnStartBatchInStore.Size = new System.Drawing.Size(105, 38);
this.btnStartBatchInStore.TabIndex = 226;
this.btnStartBatchInStore.Text = "批量入库开始";
this.btnStartBatchInStore.UseVisualStyleBackColor = true;
this.btnStartBatchInStore.Click += new System.EventHandler(this.btnStartBatchInStore_Click);
//
// btnGetOutTray
//
this.btnGetOutTray.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetOutTray.Location = new System.Drawing.Point(171, 68);
this.btnGetOutTray.Name = "btnGetOutTray";
this.btnGetOutTray.Size = new System.Drawing.Size(105, 38);
this.btnGetOutTray.TabIndex = 225;
this.btnGetOutTray.Text = "取出料盘";
this.btnGetOutTray.UseVisualStyleBackColor = true;
this.btnGetOutTray.Click += new System.EventHandler(this.btnGetOutTray_Click);
//
// lblDoorStatus
//
this.lblDoorStatus.AutoSize = true;
this.lblDoorStatus.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblDoorStatus.ForeColor = System.Drawing.Color.Green;
this.lblDoorStatus.Location = new System.Drawing.Point(35, 29);
this.lblDoorStatus.Location = new System.Drawing.Point(333, 76);
this.lblDoorStatus.Name = "lblDoorStatus";
this.lblDoorStatus.Size = new System.Drawing.Size(121, 20);
this.lblDoorStatus.TabIndex = 224;
this.lblDoorStatus.Text = "仓门状态:关闭中";
//
// button3
// btnBatchInStore
//
this.button3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(39, 68);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(105, 38);
this.button3.TabIndex = 103;
this.button3.Text = "批量入库";
this.button3.UseVisualStyleBackColor = true;
this.btnBatchInStore.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBatchInStore.Location = new System.Drawing.Point(39, 68);
this.btnBatchInStore.Name = "btnBatchInStore";
this.btnBatchInStore.Size = new System.Drawing.Size(105, 38);
this.btnBatchInStore.TabIndex = 103;
this.btnBatchInStore.Text = "批量入库";
this.btnBatchInStore.UseVisualStyleBackColor = true;
this.btnBatchInStore.Click += new System.EventHandler(this.btnBatchInStore_Click);
//
// lblBatchStatus
//
this.lblBatchStatus.AutoSize = true;
this.lblBatchStatus.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBatchStatus.ForeColor = System.Drawing.Color.Green;
this.lblBatchStatus.Location = new System.Drawing.Point(14, 31);
this.lblBatchStatus.Name = "lblBatchStatus";
this.lblBatchStatus.Size = new System.Drawing.Size(65, 20);
this.lblBatchStatus.TabIndex = 229;
this.lblBatchStatus.Text = "等待启动";
//
// FrmStoreBox
//
......@@ -2323,7 +2353,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "FrmStoreBox";
this.Text = "料仓_自动上下料";
this.Text = "料仓_批量上下料";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmTest_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmStoreBox_FormClosed);
......@@ -2531,10 +2561,12 @@
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label lblDoorStatus;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button btnBatchInStore;
private System.Windows.Forms.Button btnGetOutTray;
private System.Windows.Forms.Button btnStartBatchInStore;
private System.Windows.Forms.Button btnBatchOutEnd;
private System.Windows.Forms.Button btnBatchOutTest;
private System.Windows.Forms.Label lblBatchStatus;
}
}
......@@ -52,17 +52,16 @@ namespace OnlineStore.AutoInOutStore
cmbAxisList.ValueMember = "Explain";
cmbAxisList.SelectedIndex = 0;
AutoStorePosition ktkPosition = null;
AutoStorePosition Position = null;
if (store.PositionNumList.Count > 0)
{
cmbPosition.DataSource = store.PositionNumList;
cmbPosition.SelectedIndex = 0;
ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(cmbPosition.Text);
Position = CSVPositionReader<AutoStorePosition>.GetPositon(cmbPosition.Text);
//store.PositionNumList = positionNumList;
}
txtMiddleP1.Text = store.Config.MiddleAxis_P1_Position.ToString();
txtUpDownP1.Text = store.Config.UpDownAxis_DoorOPosition_P1.ToString();
txtInOutP1.Text = store.Config.InOutAxis_P1_Position.ToString();
txtComP1.Text = store.Config.CompressAxis_P1_Position.ToString();
......@@ -70,22 +69,23 @@ namespace OnlineStore.AutoInOutStore
txtUpDownP7.Text = store.Config.UpDownAxis_DoorOBPosition_P7.ToString();
txtUpDownP8.Text = store.Config.UpDownAxis_DoorIBPosition_P8.ToString();
//txtInOutP2.Text = store.Config.InOutAxis_DoorPosition_P2.ToString();
txtUpDownP1.Text = store.Config.UpDownAxis_DoorOPosition_P1.ToString();
if (ktkPosition != null)
{
txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = ktkPosition.UpDownAxis_OHPosition_P5.ToString();
txtUpDownP6.Text = ktkPosition.UpDownAxis_OLPosition_P6.ToString();
txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString();
txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString();
txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString();
txtUpDownP1.Text = store.Config.GetDefaultUpDownP1().ToString();
if (Position != null)
{
txtUpDownP1.Text = store.Config.GetUpDownP1(Position.BagHeight).ToString();
txtMiddleP2.Text = Position.MiddleAxis_Position_P2.ToString();
txtUpDownP3.Text = Position.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = Position.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = Position.UpDownAxis_OHPosition_P5.ToString();
txtUpDownP6.Text = Position.UpDownAxis_OLPosition_P6.ToString();
txtComP2.Text = Position.CompressAxis_Position_P2.ToString();
txtComP3.Text = Position.CompressAxis_CPosition_P3.ToString();
txtInOutP3.Text = Position.InOutAxis_Position_P3.ToString();
//txtUpDownP2.Text = ktkPosition.UpDownAxis_DoorIPosition_P2.ToString();
//txtUpDownP7.Text = ktkPosition.UpDownAxis_DoorOBPosition_P7.ToString();
//txtUpDownP8.Text = ktkPosition.UpDownAxis_DoorIBPosition_P8.ToString();
txtInOutP2.Text = ktkPosition.InOutAxis_DoorPosition_P2.ToString();
txtInOutP2.Text = Position.InOutAxis_DoorPosition_P2.ToString();
//txtUpDownP1.Text = ktkPosition.UpDownAxis_DoorOPosition_P1.ToString();
}
......@@ -148,6 +148,7 @@ namespace OnlineStore.AutoInOutStore
private bool LoadOk = false;
private void FrmTest_Load(object sender, EventArgs e)
{
timer1.Start();
LogUtil.logBox = this.richTextBox1;
initValue();
this.ShowInTaskbar = true;
......@@ -186,23 +187,30 @@ namespace OnlineStore.AutoInOutStore
}
}
}
lblBatchStatus.Text = store.GetRunStr(AutomaticBaiting.AutoBaitingStatus,false );
if (!AutomaticBaiting.WarnMsg.Equals(""))
{
lblBatchStatus.Text = AutomaticBaiting.WarnMsg;
}
//ReadPosistion();
if (store.storeRunStatus > StoreRunStatus.Wait)
{
if (AutomaticBaiting.AutoDoorSatus.Equals(1))
if (AutomaticBaiting.DoorStatus.Equals(2))
{
lblDoorStatus.Text = "仓门状态:关闭";
}else
UpdateFormDoorStats(false);
}
else
{
lblDoorStatus.Text = "仓门状态:打开";
UpdateFormDoorStats(true );
}
if (启动ToolStripMenuItem.Enabled.Equals(true))
{
StoreOpenStatus(true);
}
lblThisSta.Text = store.GetRunStr();
lblThisSta.Text = store.GetRunStr(store.storeRunStatus,true);
//复位按钮状态显示
if (复位ToolStripMenuItem.Enabled == false)
{
......@@ -283,6 +291,14 @@ namespace OnlineStore.AutoInOutStore
}
}
private void UpdateFormDoorStats(bool dooIsOpen)
{
btnBatchInStore.Enabled = !dooIsOpen;
btnGetOutTray.Enabled = !dooIsOpen;
btnStartBatchInStore.Enabled = dooIsOpen;
btnBatchOutEnd.Enabled = dooIsOpen;
}
private void ReadPosistion()
{
string portName = GetPortName();
......@@ -383,7 +399,7 @@ namespace OnlineStore.AutoInOutStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartOutStoreMove(new InOutStoreParam("", selectPositionNum, ktk));
store.StartOutStoreMove(new InOutStoreParam("", selectPositionNum, ktk),false);
}
else
{
......@@ -397,7 +413,7 @@ namespace OnlineStore.AutoInOutStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartInStoreMove(new InOutStoreParam("", selectPositionNum, ktk));
store.StartInStoreMove(new InOutStoreParam("", selectPositionNum, ktk),false);
}
else
{
......@@ -455,7 +471,7 @@ namespace OnlineStore.AutoInOutStore
txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString();
txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString();
txtInOutP2.Text = ktkPosition.InOutAxis_DoorPosition_P2.ToString();
txtUpDownP1.Text = store.Config.GetUpDownP1(ktkPosition.BagHeight).ToString();
//txtUpDownP2.Text = ktkPosition.UpDownAxis_DoorIPosition_P2.ToString();
//txtUpDownP7.Text = ktkPosition.UpDownAxis_DoorOBPosition_P7.ToString();
//txtUpDownP8.Text = ktkPosition.UpDownAxis_DoorIBPosition_P8.ToString();
......@@ -636,12 +652,14 @@ namespace OnlineStore.AutoInOutStore
store.Config.MiddleAxis_P1_Position = FormUtil.GetIntValue(txtMiddleP1);
needUpdate = true;
}
if (store.Config.UpDownAxis_DoorOPosition_P1 != FormUtil.GetIntValue(txtUpDownP1))
if (ktkPosition != null)
{
if (store.Config.GetUpDownP1(ktkPosition.BagHeight) != FormUtil.GetIntValue(txtUpDownP1))
{
store.Config.UpDownAxis_DoorOPosition_P1 = FormUtil.GetIntValue(txtUpDownP1);
store.Config.UpdateUpDownP1(ktkPosition.BagHeight, FormUtil.GetIntValue(txtUpDownP1));
needUpdate = true;
}
}
if (store.Config.InOutAxis_P1_Position != FormUtil.GetIntValue(txtInOutP1))
{
store.Config.InOutAxis_P1_Position = FormUtil.GetIntValue(txtInOutP1);
......@@ -673,11 +691,11 @@ namespace OnlineStore.AutoInOutStore
// store.Config.InOutAxis_DoorPosition_P2 = FormUtil.GetIntValue(txtInOutP2);
// needUpdate = true;
//}
if (store.Config.UpDownAxis_DoorOPosition_P1 != FormUtil.GetIntValue(txtUpDownP1))
{
store.Config.UpDownAxis_DoorOPosition_P1 = FormUtil.GetIntValue(txtUpDownP1);
needUpdate = true;
}
//if (store.Config.UpDownAxis_DoorOPosition_P1 != FormUtil.GetIntValue(txtUpDownP1))
//{
// store.Config.UpDownAxis_DoorOPosition_P1 = FormUtil.GetIntValue(txtUpDownP1);
// needUpdate = true;
//}
if (needUpdate)
{
//更新缓存
......@@ -900,7 +918,7 @@ namespace OnlineStore.AutoInOutStore
store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("", poText),false);
}
btnStartAuTo.Text = "停止自动出入库";
}
......@@ -911,11 +929,6 @@ namespace OnlineStore.AutoInOutStore
MessageBox.Show("请先启动料仓!");
}
}
//private void btnAxisConfig_Click(object sender, EventArgs e)
//{
// FormManager.ShowAxisConfig(store);
//}
private void 轴卡点动ToolStripMenuItem_Click(object sender, EventArgs e)
{
......@@ -1386,5 +1399,84 @@ namespace OnlineStore.AutoInOutStore
btnStatusSearch.Enabled = isOpen;
// Bt_ClearCounter.Enabled = isOpen;
}
private void btnBatchOutTest_Click(object sender, EventArgs e)
{
if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartOutStoreMove(new InOutStoreParam("", selectPositionNum, ktk), true );
}
else
{
MessageBox.Show("请先启动料仓!");
}
}
private void btnBatchInStore_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
AutomaticBaiting.BatchDoorOpen(false);
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnStartBatchInStore_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void btnGetOutTray_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
if (AutomaticBaiting.BatchOutStoreCount > 0 && AutomaticBaiting.BatchOutStoreHeight > 0)
{
AutomaticBaiting.BatchDoorOpen(false);
}
else
{
MessageBox.Show("未出库,无料盘可取");
}
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnBatchOutEnd_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
}
}
......@@ -11,8 +11,8 @@ DI,料盘宽度检测1,WidthCheck1,208,192.168.200.10,0,料盘宽度检测1,X09,DI-09,0,
DI,料盘宽度检测2,WidthCheck2,209,192.168.200.10,0,料盘宽度检测2,X10,DI-10,0,
DI,料盘检测1(上料机构),TrayCheck_LoadMaterial ,210,192.168.200.10,0,料盘检测1(上料机构),X11,DI-11,0,
DI,上料机构出料检测,OutCheck,211,192.168.200.10,0,上料机构出料检测,X12,DI-12,0,
DI,门锁气缸打开端,AutoDoor_Open,212,192.168.200.10,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸关闭端,AutoDoor_Close,213,192.168.200.10,0,门锁气缸关闭端,X14,DI-14,0,
DI,门锁气缸打开端,BatchDoor_Open,212,192.168.200.10,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸关闭端,BatchDoor_Close,213,192.168.200.10,0,门锁气缸关闭端,X14,DI-14,0,
DI,料盘检测2(料叉机构),TrayCheck_Fixture,214,192.168.200.10,0,料盘检测2(料叉机构),X15,DI-15,0,
DI,压紧机构计量检测,CompressAxis_Check,215,192.168.200.10,0,压紧机构计量检测,X16,DI-16,0,
DO,自动指示灯,AutoRun_HddLed,100,192.168.200.10,0,自动指示灯,Y01,DO-01,0,
......@@ -42,13 +42,14 @@ DI,左侧门关闭,DoorColse_Single,203,192.168.200.11,0,左侧门关闭,X20,DI-24,0,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM4,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM5,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM6,0,,,,,
AXIS,(轴五)自动上下轴,Auto_Axis,1,COM7,0,,,,,
AXIS,(轴五)批量上下料轴,Batch_Axis,1,COM7,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,403000,,,,,,,
PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,415000,,,,,,,
PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,,
PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,,
PRO,升降轴 待机点P1集合,UpDownAxis_P1_List,8#20000;12#22000,,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,,
PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-75000,,,,,,,
......@@ -125,16 +126,19 @@ PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制归零速度(原点返回速度),CompressAxis_HomeSpeed,15000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,,
PRO,(轴五)自动轴目标速度,AutoAxis_TargetSpeed,50,,,,,,,
PRO,(轴五)自动轴加速度,AutoAxis_AddSpeed,300,,,,,,,
PRO,(轴五)自动轴减速度,AutoAxis_DelSpeed,300,,,,,,,
PRO,(轴五)自动轴原点低速,AutoAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)自动轴原点高速,AutoAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)自动轴原点加速度,AutoAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)自动轴P1点,AutoAxis_P1,200,,,,,, ,
PRO,(轴五)自动轴停止时可误差的脉冲数的最小值,AutoAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)自动轴停止时可误差的脉冲数的最大值,AutoAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)自动轴最小限位,AutoAxis_PositionMin,0,,,,,,,
PRO,(轴五)自动轴最大限位,AutoAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,50,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,300,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,200,,,,,, ,
PRO,(轴五)上料轴停止时可误差的脉冲数的最小值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴停止时可误差的脉冲数的最大值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.10#16;192.168.200.11#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.10#16;192.168.200.11#4,,,,,,,
......@@ -144,12 +144,12 @@ namespace OnlineStore.DeviceLibrary
moveAxisList.Add(Config.Middle_Axis);
moveAxisList.Add(Config.UpDown_Axis);
moveAxisList.Add(Config.InOut_Axis);
moveAxisList.Add(Config.Auto_Axis);
moveAxisList.Add(Config.Batch_Axis);
this.AxisAlarmCodeMap = new Dictionary<string , AxisAlarmInfo>();
this.AxisAlarmCodeMap.Add(Config.UpDown_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(Config.InOut_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Middle_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Auto_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Batch_Axis.DeviceName, new AxisAlarmInfo());
}
/// <summary>
......@@ -369,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
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);
ACAxisMove(Config.UpDown_Axis, Config.GetDefaultUpDownP1(), Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_H_MiddleAxisToP1:
......@@ -398,7 +398,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1);
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);
ACAxisMove(Config.UpDown_Axis, Config.GetDefaultUpDownP1(), Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1:
......@@ -428,17 +428,33 @@ namespace OnlineStore.DeviceLibrary
}
private void OpenDoorAndWait()
{
KND.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.HIGH);
if (StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
//如果是批量出入库,不需要经过此门
if (StoreMove.IsBatchInOutStore)
{
return;
}
}
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Door_Down, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Door_Up, IO_VALUE.HIGH));
KND.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.HIGH);
}
private void CloseDoorAndWait()
{
KND.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
if (StoreMove.MoveType.Equals(StoreMoveType.InStore) || StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
//如果是批量出入库,不需要经过此门
if (StoreMove.IsBatchInOutStore)
{
return;
}
}
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Door_Down, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Door_Up, IO_VALUE.LOW));
KND.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
/// <summary>
......@@ -497,7 +513,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
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);
ACAxisMove(Config.UpDown_Axis, Config.GetDefaultUpDownP1(), Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_H_MiddleAxisToP1:
......@@ -1121,7 +1137,12 @@ namespace OnlineStore.DeviceLibrary
if (currInOutFixture.WareNum.Equals(""))
{
LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】");
StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
bool result = StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW),true);
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列");
AddWaitOutInfo(currInOutFixture);
}
}
}
}
......@@ -1197,7 +1218,7 @@ namespace OnlineStore.DeviceLibrary
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.Auto_Axis.DeviceName, Config.Auto_Axis.GetAxisValue());
ACServerManager.SuddenStop(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue());
}
public override void StopMove(bool IsCloseAxis)
{
......@@ -1330,7 +1351,7 @@ namespace OnlineStore.DeviceLibrary
IsScanCode = false;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0);
StartInStoreMove(param);
StartInStoreMove(param,true);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
}
......@@ -1640,7 +1661,7 @@ namespace OnlineStore.DeviceLibrary
{
if (CanStarInOut())
{
StartOutStoreMove(new InOutStoreParam("", posId, position));
StartOutStoreMove(new InOutStoreParam("", posId, position),true);
}
else
{
......
......@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
......@@ -34,7 +35,7 @@ namespace OnlineStore.DeviceLibrary
private int CurrInOutCount = 0;
private int CurrInOutACount = 0;
private bool LoadParamPosition(InOutStoreParam param)
private bool LoadParamPosition(InOutStoreParam param, bool IsBatch)
{
if (param == null)
{
......@@ -56,16 +57,22 @@ namespace OnlineStore.DeviceLibrary
p.Middle_P1 = Config.MiddleAxis_P1_Position;
p.InOut_P2 = position.InOutAxis_DoorPosition_P2;
//p.UpDown_P1 = position.UpDownAxis_DoorOPosition_P1;
//p.UpDown_P8 = position.UpDownAxis_DoorIBPosition_P8;
//p.UpDown_P2 = position.UpDownAxis_DoorIPosition_P2;
//p.UpDown_P7 = position.UpDownAxis_DoorOBPosition_P7;
if (IsBatch)
{
p.InOut_P2 = position.InOutAxis_Batch_P2;
}
//p.InOut_P2 = Config.InOutAxis_DoorPosition_P2;
p.UpDown_P1 = Config.UpDownAxis_DoorOPosition_P1;
p.UpDown_P1 = Config.GetUpDownP1(position.BagHeight);
p.UpDown_P8 = Config.UpDownAxis_DoorIBPosition_P8;
p.UpDown_P2 = Config.UpDownAxis_DoorIPosition_P2;
p.UpDown_P7 = Config.UpDownAxis_DoorOBPosition_P7;
if (IsBatch)
{
p.UpDown_P1 = Config.GetUpDownP1(position.BagHeight);
p.UpDown_P8 = p.UpDown_P1;
p.UpDown_P2 = p.UpDown_P1;
p.UpDown_P7 = p.UpDown_P1;
}
p.ComPress_P2 = position.CompressAxis_Position_P2;
p.ComPress_P3 = position.CompressAxis_CPosition_P3;
......@@ -75,6 +82,9 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P4 = position.UpDownAxis_ILPosition_P4;
p.UpDown_P5 = position.UpDownAxis_OHPosition_P5;
p.UpDown_P6 = position.UpDownAxis_OLPosition_P6;
//出库时批量上下料轴需要下降的高度
p.BatchAxis_DownValue = AutomaticBaiting.AxisChangeValue * position.BagHeight;
param.MoveP = p;
return true;
}
......@@ -97,7 +107,6 @@ namespace OnlineStore.DeviceLibrary
{
ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed);
}
//StoreMove.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
}
private void CheckWait()
......@@ -236,40 +245,37 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 入库
private DateTime startInStoreTime = DateTime.Now;
private Stopwatch InOutWatch = new Stopwatch();
/// <summary>
/// 开始入库移动移动
/// </summary>
public void StartInStoreMove(InOutStoreParam param, bool isNeedCheckIO)
public bool StartInStoreMove(InOutStoreParam param, bool IsBatchWork)
{
startInStoreTime = DateTime.Now;
InOutWatch.Reset();
string posId = param != null ? param.PositionNum : "";
string logMsg = IsBatchWork ? " 启动批量入库【" + posId + "】" : " 启动入库【" + posId + "】";
if (!AutomaticBaiting.DoorStatus.Equals(2))
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料门未关闭");
return false;
}
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param))
if (!LoadParamPosition(param,false))
{
LogUtil.error(LOGGER, StoreName + " 启动入库【" + posId + "】出错,找不到库位信息");
return;
LogUtil.error(LOGGER, StoreName + logMsg+ " 出错,找不到库位信息");
return false ;
}
if (KND.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
LogUtil.error(LOGGER, StoreName + " 启动入库【" + posId + "】出错,叉子料盘检测有料");
return;
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,叉子料盘检测有料");
return false ;
}
LogUtil.info(LOGGER, StoreName + " 启动入库【" + posId + "】", storeMoveColor);
LogUtil.info(LOGGER, StoreName + logMsg , storeMoveColor);
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param);
if (isNeedCheckIO)
{
//料盘检测
InStoreLog(" 入库:SI_00 检测料盘信号");
StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
}
else
{
StoreMove.IsBatchInOutStore = IsBatchWork;
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
SI_02_Move(param.MoveP);
......@@ -280,21 +286,15 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SI_01_LocationCylinderDown);
LocationDownAndWait();
}
}
return true;
}
else
{
LogUtil.error(LOGGER, StoreName + " 启动【" + posId + "】入库出错,当前状态,storeStatus=" + storeRunStatus);
return false;
}
}
/// <summary>
/// 开始入库移动移动
/// </summary>
public override void StartInStoreMove(InOutStoreParam param)
{
StartInStoreMove(param, false);
}
private void SI_02_Move(LineMoveP moveP)
{
InStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1,打开舱门");
......@@ -311,7 +311,6 @@ namespace OnlineStore.DeviceLibrary
}
protected override void InStoreProcess()
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
if (StoreMove.IsInWait)
{
CheckWait();
......@@ -320,19 +319,8 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (StoreMove.MoveStep == StoreMoveStep.SI_00_TrayCheck)
{
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
SI_02_Move(moveP);
}
else
{
InStoreLog("入库:SI_01 定位气缸下降");
StoreMove.NextMoveStep(StoreMoveStep.SI_01_LocationCylinderDown);
LocationDownAndWait();
}
}
LineMoveP moveP = StoreMove.MoveParam.MoveP;
if (StoreMove.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
{
SI_02_Move(moveP);
......@@ -342,11 +330,6 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
ComMoveToPosition(moveP.ComPress_P3);
//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);
}
......@@ -357,8 +340,6 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SI_04_CompressWare 压紧物品(有压紧轴的才需要此步骤),压紧轴至P3(压紧前点) 开始");
StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
ComMoveToPosition(moveP.ComPress_P3);
//ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
//StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
else
{
......@@ -367,31 +348,32 @@ 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)
{
//如果是自动,等待吸盘释放盘之后就可以退出
if (StoreMove.IsBatchInOutStore)
{
InStoreLog("入库:SI_06 拿物品,批量入库, 等待吸盘放下物品");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.LOW));
}
else
{
NeedCheckSafetyLight = 0;
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2);
//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);
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
{
InStoreLog("入库:SI_07 叉子 从入料口抽出,进出轴至P1(待机点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_07_DeviceBackFromDoor);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1(moveP.InOut_P1);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
......@@ -451,11 +433,6 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SI_12 放下物品,升降轴至P4(库位入料缓冲点),压紧轴至P3(压紧前点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3);
//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_P4, Config.UpDownAxis_P4_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
......@@ -477,20 +454,15 @@ namespace OnlineStore.DeviceLibrary
InStoreLog("入库:SI_14 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_GoBack);
ComMoveToPosition(moveP.ComPress_P1);
//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.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoorAndWait();
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack)
{
TimeSpan span = DateTime.Now - startInStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!", storeMoveColor);
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态
......@@ -501,38 +473,58 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(LOGGER, StoreName + " 入库,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
}
}
#endregion
#region 出库
private DateTime startOutStoreTime = DateTime.Now;
/// <summary>
/// 开始出库运动
/// </summary>
public override void StartOutStoreMove(InOutStoreParam param)
public bool StartOutStoreMove(InOutStoreParam param,bool IsBatchWork)
{
startOutStoreTime = DateTime.Now;
InOutWatch.Reset();
string posId = param != null ? param.PositionNum : "";
string logMsg = IsBatchWork ? " 启动批量出库【" + posId + "】" : " 启动出库【" + posId + "】";
if (!AutomaticBaiting.DoorStatus.Equals(2))
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料门未关闭");
return false;
}
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param))
if (!LoadParamPosition(param,IsBatchWork))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,找不到库位信息");
return;
LogUtil.error(LOGGER, StoreName + logMsg+ " 出错,找不到库位信息");
return false ;
}
if (KND.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,叉子料盘检测有料");
return;
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,叉子料盘检测有料");
return false ;
}
//若自动上料机构正在入库中,不可以出库
if (!AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构不在空闲中");
return false;
}
//判断批量上下料机构是否已经满
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
int currBatchValue = ACServerManager.GetActualtPosition(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue());
if (currBatchValue - param.MoveP.BatchAxis_DownValue < 1000)
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构已满,请先拿出料盘");
return false;
}
}
storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ", storeMoveColor);
LogUtil.info(LOGGER, StoreName + logMsg, storeMoveColor);
storeRunStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.OutStore, param);
StoreMove.IsBatchInOutStore = IsBatchWork;
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
StoreMove.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
......@@ -548,10 +540,12 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_01 定位气缸下降");
LocationDownAndWait();
}
return true;
}
else
{
LogUtil.error(LOGGER, StoreName + " 启动出库出错,当前状态,storeStatus=" + storeRunStatus);
return false;
}
}
protected override void OutStoreProcess()
......@@ -568,19 +562,27 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.MoveStep == StoreMoveStep.SO_01_LocationCylinderDown)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_02_DeviceBack);
if (StoreMove.IsBatchInOutStore)
{
//如果批量能未检测到料盘,需要把批量轴走到能检测到料盘的位置
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
{
//int currBatchValue = ACServerManager.GetActualtPosition(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue());
ACAxisMove(Config.Batch_Axis, Config.BatchAxis_P1, Config.BatchAxis_P1_Speed);
OutStoreLog("出库:SO_02 批量上下料轴走到P1点 ");
}
}
OutStoreLog("出库:SO_02 叉子先运动到P1 ");
InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ComMoveToPosition(moveP.ComPress_P3);
//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);
}
......@@ -594,12 +596,6 @@ namespace OnlineStore.DeviceLibrary
{
OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
//电缸微动至对应料盘的上端位置
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
//}
ComMoveToPosition(moveP.ComPress_P2);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
......@@ -620,12 +616,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
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();
SO_08_ToDoorPosition();
}
else
{
......@@ -636,16 +627,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_07_LocationCylinder_Up)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
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);
//此处需要等待box门口没有盘
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
//StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
//打开舱门
OpenDoorAndWait();
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_2, IO_VALUE.LOW));
SO_08_ToDoorPosition();
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_08_ToDoorPosition)
......@@ -665,10 +647,6 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_09_LocationCylinder_Down)
{
SO_10_DeviceToDoorPro();
//OutStoreLog("出库:SO_10 叉子进出料口,进出轴至P2(进料口取料点) ");
//StoreMove.NextMoveStep(StoreMoveStep.SO_10_DeviceToDoor);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_10_DeviceToDoor)
{
......@@ -676,11 +654,6 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SO_11_DevicePutWare);
NeedCheckSafetyLight = 0;
ComMoveToPosition(moveP.ComPress_P1);
//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)
......@@ -692,25 +665,43 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_12_DeviceOutFromDoor)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_13_GoBack);
if (StoreMove.IsBatchInOutStore)
{
BatchAxisUpTrayHeight();
}
else
{
OutStoreLog("出库:SO_13 升降轴返回,轴2至P1(待机点) ,关闭舱门");
}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoorAndWait();
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_13_GoBack)
{
if (StoreMove.IsBatchInOutStore)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.SO_14_WaitTake);
OutStoreLog("出库:SO_14_WaitTake 等待拿走物品,最多等待10000");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
//StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
StoreMove.OneWaitCanEndStep = true;
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_14_WaitTake)
{
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);
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
......@@ -719,7 +710,53 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, StoreName + " 出库处理,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
}
}
private void BatchAxisUpTrayHeight()
{
//上料轴需要向下走
int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
int targetValue = currPosition - StoreMove.MoveParam.MoveP.BatchAxis_DownValue;
//记录高度
AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight;
OutStoreLog("出库:SO_13 升降轴返回,批量上下料轴下降【"+ StoreMove.MoveParam.MoveP.BatchAxis_DownValue + "】,目标位置【"+targetValue+"】");
//判断盘满后,需要报警?
if (targetValue < 0)
{
//TODO
WarnMsg = "库已满,请先拿走!";
}
else
{
ACAxisMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed, targetValue);
}
}
/// <summary>
/// 出库:SO_08 走到料门口,旋转轴至P1(待机点)升降轴至P2(进料口出料前点)
/// </summary>
private void SO_08_ToDoorPosition()
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
StoreMove.NextMoveStep(StoreMoveStep.SO_08_ToDoorPosition);
if (StoreMove.IsBatchInOutStore)
{
OutStoreLog("出库:SO_08 走到吸盘下方,旋转轴至P1(待机点)升降轴至P1 ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
else
{
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);
//此处需要等待box门口没有盘
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
//打开舱门
OpenDoorAndWait();
}
}
private void SO_10_DeviceToDoorPro()
{
......@@ -728,6 +765,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_10 叉子进出料口,进出轴至P2(进料口取料点) ");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
NeedCheckSafetyLight = 1;
}
public bool InOutAxisCanMove()
{
......@@ -749,24 +787,24 @@ namespace OnlineStore.DeviceLibrary
{
if (Config.IsHasLocationCylinder>=1)
{
KND.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder_Down, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder2_Up, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder2_Down, IO_VALUE.LOW));
KND.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
}
}
private void LocationDownAndWait()
{
if (Config.IsHasLocationCylinder>=1)
{
KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
KND.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder_Up, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder2_Down, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LocationCylinder2_Up, IO_VALUE.LOW));
KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
KND.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
}
}
#endregion
......@@ -829,7 +867,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutStoreParam("", posid));
StartOutStoreMove(new InOutStoreParam("", posid),false);
}
}
}
......@@ -864,7 +902,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid));
StartInStoreMove(new InOutStoreParam("AAAA", posid),false);
}
}
}
......@@ -878,12 +916,14 @@ namespace OnlineStore.DeviceLibrary
private void InStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : "";
LogUtil.info(LOGGER, isBatchMsg+"【" + posId + "】" + msg, storeMoveColor);
}
private void OutStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : "";
LogUtil.info(LOGGER, isBatchMsg+ "【" + posId + "】" + msg, storeMoveColor);
}
}
}
......@@ -9,6 +9,10 @@ namespace OnlineStore.DeviceLibrary
{
public partial class AutomaticBaiting
{
/// <summary>
/// 0=未知。1=门打开,2=门关闭
/// </summary>
public static int DoorStatus = 2;
public static int LastHeight = 0;
public static int LastSize = 0;
public static string LastCode = "";
......@@ -17,10 +21,12 @@ namespace OnlineStore.DeviceLibrary
public static string Name = "自动上下料";
public static StoreMoveInfo StoreMove = null;
public static StoreRunStatus AutoBaitingStatus = StoreRunStatus.Wait;
/// <summary>
/// 门状态,0=位初始化,1=关闭,2=打开,
/// </summary>
public static int AutoDoorSatus = 0;
//记录没开门状态下,已经出库的数量
public static int BatchOutStoreCount = 0;
public static int BatchOutStoreHeight = 0;
/// <summary>
/// 初始化数据
/// </summary>
......@@ -45,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
OutStoreProcess();
//OutStoreProcess();
}
}
}
......@@ -63,16 +69,19 @@ namespace OnlineStore.DeviceLibrary
msg = "上料机构门未关闭";
return msg;
}
//吸盘压力确认
if (KND.IOValue(IO_Type.SuckingDisc_Air).Equals(IO_VALUE.LOW))
{
msg = "吸盘压力无信号";
return msg;
}
return msg;
}
public static bool StartReset()
private static void ClearInOutInfo()
{
BatchOutStoreCount = 0;
BatchOutStoreHeight = 0;
LastCode = "";
LastHeight = 0;
LastSize = 0;
}
public static bool Reset()
{
string msg = CanStart();
if (!String.IsNullOrEmpty(msg))
......@@ -80,11 +89,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name+"复位失败:"+msg);
return false;
}
ClearInOutInfo();
DoorStatus = 2;
AutoBaitingStatus = StoreRunStatus.Reset;
StoreMove.NewMove(StoreMoveType.StoreReset);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R01_CloseDoor);
//关闭门,轴回原点,检测
AutoDoorClose(true);
BatchDoorClose(true);
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
LogUtil.info(Name + "复位中:关闭门锁");
return true;
......@@ -106,12 +117,12 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.AUTO_R01_CloseDoor:
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R02_AutoAxisHome);
LogUtil.info(Name + "复位中:自动轴原点返回");
ACAxisHomeMove(StoreManager.Config.Auto_Axis);
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
break;
case StoreMoveStep.AUTO_R02_AutoAxisHome:
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R03_AutoAxisHome);
LogUtil.info(Name + "复位中:匀速向上运动,检测 是否有料盘");
ACAxisSpeedMove(StoreManager.Config.Auto_Axis, StoreManager.Config.Auto_Axis.TargetSpeed);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
break;
case StoreMoveStep.AUTO_R03_AutoAxisHome:
......@@ -119,7 +130,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "复位中: 没有料盘,不需要上料,上料轴回0点");
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R04_AutoBack);
ACAxisHomeMove(StoreManager.Config.Auto_Axis);
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
}
else
{
......@@ -142,25 +153,25 @@ namespace OnlineStore.DeviceLibrary
public static bool StartInOut()
{
if (AutoBaitingStatus == StoreRunStatus.Runing)
if (AutoBaitingStatus == StoreRunStatus.Runing && StoreMove.MoveType.Equals(StoreMoveType.None))
{
AutoBaitingStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.InStore);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I01_MoveToUp);
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
LogUtil.error(Name + " 启动入料 ,已检测到料盘,轴不需要上升" );
LogUtil.error(Name + " 启动入料 ,已检测到料盘,轴不需要上升");
}
else
{
LogUtil.error(Name + " 启动入料 ,轴上升到检测到料盘");
ACAxisSpeedMove(StoreManager.Config.Auto_Axis, StoreManager.Config.Auto_Axis.TargetSpeed);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
}
return true;
}
else
{
LogUtil.error(Name + " 启动入料出错,当前状态,AutoBaitingStatus=" + AutoBaitingStatus);
LogUtil.error(Name + " 启动入料失败,AutoBaitingStatus=" + AutoBaitingStatus+ ",MoveType="+ StoreMove.MoveType);
return false;
}
}
......@@ -179,21 +190,22 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I01_MoveToUp))
{
SuckingDiscWork();
}else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I02_SuckingDisc_Down))
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_SuckingDisc_Down))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_SuckingDisc_Work);
LogUtil.info(Name + "入料: 开始吸料盘");
LogUtil.info(Name + "入料: 开始吸料盘,等待上料机构检测到无料盘");
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.HIGH);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(200));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.HIGH));
}
else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I03_SuckingDisc_Work))
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_SuckingDisc_Work))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Up);
LogUtil.info(Name + "入料: 吸盘上升,同时上料轴也上升");
CylinderMove(IO_Type.SuckingDisc_Up,IO_Type.SuckingDisc_Down, true);
ACAxisSpeedMove(StoreManager.Config.Auto_Axis, StoreManager.Config.Auto_Axis.TargetSpeed);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
}
else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Up))
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Up))
{
//需要料仓没有出入库才可以扫码
if (StoreManager.Store.CanStarInOut())
......@@ -203,7 +215,7 @@ namespace OnlineStore.DeviceLibrary
LastCode = "";
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I05_ScanCode);
//计算高度
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Auto_Axis.DeviceName, StoreManager.Config.Auto_Axis.GetAxisValue());
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
int height = Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue;
int size = GetSize();
LogUtil.info(Name + "入料: 开始扫码,料盘尺寸:【" + size + "*" + height + "】");
......@@ -214,7 +226,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.OneWaitCanEndStep = true;
}
}
else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I05_ScanCode))
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I05_ScanCode))
{
if (LastCode.Equals(""))
{
......@@ -230,28 +242,33 @@ namespace OnlineStore.DeviceLibrary
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck1, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck2, IO_VALUE.LOW));
}
}else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I06_WaitTrayLeave))
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I06_WaitTrayLeave))
{
if (StoreManager.Store.StoreMove.MoveStep >= StoreMoveStep.SI_07_DeviceBackFromDoor)
{
SuckingDiscWork();
} else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I07_OpenDoor)){
}
} else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I07_OpenDoor)){
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_WaitTakeTray);
LogUtil.info(Name + "入料: 未扫到二维码,等待拿走料盘");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Work, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck1, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck2, IO_VALUE.LOW));
}
else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I08_WaitTakeTray))
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I08_WaitTakeTray))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I09_TrayLeaveWaitTime);
LogUtil.info(Name + "入料: 未扫到二维码,料盘已拿走,等待1秒后关门");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I09_TrayLeaveWaitTime))
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I09_TrayLeaveWaitTime))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I10_CloseDoor);
LogUtil.info(Name + "入料: 未扫到二维码,料盘已拿走,关闭仓门");
CylinderMove(IO_Type.Door_Down, IO_Type.Door_Up, true);
}else if (StoreMove.MoveType.Equals(StoreMoveStep.AUTO_I10_CloseDoor))
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I10_CloseDoor))
{
SuckingDiscWork();
}
......@@ -279,30 +296,105 @@ namespace OnlineStore.DeviceLibrary
AutoBaitingStatus = StoreRunStatus.Runing;
}
}
public static void OutStoreProcess()
{
}
//public static bool StartOutStore(string PosId)
//{
// AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PosId);
// if (position == null)
// {
// LogUtil.error(Name + " 启动出料失败,PosId【" + PosId + "】未找到库位信息" );
// return false;
// }
// if (AutoBaitingStatus == StoreRunStatus.Runing && StoreMove.MoveType.Equals(StoreMoveType.None))
// {
// AutoBaitingStatus = StoreRunStatus.Busy;
// StoreMove.NewMove(StoreMoveType.InStore);
// StoreMove.PosId = PosId;
// StoreMove.NextMoveStep(StoreMoveStep.AUTO_O01_SuckingDisc_Work);
// if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
// {
// LogUtil.info(Name + " 启动出料 ,已检测到料盘,轴不需要上升");
// }
// else
// {
// LogUtil.info(Name + " 启动出料 ,轴上升到检测到料盘");
// ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
// }
// return true;
// }
// else
// {
// LogUtil.error(Name + " 启动出料失败,AutoBaitingStatus=" + AutoBaitingStatus + ",MoveType=" + StoreMove.MoveType);
// return false;
// }
//}
//private static void OutStoreProcess()
//{
// if (StoreMove.IsInWait)
// {
// CheckWait();
// }
// if (StoreMove.IsInWait)
// {
// return;
// }
// if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O01_SuckingDisc_Work))
// {
// StoreMove.NextMoveStep(StoreMoveStep.AUTO_O02_WaitTimeDown);
// LogUtil.info(Name + " 出料:等待叉子后退后,吸盘下降");
// StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
// }
// else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O02_WaitTimeDown))
// {
// StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_SuckingDisc_Down);
// LogUtil.info(Name + " 出料:吸盘下降,上料轴向下运动");
// CylinderMove(IO_Type.SuckingDisc_Down, IO_Type.SuckingDisc_Up, true);
// //上料轴需要向下走
// AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(StoreMove.PosId);
// int axisValue = AxisChangeValue * position.BagHeight;
// int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
// int targetValue = currPosition - axisValue;
// //判断盘满后,需要报警?
// if (targetValue < 0)
// {
// WarnMsg = "库已满,请先拿走!";
// LogUtil.error(Name + WarnMsg);
// }
// else
// {
// ACAxisRelMove(StoreManager.Config.InOut_Axis, StoreManager.Config.InOut_Axis.TargetSpeed, targetValue);
// }
// }
// else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O03_SuckingDisc_Down))
// {
// StoreMove.NextMoveStep(StoreMoveStep.AUTO_O04_PutTrayDown);
// LogUtil.info(Name + " 出料:放下物料");
// KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_LoadMaterial, IO_VALUE.HIGH));
// }
// else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O04_PutTrayDown))
// {
// StoreMove.NextMoveStep(StoreMoveStep.AUTO_O05_SuckingDisc_Up);
// LogUtil.info(Name + " 出料:吸盘上升");
// CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down, true);
// }
// else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O05_SuckingDisc_Up))
// {
// LogUtil.info(Name + "出料:出料结束");
// StoreMove.EndMove();
// AutoBaitingStatus = StoreRunStatus.Runing;
// }
// else
// {
// LogUtil.error(Name + "未找到步骤:" + StoreMove.MoveType);
// }
//}
public static bool DoorIsClose()
......@@ -313,25 +405,31 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
public static void AutoDoorOpen (bool isWait)
public static void BatchDoorOpen(bool isWait)
{
KND.IOMove(IO_Type.AutoDoor_Close, IO_VALUE.LOW);
KND.IOMove(IO_Type.AutoDoor_Open, IO_VALUE.HIGH);
ClearInOutInfo();
DoorStatus = 1;
KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.LOW);
KND.IOMove(IO_Type.BatchDoor_Open, IO_VALUE.HIGH);
if (isWait)
{
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.AutoDoor_Close, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.AutoDoor_Open, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Close, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Open, IO_VALUE.HIGH));
}
}
public static void AutoDoorClose(bool isWait)
public static void BatchDoorClose(bool isWait)
{
ClearInOutInfo();
DoorStatus = 2;
if (isWait)
{
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.AutoDoor_Open, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.AutoDoor_Close, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Open, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Close, IO_VALUE.HIGH));
}
KND.IOMove(IO_Type.AutoDoor_Open, IO_VALUE.LOW);
KND.IOMove(IO_Type.AutoDoor_Close, IO_VALUE.HIGH);
KND.IOMove(IO_Type.BatchDoor_Open, IO_VALUE.LOW);
KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.HIGH);
}
//public static void SuckingDiscDown(bool isWait)
......
......@@ -23,6 +23,12 @@ namespace OnlineStore.DeviceLibrary
ACServerManager.SpeedMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetSpeed);
}
private static void ACAxisRelMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
}
private static void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{
moveAxis.TargetPosition = 0;
......@@ -170,13 +176,46 @@ namespace OnlineStore.DeviceLibrary
StoreManager.Store.Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
}
}
/// <summary>
/// 判断AC伺服电机轴是否运动完成
/// </summary>
private static bool ACAxisMoveIsEnd(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed, out string msg)
{
msg = "";
bool isOk = ACServerManager.GetBusyStatus(moveAxis.DeviceName, moveAxis.GetAxisValue()).Equals(0);
if (isOk)
{
int outCount = ACServerManager.GetActualtPosition(moveAxis.DeviceName, moveAxis.GetAxisValue());
int errorCount = Math.Abs(outCount - targetPosition);
if (errorCount <= moveAxis.CanErrorCountMax)
{
return true;
}
//判断是否需要重新运动
if (StoreMove.CanWhileCount > 0)
{
LogUtil.error(Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount +
"],误差过大,重新运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
}
else
{
msg = Name + moveAxis.DisplayStr + "目标[" + targetPosition + "]当前[" + outCount + "],误差过大,需要报警";
LogUtil.error(msg);
}
}
return false;
}
private static bool AxisMoveISEnd(WaitResultInfo wait)
{
string msg = "";
if (wait.IsHomeMove)
{
wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
}else
{
wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
}
if (!wait.IsEnd)
{
......
......@@ -92,7 +92,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public abstract void StartOutStoreMove(InOutStoreParam param);
//public abstract bool StartOutStoreMove(InOutStoreParam param);
protected abstract void OutStoreProcess();
#endregion
......@@ -100,17 +100,17 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始入库移动移动
/// </summary>
public abstract void StartInStoreMove(InOutStoreParam param);
//public abstract bool StartInStoreMove(InOutStoreParam param);
protected abstract void InStoreProcess();
#endregion
public string GetRunStr()
public string GetRunStr(StoreRunStatus runStatus,bool IsStore)
{
string sta = "运行中";
string aa = "";
switch (storeRunStatus)
switch (runStatus)
{
case StoreRunStatus.Busy:
sta = "忙碌";
......@@ -128,7 +128,7 @@ namespace OnlineStore.DeviceLibrary
sta = "等待启动";
break;
}
if (storeRunStatus > StoreRunStatus.Wait)
if (runStatus > StoreRunStatus.Wait)
{
//"0":"急停中", "1":"设备联机", "2":"故障中", "3":"入库执行中", "4":"出库执行中", 5":"料盘入仓位完成", "6":"料盘出仓位完成", 7":"设备调试中",
switch (storeStatus)
......
......@@ -79,5 +79,11 @@ namespace OnlineStore.DeviceLibrary
/// 轴4( 压紧轴) 压紧前点P3
/// </summary>
public int ComPress_P3{ get; set; }
/// <summary>
/// 上下料轴需要下降的相对高度
/// </summary>
public int BatchAxis_DownValue = 0;
}
}
......@@ -241,13 +241,41 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
SO_14_WaitTake=114,
/// <summary>
/// 料仓出库,批量出库,所有轴运行到吸盘下方,,轴1( 转盘) 至P1( 待机点)轴2( 上下) 至P1
/// </summary>
SO_58_ToBatchDoorPosition = 158,
/// <summary>
/// 料仓出库,定位气缸退回(有压紧轴的不需要此步骤
/// </summary>
SO_59_LocationCylinder_Down = 159,
/// <summary>
/// 料仓出库,,叉子进出料口,,轴3( 叉子) 至P2( 进料口取料点)
/// /// </summary>
SO_60_DeviceToDoor = 160,
/// <summary>
/// 料仓出库,,把物品放下,,轴2( 上下) 至P8( 进料口出料缓冲点)轴4( 压紧) 至P1( 待机点)
/// </summary>
SO_61_DevicePutWare = 161,
/// <summary>
/// 料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点)
/// 批量轴需要下降对应的高度
/// </summary>
SO_62_DeviceOutFromDoor = 162,
/// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary>
SO_63_GoBack = 163,
#endregion
#region 料仓内部入库步骤
/// <summary>
/// 入库检测
/// </summary>
SI_00_TrayCheck=200,
SI_00_TrayCheck =200,
/// <summary>
/// 入库,。定位气缸下降
/// </summary>
......@@ -270,6 +298,7 @@ namespace OnlineStore.DeviceLibrary
SI_05_DeviceToDoor = 205,
/// <summary>
/// 入库。。把物品放入叉子上,轴2( 上下) 至P7( 进料口取料缓冲点),压紧物品(有压紧轴的才需要此步骤),轴4( 压紧) 至P2(压紧点)
/// 批量入库:此步骤表示吸盘放物品
/// </summary>
SI_06_DoorWarToDevice = 206,
......@@ -383,26 +412,30 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 自动上下料出料功能
/// <summary>
/// 吸盘吸走料盘,同时上料轴开始上升
/// </summary>
AUTO_O01_SuckingDisc_Work,
/// <summary>
/// 等待1秒后吸盘下降
/// </summary>
AUTO_O02_WaitTimeDown,
//#region 自动上下料出料功能
///// <summary>
///// 吸盘吸走料盘,同时上料轴开始上升
///// </summary>
//AUTO_O01_SuckingDisc_Work,
///// <summary>
///// 等待1秒后吸盘下降
///// </summary>
//AUTO_O02_WaitTimeDown,
/// <summary>
/// 吸盘下降
/// </summary>
AUTO_O03_SuckingDisc_Down,
/// <summary>
/// 放下料盘
/// </summary>
AUTO_O04_PutTrayDown,
///// <summary>
///// 吸盘下降
///// </summary>
//AUTO_O03_SuckingDisc_Down,
///// <summary>
///// 放下料盘
///// </summary>
//AUTO_O04_PutTrayDown,
///// <summary>
///// 吸盘上升
///// </summary>
//AUTO_O05_SuckingDisc_Up,
//#endregion
#endregion
}
public enum StoreAlarmType
......
......@@ -48,7 +48,7 @@ namespace OnlineStore.DeviceLibrary
get { return moveType; }
}
/// <summary>
///出入库参数
///出入库参数,料仓内部使用
/// </summary>
public InOutStoreParam MoveParam { get; set; }
/// <summary>
......@@ -60,6 +60,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否再当前步骤等待中
/// </summary>
public bool IsInWait { get; set; }
/// <summary>
/// 上一个执行步骤
/// </summary>
......@@ -79,7 +80,12 @@ namespace OnlineStore.DeviceLibrary
{
get { return moveStep; }
}
/// <summary>
/// 是否是批量出入库
/// </summary>
public bool IsBatchInOutStore=true ;
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
public void NextMoveStep(StoreMoveStep step)
{
PreMoveStep = moveStep;
......@@ -124,20 +130,19 @@ namespace OnlineStore.DeviceLibrary
WaitList = new List<WaitResultInfo>();
CanWhileCount = 0;
}
public StoreMoveInfo clone()
{
return (StoreMoveInfo)this.MemberwiseClone();
}
//public StoreMoveInfo clone()
//{
// return (StoreMoveInfo)this.MemberwiseClone();
//}
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
/// <summary>
/// 重置之后继续出入库时,退回上一个步骤执行
/// </summary>
public void BackStep()
{
moveStep = PreMoveStep;
IsInWait = false;
}
///// <summary>
///// 重置之后继续出入库时,退回上一个步骤执行
///// </summary>
//public void BackStep()
//{
// moveStep = PreMoveStep;
// IsInWait = false;
//}
}
public class WaitResultInfo
......@@ -402,10 +407,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public int HeightValue { get; set; }
internal static WaitResultInfo WaitIO(object trayCheck_Door, IO_VALUE hIGH)
{
throw new NotImplementedException();
}
}
public enum StoreMoveType
{
......
......@@ -59,11 +59,15 @@ namespace OnlineStore.LoadCSVLibrary
public int CompressAxis_CPosition_P3 { get; set; }
/// <summary>
/// 轴3(进出轴) 进料口取料点P2
/// 轴3(进出轴) 进料口取料点P2 ,料仓门口取料放料点
/// </summary>
[CSVAttribute("进出轴进料口取料点P2")]
[CSVAttribute("进出轴仓门取料点P2")]
public int InOutAxis_DoorPosition_P2 { get; set; }
/// <summary>
/// 轴3(进出轴) 进出轴吸盘取料点P2 ,吸盘下方取放料点,批量出入库时使用
/// </summary>
[CSVAttribute("进出轴吸盘取料点P2")]
public int InOutAxis_Batch_P2 { get; set; }
public static bool CheckPosition(AutoStorePosition position, AUTO_SA_Config Config)
{
try
......@@ -92,6 +96,11 @@ namespace OnlineStore.LoadCSVLibrary
LogUtil.error(position.PositionNum + " InOutAxis_Position_P3位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
return false;
}
if (iMin > position.InOutAxis_Batch_P2 || iMax < position.InOutAxis_Batch_P2)
{
LogUtil.error(position.PositionNum + " InOutAxis_Batch_P2位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
return false;
}
}
if (Config.UpDown_Axis.PositionIsHasLimit())
{
......
......@@ -22,7 +22,7 @@ namespace OnlineStore.LoadCSVLibrary
/// 高
/// </summary>
[CSVAttribute("高度")]
public int BagHigh { get; set; }
public int BagHeight { get; set; }
/// <summary>
/// 宽
/// </summary>
......
using System;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -278,10 +279,16 @@ namespace OnlineStore.LoadCSVLibrary
public int IOSingle_TimerOut { get; set; }
/// <summary>
/// 升降轴 进料口取料点 P1
/// PRO 升降轴 待机点P1集合 UpDownAxis_P1_List 8#20000;12#22000
/// </summary>
[ConfigProAttribute("UpDownAxis_DoorOPosition_P1")]
public int UpDownAxis_DoorOPosition_P1 { get; set; }
[ConfigProAttribute("UpDownAxis_P1_List")]
public string UpDownAxis_P1_List { get; set; }
///// <summary>
///// 升降轴 进料口取料点 P1
///// </summary>
//[ConfigProAttribute("UpDownAxis_DoorOPosition_P1")]
//public int UpDownAxis_DoorOPosition_P1 { get; set; }
/// <summary>
/// 升降轴 进料口出料前点 P2
/// </summary>
......@@ -351,10 +358,10 @@ namespace OnlineStore.LoadCSVLibrary
public ConfigMoveAxis InOut_Axis { get; set; }
/// <summary>
///AXIS (轴五)自动上下轴 Auto_Axis
///AXIS (轴五)批量出入料 Batch_Axis
/// </summary>
[ConfigProAttribute("Auto_Axis")]
public ConfigMoveAxis Auto_Axis { get; set; }
[ConfigProAttribute("Batch_Axis")]
public ConfigMoveAxis Batch_Axis { get; set; }
/// <summary>
/// PRO 硕科步进电机(压紧轴)控制端口号 CompressAxis_PortName COM4
/// </summary>
......@@ -471,87 +478,70 @@ namespace OnlineStore.LoadCSVLibrary
public string Humiture_Port { get; set; }
///// <summary>
///// PRO 模拟量IO模块的IP地址 AIDevice_IP 192.168.200.11
///// </summary>
//[ConfigProAttribute("AIDevice_IP", true)]
//public string AIDevice_IP { get; set; }
///// <summary>
///// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,,
///// </summary>
//[ConfigProAttribute("AIDI1_DefaultPosition", true)]
//public double AIDI1_DefaultPosition { get; set; }
///// <summary>
///// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,,
///// </summary>
//[ConfigProAttribute("AIDI2_DefaultPosition", true)]
//public double AIDI2_DefaultPosition { get; set; }
///// <summary>
///// PRO,模拟信号3默认高度,AIDI3_DefaultPosition,1,,,,,,,
///// </summary>
//[ConfigProAttribute("AIDI3_DefaultPosition", true)]
//public double AIDI3_DefaultPosition { get; set; }
/// <summary>
/// PRO (轴五)自动轴目标速度 AutoAxis_TargetSpeed 1000
/// PRO (轴五)自动轴目标速度 BatchAxis_TargetSpeed 1000
/// </summary>
[ConfigProAttribute("AutoAxis_TargetSpeed", true)]
public int AutoAxis_TargetSpeed { get; set; }
[ConfigProAttribute("BatchAxis_TargetSpeed", true)]
public int BatchAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴加速度 AutoAxis_AddSpeed 300
/// PRO (轴五)自动轴加速度 BatchAxis_AddSpeed 300
/// </summary>
[ConfigProAttribute("AutoAxis_AddSpeed", true)]
public int AutoAxis_AddSpeed { get; set; }
[ConfigProAttribute("BatchAxis_AddSpeed", true)]
public int BatchAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴减速度 AutoAxis_DelSpeed 300
/// PRO (轴五)自动轴减速度 BatchAxis_DelSpeed 300
/// </summary>
[ConfigProAttribute("AutoAxis_DelSpeed", true)]
public int AutoAxis_DelSpeed { get; set; }
[ConfigProAttribute("BatchAxis_DelSpeed", true)]
public int BatchAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点低速 AutoAxis_HomeLowSpeed 20
/// PRO (轴五)自动轴原点低速 BatchAxis_HomeLowSpeed 20
/// </summary>
[ConfigProAttribute("AutoAxis_HomeLowSpeed", true)]
public int AutoAxis_HomeLowSpeed { get; set; }
[ConfigProAttribute("BatchAxis_HomeLowSpeed", true)]
public int BatchAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点高速 AutoAxis_HomeHighSpeed 60
/// PRO (轴五)自动轴原点高速 BatchAxis_HomeHighSpeed 60
/// </summary>
[ConfigProAttribute("AutoAxis_HomeHighSpeed", true)]
public int AutoAxis_HomeHighSpeed { get; set; }
[ConfigProAttribute("BatchAxis_HomeHighSpeed", true)]
public int BatchAxis_HomeHighSpeed { get; set; }
/// <summary>
///PRO (轴五)自动轴P1点 AutoAxis_P1 200
///PRO (轴五)自动轴P1点 BatchAxis_P1 200
/// </summary>
[ConfigProAttribute("AutoAxis_P1", true)]
public int AutoAxis_P1 { get; set; }
[ConfigProAttribute("BatchAxis_P1", true)]
public int BatchAxis_P1 { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点加速度 AutoAxis_HomeAddSpeed 200
/// PRO (轴五)自动轴原点加速度 BatchAxis_HomeAddSpeed 200
/// </summary>
[ConfigProAttribute("AutoAxis_HomeAddSpeed", true)]
public int AutoAxis_HomeAddSpeed { get; set; }
[ConfigProAttribute("BatchAxis_HomeAddSpeed", true)]
public int BatchAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴最小限位 AutoAxis_PositionMin 0
/// PRO (轴五)自动轴最小限位 BatchAxis_PositionMin 0
/// </summary>
[ConfigProAttribute("AutoAxis_PositionMin", true)]
public int AutoAxis_PositionMin { get; set; }
[ConfigProAttribute("BatchAxis_PositionMin", true)]
public int BatchAxis_PositionMin { get; set; }
/// <summary>
/// PRO (轴五)自动轴最大限位 AutoAxis_PositionMax 0
/// PRO (轴五)自动轴最大限位 BatchAxis_PositionMax 0
/// </summary>
[ConfigProAttribute("AutoAxis_PositionMax", true)]
public int AutoAxis_PositionMax { get; set; }
[ConfigProAttribute("BatchAxis_PositionMax", true)]
public int BatchAxis_PositionMax { get; set; }
/// <summary>
/// PRO (轴五)自动轴停止时可误差的脉冲数的最小值 AutoAxis_ErrorCountMin
/// PRO (轴五)自动轴停止时可误差的脉冲数的最小值 BatchAxis_ErrorCountMin
/// </summary>
[ConfigProAttribute("AutoAxis_ErrorCountMin", true)]
public int AutoAxis_ErrorCountMin { get; set; }
[ConfigProAttribute("BatchAxis_ErrorCountMin", true)]
public int BatchAxis_ErrorCountMin { get; set; }
/// <summary>
/// PRO (轴五)自动轴停止时可误差的脉冲数的最大值 AutoAxis_ErrorCountMax
/// PRO (轴五)自动轴停止时可误差的脉冲数的最大值 BatchAxis_ErrorCountMax
/// </summary>
[ConfigProAttribute("AutoAxis_ErrorCountMax", true)]
public int AutoAxis_ErrorCountMax { get; set; }
[ConfigProAttribute("BatchAxis_ErrorCountMax", true)]
public int BatchAxis_ErrorCountMax { get; set; }
/// <summary>
/// PRO (轴五)上料轴P1速度 BatchAxis_P1_Speed 50
/// </summary>
[ConfigProAttribute("BatchAxis_P1_Speed", true)]
public int BatchAxis_P1_Speed { get; set; }
/// <summary>
/// PRO IO模块对应的DI数量 IO_DILength 192.168.200.10#16;192.168.200.11#4
......@@ -567,6 +557,72 @@ namespace OnlineStore.LoadCSVLibrary
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
private Dictionary<int, int> UpDownAxisP1Map = null;
public int GetUpDownP1(int trayHeight)
{
try
{
if (UpDownAxisP1Map == null)
{
UpDownAxisP1Map = new Dictionary<int, int>();
string[] arrayList = UpDownAxis_P1_List.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
int ioip = Convert.ToInt32(arrStr[0]);
int length = Convert.ToInt32(arrStr[1]);
UpDownAxisP1Map.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (UpDownAxisP1Map.ContainsKey(trayHeight))
{
return UpDownAxisP1Map[trayHeight];
}
else
{
LogUtil.error("未找到料盘高度为【"+trayHeight+"】的升降轴P1");
if (UpDownAxisP1Map.Count > 0)
{
List<int> list = new List<int>(UpDownAxisP1Map.Values);
return list[0];
}
}
return 0;
}
public void UpdateUpDownP1(int height, int value)
{
int oldP1 = GetUpDownP1(height);
if (!oldP1.Equals(value))
{
if (UpDownAxisP1Map.ContainsKey(height))
{
UpDownAxisP1Map[height] = value;
}
else
{
UpDownAxisP1Map.Add(height, value);
}
}
string msg = "";
foreach (int key in UpDownAxisP1Map.Keys)
{
msg += key + "#" + UpDownAxisP1Map[key] + ";";
}
this.UpDownAxis_P1_List = msg;
}
public int GetDefaultUpDownP1()
{
return GetUpDownP1(8);
}
public ushort GetDILength(string ip)
{
try
......@@ -647,8 +703,8 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDIList.Add(IO_Type.WidthCheck2);
MustHaveDIList.Add(IO_Type.TrayCheck_LoadMaterial);
MustHaveDIList.Add(IO_Type.OutCheck);
MustHaveDIList.Add(IO_Type.AutoDoor_Open);
MustHaveDIList.Add(IO_Type.AutoDoor_Close);
MustHaveDIList.Add(IO_Type.BatchDoor_Open);
MustHaveDIList.Add(IO_Type.BatchDoor_Close);
MustHaveDIList.Add(IO_Type.TrayCheck_Fixture);
MustHaveDIList.Add(IO_Type.CompressAxis_Check);
......@@ -671,8 +727,8 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDOList.Add(IO_Type.Door_Down);
MustHaveDOList.Add(IO_Type.SuckingDisc_Up);
MustHaveDOList.Add(IO_Type.SuckingDisc_Down);
MustHaveDOList.Add(IO_Type.AutoDoor_Open);
MustHaveDOList.Add(IO_Type.AutoDoor_Close);
MustHaveDOList.Add(IO_Type.BatchDoor_Open);
MustHaveDOList.Add(IO_Type.BatchDoor_Close);
}
public static void ConfigAxis(AUTO_SA_Config Config)
{
......@@ -713,21 +769,21 @@ namespace OnlineStore.LoadCSVLibrary
Config.UpDown_Axis.PositionMin = Config.UpdownAxis_PositionMin;
Config.UpDown_Axis.PositionMax = Config.UpdownAxis_PositionMax;
Config.Auto_Axis.TargetSpeed = Config.AutoAxis_TargetSpeed;
Config.Auto_Axis.AddSpeed = Config.AutoAxis_AddSpeed;
Config.Auto_Axis.DelSpeed = Config.AutoAxis_DelSpeed;
Config.Auto_Axis.HomeAddSpeed = Config.AutoAxis_HomeAddSpeed;
Config.Auto_Axis.HomeHighSpeed = Config.AutoAxis_HomeHighSpeed;
Config.Auto_Axis.HomeLowSpeed = Config.AutoAxis_HomeLowSpeed;
Config.Auto_Axis.CanErrorCountMin = Config.AutoAxis_ErrorCountMin;
Config.Auto_Axis.CanErrorCountMax = Config.AutoAxis_ErrorCountMax;
Config.Auto_Axis.PositionMin = Config.AutoAxis_PositionMin;
Config.Auto_Axis.PositionMax = Config.AutoAxis_PositionMax;
Config.Auto_Axis.DefaultPosition = Config.AutoAxis_P1;
Config.Batch_Axis.TargetSpeed = Config.BatchAxis_TargetSpeed;
Config.Batch_Axis.AddSpeed = Config.BatchAxis_AddSpeed;
Config.Batch_Axis.DelSpeed = Config.BatchAxis_DelSpeed;
Config.Batch_Axis.HomeAddSpeed = Config.BatchAxis_HomeAddSpeed;
Config.Batch_Axis.HomeHighSpeed = Config.BatchAxis_HomeHighSpeed;
Config.Batch_Axis.HomeLowSpeed = Config.BatchAxis_HomeLowSpeed;
Config.Batch_Axis.CanErrorCountMin = Config.BatchAxis_ErrorCountMin;
Config.Batch_Axis.CanErrorCountMax = Config.BatchAxis_ErrorCountMax;
Config.Batch_Axis.PositionMin = Config.BatchAxis_PositionMin;
Config.Batch_Axis.PositionMax = Config.BatchAxis_PositionMax;
Config.Batch_Axis.DefaultPosition = Config.BatchAxis_P1;
Config.Middle_Axis.DefaultPosition = Config.MiddleAxis_P1_Position;
Config.InOut_Axis.DefaultPosition = Config.InOutAxis_P1_Position;
Config.UpDown_Axis.DefaultPosition = Config.UpDownAxis_DoorOPosition_P1;
Config.UpDown_Axis.DefaultPosition = Config.GetDefaultUpDownP1();
}
}
}
......@@ -138,11 +138,11 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 门锁气缸打开端 Door_Open X13 DI-13
/// </summary>
public static string AutoDoor_Open = "Door_Open";
public static string BatchDoor_Open = "Door_Open";
/// <summary>
/// 门锁气缸关闭端 Door_Close X14 DI-14
/// </summary>
public static string AutoDoor_Close = "Door_Close";
public static string BatchDoor_Close = "Door_Close";
/// <summary>
/// 料盘检测2(料叉机构) TrayCheck_Fixture X15 DI-15
/// </summary>
......@@ -169,5 +169,7 @@ namespace OnlineStore.LoadCSVLibrary
public static string SuckingDisc_Work = "SuckingDisc_Work";
public static string TrayCheck_Door = "TrayCheck_Door";
//public static string TrayCheck_Door = "TrayCheck_Door";
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!