廖井涛
2025-11-25 f68809ce9f7755daaafe9e451c80e91859cc5313
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -5,6 +5,7 @@
import com.alibaba.fastjson.TypeReference;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.common.AsyncQueryExecutor;
import com.example.erp.entity.sd.*;
import com.example.erp.tools.AreaComputed.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,10 +13,6 @@
import com.example.erp.dto.pp.*;
import com.example.erp.entity.pp.DamageDetails;
import com.example.erp.entity.pp.Report;
import com.example.erp.entity.sd.BasicData;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.entity.sd.OrderGlassDetail;
import com.example.erp.entity.sd.ProductDetail;
import com.example.erp.mapper.pp.*;
import com.example.erp.mapper.sd.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +50,7 @@
    FlowCardMapper flowCardMapper;
    private ReportingWorkMapper reportingWorkMapper;
    private final OrderMapper orderMapper;
    @Resource
    private AsyncQueryExecutor asyncExecutor;
@@ -82,7 +80,10 @@
                              .eq("prod_id", orderDetail.getProductId())
                              .eq("glass_sort",dto1.getTechnologyNumber())
                      );
              dto1.setGlassName(productDetail.getDetail());
              if(productDetail!=null){
                  dto1.setGlassName(productDetail.getDetail());
              }
            //basicData.getNickname().equals("stepC")
          }else if(basicData.getNickname().equals("stepC")){
              OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
@@ -133,7 +134,7 @@
                         ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper,
                         OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper,
                         ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper,
                         ReportingWorkMapper reportingWorkMapper, DamageDetailsMapper damageDetailsMapper) {
                         ReportingWorkMapper reportingWorkMapper, DamageDetailsMapper damageDetailsMapper, OrderMapper orderMapper) {
        this.reportMapper = reportMapper;
        this.orderProcessDetailMapper = orderProcessDetailMapper;
        this.productionSchedulingMapper = productionSchedulingMapper;
@@ -144,6 +145,7 @@
        this.orderDetailMapper = orderDetailMapper;
        this.reportingWorkMapper = reportingWorkMapper;
        this.damageDetailsMapper = damageDetailsMapper;
        this.orderMapper = orderMapper;
    }
    //流程卡进度方法
@@ -300,8 +302,6 @@
            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
        }
        map.put("data",dataList );
