cpT
2025-06-27 830527d30361c5d69065546562cc73d9afc4d0f7
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -102,6 +102,8 @@
    @Value("${constant-parameters.avoidDistance}")
    private Long avoidDistance;
    @Autowired
    private TaskWrkLogServiceImpl taskWrkLogService;
    public void generateStoreWrkFile() {
        try {
@@ -127,7 +129,7 @@
                    boolean back = false;
                    String errMsg = "-";
                    if (staProtocol.getGrossWt()>=600){
                        errMsg = "超重";
                        errMsg = "超重:"+staProtocol.getGrossWt()+"kg";
                        back = true;
                    }
                    if (staProtocol.isFrontErr()) {
@@ -150,10 +152,10 @@
                        errMsg = "右超限";
                        back = true;
                    }
                    if (!back && staProtocol.isWeightErr()) {
                        errMsg = "超重";
                        back = true;
                    }
//                    if (!back && staProtocol.isWeightErr()) {
//                        errMsg = "超重";
//                        back = true;
//                    }
                    if (!back && staProtocol.isBarcodeErr()) {
                        errMsg = "扫码失败";
                        back = true;
@@ -382,10 +384,10 @@
                        errMsg = "右超限";
                        back = true;
                    }
                    if (!back && staProtocol.isWeightErr()) {
                        errMsg = "超重";
                        back = true;
                    }
//                    if (!back && staProtocol.isWeightErr()) {
//                        errMsg = "超重";
//                        back = true;
//                    }
                    // 退回
                    if (back) {
                        if (stano == inSta.getBackSta().shortValue()) {
@@ -695,6 +697,51 @@
                        log.error("出库到出库站异常:异常信息:" + e);
                    }
                }
            }
        }
    }
    /**
     * 堆垛机5分钟无任务则回到源点
     */
    public void crnStnToOutStnSou() {
        for (CrnSlave crn : slaveProperties.getCrn()) {
            try{
                // 获取堆垛机信息
                CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
                CrnProtocol crnProtocol = crnThread.getCrnProtocol();
                if (crnProtocol == null) {
                    continue;
                }
                BasCrnp basCrnp = basCrnpService.selectById(crn.getId());
                if (basCrnp == null) {
                    log.error("{}号堆垛机尚未在数据库进行维护!", crn.getId());
                    continue;
                }
                if (crnProtocol.getLaneNo()!=0 && (crnProtocol.getBay()!=1 || crnProtocol.getLevel()!=1)){
                    if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.statusType == CrnStatusType.IDLE && crnProtocol.getTaskNo() != 0) {
                        //获取工作档
                        List<TaskWrk> taskWrks = taskWrkMapper.selectByLaneNo(crnProtocol.getLaneNo());
                        if (!taskWrks.isEmpty()) {
                            continue;
                        }
                        List<TaskWrkLog> taskWrkLogs = taskWrkLogService.selectList(new EntityWrapper<TaskWrkLog>().eq("CRN_NO",crnProtocol.getLaneNo()).orderBy("COMPLETE_TIME",true));
                        if (taskWrkLogs.isEmpty()) {
                            CrnCommand command = new CrnCommand();
                            if (!MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(4, command))) {
                                log.error("堆垛机自动回源点失败,堆垛机号={}", crnProtocol.getCrnNo());
                            }
                        }
//                        long differenceInSeconds = TimeCalculatorUtils.differenceInMilliseconds(taskWrkLogs.get(0).getCompleteTime(), new Date());
//                        if (differenceInSeconds <= 1000) {
//                            return;
//                        }
                    }
                }
            } catch (Exception e){
            }
        }
@@ -1637,7 +1684,7 @@
                    boolean back = false;
                    String errMsg = "-";
                    if (staProtocol.getGrossWt()>=600){
                        errMsg = "超重";
                        errMsg = "超重:"+staProtocol.getGrossWt()+"kg";
                        back = true;
                    }
                    if (staProtocol.isFrontErr()) {
@@ -1660,10 +1707,10 @@
                        errMsg = "右超限";
                        back = true;
                    }
                    if (!back && staProtocol.isWeightErr()) {
                        errMsg = "超重";
                        back = true;
                    }
//                    if (!back && staProtocol.isWeightErr()) {
//                        errMsg = "超重";
//                        back = true;
//                    }
                    if (!back && staProtocol.isBarcodeErr()) {
                        errMsg = "扫码失败";
                        back = true;