| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.config.RuoYiConfig; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.dto.*; |
| | |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Autowired |
| | | private RuoYiConfig ruoYiConfig; |
| | | |
| | | @Autowired |
| | | private ProductionProductMainService productionProductMainService; |
| | |
| | | throw new ServiceException("报工失败,生产订单不存在"); |
| | | } |
| | | |
| | | // 当前报工合格数量(前端已保证 = 投入数量 - 不合格数量,直接使用) |
| | | // 当前报工合格数量 |
| | | BigDecimal qualifiedQty = dto.getQualifiedQuantity() == null ? BigDecimal.ZERO : dto.getQualifiedQuantity(); |
| | | BigDecimal unqualifiedQty = dto.getUnqualifiedQuantity() == null ? BigDecimal.ZERO : dto.getUnqualifiedQuantity(); |
| | | BigDecimal totalReportQty = dto.getQuantity() == null ? BigDecimal.ZERO : dto.getQuantity(); |
| | | |
| | | if (qualifiedQty.compareTo(BigDecimal.ZERO) < 0 || unqualifiedQty.compareTo(BigDecimal.ZERO) < 0 || totalReportQty.compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("报工失败:合格数量、不合格数量或总数量不能为负数"); |
| | | } |
| | | |
| | | if (qualifiedQty.add(unqualifiedQty).compareTo(totalReportQty) != 0) { |
| | | throw new ServiceException("报工失败:合格数量与不合格数量之和必须等于总报工数量"); |
| | | } |
| | | // 订单已完成数量(历史累计) |
| | | BigDecimal completeQty = productOrder.getCompleteQuantity() == null ? BigDecimal.ZERO : productOrder.getCompleteQuantity(); |
| | | // 需求数量 |
| | |
| | | paramEntity.setValueMode(orderParam.getValueMode()); |
| | | paramEntity.setUnit(orderParam.getUnit()); |
| | | paramEntity.setStandardValue(orderParam.getStandardValue()); |
| | | paramEntity.setMinValue(orderParam.getMinValue()); |
| | | paramEntity.setMaxValue(orderParam.getMaxValue()); |
| | | } |
| | | } |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | |
| | | fileEntity.setProductionProductRouteItemId(productRouteItemEntity.getId()); |
| | | fileEntity.setFileName(originalFilename); |
| | | fileEntity.setFileUrl(formalFilePath.toString()); |
| | | Path basePath = Paths.get(RuoYiConfig.getProfile()); |
| | | String relativePath = basePath.relativize(formalFilePath).toString(); |
| | | relativePath = relativePath.replace("\\", "/"); |
| | | String url = "/profile/" + relativePath; |
| | | fileEntity.setUrl(url); |
| | | fileEntity.setFileSuffix(fileExtension); |
| | | fileEntity.setFileSize(Files.size(formalFilePath)); |
| | | fileEntity.setCreateTime(LocalDateTime.now()); |
| | |
| | | paramEntity.setParamFormat(orderParam.getParamFormat()); |
| | | paramEntity.setValueMode(orderParam.getValueMode()); |
| | | paramEntity.setUnit(orderParam.getUnit()); |
| | | paramEntity.setStandardValue(orderParam.getStandardValue()); |
| | | paramEntity.setMinValue(orderParam.getMinValue()); |
| | | paramEntity.setMaxValue(orderParam.getMaxValue()); |
| | | } |
| | | } |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | |
| | | fileEntity.setProductionProductRouteItemId(routeItemId); |
| | | fileEntity.setFileName(originalFilename); |
| | | fileEntity.setFileUrl(formalFilePath.toString()); |
| | | Path basePath = Paths.get(RuoYiConfig.getProfile()); |
| | | String relativePath = basePath.relativize(formalFilePath).toString(); |
| | | relativePath = relativePath.replace("\\", "/"); |
| | | String url = "/profile/" + relativePath; |
| | | |
| | | fileEntity.setUrl(url); |
| | | fileEntity.setFileSuffix(fileExtension); |
| | | fileEntity.setFileSize(Files.size(formalFilePath)); |
| | | fileEntity.setCreateTime(LocalDateTime.now()); |