| | |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | boolean sign = false; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | } else if (entry.getKey().equals("loc_no")){ |
| | | wrapper.like(entry.getKey(), val); |
| | | } else { |
| | | if (entry.getKey().equals("loc_type1")){ |
| | | sign=true; |
| | | } |
| | | wrapper.eq(entry.getKey(), val); |
| | | } |
| | | } |
| | | if (sign){ |
| | | wrapper.and().ne("loc_sts","Y"); |
| | | } |
| | | } |
| | | |
| | |
| | | String locNo = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); |
| | | // 获取堆垛机号 |
| | | int crnNo = 0; |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount()); |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount(),param.getStartRow()); |
| | | for (List<Integer> node : shelves.nodes){ |
| | | |
| | | if (node.contains(r)) { |
| | | crnNo = shelves.nodes.indexOf(node) + 1; |
| | | if (!Cools.isEmpty(param.getStaCrn()) && param.getStaCrn() > 0){ |
| | | crnNo = shelves.nodes.indexOf(node) + param.getStaCrn(); |
| | | }else { |
| | | crnNo = shelves.nodes.indexOf(node) + 1; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | locMastService.delete(new EntityWrapper<>()); |
| | | locDetlService.delete(new EntityWrapper<>()); |
| | | if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1){ |
| | | locMastService.delete(new EntityWrapper<>()); |
| | | } |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/convert/size/auth") |
| | | @ManagerAuth(memo = "大小库位转换") |
| | | @Transactional |
| | | public R convertSize(@RequestParam String param) { |
| | | List<LocMast> list = JSONArray.parseArray(param, LocMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | } |
| | | for (LocMast entity : list){ |
| | | if (!entity.getCrnNo().equals(1) && !entity.getCrnNo().equals(4)){ |
| | | return R.error("请选择1号、4号堆垛机的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | if (!entity.getLocSts().equals("O") && !entity.getLocSts().equals("Y")){ |
| | | return R.error("请选择空闲、被合并的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | } |
| | | List<String> innermostSideLoc = Utils.getInnermostSideLoc(list); |
| | | StringBuilder msg=new StringBuilder(); |
| | | for (String locNo : innermostSideLoc){ |
| | | String innermostSideLocLBR = Utils.getInnermostSideLocLBR(locNo); |
| | | LocMast locMast1 = locMastService.selectById(innermostSideLocLBR);//浅 |
| | | if (Cools.isEmpty(locMast1)){ |
| | | msg.append("请选择浅库位存在的货位!!!不符合条件库位:").append(innermostSideLocLBR).append("/n"); |
| | | continue; |
| | | } |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | msg.append("请选择浅库位空闲的货位!!!不符合条件库位:").append(locMast1.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | LocMast locMast = locMastService.selectById(locNo);//深 |
| | | if (Cools.isEmpty(locMast)){ |
| | | msg.append("请选择深库位存在的货位!!!不符合条件库位:").append(locNo).append("/n"); |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("O")){ |
| | | locMast1.setLocType1((short)2); |
| | | locMast.setLocType1((short)2); |
| | | locMast.setLocSts("Y"); |
| | | }else if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("Y")){ |
| | | locMast1.setLocType1((short)1); |
| | | locMast.setLocType1((short)1); |
| | | locMast.setLocSts("O"); |
| | | }else { |
| | | msg.append("请选择深库位库位空闲、被合并的货位!!!不符合条件库位:").append(locMast.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | locMastService.updateById(locMast1); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | return R.ok(msg); |
| | | } |
| | | } |