| | |
| | | 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; |
| | |
| | | BigDecimal totalQty = productOrder.getQuantity() == null ? BigDecimal.ZERO : productOrder.getQuantity(); |
| | | // 剩余可报工数量 |
| | | BigDecimal remainQty = totalQty.subtract(completeQty); |
| | | // 本次报工合格数量不能超过剩余数量(校验必须在累加前执行) |
| | | // 本次报工合格数量不能超过剩余数量 |
| | | if (qualifiedQty.compareTo(remainQty) > 0) { |
| | | throw new ServiceException("报工失败,本次报工数量不能大于剩余可报工数量,剩余报工数量:[" + remainQty + "]"); |
| | | } |
| | | // 本次报工不合格数量不能超过本次报工数量 |
| | | if (dto.getUnqualifiedQuantity() != null && dto.getUnqualifiedQuantity().compareTo(dto.getQuantity()) > 0) { |
| | | throw new ServiceException("报工失败,本次报工不合格数量不能大于报工数量,报工数量:[" + dto.getQuantity() + "]"); |
| | | } |
| | | // 历史已完成 + 本次合格数量 |
| | | BigDecimal newCompleteQty = completeQty.add(qualifiedQty); |
| | |
| | | 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()); |
| | |
| | | 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()); |