zwl
2025-05-14 1b160b340bd6fe5f34cedbd01c80b9530d530d91
src/main/java/com/zy/asrs/controller/CrnController.java
@@ -130,7 +130,7 @@
            vo.setForkOffset(crnProtocol.getForkPosType().desc);    // 货叉位置
            vo.setLiftPos(crnProtocol.getLiftPosType().desc);
            vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位");
            vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1()));
            vo.setWarnCode(String.valueOf(crnProtocol.getAlarm()));
            if (crnProtocol.getAlarm() > 0) {
                BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
                vo.setAlarm(crnError==null?"未知异常":crnError.getErrName());
@@ -165,9 +165,9 @@
        vo.setForkOffset(crnProtocol.getForkPosType().desc);    // 货叉位置
        vo.setLiftPos(crnProtocol.getLiftPosType().desc);
        vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位");
        vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1()));
        if (crnProtocol.getAlarm1() > 0) {
            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
        vo.setWarnCode(String.valueOf(crnProtocol.getAlarm()));
        if (crnProtocol.getAlarm() > 0) {
            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
            vo.setAlarm(crnError==null?"未知异常":crnError.getErrName());
        }
        return R.ok().add(vo);
@@ -307,9 +307,9 @@
            vo.setForkOffset(crnProtocol.getForkPosType().desc);    // 货叉位置
            vo.setLiftPos(crnProtocol.getLiftPosType().desc);
            vo.setWalkPos(crnProtocol.getWalkPos()==1?"不在定位":"在定位");
            vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1()));
            if (crnProtocol.getAlarm1() > 0) {
                BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
            vo.setWarnCode(String.valueOf(crnProtocol.getAlarm()));
            if (crnProtocol.getAlarm() > 0) {
                BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
                vo.setAlarm(crnError==null?"未知异常":crnError.getErrName());
            }
            vo.setInEnable(basCrnp.getInEnable());
@@ -376,21 +376,21 @@
    @ManagerAuth(memo = "入库")
    @PostMapping("/crn/operator/put")
    public R crnPut(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        // 系统运行状态判断
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
        command.setAckFinish((short) 0);  // 任务完成确认位
        command.setTaskMode(CrnTaskModeType.PAKIN); // 任务模式
        command.setSourcePosZ(param.getSourceRow());     // 源库位排
        command.setSourcePosX(param.getSourceBay());     // 源库位列
        command.setSourcePosY(param.getSourceLev());     // 源库位层
        command.setDestinationPosZ(param.getRow());     // 目标库位排
        command.setDestinationPosX(param.getBay());     // 目标库位列
        command.setDestinationPosY(param.getLev());     // 目标库位层
        command.setSourcePosX(param.getSourceRow());     // 源库位排
        command.setSourcePosY(param.getSourceBay());     // 源库位列
        command.setSourcePosZ(param.getSourceLev());     // 源库位层
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        command.setCommand((short)1);
        return crnControl(command)?R.ok():R.error();
    }
@@ -399,20 +399,21 @@
    @PostMapping("/crn/operator/take")
    public R crnTake(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
        command.setAckFinish((short) 0);  // 任务完成确认位
        command.setTaskMode(CrnTaskModeType.PAKOUT); // 任务模式
        command.setSourcePosZ(param.getSourceRow());     // 源库位排
        command.setSourcePosX(param.getSourceBay());     // 源库位列
        command.setSourcePosY(param.getSourceLev());     // 源库位层
        command.setDestinationPosZ(param.getRow());     // 目标库位排
        command.setDestinationPosX(param.getBay());     // 目标库位列
        command.setDestinationPosY(param.getLev());     // 目标库位层
        command.setTaskMode(CrnTaskModeType.PAKIN); // 任务模式
        command.setSourcePosX(param.getSourceRow());     // 源库位排
        command.setSourcePosY(param.getSourceBay());     // 源库位列
        command.setSourcePosZ(param.getSourceLev());     // 源库位层
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        command.setCommand((short)1);
        return crnControl(command)?R.ok():R.error();
    }
@@ -420,26 +421,30 @@
    @PostMapping("/crn/operator/stockMove")
    public R crnStockMove(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
        command.setAckFinish((short) 0);  // 任务完成确认位
        command.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式
        command.setSourcePosZ(param.getSourceRow());     // 源库位排
        command.setSourcePosX(param.getSourceBay());     // 源库位列
        command.setSourcePosY(param.getSourceLev());     // 源库位层
        command.setDestinationPosZ(param.getRow());     // 目标库位排
        command.setDestinationPosX(param.getBay());     // 目标库位列
        command.setDestinationPosY(param.getLev());     // 目标库位层
        command.setSourcePosX(param.getSourceRow());     // 源库位排
        command.setSourcePosY(param.getSourceBay());     // 源库位列
        command.setSourcePosZ(param.getSourceLev());     // 源库位层
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        command.setCommand((short)1);
        LocMast sourceLoc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getSourcePosX())
                .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);
        try {
            VersionUtils.locMoveCheckLocType(sourceLoc, loc);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return crnControl(command)?R.ok():R.error();
    }
