|
@@ -778,8 +778,18 @@ public class SettlementManagementServiceImpl extends ServiceImpl<SettlementBasic
|
|
//校验验收单货物
|
|
//校验验收单货物
|
|
List<Long> acceptanceBasicInfoIds = settlementGoodsInfos.stream().map(SettlementGoodsInfo::getcAcceptanceBasicInfoId)
|
|
List<Long> acceptanceBasicInfoIds = settlementGoodsInfos.stream().map(SettlementGoodsInfo::getcAcceptanceBasicInfoId)
|
|
.distinct().collect(Collectors.toList());
|
|
.distinct().collect(Collectors.toList());
|
|
|
|
+// //结算货物按验收单编号分组
|
|
|
|
+ LinkedHashMap<Long, List<SettlementGoodsInfo>> acceptanceGoodsNumbers = settlementGoodsInfos.stream()
|
|
|
|
+ .collect(Collectors.groupingBy((b) -> b.getcAcceptanceBasicInfoId(), LinkedHashMap::new, Collectors.toList()));
|
|
acceptanceBasicInfoIds.forEach(id -> {
|
|
acceptanceBasicInfoIds.forEach(id -> {
|
|
CAcceptanceBasicInfo basicInfo = icAcceptanceBasicInfoService.getById(id);
|
|
CAcceptanceBasicInfo basicInfo = icAcceptanceBasicInfoService.getById(id);
|
|
|
|
+ List<CAcceptanceGoodsInfo> cAcceptanceGoodsInfos = icAcceptanceGoodsInfoService.list(new QueryWrapper<CAcceptanceGoodsInfo>().eq("c_acceptance_basic_info_id", id));
|
|
|
|
+ if(CollectionUtil.isNotEmpty(cAcceptanceGoodsInfos)){
|
|
|
|
+ List<SettlementGoodsInfo> settlementGoodsInfos1 = acceptanceGoodsNumbers.get(id);
|
|
|
|
+ if(CollectionUtil.isNotEmpty(settlementGoodsInfos1) && settlementGoodsInfos1.size() != cAcceptanceGoodsInfos.size()){
|
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "验收单编号:"+basicInfo.getAcceptanceNumber()+"存在货物未选中结算,请新选择结算货物");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (basicInfo.getSettlement()) {
|
|
if (basicInfo.getSettlement()) {
|
|
throw new BusinessException(CodeUtil.FAIL, "存在已结算或者正在结算的货物");
|
|
throw new BusinessException(CodeUtil.FAIL, "存在已结算或者正在结算的货物");
|
|
} else {
|
|
} else {
|
|
@@ -1061,8 +1071,18 @@ public class SettlementManagementServiceImpl extends ServiceImpl<SettlementBasic
|
|
//校验验收单货物
|
|
//校验验收单货物
|
|
List<Long> acceptanceBasicInfoIds = settlementGoodsInfos.stream().map(SettlementGoodsInfo::getcAcceptanceBasicInfoId)
|
|
List<Long> acceptanceBasicInfoIds = settlementGoodsInfos.stream().map(SettlementGoodsInfo::getcAcceptanceBasicInfoId)
|
|
.distinct().collect(Collectors.toList());
|
|
.distinct().collect(Collectors.toList());
|
|
|
|
+ // //结算货物按验收单编号分组
|
|
|
|
+ LinkedHashMap<Long, List<SettlementGoodsInfo>> acceptanceGoodsNumbers = settlementGoodsInfos.stream()
|
|
|
|
+ .collect(Collectors.groupingBy((b) -> b.getcAcceptanceBasicInfoId(), LinkedHashMap::new, Collectors.toList()));
|
|
acceptanceBasicInfoIds.forEach(id -> {
|
|
acceptanceBasicInfoIds.forEach(id -> {
|
|
CAcceptanceBasicInfo basicInfo = icAcceptanceBasicInfoService.getById(id);
|
|
CAcceptanceBasicInfo basicInfo = icAcceptanceBasicInfoService.getById(id);
|
|
|
|
+ List<CAcceptanceGoodsInfo> cAcceptanceGoodsInfos = icAcceptanceGoodsInfoService.list(new QueryWrapper<CAcceptanceGoodsInfo>().eq("c_acceptance_basic_info_id", id));
|
|
|
|
+ if(CollectionUtil.isNotEmpty(cAcceptanceGoodsInfos)){
|
|
|
|
+ List<SettlementGoodsInfo> settlementGoodsInfos1 = acceptanceGoodsNumbers.get(id);
|
|
|
|
+ if(CollectionUtil.isNotEmpty(settlementGoodsInfos1) && settlementGoodsInfos1.size() != cAcceptanceGoodsInfos.size()){
|
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "验收单编号:"+basicInfo.getAcceptanceNumber()+"存在货物未选中结算,请新选择结算货物");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (basicInfo.getSettlement()) {
|
|
if (basicInfo.getSettlement()) {
|
|
throw new BusinessException(CodeUtil.FAIL, "存在已结算或者正在结算的货物");
|
|
throw new BusinessException(CodeUtil.FAIL, "存在已结算或者正在结算的货物");
|
|
} else {
|
|
} else {
|