From 134c3849c93a849863ae2a7b7013fe04fc554b27 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 27 五月 2024 14:30:53 +0800
Subject: [PATCH] 1、卧式理片笼线程改造:新增层数 总层数 详情表增加工程id 按照玻璃尺寸、膜系、层数、工程等交换玻璃信息 2、websocket漏提代码
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java | 6 +
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java | 7 --
hangzhoumesParent/common/pom.xml | 20 +++++-
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java | 18 -----
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 56 ++++++++++++++----
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java | 10 +++
hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java | 8 --
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 3
hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml | 6 --
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java | 5 +
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java | 11 ---
11 files changed, 81 insertions(+), 69 deletions(-)
diff --git a/hangzhoumesParent/common/pom.xml b/hangzhoumesParent/common/pom.xml
index 951b4ea..9da0bc0 100644
--- a/hangzhoumesParent/common/pom.xml
+++ b/hangzhoumesParent/common/pom.xml
@@ -191,16 +191,26 @@
<version>1.2.33</version>
</dependency>
-<!-- <dependency>-->
-<!-- <groupId>com.github.yulichang</groupId>-->
-<!-- <artifactId>mybatis-plus-join</artifactId>-->
-<!-- <version>1.2.4</version>-->
-<!-- </dependency>-->
+ <!-- <dependency>-->
+ <!-- <groupId>com.github.yulichang</groupId>-->
+ <!-- <artifactId>mybatis-plus-join</artifactId>-->
+ <!-- <version>1.2.4</version>-->
+ <!-- </dependency>-->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.4.12</version>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-websocket</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
+ </dependency>
</dependencies>
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
index 622197a..19cb029 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/entity/OptimizeGlassinfo.java
@@ -43,6 +43,16 @@
private String glassType;
/**
+ * 灞傛暟
+ */
+ private int layer;
+
+ /**
+ * 鎬诲眰鏁�
+ */
+ private int totalLayer;
+
+ /**
* 灏忕墖瀹斤紙鍔犵(閲忥級
*/
private Double pWidth;
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
index 25fada5..f93019e 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -1,6 +1,7 @@
package com.mes.glassinfo.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
+import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.query.MPJQueryWrapper;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.entity.OptimizeGlassinfo;
@@ -11,7 +12,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import com.github.yulichang.base.MPJBaseServiceImpl;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +35,7 @@
List<OptimizeGlassinfo> optimizeGlassinfos=null;
if (engineeringId != null) {
optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>()
- .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id")
+ .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id")
.leftJoin("optimize_detail b on t.project_no=b.project_no")
.eq("t.state",100)
.eq("t.project_no", engineeringId));
@@ -56,6 +56,8 @@
glassInfo.setWidth(map.getWidth());
glassInfo.setHeight(map.getHeight());
glassInfo.setEdgWidth(map.getPWidth());
+ glassInfo.setLayer(map.getLayer());
+ glassInfo.setTotalLayer(map.getTotalLayer());
glassInfo.setEdgHeight(map.getPHeight());
glassInfo.setThickness(map.getGlassThickness());
glassInfo.setPatternSequence(map.getStockId());//
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
index 75f66fe..11ce5dd 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/WebSocketServer.java
@@ -22,12 +22,6 @@
public static ConfigurableApplicationContext applicationContext;
- // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 //浣跨敤鏂规硶
- // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
- public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
- WebSocketServer.applicationContext = configurableApplicationContext;
- }
-
private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
private List<String> messages;
/**
@@ -111,8 +105,6 @@
JSONObject jsonObject = new JSONObject();
jsonObject.set("message", text);
this.messages.add(text);
- this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
-
}
@OnError
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
index 6e85d25..8ec6a5a 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/entity/EdgStorageCageDetails.java
@@ -31,6 +31,11 @@
/**
* 璁惧id
*/
+ private String engineerId;
+
+ /**
+ * 璁惧id
+ */
private Integer deviceId;
/**
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 365eb8d..61a5e69 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
@@ -6,7 +6,6 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.query.MPJQueryWrapper;
import com.mes.common.S7object;
-import com.mes.common.WebSocketServer;
import com.mes.common.config.Const;
import com.mes.device.PlcParameterObject;
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
@@ -19,6 +18,7 @@
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.taskcache.entity.TaskCache;
import com.mes.taskcache.service.TaskCacheService;
+import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -142,37 +142,67 @@
*/
private void inTo(String glassId, String confirmationWrodAddress, String currentSlot) {
log.info("1銆佹寜鐓х幓鐠僫d:{}鑾峰彇鐜荤拑灏忕墖淇℃伅,褰撳墠鏍煎瓙涓�:{}", glassId, currentSlot);
- GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
- //TODO: 鏌ヨ鐜荤拑
- if (glassInfo == null) {
- log.info("2銆佹鐜荤拑缂栧彿涓嶅瓨鍦�");
- return;
- }
- log.info("2銆佽幏鍙栧埌鐨勭幓鐠冧俊鎭负{}", glassInfo);
//娣诲姞杩涚墖浠诲姟 鏌ユ壘绌烘牸
EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot), Boolean.FALSE);
Assert.isTrue(null != nearestEmpty, "鏍煎瓙宸叉弧");
- log.info("3銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
+ log.info("2銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
- log.info("4銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
+ //鏌ヨ鐜荤拑骞惰繘琛屼氦鎹�
+ GlassInfo glassInfo = queryAndChangeGlass(glassId);
+ log.info("3銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
EdgStorageCageDetails details = new EdgStorageCageDetails();
BeanUtils.copyProperties(glassInfo, details);
details.setState(Const.GLASS_STATE_IN);
details.setSlot(nearestEmpty.getSlot());
details.setDeviceId(nearestEmpty.getDeviceId());
edgStorageCageDetailsService.save(details);
- log.info("5銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
+ log.info("4銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
//娣诲姞杩涚墖浠诲姟
boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN);
- log.info("6銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃鏄惁瀹屾垚锛歿}", taskCache);
+ log.info("5銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃鏄惁瀹屾垚锛歿}", taskCache);
S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1);
- log.info("7銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
+ log.info("6銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
}
/**
+ * 鏌ヨ鐜荤拑骞惰繘琛屼氦鎹�
+ *
+ * @param glassId
+ * @return
+ */
+ public GlassInfo queryAndChangeGlass(String glassId) {
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+ Assert.isFalse(null == glassInfo, "鐜荤拑淇℃伅涓嶅瓨鍦�");
+ //鎸夌収鐜荤拑灏哄
+ LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getWidth, glassInfo.getWidth())
+ .eq(GlassInfo::getHeight, glassInfo.getHeight())
+ .eq(GlassInfo::getThickness, glassInfo.getThickness())
+ .eq(GlassInfo::getFilmsid, glassInfo.getFilmsid())
+ .eq(GlassInfo::getTotalLayer, glassInfo.getTotalLayer())
+ .eq(GlassInfo::getLayer, glassInfo.getLayer())
+ .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId())
+ .notInSql(GlassInfo::getGlassId, "select distinct glass_id from edg_storage_cage_details " +
+ "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight())
+ .orderByAsc(GlassInfo::getTemperingLayoutId)
+ .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)
+ .last("Limit 1");
+ GlassInfo swapGlassInfo = glassInfoService.getOne(queryWrapper);
+ if (swapGlassInfo != null && !glassInfo.getGlassId().equals(swapGlassInfo.getGlassId())) {
+ String swapGlassId = swapGlassInfo.getGlassId();
+ swapGlassInfo.setGlassId(glassId);
+ glassInfo.setGlassId(swapGlassId);
+ glassInfoService.updateById(swapGlassInfo);
+ glassInfoService.updateById(glassInfo);
+ return swapGlassInfo;
+ }
+ return glassInfo;
+ }
+
+ /**
* 鍑虹墖浠诲姟
*
* @param out08Glassstate
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
index 1e9a559..f34d1a3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -9,14 +9,13 @@
import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService;
import com.mes.bigstoragetask.service.BigStorageCageOutTaskService;
import com.mes.common.S7object;
-import com.mes.common.WebSocketServer;
import com.mes.device.PlcParameterObject;
import com.mes.edgstoragetask.service.TaskCacheService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.menu.service.SysMenuService;
+import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml b/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
index fcf1a62..c9fd5bc 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
@@ -30,12 +30,6 @@
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-websocket</artifactId>
- </dependency>
-
</dependencies>
<properties>
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
index 9ce9047..fba11e1 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
@@ -1,12 +1,10 @@
package com.mes;
-import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@@ -23,11 +21,8 @@
@EnableScheduling
public class UnLoadGlassApplication {
-
public static void main(String[] args) {
- SpringApplication springApplication = new SpringApplication(UnLoadGlassApplication.class);
- ConfigurableApplicationContext applicationContext = springApplication.run(args);
- WebSocketServer.setApplicationContext(applicationContext);
+ SpringApplication.run(UnLoadGlassApplication.class, args);
}
}
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
index 3cd3349..e5bf336 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -1,23 +1,12 @@
package com.mes.downglassinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downglassinfo.entity.DownGlassInfo;
-import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downglassinfo.service.DownGlassTaskService;
-import com.mes.downworkstation.entity.DownWorkstation;
-import com.mes.downworkstation.mapper.DownWorkstationMapper;
-import com.mes.downworkstation.service.DownWorkstationService;
-import com.mes.downworkstation.service.DownWorkstationTaskService;
-import com.mes.tools.WebSocketServer;
-import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
-
-import java.util.List;
@Service
public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService {
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
index d8361e1..8be3a8d 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
@@ -1,37 +1,23 @@
package com.mes.job;
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.lang.Assert;
-import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.mes.common.S7object;
-import com.mes.common.config.Const;
-import com.mes.device.PlcParameterObject;
import com.mes.downglassinfo.entity.DownGlassInfo;
-import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
+import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downstorage.entity.DownStorageCage;
+import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.service.DownStorageCageDetailsService;
import com.mes.downstorage.service.DownStorageCageService;
import com.mes.downworkstation.entity.DownWorkstation;
-import com.mes.downworkstation.entity.DownWorkstationTask;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.downworkstation.service.DownWorkstationTaskService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
-import com.mes.downglassinfo.entity.DownGlassTask;
-import com.mes.downglassinfo.service.DownGlassTaskService;
-import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
--
Gitblit v1.8.0