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

---
 springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java |   17 +++++
 /dev/null                                                                            |   82 ---------------------------
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java     |    4 
 Albania_Mes-ui/src/views/home/index.vue                                              |   11 ++-
 springboot-vue3/src/main/resources/application.properties                            |    1 
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java          |   50 ++++++----------
 springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java          |    4 +
 7 files changed, 48 insertions(+), 121 deletions(-)

diff --git a/Albania_Mes-ui/src/views/home/index.vue b/Albania_Mes-ui/src/views/home/index.vue
index 6704a34..2ce8306 100644
--- a/Albania_Mes-ui/src/views/home/index.vue
+++ b/Albania_Mes-ui/src/views/home/index.vue
@@ -516,13 +516,14 @@
                     <el-button type="primary" @click="AnewMeasure()" :disabled="SoftEmergencyStopState"
                         style="z-index: 999;">閲嶆柊娴嬮噺</el-button>
                 </div>
+                <br>
                 <!--鏄剧ず-->
-                <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;margin: auto auto;">
+                <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;">
                     <!--鐜荤拑鍥�  #81b337-->
-                    <div :style="'top:10px;bottom: 10px;left: 10px;right: 10px;margin: auto;position:absolute;width:'
-                + (this.LastQueue.glasswidth / 25 * 7) + 'px;height:'
-                + (this.LastQueue.glassheight / 25 * 7) + 'px;line-height: '
-                + (this.LastQueue.glassheight / 25 * 7) + 'px;background-color: #93d2f3;text-align: center;'">
+                    <div :style="'top:10px;bottom: 10px;left: 10px;right: 10px;margin:auto auto;position:absolute;width:'
+                        + (this.LastQueue.glasswidth / 25 * 7) + 'px;height:'
+                        + (this.LastQueue.glassheight / 25 * 7) + 'px;line-height: '
+                        + (this.LastQueue.glassheight / 25 * 7) + 'px;background-color: #93d2f3;text-align: center;'">
                         {{ this.LastQueue.glasswidth }}*{{ this.LastQueue.glassheight }}
                     </div>
 
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
deleted file mode 100644
index 96fd659..0000000
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.example.springboot.component;
-
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Arrays;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-
-import com.example.springboot.common.MessageSender;
-import org.apache.commons.io.FileUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PlcParameter extends Thread {
-
-//  private final MessageSender messageSender;
-//
-//  public PlcParameter(MessageSender messageSender) {
-//    this.messageSender = messageSender;
-//  }
-
-  @Override
-  public void run() {
-    while (this != null) {
-      try {
-//        try {
-//          RabbitMQUtils.sendMessage("Hello, world!", "module_queue");
-//        } catch (Exception e) {
-//          e.printStackTrace();
-//        }
-//        try {
-//          RabbitMQUtils.receiveMessage("module_queue");
-//        } catch (Exception e) {
-//          e.printStackTrace();
-//        }
-//        String message = "Hello, RabbitMQ!";
-//        messageSender.sendMessage(message);
-        Thread.sleep(500);
-
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-      }
-
-
-      JSONObject jsonObject = new JSONObject();
-      jsonObject.put("key1", "value1");
-      jsonObject.put("key2", 123);
-      JSONArray jsonArray = new JSONArray();
-      jsonArray.add("item1");
-      jsonArray.add("item2");
-      jsonObject.put("key3", jsonArray);
-
-      try {
-        // 灏� JSON 瀵硅薄杞崲涓哄瓧绗︿覆骞跺彂閫佸埌闃熷垪
-        RabbitMQUtils.sendJsonMessage(jsonObject, "json_queue");
-      } catch (Exception e) {
-        e.printStackTrace();
-      }
-
-      try {
-        // 浠庨槦鍒楁帴鏀跺苟瑙f瀽 JSON 娑堟伅涓� JSONObject 瀵硅薄
-        JSONObject receivedJsonObject = RabbitMQUtils.receiveJsonMessage(JSONObject.class, "json_queue");
-        System.out.println(receivedJsonObject.toString());
-      } catch (Exception e) {
-        e.printStackTrace();
-      }
-    }
-  }
-
-
-}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 65d9ed9..592c4b3 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -127,39 +127,29 @@
                 // String MesSend=S7control.getinstance().ReadWord("DB14.170", 1).get(0)+"";
 
                 //鑾峰彇娴嬮噺鐨勯暱锛屽
+                boolean istest = false;
+                String PlcRequest = "1";
+                String MesSend = "0";
+                double width = 402;
+                double height = 402;
                 
-                
-                //String url="C:\\Users\\SNG-ZDH-012\\Desktop\\闃垮皵宸村凹浜氭暟鎹姹�.xlsx";E:\
-                //String url="E:\\闃垮皵宸村凹浜氭暟鎹姹�.xlsx";
-                // List result= HomeService.ReadExecl(url);
-                // for(int i=0;i<result.size();i++){
-                //     System.out.println(result.get(i));
-                // }
+                //鍖归厤
+                //System.err.println(PlcRequest+","+MesSend+","+width+","+height);
+                if ("0".equals(PlcRequest)&&istest) {
+                    S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 0);
+                }
+                if ("1".equals(PlcRequest)&&"0".equals(MesSend)) {
+                    boolean is=HomeService.Normal(width, height, "1");
+                    if (is&&istest) {
+                        // 娴嬮噺鎴愬姛
+                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
 
+                    }else if(istest){
+                        // 閲嶆柊娴嬮噺
+                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 4);
+                    }
 
