|  |  | 
 |  |  |  | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.concurrent.TimeUnit; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |                     .setPath(MesConstant.GWCS_DCKK_URL) | 
 |  |  |                     .setHeaders(headers) | 
 |  |  |                     .setJson(body) | 
 |  |  |                     .setTimeout(30, TimeUnit.SECONDS) // 设置连接 + 读取超时为30秒 | 
 |  |  |                     .build() | 
 |  |  |                     .doPost(); | 
 |  |  |             if (!Cools.isEmpty(response)) { | 
 |  |  | 
 |  |  |         if (config == null) { | 
 |  |  |             throw new CoolException("理货获取备货区配置错误!!!"); | 
 |  |  |         } | 
 |  |  |         Config chang = configMapper.selectConfigByCode("auto_tally_goods_chang"); | 
 |  |  |         if (chang == null) { | 
 |  |  |             throw new CoolException("理货获取备货区长度配置错误!!!"); | 
 |  |  |         } | 
 |  |  |         Config kuan = configMapper.selectConfigByCode("auto_tally_goods_kuan"); | 
 |  |  |         if (kuan == null) { | 
 |  |  |             throw new CoolException("理货获取备货区宽度配置错误!!!"); | 
 |  |  |         } | 
 |  |  |         Config gao = configMapper.selectConfigByCode("auto_tally_goods_gao"); | 
 |  |  |         if (gao == null) { | 
 |  |  |             throw new CoolException("理货获取备货区高度配置错误!!!"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 前几列是备货区 | 
 |  |  |         int columnNum = Integer.parseInt(config.getValue()); | 
 |  |  |  | 
 |  |  | 
 |  |  |         // 过滤掉木箱规格宽度大于600的(大于600一个托盘只能放一箱) | 
 |  |  |         tallyGoosList = tallyGoosList.stream().filter(locDetl -> { | 
 |  |  |             String[] split = locDetl.getColor().split("\\*"); | 
 |  |  |             if (split.length == 3) { // 高度也要低于614才能理货 | 
 |  |  |                 return Integer.parseInt(split[1]) <= 600 && Integer.parseInt(split[2]) <= 614; | 
 |  |  |             } else { | 
 |  |  |                 return false; | 
 |  |  |             if (split.length == 3) { | 
 |  |  |                 // 高度也要低于614才能理货 | 
 |  |  |                 //return Integer.parseInt(split[1]) <= 600 && Integer.parseInt(split[2]) <= 614; | 
 |  |  |                 //新逻辑 | 
 |  |  |                 String[] changLimit = chang.getValue().split("-"); | 
 |  |  |                 if (changLimit.length == 2){ | 
 |  |  |                     if (Integer.parseInt(split[0]) >= Integer.parseInt(changLimit[0]) && Integer.parseInt(split[0]) <= Integer.parseInt(changLimit[1])){ | 
 |  |  |                         String[] kuanLimit = chang.getValue().split("-"); | 
 |  |  |                         if (kuanLimit.length == 2){ | 
 |  |  |                             if (Integer.parseInt(split[1]) >= Integer.parseInt(kuanLimit[0]) && Integer.parseInt(split[1]) <= Integer.parseInt(kuanLimit[1])){ | 
 |  |  |                                 String[] gaoLimit = gao.getValue().split("-"); | 
 |  |  |                                 if (gaoLimit.length == 2){ | 
 |  |  |                                     if (Integer.parseInt(split[2]) >= Integer.parseInt(gaoLimit[0]) && Integer.parseInt(split[2]) <= Integer.parseInt(gaoLimit[1])){ | 
 |  |  |                                         return true; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |                 return false; | 
 |  |  |         }).collect(Collectors.toList()); | 
 |  |  |  | 
 |  |  |         // 寻找满足理货条件的两个木箱 |