| | |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.mapper.OilDepotMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.mapper.SupplierManageMapper; |
| | | import com.ruoyi.basic.pojo.OilDepot; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | |
| | | private final StockInRecordService stockInRecordService; |
| | | private final StockUtils stockUtils; |
| | | private final ApprovalTemplateMapper approvalTemplateMapper; |
| | | private final OilDepotMapper oilDepotMapper; |
| | | |
| | | @Override |
| | | public List<PurchaseLedger> selectPurchaseLedgerList(PurchaseLedger purchaseLedger) { |
| | |
| | | purchaseLedger.setSalesLedgerId(ObjectUtils.isNotEmpty(salesLedger) ? salesLedger.getId() : -1); |
| | | purchaseLedger.setSupplierName(supplierManage.getSupplierName()); |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | |
| | | // 采购油库:根据油库id回填油库名称 |
| | | if (purchaseLedgerDto.getOilDepotId() != null) { |
| | | OilDepot oilDepot = oilDepotMapper.selectById(purchaseLedgerDto.getOilDepotId()); |
| | | if (oilDepot != null) { |
| | | purchaseLedger.setOilDepotName(oilDepot.getDepotName()); |
| | | } |
| | | } |
| | | |
| | | purchaseLedger.setApprovalStatus(1); |
| | | // 实际合同金额始终等于合同金额 |
| | |
| | | if (snapshot.getProjectName() == null) { |
| | | snapshot.setProjectName(purchaseLedger.getProjectName()); |
| | | } |
| | | if (snapshot.getEntryDate() == null) { |
| | | // 录入时间以采购台账为准,避免审批快照里的录入日期与台账对不上 |
| | | if (purchaseLedger.getEntryDate() != null |
| | | && (snapshot.getEntryDate() == null |
| | | || !DateUtils.toLocalDate(snapshot.getEntryDate()) |
| | | .equals(DateUtils.toLocalDate(purchaseLedger.getEntryDate())))) { |
| | | snapshot.setEntryDate(purchaseLedger.getEntryDate()); |
| | | } |
| | | if (snapshot.getExecutionDate() == null) { |
| | |
| | | if (snapshot.getRemarks() == null) { |
| | | snapshot.setRemarks(purchaseLedger.getRemarks()); |
| | | } |
| | | // 提交审批时若尚未填写合同金额,快照里会是0,这里用台账里的当前金额兜底 |
| | | if (snapshot.getContractAmount() == null || snapshot.getContractAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | snapshot.setContractAmount(purchaseLedger.getContractAmount()); |
| | | } |
| | | if (snapshot.getNetContractAmount() == null || snapshot.getNetContractAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | snapshot.setNetContractAmount(purchaseLedger.getNetContractAmount()); |
| | | } |
| | | if (snapshot.getRecorderId() == null) { |
| | | snapshot.setRecorderId(purchaseLedger.getRecorderId()); |
| | | } |