From c3889b92e80992524e0f60371edf775ca7e28922 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期五, 12 七月 2024 13:50:26 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
---
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 97 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
index 4791b00..1ac00f6 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -66,14 +66,22 @@
@Value("${mes.sequence.order}")
private boolean sequenceOrder;
- @Value("${mes.firstLength}")
+ @Value("${mes.max.firstLength}")
private String firstLength;
- @Value("${mes.secondLength}")
+ @Value("${mes.max.secondLength}")
private String secondLength;
+ @Value("${mes.min.firstLength}")
+ private String minFirstLength;
+ @Value("${mes.min.secondLength}")
+ private String minSecondLength;
+
+ @Scheduled(fixedDelay = 1000)
public void plcHomeEdgTask() {
+ Date startDate = new Date();
+ log.info("鏈浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue();
String glassIdeValue = plcParameterObject.getPlcParameter("A05_scanning_ID").getValue();
@@ -118,6 +126,8 @@
inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
}
}
+ Date endDate = new Date();
+ log.info("鏈浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms", endDate, endDate.getTime() - startDate.getTime());
}
public void plcToHomeEdgTask() {
@@ -235,7 +245,7 @@
// 1.2.3銆佹寜鐓у嚭鐗囦俊鎭幓璇︽儏琛ㄦ煡璇㈡牸瀛愬湪绗煎瓙閲岄潰鍓╀綑鐩稿悓灏哄鐨勭幓鐠冩暟鎹笖浠ョ増鍥緄d銆佺増搴忓崌搴忔帓搴� 鍙栫涓�鍧楃幓鐠冨嚭鐗�
// 2銆佸鏋滄病鏈夊巻鍙插嚭鐗囦换鍔�
// 2.1銆佸嚭褰撳墠鐗堝浘id鏈�灏忕増搴忔渶灏忕殑鐜荤拑锛堥棶棰橈細涓ゆ潯绾块兘娌℃湁鍘嗗彶浠诲姟锛屽嚭鐗囨椂涓ゆ潯绾跨殑鐜荤拑灏哄鐩稿悓锛屾槸鍚︽壘灏哄涓嶅悓鐨勶級
- if (out08Glassstate == 2 && out10Glassstate == 2) {
+ if ((out08Glassstate == 2 && out10Glassstate == 2) || (out08Glassstate == 0 && out10Glassstate == 0)) {
log.info("A09銆丄10涓簕},{}闈炶嚜鍔ㄧ姸鎬侊紝鏃犳硶鍑虹墖");
return Boolean.FALSE;
}
@@ -257,10 +267,10 @@
EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL);
endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate);
} else {
- //鍒ゆ柇涓ゆ潯绾挎槸鍚﹂兘绌洪棽
- endcell = out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+ //鎸夌収鐘舵�佸垽鏂袱鏉$嚎璧伴偅鏉$嚎
+ endcell = computerLineByState(out08Glassstate, out10Glassstate);
- if ((out08Glassstate == 0 && out10Glassstate == 0) || (out08Glassstate == 1 && out10Glassstate == 1)) {
+ if (out08Glassstate == 1 && out10Glassstate == 1) {
EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL);
EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL);
if (a09EdgGlass == null && a10EdgGlass == null) {
@@ -272,6 +282,10 @@
wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
"case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
"on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+ } else {
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+ "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
}
wrapper.last("order by count(t.glass_id) desc limit 2");
List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
@@ -280,9 +294,13 @@
.selectAll(GlassInfo.class).eq("t.glass_id", glassId);
// .inSql("t.engineer_id", "select engineer_id from engineering where state = 1");
if (endcell == Const.A10_OUT_TARGET_POSITION) {
- queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
- "case when width < height then width else height end as second_length from glass_info) t1 " +
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
"on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+ } else {
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+ "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
}
GlassInfo one = glassInfoService.getOne(queryWrapper);
if (one != null) {
@@ -467,18 +485,20 @@
*/
private Integer queryLineByGlassInfo(EdgStorageCageDetails a08EdgStorageCageDetails, EdgStorageCageDetails a10EdgStorageCageDetails,
EdgStorageCageDetails glassInfo, int out08Glassstate, int out10Glassstate) {
- boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight() == glassInfo.getHeight()
- && a08EdgStorageCageDetails.getWidth() == glassInfo.getWidth();
- boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight() == glassInfo.getHeight()
- && a10EdgStorageCageDetails.getWidth() == glassInfo.getWidth();
//瀛樺湪鍑虹墖浠诲姟 07涓虹┖
- if (b10) {
- return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+ if (out08Glassstate == 1 && out10Glassstate == 1) {
+ boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight() == glassInfo.getHeight()
+ && a08EdgStorageCageDetails.getWidth() == glassInfo.getWidth();
+ boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight() == glassInfo.getHeight()
+ && a10EdgStorageCageDetails.getWidth() == glassInfo.getWidth();
+ if (b08) {
+ return Const.A09_OUT_TARGET_POSITION;
+ }
+ if (b10) {
+ return Const.A10_OUT_TARGET_POSITION;
+ }
}
- if (b08) {
- return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION;
- }
- return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
+ return computerLineByState(out08Glassstate, out10Glassstate);
}
/**
@@ -494,10 +514,14 @@
wrapper.select("count(t.glass_id) as count, t.width, t.height")
.eq("t.state", Const.GLASS_STATE_IN)
.groupBy("t.width, t.height");
- if (endcell == Const.A09_OUT_TARGET_POSITION) {
+ if (endcell == Const.A10_OUT_TARGET_POSITION) {
wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
"case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
"on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") ");
+ } else {
+ wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " +
+ "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " +
+ "on t.glass_id = t1.glass_id and (t1.first_length >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") ");
}
wrapper.last("order by count(t.glass_id) desc limit 2");
List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper);
@@ -587,7 +611,7 @@
boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), glassInfo.getSlot(), endcell, Const.GLASS_CACHE_TYPE_OUT);
log.info("6銆佹坊鍔犲嚭鐗囦换鍔℃槸鍚﹀畬鎴愶細{}", taskCacheStatus);
}
- boolean glassSizeStatus = saveGlassSize(glassInfo);
+ boolean glassSizeStatus = saveGlassSize(glassInfo, endcell);
log.info("7銆佹坊鍔犲嚭鐗囩幓鐠冨昂瀵镐俊鎭埌纾ㄨ竟鍓嶇幓鐠冭〃鏄惁瀹屾垚锛歿}", glassSizeStatus);
S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1);
log.info("8銆佸彂閫佺‘璁ゅ瓧宸插畬鎴�");
@@ -620,19 +644,42 @@
* 娣诲姞鐞嗙墖绗间换鍔�
*
* @param glassInfo
+ * @param endcell
* @return
*/
- private boolean saveGlassSize(EdgStorageCageDetails glassInfo) {
+ private boolean saveGlassSize(EdgStorageCageDetails glassInfo, int endcell) {
EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo();
BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo);
edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio));
edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio));
edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio));
edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE);
+ edgGlassTaskInfo.setLine(endcell);
+ edgGlassTaskInfo.setTime(new Date());
return edgGlassTaskInfoService.save(edgGlassTaskInfo);
}
-
+ /**
+ * 璁$畻鍑虹墖绾胯矾
+ * 宸叉帓闄ら兘涓�2 閮戒负0 鐨勬儏鍐�
+ *
+ * @param out08Glassstate
+ * @param out10Glassstate
+ * @return
+ */
+ private int computerLineByState(int out08Glassstate, int out10Glassstate) {
+ if (out08Glassstate == 0) {
+ if (out10Glassstate == 2) {
+ return Const.A09_OUT_TARGET_POSITION;
+ } else {
+ return Const.A10_OUT_TARGET_POSITION;
+ }
+ } else if (out08Glassstate == 1) {
+ return Const.A09_OUT_TARGET_POSITION;
+ } else {
+ return Const.A10_OUT_TARGET_POSITION;
+ }
+ }
@Scheduled(fixedDelay = 1000)
public void CacheGlassTasks() {
@@ -641,8 +688,8 @@
List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory();
jsonObject.append("currentCutTerritory", currentCutTerritorys);
//纾ㄨ竟淇℃伅
- List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo(Const.A09_OUT_TARGET_POSITION.toString());
- List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo(Const.A10_OUT_TARGET_POSITION.toString());
+ List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001");
+ List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002");
jsonObject.append("EdgTasks1", EdgTasks1);
jsonObject.append("EdgTasks2", EdgTasks2);
@@ -650,7 +697,6 @@
List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages();
jsonObject.append("EdgStorageCageinfos", EdgStorageCageinfos);
- log.info("鎺ㄩ�佹暟鎹細{}",jsonObject);
ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass");
if (sendwServer != null) {
for (WebSocketServer webserver : sendwServer) {
@@ -667,7 +713,6 @@
}
}
}
-
}
--
Gitblit v1.8.0