Commit 87046a49 LN

关机时要等待横移无托盘,所有托盘都是空或禁用时在关闭线体。

1 个父辈 253ddc3c
...@@ -565,10 +565,17 @@ namespace OnlineStore.AssemblyLine ...@@ -565,10 +565,17 @@ namespace OnlineStore.AssemblyLine
if (!stopRun && stopRequest && (DateTime.Now - stopTime).TotalSeconds > 40) if (!stopRun && stopRequest && (DateTime.Now - stopTime).TotalSeconds > 40)
{ {
stopRun = true; stopRun = true;
//停止所有料仓TToolStripMenuItem_Click(null, null);
lineBean.WriteDrivetMotorRun(IO_VALUE.LOW);
lineBean.LineStopRun = true; lineBean.LineStopRun = true;
LogUtil.info("收到服务端停机要求,停止环形线"); //停止所有料仓TToolStripMenuItem_Click(null, null);
if (lineBean.LineCanStop())
{
LogUtil.info("收到服务端停机要求,直接停止环形线");
lineBean.WriteDrivetMotorRun(IO_VALUE.LOW);
}
else
{
LogUtil.info("收到服务端停机要求,横移还有托盘,等托盘离开后再停止环形线");
}
} }
} }
else else
......
...@@ -552,6 +552,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -552,6 +552,9 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH); IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH);
} }
/// <summary>
/// 关机
/// </summary>
public bool LineStopRun = false; public bool LineStopRun = false;
public void WriteDrivetMotorRun(IO_VALUE value) public void WriteDrivetMotorRun(IO_VALUE value)
...@@ -561,7 +564,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -561,7 +564,18 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.DriveMotor_Run3, value); IOMove(IO_Type.DriveMotor_Run3, value);
IOMove(IO_Type.DriveMotor_Run4, value); IOMove(IO_Type.DriveMotor_Run4, value);
} }
public bool MotorHasRun()
{
if (IOValue(IO_Type.DriveMotor_Run1).Equals(IO_VALUE.HIGH) ||
IOValue(IO_Type.DriveMotor_Run2).Equals(IO_VALUE.HIGH) ||
IOValue(IO_Type.DriveMotor_Run3).Equals(IO_VALUE.HIGH) ||
IOValue(IO_Type.DriveMotor_Run4).Equals(IO_VALUE.HIGH)
)
{
return true;
}
return false;
}
#region 灯光处理 #region 灯光处理
...@@ -851,6 +865,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -851,6 +865,16 @@ namespace OnlineStore.DeviceLibrary
ShuntTimerProcess(); ShuntTimerProcess();
Shunt2TimerProcess(); Shunt2TimerProcess();
if (LineStopRun)
{
//需要关机
if (MotorHasRun() && LineCanStop())
{
WriteDrivetMotorRun(IO_VALUE.LOW);
LogInfo("收到服务端停机要求,线体还未关闭,停止环形线线体转动");
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -1181,5 +1205,62 @@ namespace OnlineStore.DeviceLibrary ...@@ -1181,5 +1205,62 @@ namespace OnlineStore.DeviceLibrary
} }
return null; return null;
} }
/// <summary>
/// 关机功能:判断是否可以关闭线体,验证横移上是否有料盘
/// </summary>
/// <returns></returns>
public bool LineCanStop()
{
if (!SW23_MoveInfo.MoveType.Equals(LineMoveType.None))
{
return false;
}
if (!SW41_MoveInfo.MoveType.Equals(LineMoveType.None))
{
return false;
}
if (!Shunt_MoveInfo.MoveType.Equals(LineMoveType.None))
{
if(Shunt_MoveInfo.MoveStep>=LineMoveStep.Shunt06_Top1Up&& Shunt_MoveInfo.MoveStep <= LineMoveStep.Shunt11_TopDown)
{
return false;
}
}
if (!Shunt2_MoveInfo.MoveType.Equals(LineMoveType.None))
{
if (Shunt2_MoveInfo.MoveStep >= LineMoveStep.Shunt06_Top1Up && Shunt2_MoveInfo.MoveStep <= LineMoveStep.Shunt11_TopDown)
{
return false;
}
}
if (hasTray())
{
return false;
}
return true;
}
/// <summary>
/// 所有托盘都要是空托盘或者禁用托盘
/// </summary>
/// <returns></returns>
public bool hasTray()
{
List<TrayInfo> trayList = TrayManager.getTrayList();
foreach (TrayInfo tray in trayList)
{
if (tray.IsFull)
{
if (TrayDisableManager.DisableTray(tray.TrayCode))
{
continue;
}
return true;
}
}
return false;
}
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -362,10 +362,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -362,10 +362,15 @@ namespace OnlineStore.DeviceLibrary
} }
private bool TrayNeedShunt(int trayNum, out string outMsg) private bool TrayNeedShunt(int trayNum, out string outMsg)
{ {
outMsg = ""; outMsg = "";
try try
{ {
//如果需要关机,所有托盘都不分流横移
if (LineStopRun)
{
return false;
}
TrayInfo trayInfo = TrayManager.GetTrayInfo(trayNum); TrayInfo trayInfo = TrayManager.GetTrayInfo(trayNum);
if (!trayInfo.IsFull) if (!trayInfo.IsFull)
{ {
......
...@@ -419,7 +419,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -419,7 +419,11 @@ namespace OnlineStore.DeviceLibrary
{ {
outMsg = ""; outMsg = "";
try try
{ { //如果需要关机,所有托盘都不分流横移
if (LineStopRun)
{
return false;
}
TrayInfo trayInfo = TrayManager.GetTrayInfo(trayNum); TrayInfo trayInfo = TrayManager.GetTrayInfo(trayNum);
if (!trayInfo.IsFull) if (!trayInfo.IsFull)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!