| | |
| | | List<Map<String, Object>> originalFilm = (List<Map<String, Object>>) object.get("originalFilm"); |
| | | glassOptimizeMapper.addOptimizeUse(originalFilm,projectId,"admin"); |
| | | |
| | | Map<String, Object> glassInfo = glassOptimizeMapper.getGlassInfo(projectId); |
| | | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | String json = mapper.writeValueAsString(optimalResults); |
| | | glassOptimizeMapper.addOptimizeProjectFile(json,projectId,"admin"); |
| | |
| | | glassOptimizeMapper.addOptimizeLayout(objectMapList,projectId); |
| | | for(Map<String, Object> objectMap:objectMapList){ |
| | | List<Map<String, Object>> objectMap2 = (List<Map<String, Object>>) objectMap.get("glassDetails"); |
| | | //迭代玻璃明细集合删除余料 |
| | | //迭代玻璃明细集合处理余料和其他 |
| | | Iterator<Map<String, Object>> iterator = objectMap2.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map<String, Object> map = iterator.next(); |
| | | if (map.get("isRemain").toString()=="true") { |
| | | iterator.remove(); |
| | | // 修改isRemain判断逻辑,支持数字0/1和字符串"0"/"1" |
| | | boolean isRemain = false; |
| | | if (map.containsKey("isRemain")) { |
| | | Object isRemainObj = map.get("isRemain"); |
| | | if (isRemainObj != null) { |
| | | if (isRemainObj instanceof Number) { |
| | | // 数字类型: 1表示true,0表示false |
| | | isRemain = ((Number) isRemainObj).intValue() == 1; |
| | | } else { |
| | | // 字符串类型: "1"表示true,"0"表示false |
| | | isRemain = "1".equals(isRemainObj.toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (isRemain) { |
| | | System.out.println( map); |
| | | if (glassInfo != null) { |
| | | String glassType = (String) glassInfo.get("glass_type"); |
| | | String glassThickness = (String) glassInfo.get("glass_thickness"); |
| | | // 余料存入optimizeoffcut |
| | | glassOptimizeMapper.addOptimizeOffcut(map, projectId, glassType, glassThickness); |
| | | } |
| | | iterator.remove(); // 从原列表中移除 |
| | | }else { |
| | | // 处理isRotate字段转换 (现在是0/1) |
| | | if (map.containsKey("isRotate")) { |
| | | Object isRotateObj = map.get("isRotate"); |
| | | if (isRotateObj != null) { |
| | | if (isRotateObj instanceof Number) { |
| | | // 直接使用数字值 |
| | | map.put("isRotate", ((Number) isRotateObj).intValue()); |
| | | } else { |
| | | // 字符串形式的"0"/"1" |
| | | String isRotateStr = isRotateObj.toString(); |
| | | if ("1".equals(isRotateStr)) { |
| | | map.put("isRotate", 1); |
| | | } else { |
| | | map.put("isRotate", 0); |
| | | } |
| | | } |
| | | } else { |
| | | map.put("isRotate", 0); // 默认值 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |