|
@@ -180,9 +180,10 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
|
String taskId = jsonObject.getString("taskId");
|
|
|
expenseInfo.setTaskId(taskId);
|
|
|
}
|
|
|
- //费用分配列表
|
|
|
- List<ExpenseAllocationInfo> expenseAllocationInfos = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
|
|
|
- .eq("info_id", id));
|
|
|
+ //费用分配列表 查看不显示已驳回的数据
|
|
|
+ List<ExpenseAllocationInfo> expenseAllocationInfos=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
|
|
|
+ .eq("info_id",id)
|
|
|
+ .ne("status","已驳回"));
|
|
|
if (!CollectionUtils.isEmpty(expenseAllocationInfos)) {
|
|
|
expenseInfo.setExpenseAllocationInfoList(expenseAllocationInfos);
|
|
|
}
|
|
@@ -252,10 +253,10 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
|
{
|
|
|
expenseInfo.setStatusFlag(StatusEnum.COST_PAYMENT.getFlag());
|
|
|
expenseInfo.setStatus(StatusEnum.COST_PAYMENT.getName());
|
|
|
- //合同粮款没有未分配金额
|
|
|
- if(!"1".equals(expenseInfo.getCostType())&&!!"1".equals(expenseInfo.getExpensesPurpose())) {
|
|
|
- expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney() - expenseInfo.getTotalDistribution());
|
|
|
- }
|
|
|
+// //合同粮款没有未分配金额
|
|
|
+// if(!"1".equals(expenseInfo.getCostType())&&!!"1".equals(expenseInfo.getExpensesPurpose())) {
|
|
|
+// expenseInfo.setUnallocatedAmount(expenseInfo.getAmountMoney() - expenseInfo.getTotalDistribution());
|
|
|
+// }
|
|
|
this.insert(expenseInfo);
|
|
|
//分配列表
|
|
|
List<ExpenseAllocationInfo> expenseAllocationInfoList = expenseInfo.getExpenseAllocationInfoList();
|
|
@@ -381,14 +382,20 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
|
else if ("2".equals(expenseInfo.getFlag())){
|
|
|
expenseInfo.setDistributionStatusFlag("");
|
|
|
expenseInfo.setDistributionStatus("");
|
|
|
+ //本次分配总金额
|
|
|
+ double totalDistribution=0d;
|
|
|
List<ExpenseAllocationInfo> expenseAllocationInfos=expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
|
|
|
.eq("info_id",expenseInfo.getId())
|
|
|
.eq("status","待确认"));
|
|
|
if (!CollectionUtils.isEmpty(expenseAllocationInfos)){
|
|
|
+ totalDistribution = (expenseAllocationInfos.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum());
|
|
|
for (ExpenseAllocationInfo expenseAllocationInfo:expenseAllocationInfos){
|
|
|
expenseAllocationInfo.setStatusFlag(StatusEnum.COST_ADOPTED.getFlag());
|
|
|
expenseAllocationInfo.setStatus(StatusEnum.COST_ADOPTED.getName());
|
|
|
expenseAllocationInfoService.updateById(expenseAllocationInfo);
|
|
|
+ WarehousingOrder warehousingOrder=warehousingOrderService.selectById(expenseAllocationInfo.getOrderId());
|
|
|
+ //确认分配时影响入库单成本
|
|
|
+ warehousingOrder.setAvgCost((warehousingOrder.getAvgCost()*warehousingOrder.getInWarehouseWeight()+expenseAllocationInfo.getDistributionMoney())/warehousingOrder.getInWarehouseWeight());
|
|
|
//库点费用
|
|
|
if ("3".equals(expenseInfo1.getExpensesPurpose())) {
|
|
|
ContractExpensesInfo contractExpensesInfo = new ContractExpensesInfo();
|
|
@@ -405,9 +412,6 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
|
} else {
|
|
|
contractExpensesInfo.setGrainType(expenseInfo1.getCostType());
|
|
|
}
|
|
|
- WarehousingOrder warehousingOrder=warehousingOrderService.selectById(expenseAllocationInfo.getOrderId());
|
|
|
- //确认分配时影响入库单成本
|
|
|
- warehousingOrder.setAvgCost((warehousingOrder.getAvgCost()*warehousingOrder.getInWarehouseWeight()+expenseAllocationInfo.getDistributionMoney())/warehousingOrder.getInWarehouseWeight());
|
|
|
if (warehousingOrder!=null&&"采购入库".equals(warehousingOrder.getInType())){
|
|
|
ContractManagementInfo contractManagementInfo=contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
.eq("contract_no",warehousingOrder.getContractNo())
|
|
@@ -429,11 +433,13 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
|
|
|
contractExpensesInfo.setCostType("3");
|
|
|
}
|
|
|
}
|
|
|
- warehousingOrderService.updateById(warehousingOrder);
|
|
|
contractExpensesInfoService.insert(contractExpensesInfo);
|
|
|
}
|
|
|
+ warehousingOrderService.updateById(warehousingOrder);
|
|
|
|
|
|
}
|
|
|
+ //未分配金额=未分配-本次确认分配总金额
|
|
|
+ expenseInfo.setUnallocatedAmount(expenseInfo1.getUnallocatedAmount() - totalDistribution);
|
|
|
}
|
|
|
}
|
|
|
//编辑分配
|