public void resolveTaskCommand() { try { while (true) { if (TaskexeService.getInstance().isSystemRunning()) { sendCommand(); } Thread.Sleep(1000); } } catch (Exception) { AGVLog.WriteSendInfo("循环器异常退出!", new StackFrame(true)); } }
public void sendCommand() { AGVLog.WriteSendInfo("开始处理!", new StackFrame(true)); TaskexeBean taskexeBean = TaskexeService.getInstance().getNextTaskexeBean(); if (taskexeBean == null) { return; } string cmd = "cmd=set task by name;name=" + taskexeBean.getTaskid() + ".xml"; SingleTask singleTask = AGVCacheData.getSingleTaskByID(taskexeBean.getTaskid()); sendContinueCommand(); Thread.Sleep(1000); int i = -2; if ("1".Equals(singleTask.getAllocOpType())) { while (string.IsNullOrEmpty(latestMsgFromClient) || latestMsgFromClient.IndexOf("task_isfinished=") < 0 || !"0".Equals(latestMsgFromClient.Substring(latestMsgFromClient.IndexOf("task_isfinished=") + "task_isfinished=".Length, 1))) { send(cmd); AGVLog.WriteSendInfo("发送命令:" + cmd, new StackFrame(true)); Thread.Sleep(3000); if (!AGVEngine.getInstance().isAgvReady()) { latestMsgFromClient = "task_isfinished=" + (i++) + ";"; } } } while (true) { AGVLog.WriteSendInfo("判断任务" + taskexeBean.getTaskid() + "是否Over!", new StackFrame(true)); if ("Over".Equals(TaskexeDao.getDao().selectTaskexeByUuid(taskexeBean.getUuid()).getOpflag())) { break; } Thread.Sleep(5000); } Thread.Sleep(1000); }
public void agvInit() { if (FormController.isNeedLogin()) { FormController.getFormController().getLoginFrm().ShowDialog(); } TaskexeDao.getDao().InsertTaskexeSysInfo("AGV通讯服务程序启动!"); setForkliftStateFirst(); handleCheckRunning(checkRunning()); if (isNeedElevator) { ElevatorFactory.getElevator().startReadSerialPortThread(); } if (isNeedAGVSocketServer) { AGVSocketServer.getSocketServer().StartAccept(); } if (isNeedSchedule) { ScheduleFactory.getSchedule().startShedule(); } if (isNeedTaskexe) { TaskexeService.getInstance().start(); } AGVMessageHandler.getMessageHandler().StartHandleMessage(); if (isNeedMain) { FormController.getFormController().getMainFrm().ShowDialog(); } else { FormController.getFormController().getInfoFrm().ShowDialog(); } }