|  |  |  | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocMast; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.LocMastInitParam; | 
|---|
|  |  |  | import com.zy.asrs.service.LocDetlService; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper.eq("status",0))); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | String locNo = null; | 
|---|
|  |  |  | long whsType = 0L; | 
|---|
|  |  |  | Integer crnNo = 0; | 
|---|
|  |  |  | Integer row1 = 0; | 
|---|
|  |  |  | Integer bay1 = 0; | 
|---|
|  |  |  | Integer lev1 = 0; | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : param.entrySet()) { | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (Cools.isEmpty(val)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (entry.getKey().equals("whsType")) { | 
|---|
|  |  |  | whsType = Long.getLong(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("locNo")) { | 
|---|
|  |  |  | locNo = val; | 
|---|
|  |  |  | }else if (entry.getKey().equals("crnNo")) { | 
|---|
|  |  |  | crnNo = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("row1")) { | 
|---|
|  |  |  | row1 = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("bay1")) { | 
|---|
|  |  |  | bay1 = Integer.getInteger(val); | 
|---|
|  |  |  | }else if (entry.getKey().equals("lev1")) { | 
|---|
|  |  |  | lev1 = Integer.getInteger(val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocMast> locMastList = locMastService.selectLocMastListSix(locNo,whsType,crnNo,row1,bay1,lev1,0,10); | 
|---|
|  |  |  | Page<LocMast> page = new Page<LocMast>(0,10).setRecords(locMastList); | 
|---|
|  |  |  | page.setTotal(locMastService.selectLocMastListTotalSix(locNo,whsType,crnNo,row1,bay1,lev1)); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | return R.error("异常" + e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locMastQuery/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(String condition) { | 
|---|
|  |  |  | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.like("loc_no", condition); | 
|---|
|  |  |  | Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocMast> locMastList = locMastService.selectLocMastList(condition,0,10); | 
|---|
|  |  |  | Page<LocMast> page = new Page<LocMast>(0,10).setRecords(locMastList); | 
|---|
|  |  |  | page.setTotal(locMastService.selectLocMastListTotal(condition)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | for (LocMast locMast : page.getRecords()){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", locMast.getLocNo()); | 
|---|
|  |  |  | map.put("value", locMast.getLocNo()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | if (!Cools.isEmpty(locMast)){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", locMast.getLocNo()); | 
|---|
|  |  |  | map.put("value", locMast.getLocNo()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (null != locMastService.selectOne(wrapper)){ | 
|---|
|  |  |  | return R.parse(BaseRes.REPEAT).add(getComment(LocMast.class, String.valueOf(param.get("key")))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locMast/update/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "库位修改") | 
|---|
|  |  |  | public R update(LocMast locMast){ | 
|---|
|  |  |  | if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(locMast.getContainerCode())){ | 
|---|
|  |  |  | locMast.setBarcode(locMast.getContainerCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (locMast.getEmptyContainer$().equals("N") ){ | 
|---|
|  |  |  | if (locMast.getContainerCode().isEmpty() || locMast.getContainerTypeCode().isEmpty()){ | 
|---|
|  |  |  | return R.error("容器编码或容器类型有误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (locMast.getLocSts().equals("O")){ | 
|---|
|  |  |  | locMast.setBarcode(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | locMast.setModiUser(getUserId()); | 
|---|
|  |  |  | locMast.setModiTime(new Date()); | 
|---|
|  |  |  | locMastService.updateById(locMast); | 
|---|
|  |  |  | locMastService.toWmsLocStatus(locMast); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | for (List<Integer> node : shelves.nodes){ | 
|---|
|  |  |  | if (node.contains(r)) { | 
|---|
|  |  |  | crnNo = shelves.nodes.indexOf(node) + 1; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //                    Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount()); | 
|---|
|  |  |  | //                    for (List<Integer> node : shelves.nodes){ | 
|---|
|  |  |  | //                        if (node.contains(r)) { | 
|---|
|  |  |  | //                            crnNo = shelves.nodes.indexOf(node) + 1; | 
|---|
|  |  |  | //                            break; | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | Date now =  new Date(); | 
|---|
|  |  |  | LocMast locMast = new LocMast(); | 
|---|
|  |  |  | locMast.setLocNo(locNo); | 
|---|