|
|
|
@ -588,6 +588,11 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return t -> map.putIfAbsent(keyExtractor.apply(t),Boolean.TRUE)==null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询货位包件信息 |
|
|
|
|
* @param stockupDTO |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<DistributionStockupOrderListVO> selectStockupOrderList(StockupDTO stockupDTO) { |
|
|
|
|
Long reservationId = stockupDTO.getReservationId();//预约单id
|
|
|
|
@ -604,9 +609,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId(),stockupDTO.getReservationId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
if(listYou.size() > 0){ |
|
|
|
|
boolean b = listYou.stream().anyMatch(o -> o.getAllocationId().equals(i.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
@ -615,7 +621,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//相同
|
|
|
|
|
y.setPlanNum(y.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
y.setScanNum(y.getScanNum()+i1); |
|
|
|
|
y.setScanNum(y.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//t托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(y.getTrayId()) && ObjectUtils.isNotNull(i.getTrayId()) && !y.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -634,7 +640,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setScanNum(i2); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
@ -644,7 +650,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setScanNum(i2); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
|
} |
|
|
|
@ -675,9 +681,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId(),stockupDTO.getReservationId() ); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
boolean b = listYou.stream().anyMatch(ii ->ii.getAllocationId().equals(i.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
|
listYou.forEach( wu -> { |
|
|
|
@ -685,7 +692,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//相同
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i1); |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(i.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -709,7 +716,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum( i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setScanNum(i2); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
@ -722,9 +729,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId(), stockupDTO.getReservationId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
boolean b = listYou.stream().anyMatch(ko -> ObjectUtils.isNull(ko.getAllocationId())); |
|
|
|
|
if(b){ |
|
|
|
|
|
|
|
|
@ -734,7 +742,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i1); |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//托盘信息
|
|
|
|
|
if( ObjectUtils.isNotNull(i.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){ |
|
|
|
@ -758,7 +766,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setScanNum(i2); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
@ -787,9 +795,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(p.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(p.getParcelListId(),stockupDTO.getReservationId() ); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
|
|
|
|
|
if(listYou.size() > 0){ |
|
|
|
|
//
|
|
|
|
@ -801,7 +810,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//相同
|
|
|
|
|
y.setPlanNum(y.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(p.getStockId())){ |
|
|
|
|
y.setScanNum(y.getScanNum()+i1); |
|
|
|
|
y.setScanNum(y.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//t托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(y.getTrayId()) && !y.getTrayId().contains(p.getTrayId())){ |
|
|
|
@ -823,7 +832,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNull(p.getStockId())){ |
|
|
|
|
p.setScanNum(0); |
|
|
|
|
}else{ |
|
|
|
|
p.setScanNum(i1); |
|
|
|
|
p.setScanNum(i2); |
|
|
|
|
} |
|
|
|
|
listYou.add(p); |
|
|
|
|
} |
|
|
|
@ -833,7 +842,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNull(p.getStockId())){ |
|
|
|
|
p.setScanNum(0); |
|
|
|
|
}else{ |
|
|
|
|
p.setScanNum(i1); |
|
|
|
|
p.setScanNum(i2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
listYou.add(p); |
|
|
|
@ -860,9 +869,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(p.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(p.getParcelListId(),stockupDTO.getReservationId() ); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(listYou.size() > 0){ |
|
|
|
@ -875,7 +885,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//相同
|
|
|
|
|
y.setPlanNum(y.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(p.getStockId())){ |
|
|
|
|
y.setScanNum(y.getScanNum()+i1); |
|
|
|
|
y.setScanNum(y.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//t托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(y.getTrayId()) && ObjectUtils.isNotNull(p.getTrayId()) && !y.getTrayId().contains(p.getTrayId())){ |
|
|
|
@ -902,7 +912,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNull(p.getStockId())){ |
|
|
|
|
p.setScanNum(0); |
|
|
|
|
}else{ |
|
|
|
|
p.setScanNum(i1); |
|
|
|
|
p.setScanNum(i2); |
|
|
|
|
p.setCompleteStact(true); |
|
|
|
|
} |
|
|
|
|
listYou.add(p); |
|
|
|
@ -913,7 +923,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
if (ObjectUtils.isNull(p.getStockId())){ |
|
|
|
|
p.setScanNum(0); |
|
|
|
|
}else{ |
|
|
|
|
p.setScanNum(i1); |
|
|
|
|
p.setScanNum(i2); |
|
|
|
|
p.setCompleteStact(true); |
|
|
|
|
} |
|
|
|
|
listYou.add(p); |
|
|
|
@ -924,9 +934,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity one = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
if(stockupDTO.getIsZero().equals("1")) { |
|
|
|
|
//零担 查询预约数量
|
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId()); |
|
|
|
|
one = reservationZeroPackageService.getOneZeroPackageNum(i.getParcelListId(), stockupDTO.getReservationId()); |
|
|
|
|
} |
|
|
|
|
int i1 = stockupDTO.getIsZero().equals("1") ? one.getQuantity() : 1; |
|
|
|
|
int i2 = stockupDTO.getIsZero().equals("1") ? one.getRealityQuantity() : 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean b = listYou.stream().anyMatch(ko -> ObjectUtils.isNull(ko.getAllocationId())); |
|
|
|
@ -936,7 +947,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//相同
|
|
|
|
|
wu.setPlanNum(wu.getPlanNum()+i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i1); |
|
|
|
|
wu.setScanNum(wu.getScanNum()+i2); |
|
|
|
|
} |
|
|
|
|
//托盘信息
|
|
|
|
|
if(ObjectUtils.isNotNull(wu.getTrayId()) && ObjectUtils.isNotNull(i.getTrayId()) && !wu.getTrayId().contains(i.getTrayId())){ |
|
|
|
@ -960,7 +971,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
}else{ |
|
|
|
|
i.setPlanNum(i1); |
|
|
|
|
if(ObjectUtils.isNotNull(i.getStockId())){ |
|
|
|
|
i.setScanNum(i1); |
|
|
|
|
i.setScanNum(i2); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
}else{ |
|
|
|
|
i.setScanNum(0); |
|
|
|
@ -2123,7 +2134,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
stockupDTO.setStockArticleId(null); |
|
|
|
|
} |
|
|
|
|
//把数据取出来
|
|
|
|
|
List<StockupZeroVO> zeroStockUpData = new ArrayList<>();; |
|
|
|
|
List<StockupZeroVO> zeroStockUpData;; |
|
|
|
|
if(stockupDTO.getTypeService().equals("3")){ |
|
|
|
|
//自提
|
|
|
|
|
if(ObjectUtils.isNull(stockupDTO.getAllocationId())){ |
|
|
|
@ -2146,9 +2157,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
List<StockupZeroVO> finalZeroStockUpData = zeroStockUpData; |
|
|
|
|
List<StockupZeroVO> collect = stockupDTO.getList().stream().filter( //可以
|
|
|
|
|
a -> finalZeroStockUpData.stream().anyMatch(q -> a.getStockArticleId().equals(q.getStockArticleId()) && a.getQuantity() <= q.getQuantity() && a.getQuantity() > 0) |
|
|
|
|
int xiugai= 0; |
|
|
|
|
List<StockupZeroVO> collect = zeroStockUpData.stream().filter( //可以
|
|
|
|
|
a -> stockupDTO.getList().stream().anyMatch(q -> a.getStockArticleId().equals(q.getStockArticleId()) && q.getQuantity() <= a.getQuantity() && q.getQuantity() > 0) |
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
//添加备货信息
|
|
|
|
|
List<DistributionStockEntity> stockEntityList = new ArrayList<>(); |
|
|
|
@ -2157,11 +2168,12 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionStockEntity one = distributionStockService.getOne(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockEntity::getStockArticle, i.getStockArticleId()) |
|
|
|
|
.eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId()) |
|
|
|
|
.eq(DistributionStockEntity::getReservationId, stockupDTO.getReservationId()) |
|
|
|
|
.eq(DistributionStockEntity::getParcelListId, i.getParcelListId()) |
|
|
|
|
); |
|
|
|
|
//查询备货数量
|
|
|
|
|
DistributionReservationZeroPackageEntity byId = reservationZeroPackageService.getById(i.getId()); |
|
|
|
|
if(byId.getRealityQuantity()+i.getQuantity() > byId.getQuantity()){ |
|
|
|
|
if(i.getQuantity() > byId.getQuantity()){ |
|
|
|
|
return Resp.scanFail(i.getCategoryName()+"备货数量大于待备货数量!",i.getCategoryName()+"备货数量大于待备货数量!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2169,7 +2181,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//修改数量
|
|
|
|
|
DistributionStockEntity stockEntity = new DistributionStockEntity(); |
|
|
|
|
stockEntity.setId(one.getId()); |
|
|
|
|
stockEntity.setStockQuantity(one.getStockQuantity()+i.getQuantity()); |
|
|
|
|
stockEntity.setStockQuantity(i.getQuantity()); |
|
|
|
|
distributionStockService.updateById(stockEntity); |
|
|
|
|
}else{ |
|
|
|
|
DistributionStockEntity stockEntity = new DistributionStockEntity(); |
|
|
|
@ -2192,17 +2204,30 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
DistributionReservationZeroPackageEntity reservationZeroPackageEntity = new DistributionReservationZeroPackageEntity(); |
|
|
|
|
reservationZeroPackageEntity.setRealityQuantity(i.getQuantity()); |
|
|
|
|
reservationZeroPackageEntity.setId(i.getId()); |
|
|
|
|
reservationZeroPackageService.updateById(reservationZeroPackageEntity); |
|
|
|
|
boolean b = reservationZeroPackageService.updateById(reservationZeroPackageEntity); |
|
|
|
|
if(!b){ |
|
|
|
|
return Resp.scanFail("修改失败!!","修改失败!!"); |
|
|
|
|
}else{ |
|
|
|
|
xiugai += 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
boolean b = distributionStockService.saveBatch(stockEntityList); |
|
|
|
|
if(b){ |
|
|
|
|
//修改备货状态
|
|
|
|
|
distributionAsyncService.stockZero(stockupDTO); |
|
|
|
|
return R.success("备货成功!"); |
|
|
|
|
if(!stockEntityList.isEmpty()){ |
|
|
|
|
boolean b = distributionStockService.saveBatch(stockEntityList); |
|
|
|
|
if(b){ |
|
|
|
|
//修改备货状态
|
|
|
|
|
distributionAsyncService.stockZero(stockupDTO); |
|
|
|
|
return Resp.scanSuccess("备货成功!","备货成功!"); |
|
|
|
|
}else{ |
|
|
|
|
//
|
|
|
|
|
return Resp.scanFail("修改失败!!","修改失败!!"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//
|
|
|
|
|
return R.fail(3004,"修改失败!!"); |
|
|
|
|
if(collect.size() == xiugai){ |
|
|
|
|
return Resp.scanSuccess("备货成功!","备货成功!"); |
|
|
|
|
} |
|
|
|
|
return Resp.scanFail("备货失败!","备货失败!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|