| | |
| | | } |
| | | } |
| | | } |
| | | //更新合同开票状态 |
| | | //更新合同开票状态 前提出库完成 |
| | | if (StrUtil.equals(contract.getBillingStatus(),"3")) { |
| | | contract.setBillingStatus("2"); |
| | | contract.setBillingAmout(contract.getBillingAmout().subtract(invoice.getInvoiceTotalPriceTax())); |
| | | contractMapper.updateById(contract); |
| | | |
| | | } |
| | | blueInvoice.setRedReversal("1"); |
| | | baseMapper.updateById(blueInvoice); |
| | | |
| | |
| | | @Override |
| | | public void refuseApproval(Long id) { |
| | | ContractInvoice invoice = baseMapper.selectById(id); |
| | | //更新合同出库单状态 |
| | | String[] outBoundIds = invoice.getOutBoundId().split(","); |
| | | Arrays.stream(outBoundIds).forEach(outBoundId -> { |
| | | ContractOutBound bound = contractOutBoundMapper.selectById(outBoundId); |
| | | bound.setInvoiceStatus("0"); |
| | | contractOutBoundMapper.updateById(bound); |
| | | }); |
| | | invoice.setApprovalStatus("2"); |
| | | baseMapper.updateById(invoice); |
| | | |
| | | //蓝票 |
| | | if (invoice.getInvoiceCategory().equals("1")) { |
| | | //更新合同出库单状态 |
| | | List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(invoice.getInvoicePreviewParam()),ContractOutBoundInvoiceVo.class); |
| | | if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())){ |
| | | outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> { |
| | | ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId()); |
| | | contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum())); |
| | | contractOutBoundMapper.updateById(contractOutBound); |
| | | }); |
| | | } |
| | | } |
| | | //红票 |
| | | if (invoice.getInvoiceCategory().equals("2")) { |
| | | ContractInvoice blueInvoice = baseMapper.selectById(invoice.getBlueInvoiceId()); |
| | | blueInvoice.setRedReversal("0"); |
| | | baseMapper.updateById(blueInvoice); |
| | | } |
| | | } |
| | | } |