自动化立体仓库 - WMS系统
zyx
2024-02-18 399ff7e77c18e19c855d2202289d69fefee69c4e
src/main/java/com/zy/asrs/controller/AgvBasDevpController.java
@@ -6,10 +6,7 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.LocMastInitParam;
@@ -200,21 +197,46 @@
        return R.ok(result);
    }
    @RequestMapping(value = "/basDevp/visualized/list/auth/v2")
    public R visualizedList(@RequestParam String stationCode){
        Map<String, Object> result = agvBasDevpService.getAgvBasDevpDtoByStationCode(stationCode);
        return R.ok(result);
    }
    /*
    容器离场
     */
    @RequestMapping(value = "/basDevp/visualized/container/moveOut")
    public R visualiZedContainerMoveOut(@RequestBody Map<String,Object> map) {
        List<String> devNos = (List<String>) map.get("devNo");
        List<AgvWrkMast> agvWrkMastList = devNos.stream().map(devNo -> {
        List<String> devNos = new ArrayList<>();
        List<AgvWrkMast> agvWrkMastList = new ArrayList<>();
        try {
            devNos = (List<String>) map.get("devNo");
            agvWrkMastList = devNos.stream().map(devNo -> {
                AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo).eq("wrk_sts",205L));
                if(agvWrkMast.getIoType() != 101 && agvWrkMast.getIoType() != 110){
                    throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型不为101.出库,无法执行容器离场任务,请重新选择站点。");
                }
                return agvWrkMast;
            }).collect(Collectors.toList());
        }catch (Exception e){
            String devNo = map.get("devNo").toString();
            AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo));
            if(agvWrkMast.getIoType() != 101 && agvWrkMast.getIoType() != 110){
                throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型不为101.出库,无法执行容器离场任务,请重新选择站点。");
            }
            return agvWrkMast;
        }).collect(Collectors.toList());
            agvWrkMastList.add(agvWrkMast);
        }
//        List<AgvWrkMast> agvWrkMastList = devNos.stream().map(devNo -> {
//            AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo));
//            if(agvWrkMast.getIoType() != 101 && agvWrkMast.getIoType() != 110){
//                throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型不为101.出库,无法执行容器离场任务,请重新选择站点。");
//            }
//            return agvWrkMast;
//        }).collect(Collectors.toList());
        try {
           int code = agvWrkMastService.containerMoveOut(agvWrkMastList);
@@ -245,14 +267,36 @@
     */
    @RequestMapping(value = "/basDevp/visualized/container/pickIn")
    public R visualiZedPickIn(@RequestBody Map<String,Object> map){
        List<String> devNos = (List<String>) map.get("devNo");
        List<AgvWrkMast> agvWrkMastList = devNos.stream().map(devNo -> {
            AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo));
            if(agvWrkMast.getIoType() == 101){
                throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型为101.出库,无法执行拣料入库任务,请重新选择站点。");
        List<String> devNos = new ArrayList<>();
        List<AgvWrkMast> agvWrkMastList = new ArrayList<>();
        try {
            devNos = (List<String>) map.get("devNo");
            agvWrkMastList = devNos.stream().map(devNo -> {
                AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo).eq("wrk_sts",205L));
                if(agvWrkMast.getIoType() == 101){
                    throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型为101.出库,无法执行拣料入库任务,请重新选择站点。");
                }
                return agvWrkMast;
            }).collect(Collectors.toList());
        }catch (Exception e){
            String devNo = map.get("devNo").toString();
            AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo).eq("wrk_sts",205L));
            if (agvWrkMast != null) {
                if(agvWrkMast.getIoType() == 101){
                    throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型为101.出库,无法执行拣料入库任务,请重新选择站点。");
                }
                agvWrkMastList.add(agvWrkMast);
            }
            return agvWrkMast;
        }).collect(Collectors.toList());
        }
//        List<String> devNos = (List<String>) map.get("devNo");
//        List<AgvWrkMast> agvWrkMastList = devNos.stream().map(devNo -> {
//            AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", devNo));
//            if(agvWrkMast.getIoType() == 101){
//                throw new CoolException("工作号为" + agvWrkMast.getWrkNo() + "类型为101.出库,无法执行拣料入库任务,请重新选择站点。");
//            }
//            return agvWrkMast;
//        }).collect(Collectors.toList());
        agvWorkService.pickIn(agvWrkMastList);