Commit 48ff972a LN

入库调试

1 个父辈 19012230
......@@ -40,7 +40,7 @@
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="192.168.103.22" />
<!--IO配置-->
<add key ="DIMS" value ="120"/>
<add key ="DIMS" value ="60"/>
<add key ="DOMS" value ="300"/>
<add key ="LineRunTest" value ="1"/>
<!--ABB机器人服务器-->
......@@ -49,7 +49,7 @@
<add key ="OpenRFIDWrite" value ="1"/>
<add key="DefaultPWD" value ="123456"/>
<!--当前调试的设备ID,分号分割-->
<add key ="DebugDeviceId" value ="104"/>
<add key ="DebugDeviceId" value ="103"/>
<add key ="NeedScanCode" value ="1"/>
</appSettings>
<log4net>
......
......@@ -40,7 +40,7 @@
//
// timer1
//
this.timer1.Interval = 3000;
this.timer1.Interval = 10000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lblConInfo
......
......@@ -40,8 +40,8 @@ namespace OnlineStore.AssemblyLine
lblRFID.Text = "RFID信息:\r\n";
msg = "";
List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
foreach (string ip in tList)
List<string> rfidList = new List<string>(LineManager.Line. rfidList);
foreach (string ip in rfidList)
{
string con = TrayManager.ReadRFID(ip) .ToStr() ;
msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n";
......
......@@ -34,6 +34,7 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnClearTray = new System.Windows.Forms.Button();
this.btnTrayInfo = new System.Windows.Forms.Button();
this.lblCID = new System.Windows.Forms.Label();
this.chbAutoRun = new System.Windows.Forms.CheckBox();
......@@ -123,7 +124,7 @@
this.lblMoveInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.Location = new System.Drawing.Point(18, 496);
this.lblMoveInfo.Location = new System.Drawing.Point(18, 471);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(29, 17);
this.lblMoveInfo.TabIndex = 196;
......@@ -133,6 +134,7 @@
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.btnClearTray);
this.groupBox2.Controls.Add(this.btnTrayInfo);
this.groupBox2.Controls.Add(this.lblCID);
this.groupBox2.Controls.Add(this.chbAutoRun);
......@@ -146,6 +148,19 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "状态信息";
//
// btnClearTray
//
this.btnClearTray.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearTray.BackColor = System.Drawing.Color.White;
this.btnClearTray.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClearTray.Location = new System.Drawing.Point(334, 12);
this.btnClearTray.Name = "btnClearTray";
this.btnClearTray.Size = new System.Drawing.Size(105, 35);
this.btnClearTray.TabIndex = 196;
this.btnClearTray.Text = "清空托盘信息";
this.btnClearTray.UseVisualStyleBackColor = false;
this.btnClearTray.Click += new System.EventHandler(this.btnClearTray_Click);
//
// btnTrayInfo
//
this.btnTrayInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
......@@ -323,7 +338,7 @@
this.listView1.Location = new System.Drawing.Point(9, 7);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(433, 475);
this.listView1.Size = new System.Drawing.Size(433, 460);
this.listView1.TabIndex = 191;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
......@@ -398,61 +413,61 @@
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6);
//
// 启动AToolStripMenuItem
//
this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem";
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.启动AToolStripMenuItem.Text = "启动 ";
this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6);
//
// 复位RToolStripMenuItem
//
this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem";
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.复位RToolStripMenuItem.Text = "复位";
this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6);
//
// 停止TToolStripMenuItem
//
this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem";
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.停止TToolStripMenuItem.Text = "停止";
this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6);
//
// 入库模式ToolStripMenuItem
//
this.入库模式ToolStripMenuItem.Name = "入库模式ToolStripMenuItem";
this.入库模式ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.入库模式ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.入库模式ToolStripMenuItem.Text = "入库模式";
this.入库模式ToolStripMenuItem.Visible = false;
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator2.Visible = false;
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1);
//
......@@ -473,7 +488,7 @@
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Visible = false;
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
......@@ -481,26 +496,26 @@
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(159, 6);
this.toolStripSeparator6.Visible = false;
//
// 二维码学习ToolStripMenuItem
//
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(159, 6);
this.toolStripSeparator7.Visible = false;
//
// 托盘初始化ToolStripMenuItem
//
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
this.托盘初始化ToolStripMenuItem.Visible = false;
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
......@@ -508,12 +523,12 @@
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(159, 6);
//
// iO模块状态ToolStripMenuItem
//
this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem";
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(162, 26);
this.iO模块状态ToolStripMenuItem.Text = "IO模块状态";
this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click);
//
......@@ -528,7 +543,7 @@
// 版本号ToolStripMenuItem
//
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
//
......@@ -661,6 +676,7 @@
private System.Windows.Forms.Label lblMoveInfo;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnTrayInfo;
private System.Windows.Forms.Button btnClearTray;
}
}
......@@ -255,7 +255,7 @@ namespace OnlineStore.AssemblyLine
lineBean.StopRun();
}
IOManager.instance.CloseAllDO();
// IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection();
//AIManager.CloseConnect();
ACServerManager.CloseAllPort();
......@@ -730,5 +730,17 @@ namespace OnlineStore.AssemblyLine
}
LogUtil.info("-------------------结束打印托盘信息");
}
private void btnClearTray_Click(object sender, EventArgs e)
{
List<TrayInfo> tray = TrayManager.getTrayList();
LogUtil.info("-------------------点击:清空托盘。清空前打印托盘信息:");
foreach (TrayInfo t in tray)
{
LogUtil.info(t.ToStr());
}
TrayManager.ClearTrayInfo();
LogUtil.info("-------------------点击:清空托盘。托盘内容已清空");
}
}
}
......@@ -55,10 +55,10 @@ PRO,0,出料移栽1-托盘-RFID-IP,PRO_RFIP_201,192.168.210.119,,,,,
PRO,0,出料移栽2-托盘-RFID-IP,PRO_RFIP_202,192.168.210.122,,,,,
PRO,0,出料移栽3-托盘-RFID-IP,PRO_RFIP_203,192.168.210.127,,,,,
PRO,0,出料移栽4-托盘-RFID-IP,PRO_RFIP_204,192.168.210.130,,,,,
PRO,0,入料流水线1-托盘-RFID-IP,PRO_RFIP_101,192.168.210.101,,,,,
,0,入料流水线1-托盘-RFID-IP,PRO_RFIP_101,192.168.210.101,,,,,
PRO,0,入料流水线2-托盘-RFID-IP,PRO_RFIP_102,192.168.210.110,,,,,
PRO,0,入料流水线3-托盘-RFID-IP,PRO_RFIP_103,192.168.210.116,,,,,
PRO,0,入料流水线4-托盘-RFID-IP,PRO_RFIP_104,192.168.210.117,,,,,
,0,入料流水线4-托盘-RFID-IP,PRO_RFIP_104,192.168.210.117,,,,,
PRO,0,入料流水线1-上料模块-RFID-IP,PRO_RFIP_101-1,192.168.210.102,,,,,
PRO,0,入料流水线2-上料模块-RFID-IP,PRO_RFIP_102-1,192.168.210.109,,,,,
PRO,0,入料流水线3-上料模块-RFID-IP,PRO_RFIP_103-1,192.168.210.115,,,,,
......
......@@ -29,7 +29,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 当前正在通过的托盘号
/// </summary>
protected int currTrayNum = 0;
internal int currTrayNum = 0;
/// <summary>
/// 升降轴
/// </summary>
......
......@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
StartOutStoreP();
}
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) && alarmType.Equals(LineAlarmType.None))
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) &&( isInSuddenDown.Equals(false)&&isNoAirCheck.Equals(false)))
{
StartCheckFixture();
}
......@@ -481,21 +481,21 @@ namespace OnlineStore.DeviceLibrary
IsInProcess = true;
if (IOValue(TargetIoType).Equals(TargetIoValue))
{
if (!isOk)
{
isOk = true;
lastOkTime = DateTime.Now;
}
else
{
TimeSpan span = DateTime.Now - lastOkTime;
if (span.TotalMilliseconds > 200)
//if (!isOk)
//{
// isOk = true;
// lastOkTime = DateTime.Now;
//}
//else
//{
//TimeSpan span = DateTime.Now - lastOkTime;
//if (span.TotalMilliseconds > 100)
{
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
BatchAxis.SuddenStop();
BatchAxisStopCheck();
}
}
//}
}
else
......
......@@ -47,15 +47,17 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (Config.SidesWayNum > 0)
{
int num = TrayManager.GetTrayNum(DeviceID);
bool isTestNeed = (LineManager.Line.runStatus <= LineRunStatus.Wait);
bool isNeedTray = (num > 0) && (LineManager.Line.SwNoProcess(Config.SidesWayNum));
bool isNeedTray = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && (isTestNeed || isNeedTray))
{
int num = TrayManager.GetTrayNum(DeviceID);
//判断是否是需要的托盘
if (CurrTrayIsNeed(true))
if (CurrTrayIsNeed(num, true))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
......@@ -65,37 +67,40 @@ namespace OnlineStore.DeviceLibrary
}
else
{
preTrayNum = num;
preTrayNum = currTrayNum;
currTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
}
}
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && (isTestNeed || isNeedTray))
{
//判断是否是需要的托盘
if (CurrTrayIsNeed(true))
{
////判断是否是需要的托盘
//if (CurrTrayIsNeed(num, true))
//{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,最多等待1秒");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else
{
preTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
}
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//}
//else
//{
// preTrayNum = currTrayNum;
// currTrayNum = num;
// TrayManager.UpdateSWState(Config.SidesWayNum, 1);
//}
}
}
else
{
if (IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.FL_StopCheck).Equals(IO_VALUE.HIGH))
{
int num = TrayManager.GetTrayNum(DeviceID);
// int num = TrayManager.GetTrayNum(DeviceID);
//托盘在两个阻挡内
if (num > 0 && IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH))
if ( IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("检测到FL_TrayCheck:" + SecondMoveInfo.SLog + " FL阻挡1上升)");
......@@ -111,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
CheckLog(" 检测到FL_StopCheck:" + SecondMoveInfo.SLog + " FL阻挡1下降 ,最多等待1秒)");
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
}
}
......@@ -170,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
currTrayNum = TrayManager.GetTrayNum(DeviceID);
//出料中,需要拦盘
if (CurrTrayIsNeed(true))
if (CurrTrayIsNeed(currTrayNum, true))
{
SecondMoveInfo.MoveParam = CheckParam;
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
......@@ -397,7 +402,9 @@ namespace OnlineStore.DeviceLibrary
{
//定位工位有料架,等待1秒后再次检测
MoveInfo.NextMoveStep(LineMoveStep.FI_04_WaitTime);
InLog("定位工位检测到料架: " + MoveInfo.SLog + " 等待1秒再次检测");
InLog("定位工位检测到料架: " + MoveInfo.SLog + ",进料阻挡上升,缓冲阻挡上升, 等待1秒再次检测");
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
......@@ -609,7 +616,7 @@ namespace OnlineStore.DeviceLibrary
{
InLog("料盘移栽" + MoveInfo.SLog + ":记录高度尺寸 高度【" + LastHeight + "】宽度【" + LastWidth + "】,已经没有料盘,提升轴开始回下降待机点P2");
MoveInfo.ShelfNoTray = true;
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
BatchAxis.AbsMove(null, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else
{
......@@ -837,7 +844,7 @@ namespace OnlineStore.DeviceLibrary
StartMovePosition = BatchAxis.GetAclPosition();
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, Config.BatchAxisP3, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = Config.BatchAxisP3;
BatchAxis.AbsMove( MoveInfo, Config.BatchAxisP3, Config.BatchAxis_P3Speed);
BatchAxis.AbsMove( null, Config.BatchAxisP3, Config.BatchAxis_P3Speed);
//开始检测信号
BatchAxisStartCheck();
}
......@@ -896,11 +903,7 @@ namespace OnlineStore.DeviceLibrary
#endregion
/// <summary>
/// 是否需要拦截当前托盘进行处理
/// </summary>
/// <returns></returns>
internal bool CurrTrayIsNeed(bool NeedSaveParam )
internal bool CurrTrayIsNeed(int trayNum, bool NeedSaveParam )
{
try
{
......@@ -908,8 +911,10 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
int trayNum = TrayManager.GetTrayNum(Config.Id);
if (trayNum <= 0)
{
return false;
}
TrayInfo info = TrayManager.GetTrayInfo(trayNum);
InOutParam param = new InOutParam(trayNum, info.WareCode, info.PosId, info.PlateH, info.PlateW);
......@@ -917,7 +922,7 @@ namespace OnlineStore.DeviceLibrary
if (Config.IsCanOut.Equals(1))
{
//此托盘是紧急出料盘,需要通过料架出库
bool debugNeed = IsDebug && runStatus >= LineRunStatus.Runing;
bool debugNeed = IsDebug && runStatus >= LineRunStatus.Runing&&info.IsFull&&info.InOrOutStore.Equals(2);
if (info.PosId.Equals(""))
{
param = new InOutParam(trayNum, "紧急出料测试", "1#AC1_3_2", 12, 7);
......@@ -964,11 +969,16 @@ namespace OnlineStore.DeviceLibrary
}
}
}
if (NeedSaveParam)
{
LogInfo(" 托盘【" + info.ToStr() + "】不需要出入库" );
}
}
catch (Exception ex)
{
LogUtil.error(Name + "CurrTrayIsNeed出错:" + ex.StackTrace);
}
return false;
}
......
......@@ -82,8 +82,10 @@ namespace OnlineStore.DeviceLibrary
{
//定位工位有料架,等待1秒后再次检测
MoveInfo.NextMoveStep(LineMoveStep.FO_04_WaitTime);
OutLog("准备出库料架 " + MoveInfo.SLog + "定位工位检测到料架:进料阻挡上升, 等待1秒再次检测");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);
OutLog("准备出库料架 " + MoveInfo.SLog + "定位工位检测到料架: 等待1秒再次检测");
IOMove(IO_Type.SL_Entry_StopDown, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
private void LineOutStoreProcess()
......@@ -228,7 +230,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.CanWhileCount = 0;
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, tp, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = tp;
BatchAxis.AbsMove(MoveInfo, tp, Config.BatchAxis_P3Speed);
BatchAxis.AbsMove(null, tp, Config.BatchAxis_P3Speed);
//开始检测信号
BatchAxisStartCheck(IO_Type.SL_AxisLocationCheck, IO_VALUE.LOW);
}
......
......@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary
#region 初始化
public List<string> cioList = new List<string>( );
public List<string> rfidList = new List<string>();
private bool canStart = false;
public LineBean(Line_Config lineConfig, Dictionary<int, MoveEquip_Config> configList, Dictionary<int, FeedingEquip_Config> feedMap,
......@@ -120,8 +121,13 @@ namespace OnlineStore.DeviceLibrary
cioList = new List<string>(ioList);
string ids = ConfigAppSettings.GetValue(Setting_Init.DebugDeviceId);
rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
if (IsDebug)
{
rfidList = new List<string>() {
"192.168.210.116","192.168.210.120","192.168.210.121"
};
try
{
cioList = new List<string>();
......@@ -177,11 +183,11 @@ namespace OnlineStore.DeviceLibrary
{
IOManager.instance.ConnectionIOList(cioList);
Thread.Sleep(5);
// if (!IsDebug)
if (!IsDebug)
{
Task.Factory.StartNew(delegate
{
string[] rfidArray = new List<string>(DeviceConfig.ProRFIpMap.Values).ToArray();
string[] rfidArray = rfidList.ToArray();
//连接rfip
TrayManager.RfidReader.Open(rfidArray);
});
......@@ -267,6 +273,12 @@ namespace OnlineStore.DeviceLibrary
}
else
{
ledProcessTimer.Enabled = false ;
IoCheckTimer.Enabled = false ;
mainTimer.Enabled = false ;
lineStatus = LineStatus.ResetMove;
runStatus = LineRunStatus.HomeMoving;
StartTime = DateTime.Now;
LogUtil.info(Name + "开始启动,启动时间:" + StartTime.ToString());
//连接AGV调度
......@@ -274,9 +286,6 @@ namespace OnlineStore.DeviceLibrary
{
AgvClient.Init();
}
lineStatus = LineStatus.ResetMove;
runStatus = LineRunStatus.HomeMoving;
StartTime = DateTime.Now;
LineServer.StartServer(ConfigAppSettings.GetIntValue(Setting_Init.TCPServerPort));
RHomeOp();
......@@ -306,6 +315,7 @@ namespace OnlineStore.DeviceLibrary
}
private void RHomeOp()
{
TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ;
alarmType = LineAlarmType.None;
mainTimer.Enabled = false;
......@@ -912,6 +922,7 @@ namespace OnlineStore.DeviceLibrary
//所有原点重置完成
runStatus = LineRunStatus.Runing;
lineStatus = LineStatus.StoreOnline;
MoveInfo.EndMove();
LogUtil.info(Name + "所有设备重置完成,打开流水线,开始运转!");
}
}
......@@ -922,8 +933,8 @@ namespace OnlineStore.DeviceLibrary
{
string msg = "";
// int tLength = 20;
//msg += "preTrayNum:".PadRight(tLength, ' ') + preTrayNum + "\n";
//msg += "currTrayNum:".PadRight(tLength, ' ') + currTrayNum + "\n";
msg += "Sw41TrayNum: " + Sw41TrayNum + "\n";
msg += "Sw23TrayNum:" + Sw23TrayNum + "\n";
msg += "runStatus: "+ runStatus + "\n";
msg += "lineStatus: "+ lineStatus + "\n";
......
......@@ -360,6 +360,10 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
internal bool SwNoProcess(int sidesWayNum)
{
if (sidesWayNum.Equals(2) && TrayManager.GetSwStatus(sidesWayNum).Equals(1))
{
return false;
}
if (sidesWayNum.Equals(1) || sidesWayNum.Equals(4))
{
if (SW41_MoveInfo.MoveType.Equals(LineMoveType.None))
......@@ -387,10 +391,14 @@ namespace OnlineStore.DeviceLibrary
{
SideWay41IsWait = false;
SideWay23IsWait = false;
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0);
SW41_MoveInfo.EndMove();
SW23_MoveInfo.EndMove();
IOMove(IO_Type.SW1_MotorRun, IO_VALUE.LOW);
IOMove(IO_Type.SW2_MotorRun, IO_VALUE.LOW);
IOMove(IO_Type.SW3_MotorRun, IO_VALUE.LOW);
......@@ -402,6 +410,9 @@ namespace OnlineStore.DeviceLibrary
private DateTime SideWay23Ntime = DateTime.Now;
private bool SideWay23IsWait = false;
internal int Sw41TrayNum = 0;
internal int Sw23TrayNum = 0;
private bool sdIsInprocess = false;
private DateTime sdlastProTime = DateTime.Now;
private void SideWayTimerProcess()
......@@ -430,11 +441,10 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span12 = DateTime.Now - SideWay41Ntime;
if (SideWay41IsWait && span12.TotalSeconds > 1)
{
// TrayManager.UpdateSWState(4, 2);
// TrayManager.UpdateSWState(1, 2);
SW41_MoveInfo.NewMove(LineMoveType.InStore);
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
SWLog("横移轨道41:定位气缸下降, 等待横移4托盘检测信号 ");
UpateSw41TrayNum();
SWLog("横移轨道41:定位气缸下降, 等待横移4托盘检测信号,更新托盘号 ["+Sw41TrayNum+"] ");
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW4_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW4_LocationCylinder_Down);
CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
......@@ -452,8 +462,10 @@ namespace OnlineStore.DeviceLibrary
//TrayManager.UpdateSWState(1, 4);
SW41_MoveInfo.NewMove(LineMoveType.InStore);
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW01_StopDown);
SWLog("横移轨道41:检测到SW4_StopCheck, 等待1000,定位气缸下降 ");
UpateSw41TrayNum();
SWLog("横移轨道41:检测到SW4_StopCheck, 等待1000,阻挡气缸下降,定位气缸下降 ,更新托盘号 [" + Sw41TrayNum + "] ");
IOMove(IO_Type.SW4_StopDown, IO_VALUE.HIGH);
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW4_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
......@@ -493,7 +505,8 @@ namespace OnlineStore.DeviceLibrary
//TrayManager.UpdateSWState(3, 2);
SW23_MoveInfo.NewMove(LineMoveType.InStore);
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
SWLog("横移轨道23:定位气缸下降, 等待横移4托盘检测信号 ");
UpateSw23TrayNum();
SWLog("横移轨道23:定位气缸下降, 等待横移2拖盘检测信号 ,更新托盘号 [" + Sw23TrayNum + "] ");
SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
......@@ -516,8 +529,10 @@ namespace OnlineStore.DeviceLibrary
//TrayManager.UpdateSWState(3, 2);
SW23_MoveInfo.NewMove(LineMoveType.InStore);
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW01_StopDown);
SWLog("横移轨道23:检测到SW2_StopCheck, 等待1000,定位气缸下降 ");
UpateSw23TrayNum();
SWLog("横移轨道23:检测到SW2_StopCheck, 等待1000,定位气缸下降 ,更新托盘号 [" + Sw23TrayNum + "] ");
IOMove(IO_Type.SW2_StopDown, IO_VALUE.HIGH);
SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
......@@ -547,6 +562,38 @@ namespace OnlineStore.DeviceLibrary
sdIsInprocess = false;
}
private void UpateSw41TrayNum()
{
Sw41TrayNum = 0;
if (ProvidingEquipMap.ContainsKey(204))
{
ProvidingEquip eq = ProvidingEquipMap[204];
if (eq.runStatus >= LineRunStatus.HomeMoving)
{
Sw41TrayNum = eq.currTrayNum;
}
else
{
Sw41TrayNum = TrayManager.GetTrayNum(204, true);
}
}
}
private void UpateSw23TrayNum()
{
Sw23TrayNum = 0;
if (FeedingEquipMap.ContainsKey(103))
{
FeedingEquip eq = FeedingEquipMap[103];
if (eq.runStatus >= LineRunStatus.HomeMoving)
{
Sw23TrayNum = eq.currTrayNum;
}
else
{
Sw23TrayNum = TrayManager.GetTrayNum(103, true);
}
}
}
private void SideWay41BusyProcess()
{
if (SW41_MoveInfo.IsInWait)
......@@ -572,7 +619,6 @@ namespace OnlineStore.DeviceLibrary
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Down, IO_Type.SW4_TopCylinder_Up);
CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
}
else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW03_TopCylinderUp))
{
......@@ -604,14 +650,14 @@ namespace OnlineStore.DeviceLibrary
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown);
SWLog("横移轨道41:托盘已到达出口,顶升气缸下降,判断入料1是否需要此托盘 ");
CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Up, IO_Type.SW4_TopCylinder_Down);
if (!CheckTrayIsNeed(101))
if (!CheckTrayIsNeed(101,Sw41TrayNum))
{
CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Up, IO_Type.SW1_TopCylinder_Down);
}
}
else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW07_TopCylinderDown))
{
if (CheckTrayIsNeed(101))
if (CheckTrayIsNeed(101,Sw41TrayNum))
{
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW09_WaitTrayGo);
SWLog("横移轨道41:关闭皮带电机,不需要等待 托盘离开");
......@@ -637,13 +683,13 @@ namespace OnlineStore.DeviceLibrary
}
else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo))
{
SW41_MoveInfo.EndMove();
SWLog("横移轨道41:横移结束 ");
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
SW41_MoveInfo.EndMove();
SWLog("横移轨道41:横移结束 ");
}
}
private bool CheckTrayIsNeed(int deviceId)
private bool CheckTrayIsNeed(int deviceId,int trayNum)
{
//横移1对应入料1
if (FeedingEquipMap.ContainsKey(deviceId))
......@@ -651,7 +697,7 @@ namespace OnlineStore.DeviceLibrary
FeedingEquip equip = FeedingEquipMap[deviceId];
if (equip.runStatus >= LineRunStatus.Runing)
{
if (equip.CurrTrayIsNeed(false ))
if (equip.CurrTrayIsNeed(trayNum, false ))
{
return true;
}
......@@ -715,14 +761,14 @@ namespace OnlineStore.DeviceLibrary
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown);
SWLog("横移轨道23:托盘已到达出口,顶升气缸下降 ");
CylinderMove(SW23_MoveInfo, IO_Type.SW2_TopCylinder_Up, IO_Type.SW2_TopCylinder_Down);
if (!CheckTrayIsNeed(104))
if (!CheckTrayIsNeed(104,Sw23TrayNum))
{
CylinderMove(SW23_MoveInfo, IO_Type.SW3_TopCylinder_Up, IO_Type.SW3_TopCylinder_Down);
}
}
else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW07_TopCylinderDown))
{
if (CheckTrayIsNeed(104))
if (CheckTrayIsNeed(104,Sw23TrayNum))
{
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW09_WaitTrayGo);
SWLog("横移轨道41:关闭皮带电机,不需要等待 托盘离开");
......@@ -748,10 +794,10 @@ namespace OnlineStore.DeviceLibrary
}
else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo))
{
SW23_MoveInfo.EndMove();
SWLog("横移轨道23:横移结束 ");
TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0);
SW23_MoveInfo.EndMove();
SWLog("横移轨道23:横移结束 ");
}
}
......@@ -786,6 +832,9 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + " 执行出库【" + param.ToStr() + "】失败, 加入等待队列");
moveEquip.AddWaitOutInfo(param);
}
}else if(moveEquip.MoveInfo.MoveType .Equals(LineMoveType.OutStore) && moveEquip.MoveInfo.MoveParam!=null&& moveEquip.MoveInfo.MoveParam.PosId.Equals(posId))
{
LogUtil.info(param.ToStr() + "已经完成出库," + moveEquip.Name + "正在【"+posId+"】出库中,库位号重复,不处理!");
}
else
{
......@@ -830,7 +879,7 @@ namespace OnlineStore.DeviceLibrary
public bool CanIntore(int id)
{
if (!alarmType.Equals(LineAlarmType.None) || isInSuddenDown || isNoAirCheck)
if ( isInSuddenDown || isNoAirCheck)
{
return false;
}
......
......@@ -473,7 +473,7 @@ namespace OnlineStore.DeviceLibrary
bool isNeed = false;
//此处先对托盘号进行验证
preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID);
currTrayNum = TrayManager.GetTrayNum(DeviceID,true);
bool isFull = TrayManager.TrayIsFull(currTrayNum);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{
......
......@@ -31,11 +31,11 @@ namespace OnlineStore.DeviceLibrary
private void StartCheckFixture()
{
int num = TrayManager.GetTrayNum(DeviceID);
//int num = TrayManager.GetTrayNum(DeviceID);
if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
{
//托盘在两个阻挡内
if (num > 0&& LineManager.Line.SwNoProcess(Config.SidesWayNum))
if ( LineManager.Line.SwNoProcess(Config.SidesWayNum))
{
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
......@@ -104,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
{
//此处先对托盘号进行验证
preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID);
currTrayNum = TrayManager.GetTrayNum(DeviceID,true);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{
if (TrayManager.ErrorDeviceId.Equals(DeviceID))
......
......@@ -173,25 +173,44 @@ namespace OnlineStore.DeviceLibrary
TrayErrorMsg = errorMsg;
ErrorDeviceId = errorStoreID;
}
public static void ClearTrayInfo()
{
TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
}
/// <summary>
/// 获取托盘编码
/// </summary>
public static int GetTrayNum(int subType)
public static int GetTrayNum(int subType, bool isClear = false)
{
return 9;
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = ReadRFID(ip);
if (data != null)
{
if (data.RFType.Equals("E"))
if (data.RFType.Equals((byte)'E'))
{
return data.Num;
}
else
{
LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
return 0;
//else
//{
// LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
//}
}
if (isClear)
{
RfidReader.Clear(ip);
}
return 0;
}
......@@ -206,6 +225,8 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false)&&LineManager.Line.rfidList.Contains(ip))
{
//获取盘号
byte[] data = RfidReader.Read(ip);
if (data != null && data.Length >= 2)
......@@ -213,14 +234,15 @@ namespace OnlineStore.DeviceLibrary
RFIDData d = new RFIDData(data);
return d;
}
}
}catch(Exception ex)
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData(-1,'X');
return new RFIDData(-1,-1);
}
public static string GetRFIP(int subType, int rtType = 0)
private static string GetRFIP(int subType, int rtType = 0)
{
string ip = "";
string rtName = DeviceConfig.RFIP_Str + "_" + subType.ToString().PadLeft(3, '0');
......@@ -238,25 +260,30 @@ namespace OnlineStore.DeviceLibrary
#region 横移状态缓存
internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>();
internal static bool CanMoveSidesWay(int swNum)
internal static int GetSwStatus(int swNum)
{
int status = 0;
if (SidesWayStateMap.ContainsKey(swNum))
{
status = SidesWayStateMap[swNum];
if (SidesWayStateMap[swNum].Equals(1))
return SidesWayStateMap[swNum];
}
return 0;
}
internal static bool CanMoveSidesWay(int swNum)
{
int status = GetSwStatus(swNum);
if (status.Equals(1))
{
return true;
}
else if (swNum.Equals(1) || swNum.Equals(3))
{
if (SidesWayStateMap[swNum].Equals(0))
if (status.Equals(0))
{
return true;
}
}
}
//若此横移对应的设备未启动,直接可处理
foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values)
{
......@@ -307,6 +334,8 @@ namespace OnlineStore.DeviceLibrary
SidesWayStateMap.TryAdd(swNum, value);
}
}
#endregion
}
......@@ -314,15 +343,15 @@ namespace OnlineStore.DeviceLibrary
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘=E
/// RFID类型,区分是料架还是托盘,托盘E=69,A=65
/// </summary>
public char RFType = 'E';
public int RFType=0;
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public int Num = 0;
public RFIDData(int num, char t = 'E')
public RFIDData(int num, int t )
{
this.RFType = t;
this.Num = num;
......@@ -332,8 +361,8 @@ namespace OnlineStore.DeviceLibrary
{
try
{
RFType = (char)data[0];
Num = Convert.ToInt32(data[1]);
RFType = data[1];
Num = Convert.ToInt32(data[2]);
}
catch (Exception ex)
{
......
......@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传
aioBox.AutoReadInput(true,DIMS);
aioBox.AutoReadOutput(true, DOMS);
aioBox.AutoReadOutput(false, DOMS);
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!