自动化立体仓库 - WMS系统
LSH
2022-08-18 2b0fb92e407df0c3abd0ed2f06ae7103c1569281
src/main/java/com/zy/asrs/controller/LocMastController.java
@@ -204,4 +204,50 @@
        locMastService.insertBatch(list);
        return R.ok("初始化成功");
    }
    @RequestMapping(value = "/locMast/disableALL/auth")
    @ManagerAuth(memo = "禁用指定设备号库位")
    public R disableALL(@RequestParam String param){
        return updateAll(param,"O");
    }
    @RequestMapping(value = "/locMast/openAll/auth")
    @ManagerAuth(memo = "打开指定设备号库位")
    public R openAll(@RequestParam String param){
        return updateAll(param,"X");
    }
    private R updateAll(String param,String locSts){
        List<LocMast> list = JSONArray.parseArray(param, LocMast.class);
        if (Cools.isEmpty(list)){
            return R.error();
        }
        int locType2=99;
        for (LocMast locMast : list){
            if (!locMast.getLocSts().equals(locSts)){
                if (locSts.equals("O")){
                    return R.error("此设备下有库位非空,库位号:"+locMast.getLocNo()+"\t请查看库位");
                }else if (locSts.equals("X")){
                    return R.error("此设备下有库位非禁用状态,库位号:"+locMast.getLocNo()+"\t请查看库位");
                }
            }else if (locType2==99){
                locType2 = locMast.getLocType2();
            }else if(locType2 != locMast.getLocType2()){
                return R.error("请选择同一设备号下的库位");
            }
        }
        if (locSts.equals("O")){
            locSts="X";
        }else if (locSts.equals("X")){
            locSts="O";
        }
        for (LocMast locMast : list){
            if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){
                return R.error("库位号为空:"+locMast);
            }
            locMast.setModiUser(getUserId());
            locMast.setModiTime(new Date());
            locMast.setLocSts(locSts);
            locMastService.updateById(locMast);
        }
        return R.ok();
    }
}