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 TaskexeBean getNextTaskexeBean() { List <TaskexeBean> taskexeBeanList = TaskexeDao.getDao().getTaskexeTaskList(); if (taskexeBeanList == null || taskexeBeanList.Count <= 0) { return(null); } TaskexeBean taskexeBean = taskexeBeanList[0]; AGVLog.WriteSendInfo("下一个执行的任务ID:" + taskexeBean.getTaskid(), new StackFrame(true)); if (!"Send".Equals(taskexeBean.getOpflag())) { TaskexeDao.getDao().sendTaskexeBean(taskexeBean); } return(taskexeBean); }