| src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/core/MainProcess.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/core/thread/LedThread.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/core/thread/SiemensCrnThread.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/webapp/static/images/zy-logo.png | 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -206,14 +206,16 @@ continue; } } if (wrkMast != null && devp.getId() == 2) { if (wrkMast != null) { News.warn(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); if (devp.getId() == 2) { 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站点信息失败"); } } // led 异常显示 @@ -264,7 +266,11 @@ ledCommand.setStaNo(dto.getStaNo()); ledCommand.setBarcode(barcode); commands.add(ledCommand); if (devp.getId() == 1) { MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands)); } else { MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands)); } // ledThread.errorReset(); } } else { @@ -447,10 +453,12 @@ StaDesc staDesc = staDescService.selectOne(wrapper); if (Cools.isEmpty(staDesc)) { News.error(""+mark+" - 2"+" - 入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); 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 LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); // led 异常显示 @@ -499,6 +507,20 @@ 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); commands.add(ledCommand); if (devp.getId() == 1) { MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands)); } else { MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands)); } // 更新站点信息 且 下发plc命令 @@ -1546,12 +1568,17 @@ // 组装命令 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(""); commands.add(ledCommand); 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(); } } else { @@ -1600,6 +1627,9 @@ // 工作档集合 List<WrkMast> wrkMasts = new ArrayList<>(); for (Integer staNo : led.getStaArr()) { if (staNo == 104 || staNo == 204) { continue; } // 获取叉车站点 StaProtocol staProtocol = devpThread.getStation().get(staNo); if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { @@ -1745,11 +1775,20 @@ // led显示默认内容 if (reset && !ledThread.isLedMk()) { ledThread.setLedMk(true); 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显示器复位,显示默认信息"); @@ -2325,4 +2364,16 @@ } } 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()); } } } } } src/main/java/com/zy/core/MainProcess.java
@@ -70,6 +70,9 @@ mainService.outOfDevp(11); // 复位一期led入库后显示默认信息 // mainService.resetOneLed(); //mainService.DevpCallThePolice(12); src/main/java/com/zy/core/thread/LedThread.java
@@ -113,7 +113,13 @@ // 创建一个数据页 TextBxPage page = new TextBxPage(); for (LedCommand command : list) { page.newLine(command.getTitle() +"("+command.getWorkNo()+")"); if (command.getIoType() < 100) { page.newLine(command.getTitle()); page.newLine("任务号:" + command.getWorkNo()); page.newLine("库位号:" + command.getLocNo()); page.newLine("条码:" + command.getBarcode()); } else { page.newLine(command.getTitle() + "(" + command.getWorkNo() + ")"); if (!command.isEmptyMk()) { for (MatDto matDto : command.getMatDtos()) { //去掉小数点 @@ -131,7 +137,7 @@ } page.newLine("\n"); } } // 设置字体 page.setFont(new Font("宋体",Font.PLAIN,12)); // 设置文本颜色 @@ -179,7 +185,7 @@ // page.newLine("自动化立体仓库"); // page.newLine("西格迈股份有限公司"); // } page.newLine("力源智能仓储"); page.newLine("中扬智能仓储"); // 设置字体 page.setFont(new Font("宋体",Font.PLAIN,13)); @@ -232,10 +238,42 @@ } private void error(String msg) { private void error(String msg) throws Bx5GException { if (slave.getId() <= 2) { if (!connect()) { return; } pf = new ProgramBxFile( 0, screen.getProfile()); pf.setFrameShow(false); // 分别输入X,Y,width,height area = new TextCaptionBxArea( 0,0,96,48, screen.getProfile()); // 创建一个数据页 TextBxPage page = new TextBxPage(); page.newLine(msg); // 设置字体 page.setFont(new Font("宋体",Font.PLAIN,12)); // 设置文本颜色 page.setForeground(Color.red); // 设置显示特技为快速打出 page.setDisplayStyle(styles[6]); area.clearPages(); area.addPage(page); pf.addArea(area); if (pf.validate() != null) { News.info("Led"+" - 2"+" - pf out of range"); } else { // 更新节目 screen.writeProgram(pf); // resetStatus = false; } close(); } else { errorMsg.delete(0, errorMsg.length()); errorMsg.append(msg); } } public void errorReset() { this.errorMsg.delete(0, errorMsg.length()); src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -275,6 +275,50 @@ array[8] = command.getDestinationPosZ(); array[9] = command.getCommand(); result = siemensNet.Write("DB100.0", array); log.info(JSON.toJSONString(array)); //堆垛机任务写入后,回读一次,看是否成功 Thread.sleep(200); try{ OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18); if (resultRead.IsSuccess) { CrnCommand one = new CrnCommand(); one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); one.setTaskMode(siemensNet.getByteTransform().TransInt16(resultRead.Content, 4)); one.setSourcePosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 6)); one.setSourcePosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 8)); one.setSourcePosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 10)); one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12)); one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14)); one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16)); if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) ){ try{ News.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); }catch (Exception e){ try{ News.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead)); }catch (Exception e1){ News.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); } } if(!resetFlag){ News.error("堆垛机命令回读失败后,重新添加任务到队列2 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); } Thread.sleep(100); readStatus(); return false; } else { News.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); } } }catch (Exception e){ News.error("堆垛机命令地址写入后回读出错"); } } } src/main/resources/application.yml
@@ -205,14 +205,14 @@ ip: 10.10.10.107 port: 5005 devpPlcId: ${wcs-slave.devp[0].id} staArr: 101 staArr: 101,104 # LED2 led[1]: id: 2 ip: 10.10.10.105 port: 5005 devpPlcId: ${wcs-slave.devp[0].id} staArr: 201 staArr: 201,204 # LED3 led[2]: id: 3 src/main/webapp/static/images/zy-logo.png