From 21505b0334dc8356a03c8a322d5188e3c62eb792 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 07 十一月 2024 15:24:03 +0800
Subject: [PATCH] 1、上片功能自测已完成等待联调
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/mapper/UpPattenUsageMapper.java | 4 +++-
hangzhoumesParent/common/servicebase/src/main/resources/mapper/UpPattenUsageMapper.xml | 8 ++++++++
hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml | 3 +++
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/OpcLoadGlassTask.java | 28 ++++++++++++++++++++--------
4 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/mapper/UpPattenUsageMapper.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/mapper/UpPattenUsageMapper.java
index 42e4308..b3d3233 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/mapper/UpPattenUsageMapper.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/mapper/UpPattenUsageMapper.java
@@ -9,7 +9,7 @@
/**
* <p>
- * Mapper 鎺ュ彛
+ * Mapper 鎺ュ彛
* </p>
*
* @author zhoush
@@ -18,4 +18,6 @@
public interface UpPattenUsageMapper extends MPJBaseMapper<UpPattenUsage> {
List<UpPattenUsageVO> queryRawGlassByEngineeringId(@Param("engineeringId") String engineerId);
+
+ List<Integer> queryFinishByEngineering(@Param("stationCell") Integer deviceId, @Param("finishCount") int finishCount);
}
diff --git a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/UpPattenUsageMapper.xml b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/UpPattenUsageMapper.xml
index 951829c..e859f86 100644
--- a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/UpPattenUsageMapper.xml
+++ b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/UpPattenUsageMapper.xml
@@ -27,6 +27,14 @@
and t.state = 0
ORDER BY t.layout_sequence
</select>
+ <select id="queryFinishByEngineering" resultType="java.lang.Integer">
+ SELECT id
+ FROM up_patten_usage
+ WHERE engineering_id IN (SELECT engineer_id FROM engineering WHERE station_cell = #{stationCell} AND state = 1)
+ and state = 0
+ order by id
+ LIMIT ${finishCount}
+ </select>
</mapper>
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/OpcLoadGlassTask.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/OpcLoadGlassTask.java
index 3471b59..8229684 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/OpcLoadGlassTask.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/OpcLoadGlassTask.java
@@ -17,6 +17,7 @@
import com.mes.uppattenusage.mapper.UpPattenUsageMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@@ -65,19 +66,22 @@
//2銆�1鍙蜂笂鐗囦綅鏄惁鏈夊師鐗囷紝鍘熺墖灏哄鏄惁鍜屼笂鐗囧緟涓婄墖鐨勫昂瀵镐竴鑷�
//3銆�1鍙锋棤鍘熺墖锛屼笖娌℃湁鏋跺瓙锛�2鍙蜂笂鐗囦綅灏哄鏄惁鍜屽甫涓婄墖灏哄涓�鑷�
//4銆佷笉涓�鑷村彲鑳藉嚭鐜扮幓鐠冪牬鎹熷鑷寸殑涓婁竴鏋跺師鐗囨暟閲忎笉澶�
+ @Scheduled(fixedDelay = 300)
public void opcLoadGlassOne() {
opcLoadGlassChild(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE);
}
+ @Scheduled(fixedDelay = 300)
public void opcLoadGlassTwo() {
opcLoadGlassChild(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE);
}
-
+ @Scheduled(fixedDelay = 300)
public void opcLoadGlassOneFinish() {
opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_ONE_TASK, LOAD_GLASS_ONE_DEVICE);
}
+ @Scheduled(fixedDelay = 300)
public void opcLoadGlassTwoFinish() {
opcLoadGlassFinishChid(LOAD_GLASS_DEVICE_TWO_TASK, LOAD_GLASS_TWO_DEVICE);
}
@@ -87,11 +91,12 @@
.eq(Engineering::getState, Const.ENGINEERING_RUNNING).eq(Engineering::getStationCell, deviceId));
if (null == engineering) {
log.info("{}涓婄墖绾匡紝娌℃湁宸ョ▼浠诲姟", deviceId);
+ return;
}
//浠诲姟鏆傚仠
LoadGlassDeviceTask task = loadGlassDeviceTaskService.queryTaskMessage(tableName);
- if ("1".equals(task.getTaskState())) {
- log.info("鏈夋鍦ㄦ墽琛岀殑涓婄墖浠诲姟锛岀粨鏉熸湰鍦颁笂鐗囪姹�");
+ if (task.getTaskRunning().equals(Const.ENGINEERING_RUNNING)) {
+ log.info("{}涓婄墖绾匡紝鏈夋鍦ㄦ墽琛岀殑浠诲姟锛岀粨鏉熸湰鍦颁笂鐗囪姹�", deviceId);
return;
}
List<UpPattenUsageVO> pattenUsageList = upPattenUsageMapper.queryRawGlassByEngineeringId(engineering.getEngineerId());
@@ -104,7 +109,7 @@
Map<String, List<UpPattenUsageVO>> upListMap = pattenUsageList.stream()
.collect(Collectors.groupingBy(UpPattenUsageVO::getGroupNumber));
log.info("鑾峰彇褰撳墠闇�瑕佷笂鐗囩殑鍘熺墖鏁版嵁");
- List<UpPattenUsageVO> usageVOS = upListMap.get(0);
+ List<UpPattenUsageVO> usageVOS = upListMap.get("1");
// 鑾峰彇1鍙蜂笂鐗囦綅鏄湁鏋跺瓙涓旀湁鐜荤拑
List<Integer> loadStation = LOAD_GLASS_DEVICE_ONE_TASK.equals(tableName) ? LOAD_STATION_01 : LOAD_STATION_02;
List<RawGlassStorageDetails> loadStationList = rawGlassStorageDetailsService.list(new LambdaQueryWrapper<RawGlassStorageDetails>()
@@ -118,7 +123,7 @@
RawGlassStorageDetails oneLoadStation = loadStationList.stream().filter(e -> e.getSlot().equals(loadStation.get(0))).findFirst().orElse(null);
if (null == oneLoadStation) {
RawGlassStorageDetails twoLoadStation = loadStationList.stream().filter(e -> e.getSlot().equals(loadStation.get(1))).findFirst().orElse(null);
- if (!compareRawSize(usageVOS.get(0), oneLoadStation)) {
+ if (!compareRawSize(usageVOS.get(0), twoLoadStation)) {
log.info("浜屽彿涓婄墖浣嶆湁鏋跺瓙锛屽師鐗囨暟閲忎负0鎴栬�呭師鐗囦俊鎭笌寰呬笂鐗囧昂瀵镐笉涓�鑷达紝缁撴潫鏈涓婄墖浠诲姟锛岀瓑寰呬粨鍌ㄨ皟搴︿换鍔�");
return;
}
@@ -151,8 +156,12 @@
private void opcLoadGlassFinishChid(String tableName, Integer deviceId) {
LoadGlassDeviceTask task = loadGlassDeviceTaskService.queryTaskMessage(tableName);
+ if (task.getTaskRunning().equals(Const.ENGINEERING_NEW)) {
+ log.info("鏃犱换鍔�,缁撴潫");
+ return;
+ }
if (task.getTaskState() <= 1) {
- log.info("鏃犱换鍔℃垨浠诲姟姝e湪鎵ц涓�");
+ log.info("浠诲姟姝e湪鎵ц,缁撴潫");
return;
}
//鑾峰彇浠诲姟瀹屾垚鎯呭喌
@@ -165,11 +174,14 @@
.inSql("slot", "select slot from raw_glass_storage_station where enable_state = 1")
.eq("slot", task.getSlot())
.eq("state", Const.RAW_GLASS_STATE_IN)
- .set("remain_quantity", "remain_quantity - " + (finishCount + damageCount)));
+ .setSql("remain_quantity = remain_quantity - " + (finishCount + damageCount)));
//鏇存柊宸ョ▼涓嬬殑鍘熺墖鏁伴噺 todo:sql寰呬紭鍖�
+
+ List<Integer> ids = upPattenUsageMapper.queryFinishByEngineering(deviceId, finishCount);
upPattenUsageMapper.update(null, new LambdaUpdateWrapper<UpPattenUsage>()
- .inSql(UpPattenUsage::getId, " SELECT id FROM up_patten_usage ORDER BY id ASC LIMIT 10")
+ .in(UpPattenUsage::getId, ids)
.set(UpPattenUsage::getState, Const.LOAD_RAW_GLASS_SUCCESS));
+
//todo:浠诲姟琛ㄦ暟鎹儏鍐�
task.setTaskRunning(0);
task.setTotalCount(0);
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
index e7d0a13..1e1ef3b 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/application-dev.yml
@@ -19,6 +19,9 @@
username: root
password: beibo.123/
driver-class-name: com.mysql.cj.jdbc.Driver
+ druid:
+ wall:
+ multi-statement-allow: true
cloud:
nacos:
discovery:
--
Gitblit v1.8.0