| | |
| | | StaProtocol staProtocol = siemensDevpThread.getStation().get(sourceStaNo).clone(); |
| | | //wcs反馈rcs继续执行 |
| | | if (staProtocol != null && !staProtocol.isLoading() && !staProtocol.isEmptyOutType()) { |
| | | RcsTaskContinue rcsTaskContinue = new RcsTaskContinue(); |
| | | rcsTaskContinue.setRobotTaskCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | rcsTaskContinue.setTriggerType("TASK"); |
| | | rcsTaskContinue.setTriggerCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | if(task.getTaskType().equals("AGV补空料架")){ |
| | | RcsTaskContinue rcsTaskContinue = new RcsTaskContinue(); |
| | | rcsTaskContinue.setRobotTaskCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | rcsTaskContinue.setTriggerType("TASK"); |
| | | rcsTaskContinue.setTriggerCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | |
| | | String url = HIK_URL + "api/robot/controller/task/extend/continue"; |
| | | String response = sendPost(url, JSONObject.toJSONString(rcsTaskContinue)); |
| | | if (!StringUtils.isEmpty(response) && response.contains("code")) { |
| | | RcsReturn rcsReturn1 = JSONObject.parseObject(response, RcsReturn.class); |
| | | if ("SUCCESS".equals(rcsReturn1.getCode())) { |
| | | String url = HIK_URL + "api/robot/controller/task/extend/continue"; |
| | | String response = sendPost(url, JSONObject.toJSONString(rcsTaskContinue)); |
| | | if (!StringUtils.isEmpty(response) && response.contains("code")) { |
| | | log.info("允许AGV放货成功"); |
| | | } |
| | | // 返回RCS |
| | | rcsReturn.setCode("SUCCESS"); |
| | | rcsReturn.setMessage(""); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("robotTaskCode", robotTaskCode); |
| | | rcsReturn.setData(data); |
| | | }else { |
| | | //出发PLC站点的扫码器扫码 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new com.zy.core.model.Task(3, staProtocol)); |
| | | log.info("AGV放货完成,给站点写9991工作号,下发任务:{},站点:{},agv任务号:{}", result, task.getStaNo(), task.getTaskNo()); |
| | | if (result) { |
| | | log.info("入库站点={}触发扫码成功", staProtocol.getSiteId()); |
| | | // 返回RCS |
| | | rcsReturn.setCode("SUCCESS"); |
| | | rcsReturn.setMessage(""); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("robotTaskCode", robotTaskCode); |
| | | rcsReturn.setData(data); |
| | | RcsTaskContinue rcsTaskContinue = new RcsTaskContinue(); |
| | | rcsTaskContinue.setRobotTaskCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | rcsTaskContinue.setTriggerType("TASK"); |
| | | rcsTaskContinue.setTriggerCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | |
| | | String url = HIK_URL + "api/robot/controller/task/extend/continue"; |
| | | String response = sendPost(url, JSONObject.toJSONString(rcsTaskContinue)); |
| | | if (!StringUtils.isEmpty(response) && response.contains("code")) { |
| | | log.info("允许AGV放货成功"); |
| | | } |
| | | } else { |
| | | // 返回RCS |
| | | rcsReturn.setCode("Err_Internal"); |
| | |
| | | rcsReturn.setData(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | Integer sourceStaNo = Integer.valueOf(task.getStaNo()); |
| | | SiemensDevpThread siemensDevpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = siemensDevpThread.getStation().get(sourceStaNo).clone(); |
| | | Boolean boo=false; |
| | | Short wrkNo = 9991; |
| | | //放货完成 --》agv已经离开 --》给PLC站点写9991工作号 |
| | | if (staProtocol != null && staProtocol.isLoading() && staProtocol.isEmptyOutType() && staProtocol.getWorkNo() == 0) { |
| | | staProtocol.setWorkNo((short) 9991); |
| | | staProtocol.setStaNo(Short.valueOf(task.getStaNo())); |
| | | //补空料架 --》agv已经立库 --》给PLC站点写9995工作号 |
| | | if(task.getTaskType().equals("AGV补空料架") && staProtocol != null && !staProtocol.isLoading() && staProtocol.isEmptyOutType() && staProtocol.getWorkNo() == 0){ |
| | | boo=true; |
| | | wrkNo = 9995; |
| | | }else if(!task.getTaskType().equals("AGV补空料架") && staProtocol != null && staProtocol.isLoading() && staProtocol.isEmptyOutType() && staProtocol.getWorkNo() == 0){ |
| | | boo=true; |
| | | } |
| | | if (boo) { |
| | | staProtocol.setWorkNo(wrkNo);//空料架到位信号点 |
| | | staProtocol.setStaNo(Short.valueOf("0")); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new com.zy.core.model.Task(2, staProtocol)); |
| | | log.info("AGV放货完成,给站点写9991工作号,下发任务:{},站点:{},agv任务号:{}", result, task.getStaNo(), task.getTaskNo()); |
| | | if (result) { |
| | |
| | | data.put("robotTaskCode", robotTaskCode); |
| | | rcsReturn.setData(data); |
| | | } |
| | | }else { |
| | | // 返回RCS |
| | | rcsReturn.setCode("Err_Internal"); |
| | | rcsReturn.setMessage(""); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("robotTaskCode", robotTaskCode); |
| | | rcsReturn.setData(data); |
| | | } |
| | | } |
| | | break; |
| | |
| | | SiemensDevpThread siemensDevpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = siemensDevpThread.getStation().get(sourceStaNo).clone(); |
| | | //判断站点是否有料架和托盘 |
| | | if (staProtocol != null && staProtocol.isLoading() |
| | | && staProtocol.isEmptyOutType() |
| | | && staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) { |
| | | if (staProtocol != null && (staProtocol.isLoading()||task.getTaskType().equals("AGV空料架回缓存区")) |
| | | && staProtocol.isEmptyOutType()) { |
| | | RcsTaskContinue rcsTaskContinue = new RcsTaskContinue(); |
| | | rcsTaskContinue.setRobotTaskCode(task.getTaskNo()+"-"+(task.getCtnType()-1)); |
| | | rcsTaskContinue.setTriggerType("TASK"); |
| | |
| | | SiemensDevpThread siemensDevpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = siemensDevpThread.getStation().get(sourceStaNo).clone(); |
| | | //放货完成 --》agv已经离开 --》给PLC站点写9991工作号 |
| | | if (staProtocol != null && !staProtocol.isLoading() && !staProtocol.isEmptyOutType() && staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) { |
| | | if (staProtocol != null && !staProtocol.isLoading() && !staProtocol.isEmptyOutType()) { |
| | | staProtocol.setWorkNo((short) 0); |
| | | staProtocol.setStaNo((short) 0); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new com.zy.core.model.Task(2, staProtocol)); |