Commit 48ff972a LN

入库调试

1 个父辈 19012230
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!--AGV调度服务器地址--> <!--AGV调度服务器地址-->
<add key="AgvServerIp" value="192.168.103.22" /> <add key="AgvServerIp" value="192.168.103.22" />
<!--IO配置--> <!--IO配置-->
<add key ="DIMS" value ="120"/> <add key ="DIMS" value ="60"/>
<add key ="DOMS" value ="300"/> <add key ="DOMS" value ="300"/>
<add key ="LineRunTest" value ="1"/> <add key ="LineRunTest" value ="1"/>
<!--ABB机器人服务器--> <!--ABB机器人服务器-->
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<add key ="OpenRFIDWrite" value ="1"/> <add key ="OpenRFIDWrite" value ="1"/>
<add key="DefaultPWD" value ="123456"/> <add key="DefaultPWD" value ="123456"/>
<!--当前调试的设备ID,分号分割--> <!--当前调试的设备ID,分号分割-->
<add key ="DebugDeviceId" value ="104"/> <add key ="DebugDeviceId" value ="103"/>
<add key ="NeedScanCode" value ="1"/> <add key ="NeedScanCode" value ="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
// //
// timer1 // timer1
// //
this.timer1.Interval = 3000; this.timer1.Interval = 10000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// lblConInfo // lblConInfo
......
...@@ -40,8 +40,8 @@ namespace OnlineStore.AssemblyLine ...@@ -40,8 +40,8 @@ namespace OnlineStore.AssemblyLine
lblRFID.Text = "RFID信息:\r\n"; lblRFID.Text = "RFID信息:\r\n";
msg = ""; msg = "";
List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values); List<string> rfidList = new List<string>(LineManager.Line. rfidList);
foreach (string ip in tList) foreach (string ip in rfidList)
{ {
string con = TrayManager.ReadRFID(ip) .ToStr() ; string con = TrayManager.ReadRFID(ip) .ToStr() ;
msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n"; msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n";
......
...@@ -255,7 +255,7 @@ namespace OnlineStore.AssemblyLine ...@@ -255,7 +255,7 @@ namespace OnlineStore.AssemblyLine
lineBean.StopRun(); lineBean.StopRun();
} }
IOManager.instance.CloseAllDO(); // IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection(); IOManager.instance.CloseAllConnection();
//AIManager.CloseConnect(); //AIManager.CloseConnect();
ACServerManager.CloseAllPort(); ACServerManager.CloseAllPort();
...@@ -730,5 +730,17 @@ namespace OnlineStore.AssemblyLine ...@@ -730,5 +730,17 @@ namespace OnlineStore.AssemblyLine
} }
LogUtil.info("-------------------结束打印托盘信息"); 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,,,,, ...@@ -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,出料移栽2-托盘-RFID-IP,PRO_RFIP_202,192.168.210.122,,,,,
PRO,0,出料移栽3-托盘-RFID-IP,PRO_RFIP_203,192.168.210.127,,,,, 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,出料移栽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,入料流水线2-托盘-RFID-IP,PRO_RFIP_102,192.168.210.110,,,,,
PRO,0,入料流水线3-托盘-RFID-IP,PRO_RFIP_103,192.168.210.116,,,,, 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,入料流水线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,入料流水线2-上料模块-RFID-IP,PRO_RFIP_102-1,192.168.210.109,,,,,
PRO,0,入料流水线3-上料模块-RFID-IP,PRO_RFIP_103-1,192.168.210.115,,,,, PRO,0,入料流水线3-上料模块-RFID-IP,PRO_RFIP_103-1,192.168.210.115,,,,,
......
...@@ -29,7 +29,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,7 +29,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 当前正在通过的托盘号 /// 当前正在通过的托盘号
/// </summary> /// </summary>
protected int currTrayNum = 0; internal int currTrayNum = 0;
/// <summary> /// <summary>
/// 升降轴 /// 升降轴
/// </summary> /// </summary>
......
...@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -348,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
StartOutStoreP(); StartOutStoreP();
} }
} }
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) && alarmType.Equals(LineAlarmType.None)) if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) &&( isInSuddenDown.Equals(false)&&isNoAirCheck.Equals(false)))
{ {
StartCheckFixture(); StartCheckFixture();
} }
...@@ -481,21 +481,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -481,21 +481,21 @@ namespace OnlineStore.DeviceLibrary
IsInProcess = true; IsInProcess = true;
if (IOValue(TargetIoType).Equals(TargetIoValue)) if (IOValue(TargetIoType).Equals(TargetIoValue))
{ {
if (!isOk) //if (!isOk)
{ //{
isOk = true; // isOk = true;
lastOkTime = DateTime.Now; // lastOkTime = DateTime.Now;
} //}
else //else
{ //{
TimeSpan span = DateTime.Now - lastOkTime; //TimeSpan span = DateTime.Now - lastOkTime;
if (span.TotalMilliseconds > 200) //if (span.TotalMilliseconds > 100)
{ {
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动"); LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
BatchAxis.SuddenStop(); BatchAxis.SuddenStop();
BatchAxisStopCheck(); BatchAxisStopCheck();
} }
} //}
} }
else else
......
...@@ -47,15 +47,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -47,15 +47,17 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
if (Config.SidesWayNum > 0) if (Config.SidesWayNum > 0)
{ {
int num = TrayManager.GetTrayNum(DeviceID);
bool isTestNeed = (LineManager.Line.runStatus <= LineRunStatus.Wait); 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)) 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); SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2); TrayManager.UpdateSWState(Config.SidesWayNum, 2);
...@@ -64,38 +66,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -64,38 +66,41 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up); CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
} }
else else
{ {
preTrayNum = num; preTrayNum = currTrayNum;
currTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1); TrayManager.UpdateSWState(Config.SidesWayNum, 1);
} }
} }
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && (isTestNeed || isNeedTray)) 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); SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2); TrayManager.UpdateSWState(Config.SidesWayNum, 2);
CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,最多等待1秒"); CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,最多等待1秒");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH); IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(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)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} //}
else //else
{ //{
preTrayNum = num; // preTrayNum = currTrayNum;
TrayManager.UpdateSWState(Config.SidesWayNum, 1); // currTrayNum = num;
} // TrayManager.UpdateSWState(Config.SidesWayNum, 1);
//}
} }
} }
else else
{ {
if (IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.FL_StopCheck).Equals(IO_VALUE.HIGH)) 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); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("检测到FL_TrayCheck:" + SecondMoveInfo.SLog + " FL阻挡1上升)"); CheckLog("检测到FL_TrayCheck:" + SecondMoveInfo.SLog + " FL阻挡1上升)");
...@@ -111,7 +116,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
CheckLog(" 检测到FL_StopCheck:" + SecondMoveInfo.SLog + " FL阻挡1下降 ,最多等待1秒)"); CheckLog(" 检测到FL_StopCheck:" + SecondMoveInfo.SLog + " FL阻挡1下降 ,最多等待1秒)");
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH); 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.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 ...@@ -170,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
currTrayNum = TrayManager.GetTrayNum(DeviceID); currTrayNum = TrayManager.GetTrayNum(DeviceID);
//出料中,需要拦盘 //出料中,需要拦盘
if (CurrTrayIsNeed(true)) if (CurrTrayIsNeed(currTrayNum, true))
{ {
SecondMoveInfo.MoveParam = CheckParam; SecondMoveInfo.MoveParam = CheckParam;
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
...@@ -397,7 +402,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,7 +402,9 @@ namespace OnlineStore.DeviceLibrary
{ {
//定位工位有料架,等待1秒后再次检测 //定位工位有料架,等待1秒后再次检测
MoveInfo.NextMoveStep(LineMoveStep.FI_04_WaitTime); 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)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
...@@ -609,7 +616,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -609,7 +616,7 @@ namespace OnlineStore.DeviceLibrary
{ {
InLog("料盘移栽" + MoveInfo.SLog + ":记录高度尺寸 高度【" + LastHeight + "】宽度【" + LastWidth + "】,已经没有料盘,提升轴开始回下降待机点P2"); InLog("料盘移栽" + MoveInfo.SLog + ":记录高度尺寸 高度【" + LastHeight + "】宽度【" + LastWidth + "】,已经没有料盘,提升轴开始回下降待机点P2");
MoveInfo.ShelfNoTray = true; MoveInfo.ShelfNoTray = true;
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed); BatchAxis.AbsMove(null, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
} }
else else
{ {
...@@ -837,7 +844,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -837,7 +844,7 @@ namespace OnlineStore.DeviceLibrary
StartMovePosition = BatchAxis.GetAclPosition(); StartMovePosition = BatchAxis.GetAclPosition();
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, Config.BatchAxisP3, Config.BatchAxis_P3Speed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, Config.BatchAxisP3, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = Config.BatchAxisP3; Config.Batch_Axis.TargetPosition = Config.BatchAxisP3;
BatchAxis.AbsMove( MoveInfo, Config.BatchAxisP3, Config.BatchAxis_P3Speed); BatchAxis.AbsMove( null, Config.BatchAxisP3, Config.BatchAxis_P3Speed);
//开始检测信号 //开始检测信号
BatchAxisStartCheck(); BatchAxisStartCheck();
} }
...@@ -895,12 +902,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -895,12 +902,8 @@ namespace OnlineStore.DeviceLibrary
} }
#endregion #endregion
/// <summary> internal bool CurrTrayIsNeed(int trayNum, bool NeedSaveParam )
/// 是否需要拦截当前托盘进行处理
/// </summary>
/// <returns></returns>
internal bool CurrTrayIsNeed(bool NeedSaveParam )
{ {
try try
{ {
...@@ -908,8 +911,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -908,8 +911,10 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
int trayNum = TrayManager.GetTrayNum(Config.Id); if (trayNum <= 0)
{
return false;
}
TrayInfo info = TrayManager.GetTrayInfo(trayNum); TrayInfo info = TrayManager.GetTrayInfo(trayNum);
InOutParam param = new InOutParam(trayNum, info.WareCode, info.PosId, info.PlateH, info.PlateW); InOutParam param = new InOutParam(trayNum, info.WareCode, info.PosId, info.PlateH, info.PlateW);
...@@ -917,7 +922,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -917,7 +922,7 @@ namespace OnlineStore.DeviceLibrary
if (Config.IsCanOut.Equals(1)) 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("")) if (info.PosId.Equals(""))
{ {
param = new InOutParam(trayNum, "紧急出料测试", "1#AC1_3_2", 12, 7); param = new InOutParam(trayNum, "紧急出料测试", "1#AC1_3_2", 12, 7);
...@@ -964,11 +969,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -964,11 +969,16 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
if (NeedSaveParam)
{
LogInfo(" 托盘【" + info.ToStr() + "】不需要出入库" );
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(Name + "CurrTrayIsNeed出错:" + ex.StackTrace); LogUtil.error(Name + "CurrTrayIsNeed出错:" + ex.StackTrace);
} }
return false; return false;
} }
......
...@@ -82,8 +82,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,8 +82,10 @@ namespace OnlineStore.DeviceLibrary
{ {
//定位工位有料架,等待1秒后再次检测 //定位工位有料架,等待1秒后再次检测
MoveInfo.NextMoveStep(LineMoveStep.FO_04_WaitTime); MoveInfo.NextMoveStep(LineMoveStep.FO_04_WaitTime);
OutLog("准备出库料架 " + MoveInfo.SLog + "定位工位检测到料架:进料阻挡上升, 等待1秒再次检测");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW); 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)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
private void LineOutStoreProcess() private void LineOutStoreProcess()
...@@ -163,7 +165,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -163,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
//定位工位有料架,直接开始入料 //定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FO_05_LocationCylinder_Up); MoveInfo.NextMoveStep(LineMoveStep.FO_05_LocationCylinder_Up);
OutLog("定位工位检测到料架: " + MoveInfo.SLog + " 缓冲阻挡下降, 定位气缸上升"); OutLog("定位工位检测到料架: " + MoveInfo.SLog + " 缓冲阻挡下降, 定位气缸上升");
IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降 IOMove(IO_Type.SL_Buffer_StopDown, IO_VALUE.LOW);//缓冲阻挡下降
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up); CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SW4_LocationCylinder_Up);
} }
else else
...@@ -228,7 +230,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -228,7 +230,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.CanWhileCount = 0; MoveInfo.CanWhileCount = 0;
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, tp, Config.BatchAxis_P3Speed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(Config.Batch_Axis, tp, Config.BatchAxis_P3Speed));
Config.Batch_Axis.TargetPosition = tp; 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); BatchAxisStartCheck(IO_Type.SL_AxisLocationCheck, IO_VALUE.LOW);
} }
......
...@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary
#region 初始化 #region 初始化
public List<string> cioList = new List<string>( ); public List<string> cioList = new List<string>( );
public List<string> rfidList = new List<string>();
private bool canStart = false; private bool canStart = false;
public LineBean(Line_Config lineConfig, Dictionary<int, MoveEquip_Config> configList, Dictionary<int, FeedingEquip_Config> feedMap, public LineBean(Line_Config lineConfig, Dictionary<int, MoveEquip_Config> configList, Dictionary<int, FeedingEquip_Config> feedMap,
...@@ -120,8 +121,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,8 +121,13 @@ namespace OnlineStore.DeviceLibrary
cioList = new List<string>(ioList); cioList = new List<string>(ioList);
string ids = ConfigAppSettings.GetValue(Setting_Init.DebugDeviceId); string ids = ConfigAppSettings.GetValue(Setting_Init.DebugDeviceId);
rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
if (IsDebug) if (IsDebug)
{ {
rfidList = new List<string>() {
"192.168.210.116","192.168.210.120","192.168.210.121"
};
try try
{ {
cioList = new List<string>(); cioList = new List<string>();
...@@ -177,11 +183,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -177,11 +183,11 @@ namespace OnlineStore.DeviceLibrary
{ {
IOManager.instance.ConnectionIOList(cioList); IOManager.instance.ConnectionIOList(cioList);
Thread.Sleep(5); Thread.Sleep(5);
// if (!IsDebug) if (!IsDebug)
{ {
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
string[] rfidArray = new List<string>(DeviceConfig.ProRFIpMap.Values).ToArray(); string[] rfidArray = rfidList.ToArray();
//连接rfip //连接rfip
TrayManager.RfidReader.Open(rfidArray); TrayManager.RfidReader.Open(rfidArray);
}); });
...@@ -267,6 +273,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -267,6 +273,12 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
ledProcessTimer.Enabled = false ;
IoCheckTimer.Enabled = false ;
mainTimer.Enabled = false ;
lineStatus = LineStatus.ResetMove;
runStatus = LineRunStatus.HomeMoving;
StartTime = DateTime.Now;
LogUtil.info(Name + "开始启动,启动时间:" + StartTime.ToString()); LogUtil.info(Name + "开始启动,启动时间:" + StartTime.ToString());
//连接AGV调度 //连接AGV调度
...@@ -274,9 +286,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,9 +286,6 @@ namespace OnlineStore.DeviceLibrary
{ {
AgvClient.Init(); AgvClient.Init();
} }
lineStatus = LineStatus.ResetMove;
runStatus = LineRunStatus.HomeMoving;
StartTime = DateTime.Now;
LineServer.StartServer(ConfigAppSettings.GetIntValue(Setting_Init.TCPServerPort)); LineServer.StartServer(ConfigAppSettings.GetIntValue(Setting_Init.TCPServerPort));
RHomeOp(); RHomeOp();
...@@ -306,6 +315,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,6 +315,7 @@ namespace OnlineStore.DeviceLibrary
} }
private void RHomeOp() private void RHomeOp()
{ {
TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ; TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ;
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
mainTimer.Enabled = false; mainTimer.Enabled = false;
...@@ -912,6 +922,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -912,6 +922,7 @@ namespace OnlineStore.DeviceLibrary
//所有原点重置完成 //所有原点重置完成
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
MoveInfo.EndMove();
LogUtil.info(Name + "所有设备重置完成,打开流水线,开始运转!"); LogUtil.info(Name + "所有设备重置完成,打开流水线,开始运转!");
} }
} }
...@@ -921,13 +932,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -921,13 +932,13 @@ namespace OnlineStore.DeviceLibrary
public string GetMoveStr() public string GetMoveStr()
{ {
string msg = ""; string msg = "";
// int tLength = 20; // int tLength = 20;
//msg += "preTrayNum:".PadRight(tLength, ' ') + preTrayNum + "\n"; msg += "Sw41TrayNum: " + Sw41TrayNum + "\n";
//msg += "currTrayNum:".PadRight(tLength, ' ') + currTrayNum + "\n"; msg += "Sw23TrayNum:" + Sw23TrayNum + "\n";
msg += "runStatus: "+ runStatus + "\n"; msg += "runStatus: "+ runStatus + "\n";
msg += "lineStatus: "+ lineStatus + "\n"; msg += "lineStatus: "+ lineStatus + "\n";
msg += "MoveType: " + MoveInfo.MoveType + "\n"; msg += "MoveType: " + MoveInfo.MoveType + "\n";
msg += "MoveStep: " + MoveInfo.SLog + "\n"; msg += "MoveStep: " + MoveInfo.SLog + "\n";
msg += "SW41_Move: "+ SW41_MoveInfo.MoveType + " "+ SW41_MoveInfo.MoveStep + "\n"; msg += "SW41_Move: "+ SW41_MoveInfo.MoveType + " "+ SW41_MoveInfo.MoveStep + "\n";
msg += "SW23_Move: " + SW23_MoveInfo.MoveType + " " + SW23_MoveInfo.MoveStep + "\n"; msg += "SW23_Move: " + SW23_MoveInfo.MoveType + " " + SW23_MoveInfo.MoveStep + "\n";
......
...@@ -473,7 +473,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -473,7 +473,7 @@ namespace OnlineStore.DeviceLibrary
bool isNeed = false; bool isNeed = false;
//此处先对托盘号进行验证 //此处先对托盘号进行验证
preTrayNum = currTrayNum; preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID); currTrayNum = TrayManager.GetTrayNum(DeviceID,true);
bool isFull = TrayManager.TrayIsFull(currTrayNum); bool isFull = TrayManager.TrayIsFull(currTrayNum);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false)) if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{ {
......
...@@ -31,11 +31,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -31,11 +31,11 @@ namespace OnlineStore.DeviceLibrary
private void StartCheckFixture() private void StartCheckFixture()
{ {
int num = TrayManager.GetTrayNum(DeviceID); //int num = TrayManager.GetTrayNum(DeviceID);
if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH)) 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); TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
...@@ -104,7 +104,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -104,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//此处先对托盘号进行验证 //此处先对托盘号进行验证
preTrayNum = currTrayNum; preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID); currTrayNum = TrayManager.GetTrayNum(DeviceID,true);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false)) if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{ {
if (TrayManager.ErrorDeviceId.Equals(DeviceID)) if (TrayManager.ErrorDeviceId.Equals(DeviceID))
......
...@@ -173,25 +173,44 @@ namespace OnlineStore.DeviceLibrary ...@@ -173,25 +173,44 @@ namespace OnlineStore.DeviceLibrary
TrayErrorMsg = errorMsg; TrayErrorMsg = errorMsg;
ErrorDeviceId = errorStoreID; ErrorDeviceId = errorStoreID;
} }
public static void ClearTrayInfo()
{
TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
}
/// <summary> /// <summary>
/// 获取托盘编码 /// 获取托盘编码
/// </summary> /// </summary>
public static int GetTrayNum(int subType) public static int GetTrayNum(int subType, bool isClear = false)
{ {
return 9; return 9;
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = GetRFIP(subType); string ip = GetRFIP(subType);
//获取盘号 //获取盘号
RFIDData data = ReadRFID(ip); RFIDData data = ReadRFID(ip);
if (data != null) if (data != null)
{ {
if (data.RFType.Equals("E")) if (data.RFType.Equals((byte)'E'))
{ {
return data.Num; return data.Num;
} }
else return 0;
{ //else
LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr()); //{
} // LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
//}
}
if (isClear)
{
RfidReader.Clear(ip);
} }
return 0; return 0;
} }
...@@ -206,21 +225,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,21 +225,24 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
//获取盘号 if (String.IsNullOrEmpty(ip).Equals(false)&&LineManager.Line.rfidList.Contains(ip))
byte[] data = RfidReader.Read(ip);
if (data != null && data.Length >= 2)
{ {
RFIDData d = new RFIDData(data); //获取盘号
return d; byte[] data = RfidReader.Read(ip);
if (data != null && data.Length >= 2)
{
RFIDData d = new RFIDData(data);
return d;
}
} }
}catch(Exception ex) }catch(Exception ex)
{ {
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString()); //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 ip = "";
string rtName = DeviceConfig.RFIP_Str + "_" + subType.ToString().PadLeft(3, '0'); string rtName = DeviceConfig.RFIP_Str + "_" + subType.ToString().PadLeft(3, '0');
...@@ -238,25 +260,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,25 +260,30 @@ namespace OnlineStore.DeviceLibrary
#region 横移状态缓存 #region 横移状态缓存
internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>(); internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>();
internal static int GetSwStatus(int swNum)
internal static bool CanMoveSidesWay(int swNum)
{ {
int status = 0;
if (SidesWayStateMap.ContainsKey(swNum)) if (SidesWayStateMap.ContainsKey(swNum))
{ {
status = SidesWayStateMap[swNum]; return SidesWayStateMap[swNum];
if (SidesWayStateMap[swNum].Equals(1)) }
return 0;
}
internal static bool CanMoveSidesWay(int swNum)
{
int status = GetSwStatus(swNum);
if (status.Equals(1))
{ {
return true; return true;
} }
else if (swNum.Equals(1) || swNum.Equals(3)) else if (swNum.Equals(1) || swNum.Equals(3))
{ {
if (SidesWayStateMap[swNum].Equals(0)) if (status.Equals(0))
{ {
return true; return true;
} }
} }
}
//若此横移对应的设备未启动,直接可处理 //若此横移对应的设备未启动,直接可处理
foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values) foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values)
{ {
...@@ -307,6 +334,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -307,6 +334,8 @@ namespace OnlineStore.DeviceLibrary
SidesWayStateMap.TryAdd(swNum, value); SidesWayStateMap.TryAdd(swNum, value);
} }
} }
#endregion #endregion
} }
...@@ -314,15 +343,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -314,15 +343,15 @@ namespace OnlineStore.DeviceLibrary
public class RFIDData public class RFIDData
{ {
/// <summary> /// <summary>
/// RFID类型,区分是料架还是托盘,托盘=E /// RFID类型,区分是料架还是托盘,托盘E=69,A=65
/// </summary> /// </summary>
public char RFType = 'E'; public int RFType=0;
/// <summary> /// <summary>
/// 托盘编号,从1-32 /// 托盘编号,从1-32
/// </summary> /// </summary>
public int Num = 0; public int Num = 0;
public RFIDData(int num, char t = 'E') public RFIDData(int num, int t )
{ {
this.RFType = t; this.RFType = t;
this.Num = num; this.Num = num;
...@@ -332,8 +361,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -332,8 +361,8 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
RFType = (char)data[0]; RFType = data[1];
Num = Convert.ToInt32(data[1]); Num = Convert.ToInt32(data[2]);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength); aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传 //DI主动上传
aioBox.AutoReadInput(true,DIMS); aioBox.AutoReadInput(true,DIMS);
aioBox.AutoReadOutput(true, DOMS); aioBox.AutoReadOutput(false, DOMS);
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ; aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!