自动化立体仓库 - WCS系统
zjj
2024-02-29 bdfbc18dd29ad3c7b3ae0f9ed6345e4c69ddd6c9
src/main/java/com/zy/asrs/controller/CrnController.java
@@ -248,6 +248,8 @@
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        boolean locSts = isLocSts(param.getRow().toString(), param.getBay().toString(), param.getLev().toString());
        command.setTraySize(locSts);
        return crnControl(command)?R.ok():R.error();
    }
@@ -265,6 +267,8 @@
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        boolean locSts = isLocSts(param.getSourceRow().toString(), param.getSourceBay().toString(), param.getSourceLev().toString());
        command.setTraySize(locSts);
        return crnControl(command)?R.ok():R.error();
    }
@@ -286,7 +290,11 @@
                .eq("bay1", command.getSourcePosY()).eq("lev1", command.getSourcePosZ()));
        LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX())
                .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ()));
        VersionUtils.locMoveCheckLocType(sourceLoc, loc);
        if (sourceLoc.getLocType1() != loc.getLocType1()){
            return R.error("库位类型不一致");
        }
        command.setTraySize(loc.getLocType1() == 2);
//        VersionUtils.locMoveCheckLocType(sourceLoc, loc);
        return crnControl(command)?R.ok():R.error();
    }
@@ -394,8 +402,18 @@
        if (param.getCrnNo() == null) {
            throw new CoolException("请选择堆垛机");
        }
        MessageQueue.clear(SlaveType.Crn, param.getCrnNo());
        return R.ok("清除命令成功");
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
        command.setAckFinish((short) 0);  // 任务完成确认位
        command.setTaskMode(CrnTaskModeType.NONE); // 任务模式
        command.setSourcePosX((short) 0);     // 源库位排
        command.setSourcePosY((short) 0);     // 源库位列
        command.setSourcePosZ((short) 0);     // 源库位层
        command.setDestinationPosX((short) 0);     // 目标库位排
        command.setDestinationPosY((short) 0);     // 目标库位列
        command.setDestinationPosZ((short) 0);     // 目标库位层
        return crnControl(command)?R.ok():R.error();
    }
    @ManagerAuth(memo = "手动复位")
@@ -420,6 +438,7 @@
                crnCommand.setCrnNo(crn.getId()); // 堆垛机编号
                crnCommand.setTaskMode(CrnTaskModeType.CLEAR);
                crnCommand.setAckFinish((short) 0);  // 任务完成确认位
                crnCommand.setCommand((short) 0);  // 任务完成确认位
                // 延时发送
                Thread.sleep(1000L);
                if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand))) {
@@ -490,5 +509,17 @@
        }
    }
    private boolean isLocSts(String row,String bay,String lev){
        String loc = String.format("%2d",row)+String.format("%3d",bay)+String.format("%2d",lev);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", loc));
        if (Cools.isEmpty(locMast)){
            return false;
        }
        if (locMast.getLocType1() == 2){
            return true;
        }
        return false;
    }
}