From e5e576ab6840b8030a60a1e67fb94728f7ec2ae2 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期三, 24 四月 2024 16:27:03 +0800
Subject: [PATCH] Changes

---
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java |   73 ++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 41 deletions(-)

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 3d693bf..1aa2bdf 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
@@ -18,6 +18,8 @@
 
 import java.util.List;
 
+import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
+
 @Data
 @Service
 public class DownGlassCacheLogic {
@@ -27,28 +29,16 @@
     public static final String RESULT_IN_OUT = "3";
     @Autowired
     private DownStorageCageDetailsMapper selectInfo;
-    private GlassInfoService GlassInfoService;
-    private DownStorageCageDetailsService downStorageCageDetailsService;
+    @Autowired
+    private GlassInfoService glassInfoService;
+    @Autowired
+    private DownStorageCageService downStorageCageService;
+    @Autowired
     private DownGlassTaskService downGlassTaskService;
 
-    /**
-     * @param 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);
-        if (isexist) {
-            //瀛樺湪閫昏緫    1.娣诲姞淇℃伅 2.鍥炲PLC瀛樺湪
-            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
-        } else {
-            //涓嶅瓨鍦ㄩ�昏緫  1.鍥炲PLC涓嶅瓨鍦�
-            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2);
-        }
-    }
+
+
 
     public void process() {
         String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + "";
@@ -78,21 +68,24 @@
      */
 
     public boolean processInto(String Number) {
-        GlassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
+        glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
+        downStorageCageService = WebSocketServer.applicationContext.getBean(DownStorageCageService.class);
+
         //鎸塱d鏌ヨ鐜荤拑淇℃伅琛ㄩ噷鐨勭幓鐠�
-        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
         PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
         //瀛樺湪姝ょ幓鐠冪紪鍙�
         if (GlassInfo != null) {
-            //鍚岄挗鍖栫増鍥惧唴鐨勬爡鏍煎彿
-            List<DownStorageCageDetails> list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth());
+            //鍚岄挗鍖栫増鍥惧唴鐨勬爡鏍煎彿    鎵惧埌鐩稿悓鐗堝浘id骞朵笖澶т簬鍓嶉潰鐨勯『搴忕殑绌烘牸
+            List<DownStorageCageDetails> list = downStorageCageService.getIsExistIntoCacheByLayoutAndSequence(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth());
             //绌烘爡鏍煎彿
             if (list.size() == 0) {
-                list = selectInfo.SelectCacheLeisure();
+                //鏌ヨ绗煎瓙鍐呯┖闂�
+                list = downStorageCageService.getCacheLeisure();
             }
             //灏忎簬姝ょ幓鐠冮挗鍖栫増鍥惧簭鍙风殑鏍呮牸鍙�
             if (list.size() == 0) {
-                list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getWidth());
+                list = downStorageCageService.getIsExistIntoCacheByLayout(GlassInfo.getTemperingLayoutId(), GlassInfo.getWidth());
             }
             if (list.size() > 0) {
                 //瀛樺湪绌烘牸  
@@ -102,6 +95,8 @@
                 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);
+
+               //瀹屾垚鍚庢彃鍏ュ皬鐗囨暟鎹埌缂撳瓨琛�
                 return true;
             }
 
@@ -119,9 +114,13 @@
         String G11 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + "";
         String G13 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + "";
         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> list = downStorageCageService.getCacheOut(1, 5);
+        List<DownStorageCageDetails> list2 = downStorageCageService.getCacheOut(6, 10);
+        List<DownStorageCageDetails> list3 = downStorageCageService.getCacheOut(1, 10);
+        GlassInfo Maxglass=glassInfoService.selectGlassId("2");;
+
         // 浼樺厛 瓒呭嚭灏哄浼樺厛浜哄伐鍑虹墖 浜哄伐澶勭悊
         if (!list3.isEmpty()) {
             DownStorageCageDetails item3 = list3.get(0);
@@ -138,20 +137,18 @@
         }
 
         //鍚屾椂璇锋眰 浼樺厛鍚庣鍑虹墖
-        else if (!list3.isEmpty()) {
+        else if (!list3.isEmpty()&&Maxglass.equals(list3.get(0))) {
             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;
             }
         }
-        // 鎸夌収椤哄簭绗﹀悎鍓嶇鍑虹墖
+        // 鎸夌収澶у皬绗﹀悎鍓嶇鍑虹墖
         else if (!list.isEmpty()) {
             DownStorageCageDetails item = list.get(0);
             if (G06.equals("0") && G11.equals("1")) {
@@ -175,16 +172,10 @@
         }
 
 
-
-
         // 杩斿洖缁撴灉
         return false;
     }
 
-//鏌ヨ鏄惁缁戝畾鏋跺瓙
-//    public boolean selectFlowCardId(String FlowCardId){
-//
-//    }
 
     /**
      * @param Number
@@ -199,7 +190,7 @@
     public boolean selectMessageId(String Number) {
         //鏌ヨ鏄惁瀛樺湪
 
-        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
         if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;
@@ -216,7 +207,7 @@
 
     public boolean deleteMessageId(String Number) {
         //鏌ヨ鏄惁瀛樺湪
-        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
         if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;
@@ -232,7 +223,7 @@
      */
     public boolean isExist(String Number) {
         //鏌ヨ鏄惁瀛樺湪
-        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
+        GlassInfo GlassInfo = glassInfoService.selectGlassId(Number);
         if (GlassInfo == null) {
             //杩斿洖 涓嶅瓨鍦�
             return false;

--
Gitblit v1.8.0