1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.RT.EFEMs.Servers;
- namespace Aitex.Sorter.RT.EFEMs.Tasks
- {
- public class SetEventTask : CheckImp, ITask
- {
- public SetEventTask()
- {
- HasInfoMessage = false;
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
- EfemEventType type;
- if (!Enum.TryParse(args[0], out type))
- {
- result = PARAM_NG;
- return false;
- }
- EfemEventValue value;
- if (!Enum.TryParse(args[1], out value))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<MaintenancePolicy>(device, out result))
- {
- return false;
- }
- SystemServerModule entity = (SystemServerModule)GetEntity(device);
- entity.SetEvent(type, value);
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- return true;
- }
- }
- public class QueryEventTask : CheckImp, ITask
- {
- public QueryEventTask()
- {
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
- EfemEventType type;
- if (!Enum.TryParse(args[0], out type))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = "ON";
- EfemEventType type;
- Enum.TryParse(args[0], out type);
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- if (entity.IsEventEnabled(type))
- result = string.Format("ON");
- else
- result = string.Format("OFF");
- return true;
- }
- }
- }
|