Commit 3547a0c6 LN

1

1 个父辈 179c6ed8
...@@ -377,6 +377,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -377,6 +377,10 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
return true;
}
if (SW12_MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false)) if (SW12_MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{ {
return true; return true;
......
...@@ -44,14 +44,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -44,14 +44,11 @@ namespace OnlineStore.DeviceLibrary
{ {
isInprocess = true; isInprocess = true;
lastProTime = DateTime.Now; lastProTime = DateTime.Now;
if (!isCanProcessLine())
{
return;
}
//出入料口条件: 各料仓无报警( 伺服), 各移栽装置处 于原位待机, 检测夹具IO,驱动电机运转 //出入料口条件: 各料仓无报警( 伺服), 各移栽装置处 于原位待机, 检测夹具IO,驱动电机运转
if (IOValue(IO_Type.DriveMotor_Run).Equals(IO_VALUE.LOW)) if (!isCanProcessLine() || IOValue(IO_Type.DriveMotor_Run).Equals(IO_VALUE.LOW))
{ {
isWaitOutGo = false; isWaitOutGo = false;
isInprocess = false;
return; return;
} }
...@@ -274,6 +271,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,6 +271,7 @@ namespace OnlineStore.DeviceLibrary
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
List<WriteIOInfo> wLists = checkWaitInfo.WriteIoList;
TimeSpan rwSpan = DateTime.Now - preRWTime; TimeSpan rwSpan = DateTime.Now - preRWTime;
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut) if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut)
{ {
...@@ -281,20 +279,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -281,20 +279,19 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = Name + " 等待" + NotOkMsg + "超时"; WarnMsg = Name + " 等待" + NotOkMsg + "超时";
Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, checkWaitInfo.MoveType); Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, checkWaitInfo.MoveType);
LogUtil.error(checkWaitInfo.Name + ":" + wait.IoType + "等待" + NotOkMsg + "超时", 14); LogUtil.error(checkWaitInfo.Name + ":" + checkWaitInfo.MoveStep + "等待" + NotOkMsg + "超时", 14);
isOk = false; isOk = false;
break; break;
} }
else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3 && (checkWaitInfo.WriteIoList != null) && checkWaitInfo.WriteIoList.Count > 0) else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3 && (wLists != null) && wLists.Count > 0)
{ {
List<WriteIOInfo> wLists = new List<WriteIOInfo>(checkWaitInfo.WriteIoList);
preRWTime = DateTime.Now; preRWTime = DateTime.Now;
string msg = checkWaitInfo.Name + " " + NotOkMsg + " 已等待" + Math.Abs(span.TotalSeconds) + "秒,重写DO:"; string msg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "]" + " 已等待 " + NotOkMsg + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
foreach (WriteIOInfo ww in wLists) foreach (WriteIOInfo ww in wLists)
{ {
IOMove(ww.IoType, ww.IoValue); IOMove(ww.IoType, ww.IoValue);
msg += "[" + ww.IoType + "+" + ww.IoValue + "],"; msg += "[" + ww.IoType + "=" + ww.IoValue + "],";
} }
LogUtil.error(msg); LogUtil.error(msg);
} }
...@@ -339,7 +336,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -339,7 +336,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:" + ex.ToString()); LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:" + ex.StackTrace);
} }
} }
...@@ -419,7 +416,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -419,7 +416,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(LineMoveType.InStore); MoveInfo.NewMove(LineMoveType.InStore);
MoveInfo.NextMoveStep(LineMoveStep.LI_00_Wait100); MoveInfo.NextMoveStep(LineMoveStep.LI_00_Wait100);
MoveInfo.MoveParam = param; MoveInfo.MoveParam = param;
preTrayNum = param.TrayNumber;
//等待料仓验证成功,最多等待10秒,若验证不成功,直接失败 //等待料仓验证成功,最多等待10秒,若验证不成功,直接失败
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
...@@ -460,6 +456,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -460,6 +456,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
preTrayNum = MoveInfo.MoveParam.TrayNumber;
lock (moveEquip.waitInListLock) lock (moveEquip.waitInListLock)
{ {
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
...@@ -612,95 +609,113 @@ namespace OnlineStore.DeviceLibrary ...@@ -612,95 +609,113 @@ namespace OnlineStore.DeviceLibrary
private bool SideWay12IsWait = false; private bool SideWay12IsWait = false;
private DateTime SideWay34Ntime = DateTime.Now; private DateTime SideWay34Ntime = DateTime.Now;
private bool SideWay34IsWait = false; private bool SideWay34IsWait = false;
private bool sdIsInprocess = false;
private DateTime sdlastProTime = DateTime.Now;
private void SideWayTimerProcess() private void SideWayTimerProcess()
{ {
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽 TimeSpan span = DateTime.Now - sdlastProTime;
if (IOValue(IO_Type.DriveMotor_Run).Equals(IO_VALUE.HIGH) && runStatus >= LineRunStatus.Runing) if (sdIsInprocess && span.TotalSeconds < 5)
{
return;
}
try
{ {
if (SW12_MoveInfo.MoveType.Equals(LineMoveType.None) && IOValue(IO_Type.SidesWay2_FixtureCheck).Equals(IO_VALUE.LOW)) sdIsInprocess = true; sdlastProTime = DateTime.Now;
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽
if (IOValue(IO_Type.DriveMotor_Run).Equals(IO_VALUE.HIGH) && runStatus >= LineRunStatus.Runing)
{ {
TimeSpan span12 = DateTime.Now - SideWay12Ntime; if (SW12_MoveInfo.MoveType.Equals(LineMoveType.None) && IOValue(IO_Type.SidesWay2_FixtureCheck).Equals(IO_VALUE.LOW))
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡2下降,盘通过
if (IOValue(IO_Type.SidesWay1_StopFixtureCheck).Equals(IO_VALUE.HIGH))
{ {
if (SideWay12IsWait && span12.TotalSeconds > 1) TimeSpan span12 = DateTime.Now - SideWay12Ntime;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡2下降,盘通过
if (IOValue(IO_Type.SidesWay1_StopFixtureCheck).Equals(IO_VALUE.HIGH))
{ {
SWLog("横移轨道阻挡1检测到托盘,开始移动托盘,下降横移气缸12"); if (SideWay12IsWait && span12.TotalSeconds > 1)
SW12_MoveInfo.NewMove(LineMoveType.InStore); {
SW12_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait); SWLog("横移轨道阻挡1检测到托盘,开始移动托盘,下降横移气缸12");
SideWay12TopCylinderMove(IO_VALUE.HIGH, IO_VALUE.LOW, SW12_MoveInfo); SW12_MoveInfo.NewMove(LineMoveType.InStore);
} SW12_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait);
else if (!SideWay12IsWait) SideWay12TopCylinderMove(IO_VALUE.HIGH, IO_VALUE.LOW, SW12_MoveInfo);
{ }
SideWay12IsWait = true; else if (!SideWay12IsWait)
SideWay12Ntime = DateTime.Now; {
SideWay12IsWait = true;
SideWay12Ntime = DateTime.Now;
}
} }
} else if (IOValue(IO_Type.SidesWay1_FixtureCheck).Equals(IO_VALUE.HIGH))
else if (IOValue(IO_Type.SidesWay1_FixtureCheck).Equals(IO_VALUE.HIGH))
{
if (SideWay12IsWait && span12.TotalSeconds > 1)
{ {
SWLog("横移轨道1检测到托盘,阻挡1上升,等待横移1夹具检测信号"); if (SideWay12IsWait && span12.TotalSeconds > 1)
SW12_MoveInfo.NewMove(LineMoveType.InStore); {
SW12_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck); SWLog("横移轨道1检测到托盘,阻挡1上升,等待横移1夹具检测信号");
IOMove(IO_Type.SidesWay1_StopCylinderDown, IO_VALUE.LOW); SW12_MoveInfo.NewMove(LineMoveType.InStore);
SW12_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SidesWay1_FixtureCheck, IO_VALUE.HIGH)); SW12_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
IOMove(IO_Type.SidesWay1_StopCylinderDown, IO_VALUE.LOW);
SW12_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SidesWay1_FixtureCheck, IO_VALUE.HIGH));
}
else if (!SideWay12IsWait)
{
SideWay12IsWait = true;
SideWay12Ntime = DateTime.Now;
}
} }
else if (!SideWay12IsWait) else
{ {
SideWay12IsWait = true; SideWay12IsWait = false;
SideWay12Ntime = DateTime.Now;
} }
} }
else else
{ {
SideWay12IsWait = false; SideWay12IsWait = false;
SideWay12BusyProcess();
} }
}
else
{
SideWay12IsWait = false;
SideWay12BusyProcess();
}
if (SW34_MoveInfo.MoveType.Equals(LineMoveType.None) && IOValue(IO_Type.SidesWay4_FixtureCheck).Equals(IO_VALUE.LOW)) if (SW34_MoveInfo.MoveType.Equals(LineMoveType.None) && IOValue(IO_Type.SidesWay4_FixtureCheck).Equals(IO_VALUE.LOW))
{
TimeSpan span34 = DateTime.Now - SideWay34Ntime;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡4下降,盘通过
if (IOValue(IO_Type.SidesWay3_FixtureCheck).Equals(IO_VALUE.HIGH))
{ {
if (SideWay34IsWait && span34.TotalSeconds > 1) TimeSpan span34 = DateTime.Now - SideWay34Ntime;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡4下降,盘通过
if (IOValue(IO_Type.SidesWay3_FixtureCheck).Equals(IO_VALUE.HIGH))
{ {
SWLog("横移轨道3检测到托盘,开始移动托盘"); if (SideWay34IsWait && span34.TotalSeconds > 1)
SW34_MoveInfo.NewMove(LineMoveType.InStore); {
SW34_MoveInfo.NextMoveStep(LineMoveStep.SW01_StopCylinderDown); SWLog("横移轨道3检测到托盘,开始移动托盘");
IOMove(IO_Type.SidesWay3_StopCylinderDown, IO_VALUE.HIGH); SW34_MoveInfo.NewMove(LineMoveType.InStore);
SideWay34TopCylinderMove(IO_VALUE.HIGH, IO_VALUE.LOW, SW34_MoveInfo); SW34_MoveInfo.NextMoveStep(LineMoveStep.SW01_StopCylinderDown);
IOMove(IO_Type.SidesWay3_StopCylinderDown, IO_VALUE.HIGH);
SideWay34TopCylinderMove(IO_VALUE.HIGH, IO_VALUE.LOW, SW34_MoveInfo);
}
else if (!SideWay34IsWait)
{
SideWay34IsWait = true;
SideWay34Ntime = DateTime.Now;
}
} }
else if (!SideWay34IsWait) else
{ {
SideWay34IsWait = true; SideWay34IsWait = false;
SideWay34Ntime = DateTime.Now;
} }
} }
else else
{ {
SideWay34IsWait = false; SideWay34IsWait = false;
SideWay34BusyProcess();
} }
} }
else else
{ {
SideWay34IsWait = false; SideWay34IsWait = false;
SideWay34BusyProcess(); SideWay12IsWait = false;
} }
} }
else catch (Exception ex)
{ {
SideWay34IsWait = false; LogUtil.error("SideWayTimerProcess 出错:" + ex.StackTrace);
SideWay12IsWait = false;
} }
sdIsInprocess = false;
} }
private void SideWay12BusyProcess() private void SideWay12BusyProcess()
...@@ -812,7 +827,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -812,7 +827,8 @@ namespace OnlineStore.DeviceLibrary
else if (SW34_MoveInfo.MoveStep.Equals(LineMoveStep.SW02_WaitFixtureCheck)) else if (SW34_MoveInfo.MoveStep.Equals(LineMoveStep.SW02_WaitFixtureCheck))
{ {
SW34_MoveInfo.NextMoveStep(LineMoveStep.SW03_TopCylinderUp); SW34_MoveInfo.NextMoveStep(LineMoveStep.SW03_TopCylinderUp);
SWLog("横移轨道34:顶升气缸上升 ,横移3阻挡上升 "); SWLog("横移轨道34:顶升气缸上升 ,横移3阻挡上升,至少等待1000 ");
SW34_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
IOMove(IO_Type.SidesWay3_StopCylinderDown, IO_VALUE.LOW); IOMove(IO_Type.SidesWay3_StopCylinderDown, IO_VALUE.LOW);
SideWay34TopCylinderMove(IO_VALUE.LOW, IO_VALUE.HIGH, SW34_MoveInfo); SideWay34TopCylinderMove(IO_VALUE.LOW, IO_VALUE.HIGH, SW34_MoveInfo);
} }
......
...@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
public bool UpdownUseAxis = false; public bool UpdownUseAxis = false;
public AxisAlarmInfo AxisAlarm = new AxisAlarmInfo(); public AxisAlarmInfo AxisAlarm = new AxisAlarmInfo();
public MoveEquip_Config Config; public MoveEquip_Config Config;
/// <summary> /// <summary>
///移栽装置后面分为两条移动线 ///移栽装置后面分为两条移动线
/// </summary> /// </summary>
...@@ -29,13 +29,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,13 +29,13 @@ namespace OnlineStore.DeviceLibrary
public List<InOutParam> waitOutStoreList = new List<InOutParam>(); public List<InOutParam> waitOutStoreList = new List<InOutParam>();
public List<InOutParam> waitInStoreList = new List<InOutParam>(); public List<InOutParam> waitInStoreList = new List<InOutParam>();
public object waitInListLock = ""; public object waitInListLock = "";
public object waitOutListLock = ""; public object waitOutListLock = "";
public MoveEquip(string cid, MoveEquip_Config config) public MoveEquip(string cid, MoveEquip_Config config)
{ {
this.DeviceID = config.Id; this.DeviceID = config.Id;
this.Config = config; this.Config = config;
Name = (" " + "_移栽_" + DeviceID + " ").ToUpper(); Name = (" " + "_移栽_" + DeviceID + " ").ToUpper();
//Name = (" " + cid + "_移栽_" + DeviceID + " ").ToUpper(); //Name = (" " + cid + "_移栽_" + DeviceID + " ").ToUpper();
Init(); Init();
//添加调试 //添加调试
...@@ -44,8 +44,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -44,8 +44,8 @@ namespace OnlineStore.DeviceLibrary
IsDebug = true; IsDebug = true;
} }
//this.Box = box; //this.Box = box;
MoveInfo = new LineMoveInfo(DeviceID,"移栽-"+DeviceID+"-MoveInfo"); MoveInfo = new LineMoveInfo(DeviceID, "移栽-" + DeviceID + "-MoveInfo");
SecondMoveInfo = new LineMoveInfo(DeviceID, "移栽-" + DeviceID + "-SecondMoveInfo"); SecondMoveInfo = new LineMoveInfo(DeviceID, "移栽-" + DeviceID + "-SecondMoveInfo");
IsDebug = config.IsDebug.Equals(1); IsDebug = config.IsDebug.Equals(1);
UpdownUseAxis = config.UpDownUseAxis.Equals(1); UpdownUseAxis = config.UpDownUseAxis.Equals(1);
...@@ -66,20 +66,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,20 +66,20 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 开始运行 /// 开始运行
/// </summary> /// </summary>
public override bool StartRun( ) public override bool StartRun()
{ {
preTrayNum = 0; preTrayNum = 0;
currMoveTrayNum = 0; currMoveTrayNum = 0;
mainTimer.Enabled = false; mainTimer.Enabled = false;
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
//TODO 调试时暂时注释 //TODO 调试时暂时注释
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
return MoveEquipMentHome(); return MoveEquipMentHome();
} }
public bool StartDebugRun() public bool StartDebugRun()
{ {
preTrayNum = 0; preTrayNum = 0;
currMoveTrayNum = 0; currMoveTrayNum = 0;
...@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
//TODO 调试时暂时注释 //TODO 调试时暂时注释
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
bool result= MoveEquipMentHome(); bool result = MoveEquipMentHome();
if (result) if (result)
{ {
mainTimer.Enabled = true; mainTimer.Enabled = true;
...@@ -167,13 +167,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -167,13 +167,13 @@ namespace OnlineStore.DeviceLibrary
StopMoveProcess(); StopMoveProcess();
} }
if (SecondMoveInfo.MoveType .Equals( LineMoveType.CheckFixture)) if (SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture))
{ {
CheckFixtureProcess(); CheckFixtureProcess();
} }
} }
protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
TimerProcess(); TimerProcess();
...@@ -199,15 +199,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -199,15 +199,15 @@ namespace OnlineStore.DeviceLibrary
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None)) if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ {
LineBean lineBean = LineManager.Line; LineBean lineBean = LineManager.Line;
if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run,0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false)) if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run, 0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false))
{ {
// LogUtil.info("StartCheckFixture"); // LogUtil.info("StartCheckFixture");
StartCheckFixture(); StartCheckFixture();
} }
} }
IOTimeOutProcess(); IOTimeOutProcess();
OutStoreListPro (); OutStoreListPro();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -221,7 +221,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -221,7 +221,7 @@ namespace OnlineStore.DeviceLibrary
/// 出库队列处理 /// 出库队列处理
/// </summary> /// </summary>
private void OutStoreListPro() private void OutStoreListPro()
{ {
//料仓出库完成,移栽装置开始出库检测 //料仓出库完成,移栽装置开始出库检测
if (IsDebug.Equals(false) && MoveInfo.MoveType.Equals(LineMoveType.None) && runStatus.Equals(LineRunStatus.Runing)) if (IsDebug.Equals(false) && MoveInfo.MoveType.Equals(LineMoveType.None) && runStatus.Equals(LineRunStatus.Runing))
{ {
...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(Name + "开始 执行排队中的出库【" + waitOutParma.ToStr() + "】"); LogUtil.info(Name + "开始 执行排队中的出库【" + waitOutParma.ToStr() + "】");
//出库 //出库
bool result = StartOutStoreMove(waitOutParma); bool result = StartOutStoreMove(waitOutParma);
if (!result) if (!result)
{ {
LogUtil.info(Name + " 执行排队中的出库【" + waitOutParma.ToStr() + "】失败,重新加入等待队列"); LogUtil.info(Name + " 执行排队中的出库【" + waitOutParma.ToStr() + "】失败,重新加入等待队列");
...@@ -247,11 +247,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -247,11 +247,20 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
public void AddWaitOutInfo(InOutParam param) public void AddWaitOutInfo(InOutParam param)
{ {
lock (waitOutListLock) lock (waitOutListLock)
{ {
waitOutStoreList.Add(param); //判断是否已经加入,不重复加
List<InOutParam> paramList = (from m in waitOutStoreList where m.PosId.Equals(param.PosId) select m).ToList<InOutParam>();
if (paramList.Count > 0)
{
LogUtil.error(Name + "出库【" + param.ToStr() + "】加入等待出库队列失败,此库位已存在列表中");
}
else
{
waitOutStoreList.Add(param);
}
} }
} }
...@@ -261,17 +270,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -261,17 +270,17 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
TimeSpan span = DateTime.Now - preIoTimerOutTime; TimeSpan span = DateTime.Now - preIoTimerOutTime;
if (span.TotalSeconds > 1&& alarmType.Equals(LineAlarmType.IoSingleTimeOut)) if (span.TotalSeconds > 1 && alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{ {
preIoTimerOutTime = DateTime.Now; preIoTimerOutTime = DateTime.Now;
if (runStatus < LineRunStatus.Runing|| isInSuddenDown || isNoAirCheck) if (runStatus < LineRunStatus.Runing || isInSuddenDown || isNoAirCheck)
{ {
return; return;
} }
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过 //若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (MoveInfo.IsInWait .Equals(false)&&SecondMoveInfo.IsInWait.Equals(false)) if (MoveInfo.IsInWait.Equals(false) && SecondMoveInfo.IsInWait.Equals(false))
{ {
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 "); LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
...@@ -281,14 +290,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -281,14 +290,14 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error( "IOTimeOutProcess出错:" + ex.ToString()); LogUtil.error("IOTimeOutProcess出错:" + ex.ToString());
} }
} }
/// <summary> /// <summary>
/// 移栽装置原点返回 /// 移栽装置原点返回
/// </summary> /// </summary>
public bool MoveEquipMentHome() public bool MoveEquipMentHome()
{ {
mainTimer.Stop(); mainTimer.Stop();
if (!RunAxis(true)) if (!RunAxis(true))
...@@ -298,11 +307,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,11 +307,11 @@ namespace OnlineStore.DeviceLibrary
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
LogInfo( "开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始"); LogInfo("开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始");
MoveInfo.NewMove(LineMoveType.ReturnHome); MoveInfo.NewMove(LineMoveType.ReturnHome);
//移载装置原点状态:顶升气缸下降端,前后气缸后退端,上下气缸上升端,夹料气缸放松端,阻挡气缸输入=0 //移载装置原点状态:顶升气缸下降端,前后气缸后退端,上下气缸上升端,夹料气缸放松端,阻挡气缸输入=0
UpdownHomeMove(); UpdownHomeMove();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up); // CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if (IsDebug) if (IsDebug)
{ {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
...@@ -311,17 +320,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -311,17 +320,17 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
} }
return true; return true;
} }
/// <summary> /// <summary>
/// 移栽装置重置 /// 移栽装置重置
/// </summary> /// </summary>
public override bool Reset() public override bool Reset()
{ {
WarnMsg = ""; WarnMsg = "";
//如果正在出库中,需要减去托盘号 //如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore)) if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{ {
...@@ -329,7 +338,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -329,7 +338,7 @@ namespace OnlineStore.DeviceLibrary
//减去需要的盘数 //减去需要的盘数
TrayManager.DelNeedEmptyTrayNum(); TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
if (!RunAxis(true)) if (!RunAxis(true))
{ {
return false; return false;
...@@ -338,13 +347,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -338,13 +347,13 @@ namespace OnlineStore.DeviceLibrary
//重置时清理盘号,从头开始判断 //重置时清理盘号,从头开始判断
preTrayNum = 0; preTrayNum = 0;
currMoveTrayNum = 0; currMoveTrayNum = 0;
LogInfo( "开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;"); LogInfo("开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;");
runStatus = LineRunStatus.Reset; runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
MoveInfo.NewMove(LineMoveType.Reset); MoveInfo.NewMove(LineMoveType.Reset);
UpdownHomeMove(); UpdownHomeMove();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up); // CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if (IsDebug) if (IsDebug)
{ {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
...@@ -389,7 +398,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -389,7 +398,7 @@ namespace OnlineStore.DeviceLibrary
case LineMoveStep.MH_UpDownCylinder_Up: case LineMoveStep.MH_UpDownCylinder_Up:
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back); MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo( "重置: (上升到位,顶升气缸下降,前后气缸回退 )开始"); LogInfo("重置: (上升到位,顶升气缸下降,前后气缸回退 )开始");
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten); CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
...@@ -397,7 +406,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,7 +406,7 @@ namespace OnlineStore.DeviceLibrary
case LineMoveStep.MH_OtherCylinder_Back: case LineMoveStep.MH_OtherCylinder_Back:
LogInfo( "重置完成!"); LogInfo("重置完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
...@@ -412,7 +421,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -412,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 原点返回处理 /// 原点返回处理
/// </summary> /// </summary>
protected void ReturnHomeProcess() protected void ReturnHomeProcess()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
{ {
...@@ -444,7 +453,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,7 +453,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
LogInfo( "原点返回完成!"); LogInfo("原点返回完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
//如果是调试模式,移栽装置两个阻挡气缸落下,并且不再移动 //如果是调试模式,移栽装置两个阻挡气缸落下,并且不再移动
if (IsDebug) if (IsDebug)
...@@ -475,12 +484,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -475,12 +484,12 @@ namespace OnlineStore.DeviceLibrary
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait) if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{ {
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
//流水线各装置复原位,夹料气缸状态不变 //阻挡气缸全部=0 //上下气缸上升,、 //上升到位,顶升气缸下降,前后气缸回退 //流水线各装置复原位,夹料气缸状态不变 //阻挡气缸全部=0 //上下气缸上升,、 //上升到位,顶升气缸下降,前后气缸回退
case LineMoveStep.MH_UpDownCylinder_Up: case LineMoveStep.MH_UpDownCylinder_Up:
{ {
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back); MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo( "停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始"); LogInfo("停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始");
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW); IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
...@@ -513,22 +522,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -513,22 +522,22 @@ namespace OnlineStore.DeviceLibrary
//如果正在出库中,需要减去托盘号 //如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore)) if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{ {
LogInfo( "停止运动时出库执行中,减去托盘数;"); LogInfo("停止运动时出库执行中,减去托盘数;");
//减去需要的盘数 //减去需要的盘数
TrayManager.DelNeedEmptyTrayNum(); TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
runStatus = LineRunStatus.Busy; runStatus = LineRunStatus.Busy;
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
LogInfo( "停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 "); LogInfo("停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 ");
MoveInfo.NewMove(LineMoveType.StopMove); MoveInfo.NewMove(LineMoveType.StopMove);
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up); MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
UpdownUpMove(); UpdownUpMove();
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
} }
public void ChangeDebug() public void ChangeDebug()
...@@ -559,7 +568,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -559,7 +568,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
internal void OpenStopCylinder() internal void OpenStopCylinder()
{ {
LogInfo( "下降阻挡气缸,上下气缸上升,顶升气缸下降"); LogInfo("下降阻挡气缸,上下气缸上升,顶升气缸下降");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//上下气缸上升 //上下气缸上升
...@@ -574,7 +583,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -574,7 +583,7 @@ namespace OnlineStore.DeviceLibrary
} }
internal void CloseCylinderStop() internal void CloseCylinderStop()
{ {
LogInfo( "上升阻挡气缸,关闭上下气缸,顶升气缸IO"); LogInfo("上升阻挡气缸,关闭上下气缸,顶升气缸IO");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
//上下气缸上升 //上下气缸上升
...@@ -584,7 +593,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -584,7 +593,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW); IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
} }
#region 上下气缸伺服运动 #region 上下气缸伺服运动
private string portName; private string portName;
private short slvAddr; private short slvAddr;
...@@ -629,33 +638,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -629,33 +638,33 @@ namespace OnlineStore.DeviceLibrary
private bool OpenAxis() private bool OpenAxis()
{ {
//判断轴是否正常 //判断轴是否正常
if (ACServerManager.ServerOnStatus(portName, slvAddr))
{
LogUtil.info(Name + "成功打开轴:" + Config.UpDown_Axis.Explain);
}
else
{
//清理报警,再重新打开一次
LogUtil.info(Name + "第一次打开轴" + Config.UpDown_Axis.Explain + "失败,先清理一下报警,再重新打开一次");
ACServerManager.AlarmClear(portName, slvAddr);
System.Threading.Thread.Sleep(1200);
ACServerManager.ServoOn(portName, slvAddr);
System.Threading.Thread.Sleep(100);
if (ACServerManager.ServerOnStatus(portName, slvAddr)) if (ACServerManager.ServerOnStatus(portName, slvAddr))
{ {
LogUtil.info( Name + "成功打开轴:" + Config.UpDown_Axis.Explain); LogUtil.info(Name + "清理报警后重新打卡轴成功:" + Config.UpDown_Axis.Explain);
} }
else else
{ {
//清理报警,再重新打开一次 ACServerManager.ServoOff(portName, slvAddr);
LogUtil.info( Name + "第一次打开轴" + Config.UpDown_Axis.Explain + "失败,先清理一下报警,再重新打开一次"); WarnMsg = Name + "打开轴" + Config.UpDown_Axis.Explain + "失败 ";
ACServerManager.AlarmClear(portName, slvAddr); LogUtil.info(Name + WarnMsg);
System.Threading.Thread.Sleep(1200); Alarm(LineAlarmType.AxisAlarm, 5.ToString(), WarnMsg, MoveInfo.MoveType);
ACServerManager.ServoOn(portName, slvAddr); return false;
System.Threading.Thread.Sleep(100);
if (ACServerManager.ServerOnStatus(portName, slvAddr))
{
LogUtil.info( Name + "清理报警后重新打卡轴成功:" + Config.UpDown_Axis.Explain);
}
else
{
ACServerManager.ServoOff(portName, slvAddr);
WarnMsg = Name + "打开轴" + Config.UpDown_Axis.Explain + "失败 ";
LogUtil.info( Name + WarnMsg);
Alarm(LineAlarmType.AxisAlarm, 5.ToString(), WarnMsg, MoveInfo.MoveType);
return false;
}
} }
}
return true; return true;
} }
...@@ -673,12 +682,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -673,12 +682,12 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.UpDownAxis_ServoOn, IO_VALUE.LOW); IOMove(IO_Type.UpDownAxis_ServoOn, IO_VALUE.LOW);
} }
private void ACAxisHomeMove(ConfigMoveAxis moveAxis) private void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.info( moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.info(moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
} }
...@@ -688,7 +697,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -688,7 +697,7 @@ namespace OnlineStore.DeviceLibrary
private void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed) private void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
} }
...@@ -700,7 +709,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -700,7 +709,7 @@ namespace OnlineStore.DeviceLibrary
msg = ""; msg = "";
string deviceName = moveAxis.DeviceName; string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue(); short axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0); bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo); int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition); int errorCount = Math.Abs(outCount - targetPosition);
...@@ -713,7 +722,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -713,7 +722,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error( moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error(moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -722,7 +731,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -722,7 +731,7 @@ namespace OnlineStore.DeviceLibrary
{ {
msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警"; + "],误差过大,需要报警";
LogUtil.error( msg); LogUtil.error(msg);
} }
} }
return false; return false;
...@@ -742,7 +751,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -742,7 +751,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error( moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次"); LogUtil.error(moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次");
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点"); //LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -750,11 +759,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -750,11 +759,11 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error( msg); LogUtil.error(msg);
} }
} }
return false; return false;
} }
/// <summary> /// <summary>
/// 上下气缸移动到上升端 /// 上下气缸移动到上升端
/// </summary> /// </summary>
...@@ -769,7 +778,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -769,7 +778,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up); CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
} }
} }
private void UpdownDownMove(int trayHeight) private void UpdownDownMove(int trayHeight)
{ {
if (UpdownUseAxis) if (UpdownUseAxis)
...@@ -787,7 +796,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -787,7 +796,7 @@ namespace OnlineStore.DeviceLibrary
if (UpdownUseAxis) if (UpdownUseAxis)
{ {
int position = Config.GetUpdownBoxPosition(trayHeight); int position = Config.GetUpdownBoxPosition(trayHeight);
ACAxisMove(Config.UpDown_Axis, position,Config.UpdownAxis_DownSpeed); ACAxisMove(Config.UpDown_Axis, position, Config.UpdownAxis_DownSpeed);
} }
else else
{ {
......
...@@ -87,12 +87,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,12 +87,12 @@ namespace OnlineStore.DeviceLibrary
//一分钟还未检测到 //一分钟还未检测到
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut) if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时"; WarnMsg = Name + "等待" + NotOkMsg + " 超时";
Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType); Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error( MoveInfo.Name + WarnMsg, 13); LogUtil.error(MoveInfo.Name + WarnMsg, 13);
} }
else if (rwSpan.TotalSeconds > 3&&span.TotalSeconds>3) else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3)
{ {
preRWTime = DateTime.Now; preRWTime = DateTime.Now;
string msg = moveInfo.Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:"; string msg = moveInfo.Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
...@@ -120,7 +120,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,7 +120,7 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
} }
else if (wait.WaitType.Equals( 8)) else if (wait.WaitType.Equals(8))
{ {
string posId = moveInfo.MoveParam.PosId; string posId = moveInfo.MoveParam.PosId;
int id = moveInfo.MoveParam.GetStoreId(); int id = moveInfo.MoveParam.GetStoreId();
...@@ -130,9 +130,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -130,9 +130,10 @@ namespace OnlineStore.DeviceLibrary
{ {
int storeId = moveInfo.MoveParam.GetStoreId(); int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId); wait.IsEnd = LineServer.BoxCanReviceTray(storeId);
}else if (wait.WaitType.Equals(10)) }
else if (wait.WaitType.Equals(10))
{ {
// wait.IsEnd = LineManager.Line.SideWay34HasTray().Equals(false); wait.IsEnd = LineManager.Line.SideWay34HasTray().Equals(false);
} }
if (wait.IsEnd && moveInfo.OneWaitCanEndStep) if (wait.IsEnd && moveInfo.OneWaitCanEndStep)
{ {
...@@ -153,7 +154,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -153,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
{ {
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg
+ "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒"; + "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error( WarnMsg, 18); LogUtil.error(WarnMsg, 18);
Alarm(LineAlarmType.IoSingleTimeOut, "", WarnMsg, moveInfo.MoveType); Alarm(LineAlarmType.IoSingleTimeOut, "", WarnMsg, moveInfo.MoveType);
} }
...@@ -182,7 +183,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -182,7 +183,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(LineMoveType.OutStore); MoveInfo.NewMove(LineMoveType.OutStore);
MoveInfo.MoveParam = param; MoveInfo.MoveParam = param;
MoveInfo.NextMoveStep(LineMoveStep.MO_50_StartOutProcess); MoveInfo.NextMoveStep(LineMoveStep.MO_50_StartOutProcess);
TrayManager.AddNeedEmptyTrayNum(); TrayManager.AddNeedEmptyTrayNum();
return true; return true;
} }
else else
...@@ -212,10 +213,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -212,10 +213,10 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_50_StartOutProcess)) if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_50_StartOutProcess))
{ {
OutStoreLog("出库: MO_51_BeforeAfterCylinderBefore ( 前后气缸前进 )"); OutStoreLog("出库: MO_51_BeforeAfterCylinderBefore ( 前后气缸前进 )");
MoveInfo.NextMoveStep(LineMoveStep.MO_51_BeforeAfterCylinderBefore); MoveInfo.NextMoveStep(LineMoveStep.MO_51_BeforeAfterCylinderBefore);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_51_BeforeAfterCylinderBefore)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_51_BeforeAfterCylinderBefore))
{ {
OutStoreLog("出库: MO_52_UpDownCylinderDown ( 上下气缸1下降 )"); OutStoreLog("出库: MO_52_UpDownCylinderDown ( 上下气缸1下降 )");
MoveInfo.NextMoveStep(LineMoveStep.MO_52_UpDownCylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_52_UpDownCylinderDown);
...@@ -309,7 +310,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -309,7 +310,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:(MO_08_UpDownCylinderUp 上下气缸1上升)"); OutStoreLog("出库:(MO_08_UpDownCylinderUp 上下气缸1上升)");
this.MoveInfo.NextMoveStep(LineMoveStep.MO_60_UpDownCylinderUp); this.MoveInfo.NextMoveStep(LineMoveStep.MO_60_UpDownCylinderUp);
UpdownUpMove(); UpdownUpMove();
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_60_UpDownCylinderUp)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_60_UpDownCylinderUp))
{ {
...@@ -320,9 +321,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -320,9 +321,9 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_06_TopCylinder_Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_06_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
LogInfo("【" + posId + "】出库处理结束,!"); LogInfo("【" + posId + "】出库处理结束,!");
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
...@@ -395,14 +396,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -395,14 +396,14 @@ namespace OnlineStore.DeviceLibrary
{ {
InStoreLog("入库:(MI_09_UpDownCylinderUp,上下气缸1上升)"); InStoreLog("入库:(MI_09_UpDownCylinderUp,上下气缸1上升)");
MoveInfo.NextMoveStep(LineMoveStep.MI_09_UpDownCylinderUp); MoveInfo.NextMoveStep(LineMoveStep.MI_09_UpDownCylinderUp);
UpdownUpMove(); UpdownUpMove();
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_09_UpDownCylinderUp)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_09_UpDownCylinderUp))
{ {
int num = MoveInfo.MoveParam.TrayNumber; int num = MoveInfo.MoveParam.TrayNumber;
MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox); MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox);
LogInfo("入库【" + posId + "】处理(等待移栽):(判断box门口没有盘, 且可以入库),更新盘号【" + num + "】为空盘"); LogInfo("入库【" + posId + "】处理(等待移栽):(判断box门口没有盘, 且可以入库),更新盘号【" + num + "】为空盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray()); MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateFixtureValue(num, false, 0); TrayManager.UpdateFixtureValue(num, false, 0);
//阻挡气缸移动 //阻挡气缸移动
...@@ -445,7 +446,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -445,7 +446,7 @@ namespace OnlineStore.DeviceLibrary
LineServer.StartInStore(DeviceID, MoveInfo.MoveParam); LineServer.StartInStore(DeviceID, MoveInfo.MoveParam);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_14_BeforeAfterCylinderAfter)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_14_BeforeAfterCylinderAfter))
{ {
MoveInfo.NextMoveStep(LineMoveStep.MI_15_SendEnd); MoveInfo.NextMoveStep(LineMoveStep.MI_15_SendEnd);
//判断料仓是否在入库中,如果么有在入库中,需要重新发送入库消息 //判断料仓是否在入库中,如果么有在入库中,需要重新发送入库消息
if (!LineServer.IsInStorePro(DeviceID)) if (!LineServer.IsInStorePro(DeviceID))
...@@ -456,7 +457,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -456,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
InStoreLog("入库:(MI_15_SendEnd , 送料流程完成,料仓已开始入库)"); InStoreLog("入库:(MI_15_SendEnd , 送料流程完成,料仓已开始入库)");
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_15_SendEnd)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_15_SendEnd))
{ {
...@@ -493,7 +494,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -493,7 +494,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="currMoveTrayNum"></param> /// <param name="currMoveTrayNum"></param>
/// <returns></returns> /// <returns></returns>
private bool CheckIsNeedOutStore() private bool CheckIsNeedOutStore()
{ {
bool isFull = TrayManager.IsFixTureFull(currMoveTrayNum); bool isFull = TrayManager.IsFixTureFull(currMoveTrayNum);
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && (MoveInfo.MoveStep >= LineMoveStep.MO_56_BeforeAfterCylinderAfter) if (MoveInfo.MoveType.Equals(LineMoveType.OutStore) && (MoveInfo.MoveStep >= LineMoveStep.MO_56_BeforeAfterCylinderAfter)
&& (!MoveInfo.MoveStep.Equals(LineMoveStep.MO_60_UpDownCylinderUp))) && (!MoveInfo.MoveStep.Equals(LineMoveStep.MO_60_UpDownCylinderUp)))
...@@ -517,7 +518,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -517,7 +518,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private bool CheckIsNeedInStore() private bool CheckIsNeedInStore()
{ {
bool isfull = TrayManager.IsFixTureFull(currMoveTrayNum); bool isfull = TrayManager.IsFixTureFull(currMoveTrayNum);
LogInfo("***************入库*****验证入库编号,托盘号【" + currMoveTrayNum + "】,isfull【" + isfull + "】"); LogInfo("***************入库*****验证入库编号,托盘号【" + currMoveTrayNum + "】,isfull【" + isfull + "】");
//FixtureCodeInfo code = GetBox().currInOutFixture; //FixtureCodeInfo code = GetBox().currInOutFixture;
...@@ -540,7 +541,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -540,7 +541,7 @@ namespace OnlineStore.DeviceLibrary
{ {
reIndex = i; reIndex = i;
currCode = cc; currCode = cc;
LogInfo("***************入库*****需要入库,托盘号【" + currMoveTrayNum + "】,是排队列表中的入库信息【" + currCode.ToStr() + "】 ,入库移栽"); LogInfo("*******托盘" + currMoveTrayNum + "需要入库【" + currCode.ToStr() + "】 ,开始入库移栽");
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW); SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW);
break; break;
} }
...@@ -550,8 +551,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -550,8 +551,8 @@ namespace OnlineStore.DeviceLibrary
waitInStoreList.RemoveAt(reIndex); waitInStoreList.RemoveAt(reIndex);
if (!LineServer.BoxCanInStore(DeviceID)) if (!LineServer.BoxCanInStore(DeviceID))
{ {
LogUtil.info(Name + "***************需要入库 【" + currCode.ToStr() + "】 ,料仓未上线或出库中,入库失败"); LogUtil.info(Name + "*******托盘" + currMoveTrayNum + "需要入库【" + currCode.ToStr() + "】,BoxCanInStore验证失败,先移栽再等待料仓可入库,开始入库移栽");
return false; return true;
} }
else else
{ {
...@@ -567,33 +568,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -567,33 +568,35 @@ namespace OnlineStore.DeviceLibrary
#region 托盘检测 #region 托盘检测
private void StartCheckFixture() private void StartCheckFixture()
{ {
int num = TrayManager.GetNum(DeviceID); int num = TrayManager.GetNum(DeviceID);
if (IOValue(IO_Type.Fixture_Check_4).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.Fixture_Check_4).Equals(IO_VALUE.HIGH))
{ {
//托盘在两个阻挡内 //托盘在两个阻挡内
if (num > 0) if (num > 0)
{ {
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)"); CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.EndStepWait(); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
// SecondMoveInfo.EndStepWait();
} }
else else
{ {
LogUtil.error(Name + "检测到check4亮,但是为获取到托盘号,StartCheckFixture失败~"); LogUtil.error(Name + "检测到check4亮,但是为获取到托盘号,StartCheckFixture失败~");
} }
} }
else if (IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.HIGH))
{ {
//托盘在第一个阻挡处 //托盘在第一个阻挡处
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
CheckLog(" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down阻挡气缸1-1下降 ,等待夹具检测4=1,最多等待1秒)"); CheckLog(" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down阻挡气缸1-1下降 ,最多等待1秒)");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
} }
} }
private void CheckFixtureProcess() private void CheckFixtureProcess()
...@@ -617,6 +620,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -617,6 +620,7 @@ namespace OnlineStore.DeviceLibrary
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_02_FixtureCheck 阻挡气缸1-1上升,等待夹具检测4=1)"); CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_02_FixtureCheck 阻挡气缸1-1上升,等待夹具检测4=1)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH));
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck))
...@@ -624,7 +628,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -624,7 +628,8 @@ namespace OnlineStore.DeviceLibrary
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)"); CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.EndStepWait(); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
// SecondMoveInfo.EndStepWait();
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_StopCylinder2Down)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_StopCylinder2Down))
{ {
...@@ -681,12 +686,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -681,12 +686,12 @@ namespace OnlineStore.DeviceLibrary
} }
CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)"); CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo);
//if (DeviceID.Equals(2)) if (DeviceID.Equals(2))
//{ {
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay()); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
// SecondMoveInfo.OneWaitCanEndStep = true; SecondMoveInfo.OneWaitCanEndStep = true;
//} }
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -761,12 +766,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -761,12 +766,12 @@ namespace OnlineStore.DeviceLibrary
{ {
CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)"); CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo);
//if (DeviceID.Equals(2)) if (DeviceID.Equals(2))
//{ {
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay()); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
// SecondMoveInfo.OneWaitCanEndStep = true; SecondMoveInfo.OneWaitCanEndStep = true;
//} }
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_07_WaitCanGo)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_07_WaitCanGo))
...@@ -774,7 +779,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -774,7 +779,8 @@ namespace OnlineStore.DeviceLibrary
CheckLog("托盘放行 SecondStoreMove:(MO_10_StopCylinder2_Down ,阻挡气缸1-2下降)"); CheckLog("托盘放行 SecondStoreMove:(MO_10_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_10_StopCylinder2_Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_10_StopCylinder2_Down);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.EndStepWait(); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_10_StopCylinder2_Down)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_10_StopCylinder2_Down))
{ {
...@@ -787,6 +793,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -787,6 +793,7 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_StopCylinder_Back); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_StopCylinder_Back);
CheckLog("托盘放行 SecondStoreMove:(MO_12_StopCylinder_Back , 阻挡气缸1-2上升 )"); CheckLog("托盘放行 SecondStoreMove:(MO_12_StopCylinder_Back , 阻挡气缸1-2上升 )");
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_StopCylinder_Back)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_StopCylinder_Back))
...@@ -845,7 +852,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -845,7 +852,7 @@ namespace OnlineStore.DeviceLibrary
public void LogInfo(string logInfo) public void LogInfo(string logInfo)
{ {
LogUtil.info( Name + logInfo); LogUtil.info(Name + logInfo);
} }
} }
} }
...@@ -88,17 +88,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,17 +88,13 @@ namespace OnlineStore.DeviceLibrary
{ {
if (balserNameList.Contains(cameraName)) if (balserNameList.Contains(cameraName))
{ {
bool result = BaslerCamera.Instance.IsOpen; bool result = BaslerCamera.Instance.Open(cameraName);
if (!result) // LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
{
result = BaslerCamera.Instance.Open(cameraName);
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
}
if (result) if (result)
{ {
BaslerCamera.Instance.GrabOne(); BaslerCamera.Instance.GrabOne();
bitm = BaslerCamera.Instance.Image; bitm = BaslerCamera.Instance.Image;
//BaslerCamera.Instance.Close(); BaslerCamera.Instance.Close();
} }
else else
{ {
...@@ -107,17 +103,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,17 +103,13 @@ namespace OnlineStore.DeviceLibrary
} }
else if (hikNameList.Contains(cameraName)) else if (hikNameList.Contains(cameraName))
{ {
bool result = HIKCamera.Instance.IsOpen; bool result = HIKCamera.Instance.Open(cameraName);
if (!result) // LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
{
result = HIKCamera.Instance.Open(cameraName);
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
}
if (result) if (result)
{ {
HIKCamera.Instance.GrabOne(); HIKCamera.Instance.GrabOne();
bitm = HIKCamera.Instance.Image; bitm = HIKCamera.Instance.Image;
//HIKCamera.Instance.Close(); HIKCamera.Instance.Close();
} }
else else
{ {
......
...@@ -38,7 +38,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -38,7 +38,8 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
}return false; }
return false;
} }
/// <summary> /// <summary>
/// 移栽装置拦截托盘时, 判断是否可以入库,入库执行可以入库,出库过程中不能入库 /// 移栽装置拦截托盘时, 判断是否可以入库,入库执行可以入库,出库过程中不能入库
...@@ -54,7 +55,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -54,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds < ClientKeepSecond && box.SAlarmType.Equals(LineAlarmType.None)) if (span.TotalSeconds < ClientKeepSecond && box.SAlarmType.Equals(LineAlarmType.None))
{ {
LineRunStatus runs = (LineRunStatus)box.SRunStatus; LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Runing)) if (runs.Equals(LineRunStatus.Runing))
{ {
return true; return true;
...@@ -74,18 +75,39 @@ namespace OnlineStore.DeviceLibrary ...@@ -74,18 +75,39 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 判断库位是否验证成功 /// 判断库位是否验证成功
/// </summary> /// </summary>
public static bool RightInPosId(int id,string posId) public static bool RightInPosId(int id, string posId)
{ {
BoxInfo box = GetBoxInfo(id); BoxInfo box = GetBoxInfo(id);
if (box != null) if (box != null)
{ {
TimeSpan span = DateTime.Now - box.LastMsgTime; TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond ) if (span.TotalSeconds < ClientKeepSecond)
{ {
if (box.WaitInStoreList != null && box.WaitInStoreList.Contains(posId)) if (box.WaitInStoreList != null && box.WaitInStoreList.Contains(posId))
{ {
return true; return true;
} }
}
}
return false;
}
public static bool IsInStorePro(int id)
{
BoxInfo box = GetBoxInfo(id);
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (box != null && span.TotalSeconds < ClientKeepSecond)
{
LineStatus status = (LineStatus)box.SStatus;
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Busy))
{
if (status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute))
{
return true;
}
} }
} }
return false; return false;
...@@ -101,34 +123,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -101,34 +123,13 @@ namespace OnlineStore.DeviceLibrary
if (box != null) if (box != null)
{ {
TimeSpan span = DateTime.Now - box.LastMsgTime; TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond&&box.HasTray.Equals(0)&&box.SAlarmType.Equals(LineAlarmType.None) ) if (span.TotalSeconds < ClientKeepSecond && box.HasTray.Equals(0) && box.SAlarmType.Equals(LineAlarmType.None))
{ {
LineRunStatus runs = (LineRunStatus)box.SRunStatus; LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Runing)) if (runs.Equals(LineRunStatus.Runing))
{ {
return true; return true;
}
}
}
return false;
}
public static bool IsInStorePro(int id)
{
BoxInfo box = GetBoxInfo(id);
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (box != null && span.TotalSeconds < ClientKeepSecond)
{
LineStatus status = (LineStatus)box.SStatus;
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Busy))
{
if (status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute))
{
return true;
} }
} }
} }
...@@ -147,7 +148,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -147,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds < ClientKeepSecond) if (span.TotalSeconds < ClientKeepSecond)
{ {
if (LineManager.Line.CanIntore(box.ID)) if (LineManager.Line.CanIntore(box.ID))
{ {
result += box.CId + ","; result += box.CId + ",";
} }
} }
...@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public static void StopServer() public static void StopServer()
{ {
try try
...@@ -192,15 +193,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -192,15 +193,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, "关闭 监听出错:" + ex.ToString()); LogUtil.error(LOGGER, "关闭 监听出错:" + ex.ToString());
} }
} }
public static bool UpdateBoxDebug(int id,int isDebug) public static bool UpdateBoxDebug(int id, int isDebug)
{ {
if (ClientMap.ContainsKey(id)) if (ClientMap.ContainsKey(id))
{ {
Dictionary<string,object> paramList =new Dictionary<string, object>(); Dictionary<string, object> paramList = new Dictionary<string, object>();
paramList.Add(S_Cmd, cmd_updateDebug); paramList.Add(S_Cmd, cmd_updateDebug);
int canOutStore = LineManager.Line.CanOutStore(id) ? 1 : 0; int canOutStore = LineManager.Line.CanOutStore(id) ? 1 : 0;
paramList.Add(S_CanOutStore, canOutStore); paramList.Add(S_CanOutStore, canOutStore);
paramList.Add(S_IsDebug, isDebug); paramList.Add(S_IsDebug, isDebug);
string msg = ToParamStr(paramList); string msg = ToParamStr(paramList);
Client client = ClientMap[id]; Client client = ClientMap[id];
bool result = SendStrToClient(client, msg); bool result = SendStrToClient(client, msg);
...@@ -228,7 +229,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -228,7 +229,7 @@ namespace OnlineStore.DeviceLibrary
bool result = SendStrToClient(client, msg); bool result = SendStrToClient(client, msg);
if (!result) if (!result)
{ {
LogUtil.error("StartInStore【" + id+"】【"+msg+"】失败"); LogUtil.error("StartInStore【" + id + "】【" + msg + "】失败");
} }
} }
return false; return false;
...@@ -236,7 +237,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -236,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 获取整个料仓的状态 /// 获取整个料仓的状态
/// </summary> /// </summary>
public static Operation GetInStoreOperation(string message) public static Operation GetInStoreOperation(string message)
{ {
//构建发送给服务器的对象 //构建发送给服务器的对象
Operation lineOperation = new Operation(); Operation lineOperation = new Operation();
...@@ -273,21 +274,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,21 +274,22 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功"); // LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
} }
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
LogUtil.error("CheckInStorePos【" + id + "】【" + param.ToStr() + "】失败"); LogUtil.error("CheckInStorePos【" + id + "】【" + param.ToStr() + "】失败");
} }
return false; return false;
} }
private static bool SendStrToClient(Client client, string sendMsg)
private static bool SendStrToClient(Client client, string sendMsg)
{ {
if (client != null && client.ClientSocket.Connected) if (client != null && client.ClientSocket.Connected)
{ {
...@@ -296,7 +298,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -296,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
client.ClientSocket.Send(sendBuffer); client.ClientSocket.Send(sendBuffer);
return true; return true;
} }
return false; return false;
} }
private static string ToParamStr(Dictionary<string, object> paramList) private static string ToParamStr(Dictionary<string, object> paramList)
...@@ -306,7 +308,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
return result + "\r"; return result + "\r";
} }
private static object MapLock = ""; private static object MapLock = "";
private static void SaveBoxClient(int id,BoxInfo box,Client client) private static void SaveBoxClient(int id, BoxInfo box, Client client)
{ {
lock (MapLock) lock (MapLock)
{ {
...@@ -324,19 +326,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,19 +326,19 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private static void tcp_ReviceMsgEvent(Client client, string msg) private static void tcp_ReviceMsgEvent(Client client, string msg)
{ {
try try
{ {
if (String.IsNullOrEmpty(msg)) if (String.IsNullOrEmpty(msg))
{ {
return; return;
} }
ProcessMsg(client, msg); ProcessMsg(client, msg);
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("处理料仓消息【"+msg+"】出错:"+ ex.ToString()); LogUtil.error("处理料仓消息【" + msg + "】出错:" + ex.ToString());
} }
} }
...@@ -349,14 +351,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -349,14 +351,14 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug("收到【" + add + "】的消息【" + msg + "】"); LogUtil.debug("收到【" + add + "】的消息【" + msg + "】");
StoreSendBean storeSMsg = JsonHelper.DeserializeJsonToObject<StoreSendBean>(msg); StoreSendBean storeSMsg = JsonHelper.DeserializeJsonToObject<StoreSendBean>(msg);
if ( storeSMsg==null) if (storeSMsg == null)
{ {
LogUtil.error("收到【" + add + "】的消息【" + msg + "】,解析失败"); LogUtil.error("收到【" + add + "】的消息【" + msg + "】,解析失败");
} }
else else
{ {
int id = storeSMsg.StoreId; int id = storeSMsg.StoreId;
BoxInfo box = new BoxInfo(storeSMsg.StoreId,storeSMsg.Cid,storeSMsg.Seq,storeSMsg.SStatus,storeSMsg.SRunStatus,storeSMsg.DoorHasTray,storeSMsg.AlarmType,storeSMsg.WaitInStoreList); BoxInfo box = new BoxInfo(storeSMsg.StoreId, storeSMsg.Cid, storeSMsg.Seq, storeSMsg.SStatus, storeSMsg.SRunStatus, storeSMsg.DoorHasTray, storeSMsg.AlarmType, storeSMsg.WaitInStoreList);
SaveBoxClient(id, box, client); SaveBoxClient(id, box, client);
string cmd = storeSMsg.Cmd; string cmd = storeSMsg.Cmd;
...@@ -385,16 +387,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -385,16 +387,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("SendHeartBack【" + id + "】【" + msg + "】失败"); LogUtil.error("SendHeartBack【" + id + "】【" + msg + "】失败");
} }
return true; return true;
} }
return false; return false;
} }
private static char cmd_spilt = ';'; private static char cmd_spilt = ';';
private static string cmd_heart = "heart"; private static string cmd_heart = "heart";
private static string cmd_outend = "outend"; private static string cmd_outend = "outend";
private static string cmd_startIn = "starIn"; private static string cmd_startIn = "starIn";
private static string cmd_updateDebug = "updateDebug"; private static string cmd_updateDebug = "updateDebug";
public static string cmd_checStartIn = "cmd_checStartIn"; public static string cmd_checStartIn = "cmd_checStartIn";
...@@ -444,4 +446,4 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,4 +446,4 @@ namespace OnlineStore.DeviceLibrary
public List<string> WaitInStoreList = new List<string>(); public List<string> WaitInStoreList = new List<string>();
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!