From 1577c2e2874c1fad9ac684356bf0e568c3015045 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 27 十一月 2024 09:46:15 +0800
Subject: [PATCH] 1、大理片笼新增进笼规则,计算本工程下所有玻璃的虚拟格子信息,按照虚拟格子,匹配笼内的实际格子,进笼之后查看格子是否有到齐的,执行调度任务 2、卧理修改任务执行顺序,移除捕获异常操作 3、不覆盖原有逻辑,新增opc任务,避免任务重复执行报错
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java | 5
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java | 10
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java | 205 ++++
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-yw.yml | 5
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassInfoService.java | 35
hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/ywChangelog.sql | 43
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassRelationInfoServiceImpl.java | 19
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageTask.java | 46
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassInfoController.java | 18
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassTask.java | 211 +++-
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 75
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java | 5
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassInfoMapper.java | 15
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java | 15
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java | 7
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageRelationDTO.java | 24
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java | 15
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/GlassInfoMapper.java | 4
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java | 214 ++++
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassInfoServiceImpl.java | 167 +++
hangzhoumesParent/common/servicebase/src/main/resources/mapper/GlassInfoMapper.xml | 30
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassInfoService.java | 35
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java | 624 ++++++++++++++
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java | 6
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/BigStorageBaseService.java | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassRelationInfoController.java | 18
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java | 18
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/BigStorageCageHollowDetailsServiceImpl.java | 99 +-
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/BigStorageCageFeedTaskService.java | 3
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassRelationInfoMapper.java | 15
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/mapper/BigStorageCageFeedTaskMapper.java | 2
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassInfo.java | 94 ++
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassRelationInfoService.java | 15
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml | 103 +
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 81 -
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java | 20
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml | 27
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassInfoMapper.java | 15
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassRelationInfo.java | 50 +
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java | 19
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageDTO.java | 6
/dev/null | 5
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageSequenceDTO.java | 17
hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java | 3
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java | 4
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassInfo.java | 74 +
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassRelationInfo.java | 51 +
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/BigStorageCageHollowDetailsService.java | 36
50 files changed, 2,338 insertions(+), 276 deletions(-)
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
index a05dfe6..3e3ac54 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
@@ -183,8 +183,8 @@
public static final Integer TEMPERING_START = 2;
public static final Integer TEMPERING_SUCCESS = 3;
public static final Integer TEMPERING_END = 4;
-// public static final Integer TEMPERING_DAMAGE = 8;
-// public static final Integer TEMPERING_TAKE = 9;
+ public static final Integer TEMPERING_DAMAGE = 8;
+ public static final Integer TEMPERING_TAKE = 9;
/**
* 涓嬬墖
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/GlassInfoMapper.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/GlassInfoMapper.java
index e8b3016..50c2100 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/GlassInfoMapper.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/GlassInfoMapper.java
@@ -3,6 +3,9 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.glassinfo.entity.GlassInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* <p>
@@ -15,4 +18,5 @@
@DS("hangzhoumes")
public interface GlassInfoMapper extends MPJBaseMapper<GlassInfo> {
+ List<GlassInfo> listBySize(@Param("engineerId") String engineerId);
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/xml/GlassInfoMapper.xml b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/xml/GlassInfoMapper.xml
deleted file mode 100644
index 3c9381f..0000000
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/mapper/xml/GlassInfoMapper.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.mes.glassinfo.mapper.GlassInfoMapper">
-
-</mapper>
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
index b2a6af1..8e9eb58 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/glassinfo/service/GlassInfoService.java
@@ -33,7 +33,6 @@
List<Map<String, Object>> getFlowCardId();
-
-
+ List<GlassInfo> listBySize(String engineerId);
}
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 7269cac..487e25f 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
@@ -136,5 +136,10 @@
return result;
}
+ @Override
+ public List<GlassInfo> listBySize(String engineerId) {
+ return baseMapper.listBySize(engineerId);
+ }
+
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/GlassInfoMapper.xml b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/GlassInfoMapper.xml
new file mode 100644
index 0000000..b1952d3
--- /dev/null
+++ b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/GlassInfoMapper.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.mes.glassinfo.mapper.GlassInfoMapper">
+
+ <select id="listBySize" resultType="com.mes.glassinfo.entity.GlassInfo">
+ with glass_list as (
+ SELECT flow_card_id,
+ glass_type,
+ GREATEST(width, height) as width,
+ least(width, height) as height,
+ thickness,
+ filmsid,
+ total_layer,
+ layer,
+ ismultiple,
+ max_width,
+ max_height,
+ tempering_layout_id,
+ tempering_feed_sequence,
+ engineer_id,
+ glass_id
+ FROM glass_info
+ where engineer_id = #{engineerId}
+ )
+ select *
+ from glass_list
+ order by flow_card_id, height desc, width desc, tempering_layout_id, tempering_feed_sequence
+
+ </select>
+</mapper>
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassTask.java
index b9a8248..5745741 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassTask.java
@@ -5,11 +5,12 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
import com.mes.common.config.Const;
-import com.mes.edgglasstaskqueueinfo.entity.EdgGlassTaskQueueInfo;
-import com.mes.edgglasstaskqueueinfo.service.EdgGlassTaskQueueInfoService;
+import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
+import com.mes.edgglasstask.service.EdgGlassTaskInfoService;
import com.mes.edgstoragecage.entity.EdgStorageCage;
import com.mes.edgstoragecage.entity.EdgStorageCageDetails;
import com.mes.edgstoragecage.service.EdgStorageCageDetailsService;
@@ -58,8 +59,11 @@
@Resource
EdgStorageDeviceTaskService edgStorageDeviceTaskService;
- @Resource
- EdgGlassTaskQueueInfoService edgGlassTaskQueueInfoService;
+ // @Resource
+// EdgGlassTaskQueueInfoService edgGlassTaskQueueInfoService;
+ @Autowired
+ EdgGlassTaskInfoService edgGlassTaskInfoService;
+
@Resource
GlassInfoService glassInfoService;
@Resource
@@ -75,11 +79,27 @@
private int threshold;
@Value("${mes.cellLength}")
private int cellLength;
+ @Value("${mes.ratio}")
+ private int ratio;
+ @Value("${mes.min.one.firstLength}")
+ private int minOneFirstLength;
+
+ @Value("${mes.min.one.secondLength}")
+ private int minOneSecondLength;
+
+ @Value("${mes.min.two.firstLength}")
+ private int minTwoFirstLength;
+
+ @Value("${mes.min.two.secondLength}")
+ private int minTwoSecondLength;
+
+ private String glassInIdOne = "";
+ private String glassInIdTwo = "";
private String glassIdOne = "";
private String glassIdTwo = "";
-// @Scheduled(fixedDelay = Long.MAX_VALUE)
+ // @Scheduled(fixedDelay = Long.MAX_VALUE)
// public void startOneOpcTask() throws Exception {
// miloService.subscriptionFromOpcUa(Arrays.asList("mes.WL1.edg_storage_device_one_task[1].task_state"), cacheGlassStartCallback);
// }
@@ -101,7 +121,7 @@
private void startOneOpcTaskChild(String tableName, int device) {
EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(tableName);
- try {
+// try {
if (task == null) {
log.info("浠诲姟琛ㄥ熀纭�鏁版嵁褰曞叆澶辫触锛岃妫�鏌ユ暟鎹槸鍚﹀綍鍏ユ垚鍔�");
return;
@@ -110,35 +130,41 @@
//闃叉鍑虹墖浠诲姟涓旂鍓嶆湁鐜荤拑鐨勬儏鍐碉紝灏嗚繘鐗噄d缃┖锛屽嵆鍑虹墖浠呰�冭檻绗煎唴鐨勭幓鐠�
task.setGlassIdIn("");
}
- int request = task.getTaskState();
+ int request = task.getTaskState();
+ int taskRunning = task.getTaskRunning();
log.info("寮�濮嬫墽琛屼换鍔★紝浠诲姟璇蜂俊鎭负{}", task);
- if (request == 0) {
- log.info("鏈敹鍒颁换鍔¤姹傦紝缁撴潫鏈浠诲姟");
- } else if (request == 1) {
- //杩涚墖浠诲姟
- log.info("杩涚墖浠诲姟锛氳繘鐗囩幓鐠僫d涓猴細{}", task.getGlassIdIn());
+ if (request == 0) {
+ log.info("璁惧锛歿}鐘舵�侊細{}", device, request);
+ log.info("鏈敹鍒颁换鍔¤姹傦紝缁撴潫鏈浠诲姟");
+ } else if (request == 1 && taskRunning == 0) {
+ //杩涚墖浠诲姟
+ log.info("璁惧锛歿}鐘舵�侊細{}", device, request);
+ log.info("杩涚墖浠诲姟锛氳繘鐗囩幓鐠僫d涓猴細{}", task.getGlassIdIn());
+ intoTask(task, tableName, device);
+ } else if (request == 2 && taskRunning == 0) {
+ //鍑虹墖浠诲姟
+ outTask(task, tableName, device);
+ } else if (request == 3 && taskRunning == 0) {
+ //鐩撮�氫换鍔�
+ log.info("璁惧锛歿}鐘舵�侊細{}", device, request);
+ if (!outTask(task, tableName, device)) {
intoTask(task, tableName, device);
- } else if (request == 2) {
- //鍑虹墖浠诲姟
- outTask(task, tableName, device);
- } else if (request == 3) {
- //鐩撮�氫换鍔�
- if (!outTask(task, tableName, device)) {
- intoTask(task, tableName, device);
- }
- } else if (request == 4) {
- log.info("灏嗗惎鍔ㄥ瓙鏀逛负0");
- task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING);
- edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
- } else {
- finishTask(task, tableName);
}
- } catch (Exception e) {
- log.info("鎵ц浠诲姟杩囩▼涓彂鐢熷紓甯革紝浠诲姟瀛梴}锛寋}", task.getTaskState(), e.getMessage());
- log.info("灏嗗惎鍔ㄥ瓙鏀逛负0");
- task.setTaskState(Const.GLASS_CACHE_TYPE_EMPTY);
+ } else if (request == 4) {
+ log.info("璁惧锛歿}鐘舵�侊細{}", device, request);
+ log.info("灏嗗惎鍔ㄥ瓙鏀逛负4");
+ task.setTaskRunning(Const.GLASS_CACHE_TYPE_RUNNING);
edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
+ } else {
+ log.info("璁惧锛歿}鐘舵�侊細{}", device, request);
+ finishTask(task, tableName);
}
+// } catch (Exception e) {
+// log.info("鎵ц浠诲姟杩囩▼涓彂鐢熷紓甯革紝浠诲姟瀛梴}锛寋}", task.getTaskState(), e.getMessage());
+// log.info("灏嗗惎鍔ㄥ瓧鏀逛负0");
+// task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY);
+// edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
+// }
}
@@ -181,11 +207,12 @@
miloService.writeToOpcUa(list);
miloService.writeToOpcWord(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".thickness", (int) glassInfo.getThickness() * 10));
//淇敼纾ㄨ竟瀵瑰垪涓殑纾ㄨ竟绾胯矾鍙婄姸鎬�
- edgGlassTaskQueueInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskQueueInfo>()
- .set(EdgGlassTaskQueueInfo::getLine, cell)
- .set(EdgGlassTaskQueueInfo::getState, Const.EDG_GLASS_START)
- .eq(EdgGlassTaskQueueInfo::getGlassId, glassId)
- .eq(EdgGlassTaskQueueInfo::getState, Const.EDG_GLASS_BEFORE));
+ edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>()
+ .set(EdgGlassTaskInfo::getLine, cell)
+ .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_START)
+ .set(EdgGlassTaskInfo::getUpdateTime, new Date())
+ .eq(EdgGlassTaskInfo::getGlassId, glassId)
+ .eq(EdgGlassTaskInfo::getState, Const.EDG_GLASS_BEFORE));
if (cell == 1) {
glassIdOne = glassId;
} else {
@@ -195,10 +222,33 @@
}
private boolean intoTask(EdgStorageDeviceTask task, String tableName, int deviceId) {
+ Date startDate = new Date();
+ log.info("寮�濮嬫墽琛岃繘鐗囦换鍔★紝浠诲姟淇℃伅涓猴細{},琛ㄥ悕涓猴細{},璁惧id:{},寮�濮嬫椂闂达細{}", task, tableName, deviceId, startDate);
//鑾峰彇鐜荤拑鐨勫熀鏈俊鎭�
GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn()));
if (null == glassInfo) {
log.info("杩涚墖鐜荤拑淇℃伅涓嶅瓨鍦紝鐜荤拑id:{}", task.getGlassIdIn());
+ Date endDate = new Date();
+ log.info("缁撴潫杩涚墖浠诲姟璁惧涓簕}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
+ return Boolean.FALSE;
+ }
+ if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) {
+ log.info("鐜荤拑id涓庝笂娆$浉鍚岋紝绂佹杩涚墖");
+ Date endDate = new Date();
+ log.info("缁撴潫杩涚墖浠诲姟璁惧涓簕}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
+
+ return Boolean.FALSE;
+ }
+ int firstLength = minTwoFirstLength;
+ int secondLength = minTwoSecondLength;
+ if (deviceId == 1) {
+ firstLength = minOneFirstLength;
+ secondLength = minOneSecondLength;
+ }
+ if (Math.max(glassInfo.getWidth(), glassInfo.getHeight()) < firstLength || Math.min(glassInfo.getWidth(), glassInfo.getHeight()) < secondLength) {
+ log.info("杩涚墖鐜荤拑灏哄灏忎簬{}*{}锛岀姝㈣繘绗肩幓鐠僫d:{}锛屽昂瀵镐负{}銆亄}", firstLength, secondLength, task.getGlassIdIn(), glassInfo.getWidth(), glassInfo.getHeight());
+ Date endDate = new Date();
+ log.info("缁撴潫杩涚墖浠诲姟璁惧涓簕}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
return Boolean.FALSE;
}
//鑾峰彇褰撳墠杩涚墖鐜荤拑id鍜岃繘鐗囨牸瀛� 鐩稿悓灏哄鍙互鏀句笅鐨勬牸瀛�
@@ -212,6 +262,8 @@
.ge(EdgStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())).last("order by abs(slot - " + task.getCurrentCell() + ")"));
if (CollectionUtil.isEmpty(storageCageList) || storageCageList.size() == 1) {
log.info("娌℃湁澶氫綑鐨勭┖鏍煎瓙");
+ Date endDate = new Date();
+ log.info("缁撴潫杩涚墖浠诲姟璁惧涓簕}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
return Boolean.FALSE;
}
edgStorageCage = storageCageList.get(0);
@@ -229,13 +281,26 @@
task.setTaskRunning(Const.GLASS_CACHE_TYPE_IN);
edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
saveHistoryTask(task, deviceId);
+ //璁板綍杩涚墖浠诲姟鐨勭幓鐠僫d鐢ㄤ簬涓嬫浠诲姟鐨勬瘮杈冿紝闃叉鍚屼竴鍧楃幓鐠冮噸澶嶆墽琛�
+ if (deviceId == 1) {
+ glassInIdOne = task.getGlassIdIn();
+ } else {
+ glassInIdTwo = task.getGlassIdIn();
+ }
+ edgStorageCageService.update(new UpdateWrapper<EdgStorageCage>()
+ .setSql("remain_width = remain_width -" + (glassGap + Math.max(details.getWidth(), details.getHeight()))).eq("device_id", deviceId)
+ .eq("slot", task.getStartCell()));
+ Date endDate = new Date();
+ log.info("缁撴潫杩涚墖浠诲姟璁惧涓簕}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
return Boolean.TRUE;
}
private boolean outTask(EdgStorageDeviceTask task, String tableName, int deviceId) {
+ Date startDate = new Date();
+ log.info("寮�濮嬫墽琛屽嚭鐗�/鐩撮�氫换鍔★紝浠诲姟淇℃伅涓猴細{},琛ㄥ悕涓猴細{},璁惧id:{},寮�濮嬫椂闂达細{}", task, tableName, deviceId, startDate);
EdgStorageCageDetails edgStorageCageDetails = null;
//绗煎唴鏄増鍥剧浉宸槸鍚﹁秴杩囬槇鍊�
- boolean flag = queryMaxMinDiff(threshold);
+ boolean flag = queryMaxMinDiffByDevice(threshold, deviceId);
if (flag) {
EdgStorageCageDetails minEdgDetails = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>()
.inSql(EdgStorageCageDetails::getSlot, "select slot from edg_storage_cage where enable_state = " + Const.SLOT_ON)
@@ -301,7 +366,17 @@
}
if (edgStorageCageDetails == null && StringUtils.isNotBlank(task.getGlassIdIn())) {
//鍜屼笂娆′换鍔′笉瀛樺湪鐩稿悓灏哄
+ int firstLength = minTwoFirstLength;
+ int secondLength = minTwoSecondLength;
+ if (deviceId == 1) {
+ firstLength = minOneFirstLength;
+ secondLength = minOneSecondLength;
+ }
GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn()));
+ if (Math.max(glassInInfo.getWidth(), glassInInfo.getHeight()) < firstLength || Math.min(glassInInfo.getWidth(), glassInInfo.getHeight()) < secondLength) {
+ log.info("鐩撮�氫换鍔¤繘鐗囩幓鐠冨昂瀵稿皬浜巤}*{}", firstLength, secondLength);
+ return Boolean.FALSE;
+ }
edgStorageCageDetails = new EdgStorageCageDetails();
BeanUtils.copyProperties(glassInInfo, edgStorageCageDetails);
}
@@ -317,6 +392,10 @@
return Boolean.FALSE;
}
log.info("5銆佺洿閫氫换鍔�,灏嗙幓鐠冧俊鎭彃鍏ュ崸寮忕悊鐗囩,褰撳墠鐜荤拑淇℃伅:{}", edgStorageCageDetails);
+ if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) {
+ log.info("鐜荤拑id涓庝笂娆$浉鍚岋紝绂佹杩涚墖");
+ return Boolean.FALSE;
+ }
//鐜荤拑淇℃伅鏇挎崲
String glassIdChange = queryAndChangeGlass(glassId);
//澶勭悊鍦ㄥ崸鐞嗗唴鐨勭幓鐠冧俊鎭細绗煎唴鐨勬暟鎹鐞�
@@ -368,46 +447,56 @@
edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
saveHistoryTask(task, deviceId);
+ //璁板綍鐩撮�氫换鍔$殑鐜荤拑id鐢ㄤ簬涓嬫浠诲姟鐨勬瘮杈冿紝闃叉鍚屼竴鍧楃幓鐠冮噸澶嶆墽琛�
+ if (3 == task.getTaskState()) {
+ if (deviceId == 1) {
+ glassInIdOne = edgStorageCageDetails.getGlassId();
+ } else {
+ glassInIdTwo = edgStorageCageDetails.getGlassId();
+ }
+ }
//鏇存柊璇︽儏琛ㄤ换鍔″嚭鐗囦腑
edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>()
.set(EdgStorageCageDetails::getState, Const.GLASS_STATE_OUT)
.eq(EdgStorageCageDetails::getGlassId, edgStorageCageDetails.getGlassId()));
//纾ㄨ竟瀵瑰垪琛ㄦ柊澧炰竴鏉℃暟鎹�
- EdgGlassTaskQueueInfo edgInfo = new EdgGlassTaskQueueInfo();
- BeanUtils.copyProperties(task, edgInfo);
- edgInfo.setGlassId(edgStorageCageDetails.getGlassId());
- edgInfo.setCreateTime(new Date());
- edgInfo.setWidth((int) edgStorageCageDetails.getWidth());
- edgInfo.setHeight((int) edgStorageCageDetails.getHeight());
- edgInfo.setThickness((int) edgStorageCageDetails.getThickness());
- edgInfo.setState(Const.EDG_GLASS_BEFORE);
- edgGlassTaskQueueInfoService.save(edgInfo);
+ saveGlassSize(edgStorageCageDetails);
+// edgStorageCageService.update(new UpdateWrapper<EdgStorageCage>()
+// .setSql("remain_width = remain_width +" + Math.max(edgStorageCageDetails.getWidth(), edgStorageCageDetails.getHeight()))
+// .eq("device_id", deviceId)
+// .eq("slot", task.getStartCell()));
+ Date endDate = new Date();
+ log.info("缁撴潫鍑虹墖/鐩撮�氫换鍔¤澶囦负{}锛岀粨鏉熸椂闂翠负锛歿}锛屽叡鑰楁椂锛歿}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
return Boolean.TRUE;
}
private boolean finishTask(EdgStorageDeviceTask task, String tableName) {
- log.info("褰撳墠浠诲姟淇℃伅涓猴細{}", task);
- if (task.getTaskState() <= 4 && task.getTaskRunning() == 0) {
+ if (task.getTaskState() <= 4) {
log.info("鏈夋鍦ㄦ墽琛岀殑浠诲姟鎴栬繖浠诲姟宸叉墽琛屼换鍔$姸鎬亄}锛屼换鍔″惎鍔ㄦ儏鍐祘}锛岀粨鏉�", task.getTaskState(), task.getTaskRunning());
return Boolean.FALSE;
}
+ Date startDate = new Date();
+ log.info("寮�濮嬫墽琛屽畬鎴愪换鍔″悗娓呴櫎鍔ㄤ綔锛屼换鍔′俊鎭负锛歿},琛ㄥ悕涓猴細{},寮�濮嬫椂闂达細{}", task, tableName, startDate);
Integer cell = task.getStartCell();
Integer state = task.getTaskState();
task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY);
- String glassIdOut = task.getGlassIdOut();
task.setGlassIdOut("");
task.setStartCell(0);
- edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
+
EdgStorageDeviceTaskHistory taskHistory = edgStorageDeviceTaskHistoryService.getOne(new LambdaQueryWrapper<EdgStorageDeviceTaskHistory>()
.eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW)
.orderByDesc(EdgStorageDeviceTaskHistory::getCreateTime).last("limit 1"));
+ int device = tableName.equals("edg_storage_device_one_task") ? 1 : 2;
+ updateCellRemainWidth(cell, device, taskHistory);
edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>()
.eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW)
.set(EdgStorageDeviceTaskHistory::getTaskState,
Const.GLASS_CACHE_TYPE_FINISH.equals(state) ? Const.RAW_GLASS_TASK_SUCCESS : Const.RAW_GLASS_TASK_FAILURE)
);
- int device = tableName.equals("edg_storage_device_one_task") ? 1 : 2;
- updateCellRemainWidth(cell, device, taskHistory);
+ //鏈�鍚庢洿鏂颁换鍔★紝淇濊瘉浠诲姟鍓嶇殑鍔ㄤ綔閮藉仛瀹�
+ edgStorageDeviceTaskService.updateTaskMessage(tableName, task);
+ Date endDate = new Date();
+ log.info("缁撴潫瀹屾垚浠诲姟鍚庢竻闄ゅ姩浣滐紝琛ㄥ悕涓猴細{},缁撴潫鏃堕棿涓猴細{}锛屽叡鑰楁椂锛歿}ms", tableName, endDate, endDate.getTime() - startDate.getTime());
return Boolean.TRUE;
}
@@ -497,11 +586,12 @@
*
* @return
*/
- public boolean queryMaxMinDiff(int threshold) {
+ public boolean queryMaxMinDiffByDevice(int threshold, int deviceId) {
//鑾峰彇绗煎瓙鍐呮渶澶х増鍥緄d鍜屾渶灏忕増鍥緄d鎻掑�硷紝鍒ゆ柇鏄惁澶т簬闃堝�硷紝澶т簬闃堝�肩洿鎺ュ嚭鏈�灏忕増鍥剧幓鐠�
QueryWrapper<EdgStorageCageDetails> queryWrapper = new QueryWrapper<>();
queryWrapper.select("max(tempering_layout_id)-min(tempering_layout_id) as diff")
.eq("state", Const.GLASS_STATE_IN)
+ .eq("device_id", deviceId)
.inSql("slot", "select slot from edg_storage_cage where enable_state = " + Const.SLOT_ON);
List<Object> list = edgStorageCageDetailsService.listObjs(queryWrapper);
//鑾峰彇绗煎唴鐜荤拑鐗堝浘宸�兼槸鍚﹀ぇ浜庨槇鍊�
@@ -536,6 +626,9 @@
.eq(EdgStorageCage::getDeviceId, device).eq(EdgStorageCage::getSlot, slot));
EdgStorageCageDetails bigDetails = list.stream().filter(e -> e.getGlassId().equals(taskHistory.getGlassIdIn())).findFirst().orElse(null);
remainWidth = storageCage.getRemainWidth() - glassGap - (int) Math.max(bigDetails.getWidth(), bigDetails.getHeight());
+ if (remainWidth <= 0) {
+ remainWidth = 0;
+ }
}
}
edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>().
@@ -543,6 +636,20 @@
return Boolean.TRUE;
}
+ private boolean saveGlassSize(EdgStorageCageDetails glassInfo) {
+ 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.setState(Const.EDG_GLASS_BEFORE);
+ edgGlassTaskInfo.setCreateTime(new Date());
+ edgGlassTaskInfo.setUpdateTime(new Date());
+ //鍏堝皢鍘嗗彶瀵瑰垪琛ㄤ腑鏈幓鐠冪殑鏁版嵁鍒犻櫎锛岄噸鏂版柊澧炰竴浠芥渶鏂扮殑鏁版嵁
+ edgGlassTaskInfoService.remove(new LambdaQueryWrapper<EdgGlassTaskInfo>().eq(EdgGlassTaskInfo::getGlassId, glassInfo.getGlassId()));
+ return edgGlassTaskInfoService.save(edgGlassTaskInfo);
+ }
+
private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
return ReadWriteEntity.builder()
.identifier(identifier)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
index bd2e2de..b069d57 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
@@ -106,6 +106,13 @@
return Result.build(200, "鏌ヨ鎴愬姛", bigStorageCageDetailsService.selectTemperingGlass());
}
+ @ApiOperation("鏄惁璋冨害寮�鍏�")
+ @PostMapping("/dispatchSwitch")
+ public Result dispatchSwitch(Boolean flag) {
+ bigStorageCageDetailsService.dispatchSwitch(flag);
+ return Result.build(200, "淇敼鎴愬姛", redisUtil.getCacheObject("dispatchSwitch"));
+ }
+
@ApiOperation("鏄惁閽㈠寲寮�鍏�")
@PostMapping("/temperingSwitch")
public Result temperingSwitch(Boolean flag) {
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassInfoController.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassInfoController.java
new file mode 100644
index 0000000..ad1c7f3
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassInfoController.java
@@ -0,0 +1,18 @@
+package com.mes.bigstorage.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * (BigStorageGlassInfo)琛ㄦ帶鍒跺眰
+ *
+ * @author makejava
+ * @since 2024-11-24 10:15:34
+ */
+@RestController
+@RequestMapping("bigStorageGlassInfo")
+public class BigStorageGlassInfoController {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassRelationInfoController.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassRelationInfoController.java
new file mode 100644
index 0000000..54ce5a4
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageGlassRelationInfoController.java
@@ -0,0 +1,18 @@
+package com.mes.bigstorage.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * (BigStorageGlassRelationInfo)琛ㄦ帶鍒跺眰
+ *
+ * @author makejava
+ * @since 2024-11-24 10:17:42
+ */
+@RestController
+@RequestMapping("bigStorageGlassRelationInfo")
+public class BigStorageGlassRelationInfoController {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassInfo.java
new file mode 100644
index 0000000..39fa8c0
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassInfo.java
@@ -0,0 +1,74 @@
+package com.mes.bigstorage.entity;
+
+import lombok.Data;
+
+/**
+ * (BigStorageGlassInfo)琛ㄥ疄浣撶被
+ *
+ * @author makejava
+ * @since 2024-11-24 10:15:35
+ */
+@Data
+public class BigStorageGlassInfo {
+ /**
+ * /*澶х悊鐗囩淇℃伅琛╥d
+ */
+ private Long id;
+ /**
+ * /*鐜荤拑id
+ */
+ private String glassId;
+ /**
+ * /*娴佺▼鍗″彿
+ */
+ private String flowCardId;
+ /**
+ * /*鐜荤拑绫诲瀷
+ */
+ private Integer glassType;
+ /**
+ * /*瀹�
+ */
+ private Double width;
+ /**
+ * /*楂�
+ */
+ private Double height;
+ /**
+ * /*鍘氬害
+ */
+ private Double thickness;
+ /**
+ * /*閽㈠寲鐗堝浘id
+ */
+ private Integer temperingLayoutId;
+ /**
+ * /*閽㈠寲鐗堝浘鐗囧簭
+ */
+ private Integer temperingFeedSequence;
+ /**
+ * /*x鍧愭爣
+ */
+ private Integer xCoordinate;
+ /**
+ * /*y鍧愭爣
+ */
+ private Integer yCoordinate;
+
+ private String engineerId;
+ /**
+ * /*灞傚彿
+ */
+ private Integer layer;
+ /**
+ * /*铏氭嫙鏍煎瓙鍙�
+ */
+ private Integer virtualSlot;
+ /**
+ * /*鏍煎瓙娆″簭
+ */
+ private Integer slotSequence;
+
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassRelationInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassRelationInfo.java
new file mode 100644
index 0000000..ccc1fd5
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageGlassRelationInfo.java
@@ -0,0 +1,50 @@
+package com.mes.bigstorage.entity;
+
+import lombok.Data;
+
+/**
+ * (BigStorageGlassRelationInfo)琛ㄥ疄浣撶被
+ *
+ * @author makejava
+ * @since 2024-11-24 10:17:43
+ */
+@Data
+public class BigStorageGlassRelationInfo {
+ /**
+ * /*閽㈠寲鐜荤拑鍏崇郴琛╥d
+ */
+ private Long id;
+
+ private String engineerId;
+ /**
+ * /*鐜荤拑id
+ */
+ private String glassId;
+ /**
+ * /*閽㈠寲鐗堝浘id
+ */
+ private Integer temperingLayoutId;
+ /**
+ * /*閽㈠寲鐗堝浘鐗囧簭
+ */
+ private Integer temperingFeedSequence;
+ /**
+ * /*铏氭嫙鏍煎瓙
+ */
+ private Integer virtualSlot;
+ /**
+ * /*鏍煎瓙鍐呮搴�
+ */
+ private Integer slotSequence;
+ /**
+ * /*瀹為檯绗煎瓙鍙�
+ */
+ private Integer deviceId;
+ /**
+ * /*瀹為檯鏍煎瓙鍙�
+ */
+ private Integer slot;
+
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageDTO.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageDTO.java
similarity index 78%
rename from hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageDTO.java
rename to hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageDTO.java
index 465c7a2..decf3f3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageDTO.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageDTO.java
@@ -1,4 +1,4 @@
-package com.mes.bigstorage.entity;
+package com.mes.bigstorage.entity.dto;
import lombok.Data;
@@ -27,4 +27,8 @@
* 绗煎瓙鍙�
*/
private Integer deviceId;
+ /**
+ * 搴忓彿
+ */
+ private Integer slotSequence;
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageRelationDTO.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageRelationDTO.java
new file mode 100644
index 0000000..9ab2385
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageRelationDTO.java
@@ -0,0 +1,24 @@
+package com.mes.bigstorage.entity.dto;
+
+import lombok.Data;
+
+/**
+ * @Author : zhoush
+ * @Date: 2024/11/25 18:53
+ * @Description:
+ */
+@Data
+public class BigStorageRelationDTO {
+
+
+ private String engineerId;
+ /**
+ * /*閽㈠寲鐗堝浘id
+ */
+ private Integer temperingLayoutId;
+ /**
+ * /*铏氭嫙鏍煎瓙
+ */
+ private Integer virtualSlot;
+
+}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageSequenceDTO.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageSequenceDTO.java
new file mode 100644
index 0000000..a976537
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/BigStorageSequenceDTO.java
@@ -0,0 +1,17 @@
+package com.mes.bigstorage.entity.dto;
+
+import lombok.Data;
+
+/**
+ * @Author : zhoush
+ * @Date: 2024/11/25 18:53
+ * @Description:
+ */
+@Data
+public class BigStorageSequenceDTO {
+
+ private Integer slot;
+ private Integer maxSequence;
+ private Integer minSequence;
+
+}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
index 4627118..8c0306f 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
@@ -2,6 +2,8 @@
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.bigstorage.entity.BigStorageCageDetails;
+import com.mes.bigstorage.entity.dto.BigStorageRelationDTO;
+import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
@@ -47,4 +49,8 @@
void updateBySlot(@Param(value = "list") List<UpdateBigStorageCageDTO> glassList, @Param(value = "state") int state);
List<Map<String, Object>> selectTemperingGlassCount();
+
+ List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot();
+
+ List<BigStorageSequenceDTO> queryNeedDispatchSlot(BigStorageRelationDTO bigStorageRelationDTO);
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassInfoMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassInfoMapper.java
new file mode 100644
index 0000000..5516c61
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassInfoMapper.java
@@ -0,0 +1,15 @@
+package com.mes.bigstorage.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.bigstorage.entity.BigStorageGlassInfo;
+
+/**
+ * (BigStorageGlassInfo)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author makejava
+ * @since 2024-11-24 10:15:34
+ */
+public interface BigStorageGlassInfoMapper extends BaseMapper<BigStorageGlassInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassRelationInfoMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassRelationInfoMapper.java
new file mode 100644
index 0000000..0b27fa0
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageGlassRelationInfoMapper.java
@@ -0,0 +1,15 @@
+package com.mes.bigstorage.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.bigstorage.entity.BigStorageGlassRelationInfo;
+
+/**
+ * (BigStorageGlassRelationInfo)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author makejava
+ * @since 2024-11-24 10:17:43
+ */
+public interface BigStorageGlassRelationInfoMapper extends BaseMapper<BigStorageGlassRelationInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
index 8daa7b7..74183c1 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
@@ -2,9 +2,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
-import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
-import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
+import com.mes.bigstorage.entity.dto.*;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.glassinfo.entity.GlassInfo;
@@ -78,4 +76,10 @@
String temperingSwitch(Boolean flag);
void appointEngineerId(String engineerId);
+
+ List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot();
+
+ List<BigStorageSequenceDTO> dispatchBigStorageGlassInfo(BigStorageRelationDTO bigStorageRelationDTO);
+
+ String dispatchSwitch(Boolean flag);
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassInfoService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassInfoService.java
new file mode 100644
index 0000000..52e7eb8
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassInfoService.java
@@ -0,0 +1,35 @@
+package com.mes.bigstorage.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mes.bigstorage.entity.BigStorageGlassInfo;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
+
+/**
+ * (BigStorageGlassInfo)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author makejava
+ * @since 2024-11-24 10:15:35
+ */
+public interface BigStorageGlassInfoService extends IService<BigStorageGlassInfo> {
+
+ /**
+ * 鎸夌収鐜荤拑id鑾峰彇涓┖鐩爣鏍煎瓙
+ *
+ * @return
+ */
+ BigStorageDTO queryBigStorageTargetSlot(String glassId);
+
+ /**
+ * 鐢熸垚涓┖鐜荤拑淇℃伅
+ */
+ void generateBigStorageGlassInfo(String glassId);
+
+ /**
+ * 鏍煎瓙閰嶅
+ *
+ * @param bigStorageGlassInfo
+ * @return
+ */
+ int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo);
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassRelationInfoService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassRelationInfoService.java
new file mode 100644
index 0000000..5f5e821
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageGlassRelationInfoService.java
@@ -0,0 +1,15 @@
+package com.mes.bigstorage.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mes.bigstorage.entity.BigStorageGlassRelationInfo;
+
+/**
+ * (BigStorageGlassRelationInfo)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author makejava
+ * @since 2024-11-24 10:17:43
+ */
+public interface BigStorageGlassRelationInfoService extends IService<BigStorageGlassRelationInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
index ee80460..1f82904 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -8,9 +8,7 @@
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
-import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
-import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
+import com.mes.bigstorage.entity.dto.*;
import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
@@ -432,6 +430,12 @@
}
@Override
+ public String dispatchSwitch(Boolean flag) {
+ redisUtil.setCacheObject("dispatchSwitch", flag);
+ return "success";
+ }
+
+ @Override
public String temperingSwitch(Boolean flag) {
redisUtil.setCacheObject("temperingSwitch", flag);
return "success";
@@ -441,4 +445,14 @@
public void appointEngineerId(String engineerId) {
redisUtil.setCacheObject("temperingengineerId", engineerId);
}
+
+ @Override
+ public List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot() {
+ return baseMapper.queryIsAllNeedDispatchVirtualSlot();
+ }
+
+ @Override
+ public List<BigStorageSequenceDTO> dispatchBigStorageGlassInfo(BigStorageRelationDTO bigStorageRelationDTO) {
+ return baseMapper.queryNeedDispatchSlot(bigStorageRelationDTO);
+ }
}
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
new file mode 100644
index 0000000..5b683fa
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
@@ -0,0 +1,214 @@
+package com.mes.bigstorage.service.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.lang.Assert;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.bigstorage.entity.BigStorageCage;
+import com.mes.bigstorage.entity.BigStorageCageDetails;
+import com.mes.bigstorage.entity.BigStorageGlassInfo;
+import com.mes.bigstorage.entity.BigStorageGlassRelationInfo;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageRelationDTO;
+import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO;
+import com.mes.bigstorage.mapper.BigStorageGlassInfoMapper;
+import com.mes.bigstorage.service.BigStorageCageDetailsService;
+import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.bigstorage.service.BigStorageGlassInfoService;
+import com.mes.bigstorage.service.BigStorageGlassRelationInfoService;
+import com.mes.common.config.Const;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * (BigStorageGlassInfo)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author makejava
+ * @since 2024-11-24 10:15:35
+ */
+@Service
+@Slf4j
+public class BigStorageGlassInfoServiceImpl extends ServiceImpl<BigStorageGlassInfoMapper, BigStorageGlassInfo> implements BigStorageGlassInfoService {
+ @Resource
+ GlassInfoService glassInfoService;
+ @Resource
+ BigStorageCageService bigStorageCageService;
+ @Resource
+ BigStorageCageDetailsService bigStorageCageDetailsService;
+ @Resource
+ BigStorageGlassRelationInfoService bigStorageGlassRelationInfoService;
+ @Value("${mes.slotWidth}")
+ private Integer slotWidth;
+ @Value("${mes.glassGap}")
+ private Integer glassGap;
+
+ @Override
+ public BigStorageDTO queryBigStorageTargetSlot(String glassId) {
+ //鎸夌収鐜荤拑淇℃伅鑾峰彇鍏崇郴琛ㄦ槸鍚︽湁瀵瑰簲鐨勫叧绯�
+ BigStorageGlassRelationInfo relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>()
+ .eq(BigStorageGlassRelationInfo::getGlassId, glassId));
+ if (relationInfoOne == null) {
+ //鐞嗙墖绗煎叧绯昏〃涓病鏈夊搴旂殑鏁版嵁锛屾煡鐪嬬悊鐗囩铏氭嫙浣嶇疆琛ㄦ槸鍚︽湁鏈伐绋嬩笅鐨勬墍鏈夌幓鐠冭櫄鎷熶俊鎭�
+ BigStorageGlassInfo bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>().eq(BigStorageGlassInfo::getGlassId, glassId));
+ if (null == bigStorageGlassInfo) {
+ //铏氭嫙浣嶇疆琛ㄦ病鏈夋湰宸ョ▼涓嬬殑鎵�鏈夌幓鐠冭櫄鎷熶俊鎭紝鎸夌収鐜荤拑id鐢熸垚鏈伐绋嬩笅鎵�鏈夌幓鐠冪殑铏氭嫙淇℃伅
+ generateBigStorageGlassInfo(glassId);
+ bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>().eq(BigStorageGlassInfo::getGlassId, glassId));
+ }
+ //鎸夌収铏氭嫙浣嶇疆鍜屽ぇ鐞嗙墖绗肩幇鏈夊彲鐢ㄦ牸瀛愮敓鎴愬叧绯昏〃
+ bigStorageSlotPair(bigStorageGlassInfo);
+ //鍏崇郴琛ㄨ幏鍙栧疄闄呬綅缃�
+ relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>()
+ .eq(BigStorageGlassRelationInfo::getGlassId, glassId));
+ }
+ BigStorageCageDetails bigStorageCageDetails = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getSlot, relationInfoOne.getSlot()).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
+ .orderByDesc(BigStorageCageDetails::getSequence).last("limit 1"));
+ if (null == bigStorageCageDetails) {
+ BigStorageDTO storageDTO = new BigStorageDTO();
+ storageDTO.setDeviceId(relationInfoOne.getDeviceId());
+ storageDTO.setSlot(relationInfoOne.getSlot());
+ storageDTO.setSlotSequence(relationInfoOne.getSlotSequence());
+ storageDTO.setWidth(slotWidth);
+ return storageDTO;
+ }
+ BigStorageGlassRelationInfo relationInfoBefore = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>()
+ .eq(BigStorageGlassRelationInfo::getEngineerId, relationInfoOne.getEngineerId())
+ .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, relationInfoOne.getTemperingLayoutId())
+ .eq(BigStorageGlassRelationInfo::getVirtualSlot, relationInfoOne.getVirtualSlot())
+ .eq(BigStorageGlassRelationInfo::getSlotSequence, relationInfoOne.getSlotSequence() - 1));
+ BigStorageCage storageCage = null;
+ if (null == relationInfoBefore) {
+ //琛ㄧず搴忓彿娌℃湁鎴栬�� 搴忓彿涓�1鍙堜笉鏄涓�鍧楁潵鐨� 鏂板紑涓�鏍�
+ storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+ .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+ } else {
+ BigStorageCageDetails beforeGlass = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO).eq(BigStorageCageDetails::getGlassId, relationInfoBefore.getGlassId())
+ );
+ if (null == beforeGlass) {
+ storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+ .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+ } else {
+ storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+ .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getSlot, beforeGlass.getSlot()));
+ }
+ }
+ Assert.isTrue(null != storageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
+ BigStorageDTO storageDTO = new BigStorageDTO();
+ storageDTO.setDeviceId(storageCage.getDeviceId());
+ storageDTO.setSlotSequence(relationInfoOne.getSlotSequence());
+ storageDTO.setSlot(storageCage.getSlot());
+ storageDTO.setWidth(storageCage.getRemainWidth());
+ return storageDTO;
+ }
+
+ public void dispatchBigStorageSlot() {
+ //todo:鑾峰彇绗煎唴鍗曟牸宸茬粡鍒伴綈鐨勭幓鐠冩牸瀛愪俊鎭�
+ List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot();
+ if (CollectionUtil.isEmpty(virtualList)) {
+ log.info("娌℃湁闇�瑕佽皟搴︾殑鏍煎瓙");
+ }
+ for (BigStorageRelationDTO dto : virtualList) {
+ List<BigStorageSequenceDTO> sequenceDTOList = bigStorageCageDetailsService.dispatchBigStorageGlassInfo(dto);
+ if (CollectionUtil.isEmpty(sequenceDTOList) || sequenceDTOList.size() == 1) {
+ continue;
+ }
+ int sequence = 0;
+ int startSlot = 0;
+ int targetSlot = 0;
+ for (BigStorageSequenceDTO item : sequenceDTOList) {
+ if (item.getMinSequence() == sequence + 1) {
+ //鐢熸垚璋冨害浠诲姟
+ startSlot = item.getSlot();
+ break;
+ }
+ sequence = item.getMaxSequence();
+ targetSlot = item.getSlot();
+ }
+ }
+ //
+ }
+
+ @Override
+ public void generateBigStorageGlassInfo(String glassId) {
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+ List<BigStorageGlassInfo> list = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>()
+ .eq(BigStorageGlassInfo::getEngineerId, glassInfo.getEngineerId()).eq(BigStorageGlassInfo::getTemperingLayoutId, glassInfo.getTemperingLayoutId()));
+ if (CollectionUtil.isNotEmpty(list)) {
+ return;
+ }
+// Engineering engineering = engineeringMapper.selectOne(new LambdaQueryWrapper<Engineering>()
+// .eq(Engineering::getEngineerId, glassInfo.getEngineerId()));
+ //鑾峰彇鐜荤拑鐨勫伐绋媔d锛屾寜鐓у伐绋媔d鑾峰彇宸ョ▼涓嬬殑鎵�鏈夌幓鐠冧俊鎭�
+ List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId())
+ .orderByAsc(GlassInfo::getTemperingLayoutId).orderByAsc(GlassInfo::getTemperingFeedSequence));
+ Map<Integer, List<GlassInfo>> trmperingIdMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getTemperingLayoutId));
+ List<BigStorageGlassInfo> bigStorageGlassInfoList = new ArrayList<>();
+ //鏂瑰紡涓�锛氬皢鐜荤拑鎸夌増鍥俱�佺増搴� 渚濇鐢熸垚铏氭嫙鏍煎瓙淇℃伅锛屾牸瀛愪竴鐩村線鍚庣疮鍔�
+ trmperingIdMap.forEach((e, v) -> {
+ int remainWidth = slotWidth;
+ int slotNumber = 1;
+ int slotSequence = 1;
+ for (GlassInfo item : v) {
+ int maxLength = (int) Math.max(item.getWidth(), item.getHeight());
+ if (remainWidth > maxLength) {
+ remainWidth = remainWidth - maxLength - glassGap;
+ } else {
+ slotNumber = slotNumber + 1;
+ slotSequence = 1;
+ remainWidth = slotWidth - maxLength - glassGap;
+ }
+ BigStorageGlassInfo bigStorage = new BigStorageGlassInfo();
+ BeanUtils.copyProperties(item, bigStorage);
+ bigStorage.setVirtualSlot(slotNumber);
+ bigStorage.setSlotSequence(slotSequence++);
+ bigStorage.setId(null);
+ bigStorageGlassInfoList.add(bigStorage);
+ }
+ });
+ this.saveBatch(bigStorageGlassInfoList);
+ log.info("鍒嗛厤瀹屾瘯");
+
+ }
+
+ @Override
+ public int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo) {
+ //鑾峰彇鎵�鏈夌┖闂插彲鐢ㄧ殑鏍煎瓙鍙�
+ BigStorageCage storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+ .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+ Assert.isTrue(null != storageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
+ Integer slot = storageCage.getSlot();
+ //鑾峰彇璇ュ伐绋嬪悓涓�娴佺▼鍗″悓涓�杞︾殑鐜荤拑淇℃伅
+ List<BigStorageGlassInfo> bigStorageGlassInfoList = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>()
+ .eq(BigStorageGlassInfo::getEngineerId, bigStorageGlassInfo.getEngineerId())
+ .eq(BigStorageGlassInfo::getTemperingLayoutId, bigStorageGlassInfo.getTemperingLayoutId())
+ .eq(BigStorageGlassInfo::getVirtualSlot, bigStorageGlassInfo.getVirtualSlot()));
+ //璁剧疆鍏崇郴琛ㄧ殑瀹為檯鏍煎瓙鍙�
+ List<BigStorageGlassRelationInfo> relationInfoList = bigStorageGlassInfoList.stream().map(e -> {
+ BigStorageGlassRelationInfo info = new BigStorageGlassRelationInfo();
+ BeanUtils.copyProperties(e, info);
+ info.setSlot(slot);
+ info.setDeviceId(storageCage.getDeviceId());
+ return info;
+ }).collect(Collectors.toList());
+ //淇濆瓨鍏崇郴琛�
+ bigStorageGlassRelationInfoService.saveBatch(relationInfoList);
+ //杩斿洖鏍煎瓙淇℃伅
+ return slot;
+ }
+
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassRelationInfoServiceImpl.java
new file mode 100644
index 0000000..19620ca
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassRelationInfoServiceImpl.java
@@ -0,0 +1,19 @@
+package com.mes.bigstorage.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.bigstorage.entity.BigStorageGlassRelationInfo;
+import com.mes.bigstorage.mapper.BigStorageGlassRelationInfoMapper;
+import com.mes.bigstorage.service.BigStorageGlassRelationInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * (BigStorageGlassRelationInfo)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author makejava
+ * @since 2024-11-24 10:17:43
+ */
+@Service
+public class BigStorageGlassRelationInfoServiceImpl extends ServiceImpl<BigStorageGlassRelationInfoMapper, BigStorageGlassRelationInfo> implements BigStorageGlassRelationInfoService {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/mapper/BigStorageCageFeedTaskMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/mapper/BigStorageCageFeedTaskMapper.java
index 0256f9e..32df294 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/mapper/BigStorageCageFeedTaskMapper.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/mapper/BigStorageCageFeedTaskMapper.java
@@ -2,7 +2,7 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.base.MPJBaseMapper;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import org.apache.ibatis.annotations.Param;
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/BigStorageCageFeedTaskService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/BigStorageCageFeedTaskService.java
index 40e1827..6b504a9 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/BigStorageCageFeedTaskService.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/BigStorageCageFeedTaskService.java
@@ -1,9 +1,8 @@
package com.mes.bigstoragetask.service;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.github.yulichang.base.MPJBaseService;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import java.util.List;
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java
index 262cc3f..4493d6f 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper;
import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService;
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
new file mode 100644
index 0000000..b4ef20b
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -0,0 +1,18 @@
+package com.mes.hollow.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * (HollowGlassRelationInfo)琛ㄦ帶鍒跺眰
+ *
+ * @author makejava
+ * @since 2024-11-23 15:59:27
+ */
+@RestController
+@RequestMapping("hollowGlassRelationInfo")
+public class HollowGlassRelationInfoController {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassInfo.java
new file mode 100644
index 0000000..3b8f34c
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassInfo.java
@@ -0,0 +1,94 @@
+package com.mes.hollow.entity;
+
+import lombok.Data;
+
+/**
+ * (HollowGlassInfo)琛ㄥ疄浣撶被
+ *
+ * @author makejava
+ * @since 2024-11-22 17:49:40
+ */
+@Data
+public class HollowGlassInfo {
+ /**
+ * /*鐜荤拑淇℃伅琛╥d
+ */
+ private Long id;
+ /**
+ * /*娴佺▼鍗�
+ */
+ private String flowCardId;
+ /**
+ * /*娴佺▼鍗$幓鐠冪被鍨�
+ */
+ private Integer glassType;
+ /**
+ * /*瀹�
+ */
+ private Double width;
+ /**
+ * /*楂�
+ */
+ private Double height;
+ /**
+ * /*鍘氬害
+ */
+ private Double thickness;
+ /**
+ * /*鑶滅郴
+ */
+ private String filmsid;
+ /**
+ * /*鎬诲眰鏁�
+ */
+ private Integer totalLayer;
+ /**
+ * /*灞傛暟
+ */
+ private Integer layer;
+
+ /**
+ * /*鏄惁閰嶇墖
+ */
+ private Integer ismultiple;
+ /**
+ * /*閰嶇墖鏈�澶у
+ */
+ private Double maxWidth;
+ /**
+ * /*閰嶇墖鏈�澶ч珮
+ */
+ private Double maxHeight;
+
+ /**
+ * /*閽㈠寲鐗堝浘id
+ */
+ private Integer temperingLayoutId;
+ /**
+ * /*閽㈠寲鐗堝浘鐗囧簭
+ */
+ private Integer temperingFeedSequence;
+
+ /**
+ * /*宸ョ▼鍙�
+ */
+ private String engineerId;
+
+ /**
+ * /*鐜荤拑ID
+ */
+ private String glassId;
+
+ private Integer combine;
+ /**
+ * /*鏍煎瓙鍙�
+ */
+ private Integer virtualSlot;
+ /**
+ * /*鏍煎瓙鍙�
+ */
+ private Integer slotSequence;
+
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassRelationInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassRelationInfo.java
new file mode 100644
index 0000000..362b015
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassRelationInfo.java
@@ -0,0 +1,51 @@
+package com.mes.hollow.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+/**
+ * (HollowGlassRelationInfo)琛ㄥ疄浣撶被
+ *
+ * @author makejava
+ * @since 2024-11-23 15:59:29
+ */
+@Data
+public class HollowGlassRelationInfo {
+ /**
+ * /*涓┖鐜荤拑鍏崇郴琛╥d
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * /*鐜荤拑ID
+ */
+ private String glassId;
+ /**
+ * /*娴佺▼鍗�
+ */
+ private String flowCardId;
+ /**
+ * /*鎬诲眰鏁�
+ */
+ private Integer totalLayer;
+ /**
+ * /*灞傛暟
+ */
+ private Integer layer;
+ /**
+ * /*铏氭嫙鏍煎瓙鍙�
+ */
+ private Integer virtualSlot;
+ /**
+ * /*涓┖鏍煎瓙娆″簭
+ */
+ private Integer slotSequence;
+ /**
+ * /*鏍煎瓙鍙�
+ */
+ private Integer slot;
+
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassInfoMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassInfoMapper.java
new file mode 100644
index 0000000..f57ceb5
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassInfoMapper.java
@@ -0,0 +1,15 @@
+package com.mes.hollow.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.hollow.entity.HollowGlassInfo;
+
+/**
+ * (HollowGlassInfo)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author makejava
+ * @since 2024-11-22 17:49:40
+ */
+public interface HollowGlassInfoMapper extends BaseMapper<HollowGlassInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
new file mode 100644
index 0000000..354d9e8
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -0,0 +1,15 @@
+package com.mes.hollow.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mes.hollow.entity.HollowGlassRelationInfo;
+
+/**
+ * (HollowGlassRelationInfo)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author makejava
+ * @since 2024-11-23 15:59:29
+ */
+public interface HollowGlassRelationInfoMapper extends BaseMapper<HollowGlassRelationInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/BigStorageCageHollowDetailsService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/BigStorageCageHollowDetailsService.java
index f557404..0def447 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/BigStorageCageHollowDetailsService.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/BigStorageCageHollowDetailsService.java
@@ -1,18 +1,18 @@
-//package com.mes.hollow.service;
-//
-//import com.baomidou.mybatisplus.extension.service.IService;
-//import com.mes.bigstorage.entity.BigStorageDTO;
-//import com.mes.glassinfo.entity.GlassInfo;
-//import com.mes.hollow.entity.BigStorageCageHollowDetails;
-//
-///**
-// * (BigStorageCageHollowDetails)琛ㄦ湇鍔℃帴鍙�
-// *
-// * @author makejava
-// * @since 2024-11-21 09:23:12
-// */
-//public interface BigStorageCageHollowDetailsService extends IService<BigStorageCageHollowDetails> {
-//
-// BigStorageDTO queryTargetSlotByHollow(GlassInfo info);
-//}
-//
+package com.mes.hollow.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.hollow.entity.BigStorageCageHollowDetails;
+
+/**
+ * (BigStorageCageHollowDetails)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author makejava
+ * @since 2024-11-21 09:23:12
+ */
+public interface BigStorageCageHollowDetailsService extends IService<BigStorageCageHollowDetails> {
+
+ BigStorageDTO queryTargetSlotByHollow(GlassInfo info);
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassInfoService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassInfoService.java
new file mode 100644
index 0000000..f8116eb
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassInfoService.java
@@ -0,0 +1,35 @@
+package com.mes.hollow.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mes.hollow.entity.HollowGlassInfo;
+
+/**
+ * (HollowGlassInfo)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author makejava
+ * @since 2024-11-22 17:49:41
+ */
+public interface HollowGlassInfoService extends IService<HollowGlassInfo> {
+
+ /**
+ * 鎸夌収鐜荤拑id鑾峰彇涓┖鐩爣鏍煎瓙
+ *
+ * @return
+ */
+ int queryHollowTargetSlot(String glassId);
+
+ /**
+ * 鐢熸垚涓┖鐜荤拑淇℃伅
+ */
+ void generateHollowGlassInfo(String glassId);
+
+ /**
+ * 鏍煎瓙閰嶅
+ *
+ * @param hollowGlassInfo
+ * @return
+ */
+ int hollowSlotPair(HollowGlassInfo hollowGlassInfo);
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
new file mode 100644
index 0000000..1ba739a
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -0,0 +1,15 @@
+package com.mes.hollow.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mes.hollow.entity.HollowGlassRelationInfo;
+
+/**
+ * (HollowGlassRelationInfo)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author makejava
+ * @since 2024-11-23 15:59:30
+ */
+public interface HollowGlassRelationInfoService extends IService<HollowGlassRelationInfo> {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/BigStorageCageHollowDetailsServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/BigStorageCageHollowDetailsServiceImpl.java
index 6ae14e8..07e82a7 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/BigStorageCageHollowDetailsServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/BigStorageCageHollowDetailsServiceImpl.java
@@ -1,40 +1,32 @@
-//package com.mes.hollow.service.impl;
-//
-//import cn.hutool.core.lang.Assert;
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-//import com.github.yulichang.wrapper.MPJLambdaWrapper;
-//import com.mes.bigstorage.entity.BigStorageCage;
-//import com.mes.bigstorage.entity.BigStorageCageDetails;
-//import com.mes.bigstorage.entity.BigStorageDTO;
-//import com.mes.common.config.Const;
-//import com.mes.glassinfo.entity.GlassInfo;
-//import com.mes.hollow.entity.BigStorageCageHollow;
-//import com.mes.hollow.entity.BigStorageCageHollowDetails;
-//import com.mes.hollow.mapper.BigStorageCageHollowDetailsMapper;
-//import com.mes.hollow.service.BigStorageCageHollowDetailsService;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.List;
-//
-///**
-// * (BigStorageCageHollowDetails)琛ㄦ湇鍔″疄鐜扮被
-// *
-// * @author makejava
-// * @since 2024-11-21 09:23:12
-// */
-//@Service
-//public class BigStorageCageHollowDetailsServiceImpl extends ServiceImpl<BigStorageCageHollowDetailsMapper, BigStorageCageHollowDetails> implements BigStorageCageHollowDetailsService {
-//
-// @Override
-// public BigStorageDTO queryTargetSlotByHollow(GlassInfo glassInfo) {
+package com.mes.hollow.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.hollow.entity.BigStorageCageHollowDetails;
+import com.mes.hollow.mapper.BigStorageCageHollowDetailsMapper;
+import com.mes.hollow.service.BigStorageCageHollowDetailsService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * (BigStorageCageHollowDetails)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author makejava
+ * @since 2024-11-21 09:23:12
+ */
+@Service
+@Slf4j
+public class BigStorageCageHollowDetailsServiceImpl extends ServiceImpl<BigStorageCageHollowDetailsMapper, BigStorageCageHollowDetails> implements BigStorageCageHollowDetailsService {
+
+ @Override
+ public BigStorageDTO queryTargetSlotByHollow(GlassInfo glassInfo) {
// BigStorageDTO bigStorageDTO = null;
// MPJLambdaWrapper<BigStorageCageHollow> wrapper = new MPJLambdaWrapper<>(BigStorageCageHollow.class)
// .selectAll(BigStorageCageHollow.class)
// .leftJoin(BigStorageCageHollowDetails.class, BigStorageCageHollowDetails::getSlot, BigStorageCageHollow::getSlot)
// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
-// .in(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW,Const.GLASS_STATE_IN)
+// .in(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW, Const.GLASS_STATE_IN)
// .eq(BigStorageCageDetails::getEngineerId, glassInfo.getEngineerId())
// .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
// .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight()))
@@ -111,26 +103,27 @@
// return bigStorageDTO;
// }
// }
-//
-// //鑾峰彇鐜荤拑鐨勫帤搴︼細閲嶆柊閫夌瀛愰渶瑕佹寜鐓х瀛愬彲鏀剧幓鐠冨帤搴﹁繘琛岄�夋嫨
-//// List<Integer> deviceNotUsedList = bigStorageCageService.queryFreeDeviceByNotUsed(glassInfo.getThickness());
-//// for (Integer item : deviceNotUsedList) {
-//// bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
-//// .eq(BigStorageCage::getRemainWidth, slotWidth)
-//// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
-//// .eq(BigStorageCage::getDeviceId, item)
-//// .last("limit 1"));
-//// if (null != bigStorageCage) {
-//// log.info("鎸夌収瀛樼鐜荤拑鏍煎瓙鏁板墿浣欐渶澶氬緱鏂瑰紡鑾峰彇淇℃伅鐗堝浘id:{},鏍煎瓙锛歿},鐜荤拑id锛歿}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId());
-//// bigStorageDTO = new BigStorageDTO();
-//// bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
-//// bigStorageDTO.setSlot(bigStorageCage.getSlot());
-//// bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
-//// return bigStorageDTO;
-//// }
-//// }
+
+ //鑾峰彇鐜荤拑鐨勫帤搴︼細閲嶆柊閫夌瀛愰渶瑕佹寜鐓х瀛愬彲鏀剧幓鐠冨帤搴﹁繘琛岄�夋嫨
+// List<Integer> deviceNotUsedList = bigStorageCageService.queryFreeDeviceByNotUsed(glassInfo.getThickness());
+// for (Integer item : deviceNotUsedList) {
+// bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
+// .eq(BigStorageCage::getRemainWidth, slotWidth)
+// .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
+// .eq(BigStorageCage::getDeviceId, item)
+// .last("limit 1"));
+// if (null != bigStorageCage) {
+// log.info("鎸夌収瀛樼鐜荤拑鏍煎瓙鏁板墿浣欐渶澶氬緱鏂瑰紡鑾峰彇淇℃伅鐗堝浘id:{},鏍煎瓙锛歿},鐜荤拑id锛歿}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId());
+// bigStorageDTO = new BigStorageDTO();
+// bigStorageDTO.setWidth(bigStorageCage.getRemainWidth());
+// bigStorageDTO.setSlot(bigStorageCage.getSlot());
+// bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId());
+// return bigStorageDTO;
+// }
+// }
// Assert.isTrue(null != bigStorageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
// return bigStorageDTO;
-// }
-//}
-//
+ return null;
+ }
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassInfoServiceImpl.java
new file mode 100644
index 0000000..29df072
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassInfoServiceImpl.java
@@ -0,0 +1,167 @@
+package com.mes.hollow.service.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.common.config.Const;
+import com.mes.engineering.entity.Engineering;
+import com.mes.engineering.mapper.EngineeringMapper;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.hollow.entity.BigStorageCageHollow;
+import com.mes.hollow.entity.HollowGlassInfo;
+import com.mes.hollow.entity.HollowGlassRelationInfo;
+import com.mes.hollow.mapper.HollowGlassInfoMapper;
+import com.mes.hollow.service.BigStorageCageHollowService;
+import com.mes.hollow.service.HollowGlassInfoService;
+import com.mes.hollow.service.HollowGlassRelationInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * (HollowGlassInfo)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author makejava
+ * @since 2024-11-22 17:49:41
+ */
+
+@Slf4j
+@Service
+public class HollowGlassInfoServiceImpl extends ServiceImpl<HollowGlassInfoMapper, HollowGlassInfo> implements HollowGlassInfoService {
+
+ @Resource
+ GlassInfoService glassInfoService;
+ @Resource
+ EngineeringMapper engineeringMapper;
+ @Resource
+ BigStorageCageHollowService bigStorageCageHollowService;
+ @Resource
+ HollowGlassRelationInfoService hollowGlassRelationInfoService;
+ @Value("${mes.slotWidth}")
+ private Integer slotWidth;
+ @Value("${mes.glassGap}")
+ private Integer glassGap;
+
+ @Override
+ public int queryHollowTargetSlot(String glassId) {
+ //鎸夌収鐜荤拑淇℃伅鑾峰彇鍏崇郴琛ㄤ腑瀵瑰簲鐨勫ぇ鐞嗙墖绗兼牸瀛愬彿
+ HollowGlassRelationInfo relationInfoOne = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>().eq(HollowGlassRelationInfo::getGlassId, glassId));
+ if (relationInfoOne != null) {
+ return relationInfoOne.getSlot();
+ }
+ //鎸夌収鐜荤拑id鑾峰彇涓┖淇℃伅琛ㄦ槸鍚︽暟鎹�
+ HollowGlassInfo hollowGlassInfo = this.getOne(new LambdaQueryWrapper<HollowGlassInfo>().eq(HollowGlassInfo::getGlassId, glassId));
+ if (null == hollowGlassInfo) {
+ //鎸夌収鐜荤拑id璁$畻瀵瑰簲宸ョ▼涓嬫墍鏈夌幓鐠冪殑鏍煎瓙
+ generateHollowGlassInfo(glassId);
+ hollowGlassInfo = this.getOne(new LambdaQueryWrapper<HollowGlassInfo>().eq(HollowGlassInfo::getGlassId, glassId));
+ }
+ return hollowSlotPair(hollowGlassInfo);
+ }
+
+ @Override
+ public void generateHollowGlassInfo(String glassId) {
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+ List<HollowGlassInfo> list = this.list(new LambdaQueryWrapper<HollowGlassInfo>().eq(HollowGlassInfo::getFlowCardId, glassInfo.getFlowCardId()));
+ if (CollectionUtil.isNotEmpty(list)) {
+ return;
+ }
+ Engineering engineering = engineeringMapper.selectOne(new LambdaQueryWrapper<Engineering>()
+ .eq(Engineering::getEngineerId, glassInfo.getEngineerId()));
+ //鑾峰彇鐜荤拑鐨勫伐绋媔d锛屾寜鐓у伐绋媔d鑾峰彇宸ョ▼涓嬬殑鎵�鏈夌幓鐠冧俊鎭�
+ List<GlassInfo> glassInfoList = glassInfoService.listBySize(engineering.getEngineerId());
+ Map<String, List<GlassInfo>> flowCardIdMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getFlowCardId));
+ List<HollowGlassInfo> hollowGlassInfoList = new ArrayList<>();
+ //鏂瑰紡涓�锛氬皢鐜荤拑鎸夋祦绋嬪崱銆佸昂瀵搞�佺増鍥俱�佺増搴� 渚濇鐢熸垚铏氭嫙鏍煎瓙淇℃伅锛屾牸瀛愪竴鐩村線鍚庣疮鍔�
+// flowCardIdMap.forEach((e, v) -> {
+// int remainWidth = slotWidth;
+// int slotNumber = 1;
+// for (GlassInfo item : v) {
+// int maxLength = (int) Math.max(item.getWidth(), item.getHeight());
+// if (remainWidth > maxLength) {
+// remainWidth = remainWidth - maxLength - glassGap;
+// } else {
+// slotNumber = slotNumber + 1;
+// remainWidth = slotWidth - maxLength - glassGap;
+// }
+// HollowGlassInfo hollow = new HollowGlassInfo();
+// BeanUtils.copyProperties(item, hollow);
+// hollow.setSlot(slotNumber);
+// hollowGlassInfoList.add(hollow);
+// }
+// });
+// this.saveBatch(hollowGlassInfoList);
+ //鑾峰彇涓┖澶х悊鐗囩鐨勬墍鏈夌┖闂叉牸瀛�
+// List<BigStorageCageHollow> hollowSlotList = bigStorageCageHollowService.list(new LambdaQueryWrapper<BigStorageCageHollow>()
+// .eq(BigStorageCageHollow::getEnableState, Const.SLOT_ON).eq(BigStorageCageHollow::getRemainWidth, slotWidth));
+ //鏂瑰紡浜岋細灏嗙幓鐠冩寜娴佺▼鍗°�佸昂瀵搞�佺増鍥俱�佺増搴� 锛屼紭鍏堝皢鏍煎瓙鍏ㄩ儴琛ュ叏鍚� 渚濇璁$畻鍚庨潰鐨勬牸瀛愬彿
+ flowCardIdMap.forEach((e, v) -> {
+ List<List<HollowGlassInfo>> tempHollowList = new ArrayList<>();
+ int slotNumber = 1;
+ for (GlassInfo item : v) {
+ boolean flag = false;
+ for (List<HollowGlassInfo> temp : tempHollowList) {
+ int sum = 0;
+ for (HollowGlassInfo i : temp) {
+ sum = sum + (int) Math.max(i.getHeight(), i.getWidth()) + glassGap;
+ }
+ if (sum + (int) Math.max(item.getHeight(), item.getWidth()) <= slotWidth) {
+ HollowGlassInfo hollow = new HollowGlassInfo();
+ BeanUtils.copyProperties(item, hollow);
+ hollow.setSlotSequence(temp.size() + 1);
+ hollow.setVirtualSlot(temp.get(0).getVirtualSlot());
+ temp.add(hollow);
+ flag = true;
+ break;
+ }
+ }
+ if (!flag) {
+ List<HollowGlassInfo> newList = new ArrayList<>();
+ HollowGlassInfo hollow = new HollowGlassInfo();
+ BeanUtils.copyProperties(item, hollow);
+ hollow.setSlotSequence(1);
+ hollow.setVirtualSlot(slotNumber++);
+ newList.add(hollow);
+ tempHollowList.add(newList);
+ }
+ }
+ for (List<HollowGlassInfo> item : tempHollowList) {
+ hollowGlassInfoList.addAll(item);
+ }
+
+ });
+ log.info("鍒嗛厤瀹屾瘯");
+ this.saveBatch(hollowGlassInfoList);
+ }
+
+ @Override
+ public int hollowSlotPair(HollowGlassInfo hollowGlassInfo) {
+ //鑾峰彇鎵�鏈夌┖闂插彲鐢ㄧ殑鏍煎瓙鍙�
+ BigStorageCageHollow storageCageHollow = bigStorageCageHollowService.getOne(new LambdaQueryWrapper<BigStorageCageHollow>()
+ .eq(BigStorageCageHollow::getEnableState, Const.SLOT_ON).eq(BigStorageCageHollow::getRemainWidth, slotWidth).last("limit 1"));
+ Integer slot = storageCageHollow.getSlot();
+ //鑾峰彇璇ュ伐绋嬪悓涓�娴佺▼鍗″悓涓�杞︾殑鐜荤拑淇℃伅
+ List<HollowGlassInfo> hollowGlassInfoList = this.list(new LambdaQueryWrapper<HollowGlassInfo>().eq(HollowGlassInfo::getFlowCardId, hollowGlassInfo.getFlowCardId())
+ .eq(HollowGlassInfo::getVirtualSlot, hollowGlassInfo.getVirtualSlot()));
+ //璁剧疆鍏崇郴琛ㄧ殑瀹為檯鏍煎瓙鍙�
+ List<HollowGlassRelationInfo> relationInfoList = hollowGlassInfoList.stream().map(e -> {
+ HollowGlassRelationInfo info = new HollowGlassRelationInfo();
+ BeanUtils.copyProperties(e, info);
+ info.setSlot(slot);
+ return info;
+ }).collect(Collectors.toList());
+ //淇濆瓨鍏崇郴琛�
+ hollowGlassRelationInfoService.saveBatch(relationInfoList);
+ //杩斿洖鏍煎瓙淇℃伅
+ return slot;
+ }
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
new file mode 100644
index 0000000..f739902
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -0,0 +1,19 @@
+package com.mes.hollow.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mes.hollow.entity.HollowGlassRelationInfo;
+import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
+import com.mes.hollow.service.HollowGlassRelationInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * (HollowGlassRelationInfo)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author makejava
+ * @since 2024-11-23 15:59:30
+ */
+@Service
+public class HollowGlassRelationInfoServiceImpl extends ServiceImpl<HollowGlassRelationInfoMapper, HollowGlassRelationInfo> implements HollowGlassRelationInfoService {
+
+}
+
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
new file mode 100644
index 0000000..a1e6a58
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
@@ -0,0 +1,205 @@
+package com.mes.job;
+
+import cn.hutool.json.JSONObject;
+import cn.smallbun.screw.core.util.CollectionUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mes.bigstorage.entity.BigStorageCageDetails;
+import com.mes.bigstorage.service.BigStorageCageDetailsService;
+import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
+import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.temperingglass.entity.TemperingGlassInfo;
+import com.mes.temperingglass.service.TemperingGlassInfoService;
+import com.mes.tools.WebSocketServer;
+import com.mes.utils.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+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 javax.annotation.Resource;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author SNG-015
+ */
+@Component
+@Slf4j
+public class OPCPlcSlicecage {
+
+ @Resource
+ private BigStorageCageService bigStorageCageService;
+ @Resource
+ private BigStorageCageDetailsService bigStorageCageDetailsService;
+ @Resource
+ private TemperingGlassInfoService temperingGlassInfoService;
+ @Resource
+ private RedisUtil redisUtil;
+ @Autowired
+ private GlassInfoService glassInfoService;
+ @Resource
+ private BigStorageCageTaskService bigStorageCageTaskService;
+
+ @Value("${mes.scan.ip}")
+ private String scanIp;
+
+ @Value("${mes.scan.port}")
+ private Integer scanPort;
+
+ private JSONObject jsonObject = new JSONObject();
+
+ public void queryDataSource1() throws InterruptedException {
+ List<Double> carPostion = new ArrayList<>();
+ carPostion.add(0.25);
+ carPostion.add(0.5);
+ jsonObject.append("carPostion", carPostion);
+ //鐣岄潰灞曠ず绗煎瓙淇℃伅
+ jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail());
+
+ //杩涚墖浠诲姟鏁版嵁
+ List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task");
+ jsonObject.append("bigStorageCageDetailsFeedTask", inTaskList);
+
+ //鍑虹墖浠诲姟鏁版嵁
+ List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
+ jsonObject.append("bigStorageCageDetailsOutTask", outTaskList);
+
+ //鐞嗙墖绗间娇鐢ㄦ儏鍐�
+ List<Map<String, Object>> bigStorageCageUsage = bigStorageCageService.selectBigStorageCageUsage();
+ jsonObject.append("bigStorageCageUsage", bigStorageCageUsage);
+
+ //鐞嗙墖绗艰〃鏍间俊鎭�
+ jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetailAll());
+
+ //閽㈠寲寮�鍏�
+ boolean temperingSwitch = false;
+ if (redisUtil.getCacheObject("temperingSwitch") == null) {
+ redisUtil.setCacheObject("temperingSwitch", false);
+ } else {
+ temperingSwitch = redisUtil.getCacheObject("temperingSwitch");
+ }
+ jsonObject.append("temperingSwitch", temperingSwitch);
+ //鎵撳嵃寮�鍏�
+ boolean autoPrint = false;
+ if (redisUtil.getCacheObject("autoPrint") == null) {
+ redisUtil.setCacheObject("autoPrint", false);
+ } else {
+ autoPrint = redisUtil.getCacheObject("autoPrint");
+ }
+ jsonObject.append("autoPrint", autoPrint);
+
+ //褰撳墠鎸囧畾宸ョ▼
+ String temperingengineerId = "";
+ if (redisUtil.getCacheObject("temperingengineerId") == null) {
+ redisUtil.setCacheObject("temperingengineerId", temperingengineerId);
+ } else {
+ temperingengineerId = redisUtil.getCacheObject("temperingengineerId");
+ }
+ jsonObject.append("temperingengineerId", temperingengineerId);
+
+
+ }
+
+ public void queryDataSource2() throws InterruptedException {
+ //鍑虹墖闃熷垪
+ List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list(
+ new LambdaQueryWrapper<TemperingGlassInfo>()
+ .inSql(TemperingGlassInfo::getEngineerId, "select distinct engineer_id from tempering_glass_info where state<4")
+ );
+ jsonObject.append("temperingGlassInfoList", temperingGlassInfoList);
+
+ }
+
+ /**
+ * fixedRate : 涓婁竴涓皟鐢ㄥ紑濮嬪悗鍐嶆璋冪敤鐨勫欢鏃讹紙涓嶇敤绛夊緟涓婁竴娆¤皟鐢ㄥ畬鎴愶級
+ * fixedDelay : 涓婁竴涓皟鐢ㄧ粨鏉熷悗鍐嶆璋冪敤鐨勫欢鏃�
+ */
+ @Scheduled(fixedDelay = 1000)
+ public void plcStorageCageTask() throws InterruptedException {
+ jsonObject = new JSONObject();
+ try {
+ //鏌ヨ浣跨敤鏁版嵁婧�1鏌ヨ鏁版嵁
+ queryDataSource1();
+ //鏌ヨ浣跨敤鏁版嵁婧�2鏌ヨ鏁版嵁
+ queryDataSource2();
+
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ if (webserver != null) {
+ webserver.sendMessage(jsonObject.toString());
+ List<String> messages = webserver.getMessages();
+ if (!messages.isEmpty()) {
+ // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ webserver.clearMessages();
+ }
+ } else {
+ log.info("Home is closed");
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // @Scheduled(fixedDelay = 1000)
+ public void temperingIsRun() {
+ JSONObject jsonObject = new JSONObject();
+ //杩涚墖浠诲姟鏁版嵁
+ List<BigStorageCageDetails> bigStorageCageDetailsFeedTask = bigStorageCageDetailsService.selectFeedTask();
+ jsonObject.append("bigStorageCageDetailsFeedTask", bigStorageCageDetailsFeedTask);
+ //鍑虹墖浠诲姟鏁版嵁
+ List<BigStorageCageDetails> bigStorageCageDetailsOutTask = bigStorageCageDetailsService.selectOutTask();
+ jsonObject.append("bigStorageCageDetailsOutTask", bigStorageCageDetailsOutTask);
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ if (webserver != null) {
+ webserver.sendMessage(jsonObject.toString());
+ } else {
+ log.info("Home is closed");
+ }
+ }
+ }
+ }
+
+ // @Scheduled(fixedDelay = Long.MAX_VALUE)
+ public void scanCodeTask() {
+ log.info("鎵弿浠诲姟宸插惎鍔�");
+ while (true) {
+ JSONObject jsonObject = new JSONObject();
+ try (Socket socket = new Socket(scanIp, scanPort);
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()))) {
+ // 鎺ユ敹鏈嶅姟鍣ㄥ搷搴�
+ log.info("绛夊緟鎵爜涓�......");
+ String glassId = in.readLine();
+ log.info("鎵弿鍒扮殑鐜荤拑id锛歿}", glassId);
+ List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage");
+ if (CollectionUtils.isNotEmpty(sendwServer)) {
+ //鎸夌収鐜荤拑id鑾峰彇鐜荤拑淇℃伅杩斿洖缁欏墠绔晫闈紝鍏蜂綋闇�瑕佸摢浜涙暟鎹緟纭
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getGlassId, glassId).last("limit 1"));
+ if (null == glassInfo) {
+ log.info("鎸夌収鐜荤拑id锛歿}锛屾棤娉曟壘鍒扮幓鐠冧俊鎭�", glassId);
+ } else {
+ for (WebSocketServer webserver : sendwServer) {
+ jsonObject.append("scanGlass", glassInfo);
+ webserver.sendMessage(jsonObject.toString());
+ }
+ }
+ }
+ } catch (Exception exception) {
+ log.info("璇诲彇寮傚父锛屽師鍥犱负{}", exception.getMessage());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index dcb12b5..2ef87db 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -4,18 +4,17 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.github.yulichang.toolkit.JoinWrappers;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.bigstorage.service.BigStorageGlassInfoService;
import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask;
import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService;
@@ -26,10 +25,9 @@
import com.mes.damage.service.DamageService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.hollow.service.BigStorageCageHollowDetailsService;
import com.mes.hollow.service.BigStorageCageHollowService;
-import com.mes.temperingglass.entity.TemperingGlass;
-import com.mes.temperingglass.entity.TemperingGlassInfo;
-import com.mes.temperingglass.service.TemperingGlassService;
+import com.mes.hollow.service.HollowGlassInfoService;
import com.mes.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -53,8 +51,8 @@
@Resource
private BigStorageCageHollowDetailsService bigStorageCageHollowDetailsService;
- @Resource
- private TemperingGlassService temperingGlassService;
+ // @Resource
+// private TemperingGlassService temperingGlassService;
@Resource
private DamageService damageService;
@Resource
@@ -65,6 +63,8 @@
private BigStorageCageHollowService bigStorageCageHollowService;
@Resource
private BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService;
+ @Resource
+ private BigStorageGlassInfoService bigStorageGlassInfoService;
@Resource
private BigStorageCageTaskService bigStorageCageTaskService;
@Autowired(required = false)
@@ -87,6 +87,18 @@
@Value("${mes.sequence.order}")
private boolean sequenceOrder;
+ @Resource
+ HollowGlassInfoService hollowGlassInfoService;
+
+ // @Scheduled(fixedDelay = 1000)
+ public void test() {
+ hollowGlassInfoService.queryHollowTargetSlot("P24111201|2|20");
+ }
+
+ // @Scheduled(fixedDelay = 1000)
+ public void test1() {
+ bigStorageGlassInfoService.queryBigStorageTargetSlot("P24111201|2|20");
+ }
public void inBigStorageTask() throws Exception {
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2A.DLP2A.mesControl");
@@ -109,6 +121,9 @@
if (CollectionUtils.isEmpty(inTaskList)) {
log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫杩涚墖浠诲姟");
}
+ //todo:鍘讳腑绌洪槦鍒楄〃涓煡璇㈢幓鐠冧俊鎭槸鍚﹀瓨鍦�
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, inTaskList.get(0).getGlassId()));
+ //todo:
List<String> glassIdList = inTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
log.info("鑾峰彇浠诲姟鐨勭幓鐠僫d锛歿}", glassIdList);
List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList));
@@ -151,7 +166,7 @@
miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 1));
}
- //@Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void outBigStorageTask() throws Exception {
Date startDate = new Date();
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl");
@@ -172,49 +187,9 @@
}
//todo:鏄惁鍏佽閽㈠寲
if (redisUtil.getCacheObject("temperingSwitch")) {
- //鏄惁鏈夋鍦ㄩ挗鍖栫殑鐜荤拑:閽㈠寲灏忕墖琛ㄥ叧鑱斿巻鍙蹭换鍔¤〃锛岀瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
- List<TemperingGlass> temperingGlassList = temperingGlassService.selectJoinList(TemperingGlass.class, new MPJLambdaWrapper<TemperingGlass>()
- .selectAll(TemperingGlass.class)
- .leftJoin(BigStorageCageHistoryTask.class, BigStorageCageHistoryTask::getGlassId, TemperingGlass::getGlassId)
- .eq(TemperingGlass::getState, Const.TEMPERING_NEW)
- .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT)
- .isNull(BigStorageCageHistoryTask::getGlassId)
- .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlass::getTemperingFeedSequence));
- //todo:鍘嗗彶浠诲姟琛�
- if (CollectionUtils.isNotEmpty(temperingGlassList)) {
- log.info("鏈夋鍦ㄥ嚭鐗囩殑閽㈠寲浠诲姟");
- computeOutGlassInfo(temperingGlassList, "big_storage_cage_out_two_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
- Date endDate = new Date();
- log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
- return;
- }
- //閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
- List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll();
- if (CollectionUtils.isNotEmpty(temperingLayoutDTOList)) {
- //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
- //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆閽㈠寲灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟 缁撴潫
- for (TemperingLayoutDTO item : temperingLayoutDTOList) {
-// if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) {
- List<TemperingGlass> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlass.class, JoinWrappers.lambda(GlassInfo.class)
- .selectAll(GlassInfo.class)
- .select("-1 as state")
- .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot)
- .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId)
- .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
- .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId())
- .eq(GlassInfo::getEngineerId, item.getEngineerId())
- .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence));
- if (CollectionUtils.isNotEmpty(temperingGlassInfos)) {
- temperingGlassService.saveBatch(temperingGlassInfos);
- computeOutGlassInfo(temperingGlassInfos, "big_storage_cage_out_two_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
- Date endDate = new Date();
- log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
- return;
- }
-// }
- }
- }
+
}
+
//鏄惁鏈変汉宸ヤ笅鐗囦换鍔� 鏈夌洿鎺ュ嚭
List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
.eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL)
@@ -226,6 +201,7 @@
log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
+
//鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
List<TemperingLayoutDTO> temperingOccupySlotList = bigStorageCageDetailsService.queryTemperingOccupySlot();
if (CollectionUtils.isNotEmpty(temperingOccupySlotList)) {
@@ -252,6 +228,7 @@
}
}
}
+
Date endDate = new Date();
log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
@@ -315,7 +292,7 @@
miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 0));
}
- //@Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void finishOutBigStorageTask() throws Exception {
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl");
if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
new file mode 100644
index 0000000..216e6a0
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -0,0 +1,624 @@
+package com.mes.job;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.lang.Assert;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.kangaroohy.milo.model.ReadWriteEntity;
+import com.kangaroohy.milo.service.MiloService;
+import com.mes.base.entity.BigStorageCageBaseInfo;
+import com.mes.bigstorage.entity.BigStorageCage;
+import com.mes.bigstorage.entity.BigStorageCageDetails;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageRelationDTO;
+import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO;
+import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
+import com.mes.bigstorage.service.BigStorageCageDetailsService;
+import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.bigstorage.service.BigStorageGlassInfoService;
+import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask;
+import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
+import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService;
+import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
+import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
+import com.mes.common.config.Const;
+import com.mes.damage.entity.Damage;
+import com.mes.damage.service.DamageService;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.temperingglass.entity.TemperingGlassInfo;
+import com.mes.temperingglass.service.TemperingGlassInfoService;
+import com.mes.utils.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+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 javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author SNG-015
+ */
+@Component
+@Slf4j
+public class OpcPlcStorageCageNewTask {
+ @Resource
+ private BigStorageCageDetailsService bigStorageCageDetailsService;
+ @Resource
+ private TemperingGlassInfoService temperingGlassInfoService;
+ @Resource
+ private DamageService damageService;
+ @Resource
+ private GlassInfoService glassInfoService;
+ @Resource
+ private BigStorageCageService bigStorageCageService;
+ @Resource
+ private BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService;
+ @Resource
+ private BigStorageCageTaskService bigStorageCageTaskService;
+ @Resource
+ private BigStorageGlassInfoService bigStorageGlassInfoService;
+
+ @Autowired(required = false)
+ MiloService miloService;
+
+ @Resource
+ private RedisUtil redisUtil;
+
+ @Value("${mes.slotWidth}")
+ private Integer slotWidth;
+
+ @Value("${mes.glassGap}")
+ private Integer glassGap;
+
+ @Value("${mes.carWidth}")
+ private Integer carWidth;
+
+ @Value("${mes.outCarMaxSize}")
+ private Integer outCarMaxSize;
+
+ @Value("${mes.sequence.order}")
+ private boolean sequenceOrder;
+
+
+ @Scheduled(fixedDelay = 1000)
+ public void inBigStorageTask() throws Exception {
+ ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl");
+ if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
+ log.info("褰撳墠涓洪潪鑱旀満鐘舵�侊紝缁撴潫杩涚墖浠诲姟");
+ return;
+ }
+ ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1A.DLP1A.RequestMes");
+ if (!"1".equals(requestEntity.getValue() + "")) {
+ log.info("褰撳墠鏈敹鍒拌繘鐗囪姹傦紝缁撴潫杩涚墖浠诲姟");
+ return;
+ }
+ ReadWriteEntity mesReplyEntity = miloService.readFromOpcUa("DLP1A.DLP1A.MesReply");
+ if ("1".equals(mesReplyEntity.getValue() + "")) {
+ log.info("鏈夋鍦ㄦ墽琛岀殑浠诲姟锛岀粨鏉熻繘鐗囦换鍔�");
+ return;
+ }
+ //鑾峰彇杩涚墖浠诲姟琛�
+ List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task");
+ if (CollectionUtil.isEmpty(inTaskList)) {
+ log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫杩涚墖浠诲姟");
+ }
+
+ List<String> glassIdList = inTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+ log.info("鑾峰彇浠诲姟鐨勭幓鐠僫d锛歿}", glassIdList);
+ Map<String, Long> glassCountMap = glassIdList.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting()));
+ for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) {
+ if (entry.getValue() > 1) {
+ log.info("杩涚墖鐜荤拑{}瀛樺湪鐩稿悓锛岀粨鏉熸湰娆′换鍔�", entry.getKey());
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
+ }
+ List<BigStorageCageDetails> detailsList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, glassIdList)
+ .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
+ if (CollectionUtil.isNotEmpty(detailsList)) {
+ log.info("鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑{}锛岀粨鏉熸湰娆′换鍔�", detailsList);
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
+ List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList));
+
+ Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId));
+
+ //璁$畻鐩爣鏍煎瓙
+ List<BigStorageCageHistoryTask> historyTasks = new ArrayList<>();
+ for (BigStorageCageTask task : inTaskList) {
+ GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
+ BigStorageDTO bigStorageDTO = bigStorageGlassInfoService.queryBigStorageTargetSlot(info.getGlassId());
+ //鑾峰彇鐩爣鏍煎瓙淇℃伅
+// BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlotByTempering(info);
+// 涓存椂鏇存柊鏍煎瓙鐨勫墿浣欏昂瀵革細闃叉鐩搁偦鐜荤拑杩涘悓涓�鏍煎瓙閫犳垚鍓╀綑灏哄涓嶈冻锛岀幓鐠冭秺鐣岀殑鎯呭喌锛屼换鍔″畬鎴愬悗鍐嶆鏇存柊澶х悊鐗囩琛ㄥ墿浣欏搴︼紙鎸夌収绗煎唴鐜荤拑鏁伴噺鏇存柊澶х悊鐗囩鍓╀綑灏哄锛�
+ bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>()
+ .set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap)
+ .eq(BigStorageCage::getSlot, bigStorageDTO.getSlot()));
+ task.setTargetSlot(bigStorageDTO.getSlot());
+ task.setGlassId(info.getGlassId());
+ bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task);
+ //瀛樻斁鍘嗗彶浠诲姟
+ BigStorageCageHistoryTask historyTask = new BigStorageCageHistoryTask();
+ BeanUtils.copyProperties(task, historyTask);
+ historyTask.setTaskType(Const.BIG_STORAGE_BEFORE_IN);
+ historyTask.setGlassCount(glassInfoList.size());
+ historyTask.setTaskState(Const.ENGINEERING_NEW);
+ historyTasks.add(historyTask);
+ BigStorageCageDetails cageDetails = new BigStorageCageDetails();
+ BeanUtils.copyProperties(info, cageDetails);
+ cageDetails.setSlot(bigStorageDTO.getSlot());
+ cageDetails.setState(Const.GLASS_STATE_NEW);
+ cageDetails.setDeviceId(bigStorageDTO.getDeviceId());
+ cageDetails.setSequence(bigStorageDTO.getSlotSequence());
+ cageDetails.setGap(glassGap);
+ cageDetails.setId(null);
+ bigStorageCageDetailsService.save(cageDetails);
+ }
+ //鍘嗗彶鏁版嵁鍏ュ簱
+ bigStorageCageHistoryTaskService.saveBatch(historyTasks);
+ //鍚憃pc鍙戦�佸惎鍔ㄤ俊鍙�
+ miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1));
+ }
+
+ @Scheduled(fixedDelay = 1000)
+ public void outBigStorageTask() throws Exception {
+ Date startDate = new Date();
+ ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl");
+ if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
+ log.info("褰撳墠涓洪潪鑱旀満鐘舵�侊紝缁撴潫杩涚墖浠诲姟");
+ return;
+ }
+ ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1B.DLP1B.RequestMes");
+ if (!"1".equals(requestEntity.getValue() + "")) {
+ log.info("褰撳墠鏈敹鍒板嚭鐗囪姹傦紝缁撴潫鍑虹墖浠诲姟");
+ return;
+ }
+ //鑾峰彇鍑虹墖浠诲姟琛�
+ List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
+ if (CollectionUtil.isNotEmpty(outTaskList)) {
+ log.info("鏈夋鍦ㄦ墽琛岀殑鍑虹墖浠诲姟锛岀粨鏉熸湰娆″嚭鐗囦换鍔�");
+ return;
+ }
+ //todo:鏄惁鍏佽閽㈠寲
+ if (redisUtil.getCacheObject("temperingSwitch")) {
+ //鏄惁鏈夋鍦ㄩ挗鍖栫殑鐜荤拑:閽㈠寲灏忕墖琛ㄥ叧鑱斿巻鍙蹭换鍔¤〃锛岀瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
+// 鑾峰彇褰撳墠閽㈠寲浠诲姟鏈畬鎴愬嚭鐗囩殑鐜荤拑淇℃伅
+ List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW));
+ if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) {
+ List<String> glassIdList = unFinishTemperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList());
+ List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>()
+ .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT)
+ .in(BigStorageCageHistoryTask::getGlassId, glassIdList));
+ List<TemperingGlassInfo> temperingGlassList = unFinishTemperingGlassInfoList;
+ if (CollectionUtil.isNotEmpty(historyTaskList)) {
+ List<String> taskGlassList = historyTaskList.stream().map(BigStorageCageHistoryTask::getGlassId).collect(Collectors.toList());
+ temperingGlassList = unFinishTemperingGlassInfoList.stream().filter(e -> !taskGlassList.contains(e.getGlassId())).collect(Collectors.toList());
+ }
+ if (CollectionUtil.isNotEmpty(temperingGlassList)) {
+ log.info("鏈夋鍦ㄥ嚭鐗囩殑閽㈠寲浠诲姟");
+ computeOutGlassInfo(temperingGlassList, "big_storage_cage_out_one_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+ return;
+ }
+ }
+ //閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
+ List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll();
+ if (CollectionUtil.isNotEmpty(temperingLayoutDTOList)) {
+ //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
+ //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆閽㈠寲灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟 缁撴潫
+ for (TemperingLayoutDTO item : temperingLayoutDTOList) {
+// if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) {
+ List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class)
+ .selectAll(GlassInfo.class)
+ .select("-1 as state")
+ .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot)
+ .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId)
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId())
+ .eq(GlassInfo::getEngineerId, item.getEngineerId())
+ .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence));
+ if (CollectionUtil.isNotEmpty(temperingGlassInfos)) {
+ temperingGlassInfoService.saveBatch(temperingGlassInfos);
+ computeOutGlassInfo(temperingGlassInfos, "big_storage_cage_out_one_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+ return;
+ }
+// }
+ }
+ }
+ }
+ //鏄惁鏈変汉宸ヤ笅鐗囦换鍔� 鏈夌洿鎺ュ嚭
+ List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL)
+ .orderByAsc(BigStorageCageDetails::getSlot)
+ .orderByAsc(BigStorageCageDetails::getId));
+ if (CollectionUtil.isNotEmpty(artificialList)) {
+ computeOutGlassInfo(artificialList, "big_storage_cage_out_one_task", Const.ARTIFICIAL_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+ return;
+ }
+ //鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
+ if (redisUtil.getCacheObject("dispatchSwitch")) {
+ //todo:鑾峰彇绗煎唴鍗曟牸宸茬粡鍒伴綈鐨勭幓鐠冩牸瀛愪俊鎭�
+ List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot();
+ if (CollectionUtil.isEmpty(virtualList)) {
+ log.info("娌℃湁闇�瑕佽皟搴︾殑鏍煎瓙");
+ return;
+ }
+ List<BigStorageCageDetails> list = new ArrayList<>();
+ for (BigStorageRelationDTO dto : virtualList) {
+ List<BigStorageSequenceDTO> sequenceDTOList = bigStorageCageDetailsService.dispatchBigStorageGlassInfo(dto);
+ if (CollectionUtil.isEmpty(sequenceDTOList) || sequenceDTOList.size() == 1) {
+ continue;
+ }
+ int sequence = -1;
+ int startSlot = -1;
+ for (BigStorageSequenceDTO item : sequenceDTOList) {
+ if (item.getMinSequence() == sequence + 1) {
+ //鐢熸垚璋冨害浠诲姟
+ int targetSlot = item.getSlot();
+ list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(BigStorageCageDetails::getSlot, startSlot));
+ computeOutGlassInfo(list, "big_storage_cage_out_one_task", targetSlot, Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH);
+ List<Integer> slotList = new ArrayList<>();
+ slotList.add(targetSlot);
+ updateSlotRemainBySlots(slotList);
+ break;
+ }
+ sequence = item.getMaxSequence();
+ startSlot = item.getSlot();
+ }
+ }
+ }
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+ return;
+ }
+
+ @Scheduled(fixedDelay = 1000)
+ public void finishInBigStorageTask() throws Exception {
+ ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl");
+ if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
+ log.info("褰撳墠涓洪潪鑱旀満鐘舵�侊紝缁撴潫瀹屾垚杩涚墖浠诲姟");
+ return;
+ }
+ //鑾峰彇杩涚墖浠诲姟琛�
+ List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task");
+ if (CollectionUtil.isEmpty(inTaskList)) {
+ log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫瀹屾垚杩涚墖浠诲姟");
+ return;
+ }
+ List<BigStorageCageTask> unFinishTaskList = inTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList());
+ if (CollectionUtil.isNotEmpty(unFinishTaskList)) {
+ log.info("瀛樺湪鏈畬鎴愮殑鐜荤拑淇℃伅,鐜荤拑锛歿}", unFinishTaskList);
+ return;
+ }
+ Map<Integer, List<BigStorageCageTask>> taskMap = inTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState));
+ //鎸夌収浠诲姟鐘舵�佷慨鏀瑰ぇ鐞嗙墖绗煎唴鐨勭幓鐠冩暟鎹�
+// 閲嶆柊璁$畻澶х悊鐗囩鍐呯殑鍓╀綑灏哄
+ taskMap.forEach((e1, v) -> {
+ if (e1 == 2) {
+ //杩涚墖瀹屾垚
+ log.info("3銆佽幏鍙栬繘鐗囧凡瀹屾垚鐨勭幓鐠冧俊鎭痠d:{}", v);
+ List<Integer> inSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList());
+ List<UpdateBigStorageCageDTO> storageCageDTOList = v.stream().map(e -> {
+ UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO();
+ BeanUtils.copyProperties(e, storageCageDTO);
+ return storageCageDTO;
+ }).collect(Collectors.toList());
+ bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
+ log.info("4銆佸ぇ鐞嗙墖绗艰繘鐗囩姸鎬佸凡瀹屾垚宸插畬鎴愮殑鐜荤拑淇℃伅id:{}", v);
+ updateSlotRemainBySlots(inSuccessGlassSlot);
+ } else if (e1 == 3) {
+ //鐮存崯澶勭悊
+ dealDamageInTask(v);
+ } else {
+ //娓呯┖鐞嗙墖绗肩┖鏁版嵁
+ noDealInTask(v);
+ }
+ });
+ for (BigStorageCageTask item : inTaskList) {
+ //鏇存柊鍘嗗彶浠诲姟琛ㄤ腑鐨勪换鍔$姸鎬�
+ bigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<BigStorageCageHistoryTask>()
+ .set(BigStorageCageHistoryTask::getTaskState, item.getTaskState())
+ .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_IN)
+ .eq(BigStorageCageHistoryTask::getTargetSlot, item.getTargetSlot())
+ .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId()));
+ item.setTargetSlot(0);
+ //娓呯┖浠诲姟琛ㄦ暟鎹�
+ bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item);
+ }
+ //娓呯┖鍚姩鐘舵��
+ //鍚憃pc鍙戦�佸惎鍔ㄤ俊鍙�
+ miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0));
+ }
+
+ @Scheduled(fixedDelay = 1000)
+ public void finishOutBigStorageTask() throws Exception {
+ ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl");
+ if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
+ log.info("褰撳墠涓洪潪鑱旀満鐘舵�侊紝缁撴潫瀹屾垚鍑虹墖浠诲姟");
+ return;
+ }
+ //鑾峰彇杩涚墖浠诲姟琛�
+ List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
+ if (CollectionUtil.isEmpty(outTaskList)) {
+ log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫瀹屾垚杩涚墖浠诲姟");
+ return;
+ }
+ List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList());
+ if (CollectionUtil.isNotEmpty(unFinishTaskList)) {
+ log.info("瀛樺湪鏈畬鎴愮殑鐜荤拑淇℃伅,鐜荤拑锛歿}", unFinishTaskList);
+ return;
+ }
+ Map<Integer, List<BigStorageCageTask>> taskMap = outTaskList.stream().collect(Collectors.groupingBy(BigStorageCageTask::getTaskState));
+ int taskType = 0;
+ if (Const.OUT_TARGET_POSITION_ALL.contains(outTaskList.get(0).getTargetSlot())) {
+ taskType = Const.BIG_STORAGE_BEFORE_OUT;
+ } else {
+ taskType = Const.BIG_STORAGE_BEFORE_DISPATCH;
+ }
+ //鎸夌収浠诲姟鐘舵�佷慨鏀瑰ぇ鐞嗙墖绗煎唴鐨勭幓鐠冩暟鎹�
+// 閲嶆柊璁$畻澶х悊鐗囩鍐呯殑鍓╀綑灏哄
+ Integer finalTaskType = taskType;
+ taskMap.forEach((e1, v) -> {
+ if (e1 == 2) {
+ //杩涚墖瀹屾垚
+ log.info("3銆佽幏鍙栬繘鐗囧凡瀹屾垚鐨勭幓鐠冧俊鎭痠d:{}", v);
+ List<Integer> outSuccessGlassSlot = new ArrayList<>();
+ if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) {
+ outSuccessGlassSlot = v.stream().map(BigStorageCageTask::getStartSlot).collect(Collectors.toList());
+ } else {
+ outSuccessGlassSlot = v.stream().map(BigStorageCageTask::getTargetSlot).collect(Collectors.toList());
+ }
+ List<UpdateBigStorageCageDTO> storageCageDTOList = v.stream().map(e -> {
+ UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO();
+ storageCageDTO.setGlassId(e.getGlassId());
+ if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) {
+ storageCageDTO.setTargetSlot(e.getStartSlot());
+ } else {
+ storageCageDTO.setTargetSlot(e.getTargetSlot());
+ }
+ return storageCageDTO;
+ }).collect(Collectors.toList());
+ if (finalTaskType.equals(Const.BIG_STORAGE_BEFORE_OUT)) {
+ bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT);
+ } else {
+ bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
+ }
+ log.info("4銆佸ぇ鐞嗙墖绗艰繘鐗囩姸鎬佸凡瀹屾垚宸插畬鎴愮殑鐜荤拑淇℃伅id:{}", v);
+ updateSlotRemainBySlots(outSuccessGlassSlot);
+ } else if (e1 == 3) {
+ //鐮存崯澶勭悊
+ dealDamageOutTask(v);
+ } else {
+ //娓呯┖鐞嗙墖绗肩┖鏁版嵁
+ noDealOutTask(v);
+ }
+ });
+ for (BigStorageCageTask item : outTaskList) {
+ //鏇存柊鍘嗗彶浠诲姟琛ㄤ腑鐨勪换鍔$姸鎬�
+ bigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<BigStorageCageHistoryTask>()
+ .set(BigStorageCageHistoryTask::getTaskState, item.getTaskState())
+ .eq(BigStorageCageHistoryTask::getTaskType, taskType)
+ .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId()));
+ //鏇存柊閽㈠寲灏忕墖琛�
+ Integer taskState = item.getTaskState();
+ if (taskState == 2) {
+ temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>()
+ .set(TemperingGlassInfo::getState, Const.TEMPERING_OUT).eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+ } else if (taskState == 3) {
+// temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+ temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>()
+ .set(TemperingGlassInfo::getState, Const.TEMPERING_DAMAGE
+ ).eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+
+ } else {
+// 绌烘墽琛�
+ }
+ }
+// 閲嶇疆浠诲姟琛ㄦ暟鎹�
+ bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task");
+ //娓呯┖鍚姩鐘舵��
+ //鍚憃pc鍙戦�佸惎鍔ㄤ俊鍙�
+ miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 0));
+ }
+
+ private void dealDamageInTask(List<BigStorageCageTask> damageTaskList) {
+// 鑾峰彇杩涚墖浠诲姟琛ㄤ腑鐘舵�佷负鐮存崯鐨勬暟鎹�
+ log.info("鐮存崯鐨勭幓鐠冧俊鎭湁锛歿}", damageTaskList);
+ //绉婚櫎鐞嗙墖绗艰鎯呰〃浠诲姟鎵ц杩囩▼涓牬鎹熺殑鐜荤拑
+ bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW)
+ .in(BigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList())));
+ //灏嗙牬鎹熶俊鎭柊澧炲叆鐮存崯琛�
+ List<Integer> slotList = new ArrayList<>();
+ for (BigStorageCageTask item : damageTaskList) {
+ Damage damage = new Damage();
+ damage.setGlassId(item.getGlassId());
+ damage.setLine(item.getStartSlot());
+ damage.setWorkingProcedure("纾ㄨ竟");
+ damage.setRemark("杩涚鍓嶅崸杞珛");
+ damage.setStatus(1);
+ damage.setType(item.getTaskState());
+ damageService.insertDamage(damage);
+ slotList.add(item.getTargetSlot());
+ }
+ //鏇存柊鏍煎瓙鍓╀綑瀹藉害
+ updateSlotRemainBySlots(slotList);
+ log.info("杩涚墖浠诲姟-鐮存崯浠诲姟鎵ц瀹屾垚");
+ }
+
+ private void dealDamageOutTask(List<BigStorageCageTask> damageTaskList) {
+// 鑾峰彇杩涚墖浠诲姟琛ㄤ腑鐘舵�佷负鐮存崯鐨勬暟鎹�
+ log.info("鐮存崯鐨勭幓鐠冧俊鎭湁锛歿}", damageTaskList);
+ //绉婚櫎鐞嗙墖绗艰鎯呰〃浠诲姟鎵ц杩囩▼涓牬鎹熺殑鐜荤拑
+ bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
+ .in(BigStorageCageDetails::getGlassId, damageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList())));
+ //灏嗙牬鎹熶俊鎭柊澧炲叆鐮存崯琛�
+ List<Integer> slotList = new ArrayList<>();
+ for (BigStorageCageTask item : damageTaskList) {
+ Damage damage = new Damage();
+ damage.setGlassId(item.getGlassId());
+ damage.setLine(item.getStartSlot());
+ damage.setWorkingProcedure("閽㈠寲鍓�");
+ damage.setRemark("杩涚鍚庡崸杞珛");
+ damage.setStatus(1);
+ damage.setType(item.getTaskState());
+ damageService.insertDamage(damage);
+ slotList.add(item.getTargetSlot());
+ slotList.add(item.getStartSlot());
+ }
+ //鏇存柊鏍煎瓙鍓╀綑瀹藉害
+ updateSlotRemainBySlots(slotList);
+ log.info("鍑虹墖浠诲姟-鐮存崯浠诲姟鎵ц瀹屾垚");
+ }
+
+ private void noDealInTask(List<BigStorageCageTask> noDealTaskList) {
+// 鑾峰彇杩涚墖浠诲姟琛ㄤ腑鐘舵�佷负鐮存崯鐨勬暟鎹�
+ log.info("鐮存崯鐨勭幓鐠冧俊鎭湁锛歿}", noDealTaskList);
+ //绉婚櫎鐞嗙墖绗艰鎯呰〃鏈墽琛屼换鍔$殑绌鸿褰曚俊鎭�
+ bigStorageCageDetailsService.remove(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW)
+ .in(BigStorageCageDetails::getGlassId, noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList())));
+ //璁板綍鏍煎瓙鍙凤紝鎸夋牸瀛愬彿鏇存柊鍓╀綑灏哄
+ List<Integer> slotList = new ArrayList<>();
+ for (BigStorageCageTask item : noDealTaskList) {
+ slotList.add(item.getTargetSlot());
+ slotList.add(item.getStartSlot());
+ }
+ //鏇存柊鏍煎瓙鍓╀綑瀹藉害
+ updateSlotRemainBySlots(slotList);
+ log.info("杩涚墖浠诲姟-鏃犲姩浣滄墽琛屽畬鎴�");
+ }
+
+ private void noDealOutTask(List<BigStorageCageTask> noDealTaskList) {
+// 鑾峰彇杩涚墖浠诲姟琛ㄤ腑鐘舵�佷负鐮存崯鐨勬暟鎹�
+ log.info("鐮存崯鐨勭幓鐠冧俊鎭湁锛歿}", noDealTaskList);
+ if (Const.OUT_TARGET_POSITION_ALL.contains(noDealTaskList.get(0).getTargetSlot())) {
+ //鍑虹墖浠诲姟:灏嗗嚭鐗囦腑鐘舵�佹仮澶嶄负鍦ㄧ鍐�
+ List<String> glassList = noDealTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+ bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
+ .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .in(BigStorageCageDetails::getGlassId, glassList));
+
+ } else {
+ //璋冨害浠诲姟锛氬皢璋冨害涓姸鎬佹敼涓哄湪绗煎唴锛屾牸瀛愬彿鎭㈠涓鸿皟搴﹀墠鐨勬牸瀛�
+ for (BigStorageCageTask item : noDealTaskList) {
+ bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
+ .set(BigStorageCageDetails::getSlot, item.getStartSlot())
+ .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .eq(BigStorageCageDetails::getGlassId, item.getGlassId()));
+ }
+ }
+ //灏嗙牬鎹熶俊鎭柊澧炲叆鐮存崯琛�
+ List<Integer> slotList = new ArrayList<>();
+ for (BigStorageCageTask item : noDealTaskList) {
+ slotList.add(item.getTargetSlot());
+ slotList.add(item.getStartSlot());
+ }
+ //鏇存柊鏍煎瓙鍓╀綑瀹藉害
+ updateSlotRemainBySlots(slotList);
+ log.info("鍑虹墖浠诲姟-鏃犲姩浣滄墽琛屽畬鎴�");
+ }
+
+ /**
+ * 鍑虹墖涓�娆′粎鐢熸垚涓�杞︾幓鐠�
+ *
+ * @param list
+ * @param <T>
+ * @return
+ */
+ private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType) {
+ //浠诲姟鏁版嵁:鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲�,鐜荤拑闂撮殧
+ List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>();
+ //鎵撹溅鍓╀綑灏哄
+ Integer remainWidth = carWidth;
+ for (T e : list) {
+ if (bigStorageCageTaskList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
+ break;
+ }
+ //璁$畻褰撳墠鍑虹墖杞﹀墿灏哄
+ remainWidth = remainWidth - Math.max((int) e.getWidth(), (int) e.getHeight()) - glassGap;
+ bigStorageCageTaskList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
+ 0));
+ }
+ Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
+ log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", bigStorageCageTaskList.size());
+ List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+ int glassCount = bigStorageCageTaskList.size();
+ //鐢熸垚鍑虹墖浠诲姟鏉℃暟涓嶈冻6琛ュ叏
+ while (bigStorageCageTaskList.size() < 6) {
+ bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0));
+ }
+ //娓呯┖浠诲姟琛ㄦ暟鎹�
+ bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task");
+ bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList);
+ List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> {
+ BigStorageCageHistoryTask history = new BigStorageCageHistoryTask();
+ BeanUtils.copyProperties(e, history);
+ history.setGlassCount(glassCount);
+ history.setTaskType(taskType);
+ return history;
+ }).collect(Collectors.toList());
+ bigStorageCageHistoryTaskService.saveBatch(historyList);
+
+ log.info("灏嗗嚭鐗囩幓鐠儃}鐜荤拑鐘舵�佹敼涓哄嚭鐗囦腑", glassIds);
+ bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
+ .set(BigStorageCageDetails::getState, state)
+ .set(Const.GLASS_STATE_SCHEDULE_ING.equals(state), BigStorageCageBaseInfo::getSlot, targetSlot)
+ .in(BigStorageCageDetails::getGlassId, glassIds));
+ try {
+ miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 1));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return Boolean.TRUE;
+ }
+
+
+ public void updateSlotRemainBySlots(List<Integer> slotList) {
+ //鑾峰彇鏍煎瓙鍐呮墍鏈夌殑鐜荤拑淇℃伅
+ List<BigStorageCageDetails> inSlotGlassList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
+ .in(BigStorageCageDetails::getSlot, slotList).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
+ Map<Integer, Double> slotRemainMap = new HashMap<>();
+ //鏄惁瀛樺湪鏈夋牸瀛愰潪绌虹殑鐜荤拑
+ if (CollectionUtil.isNotEmpty(inSlotGlassList)) {
+ //瀛樺湪 灏嗘牸瀛愬唴鐨勭幓鐠冨垎鍒繘琛屾洿鏂�
+ slotRemainMap = inSlotGlassList.stream()
+ .collect(Collectors.groupingBy(BigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap)));
+ slotRemainMap.forEach((e, v) -> {
+ double remainWidth = slotWidth - v >= 0 ? slotWidth - v : 0;
+ bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, remainWidth)
+ .eq(BigStorageCage::getSlot, e));
+ });
+ }
+ //杩囨护涓嶅瓨鍦ㄧ幓鐠冪殑鏍煎瓙 灏嗗搴﹂噸缃负鍘熷瀹藉害5000
+ Set<Integer> remainSlotList = slotRemainMap.keySet();
+ slotList.removeAll(remainSlotList);
+ if (CollectionUtil.isNotEmpty(slotList)) {
+ bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, slotWidth)
+ .in(BigStorageCage::getSlot, slotList));
+ }
+ }
+
+ private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
+ return ReadWriteEntity.builder()
+ .identifier(identifier)
+ //Kep涓槸Long绫诲瀷锛屽嵆锛欼nt32锛孞ava涓殑int绫诲瀷
+ .value(value)
+ .build();
+ }
+}
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageTask.java
index dcd3a91..8200db0 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageTask.java
@@ -11,7 +11,7 @@
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
@@ -35,7 +35,6 @@
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 javax.annotation.Resource;
@@ -85,7 +84,7 @@
private boolean sequenceOrder;
- @Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void inBigStorageTask() throws Exception {
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl");
if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
@@ -107,8 +106,24 @@
if (CollectionUtils.isEmpty(inTaskList)) {
log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫杩涚墖浠诲姟");
}
+
List<String> glassIdList = inTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
log.info("鑾峰彇浠诲姟鐨勭幓鐠僫d锛歿}", glassIdList);
+ Map<String, Long> glassCountMap = glassIdList.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting()));
+ for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) {
+ if (entry.getValue() > 1) {
+ log.info("杩涚墖鐜荤拑{}瀛樺湪鐩稿悓锛岀粨鏉熸湰娆′换鍔�", entry.getKey());
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
+ }
+ List<BigStorageCageDetails> detailsList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, glassIdList)
+ .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
+ if (CollectionUtil.isNotEmpty(detailsList)) {
+ log.info("鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑{}锛岀粨鏉熸湰娆′换鍔�", detailsList);
+ //todo:鍚憄lc鍙戦�佹姤璀�
+ return;
+ }
List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList));
Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId));
@@ -148,7 +163,7 @@
miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1));
}
- @Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void outBigStorageTask() throws Exception {
Date startDate = new Date();
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl");
@@ -243,7 +258,10 @@
if (CollectionUtils.isNotEmpty(list)) {
computeOutGlassInfo(list, "big_storage_cage_out_one_task", second.getSlot(), Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_BEFORE_DISPATCH);
}
- updateSlotRemainBySlots(Arrays.asList(second.getSlot()));
+ //浣跨敤Arrays.asList() 浣跨敤removeAll鎶ラ敊锛屾敼涓烘甯镐娇鐢↙ist
+ List<Integer> slotList = new ArrayList<>();
+ slotList.add(second.getSlot());
+ updateSlotRemainBySlots(slotList);
break loop;
}
}
@@ -254,7 +272,7 @@
return;
}
- @Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void finishInBigStorageTask() throws Exception {
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl");
if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
@@ -312,7 +330,7 @@
miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0));
}
- @Scheduled(fixedDelay = 1000)
+ // @Scheduled(fixedDelay = 1000)
public void finishOutBigStorageTask() throws Exception {
ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl");
if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) {
@@ -377,6 +395,20 @@
.set(BigStorageCageHistoryTask::getTaskState, item.getTaskState())
.eq(BigStorageCageHistoryTask::getTaskType, taskType)
.eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId()));
+ //鏇存柊閽㈠寲灏忕墖琛�
+ Integer taskState = item.getTaskState();
+ if (taskState == 2) {
+ temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>()
+ .set(TemperingGlassInfo::getState, Const.TEMPERING_OUT).eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+ } else if (taskState == 3) {
+// temperingGlassInfoService.remove(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+ temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>()
+ .set(TemperingGlassInfo::getState, Const.TEMPERING_DAMAGE
+ ).eq(TemperingGlassInfo::getGlassId, item.getGlassId()));
+
+ } else {
+// 绌烘墽琛�
+ }
}
// 閲嶇疆浠诲姟琛ㄦ暟鎹�
bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task");
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 72b79af..8cbbd60 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
@@ -10,7 +10,7 @@
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
@@ -37,7 +37,6 @@
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -98,7 +97,7 @@
private String d01GlassId = "";
private String d04GlassId = "";
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void plcToHomeEdgScan() {
Date startDate = new Date();
log.info("澶х悊鐗囩鎵爜浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -127,34 +126,34 @@
}
//鎸夌収绾胯矾鍙婄幓鐠僫d鑾峰彇鐩搁偦涓ゅ潡鐜荤拑 鍗ц浆绔嬩笂鐨勭幓鐠�: 鐘舵�佷负0涓嶆搷浣滐紙D01閫佺墖锛�0涓嶆搷浣滐紝1鍏佽閫佺墖锛夛紝璇锋眰瀛椾负1锛� 锛�02鐜荤拑id涓虹┖鎴栬�呭崸杞珛鏈惎鍔級
if (!REQUEST_WORD.equals(mesD01Value) && REQUEST_WORD.equals(d01ToMES) && (StringUtils.isBlank(d02State) || !REQUEST_WORD.equals(d03State))) {
- List<BigStorageCageFeedTask> bigStorageCageFeedTasks=bigStorageCageFeedTaskService.list(
- new LambdaQueryWrapper<BigStorageCageFeedTask>()
- .gt(BigStorageCageFeedTask::getTargetSlot,0)
- .eq(BigStorageCageFeedTask::getLine,Const.A09_OUT_TARGET_POSITION)
- .eq(BigStorageCageFeedTask::getTaskState,Const.BIG_STORAGE_IN_UP)
+ List<BigStorageCageFeedTask> bigStorageCageFeedTasks = bigStorageCageFeedTaskService.list(
+ new LambdaQueryWrapper<BigStorageCageFeedTask>()
+ .gt(BigStorageCageFeedTask::getTargetSlot, 0)
+ .eq(BigStorageCageFeedTask::getLine, Const.A09_OUT_TARGET_POSITION)
+ .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_UP)
);
- if(CollectionUtils.isEmpty(bigStorageCageFeedTasks)){
+ if (CollectionUtils.isEmpty(bigStorageCageFeedTasks)) {
if (!d01GlassId.equals(d01Id)) {
judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD01Address);
edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>()
- .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d01Id));
+ .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d01Id));
// d01GlassId = d01Id;
}
}
}
// 鐘舵�佷负0涓嶆搷浣滐紙D01閫佺墖锛�0涓嶆搷浣滐紝1鍏佽閫佺墖锛夛紝璇锋眰瀛椾负1锛� 鍗ц浆绔嬫湭鍚姩
if (!REQUEST_WORD.equals(mesD04Value) && REQUEST_WORD.equals(d04ToMES) && !REQUEST_WORD.equals(d05State)) {
- List<BigStorageCageFeedTask> bigStorageCageFeedTasks=bigStorageCageFeedTaskService.list(
+ List<BigStorageCageFeedTask> bigStorageCageFeedTasks = bigStorageCageFeedTaskService.list(
new LambdaQueryWrapper<BigStorageCageFeedTask>()
- .gt(BigStorageCageFeedTask::getTargetSlot,0)
- .eq(BigStorageCageFeedTask::getLine,Const.A10_OUT_TARGET_POSITION)
- .eq(BigStorageCageFeedTask::getTaskState,Const.BIG_STORAGE_IN_UP)
+ .gt(BigStorageCageFeedTask::getTargetSlot, 0)
+ .eq(BigStorageCageFeedTask::getLine, Const.A10_OUT_TARGET_POSITION)
+ .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_UP)
);
- if(CollectionUtils.isEmpty(bigStorageCageFeedTasks)){
+ if (CollectionUtils.isEmpty(bigStorageCageFeedTasks)) {
if (!d04GlassId.equals(d04Id)) {
judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD04Address);
edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>()
- .set(EdgGlassTaskInfo::getStatus, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d04Id));
+ .set(EdgGlassTaskInfo::getState, Const.EDG_GLASS_SUCCESS).eq(EdgGlassTaskInfo::getGlassId, d04Id));
// d04GlassId = d04Id;
}
}
@@ -164,7 +163,7 @@
log.info("澶х悊鐗囩鎵爜浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void plcToHomeEdgFreeCarTask() {
Date startDate = new Date();
log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -254,8 +253,8 @@
//鑾峰彇鍗ц浆绔嬪墿浣欏搴�
if (computeIsRun(lineFirst, lineGlassId)) {
computeTargetByLine(lineFirst);
- }else{
- log.info("褰撳墠绾胯矾锛歿}锛屾湁鎵爜鐜荤拑锛歿}",lineFirst,lineGlassId);
+ } else {
+ log.info("褰撳墠绾胯矾锛歿}锛屾湁鎵爜鐜荤拑锛歿}", lineFirst, lineGlassId);
}
}
Date endDate = new Date();
@@ -298,7 +297,7 @@
log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
}
- @Scheduled(fixedDelay = 10000)
+ // @Scheduled(fixedDelay = 10000)
public void plcToHomeEdgOutTask() {
Date startDate = new Date();
log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -421,7 +420,7 @@
}
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void updateInGlassStateTask() {
Date startDate = new Date();
log.info("1銆佸ぇ鐞嗙墖绗艰繘鐗囧畬鎴愬悗鏇存柊澶х悊鐗囩鏁版嵁浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -456,7 +455,7 @@
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void updateOutGlassStateTask() {
Date startDate = new Date();
log.info("1銆佸ぇ鐞嗙墖绗煎嚭鐗囧畬鎴愬悗鏇存柊澶х悊鐗囩鏁版嵁浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -500,7 +499,7 @@
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void updateScheduleGlassStateTask() {
Date startDate = new Date();
log.info("1銆佸ぇ鐞嗙墖绗艰皟搴﹀畬鎴愬悗鏇存柊澶х悊鐗囩鏁版嵁浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -540,7 +539,7 @@
/**
* 澶勭悊鐮存崯琛ㄤ换鍔�
*/
- @Scheduled(fixedDelay = 300)
+// @Scheduled(fixedDelay = 300)
public void dealDamageTask() {
Date startDate = new Date();
log.info("澶х悊鐗囩鐮存崯鐜荤拑娓呴櫎浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -606,7 +605,7 @@
/**
* 纭瀛楁竻绌�
*/
- @Scheduled(fixedDelay = 300)
+// @Scheduled(fixedDelay = 300)
public void confirmClear() {
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String d01ToMES = plcParameterObject.getPlcParameter("D01ToMES").getValue();
@@ -620,19 +619,19 @@
String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress();
String mesD05Address = plcParameterObject.getPlcParameter("MESToD05").getAddress();
if (!REQUEST_WORD.equals(d01ToMES)) {
- log.info("鍦板潃锛歿}鍐欏叆0",mesD01Address);
+ log.info("鍦板潃锛歿}鍐欏叆0", mesD01Address);
S7object.getinstance().plccontrol.writeWord(mesD01Address, 0);
}
if (!REQUEST_WORD.equals(d04ToMES)) {
- log.info("鍦板潃锛歿}鍐欏叆0",mesD04Address);
+ log.info("鍦板潃锛歿}鍐欏叆0", mesD04Address);
S7object.getinstance().plccontrol.writeWord(mesD04Address, 0);
}
if (!REQUEST_WORD.equals(d03ToMES)) {
- log.info("鍦板潃锛歿}鍐欏叆0",mesD03Address);
+ log.info("鍦板潃锛歿}鍐欏叆0", mesD03Address);
S7object.getinstance().plccontrol.writeWord(mesD03Address, 0);
}
if (!REQUEST_WORD.equals(d05ToMES)) {
- log.info("鍦板潃锛歿}鍐欏叆0",mesD05Address);
+ log.info("鍦板潃锛歿}鍐欏叆0", mesD05Address);
S7object.getinstance().plccontrol.writeWord(mesD05Address, 0);
}
}
@@ -640,7 +639,7 @@
/**
* 杩涚墖鐘舵�佷慨鏀�
*/
- @Scheduled(fixedDelay = 300)
+// @Scheduled(fixedDelay = 300)
public void feedStatusUpdate() {
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress();
@@ -673,8 +672,8 @@
.filter(glassIds1::contains)
.distinct()
.collect(Collectors.toList());
- log.info("D3id{},鍖归厤id:{}",glassIds1,matchingIds1);
- if(CollectionUtils.isNotEmpty(matchingIds1)){
+ log.info("D3id{},鍖归厤id:{}", glassIds1, matchingIds1);
+ if (CollectionUtils.isNotEmpty(matchingIds1)) {
bigStorageCageFeedTaskService.update(
new LambdaUpdateWrapper<BigStorageCageFeedTask>()
.in(BigStorageCageFeedTask::getGlassId, matchingIds1)
@@ -689,8 +688,8 @@
.filter(glassIds2::contains)
.distinct()
.collect(Collectors.toList());
- log.info("D5id{},鍖归厤id:{}",glassIds2,matchingIds2);
- if(CollectionUtils.isNotEmpty(matchingIds2)){
+ log.info("D5id{},鍖归厤id:{}", glassIds2, matchingIds2);
+ if (CollectionUtils.isNotEmpty(matchingIds2)) {
bigStorageCageFeedTaskService.update(
new LambdaUpdateWrapper<BigStorageCageFeedTask>()
.in(BigStorageCageFeedTask::getGlassId, matchingIds2)
@@ -701,7 +700,7 @@
}
if (CollectionUtils.isEmpty(glassIds1)) {
S7object.getinstance().plccontrol.writeWord(mesD03Address, 0);
- log.info("{}绾夸慨鏀圭幓鐠冪姸鎬佷负3",Const.A09_OUT_TARGET_POSITION);
+ log.info("{}绾夸慨鏀圭幓鐠冪姸鎬佷负3", Const.A09_OUT_TARGET_POSITION);
bigStorageCageFeedTaskService.update(
new LambdaUpdateWrapper<BigStorageCageFeedTask>()
.eq(BigStorageCageFeedTask::getLine, Const.A09_OUT_TARGET_POSITION)
@@ -713,7 +712,7 @@
}
if (CollectionUtils.isEmpty(glassIds2)) {
S7object.getinstance().plccontrol.writeWord(mesD05Address, 0);
- log.info("{}绾夸慨鏀圭幓鐠冪姸鎬佷负3",Const.A10_OUT_TARGET_POSITION);
+ log.info("{}绾夸慨鏀圭幓鐠冪姸鎬佷负3", Const.A10_OUT_TARGET_POSITION);
bigStorageCageFeedTaskService.update(
new LambdaUpdateWrapper<BigStorageCageFeedTask>()
.eq(BigStorageCageFeedTask::getLine, Const.A10_OUT_TARGET_POSITION)
@@ -749,7 +748,7 @@
edgGlassTaskInfoList = edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>()
.eq(EdgGlassTaskInfo::getLine, line)
.apply("time >= (select time from edg_glass_task_info where line='" + line + "' and glass_id = '" + glassId + "' and deleted = 0)")
- .orderByAsc(EdgGlassTaskInfo::getTime));
+ .orderByAsc(EdgGlassTaskInfo::getCreateTime));
if (edgGlassTaskInfoList.size() == 0) {
edgGlassTaskInfoList = edgGlassTaskInfoService.list(new QueryWrapper<EdgGlassTaskInfo>()
.select("Top 1 *")
@@ -987,7 +986,7 @@
returnData = glassIds2;
}
// returnData = s7control.readWord(outLine, 1).get(0);
- log.info("宸插悜plc绗瑊}娆″彂閫佽繘鐗囦换鍔$‘璁わ紝鍦板潃涓猴細{},鍐欏叆鐨勫唴瀹逛负{},璇诲埌鐨勮姹備负{}", count++, outLine, 2,returnData);
+ log.info("宸插悜plc绗瑊}娆″彂閫佽繘鐗囦换鍔$‘璁わ紝鍦板潃涓猴細{},鍐欏叆鐨勫唴瀹逛负{},璇诲埌鐨勮姹備负{}", count++, outLine, 2, returnData);
}
// while (returnData != 0) {
// s7control.writeWord(outLine, 2);
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/BigStorageBaseService.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/BigStorageBaseService.java
index 0402283..e611458 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/BigStorageBaseService.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/BigStorageBaseService.java
@@ -1,6 +1,6 @@
package com.mes.tools.service;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.glassinfo.entity.GlassInfo;
import java.util.List;
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
index b7e267c..2cd4787 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/tools/service/impl/BigStorageBaseServiceImpl.java
@@ -7,7 +7,7 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
-import com.mes.bigstorage.entity.BigStorageDTO;
+import com.mes.bigstorage.entity.dto.BigStorageDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
@@ -20,7 +20,6 @@
import com.mes.tools.service.BigStorageBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -554,7 +553,7 @@
}
- @Scheduled(fixedDelay = 300)
+ // @Scheduled(fixedDelay = 300)
public void querySizeByEngineerTask() {
log.info("鏌ヨ缁撴灉锛歿}", querySizeByEngineer("P24072402", 1, 10, 8));
log.info("鏌ヨ缁撴灉锛歿}", querySizeByEngineer("P24072402", 1, 5, 8));
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-yw.yml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-yw.yml
index 982bd7e..4ac536a 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-yw.yml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application-yw.yml
@@ -14,6 +14,11 @@
username: root
password: beibo.123/
driver-class-name: com.mysql.cj.jdbc.Driver
+ salve_hangzhoumes:
+ url: jdbc:sqlserver://192.168.2.100:1433;databasename=mes
+ username: sa
+ password: beibo.123/
+ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
cloud:
nacos:
discovery:
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
index b130faf..9aa2b87 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/application.yml
@@ -3,7 +3,7 @@
spring:
profiles:
- active: cz
+ active: yw
application:
name: cacheVerticalGlass
liquibase:
@@ -15,21 +15,28 @@
thread-name-prefix: task-cacheVertical
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
-# configuration:
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ configuration:
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mes:
sequence:
- order: false
- minCount: 20
- carWidth: 5000 #澶ц溅瀹藉害
- slotWidth: 5500 #澶ц溅瀹藉害
- inCarMaxSize: 2 #杩涚墖澶ц溅鏈�澶у瓨鏀剧幓鐠冩暟閲�
+ order: true
+ minCount: 30
+ carWidth: 6200 #澶ц溅瀹藉害
+ slotWidth: 6200 #澶ц溅瀹藉害
+ inCarMaxSize: 5 #杩涚墖澶ц溅鏈�澶у瓨鏀剧幓鐠冩暟閲�
outCarMaxSize: 3 #鍑虹墖澶ц溅鏈�澶у瓨鏀剧幓鐠冩暟閲�
- glassGap: 350 #鐜荤拑闂磋窛
+ glassGap: 250 #鐜荤拑闂磋窛
xMaxSize: 2800
scan:
ip: 192.168.30.199
port: 5000
kangaroohy:
milo:
- enabled: false
\ No newline at end of file
+ enabled: true
+ primary: default
+ config:
+ default:
+ endpoint: opc.tcp://192.168.2.100:49320
+ security-policy: basic256sha256
+ username: admin
+ password: 1qaz2wsx3edc4rfv
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
index 5ef3b71..0c164f2 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -19,24 +19,32 @@
<result column="remain_width" property="remainWidth"/>
</resultMap>
+ <resultMap id="virtualSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageRelationDTO">
+ <result column="engineer_id" property="engineerId"/>
+ <result column="tempering_layout_id" property="temperingLayoutId"/>
+ <result column="virtual_slot" property="virtualSlot"/>
+ </resultMap>
+ <resultMap id="baseSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageSequenceDTO">
+ <result column="slot" property="slot"/>
+ <result column="max_sequence" property="maxSequence"/>
+ <result column="min_sequence" property="minSequence"/>
+ </resultMap>
+
<select id="temperingIsAll" resultMap="temperingLayoutDTO">
SELECT T2.*
FROM (
SELECT T.ENGINEER_ID,
T.TEMPERING_LAYOUT_ID,
COUNT(T.TEMPERING_FEED_SEQUENCE) AS COUNT
- FROM
- GLASS_INFO T
- LEFT JOIN DAMAGE T1
- ON T.ENGINEER_ID = T1.ENGINEER_ID
- AND T.GLASS_ID = T1.GLASS_ID
- AND (T1.TYPE = 8
- OR T1.TYPE = 9 )
- WHERE
- T1.GLASS_ID IS NULL
- GROUP BY
- T.ENGINEER_ID,
- T.TEMPERING_LAYOUT_ID
+ FROM GLASS_INFO T
+ LEFT JOIN DAMAGE T1
+ ON T.ENGINEER_ID = T1.ENGINEER_ID
+ AND T.GLASS_ID = T1.GLASS_ID
+ AND (T1.TYPE = 8
+ OR T1.TYPE = 9)
+ WHERE T1.GLASS_ID IS NULL
+ GROUP BY T.ENGINEER_ID,
+ T.TEMPERING_LAYOUT_ID
) T2
INNER JOIN (SELECT ENGINEER_ID, TEMPERING_LAYOUT_ID, COUNT(TEMPERING_FEED_SEQUENCE) AS COUNT
FROM BIG_STORAGE_CAGE_DETAILS
@@ -44,7 +52,7 @@
GROUP BY ENGINEER_ID, TEMPERING_LAYOUT_ID) T3 ON T2.ENGINEER_ID = T3.ENGINEER_ID
AND T2.TEMPERING_LAYOUT_ID = T3.TEMPERING_LAYOUT_ID
AND T2.COUNT = T3.COUNT
- INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID=T4.ENGINEER_ID
+ INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID = T4.ENGINEER_ID
ORDER BY T4.ID, T2.TEMPERING_LAYOUT_ID
</select>
@@ -95,13 +103,66 @@
</update>
<select id="selectTemperingGlassCount" resultType="java.util.Map">
- select a.engineer_id,a.tempering_layout_id,count2,count1,count2-count1 as count3,count(c.glass_id) as count4 from
- (select engineer_id,tempering_layout_id,count(*) as count1 from big_storage_cage_details where state=100 group by engineer_id,tempering_layout_id) as a
- left join
- (select engineer_id,tempering_layout_id,count(*) as count2 from glass_info group by engineer_id,tempering_layout_id) as b
- on a.engineer_id=b.engineer_id and a.tempering_layout_id=b.tempering_layout_id
- left join damage as c on a.engineer_id=c.engineer_id and a.tempering_layout_id=c.tempering_layout_id and (type = 8 or type = 9)
- group by a.engineer_id,a.tempering_layout_id
- order by a.engineer_id,a.tempering_layout_id
+ select a.engineer_id,
+ a.tempering_layout_id,
+ count2,
+ count1,
+ count2 - count1 as count3,
+ count(c.glass_id) as count4
+ from (select engineer_id, tempering_layout_id, count(*) as count1
+ from big_storage_cage_details
+ where state = 100
+ group by engineer_id, tempering_layout_id) as a
+ left join
+ (select engineer_id, tempering_layout_id, count(*) as count2
+ from glass_info
+ group by engineer_id, tempering_layout_id) as b
+ on a.engineer_id = b.engineer_id and a.tempering_layout_id = b.tempering_layout_id
+ left join damage as c
+ on a.engineer_id = c.engineer_id and a.tempering_layout_id = c.tempering_layout_id and
+ (type = 8 or type = 9)
+ group by a.engineer_id, a.tempering_layout_id
+ order by a.engineer_id, a.tempering_layout_id
+ </select>
+
+ <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">
+ with relation_temp as (
+ select engineer_id, tempering_layout_id, virtual_slot, count(1) as slot_count
+ from big_storage_glass_relation_info
+ group by engineer_id, tempering_layout_id, virtual_slot
+ ),
+ details_temp as (
+ select t.engineer_id, t.tempering_layout_id, t.virtual_slot, count(1) as slot_count
+ from big_storage_glass_relation_info t
+ left join big_storage_cage_details t1 on t.glass_id = t1.glass_id
+ where t1.state = 100
+ group by t.engineer_id, t.tempering_layout_id, t.virtual_slot
+ ),
+ result_one as (
+ select t.*, t1.slot_count as tslot_count
+ from relation_temp t
+ INNER JOIN details_temp t1 on t.engineer_id = t1.engineer_id and
+ t.tempering_layout_id = t1.tempering_layout_id and
+ t.virtual_slot = t1.virtual_slot
+ where t.slot_count = t1.slot_count
+ )
+ select engineer_id, tempering_layout_id, virtual_slot
+ from result_one
+ order by engineer_id, tempering_layout_id
+ </select>
+
+ <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO">
+ with glass_id_temp as (
+ select glass_id
+ from big_storage_glass_relation_info
+ where (engineer_id, tempering_layout_id, virtual_slot) =
+ (#{engineerId}, #{temperingLayoutId}, #{virtualSlot})
+ )
+ select t.slot, max(t1.slot_sequence) as max_sequence, min(t1.slot_sequence) as min_sequence
+ from big_storage_cage_details t
+ inner join big_storage_glass_relation_info t1 on t.glass_id = t1.glass_id
+ where t.glass_id in (select * from glass_id_temp)
+ group by t.slot
+ order by max_sequence
</select>
</mapper>
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
index 954de19..3c508d8 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageFeedTaskMapper.xml
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper">
- <resultMap id="bigStorageDTO" type="com.mes.bigstorage.entity.BigStorageDTO">
+ <resultMap id="bigStorageDTO" type="com.mes.bigstorage.entity.dto.BigStorageDTO">
<result column="REMAIN_WIDTH" property="width"/>
<result column="GLASS_COUNT" property="glassCount"/>
</resultMap>
diff --git a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/ywChangelog.sql b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/ywChangelog.sql
index 9832dd6..b4fb95c 100644
--- a/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/ywChangelog.sql
+++ b/hangzhoumesParent/moduleService/TemperingGlassModule/src/main/resources/changelog/ywChangelog.sql
@@ -303,3 +303,46 @@
INSERT INTO big_storage_cage_out_two_task(glass_id, start_slot, target_slot, task_state)
VALUES (NULL, 0, 0, 0);
+
+-- changeset zsh:20241126001
+-- preconditions onFail:CONTINUE onError:CONTINUE
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_info' and table_schema = 'hangzhoumes';
+CREATE TABLE big_storage_glass_info
+(
+ id bigint NOT NULL AUTO_INCREMENT COMMENT '澶х悊鐗囩淇℃伅琛╥d',
+ glass_id varchar(20) DEFAULT NULL COMMENT '鐜荤拑id',
+ flow_card_id varchar(20) DEFAULT NULL COMMENT '娴佺▼鍗″彿',
+ glass_type int DEFAULT NULL COMMENT '鐜荤拑绫诲瀷',
+ width double DEFAULT NULL COMMENT '瀹�',
+ height double DEFAULT NULL COMMENT '楂�',
+ thickness double DEFAULT NULL COMMENT '鍘氬害',
+ tempering_layout_id int DEFAULT NULL COMMENT '閽㈠寲鐗堝浘id',
+ tempering_feed_sequence int DEFAULT NULL COMMENT '閽㈠寲鐗堝浘鐗囧簭',
+ x_coordinate int DEFAULT NULL COMMENT 'x鍧愭爣',
+ y_coordinate int DEFAULT NULL COMMENT 'y鍧愭爣',
+ engineer_id varchar(50) DEFAULT NULL,
+ layer int DEFAULT NULL COMMENT '灞傚彿',
+ virtual_slot int DEFAULT NULL COMMENT '铏氭嫙鏍煎瓙鍙�',
+ slot_sequence int DEFAULT NULL COMMENT '鏍煎瓙娆″簭',
+ PRIMARY KEY (id) USING BTREE
+);
+-- rollback DROP TABLE big_storage_glass_info;
+
+-- changeset zsh:20241126002
+-- preconditions onFail:CONTINUE onError:CONTINUE
+-- precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'big_storage_glass_relation_info' and table_schema = 'hangzhoumes';
+CREATE TABLE big_storage_glass_relation_info
+(
+ id bigint NOT NULL AUTO_INCREMENT COMMENT '閽㈠寲鐜荤拑鍏崇郴琛╥d',
+ engineer_id varchar(50) DEFAULT NULL,
+ glass_id varchar(20) DEFAULT NULL COMMENT '鐜荤拑id',
+ tempering_layout_id int DEFAULT NULL COMMENT '閽㈠寲鐗堝浘id',
+ tempering_feed_sequence int DEFAULT NULL COMMENT '閽㈠寲鐗堝浘鐗囧簭',
+ virtual_slot int DEFAULT NULL COMMENT '铏氭嫙鏍煎瓙',
+ slot_sequence int DEFAULT NULL COMMENT '鏍煎瓙鍐呮搴�',
+ slot int DEFAULT NULL COMMENT '瀹為檯鏍煎瓙鍙�',
+ device_id int DEFAULT NULL COMMENT '瀹為檯绗煎瓙鍙�',
+ PRIMARY KEY (id) USING BTREE
+);
+-- rollback DROP TABLE big_storage_glass_relation_info;
+
--
Gitblit v1.8.0