From cfc2855d2fe063e26947bad7277a1091efbb3bbb Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期四, 28 十一月 2024 02:16:21 +0800
Subject: [PATCH] 协议地址更新,手动页面更新

---
 springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java |  105 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 65 insertions(+), 40 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
index c2a2672..951a959 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -395,8 +395,8 @@
     }
 
     // 鏌ヨ鐜荤拑淇℃伅
-    public Result SelectGlassInfo(String width, String height, String thickness, String films,String tier) {
-        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films,tier);
+    public Result SelectGlassInfo(String width, String height, String thickness, String films, String tier) {
+        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films, tier);
         Map<String, Object> map = new HashMap<>();
         map.put("StorageCageAddInfo", glassInfoList);
         return Result.success(map);
@@ -449,19 +449,21 @@
         map.put("message", "200");
         return Result.success(map);
     }
-    //鎵爜鍖归厤鎴愬姛
-    public int ScanMatch(String Order, Integer Mateid,Integer tier) {
-        
-        GlassInfo glass=homeMapper.SelectCodeGlass(Order,Mateid,tier);
-        System.out.println("glass:"+glass);
-        System.out.println("order"+Order+"mateid"+Mateid+"tier"+tier);
-        if(glass==null){
+
+    // 鎵爜鍖归厤鎴愬姛
+    public int ScanMatch(String Order, Integer Mateid, Integer tier) {
+
+        GlassInfo glass = homeMapper.SelectCodeGlass(Order, Mateid, tier);
+        System.out.println("glass:" + glass);
+        System.out.println("order" + Order + "mateid" + Mateid + "tier" + tier);
+        if (glass == null) {
             return 0;
-        }else{
-        int cont= QueueMapper.insertQueueCode(glass.getFlowcard(),glass.getGlassid(),glass.getMateid(),glass.getGlasstype(),glass.getWidth(),glass.getHeight(),glass.getThickness());
-        glassInfoMapper.updatemeasurenumber(glass.getId());
-        return cont;
-     }
+        } else {
+            int cont = QueueMapper.insertQueueCode(glass.getFlowcard(), glass.getGlassid(), glass.getMateid(),
+                    glass.getGlasstype(), glass.getWidth(), glass.getHeight(), glass.getThickness());
+            glassInfoMapper.updatemeasurenumber(glass.getId());
+            return cont;
+        }
     }
 
     // 浜哄伐鍖归厤淇敼娴嬮噺淇℃伅
@@ -470,24 +472,26 @@
         PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
         Map<String, Object> map = new HashMap<>();
         QueueMapper.DeleteQueue();
-        String mestoplc=plcmes.getPlcParameter("MESToGaStatus").getValue();
-        String A02Plc=plcmes.getPlcParameter("GaToMES").getValue();
-        System.out.println("浜哄伐鍖归厤mestoplc:"+mestoplc);
+        String mestoplc = plcmes.getPlcParameter("MESToGaStatus").getValue();
+        String A02Plc = plcmes.getPlcParameter("GaToMES").getValue();
+        System.out.println("浜哄伐鍖归厤mestoplc:" + mestoplc);
         // int count = homeMapper.SelectQueue();
-        if (("0".equals(mestoplc)&&"0".equals(A02Plc))||("1".equals(A02Plc)&&"4".equals(mestoplc))) {
-            // homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
-            //         glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid());
+        if (("0".equals(mestoplc) && "0".equals(A02Plc)) || ("1".equals(A02Plc) && "4".equals(mestoplc))) {
+            // homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(),
+            // glassInfo.getHeight(),
+            // glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(),
+            // glassInfo.getMateid());
             homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                     glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid());
             glassInfoMapper.updatemeasurenumber(glassInfo.getId());
-           if("0".equals(mestoplc)){
-            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 1);
-            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
-            System.out.println("鎻愬墠鍖归厤");
-           }else{
-            System.out.println("娴嬮噺鍖归厤");
-            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
-           }
+            if ("0".equals(mestoplc)) {
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 1);
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
+                System.out.println("鎻愬墠鍖归厤");
+            } else {
+                System.out.println("娴嬮噺鍖归厤");
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
+            }
             map.put("message", "200");
         } else {
             map.put("message", "300");
@@ -503,14 +507,35 @@
     public Result ManualTake(String glassInfo) {
         // 璇诲彇DB105鍖烘枃浠�
         PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
-        // 绉婚櫎
-        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3);
-        // 鍒犻櫎鏁版嵁
-        QueueMapper.DeleteErrorQueue();
-
-        // plcmes.getPlcParameter("GaToMES").setValue("3");
+        String A02Plc = plcmes.getPlcParameter("GaToMES").getValue();
+        String A01Plc = plcmes.getPlcParameter("A01ToMES").getValue();
+        String A02Mes = plcmes.getPlcParameter("MESToGaStatus").getValue();
         Map<String, Object> map = new HashMap<>();
-        map.put("message", "200");
+        // 绉婚櫎
+        if ("1".equals(A02Plc)||"2".equals(A02Plc)|"1".equals(A02Mes)) {
+            Queue queue = QueueMapper.selectLastQueue3();
+            if (queue != null) {
+                // 鍑忓皯鍖归厤娆℃暟
+                glassInfoMapper.updateGlassNumber(queue.getglasstype());
+            }
+            // 鍒犻櫎闃熷垪
+            QueueMapper.DeletefromQueue();
+            if("0".equals(A02Plc)){
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 0);
+            }else{
+                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3);
+            }
+            
+            System.out.println("浜哄伐鎷胯蛋A02Plc:" + A02Plc);
+            map.put("message", "200");
+        }else{
+            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 3);
+            QueueMapper.DeletefromQueue();
+            map.put("message", "300");
+            System.out.println("浜哄伐鎷胯蛋A01Plc:" + A01Plc);
+        }
+        // plcmes.getPlcParameter("GaToMES").setValue("3");
+        
         return Result.success(map);
     }
 
@@ -533,8 +558,8 @@
 
     // 鍒犻櫎鍑虹墖闃熷垪
     public Result DeleteOutTask(Integer id) {
-        
-        int cell=homeMapper.SelectOutTaskId(id);
+
+        int cell = homeMapper.SelectOutTaskId(id);
         UpdateStroageCageByCell(cell, 1);// 鐜荤拑鏁伴噺+1
         homeMapper.DeleteOutTask(id);
         Map<String, Object> map = new HashMap<>();
@@ -567,8 +592,8 @@
         PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
         // 閲嶆柊娴嬮噺
         String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// plc璇锋眰瀛�
-        if("1".equals(PlcRequest)){
-        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2);
+        if ("1".equals(PlcRequest)) {
+            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2);
         }
         // 鍒犻櫎鏁版嵁
         QueueMapper.DeleteErrorQueue();
@@ -628,7 +653,7 @@
         for (Map map : RemoveErrorData) {
             String key = map.get("base").toString() + "_" + map.get("height").toString() + "_"
                     + map.get("thickness").toString() + "_" + map.get("films").toString() + "_"
-                    + map.get("order").toString() + "_" + map.get("matching").toString()+ map.get("tier").toString();
+                    + map.get("order").toString() + "_" + map.get("matching").toString() + map.get("tier").toString();
             String tierkey = map.get("order").toString() + "_" + map.get("matching").toString();
 
             String value = TypeData.get(key);

--
Gitblit v1.8.0