whycq
2022-12-12 aa9fabbb6a6baaa80394942c1c8b462c44332a27
# LED
4个文件已修改
77 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/DevpSlave.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/LedThread.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -176,7 +176,9 @@
                                .build()
                                .doPost();
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        Integer code = jsonObject.getInteger("code");
                        if (code == 200) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            barcodeThread.setBarcode("");
@@ -188,6 +190,19 @@
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else {
                            staProtocol.setWorkNo((short) 9999);
                            staProtocol.setStaNo((short)(inSta.getStaNo()+1));
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if(!Cools.isEmpty(ledThread)){
                                String errorMsg =  jsonObject.getString("msg");
                                if(!Cools.isEmpty(errorMsg)){
                                    LedCommand ledCommand = new LedCommand();
                                    ledCommand.setTitle(errorMsg);
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(9, ledCommand));
                                }
                            }
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
@@ -330,14 +345,14 @@
                   continue;
               }
               String barcode = barcodeThread.getBarcode();
               if(!Cools.isEmpty(barcode)) {
                   log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
                   if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                       continue;
                   }
               } else {
                   continue;
               }
//               if(!Cools.isEmpty(barcode)) {
//                   log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
//                   if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
//                       continue;
//                   }
//               } else {
//                   continue;
//               }
                // 获取拣料入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
src/main/java/com/zy/core/model/DevpSlave.java
@@ -34,6 +34,8 @@
        private Integer barcode;
        private Integer led;
    }
}
src/main/java/com/zy/core/thread/LedThread.java
@@ -74,6 +74,10 @@
                        case 1:
                            write((List<LedCommand>)task.getData());
                            break;
                        // 写数据
                        case 9:
                            write9((List<LedCommand>)task.getData());
                            break;
                        // 复位
                        case 2:
                            reset();
@@ -152,6 +156,40 @@
        close();
    }
    private void write9(List<LedCommand> list) throws Bx5GException {
        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();
        for (LedCommand command : list) {
            page.newLine(command.getTitle());
            page.newLine("\n");
        }
        // 设置字体
        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) {
            log.info("pf out of range");
        } else {
            // 更新节目
            screen.writeProgram(pf);
//            resetStatus = false;
        }
        close();
    }
    private void reset() throws Bx5GException {
        if (!connect()) {
            return;
src/main/resources/application.yml
@@ -185,14 +185,17 @@
    inSta[0]:
      staNo: 103
      barcode: ${wcs-slave.barcode[0].id}
      led: ${wcs-slave.led[1].id}
    # 入库口2
    inSta[1]:
      staNo: 203
      barcode: ${wcs-slave.barcode[1].id}
      led: ${wcs-slave.led[3].id}
    # 入库口3
    inSta[2]:
      staNo: 305
      barcode: ${wcs-slave.barcode[2].id}
      led: ${wcs-slave.led[5].id}
    # 空板入库口1
    emptyInSta[0]:
      staNo: 103
@@ -234,6 +237,7 @@
    inSta[0]:
      staNo: 402
      barcode: ${wcs-slave.barcode[3].id}
      led: ${wcs-slave.led[7].id}
    # 空板入库口1
    emptyInSta[0]:
      staNo: 402