@@ -485,13 +485,14 @@
    public Map<String, Object> workInProgressSv(
            Integer pageNum, Integer pageSize,
            String orderId, String inputProject, String selectProcesses,
            String optionVal, WorkInProgressDTO workInProgressDTO) {
            String optionVal,String terminationVals, WorkInProgressDTO workInProgressDTO) {
        Integer offset = (pageNum - 1) * pageSize;
        if ("null".equals(orderId)) orderId = "";
        if ("null".equals(inputProject)) inputProject = "";
        if ("null".equals(optionVal)) optionVal = "";
        if ("null".equals(terminationVals)) terminationVals = "";
        if ("all".equals(selectProcesses)) selectProcesses = "";
        String laminating = reportMapper.getLaminating(selectProcesses);
@@ -502,6 +503,7 @@
            String finalOrderId = orderId;
            String finalInputProject = inputProject;
            String finalSelectProcesses = selectProcesses;
            String finalTerminationVals = terminationVals;
            CompletableFuture<List<WorkInProgressDTO>> dataList2Future =
                    asyncExecutor.runAsync(() ->
                            reportMapper.workInProgressMpdataList2(
@@ -519,7 +521,7 @@
                totalFuture = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressOrderFootSum(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
            } else if ("2".equals(optionVal)) {
                // 流程卡号汇总
@@ -529,25 +531,25 @@
                totalFuture = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressOrderFootSum(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
            } else if ("3".equals(optionVal)) {
                dataList1Future = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressMpdataList1(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
                totalFuture = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressOrderFootSum(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
            } else {
                // 不分组
                dataList1Future = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressMpdataList1(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, laminating,finalTerminationVals, workInProgressDTO));
                totalFuture = asyncExecutor.runAsync(() ->
                        reportMapper.workInProgressOrderFootSum(
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses, workInProgressDTO));
                                offset, pageSize, finalOrderId, finalInputProject, finalSelectProcesses,finalTerminationVals, workInProgressDTO));
            }
            // 等待全部任务完成
@@ -970,13 +972,17 @@
        }
        String inputVal= (String) dates.get("inputVal");
        String project= (String) dates.get("project");
        if ("null".equals(inputVal)) {
        String terminationVals= dates.get("terminationVals").toString();
        if (inputVal==null) {
            inputVal = "";
        }
        if ("null".equals(project)) {
        if (project==null) {
            project = "";
        }
        List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project);
        if (terminationVals==null) {
            terminationVals = "";
        }
        List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project,terminationVals);
        List<WorkInProgressDTO> dataList2  =reportMapper.exportWorkInProgressMpdataList2(process);
        mergeTeamsGroupsName(dataList1, dataList2);
@@ -1139,7 +1145,7 @@
    public Map<String, Object> workInProgressCombinationSv(
            Integer pageNum, Integer pageSize,
            String orderId, String inputProject, String selectProcesses,
            String optionVal, WorkInProgressDTO workInProgressDTO) {
            String optionVal,String terminationVal, WorkInProgressDTO workInProgressDTO) {
        Integer offset = (pageNum - 1) * pageSize;
@@ -1151,6 +1157,9 @@
        }
        if ("null".equals(optionVal)) {
            optionVal = "";
        }
        if ("null".equals(terminationVal)) {
            terminationVal = "";
        }
        if ("all".equals(selectProcesses)) {
            selectProcesses = "";
@@ -1168,17 +1177,16 @@
        // 最终数据集合
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (!"".equals(selectProcesses)) {
            laminating = reportingWorkMapper.getProcessLaminating(selectProcesses);
            List<Map<String, Object>> singleResult =
                    reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal);
                    reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal,terminationVal);
            if (singleResult != null && !singleResult.isEmpty()) {
                resultList.addAll(singleResult);
            }
            Map<String, Object> total =
                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal);
                    reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal,terminationVal);
            if (total != null) {
                BigDecimal stockNum = (BigDecimal) total.get("stockNum");
                BigDecimal stockArea = (BigDecimal) total.get("stockArea");
@@ -1196,14 +1204,14 @@
                laminating = reportingWorkMapper.getProcessLaminating(process);
                List<Map<String, Object>> singleResult =
                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal);
                        reportMapper.getWorkInProgressCombination(process, laminating, optionVal,terminationVal);
                if (singleResult != null && !singleResult.isEmpty()) {
                    resultList.addAll(singleResult);
                }
                Map<String, Object> total =
                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal);
                        reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal,terminationVal);
                if (total != null) {
                    BigDecimal stockNum = (BigDecimal) total.get("stockNum");
                    BigDecimal stockArea = (BigDecimal) total.get("stockArea");
@@ -1235,11 +1243,15 @@
        }
        String inputVal= (String) dates.get("inputVal");
        String project= (String) dates.get("project");
        if ("null".equals(inputVal)) {
        String terminationVals= dates.get("terminationVals").toString();
        if (inputVal==null) {
            inputVal = "";
        }
        if ("null".equals(project)) {
        if (project==null) {
            project = "";
        }
        if (terminationVals==null) {
            terminationVals = "";
        }
        String laminating = "";
@@ -1253,7 +1265,7 @@
        if (!"".equals(process)) {
            laminating = reportingWorkMapper.getProcessLaminating(process);
            List<WorkInProgressCombinationDTO> singleResult =
                    reportMapper.exportWorkInProgressCombination(process, laminating, inputVal);
                    reportMapper.exportWorkInProgressCombination(process, laminating, inputVal,terminationVals);
            if (singleResult != null && !singleResult.isEmpty()) {
                resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
            }
@@ -1264,7 +1276,7 @@
                laminating = reportingWorkMapper.getProcessLaminating(processVal);
                List<WorkInProgressCombinationDTO> singleResult =
                        reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal);
                        reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal,terminationVals);
                if (singleResult != null && !singleResult.isEmpty()) {
                    resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
@@ -1430,11 +1442,10 @@
            dataList.get(i).put("reportWorkQuantityShow",JSON.toJSONString(dataShow));
        }
        Order order = orderMapper.selectOrderId(orderId);
        map.put("mergeCells", rowCount);
        map.put("data",dataList);
        map.put("order",order);
        return  map;
    }