From 7567163fa367e2045a165ec86ea1c4bc79cea4a6 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 16 十月 2024 10:08:59 +0800
Subject: [PATCH] 版本整合05
---
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 128 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 119 insertions(+), 9 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 474bbf0..37eb415 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
@@ -80,6 +80,12 @@
@Value("${mes.max.secondLength}")
private String secondLength;
+ @Value("${mes.cache.cacheWidth}")
+ private double cacheWidth;
+
+ @Value("${mes.cache.cacheHeight}")
+ private double cacheHeight;
+
@Value("${mes.min.one.firstLength}")
private String minOneFirstLength;
@@ -94,7 +100,7 @@
public static String engineerId = "";
- //@Scheduled(fixedDelay = 1000)
+ @Scheduled(fixedDelay = 1000)
public void plcHomeEdgTask() {
Date startDate = new Date();
log.info("鏈浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
@@ -107,6 +113,13 @@
String out10Glassstate = plcParameterObject.getPlcParameter("A10_glass_status").getValue();
String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress();
String currentSlot = plcParameterObject.getPlcParameter("Current_slot").getValue();
+
+// taskRequestTypeValue = "3";
+// out08Glassstate = "1";
+// out10Glassstate = "1";
+// currentSlot = "2";
+// confirmationWrodValue = "0";
+// glassIdeValue = "P24092706|15|5";
log.info("1銆佽幏鍙栧埌鐨勮姹傚瓧涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{}锛岃幏鍙栧埌鐨勭‘璁ゅ瓧涓猴細{}锛岃幏鍙栧埌鐨勫嚭鐗囩姸鎬佸垎鍒负锛欰09:{}銆丄10:{},褰撳墠鏍煎瓙鍙蜂负锛歿}",
taskRequestTypeValue, glassIdeValue, confirmationWrodValue, out08Glassstate, out10Glassstate, currentSlot);
@@ -132,7 +145,7 @@
//09绌洪棽 锛�1 10绌洪棽 锛�2 閮界┖闂诧細3 鍏朵粬0
log.info("2銆佸嚭鐗囪姹傦紝涓旂‘璁ゅ瓧涓�0锛屾墽琛屽嚭鐗囦换鍔�");
outTo(Integer.parseInt(out08Glassstate),
- Integer.parseInt(out10Glassstate), confirmationWrodAddress, "", 0);
+ Integer.parseInt(out10Glassstate), confirmationWrodAddress, "", Integer.parseInt(currentSlot));
} else if ("3".equals(taskRequestTypeValue)) {
log.info("2銆佽繘鐗囧拰鍑虹墖閮界┖闂诧紝鎵ц鍑虹墖浠诲姟");
//鍔犵瀛愰噷闈㈡槸鍚︽湁鐜荤拑锛屾湁鍏堝嚭锛屾棤鐜荤拑鍏堣繘
@@ -165,9 +178,9 @@
Damage damage = new Damage();
damage.setGlassId(e.getGlassId());
damage.setLine(e.getEndCell());
- damage.setWorkingProcedure("鍐峰姞宸�");
+ damage.setWorkingProcedure("纾ㄨ竟");
damage.setRemark("纾ㄨ竟鍓嶅崸寮忕悊鐗�");
- damage.setStatus(0);
+ damage.setStatus(1);
damage.setType(e.getTaskStatus());
return damage;
}).collect(Collectors.toList());
@@ -187,6 +200,16 @@
*/
public void inTo(String glassId, String confirmationWrodAddress, String currentSlot) {
log.info("1銆佹寜鐓х幓鐠僫d:{}鑾峰彇鐜荤拑灏忕墖淇℃伅,褰撳墠鏍煎瓙涓�:{}", glassId, currentSlot);
+
+ GlassInfo feedGlassInfo = glassInfoService.getOne(
+ new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getGlassId, glassId)
+ );
+ if (Math.max(feedGlassInfo.getWidth(), feedGlassInfo.getHeight()) > cacheWidth || Math.min(feedGlassInfo.getWidth(), feedGlassInfo.getHeight()) > cacheHeight) {
+ log.info("1.1銆佺幓鐠冭秴杩囧崸寮忕悊鐗囨渶澶у昂瀵�:{}", feedGlassInfo);
+ return;
+ }
+
//娣诲姞杩涚墖浠诲姟 鏌ユ壘绌烘牸
EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot), Boolean.FALSE);
Assert.isTrue(null != nearestEmpty, "鏍煎瓙宸叉弧");
@@ -233,11 +256,14 @@
.eq(GlassInfo::getHeight, glassInfo.getHeight())
.eq(GlassInfo::getThickness, glassInfo.getThickness())
.eq(GlassInfo::getFilmsid, glassInfo.getFilmsid())
+ .eq(GlassInfo::getFlowCardId, glassInfo.getFlowCardId())
+ .ne(GlassInfo::getGlassId, glassInfo.getGlassId())
.eq(GlassInfo::getTotalLayer, glassInfo.getTotalLayer())
.eq(GlassInfo::getLayer, glassInfo.getLayer())
.eq(GlassInfo::getEngineerId, glassInfo.getEngineerId())
.notInSql(GlassInfo::getGlassId, "select distinct glass_id from edg_storage_cage_details " +
- "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight())
+ "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight()
+ + " and state != 100")
.orderByAsc(GlassInfo::getTemperingLayoutId)
.orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)
.last("Limit 1");
@@ -272,17 +298,28 @@
// 鑾峰彇寰呭嚭绗肩殑鐜荤拑闇�瑕佹浛鎹㈢殑鐜荤拑淇℃伅
EdgStorageCageDetails swapGlassDetailInfo = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>()
.eq(EdgStorageCageDetails::getGlassId, swapGlassId).eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN));
+
// 鐜荤拑灏忕墖琛ㄤ腑鐜荤拑宸茬粡鏇挎崲锛屾洿鏂板崸鐞嗙鍐呯幇鏈夌殑鍑嗗鍑虹鐨勭幓鐠冧俊鎭紝
if (null == swapGlassDetailInfo) {
+ GlassInfo glassInfoBase = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
+ .eq(GlassInfo::getGlassId, swapGlassId));
//闇�瑕佹浛鎹㈢殑鐜荤拑涓哄瓨杩涘崸鐞嗭紝浠呴渶鏇存柊褰撳墠闇�瑕佸嚭绗肩殑鐜荤拑淇℃伅鍗冲彲
edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>()
- .eq(EdgStorageCageDetails::getGlassId, glassId).set(EdgStorageCageDetails::getGlassId, swapGlassId));
+ .eq(EdgStorageCageDetails::getGlassId, glassId)
+ .set(EdgStorageCageDetails::getTemperingLayoutId, glassInfoBase.getTemperingLayoutId())
+ .set(EdgStorageCageDetails::getTemperingFeedSequence, glassInfoBase.getTemperingFeedSequence()));
} else {
//闇�瑕佹浛鎹㈢殑鐜荤拑閮藉湪鍗х悊鍐咃紝鎸夌収鐜荤拑id瀵硅皟鐜荤拑淇℃伅锛氬璋冪幓鐠僫d鍗冲彲
edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>()
- .eq(EdgStorageCageDetails::getId, glassInfo.getId()).set(EdgStorageCageDetails::getGlassId, swapGlassId));
+ .eq(EdgStorageCageDetails::getId, glassInfo.getId())
+ .set(EdgStorageCageDetails::getTemperingLayoutId, swapGlassDetailInfo.getTemperingLayoutId())
+ .set(EdgStorageCageDetails::getTemperingFeedSequence, swapGlassDetailInfo.getTemperingFeedSequence())
+ );
edgStorageCageDetailsService.update(new LambdaUpdateWrapper<EdgStorageCageDetails>()
- .eq(EdgStorageCageDetails::getId, swapGlassDetailInfo.getId()).set(EdgStorageCageDetails::getGlassId, glassId));
+ .eq(EdgStorageCageDetails::getId, swapGlassDetailInfo.getId())
+ .set(EdgStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
+ .set(EdgStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence())
+ );
}
}
@@ -417,7 +454,7 @@
}
}
}
- return saveOutGlassMessage(glassInfo, endcell, confirmationWrodAddress, glassId, currentSlot);
+ return saveOutGlassMessageBySlot(glassInfo, endcell, confirmationWrodAddress, glassId, currentSlot);
}
/**
@@ -659,6 +696,7 @@
log.info("4銆佹坊鍔犲嚭鐗囦换鍔★紝鐜荤拑id锛歿}锛屼换鍔$被鍨嬶細{}锛岃捣濮嬩綅缃細{}锛岀粨鏉熶綅缃細{}", glassInfo.getGlassId(),
2, glassInfo.getSlot(), endcell);
if (glassInfo.getGlassId().equals(glassId)) {
+
log.info("5銆佺洿閫氫换鍔�,灏嗙幓鐠冧俊鎭彃鍏ュ崸寮忕悊鐗囩,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
EdgStorageCageDetails details = new EdgStorageCageDetails();
BeanUtils.copyProperties(glassInfo, details);
@@ -718,6 +756,78 @@
BeanUtils.copyProperties(glassInfo, details);
} else {
GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+ BeanUtils.copyProperties(one, details);
+ }
+ EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot, Boolean.TRUE);
+ Assert.isTrue(null != nearestEmpty, "鏍煎瓙宸叉弧,鏃犳硶鎵ц鐩撮�氫换鍔�");
+ log.info("3銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", nearestEmpty);
+ details.setSlot(nearestEmpty.getSlot());
+ details.setState(Const.GLASS_STATE_OUT);
+ edgStorageCageDetailsService.save(details);
+ boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), nearestEmpty.getSlot(), endcell, Const.GLASS_CACHE_TYPE_THROUGH);
+ log.info("6銆佹坊鍔犲嚭鐗囦换鍔℃槸鍚﹀畬鎴愶細{}", taskCacheStatus);
+ } else {
+ log.info("5銆侀潪鐩撮�氫换鍔�,灏嗙幓鐠冧俊鎭彃鍏ュ崸寮忕悊鐗囩,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
+ if (!glassInfo.getSlot().equals(currentSlot)) {
+ EdgStorageCageDetails currentGlass = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>()
+ .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .eq(EdgStorageCageDetails::getSlot, currentSlot).eq(EdgStorageCageDetails::getWidth, glassInfo.getWidth())
+ .eq(EdgStorageCageDetails::getHeight, glassInfo.getHeight()).eq(EdgStorageCageDetails::getThickness, glassInfo.getThickness())
+ );
+ if (null != currentGlass) {
+ glassInfo = currentGlass;
+ }
+ }
+ //鐜荤拑淇℃伅鏇挎崲
+ String glassIdChange = queryAndChangeGlass(glassInfo.getGlassId());
+ //澶勭悊鍦ㄥ崸鐞嗗唴鐨勭幓鐠冧俊鎭細绗煎唴鐨勬暟鎹鐞�
+ queryEdgAndChangeGlass(glassInfo.getGlassId(), glassIdChange);
+ LambdaUpdateWrapper<EdgStorageCageDetails> wrapper = new LambdaUpdateWrapper<>();
+ wrapper.eq(EdgStorageCageDetails::getGlassId, glassInfo.getGlassId()).set(EdgStorageCageDetails::getState, Const.GLASS_STATE_OUT);
+ edgStorageCageDetailsService.update(wrapper);
+ log.info("5銆佹洿鏂板嚭鐗囩幓鐠冪殑鐘舵�佷负{}", Const.GLASS_STATE_OUT);
+
+ boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), glassInfo.getSlot(), endcell, Const.GLASS_CACHE_TYPE_OUT);
+ log.info("6銆佹坊鍔犲嚭鐗囦换鍔℃槸鍚﹀畬鎴愶細{}", taskCacheStatus);
+ }
+ boolean glassSizeStatus = saveGlassSize(glassInfo, endcell);
+ log.info("7銆佹坊鍔犲嚭鐗囩幓鐠冨昂瀵镐俊鎭埌纾ㄨ竟鍓嶇幓鐠冭〃鏄惁瀹屾垚锛歿}", glassSizeStatus);
+ S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1);
+ log.info("8銆佸彂閫佺‘璁ゅ瓧宸插畬鎴�");
+ Damage damage = new Damage();
+ damage.setGlassId(glassInfo.getGlassId());
+ damage.setWorkingProcedure("鍒囧壊");
+ damage.setLine(1001);
+ damage.setType(1);
+ damage.setRemark("杩囧崸寮忕悊鐗�");
+ damageService.insertDamage(damage);
+ return Boolean.TRUE;
+ }
+ return Boolean.FALSE;
+ }
+
+ /**
+ * 淇濆瓨鍑虹墖浠诲姟鐩稿叧淇℃伅
+ *
+ * @param glassInfo
+ * @param endcell
+ * @param confirmationWrodAddress
+ * @param glassId
+ * @return
+ */
+ private boolean saveOutGlassMessageBySlot(EdgStorageCageDetails glassInfo, int endcell, String confirmationWrodAddress, String glassId, Integer currentSlot) {
+ if (glassInfo != null) {
+ log.info("4銆佹坊鍔犲嚭鐗囦换鍔★紝鐜荤拑id锛歿}锛屼换鍔$被鍨嬶細{}锛岃捣濮嬩綅缃細{}锛岀粨鏉熶綅缃細{}", glassInfo.getGlassId(),
+ 2, glassInfo.getSlot(), endcell);
+ if (glassInfo.getGlassId().equals(glassId)) {
+ log.info("5銆佺洿閫氫换鍔�,灏嗙幓鐠冧俊鎭彃鍏ュ崸寮忕悊鐗囩,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
+ EdgStorageCageDetails details = new EdgStorageCageDetails();
+ //鐜荤拑淇℃伅鏇挎崲
+ String glassIdChange = queryAndChangeGlass(glassId);
+ if (StringUtils.isBlank(glassIdChange)) {
+ BeanUtils.copyProperties(glassInfo, details);
+ } else {
+ GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
BeanUtils.copyProperties(glassInfo, details);
}
EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot, Boolean.TRUE);
--
Gitblit v1.8.0