#
luxiaotao1123
2022-03-10 e4abcf00a4be207814968b8be9b92be33ce1b0c9
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -493,8 +493,10 @@
                // 如果最近一次是入库模式
                if (crnProtocol.getLastIo().equals("I")) {
                    if (basCrnp.getInEnable().equals("Y")) {
                        this.crnStnToLoc(crn, crnProtocol); //  入库
                        crnProtocol.setLastIo("O");
                        //  入库
                        if (this.crnStnToLoc(crn, crnProtocol)) {
                            crnProtocol.setLastIo("O");
                        }
                    } else if (basCrnp.getOutEnable().equals("Y")) {
                        this.locToCrnStn(crn, crnProtocol); //  出库
                        crnProtocol.setLastIo("I");
@@ -506,8 +508,10 @@
                        this.locToCrnStn(crn, crnProtocol); //  出库
                        crnProtocol.setLastIo("I");
                    } else if (basCrnp.getInEnable().equals("Y")) {
                        this.crnStnToLoc(crn, crnProtocol); //  入库
                        crnProtocol.setLastIo("O");
                        //  入库
                        if (this.crnStnToLoc(crn, crnProtocol)) {
                            crnProtocol.setLastIo("O");
                        }
                    }
                }
            }
@@ -576,6 +580,12 @@
                    }
                // 没有小车
                } else {
                    // 已经存在吊车执行任务时,则过滤
                    if (wrkMastMapper.selectWorking(slave.getId()) != null) {
                        continue;
                    }
                    // 堆垛机入库 命令下发区 --------------------------------------------------------------------------
                    CrnCommand crnCommand = new CrnCommand();
                    crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
@@ -620,6 +630,11 @@
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                            // 已经存在吊车执行任务时,则过滤
                            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
                                continue;
                            }
                            // 堆垛机入库 命令下发区 --------------------------------------------------------------------------
                            CrnCommand crnCommand = new CrnCommand();
                            crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
@@ -661,43 +676,8 @@
                    if (wrkMast.getWrkSts() == 3L) {
                        this.carMoveIn(wrkMast, wrkMast.getSteNo(), crnProtocol);
                    }
                    // 堆垛机搬运货物
                    if (wrkMast.getWrkSts() == 6L) {
                        // 堆垛机入库 命令下发区 --------------------------------------------------------------------------
                        CrnCommand crnCommand = new CrnCommand();
                        crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
                        crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
                        crnCommand.setAckFinish((short) 0);  // 任务完成确认位
                        crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转
                        crnCommand.setSourcePosX(crnStn.getRow().shortValue());     // 源库位排
                        crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 源库位列
                        crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 源库位层
                        crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo()).shortValue());     // 目标库位排
                        crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 目标库位列
                        crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 目标库位层
                        if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                            log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                        } else {
                            // 修改工作档状态  6.小车待入 ===>> 7.吊车入库中
                            Date now = new Date();
                            wrkMast.setWrkSts(7L);
                            wrkMast.setCrnStrTime(now);
                            wrkMast.setModiTime(now);
                            if (wrkMastMapper.updateById(wrkMast) == 0) {
                                log.error("修改工作档状态 6.小车待入 => 7.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo());
                            }
                            return true;
                        }
                    }
                }
            }
            // 已经存在吊车执行任务时,则过滤
            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
                continue;
            }
        }
        return false;