Browse Source

修改包件转库存品

training
caoyizhong 1 year ago
parent
commit
09fa2152ec
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionParcelListController.java
  2. 104
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

2
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<String, Object> distributionParcelList) {

104
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -391,58 +391,66 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
*/
@Override
public R packageTransferStock(Map<String, Object> distributionParcelList) {
Object o = distributionParcelList.get("list");
Object o = distributionParcelList.get("ids");
if(ObjectUtils.isNull(o)){
return R.fail("参数不完整!");
}
List<DistributionParcelListEntity> 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<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>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<DistributionParcelListEntity> 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<DistributionParcelListEntity> 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<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>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;
}

Loading…
Cancel
Save