Commit a9d24b1c LN

横移处理修改

1 个父辈 9fea21ae
...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,, ...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D5,,,,, PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D5,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D6,,,,, PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D6,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,1,COM5,0,,, AXIS,0,轴二提升上料轴,Batch_Axis,1,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,, PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,, PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,, PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,, ...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,, PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,, PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM5,0,,, AXIS,0,轴一移栽上下轴,UpDown_Axis,2,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,, PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,, PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,,
......
...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,, ...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D3,,,,, PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D3,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D4,,,,, PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D4,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,3,COM5,0,,, AXIS,0,轴二提升上料轴,Batch_Axis,3,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,, PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,, PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,, PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,, ...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,, PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,, PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,4,COM5,0,,, AXIS,0,轴一移栽上下轴,UpDown_Axis,4,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,, PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,, PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,,
......
...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,, ...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D1,,,,, PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D1,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D2,,,,, PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D2,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,5,COM5,0,,, AXIS,0,轴二提升上料轴,Batch_Axis,5,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,, PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,, PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,, PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,, ...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,, PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,, PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,6,COM5,0,,, AXIS,0,轴一移栽上下轴,UpDown_Axis,6,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,, PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,268294,,,,, PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,268294,,,,,
......
...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,1,,,,, ...@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,1,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D7,,,,, PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D7,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D8,,,,, PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D8,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,7,COM5,0,,, AXIS,0,轴二提升上料轴,Batch_Axis,7,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,, PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,, PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20450000,,,,, PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20450000,,,,,
...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,, ...@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,2000,,,,, PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,2000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,, PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,, ,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,8,COM5,0,,, AXIS,0,轴一移栽上下轴,UpDown_Axis,8,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=158000,,,,, PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=158000,,,,,
PRO,0,移栽上下轴P3放料位置,UpDownAxisP3,310000,,,,, PRO,0,移栽上下轴P3放料位置,UpDownAxisP3,310000,,,,,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -46,45 +47,63 @@ namespace OnlineStore.DeviceLibrary ...@@ -46,45 +47,63 @@ namespace OnlineStore.DeviceLibrary
public event TrayProcessEnd TrayPEndEvent; public event TrayProcessEnd TrayPEndEvent;
#region 托盘检测 #region 托盘检测
private InOutParam CheckParam = new InOutParam(); private InOutParam CheckParam = new InOutParam();
// private DateTime swWaitTime = DateTime.Now;
private DateTime lastStopDown = DateTime.Now;
//private bool swIsWait = false;
private Stopwatch swWaitWatch = new Stopwatch();
private void StartCheckFixture() private void StartCheckFixture()
{ {
if (!LineManager.Line.CanProcessLine()) if (!LineManager.Line.CanProcessLine())
{ {
swWaitWatch.Stop();
return; return;
} }
if (Config.SidesWayNum > 0) if (Config.SidesWayNum > 0)
{ {
bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum)); bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && canProcess) if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && canProcess)
{ {
UpdateTrayNum(); if (TrayManager.checkWatch(swWaitWatch, TrayManager.SwTrayWaitTime, true))
// preTrayNum = currTrayNum;
//int num = TrayManager.GetTrayNum(DeviceID);
//currTrayNum = num;
//判断是否是需要的托盘
if (CurrTrayIsNeed(currTrayNum, true))
{ {
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam); UpdateTrayNum();
TrayManager.UpdateSWState(Config.SidesWayNum, 2); //判断是否是需要的托盘
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp); if (CurrTrayIsNeed(currTrayNum, true))
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )"); {
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up); SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
}
else
{
SMoveEnd();
}
} }
else }
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && canProcess
&& (DateTime.Now - lastStopDown).TotalSeconds > 4)
{
if (TrayManager.checkWatch(swWaitWatch, TrayManager.SwTrayWaitTime, true))
{ {
// currTrayNum = num; swWaitWatch.Stop();
TrayManager.UpdateSWState(Config.SidesWayNum, 1); //SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
//TrayManager.UpdateSWState(Config.SidesWayNum, 2);
//SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down);
//CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待" + TrayManager.StopDownWaitTime);
//IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
lastStopDown = DateTime.Now;
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
} }
} }
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && canProcess) else
{ {
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam); swWaitWatch.Stop();
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down);
CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待"+TrayManager.StopDownWaitTime);
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
} }
} }
else else
...@@ -355,6 +374,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -355,6 +374,7 @@ namespace OnlineStore.DeviceLibrary
private void SMoveEnd() private void SMoveEnd()
{ {
lastStopDown = DateTime.Now.AddSeconds(-2);
TrayManager.UpdateSWState(Config.SidesWayNum, 1); TrayManager.UpdateSWState(Config.SidesWayNum, 1);
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum); this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -433,8 +434,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -433,8 +434,8 @@ namespace OnlineStore.DeviceLibrary
private void SideWayStop() private void SideWayStop()
{ {
SideWay41IsWait = false; sw23WaitWatch.Stop();
SideWay23IsWait = false; sw41WaitWatch.Stop();
TrayManager.UpdateSWState(4, 0); TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0); TrayManager.UpdateSWState(1, 0);
TrayManager.UpdateSWState(2, 0); TrayManager.UpdateSWState(2, 0);
...@@ -449,10 +450,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -449,10 +450,12 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW); IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW);
} }
private DateTime SideWay41Ntime = DateTime.Now; //private DateTime SideWay41Ntime = DateTime.Now;
private bool SideWay41IsWait = false; //private bool SideWay41IsWait = false;
private DateTime SideWay23Ntime = DateTime.Now; //private DateTime SideWay23Ntime = DateTime.Now;
private bool SideWay23IsWait = false; //private bool SideWay23IsWait = false;
private Stopwatch sw41WaitWatch = new Stopwatch();
private Stopwatch sw23WaitWatch = new Stopwatch();
private bool sdIsInprocess = false; private bool sdIsInprocess = false;
private DateTime sdlastProTime = DateTime.Now; private DateTime sdlastProTime = DateTime.Now;
...@@ -472,8 +475,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -472,8 +475,8 @@ namespace OnlineStore.DeviceLibrary
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽 //流水线转动中,并且在忙碌或出入库处理中,需要处理移栽
if (!CanProcessLine()) if (!CanProcessLine())
{ {
SideWay23IsWait = false; sw41WaitWatch.Stop();
SideWay41IsWait = false; sw23WaitWatch.Stop();
sdIsInprocess = false; sdIsInprocess = false;
return; return;
} }
...@@ -483,8 +486,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -483,8 +486,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.SW4_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) && if (IOValue(IO_Type.SW4_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) &&
TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1)) TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1))
{ {
TimeSpan span41 = DateTime.Now - SideWay41Ntime; if (TrayManager.checkWatch(sw41WaitWatch, TrayManager.SwTrayWaitTime, true))
if (SideWay41IsWait && span41.TotalMilliseconds > TrayManager.SwTrayWaitTime)
{ {
SW41_MoveInfo.NewMove(LineMoveType.InStore); SW41_MoveInfo.NewMove(LineMoveType.InStore);
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck); SW41_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
...@@ -493,12 +495,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -493,12 +495,7 @@ namespace OnlineStore.DeviceLibrary
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW4_TrayCheck, IO_VALUE.HIGH)); SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW4_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW4_LocationCylinder_Down); CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW4_LocationCylinder_Down);
CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down); CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
} }
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
} }
else if (IOValue(IO_Type.SW4_StopCheck).Equals(IO_VALUE.HIGH) && else if (IOValue(IO_Type.SW4_StopCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.SW4_StopDown).Equals(IO_VALUE.LOW) && IOValue(IO_Type.SW4_StopDown).Equals(IO_VALUE.LOW) &&
...@@ -506,9 +503,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -506,9 +503,8 @@ namespace OnlineStore.DeviceLibrary
IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) && IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) &&
(DateTime.Now- lastSw4StopDownTime).TotalSeconds>4 && (DateTime.Now- lastSw4StopDownTime).TotalSeconds>4 &&
TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1)) TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1))
{ {
TimeSpan span41 = DateTime.Now - SideWay41Ntime; if (TrayManager.checkWatch(sw41WaitWatch, TrayManager.SwTrayWaitTime,true))
if (SideWay41IsWait && span41.TotalMilliseconds>TrayManager.SwTrayWaitTime)
{ {
//SW41_MoveInfo.NewMove(LineMoveType.InStore); //SW41_MoveInfo.NewMove(LineMoveType.InStore);
//SW41_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait); //SW41_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait);
...@@ -518,28 +514,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -518,28 +514,17 @@ namespace OnlineStore.DeviceLibrary
//CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down); //CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
//阻挡气缸下降500毫秒然后上升 //阻挡气缸下降500毫秒然后上升
lastSw4StopDownTime = DateTime.Now; lastSw4StopDownTime = DateTime.Now;
IOMove(IO_Type.SW4_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime); IOMove(IO_Type.SW4_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
SideWay41IsWait = false; }
} }
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
}
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
else else
{ {
SideWay41IsWait = false; sw41WaitWatch.Stop();
} }
} }
else else
{ {
SideWay41IsWait = false; sw41WaitWatch.Stop();
SideWay41BusyProcess(); SideWay41BusyProcess();
} }
if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None) && FeedingEquipMap[104].runStatus <= LineRunStatus.Wait) if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None) && FeedingEquipMap[104].runStatus <= LineRunStatus.Wait)
...@@ -549,8 +534,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -549,8 +534,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.SW2_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW3_TrayCheck).Equals(IO_VALUE.LOW) && if (IOValue(IO_Type.SW2_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW3_TrayCheck).Equals(IO_VALUE.LOW) &&
TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3)) TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3))
{ {
TimeSpan span34 = DateTime.Now - SideWay23Ntime; if (TrayManager.checkWatch(sw23WaitWatch, TrayManager.SwTrayWaitTime, true))
if (SideWay23IsWait && span34.TotalMilliseconds > TrayManager.SwTrayWaitTime)
{ {
SW23_MoveInfo.NewMove(LineMoveType.InStore); SW23_MoveInfo.NewMove(LineMoveType.InStore);
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck); SW23_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
...@@ -559,12 +543,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -559,12 +543,7 @@ namespace OnlineStore.DeviceLibrary
SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH)); SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down); CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down); CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
} }
else if (!SideWay23IsWait)
{
SideWay23IsWait = true;
SideWay23Ntime = DateTime.Now;
}
} }
else if (IOValue(IO_Type.SW2_StopCheck).Equals(IO_VALUE.HIGH) && else if (IOValue(IO_Type.SW2_StopCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.SW2_StopDown).Equals(IO_VALUE.LOW) && IOValue(IO_Type.SW2_StopDown).Equals(IO_VALUE.LOW) &&
...@@ -573,8 +552,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -573,8 +552,7 @@ namespace OnlineStore.DeviceLibrary
(DateTime.Now - lastSw2StopDownTime).TotalSeconds > 4 && (DateTime.Now - lastSw2StopDownTime).TotalSeconds > 4 &&
TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3)) TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3))
{ {
TimeSpan span34 = DateTime.Now - SideWay23Ntime; if (TrayManager.checkWatch(sw23WaitWatch, TrayManager.SwTrayWaitTime, true))
if (SideWay23IsWait && span34.TotalMilliseconds > TrayManager.SwTrayWaitTime)
{ {
//SW23_MoveInfo.NewMove(LineMoveType.InStore); //SW23_MoveInfo.NewMove(LineMoveType.InStore);
//SW23_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait); //SW23_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait);
...@@ -585,22 +563,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -585,22 +563,16 @@ namespace OnlineStore.DeviceLibrary
//阻挡气缸下降500毫秒然后上升 //阻挡气缸下降500毫秒然后上升
lastSw2StopDownTime = DateTime.Now; lastSw2StopDownTime = DateTime.Now;
IOMove(IO_Type.SW2_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime); IOMove(IO_Type.SW2_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
SideWay23IsWait = false;
}
else if (!SideWay23IsWait)
{
SideWay23IsWait = true;
SideWay23Ntime = DateTime.Now;
} }
} }
else else
{ {
SideWay23IsWait = false; sw23WaitWatch.Stop();
} }
} }
else else
{ {
SideWay23IsWait = false; sw23WaitWatch.Stop();
SideWay23BusyProcess(); SideWay23BusyProcess();
} }
...@@ -745,7 +717,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -745,7 +717,7 @@ namespace OnlineStore.DeviceLibrary
{ {
TrayManager.UpdateSWState(4, 0); TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0); TrayManager.UpdateSWState(1, 0);
lastSw4StopDownTime = DateTime.Now; lastSw4StopDownTime = DateTime.Now.AddSeconds(-2);
SW41_MoveInfo.EndMove(); SW41_MoveInfo.EndMove();
SWLog("横移轨道41:横移结束 "); SWLog("横移轨道41:横移结束 ");
} }
...@@ -866,7 +838,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -866,7 +838,7 @@ namespace OnlineStore.DeviceLibrary
{ {
TrayManager.UpdateSWState(2, 0); TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0); TrayManager.UpdateSWState(3, 0);
lastSw2StopDownTime = DateTime.Now; lastSw2StopDownTime = DateTime.Now.AddSeconds(-2);
SW23_MoveInfo.EndMove(); SW23_MoveInfo.EndMove();
SWLog("横移轨道23:横移结束 "); SWLog("横移轨道23:横移结束 ");
} }
......
...@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary; ...@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
...@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public static int SwTrayWaitTime = 500; public static int SwTrayWaitTime = 500;
public static int StopDownWaitTime = 500; public static int StopDownWaitTime = 500;
public static RFID RfidReader = new RFID(); public static RFID RfidReader = new RFID();
/// <summary> /// <summary>
/// 托盘集合,key=托盘编号,value=托盘详细信息 /// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary> /// </summary>
...@@ -36,9 +37,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -36,9 +37,9 @@ namespace OnlineStore.DeviceLibrary
/// 盘错乱的StoreID /// 盘错乱的StoreID
/// </summary> /// </summary>
public static int ErrorDeviceId = -1; public static int ErrorDeviceId = -1;
static TrayManager() static TrayManager()
{ {
} }
public static List<TrayInfo> getTrayList() public static List<TrayInfo> getTrayList()
{ {
...@@ -181,7 +182,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -181,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public static int GetTrayNum(int subType, bool isClear = false) public static int GetTrayNum(int subType, bool isClear = false)
{ {
// return 9; // return 9;
if (subType.Equals(104)) if (subType.Equals(104))
{ {
return LineManager.Line.Sw23TrayNum; return LineManager.Line.Sw23TrayNum;
...@@ -193,7 +194,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -193,7 +194,7 @@ namespace OnlineStore.DeviceLibrary
string ip = GetRFIP(subType); string ip = GetRFIP(subType);
//获取盘号 //获取盘号
RFIDData data = ReadRFID(ip,isClear); RFIDData data = ReadRFID(ip, isClear);
if (data != null) if (data != null)
{ {
if (data.RFType.Equals((byte)'E')) if (data.RFType.Equals((byte)'E'))
...@@ -202,29 +203,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -202,29 +203,29 @@ namespace OnlineStore.DeviceLibrary
} }
return 0; return 0;
} }
return 0; return 0;
} }
public static RFIDData GetShelfData(int subType) public static RFIDData GetShelfData(int subType)
{ {
string ip = GetRFIP(subType, 1); string ip = GetRFIP(subType, 1);
return ReadRFID(ip); return ReadRFID(ip);
} }
public static RFIDData ReadRFID(string ip,bool isClear=false) public static RFIDData ReadRFID(string ip, bool isClear = false)
{ {
try try
{ {
if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip)) if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{ {
RFIDData data= new RFIDData(RfidReader.Read(ip)); RFIDData data = new RFIDData(RfidReader.Read(ip));
if (isClear) if (isClear)
{ {
RfidReader.Clear(ip); RfidReader.Clear(ip);
} }
return data; return data;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -250,7 +251,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -250,7 +251,7 @@ 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 int GetSwStatus(int swNum)
{ {
//if (SidesWayStateMap.ContainsKey(swNum)) //if (SidesWayStateMap.ContainsKey(swNum))
...@@ -319,9 +320,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -319,9 +320,22 @@ namespace OnlineStore.DeviceLibrary
//} //}
} }
#endregion
#endregion
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true)
{
if (!watch.IsRunning)
{
watch.Restart();
return false;
}
else if (watch.ElapsedMilliseconds >= targetMs)
{
watch.Stop();
return true;
}
return false;
}
} }
public class RFIDData public class RFIDData
...@@ -364,6 +378,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -364,6 +378,8 @@ namespace OnlineStore.DeviceLibrary
{ {
return " [" + RFType + "],[" + Num + "] "; return " [" + RFType + "],[" + Num + "] ";
} }
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!