| | |
| | | if (Objects.isNull(itemParams) || itemParams.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | String waveId = map.get("wave").toString(); |
| | | Wave waves = this.getById(Long.parseLong(waveId)); |
| | | // Wave waveId = (Wave) map.get("wave"); |
| | | Wave wave = JSON.parseObject(JSON.toJSONString(map.get("wave")), Wave.class); |
| | | Wave waves = this.getById(wave.getId()); |
| | | if (Objects.isNull(waves)) { |
| | | throw new CoolException("波次数据不存在!!"); |
| | | } |
| | |
| | | private List<WaveItem> getLocs(List<WaveItem> waveItems) throws Exception { |
| | | //TODO 根据物料编码,批次,动态字段 查询符合的库位,再根据库位中物料的数量选择最适合的库位 |
| | | waveItems.forEach(waveItem -> { |
| | | List<LocItem> locItems = locItemService.list(new QueryWrapper<LocItem>() |
| | | LambdaQueryWrapper<LocItem> locItemLambdaQueryWrapper = new QueryWrapper<LocItem>() |
| | | .select("id", "loc_id", "loc_code", "order_id", "SUM(anfme) anfme", "SUM(qty) qty", "SUM(work_qty) work_qty", "splr_batch", "fields_index", "matnr_code") |
| | | .lambda() |
| | | .eq(LocItem::getMatnrCode, waveItem.getMatnrCode()) |
| | | .eq(LocItem::getSplrBatch, waveItem.getSplrBatch()) |
| | | .eq(StringUtils.isNotBlank(waveItem.getFieldsIndex()), LocItem::getFieldsIndex, waveItem.getFieldsIndex()) |
| | | .groupBy(LocItem::getMatnrCode, LocItem::getSplrBatch, LocItem::getFieldsIndex, LocItem::getId)); |
| | | .eq(StringUtils.isNotBlank(waveItem.getFieldsIndex()), LocItem::getFieldsIndex, waveItem.getFieldsIndex()); |
| | | Wave wave = this.getById(waveItem.getWaveId()); |
| | | if (!Cools.isEmpty(wave.getLocCode())) { |
| | | locItemLambdaQueryWrapper.eq(LocItem::getLocCode, wave.getLocCode()); |
| | | } |
| | | locItemLambdaQueryWrapper.groupBy(LocItem::getMatnrCode, LocItem::getSplrBatch, LocItem::getFieldsIndex, LocItem::getId); |
| | | List<LocItem> locItems = locItemService.list(locItemLambdaQueryWrapper); |
| | | List<Double> doubles1 = locItems.stream().map(LocItem::getAnfme).collect(Collectors.toList()); |
| | | double[] doubles = doubles1.stream().mapToDouble(Double::doubleValue).toArray(); |
| | | |