From 0477b72d30cfe7d412edeb237aa587b1c5242207 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 09 七月 2024 08:34:31 +0800
Subject: [PATCH] 1、任务新增计时功能,日志打印每次任务执行的周期 2、卧式理片笼更新出片规则:都为禁用(2),笼子不出玻璃;存在一个禁用,07片台可以存玻璃;都非禁用:两片台有玻璃笼子不出片
---
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 43 +++++++++++++++++----
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 43 +++++++++++++++++----
2 files changed, 70 insertions(+), 16 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 abd6d98..4ba8caa 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,8 @@
@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();
@@ -124,6 +126,8 @@
inTo(glassIdeValue, confirmationWrodAddress, currentSlot);
}
}
+ Date endDate = new Date();
+ log.info("鏈浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms", endDate, endDate.getTime() - startDate.getTime());
}
public void plcToHomeEdgTask() {
@@ -263,8 +267,8 @@
EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL);
endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate);
} else {
- //鍒ゆ柇涓ゆ潯绾挎槸鍚﹂兘绌洪棽
- endcell = out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION;
+ //鎸夌収鐘舵�佸垽鏂袱鏉$嚎璧伴偅鏉$嚎
+ endcell = computerLineByState(out08Glassstate, out10Glassstate);
if (out08Glassstate == 1 && out10Glassstate == 1) {
EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL);
@@ -486,13 +490,15 @@
boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight() == glassInfo.getHeight()
&& a10EdgStorageCageDetails.getWidth() == glassInfo.getWidth();
//瀛樺湪鍑虹墖浠诲姟 07涓虹┖
- if (b08) {
- return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION;
+ if (out08Glassstate == 1 && out10Glassstate == 1) {
+ if (b08) {
+ return Const.A09_OUT_TARGET_POSITION;
+ }
+ if (b10) {
+ return Const.A10_OUT_TARGET_POSITION;
+ }
}
- if (b10) {
- return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
- }
- return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION;
+ return computerLineByState(out08Glassstate, out10Glassstate);
}
/**
@@ -653,6 +659,27 @@
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() {
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 f3f04f3..6d5c999 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
@@ -83,6 +83,8 @@
@Scheduled(fixedDelay = 300)
public void plcToHomeEdgScan() {
+ Date startDate = new Date();
+ log.info("澶х悊鐗囩鎵爜浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
String d04Id = plcParameterObject.getPlcParameter("D04ID").getValue();
@@ -111,22 +113,27 @@
if (REQUEST_WORD.equals(d04ToMES) && !REQUEST_WORD.equals(d05State)) {
judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD04Address);
}
- log.info("缁撴潫鎵爜浠诲姟");
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鎵爜浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
}
@Scheduled(fixedDelay = 300)
public void plcToHomeEdgFreeCarTask() {
+ Date startDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
String e01Status = plcParameterObject.getPlcParameter("E01State").getValue();
String d03ToMES = plcParameterObject.getPlcParameter("D03ToMES").getValue();
String d05ToMES = plcParameterObject.getPlcParameter("D05ToMES").getValue();
log.info("鎵ц绌鸿溅閫佺墖浠诲姟锛岃幏鍙栧埌鐨勫ぇ杞︾姸鎬佷负{}锛屽崸杞珛鐘舵�佸垎鍒负d03:{}锛宒05:{}", e01Status, d03ToMES, d05ToMES);
if (REQUEST_WORD.equals(e01Status)) {
- log.info("杩涚墖澶ц溅闈炵┖闂诧紝缁撴潫閫佺墖浠诲姟");
+ Date endDate = new Date();
+ log.info("杩涚墖澶ц溅闈炵┖闂诧紝缁撴潫閫佺墖浠诲姟锛屼换鍔$粨鏉熸椂闂达細{}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
if (!REQUEST_WORD.equals(d03ToMES) && !REQUEST_WORD.equals(d05ToMES)) {
- log.info("鍗ц浆绔嬫病鏈夐�佺墖璇锋眰锛岀粨鏉熼�佺墖浠诲姟");
+ Date endDate = new Date();
+ log.info("鍗ц浆绔嬫病鏈夐�佺墖璇锋眰锛岀粨鏉熼�佺墖浠诲姟锛屼换鍔$粨鏉熸椂闂达細{}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
LambdaQueryWrapper<BigStorageCageFeedTask> wrapper = new LambdaQueryWrapper<BigStorageCageFeedTask>()
@@ -137,14 +144,15 @@
if (CollectionUtils.isNotEmpty(feedTaskList)) {
if (feedTaskList.size() == 1) {
computeTargetByLine(feedTaskList.get(0).getLine());
- return;
} else {
//姣旇緝鏈�鏃╀竴鐗囦换鍔$殑鐗堝浘id鍙婄増搴� 姹傚嚭鍗ц浆绔嬬殑绾胯矾
Integer startLine = getStartLine();
// //璁$畻鐩爣鏍煎瓙锛屽彂閫佸惎鍔ㄤ换鍔�
computeTargetByLine(startLine);
- return;
}
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+ return;
}
String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
String d04Id = plcParameterObject.getPlcParameter("D04ID").getValue();
@@ -157,7 +165,8 @@
//鑾峰彇涓ゆ潯绾垮崸杞珛鏄惁鏈夌幓鐠冿紝涓斾换鍔$姸鎬侀兘涓�2
List<Integer> lineList = bigStorageCageFeedTaskService.querySitToUpGlass();
if (CollectionUtils.isEmpty(lineList)) {
- log.info("涓ゆ潯绾垮崸杞珛涓虹┖鎴栬�呮湁杩涚墖浠诲姟鏈畬鎴愶紝缁撴潫浠诲姟");
+ Date endDate = new Date();
+ log.info("涓ゆ潯绾垮崸杞珛涓虹┖鎴栬�呮湁杩涚墖浠诲姟鏈畬鎴愶紝缁撴潫浠诲姟锛屽ぇ鐞嗙墖绗肩┖杞﹁繘鐗囦换鍔$粨鏉熸椂闂达細{}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
Integer lineFirst = lineList.get(0);
@@ -174,6 +183,8 @@
computeTargetByLine(lineFirst);
}
}
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
//涓ゆ潯鍏堝潎鍙墽琛岃繘鐗囦换鍔★紝鍒ゆ柇涓ゆ潯绾挎槸鍚﹁繘鐗囪姹傛槸鍚﹂兘涓虹┖
@@ -182,6 +193,8 @@
Integer line = getStartLine();
//璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
computeTargetByLine(line);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
} else if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d04Id)) {
// todo:涓や釜閮芥湁杩涚墖鐜荤拑
@@ -195,6 +208,8 @@
} else if (computeIsRun(Const.A10_OUT_TARGET_POSITION, d04Id)) {
computeTargetByLine(Const.A10_OUT_TARGET_POSITION);
} else {
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
} else {
@@ -204,11 +219,14 @@
//鑾峰彇杩涚墖璇锋眰鐜荤拑涓虹┖鐨勶紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
computeTargetByLine(outLine);
}
-
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
}
@Scheduled(fixedDelay = 300)
public void plcToHomeEdgOutTask() {
+ Date startDate = new Date();
+ log.info("澶х悊鐗囩绌鸿溅杩涚墖浠诲姟寮�濮嬫墽琛屾椂闂达細{}", startDate);
PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject;
String mesToPLCAddress = plcMesObject.getPlcParameter("MESToPLC").getAddress();
List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_NEW));
@@ -224,6 +242,8 @@
if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) {
log.info("鏈夋鍦ㄥ嚭鐗囩殑閽㈠寲浠诲姟");
computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
//鏄惁鏈変汉宸ヤ笅鐗囦换鍔� 鏈夌洿鎺ュ嚭
@@ -231,6 +251,8 @@
.eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth));
if (CollectionUtils.isNotEmpty(artificialList)) {
computeOutGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
//閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
@@ -248,6 +270,8 @@
.eq(GlassInfo::getEngineerId, temperingLayoutDTO.getEngineerId()));
temperingGlassInfoService.saveBatch(temperingGlassInfos);
computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
//鏈埌榻� 鎵ц鍐呴儴璋冨害浠诲姟
@@ -267,6 +291,8 @@
bigStorageCageOutTaskService.saveBatch(outTasks);
S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1);
log.info("宸插悜plc鍙戦�佸嚭鐗囦换鍔$‘璁わ紝鍦板潃涓猴細{}", mesToPLCAddress);
+ Date endDate = new Date();
+ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
return;
}
}
@@ -419,6 +445,7 @@
}
private void sendTaskListToPLC(List<BigStorageCageFeedTask> taskList, Integer line) {
+ log.info("閫佺墖浠诲姟鍙戦�佽繘鐗囩幓鐠冧俊鎭�");
S7control s7control = S7object.getinstance().plccontrol;
PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject;
String mesD03Address = plcMesObject.getPlcParameter("MESToD03").getAddress();
@@ -429,7 +456,7 @@
s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport" + i).getAddress(), taskList.get(i - 1).getTargetSlot());
}
s7control.writeWord(outLine, 2);
- log.info("閫佺墖浠诲姟宸插彂閫佸畬鎴愶紝浠诲姟绾胯矾涓猴細{}锛屽惎鍔ㄥ湴鍧�涓簕}", line, outLine);
+ log.info("閫佺墖浠诲姟宸插彂閫佸畬鎴愶紝浠诲姟绾胯矾涓猴細{}锛屽惎鍔ㄥ湴鍧�涓簕},纭瀛椾负{}", line, outLine, 2);
}
private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, Boolean isTempering, String mesToPLCAddress) {
--
Gitblit v1.8.0