From b0331e977d9a656dc411263f88e633ac80bf4dd0 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 06 一月 2025 16:17:31 +0800
Subject: [PATCH] 1、中空理片笼对接李赛克细节优化

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |   56 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
index 6872823..21e6b99 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -11,7 +11,6 @@
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.HollowFormulaDetails;
 import com.mes.hollow.entity.HollowGlassOutRelationInfo;
-import com.mes.hollow.entity.HollowGlassRelationInfo;
 import com.mes.hollow.entity.dto.*;
 import com.mes.hollow.entity.request.HollowTaskRequest;
 import com.mes.hollow.mapper.HollowGlassOutRelationInfoMapper;
@@ -108,6 +107,14 @@
 
     @Override
     public Boolean startTask(String flowCardId, int cell) {
+        log.info("鏌ョ湅璇ユ祦绋嬪崱鏄惁鐢辨鍦ㄦ墽琛岀殑浠诲姟锛屾祦绋嬪崱锛歿}", flowCardId);
+        int taskCount = this.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
+                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
+        if (taskCount == 0 || taskCount > 1) {
+            log.info("璇ユ祦绋嬪崱涓嶅瓨鍦ㄤ换鍔℃垨鑰呮湁姝e湪鎵ц涓紝鏃犳硶鍐嶆鎵ц");
+            return Boolean.FALSE;
+        }
         //鏇存柊浠诲姟鐘舵�佷负寮�濮�
         return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                 .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
@@ -153,7 +160,7 @@
     }
 
     @Override
-    public String generateHollowLisecFile(String flowCardId, int cell, int isForce) throws IOException {
+    public String generateHollowLisecFile(String flowCardId, int cell, int isForce, int isOut) throws IOException {
         List<HollowGlassOutRelationInfo> outRelationList = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                 .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
                 .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
@@ -185,28 +192,20 @@
         String randomNumber = "" + (int) (Math.random() * 100000 + 100000);
         details.setBcdStart(randomNumber);
         details.setBatchNo(randomNumber);
-        details.setOrd(relationInfo.getFlowCardId().substring(2, 9));
+        details.setOrd(relationInfo.getFlowCardId().substring(2, 9) + (int) (Math.random() * 100 + 100));
         details.setCustNum(order.getCustomerId() + "");
-        details.setCustNam(order.getCustomerName());
+        details.setCustNam("");
         details.setProDate((new SimpleDateFormat("dd/MM/yyyy").format(new Date())));
         details.setDelDate(new SimpleDateFormat("dd/MM/yyyy").format(order.getDeliveryDate()));
 
         //璁剧疆鏂囦欢绗竴灞傚垪琛ㄦ暟鎹�
         //鏆傛椂鐢熸垚绗煎唴鎵�鏈夌殑鐜荤拑淇℃伅锛堝凡閰嶅鍜屾湭閰嶅鐨勶級
-        List<HollowGlassRelationInfo> hollowGlassRelationInfos = hollowGlassRelationInfoService.list(new LambdaQueryWrapper<HollowGlassRelationInfo>()
-                .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId).orderByAsc(HollowGlassRelationInfo::getHollowSequence));
-        Map<Integer, List<HollowGlassRelationInfo>> listMap = hollowGlassRelationInfos.stream().collect(Collectors.groupingBy(HollowGlassRelationInfo::getHollowSequence));
+//        List<HollowGlassRelationInfo> hollowGlassRelationInfos = hollowGlassRelationInfoService.list(new LambdaQueryWrapper<HollowGlassRelationInfo>()
+//                .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId).orderByAsc(HollowGlassRelationInfo::getHollowSequence));
+        List<HollowBigStorageCageDetails> hollowGlassRelationInfos = hollowBigStorageCageDetailsService.queryPairGlassList(flowCardId, relationInfo.getTotalLayer(), relationInfo.getTotalPairQuantity(), isOut);
+        Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowGlassRelationInfos.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence));
 
         //璁剧疆闂撮殧鏉挎暟鎹叡鎵�鏈夐厤瀵圭幓鐠冧娇鐢�
