| | |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | | */ |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | public synchronized void generateStoreWrkFile(Integer mark) throws InterruptedException { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { //遍历输送线 |
| | | // 遍历入库口 |
| | |
| | | 是2号输送线9995拣料任务 |
| | | */ |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (Cools.isEmpty(barcode) || !staProtocol.isInEnable() || staProtocol.isEmptyMk() |
| | | || !staProtocol.isFullPlt() || (staProtocol.getWorkNo() == 9995 && devp.getId() == 2)) { |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg)); |
| | | Thread.sleep(500); |
| | | } |
| | | |
| | | if (Cools.isEmpty(barcode) || !staProtocol.isInEnable() || staProtocol.isEmptyMk() |
| | | || !staProtocol.isFullPlt() || (staProtocol.getWorkNo() <= 9000 && devp.getId() == 2)) { |
| | | continue; |
| | | } |
| | | |
| | | if (staProtocol.isAutoing() && staProtocol.isInEnable() |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if (wrkMast != null && devp.getId() == 2) { |
| | | News.warn(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | if (wrkMast != null) { |
| | | News.warn(""+mark+" - 4"+" - 满托盘入库工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | if (devp.getId() == 2) { |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | 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) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "工作档已存在该条码号===>>" + barcode; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | continue; |
| | | } |
| | |
| | | ledCommand.setTitle("全板入库"); |
| | | ledCommand.setLocNo(dto.getLocNo()); |
| | | ledCommand.setStaNo(dto.getStaNo()); |
| | | ArrayList<MatDto> matDtos = new ArrayList<>(); |
| | | MatDto matDto = new MatDto(); |
| | | matDto.setLocNo(dto.getLocNo()); |
| | | matDtos.add(matDto); |
| | | ledCommand.setMatDtos(matDtos); |
| | | ledCommand.setBarcode(barcode); |
| | | commands.add(ledCommand); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands)); |
| | | if (devp.getId() == 1) { |
| | | // if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){ |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | } else { |
| | | if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands))){ |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | // ledThread.errorReset(); |
| | | } |
| | | } else { |
| | | News.error(""+mark+" - 5"+" - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | News.error(""+mark+" - 5"+" - 满板入库请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | if(devp.getId() == 2) { |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | |
| | | .eq("stn_no", stnNo) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | //LED |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | News.error(""+mark+" - 2"+" - 入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); |
| | | staProtocol.setWorkNo((short) 9999); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | //LED |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); |
| | | if (devp.getId() == 2) { |
| | | staProtocol.setWorkNo((short) 9999); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = "此为拣料、并板、盘点再入库.请放在"+pickSta.getBackSta().shortValue()+"站点"; |
| | |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | continue; |
| | | } |
| | | List<LedCommand> commands = new ArrayList<>(); |
| | | LedCommand ledCommand = new LedCommand(); |
| | | ledCommand.setWorkNo(wrkMast.getWrkNo()); |
| | | ledCommand.setIoType(wrkMast.getIoType()); |
| | | ledCommand.setTitle(wrkMast.getIoType() == 53 ? "拣料再入库" : "盘点再入库"); |
| | | ledCommand.setLocNo(wrkMast.getLocNo()); |
| | | ledCommand.setStaNo(wrkMast.getStaNo()); |
| | | ledCommand.setBarcode(barcode); |
| | | ArrayList<MatDto> matDtos = new ArrayList<>(); |
| | | MatDto matDto = new MatDto(); |
| | | matDto.setLocNo(wrkMast.getLocNo()); |
| | | matDtos.add(matDto); |
| | | ledCommand.setMatDtos(matDtos); |
| | | commands.add(ledCommand); |
| | | if (devp.getId() == 1) { |
| | | // if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) { |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | } else { |
| | | if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands))){ |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | |
| | | // 更新站点信息 且 下发plc命令 |
| | |
| | | // 组装命令 |
| | | LedCommand ledCommand = new LedCommand(); |
| | | ledCommand.setWorkNo(dto.getWorkNo()); |
| | | ledCommand.setIoType(1); |
| | | ledCommand.setTitle("全板入库"); |
| | | ledCommand.setIoType(10); |
| | | ledCommand.setTitle("空板入库"); |
| | | ledCommand.setLocNo(dto.getLocNo()); |
| | | ledCommand.setStaNo(dto.getStaNo()); |
| | | ledCommand.setBarcode(""); |
| | | ArrayList<MatDto> matDtos = new ArrayList<>(); |
| | | MatDto matDto = new MatDto(); |
| | | matDto.setLocNo(dto.getLocNo()); |
| | | matDtos.add(matDto); |
| | | ledCommand.setMatDtos(matDtos); |
| | | commands.add(ledCommand); |
| | | MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands)); |
| | | if (devp.getId() == 1) { |
| | | // MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands)); |
| | | } else { |
| | | MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands)); |
| | | } |
| | | // ledThread.errorReset(); |
| | | } |
| | | Thread.sleep(500); |
| | | } else { |
| | | staProtocol.setWorkNo((short)9991); |
| | | staProtocol.setStaNo((short)100); |
| | |
| | | MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | } |
| | | News.error(""+mark+" - 3"+" - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | News.error(""+mark+" - 3"+" - 空板入库请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | // 工作档集合 |
| | | List<WrkMast> wrkMasts = new ArrayList<>(); |
| | | for (Integer staNo : led.getStaArr()) { |
| | | if (staNo == 104 || staNo == 204 || staNo == 304) { |
| | | continue; |
| | | } |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { |
| | |
| | | } else { |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } else { |
| | | } else if(led.getId() == 1 || led.getId() == 2){ |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | News.error(""+mark+" - 3"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | if (led.getId() <=2 ) { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } else { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | News.infoNoLog(""+mark+" - 0"+" - 执行完成:其他 ===>> LED显示器复位,显示默认信息"); |
| | |
| | | } |
| | | } |
| | | |
| | | public void resetOneLed() { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { //遍历输送线 |
| | | if (devp.getId() == 1) { |
| | | // 遍历入库口 |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { // 遍历入库口 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |