| | |
| | | return; |
| | | } |
| | | if (flag1007 && staProtocol.getWorkNo() > 0 && staProtocol.isAutoing() && !staProtocol.isEmptyMk() && staProtocol.isPakMk()) { |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(3, staProtocol)); |
| | | staProtocol.setWorkNo(0); |
| | | staProtocol.setStaNo((short) 0); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | log.info("取走写入确认位:{},{}", staProtocol.getWorkNo(), 1007); |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | //&& staProtocol.isOutEnable() |
| | | if (flag1001 && staProtocol.isAutoing() && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) && staProtocol.isPakMk()) { |
| | | if (staProtocol.isAutoing() && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) && staProtocol.isPakMk()) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行"); |
| | | // 判断重复工作档 |
| | | // 106也算上,以后106-》107用于更新库存 |
| | |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | log.info("输送线下发3:{},{}", staProtocol.getWorkNo(), 1004); |
| | | if (result) { |
| | | try { |
| | | Thread.sleep(8000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | setFlag1001(false); |
| | | } else { |
| | | News.error("" + mark + " - 2" + " - 发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | |
| | | } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1001); |
| | | if (i >= 7) { |
| | | if (i >= 6) { |
| | | OpenBusSubmitParam openBusSubmitParam = new OpenBusSubmitParam(); |
| | | openBusSubmitParam.setBatch(DateUtils.convert(new Date())); |
| | | List<TaskDto> taskList = new ArrayList<>(); |
| | | TaskDto taskDto = new TaskDto(); |
| | | taskDto.setSeqNum(Math.random() * 1000 + ""); |
| | | Random rand = new Random(); |
| | | taskDto.setSeqNum("SSX-CK" + rand.nextInt() * 10000); |
| | | taskDto.setOriLoc(getFLoc("1001", "16")); |
| | | taskDto.setDestSta("1001"); |
| | | taskDto.setPriority(123); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 1007入库 |
| | | * |
| | | * @param mark |
| | | */ |
| | | public synchronized void autoIn(Integer mark) { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1007); |
| | |
| | | if (!staProtocol.isLoading()) { |
| | | return; |
| | | } |
| | | if (staProtocol.getStaNo() > 0) { |
| | | if (staProtocol.getStaNo() <= 0) { |
| | | return; |
| | | } |
| | | OpenBusSubmitParam openBusSubmitParam = new OpenBusSubmitParam(); |
| | | openBusSubmitParam.setBatch(DateUtils.convert(new Date())); |
| | | List<TaskDto> taskList = new ArrayList<>(); |
| | | TaskDto taskDto = new TaskDto(); |
| | | taskDto.setSeqNum(Math.random() * 1000 + ""); |
| | | taskDto.setSeqNum("SSX-RK" + staProtocol.getWorkNo()); |
| | | taskDto.setDestLoc(getFLoc("1007", "15")); |
| | | taskDto.setOriLoc("1007"); |
| | | taskDto.setOriSta("1007"); |
| | | taskDto.setPriority(123); |
| | | taskList.add(taskDto); |
| | | openBusSubmitParam.setTaskList(taskList); |
| | | sendTask(openBusSubmitParam, staProtocol); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public void sendTask(OpenBusSubmitParam openBusSubmitParam, StaProtocol staProtocol) { |
| | | public boolean sendTask(OpenBusSubmitParam openBusSubmitParam, StaProtocol staProtocol) { |
| | | String response = ""; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | log.info("下发任务返回数据:{}", response); |
| | | return true; |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", ctuUrl + sendTask, JSON.toJSONString(openBusSubmitParam), response); |
| | | throw new CoolException("调用下发任务接口报错"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | //log.error("fail", e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Transactional |