|
|
@@ -2,9 +2,7 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
using System.Threading;
|
|
|
-using System.Threading.Tasks;
|
|
|
using GSG.NET.Concurrent;
|
|
|
using GSG.NET.Logging;
|
|
|
using GSG.NET.Utils;
|
|
|
@@ -14,7 +12,6 @@ using OHV.Common.Shareds;
|
|
|
using OHV.SqliteDAL;
|
|
|
using Prism.Events;
|
|
|
using VehicleControlSystem.ControlLayer.Actuator.Cylinder;
|
|
|
-using VehicleControlSystem.ControlLayer.Axis;
|
|
|
using VehicleControlSystem.ControlLayer.IO;
|
|
|
using VehicleControlSystem.ControlLayer.Motion;
|
|
|
using VehicleControlSystem.Managers;
|
|
|
@@ -24,7 +21,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
/// <summary>
|
|
|
/// Control Layer 의 자원을 여기서 사용하자.
|
|
|
/// </summary>
|
|
|
- public class Vehicle : IDisposable
|
|
|
+ public class Vehicle : ControlObjectBase, IDisposable
|
|
|
{
|
|
|
static Logger logger = Logger.GetLogger();
|
|
|
|
|
|
@@ -76,7 +73,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public eVehicleState VehicleStateProperty
|
|
|
{
|
|
|
get { return vehicleState; }
|
|
|
- set { vehicleState = value; }
|
|
|
+ set { SetField(ref this.vehicleState, value); }
|
|
|
}
|
|
|
|
|
|
IEventAggregator eventAggregator;
|
|
|
@@ -175,7 +172,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- this.CheckObstacle();
|
|
|
+ if ( this.autoManager.OperationModeProperty == eOperatationMode.AutoMode)
|
|
|
+ this.CheckObstacle();
|
|
|
}
|
|
|
catch (ThreadInterruptedException threadInterruptedException)
|
|
|
{
|
|
|
@@ -225,12 +223,14 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
case SubCmd.eType.Load:
|
|
|
this.CurrentSubCommand = subCmd;
|
|
|
- this.Load(subCmd);
|
|
|
+ this.LoadCarrier(subCmd);
|
|
|
break;
|
|
|
|
|
|
case SubCmd.eType.Unload:
|
|
|
+ this.CurrentSubCommand = subCmd;
|
|
|
+ this.UnloadCarrier(subCmd);
|
|
|
break;
|
|
|
- case SubCmd.eType.Chaging:
|
|
|
+ case SubCmd.eType.Charge:
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -294,64 +294,48 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- //Load
|
|
|
- void Load(SubCmd sub)
|
|
|
- {
|
|
|
- if (this.LoadCarrier(sub))
|
|
|
- sql.SubCmdDAL.Delete(sub);
|
|
|
- }
|
|
|
-
|
|
|
public bool LoadCarrier(SubCmd sub)
|
|
|
{
|
|
|
var route = sql.RouteDal.GetRoute(sub.TargetID);
|
|
|
|
|
|
if (!CorrectPosition(route, this.CurrentPosition))
|
|
|
+ {
|
|
|
+ this.autoManager.ProcessAlarm(20);
|
|
|
return false; //Alarm
|
|
|
+ }
|
|
|
|
|
|
+ int result = this.conveyor.PIOAndLoad(sub.TargetID);
|
|
|
+ if (result != 0)
|
|
|
+ this.autoManager.ProcessAlarm(result);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- return Wait4LoadCarreir();
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- bool Wait4LoadCarreir()
|
|
|
+ public bool UnloadCarrier(SubCmd sub)
|
|
|
{
|
|
|
- int waitTime = 60000;
|
|
|
- long st = SwUtils.CurrentTimeMillis;
|
|
|
+ var route = sql.RouteDal.GetRoute(sub.TargetID);
|
|
|
|
|
|
- //Todo: 이동시 확인 사항들.
|
|
|
- while (true)
|
|
|
+ if (!CorrectPosition(route, this.CurrentPosition))
|
|
|
{
|
|
|
- if (SwUtils.Gt(st, waitTime))
|
|
|
- {
|
|
|
- //Todo: 이동시간 초과 시 동작들.
|
|
|
- break;
|
|
|
- }
|
|
|
+ this.autoManager.ProcessAlarm(21);
|
|
|
+ return false; //Alarm
|
|
|
}
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
- public bool UnloadCarrier()
|
|
|
- {
|
|
|
- return Wait4UnloadCarreir();
|
|
|
+ int result = this.conveyor.PIOAndUnload(sub.TargetID);
|
|
|
+ if (result != 0)
|
|
|
+ {
|
|
|
+ this.autoManager.ProcessAlarm(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- bool Wait4UnloadCarreir()
|
|
|
+ public bool BatteryCharge(SubCmd sub)
|
|
|
{
|
|
|
- int waitTime = 60000;
|
|
|
- long st = SwUtils.CurrentTimeMillis;
|
|
|
|
|
|
- //Todo: 이동시 확인 사항들.
|
|
|
- while (true)
|
|
|
- {
|
|
|
- if (SwUtils.Gt(st, waitTime))
|
|
|
- {
|
|
|
- //Todo: 이동시간 초과 시 동작들.
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region Check Method
|