-
-                // String PlcRequest = "1";
-                // String MesSend = "0";
-                // double width = 402;
-                // double height = 402;
-                
-                // //鍖归厤
-                // //System.err.println(PlcRequest+","+MesSend+","+width+","+height);
-                // if ("0".equals(PlcRequest)) {
-                //     S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 0);
-                // }
-                // if ("1".equals(PlcRequest)&&"0".equals(MesSend)) {
-                //     boolean is=HomeService.Normal(width, height, "1");
-                //     if (is) {
-                //         // 娴嬮噺鎴愬姛
-                //         S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
-
-                //     }else{
-                //         // 閲嶆柊娴嬮噺
-                //         S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 4);
-                //     }
-
-                // }
+                }
                 Queue LastQueue= QueueMapper.selectLastQueue();
                 // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
                 // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 40f05a3..d71b64f 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -16,9 +16,9 @@
         // TODO Auto-generated method stub
         //
         System.out.println("鍚姩瀹屾垚");
-        // new PLCAutoMes().start();
+        //new PLCAutoMes().start();
         // new PlcHold().start();
-        // new PlcHoldNew().start();
+        //new PlcHoldNew().start();
 
         new Plchome().start();
         // new PlcLayout().start();
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 65c1980..e7e6bb2 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -312,4 +312,8 @@
   @Select("select * from storage_cage where cage=#{cage} order by id desc")
   List<StorageCage> SelectStorageCageByCage(Integer cage);
 
+  // 娣诲姞鍑虹墖闃熷垪
+  @Insert("INSERT INTO flowcard(`flowcard`, `totaltier`, `number`, `line`, `state`, `method`, `starttime`) "
+                    +" select #{flowcard}, 0, #{number}, 0, 0, 0, now() where 0=( select count(*) from flowcard where flowcard=#{flowcard});")
+  void InsertFlowcard(String flowcard, Integer number);
 }
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 1b0eb51..ee61e88 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
@@ -363,7 +363,8 @@
         List<Map> TypeDatas = homeMapper.SelectType();
         Map<String, String> TypeData = new HashMap<String, String>();// 寰楀埌澶勭悊瀹屽悗鎵�鏈夌殑绫诲瀷
         Map<String, Integer> groupby=new HashMap<String, Integer>(); // 寰楀埌澶勭悊瀹屽悗鎵�鏈夋�诲眰鏁�;
-
+        Map<String, Integer> OrderFinishedProduct=new HashMap<String, Integer>(); // 寰楀埌澶勭悊瀹屽悗璁㈠崟鎴愬搧鎬绘暟閲�;
+        //"order zong 0  1  10  2 10"
         List<Map> RemoveErrorData = IportDataStr.stream()
                 .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null
                         &&
@@ -377,6 +378,17 @@
 
         RemoveErrorData.forEach(item -> {
             String key=item.get("order").toString()+"_"+item.get("matching").toString();
+            String keyCount=item.get("order").toString()+"_"+item.get("matching").toString()+"_"+item.get("tier").toString();
+            String keyCountSum=item.get("order").toString()+"_"+item.get("matching").toString()+"_Sum";//璁㈠崟鎬绘暟
+            if (OrderFinishedProduct.get(keyCount)!=null) {
+                Integer count=OrderFinishedProduct.get(keyCount)+1;
+                Integer sumcount=OrderFinishedProduct.get(keyCountSum)+Integer.parseInt(item.get("quantity").toString());
+                OrderFinishedProduct.put(keyCount,count);
+                OrderFinishedProduct.put(keyCountSum,sumcount);
+            }else if(OrderFinishedProduct.get(keyCount)==null&&groupby.get(key)==null){
+                OrderFinishedProduct.put(keyCount,1);
+                OrderFinishedProduct.put(keyCountSum,Integer.parseInt(item.get("quantity").toString()));
+            }
             if (groupby.get(key)!=null) {
                 Integer Tiers=groupby.get(key)+1;
                 groupby.put(key, Tiers);
@@ -407,7 +419,8 @@
                     Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()),
                     Double.parseDouble(map.get("thickness").toString()),
                     Integer.parseInt(map.get("quantity").toString()),groupby.get(tierkey));// 闇�瑕佽绠楁�诲眰鏁�
-            
+            //璁㈠崟鍐呮�诲眰鏁�
+            homeMapper.InsertFlowcard(map.get("order").toString(),OrderFinishedProduct.get(tierkey+"_Sum")); 
         }
         Map<String, Object> ResultCode = new HashMap<>();
         ResultCode.put("message", "200");
diff --git a/springboot-vue3/src/main/resources/application.properties b/springboot-vue3/src/main/resources/application.properties
index 5f6b5f7..01f54d2 100644
--- a/springboot-vue3/src/main/resources/application.properties
+++ b/springboot-vue3/src/main/resources/application.properties
@@ -6,6 +6,7 @@
 #\u6570\u636E\u5E93\u9A71\u52A8
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 #\u6570\u636E\u5E93\u8FDE\u63A5\u5730\u5740
+#spring.datasource.url=jdbc:mysql://localhost:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
 spring.datasource.url=jdbc:mysql://10.153.19.150:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
 #\u6570\u636E\u5E93\u7528\u6237\u540D
 spring.datasource.username=root

--
Gitblit v1.8.0