pjb
2024-06-28 0be842a3c8a3063e933f35a8bb1bc9e578f27699
led复位修改
5个文件已修改
102 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/MatDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/LedThread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensCrnThread.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -96,7 +96,7 @@
     * 组托
     * 入库站,根据条码扫描生成入库工作档,工作状态 2
     */
    public synchronized void generateStoreWrkFile(Integer mark) {
    public synchronized void generateStoreWrkFile(Integer mark) throws InterruptedException {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) { //遍历输送线
            // 遍历入库口
@@ -125,10 +125,7 @@
                  是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;
@@ -192,6 +189,12 @@
                    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() == 9995 && devp.getId() == 2)) {
                    continue;
                }
                if (staProtocol.isAutoing() && staProtocol.isInEnable()
@@ -264,12 +267,21 @@
                                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);
                                if (devp.getId() == 1) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands));
                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){
                                         ledThread.setLedMk(false);
                                     }
                                } else {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands));
                                    if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands))){
                                        ledThread.setLedMk(false);
                                    }
                                }
//                                ledThread.errorReset();
                            }
@@ -451,6 +463,8 @@
                            .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());
                        if (devp.getId() == 2) {
@@ -459,8 +473,7 @@
                            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 异常显示
                        if (ledThread != null) {
                            String errorMsg = "此为拣料、并板、盘点再入库.请放在"+pickSta.getBackSta().shortValue()+"站点";
@@ -516,11 +529,20 @@
                    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) {
                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands));
                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) {
                            ledThread.setLedMk(false);
                        }
                    } else {
                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands));
                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands))){
                            ledThread.setLedMk(false);
                        }
                    }
                    // 更新站点信息 且 下发plc命令
@@ -1573,6 +1595,11 @@
                                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);
                                if (devp.getId() == 1) {
                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
@@ -1627,7 +1654,7 @@
            // 工作档集合
            List<WrkMast> wrkMasts = new ArrayList<>();
            for (Integer staNo : led.getStaArr()) {
                if (staNo == 104 || staNo == 204) {
                if (staNo == 104 || staNo == 204 || staNo == 304) {
                    continue;
                }
                // 获取叉车站点
@@ -1704,7 +1731,7 @@
                    } 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;
src/main/java/com/zy/common/model/MatDto.java
@@ -27,6 +27,8 @@
    // 批次
    private String batch;
    private String locNo;
    public MatDto() {
    }
src/main/java/com/zy/core/thread/LedThread.java
@@ -185,7 +185,7 @@
//            page.newLine("自动化立体仓库");
//            page.newLine("西格迈股份有限公司");
//        }
        page.newLine("中扬智能仓储");
        page.newLine("捷众智能仓储");
        // 设置字体
        page.setFont(new Font("宋体",Font.PLAIN,13));
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -256,6 +256,49 @@
                array[8] = command.getDestinationPosZ();
                array[9] = command.getCommand();
                result = siemensNet.Write("DB100.0", 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("堆垛机命令地址写入后回读出错");
                }
            }
        } else {
            // 写任务完成确认
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -278,7 +278,7 @@
            OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.42", (short) 8);
            if (resultErr.IsSuccess) {
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, 0, 1);
                StaProtocol staProtocol = station.get(303);
                StaProtocol staProtocol = station.get(304);
                staProtocol.setFrontErr(status[0]);
                staProtocol.setBackErr(status[1]);
                staProtocol.setHighErr(status[2]);