*
L
2 天以前 e2a14112a81740481623dc16bbd1301432ce34b0
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -761,19 +761,25 @@
                        if (!taskWrks.isEmpty()) {
                            continue;
                        }
                        List<TaskWrkLog> taskWrkLogs = taskWrkLogService.selectList(new EntityWrapper<TaskWrkLog>().eq("CRN_NO",crnProtocol.getLaneNo()).orderBy("COMPLETE_TIME",true));
                        List<TaskWrkLog> taskWrkLogs = taskWrkLogService.selectList(new EntityWrapper<TaskWrkLog>().eq("CRN_NO",crnProtocol.getLaneNo()).orderBy("COMPLETE_TIME",false));
                        if (!taskWrkLogs.isEmpty()) {
                            TaskWrkLog taskWrkLog = taskWrkLogs.get(0);
                            Date completeTime = taskWrkLog.getCompleteTime();
                            if (completeTime==null){
                                completeTime = taskWrkLog.getCancelTime();
                            boolean signT = false;
                            for (TaskWrkLog taskWrkLog : taskWrkLogs){
                                Date completeTime = taskWrkLog.getCompleteTime();
                                if (completeTime==null){
                                    completeTime = taskWrkLog.getModiTime();
                                    continue;
                                }
                                long differenceInSeconds = TimeCalculatorUtils.differenceInMilliseconds(completeTime, new Date());
                                if (differenceInSeconds <= 60*2*1000) {
                                    signT = true;
                                    break;
                                } else {
                                    signT = false;
                                    break;
                                }
                            }
                            long differenceInSeconds = TimeCalculatorUtils.differenceInMilliseconds(completeTime, new Date());
                            if (differenceInSeconds <= 60*10*1000) {
                                return;
                            if (signT){
                                continue;
                            }
                        }
                        // 命令下发区 --------------------------------------------------------------------------
@@ -782,11 +788,11 @@
                        crnCommand.setLaneNo(crnProtocol.getLaneNo()); // 堆垛机巷道编号
                        crnCommand.setTaskNo((short)999); // 工作号
                        crnCommand.setAckFinish((short) 0);  // 任务完成确认位
                        crnCommand.setTaskMode(CrnTaskModeType.GO_ORIGIN); // 任务模式:  库位移转
                        crnCommand.setSourcePosX((short) 0);     // 源库位排
                        crnCommand.setSourcePosY((short) 0);     // 源库位列
                        crnCommand.setSourcePosZ((short) 0);   // 源库位层
                        crnCommand.setTaskMode(CrnTaskModeType.SITE_MOVE); // 任务模式:  站位移转4
                        int row = crnProtocol.getLaneNo() * 2;
                        crnCommand.setSourcePosX((short) row);     // 源库位排
                        crnCommand.setSourcePosY((short) 1);     // 源库位列
                        crnCommand.setSourcePosZ((short) 1);   // 源库位层
                        crnCommand.setDestinationPosX((short) row);     // 目标库位排
                        crnCommand.setDestinationPosY((short) 1);     // 目标库位层
                        crnCommand.setDestinationPosZ((short) 1);     // 目标库位列
@@ -989,22 +995,22 @@
//                }
                // 命令下发区 --------------------------------------------------------------------------
                CrnCommand crnCommand = new CrnCommand();
                crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
                crnCommand.setLaneNo(crnProtocol.getLaneNo()); // 堆垛机巷道编号
                crnCommand.setTaskNo(taskWrk.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.getRowShort(taskWrk.getTargetPoint()));     // 目标库位列
                CrnCommand crnCommand1 = new CrnCommand();
                crnCommand1.setCrnNo(slave.getId()); // 堆垛机编号
                crnCommand1.setLaneNo(crnProtocol.getLaneNo()); // 堆垛机巷道编号
                crnCommand1.setTaskNo(taskWrk.getWrkNo().shortValue()); // 工作号
                crnCommand1.setAckFinish((short) 0);  // 任务完成确认位
                crnCommand1.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转
                crnCommand1.setSourcePosX(crnStn.getRow().shortValue());     // 源库位排
                crnCommand1.setSourcePosY(crnStn.getBay().shortValue());     // 源库位列
                crnCommand1.setSourcePosZ(crnStn.getLev().shortValue());   // 源库位层
                crnCommand1.setDestinationPosX(Utils.getRowShort(taskWrk.getTargetPoint()));     // 目标库位列
                int bay1 = Utils.getBayShort(taskWrk.getTargetPoint()) + 1;
                crnCommand.setDestinationPosY((short)bay1);     // 目标库位层
                crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint()));     // 目标库位排
                crnCommand1.setDestinationPosY((short)bay1);     // 目标库位层
                crnCommand1.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint()));     // 目标库位排
//                crnCommand.setCommand((short) 1);
                if (!MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, crnCommand))) {
                    log.error("堆垛机命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
                if (!MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, crnCommand1))) {
                    log.error("堆垛机命令生成失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand1));
                    devpThread.setErrorDev(staProtocol.getSiteId(), crnProtocol.getLaneNo()+"巷道堆垛机命令生成失败");
                    CrnErrCache.updateCrnErr(crnProtocol.getCrnNo(), "运行命令下发失败");
@@ -1244,6 +1250,7 @@
                // 已经存在吊车执行任务时,则过滤
                if (taskWrkMapper.selectCrnWorking(crnProtocol.getLaneNo()) != null) {
                    CrnErrCache.updateCrnErr(crnProtocol.getCrnNo(), "堆垛机存在执行中吊车任务");
                    continue;
                }