|
@@ -145,6 +145,8 @@ namespace Venus_RT.Modules
|
|
public bool HasJobRunning => _lstControlJobs.Count > 0;
|
|
public bool HasJobRunning => _lstControlJobs.Count > 0;
|
|
public RState CycleState => _cycleState;
|
|
public RState CycleState => _cycleState;
|
|
|
|
|
|
|
|
+ private Dictionary<string, ControlJobInfo> _loadportControlJobDic = new Dictionary<string, ControlJobInfo>();
|
|
|
|
+
|
|
#region public interface
|
|
#region public interface
|
|
public AutoCycle()
|
|
public AutoCycle()
|
|
{
|
|
{
|
|
@@ -172,6 +174,12 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
DATA.Subscribe("Scheduler.PjIdList", () => Array.ConvertAll(_lstProcessJobs.ToArray(), x => x.InnerId.ToString()).ToList());
|
|
DATA.Subscribe("Scheduler.PjIdList", () => Array.ConvertAll(_lstProcessJobs.ToArray(), x => x.InnerId.ToString()).ToList());
|
|
DATA.Subscribe("Scheduler.PjNameList", () => Array.ConvertAll(_lstProcessJobs.ToArray(), x => x.LotName.ToString()).ToList());
|
|
DATA.Subscribe("Scheduler.PjNameList", () => Array.ConvertAll(_lstProcessJobs.ToArray(), x => x.LotName.ToString()).ToList());
|
|
|
|
+ for(int i=1;i<=3;i++)
|
|
|
|
+ {
|
|
|
|
+ _loadportControlJobDic[$"LP{i}"] = null;
|
|
|
|
+ string lp = $"LP{i}";
|
|
|
|
+ DATA.Subscribe($"{lp}.CurrentControlJob", () => _loadportControlJobDic[lp],SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -378,8 +386,9 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
_lstControlJobs.Add(cj);
|
|
_lstControlJobs.Add(cj);
|
|
//AssociatedPMWithLP(cj);
|
|
//AssociatedPMWithLP(cj);
|
|
-
|
|
|
|
|
|
+ _loadportControlJobDic[cj.Module] = cj;
|
|
_faCallback.JobCreated(cj, GetFirstProcessJob(cj));
|
|
_faCallback.JobCreated(cj, GetFirstProcessJob(cj));
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -421,13 +430,15 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- public void AbortJob(string jobName)
|
|
|
|
|
|
+ public bool AbortJob(string jobName,out string reason)
|
|
{
|
|
{
|
|
|
|
+ reason = "";
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
if (cj == null)
|
|
if (cj == null)
|
|
{
|
|
{
|
|
- LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"abort job rejected, not found job with id {jobName}");
|
|
|
|
- return;
|
|
|
|
|
|
+ reason=$"abort job rejected, not found job with id {jobName}";
|
|
|
|
+ LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, reason);
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
List<ProcessJobInfo> pjAbortList = new List<ProcessJobInfo>();
|
|
List<ProcessJobInfo> pjAbortList = new List<ProcessJobInfo>();
|
|
@@ -460,15 +471,22 @@ namespace Venus_RT.Modules
|
|
}
|
|
}
|
|
|
|
|
|
_lstControlJobs.Remove(cj);
|
|
_lstControlJobs.Remove(cj);
|
|
|
|
+ if (_loadportControlJobDic.ContainsKey(cj.Module))
|
|
|
|
+ {
|
|
|
|
+ _loadportControlJobDic[cj.Module] = null;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
- public void StopJob(string jobName)
|
|
|
|
|
|
+ public bool StopJob(string jobName,out string reason)
|
|
{
|
|
{
|
|
|
|
+ reason = "";
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
if (cj == null)
|
|
if (cj == null)
|
|
{
|
|
{
|
|
- LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"stop job rejected, not found job with id {jobName}");
|
|
|
|
- return;
|
|
|
|
|
|
+ reason = $"stop job rejected, not found job with id {jobName}";
|
|
|
|
+ LOG.Write(eEvent.WARN_ROUTER, ModuleName.System,reason);
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
foreach (var pj in _lstProcessJobs)
|
|
foreach (var pj in _lstProcessJobs)
|
|
@@ -481,15 +499,22 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
_faCallback.JobStopped(cj, GetFirstProcessJob(cj));
|
|
_faCallback.JobStopped(cj, GetFirstProcessJob(cj));
|
|
_dbCallback.LotFinished(cj);
|
|
_dbCallback.LotFinished(cj);
|
|
|
|
+ if (_loadportControlJobDic.ContainsKey(cj.Module))
|
|
|
|
+ {
|
|
|
|
+ _loadportControlJobDic[cj.Module] = null;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
- public void ResumeJob(string jobName)
|
|
|
|
|
|
+ public bool ResumeJob(string jobName,out string reason)
|
|
{
|
|
{
|
|
|
|
+ reason = "";
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
if (cj == null)
|
|
if (cj == null)
|
|
{
|
|
{
|
|
|
|
+ reason = $"resume job rejected, not found job with id {jobName}";
|
|
//LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"resume job rejected, not found job with id {jobName}");
|
|
//LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"resume job rejected, not found job with id {jobName}");
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (cj.State == EnumControlJobState.Paused)
|
|
if (cj.State == EnumControlJobState.Paused)
|
|
@@ -499,15 +524,18 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
_faCallback.JobResumed(cj, GetFirstProcessJob(cj));
|
|
_faCallback.JobResumed(cj, GetFirstProcessJob(cj));
|
|
_cycleState = RState.Running;
|
|
_cycleState = RState.Running;
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
- public void PauseJob(string jobName)
|
|
|
|
|
|
+ public bool PauseJob(string jobName,out string reason)
|
|
{
|
|
{
|
|
|
|
+ reason = "";
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
ControlJobInfo cj = _lstControlJobs.Find(x => x.Name == jobName);
|
|
if (cj == null)
|
|
if (cj == null)
|
|
{
|
|
{
|
|
|
|
+ reason = $"pause job rejected, not found job with id {jobName}";
|
|
//LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"pause job rejected, not found job with id {jobName}");
|
|
//LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"pause job rejected, not found job with id {jobName}");
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (cj.State == EnumControlJobState.Executing)
|
|
if (cj.State == EnumControlJobState.Executing)
|
|
@@ -519,6 +547,7 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
if (!_lstControlJobs.Exists(job => job.State == EnumControlJobState.Executing))
|
|
if (!_lstControlJobs.Exists(job => job.State == EnumControlJobState.Executing))
|
|
_cycleState = RState.Paused;
|
|
_cycleState = RState.Paused;
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|