From 1de52d82ec5c3fb56e095a36571ab32bfdb15ca4 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期日, 31 三月 2024 13:25:01 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes

---
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java |  109 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 68 insertions(+), 41 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
index 886fb12..5cc729d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -1,25 +1,21 @@
 package com.example.springboot.component;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
-import com.example.springboot.service.JdbcConnections;
 import com.example.springboot.service.SpianServiceNew;
-import com.example.springboot.entity.north_glass_buffer1;
+import com.example.springboot.service.StorageCageService;
+import com.example.springboot.entity.GlassInfo;
 import com.example.springboot.entity.device.PlcParameterObject;
 import com.example.springboot.mapper.AlarmMapper;
 import com.example.springboot.mapper.AlbaniaMapper;
-import com.example.springboot.mapper.SpianMapper;
+
 
 public class PlcHoldNew extends Thread {
 
   private AlarmMapper alarmMapper;
 
   @Autowired
-  private JdbcConnections jdbcConnections;
   private AlbaniaMapper albaniaMapper;
   private SpianServiceNew spianService;
+  private StorageCageService storageCageService;
   int aaa;
 
   @Override
@@ -33,63 +29,94 @@
         // \\ TODO Auto-generated catch block
         e.printStackTrace();
       }
-     
+
+      
+      storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
       spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class);
       albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
-      //spianService.selectAll(albaniaMapper.SelectGlass());
+      
       //璇诲彇DB14鍖烘枃浠�
       PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
-      
+      if(plcmes.getPlcParameter("PLCToMES").getValue()!=null){
+        
+      // spianService.Mestast("1234567890123",40,0,2,"MESID1");
+      // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//鍑虹墖浠诲姟鍚姩
     
       String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//鍑虹墖璇锋眰涓�绾�
       String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//鍑虹墖璇锋眰浜岀嚎
-      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//杩涚墖璇锋眰
-      String B01State=plcmes.getPlcParameter("B01State").getValue();//杩愰�佽溅璇锋眰
-      String TastState=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//浠诲姟瀹屾垚
-  
+      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//杩愰�佽溅璇锋眰
+      //String B01State=plcmes.getPlcParameter("B01State").getValue();//杩愰�佽溅璇锋眰
+      String IDStatus1=plcmes.getPlcParameter("IDStatus1").getValue();//1鍙蜂换鍔″畬鎴�
+      String MESToPLCStatus1=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//1鍙风‘璁ゅ瓧
       
       //涓�鍙风嚎璇锋眰
-      // if (ExportTOMES1.equals("1") == true&&B01State.equals("0")==true) {
-      //   //灏嗚繍杈撹溅鐘舵�佹敼涓哄繖纰�
-      //   S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
-      //   spianService.selectout(1);
-      // }
-      // //浜岀嚎鍙疯姹傛椂
-      // if (ExportToMES2.equals("1") == true&&B01State.equals("0")==true) {
-      //   //灏嗚繍杈撹溅鐘舵�佹敼涓哄繖纰�
-      //   S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
-      //   spianService.selectout(2);
-      // }
-      //杩涚墖璇锋眰鏃�
-      if(PLCToMES!=null && B01State!=null){
-      if(PLCToMES.equals("1")==true&&B01State.equals("0")==true){
+      if(ExportTOMES1!=null){
+      if (ExportTOMES1.equals("1") == true&&PLCToMES.equals("1")==true) {
         //灏嗚繍杈撹溅鐘舵�佹敼涓哄繖纰�
-        //S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
-        
-        spianService.selectAll(albaniaMapper.SelectGlass());
+        spianService.selectout(1);
       }
+    }
+      // //浜岀嚎鍙疯姹傛椂
+      if(ExportToMES2!=null ){
+      if (ExportToMES2.equals("1") == true&&PLCToMES.equals("1")==true) {
+        //灏嗚繍杈撹溅鐘舵�佹敼涓哄繖纰�
+        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
+        spianService.selectout(2);
+      }
+    }
+      //杩涚墖璇锋眰鏃�
+      GlassInfo glass=albaniaMapper.SelectGlass();
+      if(PLCToMES!=null && glass!=null){
+      if(PLCToMES.equals("1")==true&&glass!=null){        
+        spianService.selectAll(glass);
+      }
+    }
     
 
       //浠诲姟瀹屾垚鏃�
-      if(TastState.equals("1")==true){
-        
+      if(IDStatus1.equals("1")==true && MESToPLCStatus1.equals("0")==true){
         //瀹屾垚纭瀛�
         for(int i=1;i<7;i++){
-          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//渚濇鑾峰彇浠诲姟绫诲瀷
-          String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//渚濇鑾峰彇浠诲姟绫诲瀷
+          
+          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//PLC鐞嗙墖浠诲姟鐘舵�佹眹鎶�
+          String Glassid=plcmes.getPlcParameter("MESID"+i).getValueString();//MES鐜荤拑ID
+          
+          GlassInfo id=albaniaMapper.SelectTaskId(Glassid);
           if(Tastover.equals("1")){
-
-            //璋冪敤瀹屾垚浠诲姟 Glassid
-            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//瀹屾垚纭瀛�
+            if(id!=null){
+              //璋冪敤瀹屾垚浠诲姟 Glassid
+              storageCageService.FinishTask(id.getId());
+            }    
+              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 0);//娓呴櫎浠诲姟瀛�
+              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//瀹屾垚纭瀛�
+             
+            }
+          
+          
+          
+        }
+      }
+      //姹囨姤鍙栨秷鏃�
+      if(IDStatus1.equals("0")==true &&MESToPLCStatus1.equals("1")){
+        
+        //鍙栨秷纭瀛�
+        for(int i=1;i<7;i++){
+          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//渚濇鑾峰彇浠诲姟姹囨姤
+          if(Tastover.equals("0")){
+            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("IDStatus"+i).getAddress(), (short) 0);//娓呴櫎纭瀛�
+            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 0);//娓呴櫎纭瀛�
+            // System.out.println(plcmes.getPlcParameter("MESToPLCStatus1").getValue());
+            // System.out.println(S7control.getinstance().ReadWord("DB14.158", 1));
           }
         }
       }
-    }
+    
+  }
   
       // 鏌ヨ鏁版嵁搴�
       // 鎺ㄩ�佸埌鍓嶇
 
-      // }
+    
     }
   }
 

--
Gitblit v1.8.0