Browse Source

fix: 修复错误的分配金额及数据

master
Yen 2 months ago
parent
commit
896f655edd
  1. 4
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetApplicationService.java
  2. 37
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/third/service/PortalOfCost2Application.java
  3. 4
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java

4
cms-modules/cms-system/src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetApplicationService.java

@ -684,7 +684,9 @@ public class TbsBudgetApplicationService {
//无匹配的预算 //无匹配的预算
if(!isMatch){ if(!isMatch){
if (throwEx){ if (throwEx){
Assert.throwEx("匹配品类时预算不足["+ activityCostItem.getTargetCode()+"]"); Assert.throwEx("匹配品类时预算不足["+ activityCostItem.getTargetCode()
+"],成本中心:"+activityCostItem.getCenterName()
+",科目:"+activityCostItem.getSubjectName());
} }
log.warn("[{}]{} 预算不足,成本中心:{},科目:{}",activityCostItem.getTargetCode() log.warn("[{}]{} 预算不足,成本中心:{},科目:{}",activityCostItem.getTargetCode()
,activityCostItem.getTargetName(),activityCostItem.getCenterName(),activityCostItem.getSubjectName()); ,activityCostItem.getTargetName(),activityCostItem.getCenterName(),activityCostItem.getSubjectName());

37
cms-modules/cms-system/src/main/java/com/qs/serve/modules/third/service/PortalOfCost2Application.java

@ -342,7 +342,11 @@ public class PortalOfCost2Application {
} }
@NotNull @NotNull
private List<TbsActivityCenterGoods> getTbsActivityCenterGoods(BmsSupplier supplier, BmsSubject subject, BigDecimal OneHundred, List<ProcessGoodsItem> processGoodsItems, String costCode, LocalDate nowDate, LocalDate startDate, LocalDate endDate, Long supplierId, BigDecimal totalAmount, TbsActivity activity, List<TbsActivityCenter> activityCenterList, List<TbsActivityGoods> activityGoodsList) { private List<TbsActivityCenterGoods> getTbsActivityCenterGoods(BmsSupplier supplier, BmsSubject subject, BigDecimal OneHundred,
List<ProcessGoodsItem> processGoodsItems, String costCode, LocalDate nowDate,
LocalDate startDate, LocalDate endDate, Long supplierId, BigDecimal totalAmount,
TbsActivity activity, List<TbsActivityCenter> activityCenterList,
List<TbsActivityGoods> activityGoodsList) {
List<TbsActivityCenterGoods> activityCenterGoodsList = new ArrayList<>(); List<TbsActivityCenterGoods> activityCenterGoodsList = new ArrayList<>();
for (TbsActivityCenter activityCenter : activityCenterList) { for (TbsActivityCenter activityCenter : activityCenterList) {
@ -384,29 +388,16 @@ public class PortalOfCost2Application {
centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds()); centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds());
centerGoods.setTargetLevelPathNames(activityGoods.getTargetLevelPathNames()); centerGoods.setTargetLevelPathNames(activityGoods.getTargetLevelPathNames());
// 分配金额 // 分配金额
if (costCode.contains("YX06")){ if(i+1== activityGoodsList.size()){
if(i+1== activityGoodsList.size()){ centerGoods.setCenterGoodsAmount(yx06Surplus);
centerGoods.setCenterGoodsAmount(yx06Surplus); centerGoods.setCenterGoodsRate(yx06SurplusRate);
centerGoods.setCenterGoodsRate(yx06SurplusRate); centerGoods.setUsedAmount(yx06Surplus);
centerGoods.setUsedAmount(yx06Surplus);
}else {
yx06SurplusRate = yx06SurplusRate.subtract(yx06Rate);
yx06Surplus = yx06Surplus.subtract(yx06ItemAmt);
centerGoods.setCenterGoodsAmount(yx06ItemAmt);
centerGoods.setCenterGoodsRate(yx06Rate);
centerGoods.setUsedAmount(yx06ItemAmt);
}
}else { }else {
BigDecimal totalSkuAmt = BigDecimal.ZERO; yx06SurplusRate = yx06SurplusRate.subtract(yx06Rate);
for (ProcessGoodsItem goodsItem : processGoodsItems) { yx06Surplus = yx06Surplus.subtract(yx06ItemAmt);
if(goodsItem.getInventoryCode().equals(activityGoods.getTargetCode())){ centerGoods.setCenterGoodsAmount(yx06ItemAmt);
totalSkuAmt = totalSkuAmt.add(goodsItem.getAmount()); centerGoods.setCenterGoodsRate(yx06Rate);
} centerGoods.setUsedAmount(yx06ItemAmt);
}
BigDecimal rate = totalSkuAmt.divide(totalAmount, RoundingMode.UP);
centerGoods.setCenterGoodsAmount(totalSkuAmt);
centerGoods.setCenterGoodsRate(rate);
centerGoods.setUsedAmount(totalSkuAmt);
} }
activityCenterGoodsList.add(centerGoods); activityCenterGoodsList.add(centerGoods);
} }

4
cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java

@ -914,7 +914,9 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe
BigDecimal totalDispatchAmt = BigDecimal.ZERO; BigDecimal totalDispatchAmt = BigDecimal.ZERO;
for (VtbVerificationSubject verificationSubject : verificationSubjects) { for (VtbVerificationSubject verificationSubject : verificationSubjects) {
totalAmount = totalAmount.add(verificationSubject.getUsedAmount()); totalAmount = totalAmount.add(verificationSubject.getUsedAmount());
totalDispatchAmt = totalDispatchAmt.add(verificationSubject.getFinalDispatchAmt()); if(verificationSubject.getFinalDispatchAmt()!=null){
totalDispatchAmt = totalDispatchAmt.add(verificationSubject.getFinalDispatchAmt());
}
} }
ErpDispatchSumPmsVo dispatchSumPmsVo = activityService.getDispatchSumByActivity(activity); ErpDispatchSumPmsVo dispatchSumPmsVo = activityService.getDispatchSumByActivity(activity);
verification.setAutoDispatchAmt(dispatchSumPmsVo.getTotalAmount()); verification.setAutoDispatchAmt(dispatchSumPmsVo.getTotalAmount());

Loading…
Cancel
Save