|
|
|
|
@ -57,6 +57,7 @@ public class LdOnePutStorageServiceImpl extends ServiceImpl<LdOnePutStorageMappe |
|
|
|
|
@Autowired |
|
|
|
|
ILdApproveService ldApproveService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PageInfo<LdOnePutStorage> getOnePutStorageList(Date startTime, Date endTime, String inOperator, Integer pageNum, Integer pageSize) { |
|
|
|
|
|
|
|
|
|
@ -111,6 +112,35 @@ public class LdOnePutStorageServiceImpl extends ServiceImpl<LdOnePutStorageMappe |
|
|
|
|
throw new CustomerException("入库ID有误"); |
|
|
|
|
} |
|
|
|
|
List<LdOnePutStorageDetail> ldOnePutStorageDetailList = onePutStorageDetailService.getByOnePutStorageId(ldOnePutStorage.getId()); |
|
|
|
|
ldOnePutStorageDetailList.forEach(item ->item.setYetInboundQuantity(new BigDecimal(0))); |
|
|
|
|
List<Long> idList = ldOnePutStorageDetailList.stream().map(LdOnePutStorageDetail::getLdPurchaseEndId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
//查询一级入库是否有该采购单
|
|
|
|
|
List<LdOnePutStoragePurchaseEnd> onePutStoragePurchaseEndList = onePutStoragePurchaseEndService.selectByPurchaseEndId(idList); |
|
|
|
|
if(!CollectionUtils.isEmpty(onePutStoragePurchaseEndList)){ |
|
|
|
|
//获取一级库ID
|
|
|
|
|
List<Long> onePutStorageIds = onePutStoragePurchaseEndList.stream() |
|
|
|
|
.map(LdOnePutStoragePurchaseEnd::getOnePutStorageId) |
|
|
|
|
.distinct() |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
//查询是否审核通过
|
|
|
|
|
List<LdOnePutStorage> ldOnePutStorageList = this.getApprove(onePutStorageIds); |
|
|
|
|
if(!CollectionUtils.isEmpty(ldOnePutStorageList)){ |
|
|
|
|
//通过的话需要汇总入库数量
|
|
|
|
|
List<Long> collect = ldOnePutStorageList.stream() |
|
|
|
|
.map(LdOnePutStorage::getId) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<LdOnePutStorageDetail> ldOnePutStorageDetailOldList = onePutStorageDetailService.getSummaryData(collect); |
|
|
|
|
for(LdOnePutStorageDetail detail : ldOnePutStorageDetailList){ |
|
|
|
|
for(LdOnePutStorageDetail oldDtail : ldOnePutStorageDetailOldList){ |
|
|
|
|
if(detail.getMaterialId() == oldDtail.getMaterialId() && detail.getMaterialCode().equals(oldDtail.getMaterialCode())){ |
|
|
|
|
detail.setYetInboundQuantity(oldDtail.getInboundQuantity()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<LdApprove> approveList = ldApproveService.getByFromId(onePutStorageId,BatchConstant.PUT_STORAGE_TYPE); |
|
|
|
|
|
|
|
|
|
@ -220,7 +250,7 @@ public class LdOnePutStorageServiceImpl extends ServiceImpl<LdOnePutStorageMappe |
|
|
|
|
throw new CustomerException("获取入库单ID失败"); |
|
|
|
|
} |
|
|
|
|
// 设置审批人
|
|
|
|
|
setApproverInfo(dto, dto.getUserInfoVO()); |
|
|
|
|
// setApproverInfo(dto, dto.getUserInfoVO());
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -441,7 +471,9 @@ public class LdOnePutStorageServiceImpl extends ServiceImpl<LdOnePutStorageMappe |
|
|
|
|
private void updateDetails(LdOnePutStorageDto dto) { |
|
|
|
|
for (LdOnePutStorageDetailVO detailVO : dto.getLdOnePutStorageDetailVOList()) { |
|
|
|
|
if (detailVO.getId() != null) { |
|
|
|
|
updateExistingDetail(detailVO); |
|
|
|
|
detailVO.setInboundQuantity(detailVO.getTheInboundQuantity()); |
|
|
|
|
onePutStorageDetailService.updateById(detailVO); |
|
|
|
|
//updateExistingDetail(detailVO);
|
|
|
|
|
} else { |
|
|
|
|
addNewDetail(detailVO, dto); |
|
|
|
|
} |
|
|
|
|
|