luxiaotao1123
2021-01-13 8076a2a7abb05b4f49544bd95a6083bae0048023
src/main/java/com/zy/asrs/controller/CrnController.java
@@ -14,11 +14,14 @@
import com.zy.asrs.domain.vo.CrnStateTableVo;
import com.zy.asrs.entity.BasCrnError;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.mapper.BasCrnErrorMapper;
import com.zy.asrs.service.BasCrnpService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.asrs.utils.VersionUtils;
import com.zy.core.CrnThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -35,12 +38,15 @@
import com.zy.core.properties.SystemProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 堆垛机接口
@@ -61,6 +67,8 @@
    private BasCrnpService basCrnpService;
    @Autowired
    private MainServiceImpl mainService;
    @Autowired
    private LocMastService locMastService;
    @ManagerAuth(memo = "进行中的命令")
@@ -211,6 +219,20 @@
        return R.ok().add(str.toString());
    }
    @GetMapping("/demo/status")
    public R demoStatus(){
        List<Map<String, Object>> res = new ArrayList<>();
        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
            Map<String, Object> map = new HashMap<>();
            map.put("crnNo", crnSlave.getId());
            map.put("demo", crnSlave.getDemo());
            res.add(map);
        }
        return R.ok().add(res);
    }
    @PostMapping("/demo/switch")
    @ManagerAuth(memo = "堆垛机演示")
    public R crnDemo(CrnDemoParam param) throws InterruptedException {
@@ -224,9 +246,15 @@
            return R.error("口令错误");
        }
        Thread.sleep(200L);
        mainService.crnDemoOfLocMove(param.getCrnId());
        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
            if (crnSlave.getId().equals(param.getCrnId())) {
                crnSlave.setDemo(param.getOpt());
            }
        }
//        mainService.crnDemoOfLocMove(param.getCrnId());
        return R.ok();
    }
    /****************************************************************/
@@ -247,7 +275,6 @@
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        staNoProcess(param, command);
        return crnControl(command)?R.ok():R.error();
    }
@@ -265,7 +292,6 @@
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        staNoProcess(param, command);
        return crnControl(command)?R.ok():R.error();
    }
@@ -283,7 +309,11 @@
        command.setDestinationPosX(param.getRow());     // 目标库位排
        command.setDestinationPosY(param.getBay());     // 目标库位列
        command.setDestinationPosZ(param.getLev());     // 目标库位层
        staNoProcess(param, command);
        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);
        return crnControl(command)?R.ok():R.error();
    }
@@ -301,7 +331,6 @@
        command.setDestinationPosX(param.getStaNo());     // 目标库位排
        command.setDestinationPosY((short) 0);     // 目标库位列
        command.setDestinationPosZ((short) 1);     // 目标库位层
        staNoProcess(param, command);
        return crnControl(command)?R.ok():R.error();
    }