| | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | if (Cools.isEmpty(tagId)) { |
| | | tagId = getOriginTag().getId(); |
| | | } |
| | | return R.ok(matService.getPage(new Page<>(curr, limit) |
| | | return R.ok(matService.getPage2(new Page<>(curr, limit) |
| | | , String.valueOf(tagId) |
| | | , param.get("matnr") |
| | | , param.get("maktx")) |
| | | , param.get("maktx") |
| | | , param.get("specs")) |
| | | ); |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/mat/turn/over/list/auth") |
| | | @ManagerAuth |
| | | public R turnOverList(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | return R.ok(matService.getMatTurnPage(toPage(curr, limit, param, Mat.class))); |
| | | } |
| | | |
| | | @RequestMapping("/mat/turn/over/take/site") |
| | | @ManagerAuth() |
| | | public R availableTakeSite(@RequestParam(required = false) String matnr){ |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | List<Mat> mats = matService.selectByMatnrLink(matnr); |
| | | for (Mat mat : mats) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("siteId", mat.getId()); |
| | | map.put("desc", mat.getMatnr()); |
| | | result.add(map); |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/mat/export/auth") |
| | |
| | | return R.ok().add(valueVos); |
| | | } |
| | | |
| | | @RequestMapping(value = "/mat/list/pda/page/auth") |
| | | @ManagerAuth |
| | | public R pdaPageList(@RequestParam(required = true)Long tagId, |
| | | @RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit){ |
| | | EntityWrapper<Mat> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("tag_id", tagId); |
| | | wrapper.orderBy("create_time", false); |
| | | return R.ok().add(matService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/mat/split") |
| | | @ManagerAuth(memo = "解析物料码") |
| | | public R split(@RequestParam("matnr") String matnr) { |
| | | if (Cools.isEmpty(matnr)) { |
| | | return R.error("数据为空"); |
| | | } |
| | | String[] split = matnr.split(","); |
| | | if (split.length != 8) { |
| | | return R.error("数据错误"); |
| | | } |
| | | // Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", split[0])); |
| | | // if (Cools.isEmpty(mat)){ |
| | | // return R.error("未查询到物料信息,"+split[0]); |
| | | // } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (split[0].equals("00000000")) { |
| | | // 原材料码解析规则 |
| | | map.put("matnr", split[0]); |
| | | map.put("batch", split[1]); |
| | | map.put("specs", split[2]); |
| | | map.put("manuDate", split[3]); |
| | | map.put("model", split[4]); |
| | | String[] split1 = split[5].split("\\*"); |
| | | double a = Double.parseDouble(split1[0]); // 厚度 |
| | | double b = Double.parseDouble(split1[1]); // 宽幅 |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | map.put("weight", df.format(b)); |
| | | map.put("length", split[6]); |
| | | map.put("volume", df.format(a * b)); |
| | | } else { |
| | | // 半成品码解析规则 |
| | | map.put("matnr", split[0]); |
| | | map.put("batch", split[1]); |
| | | map.put("specs", split[2].substring(0, split[2].length() - 1)); |
| | | map.put("manuDate", split[3]); |
| | | map.put("model", split[4].substring(0, split[4].length() - 1)); |
| | | map.put("weight", split[5].substring(0, split[5].length() - 2)); |
| | | map.put("length", split[6]); |
| | | map.put("volume", split[7]); |
| | | } |
| | | |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | //0205040001,K44132-09-0724,PE@,20240724,HD-233L@,70@@,2816,53908.56626 80000001 |
| | | } |