From 39074eeb5b58bbb20637401bfb41b96fd27cec8c Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 09 九月 2024 08:52:50 +0800
Subject: [PATCH] 更改链接层号的字段

---
 hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java |   75 +++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 29 deletions(-)

diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
index 5dd8f54..b372378 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -4,25 +4,25 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.query.MPJQueryWrapper;
-import com.github.yulichang.toolkit.JoinWrappers;
 import com.mes.glassinfo.entity.GlassInfo;
 import com.mes.glassinfo.entity.OptimizeGlassinfo;
 import com.mes.glassinfo.mapper.GlassInfoMapper;
 import com.mes.glassinfo.service.GlassInfoService;
 import com.mes.pp.entity.OptimizeProject;
 import com.mes.pp.mapper.OptimizeProjectMapper;
-import com.mes.uppattenusage.entity.UpPattenUsage;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
- *  鏈嶅姟瀹炵幇绫�
+ * 鏈嶅姟瀹炵幇绫�
  * </p>
  *
  * @author wu
@@ -31,25 +31,26 @@
 @Service
 @Slf4j
 public class GlassInfoServiceImpl extends MPJBaseServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService {
-    @Autowired
+    @Resource
     OptimizeProjectMapper optimizeProjectMapper;
+
     @Override
     @DS("pp")
     public List<GlassInfo> selectGlassInfo(String engineeringId) {
-        List<OptimizeGlassinfo> optimizeGlassinfos=null;
+        List<OptimizeGlassinfo> optimizeGlassinfos = null;
         if (engineeringId != null) {
             optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>()
-                    .select("b.process_id,t.glass_type,b.o_width,b.o_height,t.glass_thickness,b.order_sort,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,c.x_axis,c.y_axis,b.project_no,b.glass_id,c.rotate_angle")
+                    .select("b.process_id,t.glass_type,b.o_width,b.o_height,t.glass_thickness,b.order_sort,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,c.x_axis,c.y_axis,b.project_no,b.glass_id,c.rotate_angle,d.merge")
                     .leftJoin("optimize_detail b on t.project_no=b.project_no")
-                                    .leftJoin("optimize_heat_detail c on c.project_no=t.project_no and b.heat_layout_id=c.layout_id and b.heat_layout_sort=c.sort")
+                    .leftJoin("optimize_heat_detail c on c.project_no=t.project_no and b.heat_layout_id=c.layout_id and b.heat_layout_sort=c.sort")
+                    .leftJoin("flow_card d on d.process_id=b.process_id and d.technology_number=b.layer and  d.order_number=b.order_sort ")
                     //.eq("t.state",100)
                     .eq("t.project_no", engineeringId));
         }
-        //order_sort,o_width,o_height
         // 鍒涘缓涓�涓� List 鐢ㄤ簬淇濆瓨鏄犲皠鍚庣殑瀹炰綋瀵硅薄
         List<GlassInfo> resultList = new ArrayList<>();
 
-        if(optimizeGlassinfos!=null){
+        if (optimizeGlassinfos != null) {
             for (OptimizeGlassinfo map : optimizeGlassinfos) {
                 // 鍒涘缓涓�涓柊鐨� OptimizeGlassinfo 瀵硅薄
                 GlassInfo glassInfo = new GlassInfo();
@@ -72,12 +73,13 @@
                 glassInfo.setYCoordinate(map.getYAxis());
                 glassInfo.setAngle(map.getRotateAngle());
                 glassInfo.setGlassId(map.getGlassId());
+                glassInfo.setCombine(map.getMerge());
                 // 灏嗘槧灏勫悗鐨勫璞℃坊鍔犲埌缁撴灉鍒楄〃涓�
                 resultList.add(glassInfo);
             }
         }
-        log.info("鏌ヨ鍑篻lassinfo鐨勬暟鎹畕}:",resultList);
-        log.info("鏌ヨ鍑篻lassinfopro鐨勬暟鎹畕}:",optimizeGlassinfos);
+        log.info("鏌ヨ鍑篻lassinfo鐨勬暟鎹畕}:", resultList);
+        log.info("鏌ヨ鍑篻lassinfopro鐨勬暟鎹畕}:", optimizeGlassinfos);
         return resultList;
     }
 
@@ -87,32 +89,47 @@
     }
 
 
-
-
-
-
     @Override
-    public int getGlassInfoCountByFlowCardId(String flowCardId) {
+    public int getGlassInfoCountByFlowCardId(String flowCardId, int layer) {
         return baseMapper.selectCount(new QueryWrapper<GlassInfo>().lambda()
-                .eq(GlassInfo::getFlowCardId, flowCardId));
-    }
+                .eq(GlassInfo::getFlowCardId, flowCardId)
+                .eq(GlassInfo::getLayer, layer));
 
+    }
 
 
     @Override
     public List<Map<String, Object>> getFlowCardId() {
-        return baseMapper.selectJoinMaps(JoinWrappers.lambda(GlassInfo.class)
-                .select(GlassInfo::getFlowCardId)
-                .leftJoin(UpPattenUsage.class, on -> on
-                        .eq(OptimizeProject::getProjectNo, GlassInfo::getEngineerId)
-                        .ne(OptimizeProject::getState, 300)
-                )
-                .groupBy(GlassInfo::getFlowCardId)
+        // 绗簩涓煡璇細鏌ヨ OptimizeProject 琛紝鏍规嵁 GlassInfo 鐨� engineerId 鍜� state 杩涜绛涢��
+        List<OptimizeProject> optimizeProjects = optimizeProjectMapper.selectList(
+                new QueryWrapper<OptimizeProject>()
+                        .ne("state", 300)
         );
+        // 鎻愬彇 engineerId 鍒楄〃
+        List<String> engineerIds = optimizeProjects.stream()
+                .map(OptimizeProject::getProjectNo)
+                .collect(Collectors.toList());
+
+        // 绗竴涓煡璇細鏌ヨ GlassInfo 琛ㄥ苟鎸� flow_card_id 鍒嗙粍锛屽悓鏃剁瓫閫夊嚭鍦� engineerIds 鍒楄〃涓殑璁板綍
+        List<GlassInfo> glassInfos = baseMapper.selectList(
+                new QueryWrapper<GlassInfo>()
+                        .in("engineer_id", engineerIds)
+                        .groupBy("flow_card_id")
+                        .groupBy("layer")
+        );
+
+        // 杞崲涓� List<Map<String, Object>>
+        List<Map<String, Object>> result = glassInfos.stream()
+                .map(glassInfo -> {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("flow_card_id", glassInfo.getFlowCardId() + " | " + glassInfo.getLayer());
+                    // 濡傛灉杩樻湁鍏朵粬瀛楁闇�瑕佹坊鍔犲埌 map 涓紝鍦ㄨ繖閲岀户缁坊鍔�
+                    return map;
+                })
+                .collect(Collectors.toList());
+        log.info("result666: {}", result);
+        return result;
     }
-
-
-
 
 
 

--
Gitblit v1.8.0