-
-//        for (int i = 1; i < relationInfo.getTotalLayer(); i++) {
-//            LisecHollowFrameDetails frameDetails = new LisecHollowFrameDetails();
-//            frameDetails.setRecType("<FR" + i + ">");
-//            frameDetails.setType(formulaDetails.getIntervalFrameType());
-//            frameDetails.setWidth(formulaDetails.getIntervalFrameWidth());
-//            frameDetails.setHeight(formulaDetails.getIntervalFrameHeight());
-//            frameList.add(frameDetails);
-//        }
         List<LisecHollowGlassAndFrameDetails> glassAndFrameList = new ArrayList<>();
         listMap.forEach((e, v) -> {
             LisecHollowGlassAndFrameDetails glassAndFrame = new LisecHollowGlassAndFrameDetails();
@@ -214,8 +213,10 @@
             List<LisecHollowFrameDetails> frameList = new ArrayList<>();
             for (int i = 1; i <= v.size(); i++) {
                 LisecHollowGlassDetails hollowGlassDetails = new LisecHollowGlassDetails();
+                HollowBigStorageCageDetails glassInfo = v.get(i - 1);
                 hollowGlassDetails.setRecType("<GL" + i + ">");
-                hollowGlassDetails.setThickness((int) (v.get(i - 1).getThickness() * 10) + "");
+                hollowGlassDetails.setThickness((int) (glassInfo.getThickness() * 10) + "");
+                hollowGlassDetails.setDescript(formulaDetails.getIntervalFrameWidthOne() + "-" + (int) (glassInfo.getThickness() * 10));
                 hollowGlassDetails.setPaneBcd(randomNumber + "" + (e * ID_RATIO + i));
                 glassList.add(hollowGlassDetails);
             }
@@ -228,38 +229,38 @@
             glassAndFrame.setHeight((int) (v.get(0).getHeight() * 10) + "");
             glassAndFrame.setGlass1(e * ID_RATIO + 1 + "");
             glassAndFrame.setFrame1(formulaDetails.getFrameOne());
-            frameList.add(new LisecHollowFrameDetails("<FR1",formulaDetails.getIntervalFrameTypeOne(), formulaDetails.getIntervalFrameWidthOne(), formulaDetails.getIntervalFrameHeightOne()));
+            frameList.add(new LisecHollowFrameDetails("<FR1>", formulaDetails.getIntervalFrameTypeOne(), formulaDetails.getIntervalFrameWidthOne(), formulaDetails.getIntervalFrameHeightOne()));
             glassAndFrame.setGasCode1(formulaDetails.getCasOne());
             if (relationInfo.getTotalLayer() == 2) {
                 glassAndFrame.setGlass2(e * ID_RATIO + 2 + "");
             } else if (relationInfo.getTotalLayer() == 3) {
                 glassAndFrame.setGlass2(e * ID_RATIO + 2 + "");
                 glassAndFrame.setFrame2(formulaDetails.getFrameTwo());
-                frameList.add(new LisecHollowFrameDetails("<FR2",formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
+                frameList.add(new LisecHollowFrameDetails("<FR2>", formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
                 glassAndFrame.setGasCode2(formulaDetails.getCasTwo());
                 glassAndFrame.setGlass3(e * ID_RATIO + 3 + "");
             } else if (relationInfo.getTotalLayer() == 4) {
                 glassAndFrame.setGlass2(e * ID_RATIO + 2 + "");
                 glassAndFrame.setFrame2(formulaDetails.getFrameTwo());
-                frameList.add(new LisecHollowFrameDetails("<FR2",formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
+                frameList.add(new LisecHollowFrameDetails("<FR2>", formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
                 glassAndFrame.setGasCode2(formulaDetails.getCasTwo());
                 glassAndFrame.setGlass3(e * ID_RATIO + 3 + "");
                 glassAndFrame.setFrame3(formulaDetails.getFrameThree());
-                frameList.add(new LisecHollowFrameDetails("<FR3",formulaDetails.getIntervalFrameTypeThree(), formulaDetails.getIntervalFrameWidthThree(), formulaDetails.getIntervalFrameHeightThree()));
+                frameList.add(new LisecHollowFrameDetails("<FR3>", formulaDetails.getIntervalFrameTypeThree(), formulaDetails.getIntervalFrameWidthThree(), formulaDetails.getIntervalFrameHeightThree()));
                 glassAndFrame.setGasCode3(formulaDetails.getCasThree());
                 glassAndFrame.setGlass4(e * ID_RATIO + 4 + "");
             } else {
                 glassAndFrame.setGlass2(e * ID_RATIO + 2 + "");
                 glassAndFrame.setFrame2(formulaDetails.getFrameTwo());
-                frameList.add(new LisecHollowFrameDetails("<FR2",formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
+                frameList.add(new LisecHollowFrameDetails("<FR2>", formulaDetails.getIntervalFrameTypeTwo(), formulaDetails.getIntervalFrameWidthTwo(), formulaDetails.getIntervalFrameHeightTwo()));
                 glassAndFrame.setGasCode2(formulaDetails.getCasTwo());
                 glassAndFrame.setGlass3(e * ID_RATIO + 3 + "");
                 glassAndFrame.setFrame3(formulaDetails.getFrameThree());
-                frameList.add(new LisecHollowFrameDetails("<FR3",formulaDetails.getIntervalFrameTypeThree(), formulaDetails.getIntervalFrameWidthThree(), formulaDetails.getIntervalFrameHeightThree()));
+                frameList.add(new LisecHollowFrameDetails("<FR3>", formulaDetails.getIntervalFrameTypeThree(), formulaDetails.getIntervalFrameWidthThree(), formulaDetails.getIntervalFrameHeightThree()));
                 glassAndFrame.setGasCode3(formulaDetails.getCasThree());
                 glassAndFrame.setGlass4(e * ID_RATIO + 4 + "");
                 glassAndFrame.setFrame3(formulaDetails.getFrameFour());
-                frameList.add(new LisecHollowFrameDetails("<FR4",formulaDetails.getIntervalFrameTypeFour(), formulaDetails.getIntervalFrameWidthFour(), formulaDetails.getIntervalFrameHeightFour()));
+                frameList.add(new LisecHollowFrameDetails("<FR4>", formulaDetails.getIntervalFrameTypeFour(), formulaDetails.getIntervalFrameWidthFour(), formulaDetails.getIntervalFrameHeightFour()));
                 glassAndFrame.setGasCode4(formulaDetails.getCasFour());
                 glassAndFrame.setGlass4(e * ID_RATIO + 5 + "");
             }
@@ -288,7 +289,7 @@
         // 灏嗙敓鎴愮殑鏂囦欢瀛樺叆鎸囧畾璺緞
         //璁$畻鐢熸垚鏉庤禌鍏嬮渶瑕佺殑鏁版嵁缁欏埌姣忎釜灞炴��
         StringWriter out = new StringWriter();
-        File file = new File(System.getProperty("user.dir")+"/lisec", relationInfo.getFlowCardId() + randomNumber.substring(randomNumber.length() - 3) + ".trf");
+        File file = new File(System.getProperty("user.dir") + "/lisec", relationInfo.getFlowCardId() + randomNumber.substring(randomNumber.length() - 3) + ".trf");
         try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
             temp.process(root, out);
             writer.write(out.toString());
@@ -307,11 +308,10 @@
             return info;
         }
         List<HollowGlassOutRelationInfo> outRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                .eq(HollowGlassOutRelationInfo::getCell, request.getCell())
                 .eq(HollowGlassOutRelationInfo::getFlowCardId, request.getFlowCardId())
                 .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE));
         if (CollectionUtil.isNotEmpty(outRelationInfos)) {
-            log.info("褰撳墠娴佺▼鍗″湪鏈潯绾挎湁鏈畬鎴愮殑浠诲姟");
+            log.info("褰撳墠娴佺▼鍗℃湁鏈畬鎴愮殑浠诲姟");
             return null;
         }
         //淇濆瓨浠诲姟鍏崇郴涓昏〃
@@ -348,7 +348,7 @@
         hollowGlassQueueInfoService.saveBatch(hollowQueues);
         try {
             if (request.getCell() == 930) {
-                generateHollowLisecFile(request.getFlowCardId(), 930, isForce);
+                generateHollowLisecFile(request.getFlowCardId(), 930, isForce, 0);
             }
         } catch (Exception e) {
             log.info("鐢熸垚鏉庤禌鍏嬫枃浠舵椂鍙戠敓寮傚父锛屾祦绋嬪崱鍙蜂负{}", request.getFlowCardId());

--
Gitblit v1.8.0