@@ -447,9 +452,9 @@
    @PostMapping("/crn/operator/siteMove")
    public R crnSiteMove(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
@@ -468,9 +473,9 @@
    @PostMapping("/crn/operator/bacOrigin")
    public R crnBacOrigin(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
@@ -489,9 +494,9 @@
    @PostMapping("/crn/operator/reverseOrigin")
    public R reverseOrigin(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
@@ -528,9 +533,9 @@
    @PostMapping("/crn/operator/taskComplete")
    public R crnTaskComplete(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
        command.setTaskNo((short) 0); // 工作号
@@ -542,6 +547,7 @@
        command.setDestinationPosX((short) 0);     // 目标库位排
        command.setDestinationPosY((short) 0);     // 目标库位列
        command.setDestinationPosZ((short) 0);     // 目标库位层
        command.setCommand((short)0);
        return crnControl(command)?R.ok():R.error();
    }
@@ -561,9 +567,9 @@
    @PostMapping("/crn/operator/clearCommand")
    public R crnClearCommand(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        if (param.getCrnNo() == null) {
            throw new CoolException("请选择堆垛机");
        }
@@ -585,9 +591,9 @@
    @PostMapping("/crn/operator/handleReset")
    public R handleReset(CrnOperatorParam param) throws Exception {
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        if (param.getCrnNo() == null) {
            throw new CoolException("请选择堆垛机");
        }
@@ -610,7 +616,7 @@
                crnCommand.setCommand((short) 0);  // 任务完成确认位
                // 延时发送
                Thread.sleep(1000L);
                if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand), false)) {
                if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand), false)) {
                    return R.ok();
                } else {
                    throw new CoolException("命令下发失败");
@@ -627,9 +633,9 @@
    @PostMapping("/crn/operator/auto")
    public R crnAuto(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -642,9 +648,9 @@
    @PostMapping("/crn/operator/semiAutomatic")
    public R crnsemiAutomatic(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -657,9 +663,9 @@
    @PostMapping("/crn/operator/hand")
    public R onlineWrk1(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -672,9 +678,9 @@
    @PostMapping("/crn/operator/onlineWrk1")
    public R onlineWrk2(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -687,9 +693,9 @@
    @PostMapping("/crn/operator/onlineWrk2")
    public R onlineWrk3(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -702,9 +708,9 @@
    @PostMapping("/crn/operator/onlineWrk3")
    public R onlineWrk4(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -717,9 +723,9 @@
    @PostMapping("/crn/operator/onlineWrk4")
    public R crnHand(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号
@@ -733,9 +739,9 @@
    @PostMapping("/crn/operator/reset")
    public R crnReset(CrnOperatorParam param){
        // 系统运行状态判断
        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
            return R.error("wcs系统状态为开启");
        }
//        if (SystemProperties.WCS_RUNNING_STATUS.get()) {
//            return R.error("wcs系统状态为开启");
//        }
        short[] array = new short[9];
        CrnCommand command = new CrnCommand();
        command.setCrnNo(param.getCrnNo()); // 堆垛机编号