public void Procedure(object ojb) { ProcedureMachineToReturn BfToRe = (ProcedureMachineToReturn)ojb; RobotUnity rb = BfToRe.robot; DataMachineToReturn p = BfToRe.points; TrafficManagementService Traffic = BfToRe.Traffic; rb.mcuCtrl.lampRbOn(); robot.ShowText(" Start -> " + procedureCode); while (ProRun) { switch (StateMachineToReturn) { case MachineToReturn.MACRET_IDLE: break; case MachineToReturn.MACRET_SELECT_BEHAVIOR_ONZONE: if (Traffic.RobotIsInArea("READY", robot.properties.pose.Position)) { if (rb.PreProcedureAs == ProcedureControlAssign.PRO_READY) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_GOTO_BACK_FRONTLINE_READY; registryRobotJourney.startPlaceName = Traffic.DetermineArea(BfToRe.GetFrontLineMachine().Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = BfToRe.GetFrontLineMachine().Position; } } else if (Traffic.RobotIsInArea("VIM", robot.properties.pose.Position)) { if (rb.SendPoseStamped(BfToRe.GetFrontLineMachine())) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM_REG; registryRobotJourney.startPlaceName = Traffic.DetermineArea(BfToRe.GetFrontLineMachine().Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = BfToRe.GetFrontLineMachine().Position; //robot.ShowText("BUFMAC_ROBOT_WAITTING_CAME_FRONTLINE_BUFFER"); } } else if (Traffic.RobotIsInArea("OUTER", robot.properties.pose.Position)) { Pose destPos1 = BfToRe.GetFrontLineMachine(); String destName1 = Traffic.DetermineArea(destPos1.Position, TypeZone.MAIN_ZONE); if (destName1.Equals("OUTER")) { //robot.ShowText("GO FRONTLINE IN OUTER"); if (rb.SendPoseStamped(destPos1)) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos1.Position; //robot.ShowText("MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE"); } } else if (destName1.Equals("VIM")) { //robot.ShowText("GO FRONTLINE IN VIM"); if (rb.SendPoseStamped(destPos1)) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM_REG; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos1.Position; //robot.ShowText("MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE"); //robot.ShowText("CHECK - REG"); } } } break; case MachineToReturn.MACRET_ROBOT_GOTO_BACK_FRONTLINE_READY: if (TrafficRountineConstants.DetetectInsideStationCheck(registryRobotJourney)) { break; } if (rb.SendCmdPosPallet(RequestCommandPosPallet.REQUEST_GOBACK_FRONTLINE_TURN_RIGHT)) { Stopwatch sw = new Stopwatch(); sw.Start(); do { robot.onFlagGoBackReady = true; if (resCmd == ResponseCommand.RESPONSE_FINISH_GOBACK_FRONTLINE) { robot.onFlagGoBackReady = false; Pose destPos1 = BfToRe.GetFrontLineMachine(); String destName1 = Traffic.DetermineArea(destPos1.Position, TypeZone.MAIN_ZONE); if (destName1.Equals("OUTER")) { //robot.ShowText("GO FRONTLINE IN OUTER"); if (rb.SendPoseStamped(destPos1)) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos1.Position; //robot.ShowText("MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE"); } } else if (destName1.Equals("VIM")) { //robot.ShowText("GO FRONTLINE IN VIM"); if (rb.SendPoseStamped(destPos1)) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM_READY; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos1.Position; //robot.ShowText("MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE"); //robot.ShowText("CHECK - REG"); } } break; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); break; } if (sw.ElapsedMilliseconds > TIME_OUT_WAIT_GOTO_FRONTLINE) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); break; } Thread.Sleep(100); } while (ProRunStopW); sw.Stop(); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM_READY: try { TrafficRountineConstants.DetectRelease(registryRobotJourney); if (resCmd == ResponseCommand.RESPONSE_LASER_CAME_POINT) //if (robot.ReachedGoal()) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_SEND_CMD_CAME_FRONTLINE_MACHINE; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM_REG: if (TrafficRountineConstants.DetetectInsideStationCheck(registryRobotJourney)) { break; } else { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM; } break; case MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE_FROM_VIM: try { TrafficRountineConstants.DetectRelease(registryRobotJourney); if (resCmd == ResponseCommand.RESPONSE_LASER_CAME_POINT) //if (robot.ReachedGoal()) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_SEND_CMD_CAME_FRONTLINE_MACHINE; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_CAME_FRONTLINE_MACHINE: try { if (resCmd == ResponseCommand.RESPONSE_LASER_CAME_POINT) //if (robot.ReachedGoal()) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_SEND_CMD_CAME_FRONTLINE_MACHINE; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_SEND_CMD_CAME_FRONTLINE_MACHINE: if (rb.SendCmdAreaPallet(BfToRe.GetInfoOfPalletMachine(PistonPalletCtrl.PISTON_PALLET_UP))) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_PICKUP_PALLET_MACHINE; //robot.ShowText("MACRET_ROBOT_WAITTING_PICKUP_PALLET_MACHINE"); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_PICKUP_PALLET_MACHINE: if (resCmd == ResponseCommand.RESPONSE_LINEDETECT_PALLETUP) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_GOBACK_FRONTLINE_MACHINE; //robot.ShowText("MACRET_ROBOT_WAITTING_GOBACK_FRONTLINE_MACHINE"); } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_GOBACK_FRONTLINE_MACHINE: // đợi try { if (resCmd == ResponseCommand.RESPONSE_FINISH_GOBACK_FRONTLINE) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_GOTO_RETURN_SELECT_BEHAVIOR_ONZONE; // cập nhật lại điểm xuất phát registryRobotJourney.startPoint = robot.properties.pose.Position; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_GOTO_RETURN_SELECT_BEHAVIOR_ONZONE: String startNamePoint = Traffic.DetermineArea(registryRobotJourney.startPoint, TypeZone.MAIN_ZONE); Pose destPos = BfToRe.GetFrontLineReturn(); String destName = Traffic.DetermineArea(destPos.Position, TypeZone.MAIN_ZONE); if (startNamePoint.Equals("VIM")) { if (rb.SendPoseStamped(destPos)) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_GOTO_FRONTLINE_RETURN_FROM_VIM; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos.Position; //robot.ShowText("BUFMAC_ROBOT_WAITTING_CAME_FRONTLINE_BUFFER"); } } else if (startNamePoint.Equals("OUTER")) { if (destName.Equals("OUTER")) { if (rb.SendPoseStamped(destPos)) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_GOTO_FRONTLINE_RETURN_FROM_VIM; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos.Position; //robot.ShowText("BUFMAC_ROBOT_WAITTING_CAME_FRONTLINE_BUFFER"); } } else if (destName.Equals("VIM")) { if (rb.SendPoseStamped(destPos)) { StateMachineToReturn = MachineToReturn.MACRET_ROBOT_GOTO_FRONTLINE_RETURN_FROM_VIM; registryRobotJourney.startPlaceName = Traffic.DetermineArea(robot.properties.pose.Position, TypeZone.OPZS); registryRobotJourney.startPoint = robot.properties.pose.Position; registryRobotJourney.endPoint = destPos.Position; //robot.ShowText("BUFMAC_ROBOT_WAITTING_CAME_FRONTLINE_BUFFER"); } } } break; case MachineToReturn.MACRET_ROBOT_GOTO_FRONTLINE_RETURN_FROM_VIM: // dang di if (TrafficRountineConstants.DetetectInsideStationCheck(registryRobotJourney)) { break; } try { if (resCmd == ResponseCommand.RESPONSE_LASER_CAME_POINT) //if ( robot.ReachedGoal()) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_SEND_CMD_DROPDOWN_PALLET; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_GOTO_FRONTLINE_RETURN: // dang di try { if (resCmd == ResponseCommand.RESPONSE_LASER_CAME_POINT) //if ( robot.ReachedGoal()) { resCmd = ResponseCommand.RESPONSE_NONE; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_SEND_CMD_DROPDOWN_PALLET; } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } } catch (System.Exception) { errorCode = ErrorCode.CAN_NOT_GET_DATA; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_SEND_CMD_DROPDOWN_PALLET: if (rb.SendCmdAreaPallet(BfToRe.GetInfoOfPalletReturn(PistonPalletCtrl.PISTON_PALLET_DOWN))) { //rb.prioritLevel.OnAuthorizedPriorityProcedure = true; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_DROPDOWN_PALLET; //robot.ShowText("MACRET_ROBOT_WAITTING_DROPDOWN_PALLET"); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_DROPDOWN_PALLET: if (resCmd == ResponseCommand.RESPONSE_LINEDETECT_PALLETDOWN) { resCmd = ResponseCommand.RESPONSE_NONE; BfToRe.UpdatePalletState(PalletStatus.W, order.palletId_P, order.palletId_P); StateMachineToReturn = MachineToReturn.MACRET_ROBOT_WAITTING_GOTO_FRONTLINE; //robot.ShowText("MACRET_ROBOT_WAITTING_GOTO_FRONTLINE"); } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_WAITTING_GOTO_FRONTLINE: if (resCmd == ResponseCommand.RESPONSE_FINISH_GOBACK_FRONTLINE) { resCmd = ResponseCommand.RESPONSE_NONE; //rb.prioritLevel.OnAuthorizedPriorityProcedure = false; StateMachineToReturn = MachineToReturn.MACRET_ROBOT_RELEASED; //robot.ShowText("MACRET_ROBOT_RELEASED"); } else if (resCmd == ResponseCommand.RESPONSE_ERROR) { errorCode = ErrorCode.DETECT_LINE_ERROR; CheckUserHandleError(this); } break; case MachineToReturn.MACRET_ROBOT_RELEASED: // trả robot về robotmanagement để nhận quy trình mới TrafficRountineConstants.ReleaseAll(robot); Global_Object.onFlagRobotComingGateBusy = false; robot.orderItem = null; rb.PreProcedureAs = ProcedureControlAssign.PRO_MACHINE_TO_RETURN; ReleaseProcedureHandler(this); ProRun = false; //robot.ShowText("RELEASED"); UpdateInformationInProc(this, ProcessStatus.S); order.status = StatusOrderResponseCode.FINISHED; order.endTimeProcedure = DateTime.Now; order.totalTimeProcedure = order.endTimeProcedure.Subtract(order.startTimeProcedure).TotalMinutes; KillEvent(); break; default: break; } //robot.ShowText("-> " + procedureCode); Thread.Sleep(5); } StateMachineToReturn = MachineToReturn.MACRET_IDLE; }
public void Register(ProcedureItemSelected ProcedureItem, RobotUnity robot, OrderItem orderItem) { CleanUp(); switch (ProcedureItem) { case ProcedureItemSelected.PROCEDURE_FORLIFT_TO_BUFFER: { ProcedureForkLiftToBuffer procfb = new ProcedureForkLiftToBuffer(robot, doorService, trafficService); procfb.Registry(deviceService); ProcedureDataItems profbDataItems = new ProcedureDataItems(); profbDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocfb = new RegisterProcedureItem() { item = procfb, robot = robot, procedureDataItems = profbDataItems }; procfb.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procfb.ErrorProcedureHandler += ErrorApprearInProcedureItem; //RegisterProcedureItemList.Add (itemprocfb); procfb.AssignAnOrder(orderItem); robot.proRegistryInRobot.pFB = procfb; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_FORKLIFT_TO_BUFFER; procfb.Registry(robotManagementService); procfb.Start(); break; } case ProcedureItemSelected.PROCEDURE_BUFFER_TO_MACHINE: ProcedureBufferToMachine procbm = new ProcedureBufferToMachine(robot, trafficService); procbm.Registry(deviceService); ProcedureDataItems prcobmDataItems = new ProcedureDataItems(); prcobmDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocbm = new RegisterProcedureItem() { item = procbm, robot = robot, procedureDataItems = prcobmDataItems }; procbm.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procbm.ErrorProcedureHandler += ErrorApprearInProcedureItem; //RegisterProcedureItemList.Add (itemprocbm); procbm.AssignAnOrder(orderItem); robot.proRegistryInRobot.pBM = procbm; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_BUFFER_TO_MACHINE; procbm.Registry(robotManagementService); procbm.Start(); break; case ProcedureItemSelected.PROCEDURE_BUFFER_TO_RETURN: ProcedureBufferToReturn procbr = new ProcedureBufferToReturn(robot, trafficService); ProcedureDataItems prcobrDataItems = new ProcedureDataItems(); prcobrDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocbr = new RegisterProcedureItem() { item = procbr, robot = robot, procedureDataItems = prcobrDataItems }; procbr.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procbr.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocbr); procbr.AssignAnOrder(orderItem); robot.proRegistryInRobot.pBR = procbr; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_BUFFER_TO_RETURN; procbr.Registry(robotManagementService); procbr.Start(); break; case ProcedureItemSelected.PROCEDURE_PALLETEMPTY_MACHINE_TO_RETURN: ProcedureMachineToReturn procmr = new ProcedureMachineToReturn(robot, trafficService); ProcedureDataItems prcomrDataItems = new ProcedureDataItems(); prcomrDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocmr = new RegisterProcedureItem() { item = procmr, robot = robot, procedureDataItems = prcomrDataItems }; procmr.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procmr.ErrorProcedureHandler += ErrorApprearInProcedureItem; //RegisterProcedureItemList.Add (itemprocmr); procmr.AssignAnOrder(orderItem); robot.proRegistryInRobot.pMR = procmr; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_MACHINE_TO_RETURN; procmr.Registry(robotManagementService); procmr.Start(); break; case ProcedureItemSelected.PROCEDURE_RETURN_TO_GATE: ProcedureReturnToGate procrg = new ProcedureReturnToGate(robot, doorService, trafficService); ProcedureDataItems prorgDataItems = new ProcedureDataItems(); prorgDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocrg = new RegisterProcedureItem() { item = procrg, robot = robot, procedureDataItems = prorgDataItems }; procrg.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procrg.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrg); procrg.AssignAnOrder(orderItem); procrg.Registry(robotManagementService); procrg.Start(); break; case ProcedureItemSelected.PROCEDURE_ROBOT_TO_CHARGE: ProcedureRobotToCharger procrc = new ProcedureRobotToCharger(robot, chargerService, robot.properties.ChargeID); ProcedureDataItems procrcDataItems = new ProcedureDataItems(); procrcDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocrc = new RegisterProcedureItem() { item = procrc, robot = robot, procedureDataItems = procrcDataItems }; procrc.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procrc.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrc); robot.proRegistryInRobot.pRC = procrc; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_CHARGE; procrc.Start(); break; case ProcedureItemSelected.PROCEDURE_ROBOT_TO_READY: robot.ShowText(robot.properties.Label + "Add PROCEDURE_ROBOT_TO_READY ----------(--___--)---------------"); ProcedureRobotToReady procrr = new ProcedureRobotToReady(robot, robot.properties.ChargeID, trafficService, chargerService, null); ProcedureDataItems procrrDataItems = new ProcedureDataItems(); procrrDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocrr = new RegisterProcedureItem() { item = procrr, robot = robot, procedureDataItems = procrrDataItems }; procrr.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procrr.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrr); robot.proRegistryInRobot.pRR = procrr; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_READY; procrr.Registry(deviceService); procrr.Registry(robotManagementService); procrr.Registry(assigmentTask); procrr.Start(); break; case ProcedureItemSelected.PROCEDURE_ROBOT_READY_TO_READY: ProcedureRobotToReady procRrr = new ProcedureRobotToReady(robot, robot.properties.ChargeID, trafficService, chargerService, doorService.DoorMezzamineUp.config.PointCheckInGate); ProcedureDataItems procRrrDataItems = new ProcedureDataItems(); procRrrDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocRrr = new RegisterProcedureItem() { item = procRrr, robot = robot, procedureDataItems = procRrrDataItems }; procRrr.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procRrr.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add(itemprocRrr); robot.proRegistryInRobot.pRR = procRrr; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_READY; procRrr.Registry(robotManagementService); procRrr.Start(); break; case ProcedureItemSelected.PROCEDURE_FORLIFT_TO_MACHINE: ProcedureForkLiftToMachine procfm = new ProcedureForkLiftToMachine(robot, doorService, trafficService); ProcedureDataItems profmDataItems = new ProcedureDataItems(); profmDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocfm = new RegisterProcedureItem() { item = procfm, robot = robot, procedureDataItems = profmDataItems }; procfm.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procfm.ErrorProcedureHandler += ErrorApprearInProcedureItem; //RegisterProcedureItemList.Add(itemprocfm); procfm.AssignAnOrder(orderItem); robot.proRegistryInRobot.pFM = procfm; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_FORKLIFT_TO_MACHINE; procfm.Registry(robotManagementService); procfm.Start(); break; case ProcedureItemSelected.PROCEDURE_BUFFER_TO_BUFFER: ProcedureBufferReturnToBuffer401 procbb = new ProcedureBufferReturnToBuffer401(robot, trafficService); ProcedureDataItems prcobbDataItems = new ProcedureDataItems(); prcobbDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocbb = new RegisterProcedureItem() { item = procbb, robot = robot, procedureDataItems = prcobbDataItems }; procbb.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procbb.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocbr); procbb.AssignAnOrder(orderItem); robot.proRegistryInRobot.pBB = procbb; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_BUFFER_TO_BUFFER; procbb.Registry(robotManagementService); procbb.Start(); break; case ProcedureItemSelected.PROCEDURE_BUFFER_TO_GATE: ProcedureBufferToGate procbg = new ProcedureBufferToGate(robot, doorService, trafficService); ProcedureDataItems probgDataItems = new ProcedureDataItems(); probgDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocbg = new RegisterProcedureItem() { item = procbg, robot = robot, procedureDataItems = probgDataItems }; procbg.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procbg.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrg); procbg.AssignAnOrder(orderItem); robot.proRegistryInRobot.pBG = procbg; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_BUFFER_TO_GATE; procbg.Registry(robotManagementService); procbg.Start(); break; case ProcedureItemSelected.PROCEDURE_MACHINE_TO_GATE: ProcedureMachineToGate procmg = new ProcedureMachineToGate(robot, doorService, trafficService); ProcedureDataItems promgDataItems = new ProcedureDataItems(); promgDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocmg = new RegisterProcedureItem() { item = procmg, robot = robot, procedureDataItems = promgDataItems }; procmg.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procmg.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrg); procmg.AssignAnOrder(orderItem); robot.proRegistryInRobot.pMG = procmg; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_MACHINE_TO_GATE; procmg.Start(); break; case ProcedureItemSelected.PROCEDURE_MACHINE_TO_BUFFER_RETURN: ProcedureMachineToBufferReturn procmbr = new ProcedureMachineToBufferReturn(robot, trafficService); ProcedureDataItems prombrDataItems = new ProcedureDataItems(); prombrDataItems.StartTaskTime = DateTime.Now; RegisterProcedureItem itemprocmbr = new RegisterProcedureItem() { item = procmbr, robot = robot, procedureDataItems = prombrDataItems }; procmbr.ReleaseProcedureHandler += ReleaseProcedureItemHandler; procmbr.ErrorProcedureHandler += ErrorApprearInProcedureItem; // RegisterProcedureItemList.Add (itemprocrg); procmbr.AssignAnOrder(orderItem); robot.proRegistryInRobot.pMBR = procmbr; robot.ProcedureRobotAssigned = ProcedureControlAssign.PRO_MACHINE_TO_BUFFER_RETURN; procmbr.Registry(robotManagementService); procmbr.Start(); break; } }