From 609818970fb1e7ae59b2535752a5ea063aa229b0 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期六, 06 七月 2024 15:05:52 +0800
Subject: [PATCH] 1:大理片 新增计算最大宽度:避免高度大于宽度  计算出错 2、磨边前卧式理片新增最小尺寸校验 3、下片修复下片逻辑异常,新增配置 人工下片的最大尺寸   最小尺寸    直通任务的最大尺寸

---
 hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
index 926922a..5aef293 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -66,11 +66,17 @@
     @Value("${mes.sequence.order}")
     private boolean sequenceOrder;
 
-    @Value("${mes.firstLength}")
+    @Value("${mes.max.firstLength}")
     private String firstLength;
 
-    @Value("${mes.secondLength}")
+    @Value("${mes.max.secondLength}")
     private String secondLength;
+
+    @Value("${mes.min.firstLength}")
+    private String minFirstLength;
+
+    @Value("${mes.min.secondLength}")
+    private String minSecondLength;
 
     @Scheduled(fixedDelay = 1000)
     public void plcHomeEdgTask() {
@@ -272,6 +278,10 @@
                         wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
                                 "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
                                 "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+                    } else {
+                        wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+                                "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+                                "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
                     }
                     wrapper.last("order by count(t.glass_id) desc  limit 2");
                     List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
@@ -280,9 +290,13 @@
                                 .selectAll(GlassInfo.class).eq("t.glass_id", glassId);
 //                                .inSql("t.engineer_id", "select engineer_id from engineering where state = 1");
                         if (endcell == Const.A10_OUT_TARGET_POSITION) {
-                            queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
-                                    "case when width < height then width else height end as second_length from glass_info) t1 " +
+                            wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+                                    "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
                                     "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+                        } else {
+                            wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+                                    "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+                                    "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
                         }
                         GlassInfo one = glassInfoService.getOne(queryWrapper);
                         if (one != null) {
@@ -494,10 +508,14 @@
         wrapper.select("count(t.glass_id) as count, t.width, t.height")
                 .eq("t.state", Const.GLASS_STATE_IN)
                 .groupBy("t.width, t.height");
-        if (endcell == Const.A09_OUT_TARGET_POSITION) {
+        if (endcell == Const.A10_OUT_TARGET_POSITION) {
             wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
                     "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
                     "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+        } else {
+            wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+                    "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+                    "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
         }
         wrapper.last("order by count(t.glass_id) desc  limit 2");
         List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
@@ -587,7 +605,7 @@
                 boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), glassInfo.getSlot(), endcell, Const.GLASS_CACHE_TYPE_OUT);
                 log.info("6銆佹坊鍔犲嚭鐗囦换鍔℃槸鍚﹀畬鎴愶細{}", taskCacheStatus);
             }
-            boolean glassSizeStatus = saveGlassSize(glassInfo);
+            boolean glassSizeStatus = saveGlassSize(glassInfo, endcell);
             log.info("7銆佹坊鍔犲嚭鐗囩幓鐠冨昂瀵镐俊鎭埌纾ㄨ竟鍓嶇幓鐠冭〃鏄惁瀹屾垚锛歿}", glassSizeStatus);
             S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1);
             log.info("8銆佸彂閫佺‘璁ゅ瓧宸插畬鎴�");
@@ -620,15 +638,18 @@
      * 娣诲姞鐞嗙墖绗间换鍔�
      *
      * @param glassInfo
+     * @param endcell
      * @return
      */
-    private boolean saveGlassSize(EdgStorageCageDetails glassInfo) {
+    private boolean saveGlassSize(EdgStorageCageDetails glassInfo, int endcell) {
         EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo();
         BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo);
         edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio));
         edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio));
         edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio));
         edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE);
+        edgGlassTaskInfo.setLine(endcell);
+        edgGlassTaskInfo.setTime(new Date());
         return edgGlassTaskInfoService.save(edgGlassTaskInfo);
     }
 

--
Gitblit v1.8.0