From 56b73ce57147653cfbcfe87a7c28e9792dbb2f72 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 29 四月 2026 15:07:33 +0800
Subject: [PATCH] feat: 流转卡二维码返回工单绑定的工艺工序

---
 src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 2b069af..d6c5a0d 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -18,7 +18,9 @@
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
 import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.production.dto.ProductionProductMainDetailExportDto;
 import com.ruoyi.production.dto.ProductionProductMainDto;
+import com.ruoyi.production.dto.ProductionProductMainSummaryExportDto;
 import com.ruoyi.production.dto.ProductionReportDailySummaryDto;
 import com.ruoyi.production.dto.ProductionReportStateDto;
 import com.ruoyi.production.enums.ProductProcessEnum;
@@ -101,6 +103,58 @@
         IPage<ProductionProductMainDto> result = productionProductMainMapper.listPageProductionProductMainDetailDto(page, productionProductMainDto);
         fillHourDefaults(result.getRecords());
         return result;
+    }
+
+    @Override
+    public List<ProductionProductMainSummaryExportDto> listSummaryExportData(ProductionProductMainDto productionProductMainDto) {
+        return listPageProductionProductMainDto(new Page<>(1, -1), productionProductMainDto)
+                .getRecords()
+                .stream()
+                .map(item -> {
+                    ProductionProductMainSummaryExportDto exportDto = new ProductionProductMainSummaryExportDto();
+                    exportDto.setProcess(item.getProcess());
+                    exportDto.setWorkOrderNo(item.getWorkOrderNo());
+                    exportDto.setSalesContractNo(item.getSalesContractNo());
+                    exportDto.setProductOrderNpsNo(item.getProductOrderNpsNo());
+                    exportDto.setProductName(item.getProductName());
+                    exportDto.setProductModelName(item.getProductModelName());
+                    exportDto.setUnit(item.getUnit());
+                    exportDto.setProjectTotalHours(item.getProjectTotalHours());
+                    exportDto.setProcessStandardHours(item.getProcessStandardHours());
+                    exportDto.setActualReportHours(item.getActualReportHours());
+                    exportDto.setDailyPersonHours(item.getDailyPersonHours());
+                    exportDto.setOutputTotalQuantity(item.getOutputTotalQuantity());
+                    exportDto.setScrapTotalQuantity(item.getScrapTotalQuantity());
+                    return exportDto;
+                })
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public List<ProductionProductMainDetailExportDto> listDetailExportData(ProductionProductMainDto productionProductMainDto) {
+        return listPageProductionProductMainDetailDto(new Page<>(1, -1), productionProductMainDto)
+                .getRecords()
+                .stream()
+                .map(item -> {
+                    ProductionProductMainDetailExportDto exportDto = new ProductionProductMainDetailExportDto();
+                    exportDto.setProductNo(item.getProductNo());
+                    exportDto.setNickName(item.getNickName());
+                    exportDto.setProcess(item.getProcess());
+                    exportDto.setWorkOrderNo(item.getWorkOrderNo());
+                    exportDto.setSalesContractNo(item.getSalesContractNo());
+                    exportDto.setProductOrderNpsNo(item.getProductOrderNpsNo());
+                    exportDto.setProductName(item.getProductName());
+                    exportDto.setProductModelName(item.getProductModelName());
+                    exportDto.setQuantity(item.getQuantity());
+                    exportDto.setScrapQty(item.getScrapQty());
+                    exportDto.setUnit(item.getUnit());
+                    exportDto.setProcessStandardHours(item.getProcessStandardHours());
+                    exportDto.setActualReportHours(item.getActualReportHours());
+                    exportDto.setDailyPersonHours(item.getDailyPersonHours());
+                    exportDto.setCreateTime(item.getCreateTime());
+                    return exportDto;
+                })
+                .collect(Collectors.toList());
     }
 
     private void fillHourDefaults(List<ProductionProductMainDto> records) {
@@ -189,8 +243,19 @@
 
     @Override
     public ProductionReportStateDto reportState(Long workOrderId, Long productProcessRouteItemId) {
-        ProductionProductMain running = getRunning(workOrderId, productProcessRouteItemId);
         ProductionReportStateDto dto = new ProductionReportStateDto();
+        ProductWorkOrder workOrder = productWorkOrderMapper.selectById(workOrderId);
+        if (workOrder != null) {
+            BigDecimal planQty = workOrder.getPlanQuantity() == null ? BigDecimal.ZERO : workOrder.getPlanQuantity();
+            BigDecimal completeQty = workOrder.getCompleteQuantity() == null ? BigDecimal.ZERO : workOrder.getCompleteQuantity();
+            //  鐢熶骇鎶ュ伐鏁伴噺宸插畬鎴�
+            if (planQty.compareTo(BigDecimal.ZERO) > 0 && completeQty.compareTo(planQty) >= 0) {
+                dto.setState(3);
+                return dto;
+            }
+        }
+
+        ProductionProductMain running = getRunning(workOrderId, productProcessRouteItemId);
         if (running == null) {
             dto.setState(1);
             return dto;

--
Gitblit v1.9.3