12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using MECF.Framework.Common.Communications;
- namespace athosRT.Modules.Robot
- {
- public class RorzeRobot751MotionHandler : RorzeRobot751Handler
- {
- private string _motionCmd = "HOME,EXTD,LOAD, UNLD,TRNS, EXCH,CLMP, UCLM,WMAP, UTRN,MGET, MPUT,MGT1, MGT2,MPT1, MPT2,WCHK, ALEX,ALLD, ALUL,ALGT, ALEA,ALMV,STEP,GCHK";
- public RorzeRobot751MotionHandler(RorzeRobot751 robot, string command, string parameter = null)
- : base(robot, command, parameter)
- {
- string text = (string.IsNullOrEmpty(parameter) ? parameter : "");
- LOG.Write(robot.Name + " execute motion command " + command + " " + text + " in ASCII.", 2, "D:\\sorter\\trunk\\Efem\\Jet\\Jet_001_2P_Jet\\EfemRT\\Devices\\Rorze751\\RorzeRobot751Handler.cs", ".ctor", 152);
- }
- public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
- {
- RorzeRobot751Message rorzeRobot751Message = msg as RorzeRobot751Message;
- base.ResponseMessage = msg;
- LOG.Write(base.Device.Name + " handler message:" + rorzeRobot751Message.RawMessage + " in ASCII.", 2, "D:\\sorter\\trunk\\Efem\\Jet\\Jet_001_2P_Jet\\EfemRT\\Devices\\Rorze751\\RorzeRobot751Handler.cs", "HandleMessage", 162);
- if (msg.IsError)
- {
- base.Device.NoteError(rorzeRobot751Message.RawMessage);
- transactionComplete = true;
- return true;
- }
- if (msg.IsAck)
- {
- SetState(EnumHandlerState.Acked);
- }
- if (msg.IsComplete)
- {
- }
- if (rorzeRobot751Message.IsEvent)
- {
- if (_command == "ORGN" && rorzeRobot751Message.RawMessage.Contains("STAT") && base.Device.IsOrgshCompleted && base.Device.CurrentOpStatus == RROpStatusEnum.Stop)
- {
- base.Device.OnActionDone(null);
- transactionComplete = true;
- return true;
- }
- if (_command == "INIT" && rorzeRobot751Message.RawMessage.Contains("STAT") && base.Device.CurrentOpMode != 0)
- {
- base.Device.OnActionDone(null);
- transactionComplete = true;
- return true;
- }
- if (_motionCmd.Contains(_command))
- {
- if (rorzeRobot751Message.RawMessage.Contains("STAT") && !base.Device.IsOrgshCompleted)
- {
- base.Device.OnError("GetErrorMsg:" + rorzeRobot751Message.RawMessage + " on command:" + _command);
- transactionComplete = true;
- return true;
- }
- if (rorzeRobot751Message.RawMessage.Contains("STAT") && base.Device.CurrentOpStatus == RROpStatusEnum.Stop)
- {
- if (base.Device.CurrentIdCodeForErrorController != "00")
- {
- EV.PostAlarmLog("Robot", "occurred error:GetErrorMsg:" + rorzeRobot751Message.RawMessage + " on command:" + _command);
- }
- base.Device.OnActionDone(null);
- transactionComplete = true;
- return true;
- }
- }
- }
- transactionComplete = false;
- return false;
- }
- }
- }
|