| | |
| | | SalesLedger.class |
| | | ); |
| | | } |
| | | //如果是更新的话需要删除审批重新添加 |
| | | if (salesLedger.getId() != null) { |
| | | approveProcessService.deleteByRecordId(salesLedger.getId()); |
| | | } |
| | | //添加审批 |
| | | submitApprove(salesLedger, salesLedger.getSalesContractNo(), SecurityUtils.getLoginUser()); |
| | | |
| | | // 5. 迁移临时文件到正式目录 |
| | | if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) { |
| | |
| | | throw new BaseException("文件迁移失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private void submitApprove(SalesLedger salesLedger, String customerNo, LoginUser loginUser) { |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | approveProcessVO.setApproveType(10); |
| | | approveProcessVO.setRecordId(salesLedger.getId()); |
| | | approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId()); |
| | | approveProcessVO.setApproveReason(customerNo); |
| | | approveProcessVO.setApproveUser(loginUser.getUserId()); |
| | | approveProcessVO.setApproveTime(LocalDate.now().toString()); |
| | | try { |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException("审批失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 将临时文件迁移到正式目录 |
| | | * |
| | |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | //添加销售审批 审批成功之后添加生产数据 |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | approveProcessVO.setApproveType(9); |
| | | approveProcessVO.setApproveDeptId(SecurityUtils.getDeptId()[0]); |
| | | approveProcessVO.setApproveReason(contractNo); |
| | | approveProcessVO.setRecordId(salesLedgerProduct.getId()); |
| | | approveProcessVO.setApproveUser(SecurityUtils.getUserId()); |
| | | approveProcessVO.setApproveTime(LocalDate.now().toString()); |
| | | approveProcessVO.setApproveId(salesLedgerProduct.getId().toString()); |
| | | try { |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | }catch (Exception e) { |
| | | log.error("添加销售审批异常", e); |
| | | } |
| | | // 添加生产数据 |
| | | // salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); |
| | | } |