Commit a9171799 LN

超时改为3秒,入库验证增加超时处理。出库增加信号检测。

1 个父辈 41b47a48
......@@ -135,6 +135,7 @@
this.btnClearLog = new System.Windows.Forms.Button();
this.lblThisSta = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnConOut = new System.Windows.Forms.Button();
this.lblMoveEquipInfo = new System.Windows.Forms.Label();
this.chbDebug = new System.Windows.Forms.CheckBox();
this.chbAuto = new System.Windows.Forms.CheckBox();
......@@ -154,18 +155,6 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.groupHistory = new System.Windows.Forms.GroupBox();
this.txtHistoryTemp = new System.Windows.Forms.TextBox();
this.btnSelHistory = new System.Windows.Forms.Button();
this.label24 = new System.Windows.Forms.Label();
this.txtHistoryTime = new System.Windows.Forms.TextBox();
this.txtHistoryCount = new System.Windows.Forms.TextBox();
this.label30 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.txtHistoryHum = new System.Windows.Forms.TextBox();
this.txtCurrCount = new System.Windows.Forms.TextBox();
this.label26 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.btnSelTemp = new System.Windows.Forms.Button();
this.txtHum = new System.Windows.Forms.TextBox();
this.label29 = new System.Windows.Forms.Label();
......@@ -205,7 +194,6 @@
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupHistory.SuspendLayout();
this.tabControl2.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
......@@ -223,7 +211,7 @@
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.Location = new System.Drawing.Point(12, 54);
this.lblWarnMsg.Name = "lblWarnMsg";
this.lblWarnMsg.Size = new System.Drawing.Size(1049, 50);
this.lblWarnMsg.Size = new System.Drawing.Size(867, 50);
this.lblWarnMsg.TabIndex = 224;
this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
......@@ -1694,6 +1682,7 @@
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.btnConOut);
this.groupBox3.Controls.Add(this.lblMoveEquipInfo);
this.groupBox3.Controls.Add(this.lblWarnMsg);
this.groupBox3.Controls.Add(this.lblThisSta);
......@@ -1704,6 +1693,19 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "设备状态";
//
// btnConOut
//
this.btnConOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConOut.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnConOut.Location = new System.Drawing.Point(885, 60);
this.btnConOut.Name = "btnConOut";
this.btnConOut.Size = new System.Drawing.Size(183, 39);
this.btnConOut.TabIndex = 273;
this.btnConOut.Text = "忽略检测信号,继续出库";
this.btnConOut.UseVisualStyleBackColor = true;
this.btnConOut.Visible = false;
this.btnConOut.Click += new System.EventHandler(this.btnConOut_Click);
//
// lblMoveEquipInfo
//
this.lblMoveEquipInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
......@@ -1904,7 +1906,6 @@
//
// groupBox7
//
this.groupBox7.Controls.Add(this.groupHistory);
this.groupBox7.Controls.Add(this.btnSelTemp);
this.groupBox7.Controls.Add(this.txtHum);
this.groupBox7.Controls.Add(this.label29);
......@@ -1921,147 +1922,6 @@
this.groupBox7.TabStop = false;
this.groupBox7.Text = "温控器调试";
//
// groupHistory
//
this.groupHistory.Controls.Add(this.txtHistoryTemp);
this.groupHistory.Controls.Add(this.btnSelHistory);
this.groupHistory.Controls.Add(this.label24);
this.groupHistory.Controls.Add(this.txtHistoryTime);
this.groupHistory.Controls.Add(this.txtHistoryCount);
this.groupHistory.Controls.Add(this.label30);
this.groupHistory.Controls.Add(this.label23);
this.groupHistory.Controls.Add(this.txtHistoryHum);
this.groupHistory.Controls.Add(this.txtCurrCount);
this.groupHistory.Controls.Add(this.label26);
this.groupHistory.Controls.Add(this.label22);
this.groupHistory.Location = new System.Drawing.Point(6, 138);
this.groupHistory.Name = "groupHistory";
this.groupHistory.Size = new System.Drawing.Size(532, 177);
this.groupHistory.TabIndex = 260;
this.groupHistory.TabStop = false;
this.groupHistory.Text = "历史记录";
this.groupHistory.Visible = false;
//
// txtHistoryTemp
//
this.txtHistoryTemp.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtHistoryTemp.Location = new System.Drawing.Point(103, 25);
this.txtHistoryTemp.MaxLength = 10;
this.txtHistoryTemp.Name = "txtHistoryTemp";
this.txtHistoryTemp.Size = new System.Drawing.Size(87, 26);
this.txtHistoryTemp.TabIndex = 254;
this.txtHistoryTemp.Text = "0";
//
// btnSelHistory
//
this.btnSelHistory.Location = new System.Drawing.Point(369, 106);
this.btnSelHistory.Name = "btnSelHistory";
this.btnSelHistory.Size = new System.Drawing.Size(137, 33);
this.btnSelHistory.TabIndex = 259;
this.btnSelHistory.Text = "查询记录信息";
this.btnSelHistory.UseVisualStyleBackColor = true;
this.btnSelHistory.Click += new System.EventHandler(this.btnSelHistory_Click);
//
// label24
//
this.label24.AutoSize = true;
this.label24.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label24.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label24.Location = new System.Drawing.Point(226, 32);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(71, 17);
this.label24.TabIndex = 249;
this.label24.Text = "记录总条数:";
this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtHistoryTime
//
this.txtHistoryTime.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtHistoryTime.Location = new System.Drawing.Point(103, 109);
this.txtHistoryTime.MaxLength = 10;
this.txtHistoryTime.Name = "txtHistoryTime";
this.txtHistoryTime.Size = new System.Drawing.Size(224, 26);
this.txtHistoryTime.TabIndex = 258;
this.txtHistoryTime.Text = "0";
//
// txtHistoryCount
//
this.txtHistoryCount.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtHistoryCount.Location = new System.Drawing.Point(324, 23);
this.txtHistoryCount.MaxLength = 10;
this.txtHistoryCount.Name = "txtHistoryCount";
this.txtHistoryCount.Size = new System.Drawing.Size(87, 26);
this.txtHistoryCount.TabIndex = 250;
this.txtHistoryCount.Text = "0";
//
// label30
//
this.label30.AutoSize = true;
this.label30.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label30.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label30.Location = new System.Drawing.Point(29, 114);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(59, 17);
this.label30.TabIndex = 257;
this.label30.Text = "记录时间:";
this.label30.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label23.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label23.Location = new System.Drawing.Point(226, 68);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(83, 17);
this.label23.TabIndex = 251;
this.label23.Text = "当前指针位置:";
this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtHistoryHum
//
this.txtHistoryHum.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtHistoryHum.Location = new System.Drawing.Point(103, 65);
this.txtHistoryHum.MaxLength = 10;
this.txtHistoryHum.Name = "txtHistoryHum";
this.txtHistoryHum.Size = new System.Drawing.Size(87, 26);
this.txtHistoryHum.TabIndex = 256;
this.txtHistoryHum.Text = "0";
//
// txtCurrCount
//
this.txtCurrCount.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCurrCount.Location = new System.Drawing.Point(324, 64);
this.txtCurrCount.MaxLength = 10;
this.txtCurrCount.Name = "txtCurrCount";
this.txtCurrCount.Size = new System.Drawing.Size(87, 26);
this.txtCurrCount.TabIndex = 252;
this.txtCurrCount.Text = "0";
//
// label26
//
this.label26.AutoSize = true;
this.label26.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label26.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label26.Location = new System.Drawing.Point(17, 72);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(71, 17);
this.label26.TabIndex = 255;
this.label26.Text = "记录湿度值:";
this.label26.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label22.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label22.Location = new System.Drawing.Point(17, 32);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(71, 17);
this.label22.TabIndex = 253;
this.label22.Text = "记录温度值:";
this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnSelTemp
//
this.btnSelTemp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
......@@ -2421,8 +2281,6 @@
this.tabPage2.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupHistory.ResumeLayout(false);
this.groupHistory.PerformLayout();
this.tabControl2.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
......@@ -2572,18 +2430,6 @@
private System.Windows.Forms.Button btnClearL;
private System.Windows.Forms.Button btnStoreStart;
private System.Windows.Forms.Button btnDebug;
private System.Windows.Forms.TextBox txtHistoryTemp;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox txtCurrCount;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox txtHistoryCount;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.TextBox txtHistoryTime;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.TextBox txtHistoryHum;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Button btnSelHistory;
private System.Windows.Forms.GroupBox groupHistory;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button3;
......@@ -2604,6 +2450,7 @@
private System.Windows.Forms.TextBox lblTargetP4;
private System.Windows.Forms.TextBox lblActual4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button btnConOut;
}
}
......@@ -38,28 +38,21 @@ namespace OnlineStore.ACSingleStore
private void FrmTest_Load(object sender, EventArgs e)
{
string version = GetVersion(true );
string version = GetVersion(true);
LogUtil.logBox = this.richTextBox1;
LoadStore();
chbDebug.Checked = store.IsDebug;
this.ShowInTaskbar = true;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title)+"_"+store.StoreID;
groupBox3.Text = "设备["+store.CID+"]状态";
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title) + "_" + store.StoreID;
groupBox3.Text = "设备[" + store.CID + "]状态";
notifyIcon1.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
//cmbHomeType.SelectedIndex = 1;
HideForm();
this.Opacity = 1;
txtTempPort.Text = store.Config.Humiture_Port;
if (HumitureController.HumitureControllerType.Equals(1))
{
groupHistory.Visible = true;
}
else
{
groupHistory.Visible = false;
}
LoadOk = true;
}
private void LoadStore()
......@@ -122,7 +115,7 @@ namespace OnlineStore.ACSingleStore
//}
//cmbHomeType.SelectedIndex = 0;
timer1.Enabled = true;
}
}
#endregion
......@@ -157,22 +150,22 @@ namespace OnlineStore.ACSingleStore
preOpen = isOpen;
btnOutStore.Enabled = isOpen;
btnInStore.Enabled = isOpen;
btnInStore.Enabled = isOpen;
btnStoreStart.Enabled = !isOpen;
btnSotreReset.Enabled = isOpen;
btnStoreStop.Enabled = isOpen;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (!this.Visible)
{
return;
}
// button6_Click(null, null);
// timer1.Interval = 300;
// button6_Click(null, null);
// timer1.Interval = 300;
if (chbDebug.Checked.Equals(store.IsDebug).Equals(false))
{
LoadOk = false;
......@@ -180,7 +173,7 @@ namespace OnlineStore.ACSingleStore
LoadOk = true;
}
lblTemp.Text = store.currTempStr;
lblMoveEquipInfo.Text = "移栽状态:"+(LineConnect.CanStartOut() ? "可出库":"不可出库" )+" "+LineConnect.LastUpdateTime.ToLongTimeString()+"" ;
lblMoveEquipInfo.Text = "移栽状态:" + (LineConnect.CanStartOut() ? "可出库" : "不可出库") + " " + LineConnect.LastUpdateTime.ToLongTimeString() + "";
//忙碌状态不读取状态
if (!store.storeRunStatus.Equals(StoreRunStatus.Busy))
{
......@@ -195,7 +188,10 @@ namespace OnlineStore.ACSingleStore
}
lblThisSta.Text = store.GetRunStr();
if (store.OutCheckAlarm())
{
btnConOut.Visible = true;
}
//复位按钮状态显示
if (btnSotreReset.Enabled == false)
{
......@@ -225,22 +221,12 @@ namespace OnlineStore.ACSingleStore
}
lblWarnMsg.Text = store.WarnMsg;
//if (store.Config.IsHasDoorLimit.Equals(1))
//{
// if (IOManager.IOValue(IO_Type.Door_LimitSingle).Equals(IO_VALUE.LOW))
// {
// lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关";
// }
//}
//如果不在出入库中,且叉子上有信号,需要提示检查叉子
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
lblWarnMsg.Text = lblWarnMsg.Text + " 叉子料盘检测有料,请检查";
}
//if (IOManager.IOValue(IO_Type.DoorLimit).Equals(IO_VALUE.LOW))
//{
// lblWarnMsg.Text = lblWarnMsg.Text + " 无门禁信号,请检查";
//}
if (store.TempOrHumidityIsAlarm)
{
lblWarnMsg.Text = lblWarnMsg.Text + " 温湿度报警[" + store.TempAlarmTime.ToLongTimeString() + "]";
......@@ -292,7 +278,8 @@ namespace OnlineStore.ACSingleStore
lblThisSta.Text = "等待启动";
lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库";
}
btnConOut.Visible = false;
}
}
private void ReadPosistion()
......@@ -302,7 +289,7 @@ namespace OnlineStore.ACSingleStore
//判断私服是否打开、
if (ACServerManager.ServerOnStatus(portName, SlvAddr))
{
txtServoStatue.Text = "✔";
txtServoStatue.Text = "✔";
}
else
{
......@@ -312,9 +299,9 @@ namespace OnlineStore.ACSingleStore
ReadA(store.Config.UpDown_Axis, lblActual2, lblTargetP2, txtUpdownTarget, axis_2_Alarm);
ReadA(store.Config.InOut_Axis, lblActual3, lblTargetP3, txtInoutTarget, axis_3_Alarm);
ReadA(store.Config.Comp_Axis, lblActual4, lblTargetP4, txt4Target, axis_4_Alarm);
}
private void ReadA(ConfigMoveAxis axis,TextBox lblActual, TextBox lblTarget,TextBox lblT, IOStatusControl sta)
private void ReadA(ConfigMoveAxis axis, TextBox lblActual, TextBox lblTarget, TextBox lblT, IOStatusControl sta)
{
string portName = GetPortName();
int SlvAddr = GetSlaveAddr();
......@@ -372,7 +359,7 @@ namespace OnlineStore.ACSingleStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartOutStoreMove(new InOutParam(new InOutPosInfo( "", selectPositionNum), ktk));
store.StartOutStoreMove(new InOutParam(new InOutPosInfo("", selectPositionNum), ktk));
}
else
{
......@@ -386,7 +373,7 @@ namespace OnlineStore.ACSingleStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartInStoreMove(new InOutParam(new InOutPosInfo( "", selectPositionNum), ktk));
store.StartInStoreMove(new InOutParam(new InOutPosInfo("", selectPositionNum), ktk));
}
else
{
......@@ -503,20 +490,20 @@ namespace OnlineStore.ACSingleStore
// MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
//}
if ( store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.InOutAxisCanMove().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.InOutAxisCanMove().Equals(false)))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else if ( store.Config.Middle_Axis.IsSameAxis(portName, SlvAddr) || store.Config.UpDown_Axis.IsSameAxis(portName, SlvAddr))
else if (store.Config.Middle_Axis.IsSameAxis(portName, SlvAddr) || store.Config.UpDown_Axis.IsSameAxis(portName, SlvAddr))
{
if (!InOutIsIsP1())
{
return;
}
}
LogUtil.info("点击【绝对运动】,端口号【"+ portName + "】地址【" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
ACServerManager.AbsMove(portName, SlvAddr, position, speed );
LogUtil.info("点击【绝对运动】,端口号【" + portName + "】地址【" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
ACServerManager.AbsMove(portName, SlvAddr, position, speed);
}
private void btnAxisVMove_Click(object sender, EventArgs e)
{
......@@ -537,7 +524,7 @@ namespace OnlineStore.ACSingleStore
}
}
LogUtil.info("点击【匀速运动】,端口号【" + portName + "】地址【" + SlvAddr + "】 速度【" + speed + "】");
ACServerManager.SpeedMove(portName, SlvAddr, speed);
ACServerManager.SpeedMove(portName, SlvAddr, speed);
}
private void btnAxisRMove_Click(object sender, EventArgs e)
......@@ -571,7 +558,7 @@ namespace OnlineStore.ACSingleStore
ACServerManager.RelMove(portName, SlvAddr, position, speed);
}
private void btnAxisStop_Click(object sender, EventArgs e)
{
......@@ -707,13 +694,13 @@ namespace OnlineStore.ACSingleStore
/// </summary>
private bool InOutIsIsP1()
{
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
int currValue = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
int currValue = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
if (currValue <= InOutDefaultPosition)
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位("+InOutDefaultPosition+")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void btnCloseAxis_Click(object sender, EventArgs e)
......@@ -725,13 +712,13 @@ namespace OnlineStore.ACSingleStore
}
private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{
moveAxis.TargetPosition = targetPosition;
moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
}
private void btnUpDownP1_Click(object sender, EventArgs e)
{
if (InOutIsIsP1())
{
{
int value = FormUtil.GetIntValue(txtUpDownP1);
AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_P1_Speed);
}
......@@ -914,7 +901,7 @@ namespace OnlineStore.ACSingleStore
{
MessageBox.Show("请先启动料仓!");
}
}
}
private void 轴卡点动ToolStripMenuItem_Click(object sender, EventArgs e)
{
button1_Click(null, null);
......@@ -938,7 +925,7 @@ namespace OnlineStore.ACSingleStore
private void 复位ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.store.Reset();
btnSotreReset.Enabled = false;
btnSotreReset.Enabled = false;
}
private void 查看IOToolStripMenuItem_Click(object sender, EventArgs e)
......@@ -953,12 +940,12 @@ namespace OnlineStore.ACSingleStore
private void 开启DEBUGToolStripMenuItem_Click(object sender, EventArgs e)
{
if (LogUtil.debug_opened == false)
{
{
btnLogDebug.Text = "关闭DEBUG";
LogUtil.debug_opened = true;
}
else
{
{
btnLogDebug.Text = "开启DEBUG";
LogUtil.debug_opened = false;
}
......@@ -973,13 +960,13 @@ namespace OnlineStore.ACSingleStore
private void 料仓运转ONToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Enabled = false;
store.RunAxis(false );
store.RunAxis(false);
this.Enabled = true;
LogUtil.info("料仓运转ON完成");
}
private void 打开舱门ToolStripMenuItem_Click(object sender, EventArgs e)
{
{
StoreManager.Store.OpenDoor(false);
}
......@@ -990,7 +977,7 @@ namespace OnlineStore.ACSingleStore
}
private void 关闭仓门ToolStripMenuItem_Click(object sender, EventArgs e)
{
{
StoreManager.Store.CloseDoor(false);
}
......@@ -1012,9 +999,9 @@ namespace OnlineStore.ACSingleStore
MessageBox.Show("请先启动料仓!");
}
}
private void FrmStoreBox_Shown(object sender, EventArgs e)
{
{
this.btnUpDownP1.ForeColor = System.Drawing.Color.Red;
this.btnUpDownP2.ForeColor = System.Drawing.Color.Red;
this.btnUpDownP3.ForeColor = System.Drawing.Color.Red;
......@@ -1038,8 +1025,8 @@ namespace OnlineStore.ACSingleStore
}
private int GetSlaveAddr()
{
return FormUtil.GetShortValue(txtAxisValue);
......@@ -1124,9 +1111,9 @@ namespace OnlineStore.ACSingleStore
this.ShowInTaskbar = true;
DebugStatus(false);
}
catch(Exception ex)
catch (Exception ex)
{
LogUtil.error("显示界面出错:"+ex.ToString());
LogUtil.error("显示界面出错:" + ex.ToString());
}
}
private void ExitApp()
......@@ -1147,7 +1134,7 @@ namespace OnlineStore.ACSingleStore
IOManager.instance.CloseAllConnection();
ACServerManager.CloseAllPort();
// KNDAIManager.CloseAllConnection();
// KNDAIManager.CloseAllConnection();
//WCFControl.CloseWCF();
System.Environment.Exit(System.Environment.ExitCode);
}
......@@ -1159,7 +1146,7 @@ namespace OnlineStore.ACSingleStore
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("是否确定退出?", "提示", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
DialogResult result = MessageBox.Show("是否确定退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result.Equals(DialogResult.Yes))
{
ExitApp();
......@@ -1183,12 +1170,12 @@ namespace OnlineStore.ACSingleStore
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("是否确定退出?", "提示", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
DialogResult result = MessageBox.Show("是否确定退出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result.Equals(DialogResult.Yes))
{
ExitApp();
}
}
}
private void btnTempInit_Click(object sender, EventArgs e)
{
string port = txtTempPort.Text.ToString();
......@@ -1217,7 +1204,7 @@ namespace OnlineStore.ACSingleStore
//IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
StoreManager.Store.OpenDoor(false);
}
private void btnClearL_Click(object sender, EventArgs e)
{
LogUtil.ClearLog();
......@@ -1255,27 +1242,8 @@ namespace OnlineStore.ACSingleStore
}
}
private void btnSelHistory_Click(object sender, EventArgs e)
{
int count = HumitureController.QueryHistoryCount();
txtHistoryCount.Text = count.ToString();
int cuCount = HumitureController.QueryCurrCount();
txtCurrCount.Text = cuCount.ToString();
List<object> data = HumitureController.QueryHistory();
if (data.Count >= 3)
{
txtHistoryTemp.Text = data[0].ToString();
txtHistoryHum.Text = data[1].ToString();
txtHistoryTime.Text = data[2].ToString();
}
}
private void btnCloseDoor_Click(object sender, EventArgs e)
{
//IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
//IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
StoreManager.Store.CloseDoor(false);
}
......@@ -1314,7 +1282,7 @@ namespace OnlineStore.ACSingleStore
}
private void chbDebug_CheckedChanged(object sender, EventArgs e)
{
{
if (!LoadOk)
{
return;
......@@ -1340,7 +1308,7 @@ namespace OnlineStore.ACSingleStore
DialogResult result = MessageBox.Show("是否切换到正常工作状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
store.IsDebug = false ;
store.IsDebug = false;
ConfigAppSettings.SaveValue(Setting_Init.IsInDebug, 0);
LogUtil.info("用户切换到正常工作状态 ");
}
......@@ -1390,5 +1358,11 @@ namespace OnlineStore.ACSingleStore
{
LogUtil.UpdateLogbox();
}
private void btnConOut_Click(object sender, EventArgs e)
{
btnConOut.Visible = false;
store.ContinueOut();
}
}
}
......@@ -19,89 +19,52 @@ namespace OnlineStore.Common
public class HttpHelper
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
{
return Post(url, paramData, Encoding.UTF8);
}
//public static bool PingURLIP(string url, int ms = 100)
//{
// string[] urlArray = url.Split('/');
// if (urlArray.Length > 3)
// {
// string ip = urlArray[2];
// Ping pingSender = new Ping();
// PingReply reply = pingSender.Send(ip, ms);//第一个参数为ip地址,第二个参数为ping的时间
// if (reply.Status == IPStatus.Success)
// {
// //通
// return true;
// }
// else
// {
// //不通
// return false;
// }
// }
// return true;
//}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="operation"></param>
/// <param name="simulate">是否模拟服务器返回结果</param>
/// <returns></returns>
public static Operation Post(string url, Operation operation, bool simulate)
public static Operation Post(string url, Operation operation,out bool isTimeOut)
{
isTimeOut = false;
try
{ //如果Op=0或者Op=5,先拼Ip,不通不发送
//if (operation.op < 0 || operation.op.Equals(5))
//{
// if (PingURLIP(url, 100).Equals(false))
// {
// return null;
{
//if (simulate)
//{//模拟服务器返回
// operation.status = 200;
// operation.data.Clear();
// operation.data.Add("posId", "A001");
// string pos = "D100-111#D102-222#D104-333";
// operation.data.Add("pos", pos);
// if (operation.op == 1 || operation.op == 2)
// {//入库或出库
// string json = JsonHelper.SerializeObject(operation);
// LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
// return operation;
// }
//}
if (simulate)
{//模拟服务器返回
operation.status = 200;
operation.data.Clear();
operation.data.Add("posId", "A001");
string pos = "D100-111#D102-222#D104-333";
operation.data.Add("pos", pos);
if (operation.op == 1 || operation.op == 2)
{//入库或出库
string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
return operation;
}
//else
//{
string json = "";
try
{
json = JsonHelper.SerializeObject(operation);
}
catch (Exception ex)
{
LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
}
else
string result = Post(url, json, Encoding.UTF8, out isTimeOut);
if (!string.IsNullOrEmpty(result))
{
string json = "";
try
{
json = JsonHelper.SerializeObject(operation);
return JsonHelper.DeserializeJsonToObject<Operation>(result);
}
catch (Exception ex)
{
LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
}
string result = Post(url, json);
if (!string.IsNullOrEmpty(result))
{
try
{
return JsonHelper.DeserializeJsonToObject<Operation>(result);
}
catch (Exception ex)
{
LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
}
LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
}
}
//}
}
catch (Exception ex)
{
......@@ -110,12 +73,9 @@ namespace OnlineStore.Common
return null;
}
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding)
public static string Post(string url, string paramData, Encoding encoding, out bool IsTimeOut)
{
//if (PingURLIP(url, 100).Equals(false))
//{
// return null;
//}
IsTimeOut = false;
if (isLog == 1)
{
LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
......@@ -134,7 +94,7 @@ namespace OnlineStore.Common
try
{
var wc = new MyWebClient(10000);
var wc = new MyWebClient(3000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = encoding;
......@@ -142,6 +102,11 @@ namespace OnlineStore.Common
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (WebException ex)
{
IsTimeOut = true;
LogUtil.error(LOGGER, "POST WebException :" + ex.ToString(), 101);
}
catch (Exception e)
{
LogUtil.error(LOGGER, "POST ERROR:" + e.ToString(), 1);
......@@ -157,30 +122,30 @@ namespace OnlineStore.Common
return result;
}
public static string Get(string url)
{
return Get(url, Encoding.UTF8);
}
//public static string Get(string url)
//{
// return Get(url, Encoding.UTF8);
//}
public static string Get(string url, Encoding encoding)
{
try
{
LogUtil.info(LOGGER, "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.info(LOGGER, "receive << " + result);
return result;
}
}
catch (Exception e)
{
LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2);
}
return "";
}
//public static string Get(string url, Encoding encoding)
//{
// try
// {
// LogUtil.info(LOGGER, "HTTP GET FROM: " + url);
// var wc = new WebClient { Encoding = encoding };
// var readStream = wc.OpenRead(url);
// using (var sr = new StreamReader(readStream, encoding))
// {
// var result = sr.ReadToEnd();
// LogUtil.info(LOGGER, "receive << " + result);
// return result;
// }
// }
// catch (Exception e)
// {
// LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2);
// }
// return "";
//}
}
}
\ No newline at end of file
......@@ -1252,31 +1252,39 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(LOGGER, logName + " 设备未启动,验证失败");
return false;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.debug(LOGGER, logName + "发送给服务器验证入库PosID");
}
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() }, { "rfid", rfid } };
operation.data.Add("inPos", posId);
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
for (int i = 1; i <= 3; i++)
{
//如果有提示消息,直接显示提示
LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
bool timeOut = false;
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, out timeOut);
if (timeOut)
{
LogUtil.info(LOGGER, logName + " 第" + i + "次发送超时 ");
continue;
}
if (resultOperation == null)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
//如果有提示消息,直接显示提示
LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
}
else if (resultOperation.op.Equals(1))
{
LogUtil.info(LOGGER, logName + " 成功");
return true;
}
else if (resultOperation.op.Equals(1))
{
LogUtil.info(LOGGER, logName + " 成功");
return true;
}
break;
}
}
catch (Exception ex)
......@@ -1621,7 +1629,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
bool isTimeout = false;
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, out isTimeout);
//发送状态信息到服务器
if (resultOperation == null || (resultOperation.op <= 0))
......
......@@ -169,10 +169,14 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut;
if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_27_WaitTake))
if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake))
{
timeOutMs = 650000;
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_26_CheckTray))
{
timeOutMs = 5000;
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -182,7 +186,7 @@ namespace OnlineStore.DeviceLibrary
isOk = false;
break;
}
else if ((!wait.IsEnd) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_27_WaitTake) && LineConnect.CanReSend())
else if ((!wait.IsEnd) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake) && LineConnect.CanReSend())
{
//判断是否需要重发入库结束命令
SendOutStoreEnd(StoreMove);
......@@ -222,7 +226,7 @@ namespace OnlineStore.DeviceLibrary
//{
// LogUtil.debug("等待height=" + wait.HeightValue + "完成");
//}
}
}
if (wait.IsEnd)
{
if (StoreMove.OneWaitCanEndStep)
......@@ -233,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (!StoreMove.OneWaitCanEndStep )
if (!StoreMove.OneWaitCanEndStep)
{
isOk = false;
break;
......@@ -245,15 +249,15 @@ namespace OnlineStore.DeviceLibrary
StoreMove.EndStepWait();
}
else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{
{
WarnMsg = StoreName + "[" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] 等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(LOGGER, WarnMsg,100);
LogUtil.error(LOGGER, WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
}
}
}
private static DateTime lastComRHomeTime = DateTime.Now;
#endregion
......@@ -304,14 +308,14 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, StoreName + " 启动【" + posId + "】入库出错,当前状态,storeStatus=" + storeRunStatus);
}
}
}
private void SI_02_Move(LineMoveP moveP)
{
private void SI_02_Move(LineMoveP moveP)
{
InStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1,打开舱门");
StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
OpenDoor();
StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
OpenDoor();
InOutBackToP1(moveP.InOut_P1);
}
private void SI_05_DeviceToDoor()
......@@ -353,7 +357,7 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog(" 入库:SI_00 入库等待仓门口料盘信号");
StoreMove.NextMoveStep(StoreMoveStep.SI_00_TrayCheck);
StoreMove.TimeOutSeconds = 5;
StoreMove.TimeOutSeconds = 5;
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
//WarnMsg = StoreName + "入库未检测到料盘[" + StoreMove.MoveParam.PosInfo.barcode + "][" + StoreMove.MoveParam.PosInfo.PosId + "]";
......@@ -371,14 +375,14 @@ namespace OnlineStore.DeviceLibrary
}
}
if (StoreMove.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
{
{
SI_02_Move(moveP);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
{
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
ComMoveToPosition(moveP.ComPress_P3,Config.CompAxis_P3_Speed);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
......@@ -388,7 +392,7 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_04_CompressWare 压紧物品(有压紧轴的才需要此步骤),压紧轴至P3(压紧前点) 开始");
StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
ComMoveToPosition(moveP.ComPress_P3,Config.CompAxis_P3_Speed);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
OpenDoor();
}
else
......@@ -397,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_04_CompressWare)
{
{
SI_05_DeviceToDoor();
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_05_DeviceToDoor)
......@@ -405,7 +409,7 @@ namespace OnlineStore.DeviceLibrary
//NeedCheckSafetyLight = 0;
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2,Config.CompAxis_P2_Speed);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
......@@ -432,7 +436,7 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_08 定位气缸伸出 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_08_LocationCylinder_Up);
LocationUpAndWait();
LocationUpAndWait();
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_08_LocationCylinder_Up)
......@@ -481,14 +485,14 @@ namespace OnlineStore.DeviceLibrary
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3,Config.CompAxis_P3_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
{
InStoreLog("入库:SI_13 叉子从库位中返回,进出轴动作至P1(待机点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_13_DeviceBackFromBag);
InOutBackToP1(moveP.InOut_P1);
}
......@@ -496,7 +500,7 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_14 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_GoBack);
ComMoveToPosition(moveP.ComPress_P1,Config.CompAxis_P1_Speed);
ComMoveToPosition(moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoor();
......@@ -515,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
else
{
LogUtil.info(LOGGER, StoreName + " 入库,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
}
}
}
......@@ -588,7 +592,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagP)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_04_InoutToP3);
OutStoreLog("出库: 进出轴至P3(库位取放料点) ["+ moveP.InOut_P3 + "] ");
OutStoreLog("出库: 进出轴至P3(库位取放料点) [" + moveP.InOut_P3 + "] ");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_04_InoutToP3)
......@@ -620,7 +624,7 @@ namespace OnlineStore.DeviceLibrary
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料盘有料";
LogUtil.error(CodeMsg);
}
if (StoreMove.MoveParam.LoadLocationP() )
if (StoreMove.MoveParam.LoadLocationP())
{
StoreMove.NextMoveStep(StoreMoveStep.SOL_11_MoveToBag);
OutStoreLog("出库定位:旋转轴 至P2( 库位点)升降轴到P3(库位入库前点) ");
......@@ -638,7 +642,7 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.SOL_12_InoutToP3);
int p = StoreMove.MoveParam.LocationPos.InOutAxis_Position_P3;
OutStoreLog("出库定位:进出轴到P3(库位取放料点)["+p+"] ");
OutStoreLog("出库定位:进出轴到P3(库位取放料点)[" + p + "] ");
ACAxisMove(Config.InOut_Axis, p, Config.InOutAxis_P3_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SOL_12_InoutToP3)
......@@ -658,7 +662,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SOL_15_GetWare);
OutStoreLog("出库定位:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点) ");
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.LocationPos.UpDownAxis_OHPosition_P6, Config.UpDownAxis_P6_Speed);
ACAxisMove(Config.Comp_Axis, StoreMove.MoveParam.MoveP.ComPress_P2 , Config.CompAxis_P2_Speed);
ACAxisMove(Config.Comp_Axis, StoreMove.MoveParam.MoveP.ComPress_P2, Config.CompAxis_P2_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SOL_15_GetWare)
{
......@@ -671,7 +675,7 @@ namespace OnlineStore.DeviceLibrary
SO_21_ToDoorP();
}
#endregion
else if (StoreMove.MoveStep == StoreMoveStep.SO_21_ToDoorP)
{
......@@ -699,14 +703,15 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_25_InoutToP1)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_26_GoBack);
OutStoreLog("出库:轴2至P1(待机点) ,关闭舱门");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoor();
//发送消息给流水线
SendOutStoreEnd(StoreMove);
StoreMove.NextMoveStep(StoreMoveStep.SO_26_CheckTray);
OutStoreLog("出库:检测料仓门口料盘信号 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_26_GoBack)
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_26_CheckTray))
{
SO_27_GoBack();
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_27_GoBack)
{
int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
if (OutStoreWaitSeconds <= 0)
......@@ -714,14 +719,14 @@ namespace OnlineStore.DeviceLibrary
OutStoreWaitSeconds = 600;
}
int ms = OutStoreWaitSeconds * 1000;
StoreMove.NextMoveStep(StoreMoveStep.SO_27_WaitTake);
StoreMove.NextMoveStep(StoreMoveStep.SO_28_WaitTake);
OutStoreLog("出库: 等待拿走物品,最多等待" + 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 if (StoreMove.MoveStep == StoreMoveStep.SO_27_WaitTake)
else if (StoreMove.MoveStep == StoreMoveStep.SO_28_WaitTake)
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
......@@ -738,8 +743,34 @@ namespace OnlineStore.DeviceLibrary
}
}
public bool OutCheckAlarm()
{
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut) && StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_26_CheckTray))
{
return true;
}
return false;
}
public void ContinueOut()
{
if (OutCheckAlarm())
{
LogUtil.info(StoreName + "执行用户操作:忽略检测信号,继续出库");
StoreMove.EndStepWait();
}
}
private void SO_27_GoBack()
{
StoreMove.NextMoveStep(StoreMoveStep.SO_27_GoBack);
OutStoreLog("出库:轴2至P1(待机点) ,关闭舱门");
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoor();
//发送消息给流水线
SendOutStoreEnd(StoreMove);
}
private void SO_21_ToDoorP()
{
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
StoreMove.NextMoveStep(StoreMoveStep.SO_21_ToDoorP);
OutStoreLog("出库:旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门 ");
......@@ -755,7 +786,7 @@ namespace OnlineStore.DeviceLibrary
ss = (int)StoreStatus.Debugging;
}
StoreSendBean store = new StoreSendBean(Config.Id, Config.CID, (int)storeStatus, (int)storeRunStatus, hasTray, (int)alarmType);
store.data.Add(ParamDefine.posId,StoreMove.MoveParam.PosInfo.PosId);
store.data.Add(ParamDefine.posId, StoreMove.MoveParam.PosInfo.PosId);
store.data.Add(ParamDefine.plateH, StoreMove.MoveParam.PosInfo.PlateH.ToString());
store.data.Add(ParamDefine.plateW, StoreMove.MoveParam.PosInfo.PlateW.ToString());
store.data.Add(ParamDefine.cutReel, StoreMove.MoveParam.PosInfo.cutReel.ToString());
......@@ -791,7 +822,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SO_22_WaitNoTray);
OpenDoor();
}
}
public bool InOutAxisCanMove()
{
......@@ -811,7 +842,7 @@ namespace OnlineStore.DeviceLibrary
}
private void LocationUpAndWait()
{
if (Config.IsHasLocationCylinder>=1)
if (Config.IsHasLocationCylinder >= 1)
{
IOManager.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
......@@ -823,7 +854,7 @@ namespace OnlineStore.DeviceLibrary
}
private void LocationDownAndWait()
{
if (Config.IsHasLocationCylinder>=1)
if (Config.IsHasLocationCylinder >= 1)
{
IOManager.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
......@@ -859,7 +890,7 @@ namespace OnlineStore.DeviceLibrary
}
if (storeMoveType.Equals(StoreMoveType.InStore))
{
int newIndex = autoPositionIndex - 1;
int newIndex = autoPositionIndex - 1;
if (newIndex < 0)
{
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
......@@ -956,7 +987,7 @@ namespace OnlineStore.DeviceLibrary
private void InStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
}
private void OutStoreLog(string msg)
{
......
......@@ -256,13 +256,17 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
SO_25_InoutToP1,
/// <summary>
/// 料仓出库,检测料仓门口信号
/// </summary>
SO_26_CheckTray,
/// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary>
SO_26_GoBack,
SO_27_GoBack,
/// <summary>
/// 等待拿走物品
/// </summary>
SO_27_WaitTake,
SO_28_WaitTake,
#endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!