| | |
| | | public R initLocCache(LocMastInitParam param, Long userId) { |
| | | try { |
| | | List<LocCache> list = new ArrayList<>(); |
| | | BasAreas areas = basAreasService.selectById(param.getIdentifying()); |
| | | if (Cools.isEmpty(areas)) { |
| | | return R.error("库区不存在!!!"); |
| | | } |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { |
| | | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { |
| | | // 获取库位号 |
| | | String locNo = areas.getAreaNo() + String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); |
| | | Date now = new Date(); |
| | | LocCache locMast = new LocCache(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocSts("O"); |
| | | locMast.setRow1(r); // 排 |
| | | locMast.setBay1(b); // 列 |
| | | locMast.setLev1(l); // 层 |
| | | locMast.setId(null); |
| | | locMast.setLocType1(!Cools.isEmpty(param.getLocType1()) ? param.getLocType1() : 1); |
| | | locMast.setLocType2(param.getLocType2()); |
| | | locMast.setLocType3(param.getLocType3()); |
| | | locMast.setAppeUser(userId); |
| | | locMast.setAppeTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | locMast.setAreaId(areas.getId()); |
| | | locMast.setAreaName(areas.getName()); |
| | | list.add(locMast); |
| | | } |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1) { |
| | | if (!this.delete(new EntityWrapper<>())) { |
| | | throw new CoolException("删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (!this.insertBatch(list)) { |
| | | throw new CoolException("添加失败!!"); |
| | | BasAreas areas = basAreasService.selectById(param.getIdentifying()); |
| | | if (Cools.isEmpty(areas)) { |
| | | return R.error("库区不存在!!!"); |
| | | } |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | // for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { |
| | | // for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { |
| | | // |
| | | // } |
| | | // } |
| | | // 获取库位号 |
| | | String locNo = areas.getAreaNo() + String.format("%02d", r); |
| | | Date now = new Date(); |
| | | LocCache locMast = new LocCache(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocSts("O"); |
| | | locMast.setRow1(r); // 排 |
| | | locMast.setBay1(1); // 列 |
| | | locMast.setLev1(1); // 层 |
| | | locMast.setFullPlt("N"); |
| | | locMast.setLocType1(!Cools.isEmpty(param.getLocType1()) ? param.getLocType1() : 1); |
| | | locMast.setLocType2(param.getLocType2()); |
| | | locMast.setLocType3(param.getLocType3()); |
| | | locMast.setAppeUser(userId); |
| | | locMast.setAppeTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | locMast.setAreaId(areas.getId()); |
| | | locMast.setAreaName(areas.getName()); |
| | | // list.add(locMast); |
| | | |
| | | if (!this.insert(locMast)) { |
| | | throw new CoolException("添加失败!!"); |
| | | } |
| | | } |
| | | |
| | | return R.ok("初始化成功"); |
| | | } catch (Exception e) { |
| | | return R.error("初始化失败===>" + e.getMessage()); |