| | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | // return R.error("未查询到物料信息,"+split[0]); |
| | | // } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | 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]); |
| | | 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); |
| | | } |
| | | |