| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.excel.ExcelUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | |
| | | record.setSalesLedgerProcessRouteId(route.getId()); |
| | | Integer isCompleted = inputRecord != null && inputRecord.getIsCompleted() != null ? inputRecord.getIsCompleted() : 0; |
| | | record.setIsCompleted(isCompleted); |
| | | record.setCompletedTime(Objects.equals(isCompleted, 1) ? LocalDateTime.now() : null); |
| | | if (Objects.equals(isCompleted, 1)) { |
| | | record.setCompletedTime(inputRecord != null && inputRecord.getCompletedTime() != null ? inputRecord.getCompletedTime() : LocalDateTime.now()); |
| | | } else { |
| | | record.setCompletedTime(null); |
| | | } |
| | | routeRecordList.add(record); |
| | | } |
| | | salesLedgerProcessRouteRecordService.saveBatch(routeRecordList); |
| | |
| | | BigDecimal stockedQty = item.getStockedQuantity() == null ? BigDecimal.ZERO : item.getStockedQuantity(); |
| | | return orderQty.compareTo(BigDecimal.ZERO) <= 0 || stockedQty.compareTo(orderQty) >= 0; |
| | | }); |
| | | ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0)); |
| | | int newStockStatus = allStocked ? 2 : (hasStocked ? 1 : 0); |
| | | if (newStockStatus > 0 && ledger.getDeliveryDate() == null) { |
| | | ledger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | ledger.setStockStatus(newStockStatus); |
| | | baseMapper.updateById(ledger); |
| | | } |
| | | |
| | |
| | | return sq != null && sq.compareTo(BigDecimal.ZERO) > 0; |
| | | }); |
| | | boolean allLinesFull = ledgerAllProducts.stream().allMatch(p -> Objects.equals(p.getProductStockStatus(), 2)); |
| | | salesLedger.setStockStatus(allLinesFull ? 2 : (anyInbound ? 1 : 0)); |
| | | int newStockStatus = allLinesFull ? 2 : (anyInbound ? 1 : 0); |
| | | if (newStockStatus > 0 && salesLedger.getDeliveryDate() == null) { |
| | | salesLedger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | salesLedger.setStockStatus(newStockStatus); |
| | | baseMapper.updateById(salesLedger); |
| | | } |
| | | |
| | |
| | | sheetMap.put("工艺路线", sheetData); |
| | | } |
| | | |
| | | com.ruoyi.common.utils.excel.ExcelUtils.exportManySheet(response, "销售台账工艺路线导出", sheetMap); |
| | | ExcelUtils.exportManySheet(response, "销售台账工艺路线导出", sheetMap); |
| | | } catch (Exception e) { |
| | | log.error("导出售后台账工艺路线失败", e); |
| | | throw new ServiceException("导出售后台账工艺路线失败:" + e.getMessage()); |
| | |
| | | |
| | | private List<Object> buildProcessRouteRow(SalesLedger salesLedger, SalesLedgerProduct product, SalesLedgerProcessRouteRecord route) { |
| | | List<Object> row = new ArrayList<>(); |
| | | row.add(salesLedger.getEntryDate() == null ? "" : DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, salesLedger.getEntryDate())); |
| | | row.add(route.getCompletedTime() == null ? "" : route.getCompletedTime().format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | row.add(salesLedger.getSalesContractNo()); |
| | | row.add(salesLedger.getCustomerName()); |
| | | row.add(product == null ? "" : product.getSpecificationModel()); |