| | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | public short wrkNo = 10000; |
| | | public short wrkNo = 11000; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | continue; |
| | | } |
| | | staProtocol.setWorkNo(wrkNo); |
| | | News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo); |
| | | wrkNo++; |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | } |
| | | |
| | | |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() |
| | |
| | | if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { |
| | | News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | //条码为空或者不符合,退库到172站点 |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo((short)172); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | staProtocol.setWorkNo(wrkNo); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | wrkNo++; |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | //判断101和104是否是拣料、并板、盘点再入库 设备暂不支持101、104站盘点/拣料入库 |
| | | WrkMast wrkMast1=wrkMastMapper.selectpj(inSta.getStaNo(),barcode); |
| | | if(!Cools.isEmpty(wrkMast1)){ |
| | | if (wrkMast1.getIoType()!=1){ |
| | | continue; |
| | | } |
| | | } |
| | | if( !Cools.isEmpty(barcode)&&!Cools.isEmpty(wrkMast1)){ |
| | | log.error("101或104拣料、并板、盘点再入库", wrkMast1.getWrkNo()); |
| | | continue; |
| | | } |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | | if (wrkMast != null) { |
| | |
| | | |
| | | WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("barcode", barcode) |
| | | .in("io_type", 107,103)); |
| | | .in("io_type", 107,103,57,53)); |
| | | if (!Cools.isEmpty(checkPick)) { |
| | | continue; |
| | | } else { |
| | | News.info("新板入库条码===>>" + barcode); |
| | | } |
| | | // WrkMast checkPick2 = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | // .eq("barcode", barcode) |
| | | // .in("io_type", 57,53)); |
| | | // if (!Cools.isEmpty(checkPick2)) { |
| | | // continue; |
| | | // } |
| | | |
| | | try { |
| | | |
| | |
| | | News.error(methodName + ":更新plc站点信息失败"); |
| | | |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | }else { |
| | | ledThread.errorReset(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (!Cools.isEmpty(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode) ) { |
| | | if (!staProtocol.isLoading()) { |
| | | continue; |
| | | } |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | continue; |
| | | } |
| | | |
| | | if (ledThread != null) { |
| | | ledThread.errorReset(); |
| | | } |
| | | // 更新站点信息 且 下发plc命令 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | |
| | | if (!result) { |
| | | News.error(methodName + ":发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | |
| | |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) != 0) { |
| | | // 复位堆垛机 |
| | | News.info("crnStnToOutStn堆垛机复位时工作号===>>" + crnProtocol.getTaskNo()); |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | News.error(methodName + ":更新工作档的工作状态为14失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | |
| | | // 堆垛机控制过滤 |
| | | if (!crnProtocolNow.getStatusType().equals(CrnStatusType.IDLE) || crnProtocolNow.getTaskNo() != 0) { |
| | | continue; |
| | | } |
| | | |
| | | // 已经存在吊车执行任务时,则过滤 |
| | | if (wrkMastMapper.selectWorking(slave.getId()) != null) { |
| | | break; |
| | | // return; |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | CrnSlave.CrnStn crnStn = null; |
| | | for (CrnSlave.CrnStn crnStn1 : slave.getCrnOutStn()) { |
| | | if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) { |
| | | if (wrkMast.getSourceStaNo().equals(crnStn1.getStaNo())) { |
| | | crnStn = crnStn1; |
| | | break; |
| | | } else { |
| | |
| | | } |
| | | // 入库 + 库位转移 ==> 4.入库完成 |
| | | if (wrkMast.getWrkSts() == 3 || (wrkMast.getWrkSts() == 12 && wrkMast.getIoType() == 11)) { |
| | | log.error("入库完成堆垛机任务=========》"+JSON.toJSONString(wrkMast)); |
| | | wrkMast.setWrkSts(4L); |
| | | } else { |
| | | continue; |
| | |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | News.info("storeFinished堆垛机复位时工作号===>>" + crnProtocol.getTaskNo()); |
| | | crnThread.setResetFlag(true); |
| | | } |
| | | } |
| | |
| | | ledCommand.setBarcode(wrkMast.getBarcode()); |
| | | if (wrkMast.getIoType() != 110) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); |
| | | |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | Double total = 0.0; |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr())); |
| | | if (!Cools.isEmpty(locDetl)) { |
| | | total = locDetl.getAnfme(); |
| | | } |
| | | if (wrkMast.getIoType() == 101) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())); |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())); |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | if (wrkMast.getIoType() == 107) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())); |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | if (!commands.isEmpty()) { |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | * 其他 ===>> LED显示器复位,显示默认信息 |
| | | */ |
| | | public synchronized void ledReset() { |
| | | // for (LedSlave led : slaveProperties.getLed()) { |
| | | // // 获取输送线plc线程 |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | | // // 命令集合 |
| | | // boolean reset = true; |
| | | // for (Integer staNo : led.getStaArr()) { |
| | | // // 获取叉车站点 |
| | | // StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | // if (staProtocol == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // if (staProtocol.getWorkNo() != 0) { |
| | | // reset = false; |
| | | // break; |
| | | // } |
| | | // } |
| | | // // 获取led线程 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId()); |
| | | // // led显示默认内容 |
| | | // if (reset) { |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | // News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // } |
| | | // } |
| | | // } |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); |
| | |
| | | for (Integer staNo : led.getStaArr()) { |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) { |
| | | if (staProtocol == null) { continue; } |
| | | if (staProtocol.getWorkNo() != 0) { |
| | | reset = false; |
| | | break; |
| | | } |
| | | } |
| | | // // 获取led线程 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | // // led显示默认内容 |
| | | // if (reset && !ledThread.isLedMk()) { |
| | | // if (led.getId() == 7) { |
| | | // ledThread.setLedMk(true); |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | // News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // } else { |
| | | // |
| | | // } |
| | | // } else { |
| | | // ledThread.setLedMk(true); |
| | | // if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | // News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | // } else { |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // 获取led线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId()); |
| | | // led显示默认内容 |
| | | if (reset) { |
| | | if (ledThread == null) { |
| | | continue; |
| | | } |
| | | ledThread.errorReset(); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |