From 9272ffcd882f7fceef00dc01dc08b75a1e3acd4c Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 11 十一月 2025 15:09:34 +0800
Subject: [PATCH] 1、 中空出片任务调度任务判定,占用单格的不配对的不执行调度,格子内全部为不配对的不调度 2、 移除无用包引用
---
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 130 ++++++++++++++++++++++++++++++++++--------
1 files changed, 104 insertions(+), 26 deletions(-)
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index dd9c839..0fb1f76 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -117,6 +117,8 @@
private static final String ALARM_TYPE = "涓┖澶х悊鐗�";
private static final String ALARM_CODE_SIZE = "sizeSame";
private static final String ALARM_CODE_ID = "idSame";
+ private static final String ALARM_CODE_SLOT = "slotLess";
+ private static final String ALARM_CODE_OVER = "overSize";
/**
* 鐩撮�氭牸瀛�
@@ -245,6 +247,13 @@
.ge(HollowBigStorageCage::getMaxThickness, entry.getKey()));
if (count < entry.getValue()) {
log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
+ ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+ alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+ alarmInfo.setAlarmModule(ALARM_MODULE);
+ alarmInfo.setAlarmType(ALARM_TYPE);
+ alarmInfo.setAlarmCode(ALARM_CODE_SLOT);
+ alarmInfo.setAlarmMessage(count + "");
+ productAlarmInfoService.save(alarmInfo);
//鍚憄lc鍙戦�佹姤璀�:绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻
s7DataZKDLPOne = new S7DataZKDLPOne();
s7DataZKDLPOne.setAlramSignal(16);
@@ -468,6 +477,20 @@
}
HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null;
+
+ //鐩撮�氬彴鏈夌幓鐠冩椂灏嗕腑绌哄嚭鐗囬槦鍒椾腑瀵瑰簲鐜荤拑id鐨勬牸瀛愬彿鏇挎崲鏈洿閫氬彴
+ HollowBigStorageCageDetails details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+ .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
+ .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1"));
+ if (details != null) {
+ hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService.getOne(
+ new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, details.getFlowCardId())
+ .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+ .orderByAsc(HollowGlassOutRelationInfo::getId)
+ .last("limit 1")
+ );
+ }
int cell = -1;
for (Integer i : resultList) {
if (null == hollowGlassOutRelationInfo) {
@@ -509,19 +532,24 @@
.eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
.eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId())
.orderByAsc(HollowGlassQueueInfo::getHollowSequence));
- if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
+ //鎸夌収浠诲姟淇℃伅杩囨护绛涢�夐渶瑕佸嚭鐗囧強璋冨害鐨勭幓鐠冮槦鍒�
+ List<HollowGlassQueueInfo> resultQueue = computeOutHollowQueue(unFinishHollowQueueList, hollowGlassOutRelationInfo);
+ log.info("涓┖鍑虹墖浠诲姟璁$畻鍚庣殑鍑虹墖闃熷垪涓猴細{}", resultQueue);
+ if (CollectionUtil.isNotEmpty(resultQueue)) {
//鐩撮�氬彴鏈夌幓鐠冩椂灏嗕腑绌哄嚭鐗囬槦鍒椾腑瀵瑰簲鐜荤拑id鐨勬牸瀛愬彿鏇挎崲鏈洿閫氬彴
- HollowBigStorageCageDetails details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
- .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
- .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1"));
log.info("涓┖澶х悊鐗囩洿閫氬彴鐜荤拑淇℃伅{}", details);
- if (details != null && details.getGlassId().equals(unFinishHollowQueueList.get(0).getGlassId())) {
- unFinishHollowQueueList.get(0).setSlot(THROUGH_SLOT);
- log.info("灏嗕腑绌洪槦鍒椾腑鐨勬牸瀛愬彿鏇挎崲涓虹洿閫氬彴{}", unFinishHollowQueueList);
+ if (details != null) {
+ resultQueue.stream().forEach(e -> {
+ if (e.getGlassId().equals(details.getGlassId())) {
+ e.setSlot(THROUGH_SLOT);
+ e.setDeviceId(0);
+ log.info("灏嗕腑绌洪槦鍒椾腑鐨勬牸瀛愬彿鏇挎崲涓虹洿閫氬彴{}", e);
+ }
+ });
}
- log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟");
- Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
- hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce());
+ log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟:{}", hollowGlassOutRelationInfo);
+ Integer isPair = resultQueue.get(0).getIsPair();
+ hollowOutGlassByIsPair(resultQueue, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce());
Date endDate = new Date();
log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
@@ -571,6 +599,7 @@
log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
+
@Scheduled(fixedDelay = 1000)
public void finishInBigStorageTask() throws Exception {
@@ -901,6 +930,14 @@
log.info("褰撳墠鏈敹鍒拌繘鐗囪姹傦紝缁撴潫杩涚墖浠诲姟");
return;
}
+ if (StringUtils.isNotBlank(s7DataZKDLPOne.getId1())) {
+ log.info("褰撳墠瀛樺湪杩涚墖浠诲姟锛岀粨鏉�");
+ return;
+ }
+ if (StringUtils.isNotBlank(s7DataZKDLPOne.getId1())) {
+ log.info("褰撳墠瀛樺湪杩涚墖浠诲姟璇锋眰锛岀粨鏉熸湰娆″ぇ绗煎瓙璋冨害");
+ return;
+ }
//鏈夎姹備俊鍙�
List<String> glassIdList = hollowGlassQueueInfoService.queryNeedInCarGlass();
if (CollectionUtil.isEmpty(glassIdList)) {
@@ -909,18 +946,25 @@
int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
.eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
.eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT));
+ log.info("鐩撮�氱墖鍙扮殑浠诲姟鏁伴噺涓猴細{}", count);
if (count > 0) {
return;
}
- List<HollowBigStorageCageDetails> list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
- .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
- .in(HollowBigStorageCageDetails::getDeviceId, 6)
- .in(HollowBigStorageCageDetails::getGlassId, glassIdList));
- if (CollectionUtil.isEmpty(list)) {
+ HollowBigStorageCageDetails details = null;
+ for (String glassId : glassIdList) {
+ details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+ .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .eq(HollowBigStorageCageDetails::getGlassId, glassId).last("limit 1"));
+ log.info("鑾峰彇璋冨害浠诲姟锛歿}", details);
+ if (details != null) {
+ break;
+ }
+ }
+ if (details == null) {
return;
}
- HollowBigStorageCageDetails details = list.get(0);
- //todo:鐢熸垚杩涜繘鐗囧ぇ杞︿换鍔�
+ log.info("鑾峰彇闇�瑕佽皟搴︾殑鍗曟潯浠诲姟锛歿}", details);
+ //鐢熸垚杩涜繘鐗囧ぇ杞︿换鍔�
hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>()
.set(HollowBigStorageCageDetails::getState, Const.RAW_GLASS_STATE_OUT)
.eq(HollowBigStorageCageDetails::getGlassId, details.getGlassId()));
@@ -1034,6 +1078,36 @@
log.info("鍑虹墖浠诲姟-鏃犲姩浣滄墽琛屽畬鎴�");
}
+ private List<HollowGlassQueueInfo> computeOutHollowQueue(List<HollowGlassQueueInfo> queueInfoList, HollowGlassOutRelationInfo hollowGlassOutRelationInfo) {
+ if (CollectionUtil.isNotEmpty(queueInfoList)) {
+ return new ArrayList<>();
+ }
+ //浠诲姟涓哄己鍒讹紝鍙洿鎺ヨ繑鍥炲師鏈夌殑闃熷垪
+ if (hollowGlassOutRelationInfo.getIsForce() == 1) {
+ return queueInfoList;
+ }
+ log.info("棰嗗彇浠诲姟锛歿}鐨勯槦鍒楋細{}", hollowGlassOutRelationInfo, queueInfoList);
+ // 鎸夋牸瀛愬彿鍒嗙粍
+ Map<Integer, List<HollowGlassQueueInfo>> gridGroups = queueInfoList.stream()
+ .collect(Collectors.groupingBy(HollowGlassQueueInfo::getSlot));
+ List<HollowGlassQueueInfo> resultQueue = new ArrayList<>();
+
+ for (List<HollowGlassQueueInfo> items : gridGroups.values()) {
+ // 鎯呭喌1锛氭牸瀛愬唴鍙湁涓�涓暟鎹笖鏈厤瀵� - 杩囨护鎺�
+ if (items.size() == 1 && 0 == items.get(0).getSlot()) {
+ continue;
+ }
+
+ // 鎯呭喌2锛氭牸瀛愬唴鍏ㄩ儴涓烘湭閰嶅鐨勬暟鎹� - 杩囨护鎺�
+ boolean allUnpaired = items.stream().noneMatch(e -> e.getIsPair() == 1);
+ if (allUnpaired) {
+ continue;
+ }
+ // 鍚﹀垯淇濈暀杩欎釜鏍煎瓙鍐呯殑鎵�鏈夋暟鎹�
+ resultQueue.addAll(items);
+ }
+ return resultQueue;
+ }
private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list,
int targetSlot, int isPair, int totalLayer, int isForce) throws Exception {
@@ -1070,6 +1144,13 @@
S7DataZKDLPOne s7DataZKDLPOne = new S7DataZKDLPOne();
s7DataZKDLPOne.setAlramSignal(16);
s7SerializerZKDLPOne.write(s7DataZKDLPOne);
+ ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+ alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+ alarmInfo.setAlarmModule(ALARM_MODULE);
+ alarmInfo.setAlarmType(ALARM_TYPE);
+ alarmInfo.setAlarmCode(ALARM_CODE_SLOT);
+ alarmInfo.setAlarmMessage("");
+ productAlarmInfoService.save(alarmInfo);
Assert.isFalse(storageCage == null, "浠诲姟璋冨害娌℃湁澶氫綑鏍煎瓙锛岀粨鏉熻皟搴︿换鍔�");
}
@@ -1105,15 +1186,6 @@
Integer glassGap = hollowGlassRelationInfoService.getGlassGapByThickness(list.get(0).getThickness());
log.info("涓┖鐢熸垚涓�杞︿换鍔★細{}", list);
for (T e : list) {
- //鏍煎瓙涓虹浜斾釜绗煎瓙鏃朵笉娣诲姞鍑虹墖浠诲姟
- HollowBigStorageCage hollowBigStorageCage = hollowBigStorageCageService.getOne(
- new LambdaQueryWrapper<HollowBigStorageCage>()
- .eq(HollowBigStorageCage::getSlot, e.getSlot())
- );
-
- if (hollowBigStorageCage != null && hollowBigStorageCage.getDeviceId() == 6) {
- break;
- }
if (templist.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
break;
}
@@ -1165,6 +1237,12 @@
for (T t : baseInfoList) {
bigStorageCageTaskList.add(new BigStorageCageTask(t.getGlassId(), t.getSlot(), targetSlot, 0));
}
+
+ List<BigStorageCageTask> tasks = bigStorageCageTaskList.stream().filter(e -> e.getStartSlot() >= 500 && e.getStartSlot() < 900).collect(Collectors.toList());
+ if (CollectionUtil.isNotEmpty(tasks)) {
+ log.info("褰撳墠鍑虹墖闃熷垪瀛樺湪鏂扮瀛愮殑鐜荤拑灏忕墖锛岀粨鏉熸湰娆′换鍔★細{}", tasks);
+ return false;
+ }
//娓呯┖浠诲姟琛ㄦ暟鎹�
resetOutTask();
log.info("鐢熸垚鍑虹墖浠诲姟鏁版嵁{}", bigStorageCageTaskList);
--
Gitblit v1.8.0