From e8005cc7b6caaa85c7fc99cc87e3877516f777d9 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期三, 17 四月 2024 10:53:30 +0800
Subject: [PATCH] 更新语句

---
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java |   24 ++++++
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java    |    6 +
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java                    |  150 ++++++++++++++++++-------------------
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java       |   22 ++++
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java    |   10 ++
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java          |    5 +
 6 files changed, 134 insertions(+), 83 deletions(-)

diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java
index f78f833..c316ad9 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java
@@ -5,8 +5,11 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+import java.util.Map;
+
 @RestController
-@RequestMapping("/down-storage-cage-details")
+@RequestMapping("/api/unLoadGlass/downstorage")
 public class DownStorageCageDetailsController {
 
     @Autowired
@@ -18,5 +21,10 @@
         return "Details added successfully";
     }
 
+    @GetMapping("/leisure")
+    public List<Map<String, Object>> getLeisureData() {
+        return downStorageCageDetailsService.selectCacheLeisure();
+    }
+
     // Other CRUD operations can be defined here
 }
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
index 8a505fa..3d693bf 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
@@ -21,6 +21,10 @@
 @Data
 @Service
 public class DownGlassCacheLogic {
+    //涓嬬墖鍓嶇悊鐗�
+    public static final String RESULT_IN = "1";
+    public static final String RESULT_OUT = "2";
+    public static final String RESULT_IN_OUT = "3";
     @Autowired
     private DownStorageCageDetailsMapper selectInfo;
     private GlassInfoService GlassInfoService;
@@ -28,28 +32,23 @@
     private DownGlassTaskService downGlassTaskService;
 
     /**
-     * @param Number
-     *    //璇嗗埆閫昏緫    涓嶄氦浜�
+     * @param Number //璇嗗埆閫昏緫    涓嶄氦浜�
      */
 
-    public void identify(String Number){
+    public void identify(String Number) {
         //鏌ヨ浠诲姟
-        PlcParameterObject plcmes= PLCAutoMes.PlcMesObject;
-        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
-        String s=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+"";
-        boolean isexist=isExist(Number);
+        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
+        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
+        String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + "";
+        boolean isexist = isExist(Number);
         if (isexist) {
             //瀛樺湪閫昏緫    1.娣诲姞淇℃伅 2.鍥炲PLC瀛樺湪
             //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
-        }else {
+        } else {
             //涓嶅瓨鍦ㄩ�昏緫  1.鍥炲PLC涓嶅瓨鍦�
             //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2);
         }
     }
-    //涓嬬墖鍓嶇悊鐗�
-    public static final String RESULT_IN = "1";
-    public static final String RESULT_OUT = "2";
-    public static final String RESULT_IN_OUT = "3";
 
     public void process() {
         String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + "";
@@ -75,44 +74,44 @@
 
     /**
      * @param Number
-     * @return
-     *   //涓嬬墖鍓嶇悊鐗� 杩�
+     * @return //涓嬬墖鍓嶇悊鐗� 杩�
      */
 
-    public boolean processInto(String Number){
+    public boolean processInto(String Number) {
         GlassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
         //鎸塱d鏌ヨ鐜荤拑淇℃伅琛ㄩ噷鐨勭幓鐠�
-        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
-        PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
+        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
         //瀛樺湪姝ょ幓鐠冪紪鍙�
-        if(GlassInfo!=null){
+        if (GlassInfo != null) {
             //鍚岄挗鍖栫増鍥惧唴鐨勬爡鏍煎彿
-            List<DownStorageCageDetails> list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getTemperingFeedSequence(),GlassInfo.getWidth());
+            List<DownStorageCageDetails> list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth());
             //绌烘爡鏍煎彿
-            if (list.size()==0) {
-                list=selectInfo.SelectCacheLeisure();
+            if (list.size() == 0) {
+                list = selectInfo.SelectCacheLeisure();
             }
             //灏忎簬姝ょ幓鐠冮挗鍖栫増鍥惧簭鍙风殑鏍呮牸鍙�
-            if(list.size()==0){
-                list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getWidth());
+            if (list.size() == 0) {
+                list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getWidth());
             }
-            if(list.size()>0){
+            if (list.size() > 0) {
                 //瀛樺湪绌烘牸  
                 //1.鐢熸垚浠诲姟锛�  璧峰浣嶇疆0   缁撴潫浣嶇疆this.slot  浠诲姟绫诲瀷 1   锛堣繘鐗囦换鍔★級
                 //2.鍥炲 1杩涚墖
-                DownStorageCageDetails item=list.get(0);
-                selectInfo.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1",GlassInfo.getWidth(),GlassInfo.getHeight(),GlassInfo.getFilmsid(),GlassInfo.getThickness(),GlassInfo.getFlowcardId());
+                DownStorageCageDetails item = list.get(0);
+                selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId());
 
-                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
                 return true;
             }
-            
-        }else{
+
+        } else {
             // ID缂栧彿涓嶅瓨鍦�   涓嶅鐞�/鍥炲PLC  杩涜鎶ヨ鎻愮ず
         }
         //杩斿洖缁撴灉
         return false;
     }
+
     //鐞嗙墖 鍑�
     public boolean processOut() {
         // 鏌ヨ浠诲姟
@@ -122,10 +121,38 @@
         PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
         List<DownStorageCageDetails> list = selectInfo.SelectCacheOut(1, 5);
         List<DownStorageCageDetails> list2 = selectInfo.SelectCacheOut(6, 10);
-        List<DownStorageCageDetails>  list3 = selectInfo.SelectCacheOut(1, 10);
+        List<DownStorageCageDetails> list3 = selectInfo.SelectCacheOut(1, 10);
+        // 浼樺厛 瓒呭嚭灏哄浼樺厛浜哄伐鍑虹墖 浜哄伐澶勭悊
+        if (!list3.isEmpty()) {
+            DownStorageCageDetails item3 = list3.get(0);
+            if (item3.getHeight() >= 1 && item3.getWidth() >= 1) {
 
+                String endcell = "13";
+                String SendEndcell = "1";
+
+                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
+                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
+                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
+                return true;
+            }
+        }
+
+        //鍚屾椂璇锋眰 浼樺厛鍚庣鍑虹墖
+        else if (!list3.isEmpty()) {
+            DownStorageCageDetails item3 = list3.get(0);
+            if (G06.equals("0") && G11.equals("0")) {
+
+                String endcell = "11";
+                String SendEndcell = "1";
+
+                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
+                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
+                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
+                return true;
+            }
+        }
         // 鎸夌収椤哄簭绗﹀悎鍓嶇鍑虹墖
-        if (!list.isEmpty()) {
+        else if (!list.isEmpty()) {
             DownStorageCageDetails item = list.get(0);
             if (G06.equals("0") && G11.equals("1")) {
                 // 鍑哄埌 G06
@@ -144,20 +171,11 @@
                 S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                 return true;
             }
-            // 瓒呭嚭灏哄浼樺厛浜哄伐鍑虹墖 浜哄伐澶勭悊
-        } else if (!list3.isEmpty()) {
-            DownStorageCageDetails item3 = list3.get(0);
-            if (item3.getHeight() >= 3440 && item3.getWidth() >= 1440) {
 
-                String endcell = "06";
-                String SendEndcell = "1";
-
-                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
-                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
-                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
-                return true;
-            }
         }
+
+
+
 
         // 杩斿洖缁撴灉
         return false;
@@ -173,33 +191,16 @@
      *  //纾ㄨ竟   涓嶄氦浜�  鐞嗙墖鍜岀(杈规満鑷繁浜や簰
      */
 
-    public void processMb(String Number){
-          //鎸塱d鏌ヨ鐜荤拑淇℃伅琛ㄩ噷鐨勭幓鐠�
-        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
-        PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
-        if(GlassInfo!=null){
-            //鍙戦�佷换鍔�   ID   闀� 瀹� 鍘� 鍊掕 宸ヨ壓鍔熻兘绛�
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.22").getAddress(),"N10000");  
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.24").getAddress(), "1000");  
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.26").getAddress(),"800");  
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(),"60");  
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.30").getAddress(), "2");  
-            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");   
-        }
-        //杩斿洖缁撴灉
-    }
-
 
     /**
      * @param Number
-     * @return
-     * 鏌ヨ娑堟伅闃熷垪閲屾鐜荤拑ID鐨勬暟鎹�
+     * @return 鏌ヨ娑堟伅闃熷垪閲屾鐜荤拑ID鐨勬暟鎹�
      */
-    public boolean selectMessageId(String Number){
+    public boolean selectMessageId(String Number) {
         //鏌ヨ鏄惁瀛樺湪
 
-        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
-        if(GlassInfo==null){
+        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;
 
@@ -210,38 +211,35 @@
 
     /**
      * @param Number
-     * @return
-     *   鍒犻櫎娑堟伅闃熷垪閲屾鐜荤拑ID鐨勬暟鎹�
+     * @return 鍒犻櫎娑堟伅闃熷垪閲屾鐜荤拑ID鐨勬暟鎹�
      */
 
-    public boolean deleteMessageId(String Number){
+    public boolean deleteMessageId(String Number) {
         //鏌ヨ鏄惁瀛樺湪
-        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
-        if(GlassInfo==null){
+        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;
         }
         //杩斿洖 瀛樺湪
         return true;
     }
-
 
 
     /**
      * @param Number
-     * @return
-     *   //鏄惁瀛樺湪姝ょ紪鍙风幓鐠�
+     * @return //鏄惁瀛樺湪姝ょ紪鍙风幓鐠�
      */
-    public boolean isExist(String Number){
+    public boolean isExist(String Number) {
         //鏌ヨ鏄惁瀛樺湪
-        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
-        if(GlassInfo==null){
+        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;
         }
         //杩斿洖 瀛樺湪
         return true;
     }
-    
+
 }
 
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
index a5c57bc..beedbab 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -2,11 +2,14 @@
 
 import com.mes.downstorage.entity.DownStorageCageDetails;
 
+import java.util.List;
+import java.util.Map;
+
 public interface DownStorageCageDetailsService {
 
     void addDownStorageCageDetails(DownStorageCageDetails details);
 
-
+    List<Map<String, Object>> selectCacheLeisure();
 
 
 }
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
index cb8604a..e9ff3fb 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -1,20 +1,44 @@
 package com.mes.downstorage.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.downstorage.entity.DownStorageCage;
 import com.mes.downstorage.entity.DownStorageCageDetails;
 import com.mes.downstorage.mapper.DownStorageCageDetailsMapper;
+import com.mes.downstorage.mapper.DownStorageCageMapper;
 import com.mes.downstorage.service.DownStorageCageDetailsService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService {
 
+
+
     @Override
     public void addDownStorageCageDetails(DownStorageCageDetails details) {
         this.save(details);
     }
 
 
+//    @Resource
+//    private DownStorageCageDetailsMapper downStorageCageDetailsMapper;
+    @Override
+    public List<Map<String, Object>> selectCacheLeisure() {
+        QueryWrapper<DownStorageCageDetails> queryWrapper = new QueryWrapper<>();
+        queryWrapper
+                .apply("LEFT JOIN down_storage_cage esc ON esc.slot = down_storage_cage_details.slot")
+                .isNull("down_storage_cage_details.slot");
+
+        return listMaps(queryWrapper);
+    }
+
+
 
 
     // Other business methods can be implemented here
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
index 8788d0e..0248b42 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -51,11 +51,27 @@
             return ResponseEntity.status(500).body(errorResponse);
         }
     }
-
     @GetMapping("/gettwo")
-    public List<DownWorkstation> gettwoDownWorkstations() {
-        return downWorkstationService.getoneDownWorkstations(6,10);
+    public ResponseEntity<?> gettwoDownWorkstations() {
+        try {
+            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,5);
+            // 鏋勫缓绗﹀悎棰勬湡鏍煎紡鐨勫搷搴旀暟鎹�
+            Map<String, Object> responseData = new HashMap<>();
+            responseData.put("code", 200);
+            responseData.put("msg", "鎴愬姛");
+            responseData.put("data", data);
+            // 杩斿洖 ResponseEntity 瀵硅薄锛屽寘鍚搷搴旀暟鎹拰鐘舵�佺爜
+            return ResponseEntity.ok(responseData);
+        } catch (Exception e) {
+            e.printStackTrace();
+            // 濡傛灉鍑虹幇寮傚父锛岃繑鍥為敊璇俊鎭�
+            Map<String, Object> errorResponse = new HashMap<>();
+            errorResponse.put("code", 500);
+            errorResponse.put("msg", "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+            return ResponseEntity.status(500).body(errorResponse);
+        }
     }
+
     @GetMapping("/getflowCardId")
     public ResponseEntity<Map<String, Object>> getflowCardId() {
         Map<String, Object> responseData = new HashMap<>();
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
index 2752c15..0c44dac 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -120,8 +120,10 @@
         // 浠� SQL Server 鏁版嵁搴撲腑鏌ヨ鏁版嵁
         List<DownWorkstationTask> downWorkstationTasks = downWorkstationTaskMapper.selectList();
 
-
-
     }
 
+
+
+
+
 }

--
Gitblit v1.8.0