From 82de5a307466894bbb0258f8a63a26a7bb96d80d Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期四, 16 十月 2025 09:55:35 +0800 Subject: [PATCH] 13 --- src/main/java/com/zy/asrs/controller/LocMastController.java | 100 ++++++++++++++++++++++++++------------------------ 1 files changed, 52 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocMastController.java b/src/main/java/com/zy/asrs/controller/LocMastController.java index ac44727..f6648dd 100644 --- a/src/main/java/com/zy/asrs/controller/LocMastController.java +++ b/src/main/java/com/zy/asrs/controller/LocMastController.java @@ -58,54 +58,58 @@ @RequestMapping(value = "/locMast/list/auth") @ManagerAuth - public R list(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, - @RequestParam(required = false)String orderByField, - @RequestParam(required = false)String orderByType, - @RequestParam Map<String, Object> param){ + public R list(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @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); // 涓嶅悓缁ф壙瑙掕壊鏄剧ず涓嶅悓搴撲俊鎭� - RoleUtils.addRoleWrapperByCrn(getUserId(),wrapper); - if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} + RoleUtils.addRoleWrapperByCrn(getUserId(), wrapper); + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); } @RequestMapping(value = "/locMast/crn/list/auth") @ManagerAuth - public R crnList(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, - @RequestParam(required = false)String orderByField, - @RequestParam(required = false)String orderByType, - @RequestParam Map<String, Object> param){ + public R crnList(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @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); - wrapper.in("crn_no", 1,2); - if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} + wrapper.in("crn_no", 1, 2); + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); } - private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { boolean sign = false; - for (Map.Entry<String, Object> entry : map.entrySet()){ + for (Map.Entry<String, Object> entry : map.entrySet()) { String val = String.valueOf(entry.getValue()); - if (val.contains(RANGE_TIME_LINK)){ + 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 if (entry.getKey().equals("loc_no")){ + } else if (entry.getKey().equals("loc_no")) { wrapper.like(entry.getKey(), val); } else { - if (entry.getKey().equals("loc_type1")){ - sign=true; + if (entry.getKey().equals("loc_type1")) { + sign = true; } wrapper.eq(entry.getKey(), val); } } - if (sign){ - wrapper.and().ne("loc_sts","Y"); + if (sign) { + wrapper.and().ne("loc_sts", "Y"); } } @@ -120,10 +124,10 @@ return R.ok(); } - @RequestMapping(value = "/locMast/update/auth") - @ManagerAuth(memo = "搴撲綅淇敼") - public R update(LocMast locMast){ - if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ + @RequestMapping(value = "/locMast/update/auth") + @ManagerAuth(memo = "搴撲綅淇敼") + public R update(LocMast locMast) { + if (Cools.isEmpty(locMast) || null == locMast.getLocNo()) { return R.error(); } LocMast oldLocMast = locMastService.selectById(locMast.getLocNo()); @@ -136,7 +140,7 @@ locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); } } - if (locMast.getLocSts().equals("O")){ + if (locMast.getLocSts().equals("O")) { locMast.setBarcode(""); } locMast.setModiUser(getUserId()); @@ -147,12 +151,12 @@ @RequestMapping(value = "/locMast/delete/auth") @ManagerAuth(memo = "搴撲綅鍒犻櫎") - public R delete(@RequestParam String param){ + public R delete(@RequestParam String param) { List<LocMast> list = JSONArray.parseArray(param, LocMast.class); - if (Cools.isEmpty(list)){ + if (Cools.isEmpty(list)) { return R.error(); } - for (LocMast entity : list){ + for (LocMast entity : list) { locMastService.delete(new EntityWrapper<>(entity)); } return R.ok(); @@ -160,7 +164,7 @@ @RequestMapping(value = "/locMast/export/auth") @ManagerAuth(memo = "搴撲綅瀵煎嚭") - public R export(@RequestBody JSONObject param){ + public R export(@RequestBody JSONObject param) { List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); Map<String, Object> map = excludeTrash(param.getJSONObject("locMast")); @@ -176,7 +180,7 @@ wrapper.like("loc_no", condition); Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); List<Map<String, Object>> result = new ArrayList<>(); - for (LocMast locMast : page.getRecords()){ + for (LocMast locMast : page.getRecords()) { Map<String, Object> map = new HashMap<>(); map.put("id", locMast.getLocNo()); map.put("value", locMast.getLocNo()); @@ -189,7 +193,7 @@ @ManagerAuth public R query(@RequestBody JSONObject param) { Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); - if (null != locMastService.selectOne(wrapper)){ + if (null != locMastService.selectOne(wrapper)) { return R.parse(BaseRes.REPEAT).add(getComment(LocMast.class, String.valueOf(param.get("key")))); } return R.ok(); @@ -199,38 +203,38 @@ @ManagerAuth(memo = "鍒濆鍖栧簱浣�") // @Transactional public R init(LocMastInitParam param) { - try{ + try { List<LocMast> list = new ArrayList<>(); BasWhs basWhs = basWhsService.selectByIdentifying(param.getIdentifying()); - if (Cools.isEmpty(basWhs)){ + if (Cools.isEmpty(basWhs)) { 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++) { + 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 = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); // 鑾峰彇鍫嗗灈鏈哄彿 int crnNo = 0; - try{ - Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount(),param.getStartRow()); - for (List<Integer> node : shelves.nodes){ + try { + Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount(), param.getStartRow()); + for (List<Integer> node : shelves.nodes) { if (node.contains(r)) { - if (!Cools.isEmpty(param.getStaCrn()) && param.getStaCrn() > 0){ + if (!Cools.isEmpty(param.getStaCrn()) && param.getStaCrn() > 0) { crnNo = shelves.nodes.indexOf(node) + param.getStaCrn(); - }else { + } else { crnNo = shelves.nodes.indexOf(node) + 1; } break; } } - }catch (Exception e){ + } catch (Exception e) { throw new Exception("瑙f瀽鍫嗗灈鏈哄彿澶辫触锛岃濉啓姝g‘鐨勬暟鎹�!!!"); } - Date now = new Date(); + Date now = new Date(); LocMast locMast = new LocMast(); locMast.setLocNo(locNo); locMast.setLocSts("O"); @@ -251,13 +255,13 @@ } } } - if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1){ + if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1) { locMastService.delete(new EntityWrapper<>()); } locMastService.insertBatch(list); return R.ok("鍒濆鍖栨垚鍔�"); - }catch (Exception e){ - return R.error("鍒濆鍖栧け璐�===>"+e.getMessage()); + } catch (Exception e) { + return R.error("鍒濆鍖栧け璐�===>" + e.getMessage()); } } } -- Gitblit v1.9.1