src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
@@ -48,9 +48,9 @@ @Override public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel()); deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { return AjaxResult.error("设备型号已存在"); return AjaxResult.error("设备名称已存在"); } boolean save = this.save(deviceLedger); if (save){ src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java
@@ -1,5 +1,6 @@ package com.ruoyi.production.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.poi.ExcelUtil; @@ -53,7 +54,7 @@ @Log(title = "生产管理-生产派工-损耗率", businessType = BusinessType.OTHER) @ApiOperation("生产管理-生产派工-损耗率") public AjaxResult loss() { return AjaxResult.success(lossMapper.selectList(null)); return AjaxResult.success(lossMapper.selectOne(new LambdaQueryWrapper<Loss>().last("limit 1"))); } @PostMapping("/addLoss") src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
@@ -29,11 +29,24 @@ IPage<SalesLedgerProductionAccountingDto> list = salesLedgerProductionAccountingMapper.listPage(page, salesLedgerProductionAccountingDto); list.getRecords().forEach(item -> { String[] split = item.getSpecificationModel().split("\\*"); if(split.length == 2){ if(split.length == 2 && isNumeric(split[1])){ // 计算工资 = 工时定额 * 数量 * 规格 item.setWages(item.getWages().multiply(new BigDecimal(split[1]))); } }); return list; } public static boolean isNumeric(String str) { if (str == null || str.isEmpty()) { return false; } // 遍历字符串的每个字符,检查是否为数字 for (int i = 0; i < str.length(); i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } } src/main/java/com/ruoyi/production/service/impl/SalesLedgerSchedulingServiceImpl.java
@@ -82,7 +82,7 @@ } // 计算生产总量 = 规格 * 数量 / 1000 String[] split = i.getSpecificationModel().split("\\*"); if(split.length == 2){ if(split.length == 2 && isNumeric(split[0]) && isNumeric(split[1])){ BigDecimal multiply = new BigDecimal(split[0]) .multiply(new BigDecimal(split[1]) .multiply(i.getQuantity()).divide(new BigDecimal(1000),2, RoundingMode.CEILING)); @@ -91,6 +91,19 @@ }); return list; } public static boolean isNumeric(String str) { if (str == null || str.isEmpty()) { return false; } // 遍历字符串的每个字符,检查是否为数字 for (int i = 0; i < str.length(); i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } @Override @@ -277,7 +290,7 @@ list.getRecords().forEach(i -> { // 计算生产总量 = 规格 * 数量 / 1000 String[] split = i.getSpecificationModel().split("\\*"); if(split.length == 2){ if(split.length == 2 && isNumeric(split[0]) && isNumeric(split[1])){ BigDecimal multiply = new BigDecimal(split[0]) .multiply(new BigDecimal(split[1]) .multiply(i.getSuccessNum()).divide(new BigDecimal(1000),2, RoundingMode.CEILING)); src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -206,7 +206,6 @@ List<Long> salesLedgerIds = iPage.getRecords().stream().map(SalesLedger::getId).collect(Collectors.toList()); List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds); if(CollectionUtils.isEmpty(invoiceLedgerDtoList)){ iPage.setTotal(iPage.getRecords().size()); return iPage; } // 计算回款金额,待回款金额 @@ -262,9 +261,10 @@ if (ObjectUtils.isNotEmpty(salesLedgerDto.getStatus())) { if (salesLedgerDto.getStatus()) { iPage.getRecords().removeIf(salesLedger -> Objects.equals(salesLedger.getNoInvoiceAmountTotal(), new BigDecimal("0.00"))); iPage.setTotal(iPage.getRecords().size()); } } iPage.setTotal(iPage.getTotal()); return iPage; } }