diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java index dc38b0848..ae7cc71a5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java @@ -128,7 +128,7 @@ public class DistributionParcelListController extends BladeController { /** * 包件转库存品 */ - @PostMapping("/packageTransfer") + @GetMapping("/packageTransfer") @ApiOperationSupport(order = 2) @ApiOperation(value = "包件转库存品", notes = "传入distributionParcelList") public R packageTransferStock(@ApiIgnore @RequestParam Map distributionParcelList) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 93f17075c..547e8f172 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -391,58 +391,66 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl distributionParcelList) { - Object o = distributionParcelList.get("list"); + Object o = distributionParcelList.get("ids"); if(ObjectUtils.isNull(o)){ return R.fail("参数不完整!"); } - List list1 = Collections.singletonList((DistributionParcelListEntity) o); - if (!list1.isEmpty()) { - list1.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getMaterialId)) - .forEach((k ,v) ->{ - int sum = v.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); - v.stream().forEach( i -> { - //查询有没有打托数据 - - //查询包件有没有物料 - List list = distributionParcelDetailsService.list(Wrappers.query().lambda() - .eq(DistributionParcelDetailsEntity::getParcelListId, i.getId()) - ); - if (!list.isEmpty()) { - //有 - list.stream().collect(Collectors.groupingBy(DistributionParcelDetailsEntity::getEncoded)) - .forEach((kk,vv) ->{ - DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); - BeanUtil.copyProperties(vv.get(0),parcelListEntity); - parcelListEntity.setQuantity(sum); - parcelListEntity.setMaterialName(vv.get(0).getName()); - parcelListEntity.setMaterialCode(vv.get(0).getEncoded()); - parcelListEntity.setMaterialUnit(vv.get(0).getUnit()); - // 添加库存品信息 - addStockList(parcelListEntity, 1); - }); - } - DistributionParcelListEntity parcelList = new DistributionParcelListEntity(); - parcelList.setId(i.getId()); - parcelList.setConditions(2); - baseMapper.updateById(parcelList); - - }); - DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); - BeanUtil.copyProperties(v.get(0),parcelListEntity); - parcelListEntity.setQuantity(sum); - // 添加库存品信息 - addStockList(parcelListEntity, 1); - }); - -// for (int i = 0; i < split.length; i++) { -// //修改订单状态 -// DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); -// stockArticleEntity.setId(Long.parseLong(split[i])); -// stockArticleEntity.setGenre(2); -// baseMapper.updateById(stockArticleEntity); -// } - return R.success("操作成功!"); + QueryWrapper queryWrapper = new QueryWrapper<>(); + String s = String.valueOf(o); + if(s.contains(",")){ + String[] split = s.split(","); + queryWrapper.in("id",split); + }else{ + queryWrapper.eq("id",o); } + List list1 = baseMapper.selectList(queryWrapper); +// if (!list1.isEmpty()) { +// list1.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getMaterialId)) +// .forEach((k ,v) ->{ +// int sum = v.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); +// v.stream().forEach( i -> { +// //查询有没有打托数据 +// +// //查询包件有没有物料 +// List list = distributionParcelDetailsService.list(Wrappers.query().lambda() +// .eq(DistributionParcelDetailsEntity::getParcelListId, i.getId()) +// ); +// if (!list.isEmpty()) { +// //有 +// list.stream().collect(Collectors.groupingBy(DistributionParcelDetailsEntity::getEncoded)) +// .forEach((kk,vv) ->{ +// DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); +// BeanUtil.copyProperties(vv.get(0),parcelListEntity); +// parcelListEntity.setQuantity(sum); +// parcelListEntity.setMaterialName(vv.get(0).getName()); +// parcelListEntity.setMaterialCode(vv.get(0).getEncoded()); +// parcelListEntity.setMaterialUnit(vv.get(0).getUnit()); +// // 添加库存品信息 +// addStockList(parcelListEntity, 1); +// }); +// } +// DistributionParcelListEntity parcelList = new DistributionParcelListEntity(); +// parcelList.setId(i.getId()); +// parcelList.setConditions(2); +// baseMapper.updateById(parcelList); +// +// }); +// DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); +// BeanUtil.copyProperties(v.get(0),parcelListEntity); +// parcelListEntity.setQuantity(sum); +// // 添加库存品信息 +// addStockList(parcelListEntity, 1); +// }); +// +//// for (int i = 0; i < split.length; i++) { +//// //修改订单状态 +//// DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); +//// stockArticleEntity.setId(Long.parseLong(split[i])); +//// stockArticleEntity.setGenre(2); +//// baseMapper.updateById(stockArticleEntity); +//// } +// return R.success("操作成功!"); +// } return null; }