| | |
| | | import com.ruoyi.production.bean.vo.ProductionOrderVo; |
| | | import com.ruoyi.production.bean.vo.ProductionPlanVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderWorkOrderDetailVo; |
| | | import com.ruoyi.production.bean.vo.ProcessRouteStatusVo; |
| | | import com.ruoyi.production.bean.vo.ProductionOrderProcessTaskVo; |
| | | import com.ruoyi.production.enums.ProductOrderStatusEnum; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | |
| | | // 分页查询生产订单 |
| | | Page<ProductionOrderVo> result = (Page<ProductionOrderVo>) baseMapper.pageProductionOrder(page, dto); |
| | | fillProductImages(result.getRecords()); |
| | | fillProcessRouteStatus(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | |
| | | // 查询生产订单列表 |
| | | List<ProductionOrderVo> records = baseMapper.listProductionOrder(dto); |
| | | fillProductImages(records); |
| | | fillProcessRouteStatus(records); |
| | | return records; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void fillProcessRouteStatus(List<ProductionOrderVo> records) { |
| | | if (records == null || records.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> orderIds = records.stream() |
| | | .map(ProductionOrderVo::getId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (orderIds.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | List<ProductionOrderProcessTaskVo> tasks = productionOperationTaskMapper.listProcessStatusByOrderIds(orderIds); |
| | | Map<Long, List<ProcessRouteStatusVo>> statusMap = new LinkedHashMap<>(); |
| | | if (tasks != null) { |
| | | for (ProductionOrderProcessTaskVo task : tasks) { |
| | | if (task == null || task.getProductionOrderId() == null) { |
| | | continue; |
| | | } |
| | | ProcessRouteStatusVo status = new ProcessRouteStatusVo(); |
| | | status.setName(task.getOperationName() != null && !task.getOperationName().isBlank() |
| | | ? task.getOperationName() |
| | | : "未知工序"); |
| | | BigDecimal percentage = task.getCompletionStatus() == null |
| | | ? BigDecimal.ZERO |
| | | : task.getCompletionStatus(); |
| | | if (percentage.compareTo(new BigDecimal("100")) > 0) { |
| | | percentage = new BigDecimal("100"); |
| | | } |
| | | status.setPercentage(percentage); |
| | | statusMap.computeIfAbsent(task.getProductionOrderId(), key -> new ArrayList<>()).add(status); |
| | | } |
| | | } |
| | | |
| | | for (ProductionOrderVo record : records) { |
| | | record.setProcessRouteStatus(statusMap.getOrDefault(record.getId(), Collections.emptyList())); |
| | | } |
| | | } |
| | | |
| | | private StorageBlobVO toStorageBlobVO(StorageBlob blob) { |
| | | // 将存储文件对象转换为VO |
| | | StorageBlobVO vo = BeanUtil.copyProperties(blob, StorageBlobVO.class); |