|  |  |  | 
|---|
|  |  |  | return R.parse("订单数据为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 按包装组号分组处理 | 
|---|
|  |  |  | Map<String, List<OrderDetl>> brandGroup = orderDetls.stream() | 
|---|
|  |  |  | .collect(Collectors.groupingBy(o -> { | 
|---|
|  |  |  | String brand = o.getBrand(); | 
|---|
|  |  |  | return brand != null ? brand : "跨巷道"; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | Map<String, List<OrderDetl>> brandGroup; | 
|---|
|  |  |  | if (order.getDocType() == 27) { | 
|---|
|  |  |  | // 按包装组号分组处理 | 
|---|
|  |  |  | brandGroup = orderDetls.stream() | 
|---|
|  |  |  | .collect(Collectors.groupingBy(o -> { | 
|---|
|  |  |  | String brand = o.getModel(); | 
|---|
|  |  |  | return brand != null ? brand : "跨巷道"; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 按包装组号分组处理 | 
|---|
|  |  |  | brandGroup = orderDetls.stream() | 
|---|
|  |  |  | .collect(Collectors.groupingBy(o -> { | 
|---|
|  |  |  | String brand = o.getBrand(); | 
|---|
|  |  |  | return brand != null ? brand : "跨巷道"; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDto> locDtos = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Map.Entry<String, List<OrderDetl>> entry : brandGroup.entrySet()) { | 
|---|
|  |  |  | String brand = entry.getKey(); | 
|---|
|  |  |  | List<OrderDetl> brandOrderDetls = entry.getValue(); | 
|---|
|  |  |  | List<LocDetl> locDetls; | 
|---|
|  |  |  | if (order.getDocType() == 27) { | 
|---|
|  |  |  | locDetls = locDetlService.selectList( | 
|---|
|  |  |  | new EntityWrapper<LocDetl>().eq("model", brand) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 查这个包装组对应的所有库存 | 
|---|
|  |  |  | locDetls = locDetlService.selectList( | 
|---|
|  |  |  | new EntityWrapper<LocDetl>().eq("brand", brand) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查这个包装组对应的所有库存 | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.selectList( | 
|---|
|  |  |  | new EntityWrapper<LocDetl>().eq("brand", brand) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (locDetls.isEmpty()) continue; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取出库口 | 
|---|
|  |  |  | 
|---|
|  |  |  | locDto.setUnit(locDetl.getUnit()); | 
|---|
|  |  |  | locDto.setModel(locDetl.getModel()); | 
|---|
|  |  |  | locDto.setThreeCode(locDetl.getThreeCode()); | 
|---|
|  |  |  | locDto.setBrand(brand); | 
|---|
|  |  |  | locDto.setBrand(locDetl.getBrand()); | 
|---|
|  |  |  | locDto.setOrderNo(firstDetl.getOrderNo()); | 
|---|
|  |  |  | locDto.setStaNos(staNos); | 
|---|
|  |  |  | locDto.setOrderDetlId(firstDetl.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException(one.getModel() + "卷是合格: " + one.getThreeCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (!"合格".equals(one.getThreeCode())) { | 
|---|
|  |  |  | throw new CoolException(one.getModel() + "卷不合格: " + one.getThreeCode()); | 
|---|
|  |  |  | // 3077 3106 只有合格能出 | 
|---|
|  |  |  | if((stockOutParam.getOutSite() == 3077 || stockOutParam.getOutSite() == 3106) && !"合格".equals(one.getThreeCode())) { | 
|---|
|  |  |  | throw new CoolException(one.getModel() + "卷不合格:" + one.getThreeCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 2041 只有待判能出 | 
|---|
|  |  |  | if(stockOutParam.getOutSite() == 2041 && null != one.getThreeCode()) { | 
|---|
|  |  |  | throw new CoolException(one.getModel() + "卷不为待判:" + one.getThreeCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | ioWorkType = IoWorkType.ALL_OUT; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | workService.stockOut(staNo, locDetlDtos, | 
|---|
|  |  |  | ioWorkType, | 
|---|
|  |  |  | getUserId(), optionValue); | 
|---|
|  |  |  | if (order.getDocType() == 27) { | 
|---|
|  |  |  | workService.stockOut2(staNo, locDetlDtos, | 
|---|
|  |  |  | ioWorkType, | 
|---|
|  |  |  | getUserId(), optionValue); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | workService.stockOut(staNo, locDetlDtos, | 
|---|
|  |  |  | ioWorkType, | 
|---|
|  |  |  | getUserId(), optionValue); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | throw new CoolException("所选库位状态不为F/D,库位号:" + | 
|---|
|  |  |  | locMast.getLocNo() + ",当前状态:" + | 
|---|