From 6367c35c9832ac81034e4e1a2c831b7632348d17 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期六, 29 六月 2024 23:53:25 +0800
Subject: [PATCH] 大理片笼进片任务逻辑调整已完成,待测试
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json | 422 +++++++++++++++++++++++++++++++++++++---------
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java | 66 ++++--
2 files changed, 373 insertions(+), 115 deletions(-)
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 aebf46d..4b1aa74 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
@@ -27,6 +27,7 @@
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.service.TemperingGlassInfoService;
+import com.mes.tools.S7control;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -80,31 +81,31 @@
@Scheduled(fixedDelay = 5000)
public void plcToHomeEdgScan() {
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
- String d01Request = plcParameterObject.getPlcParameter("D01Request").getValue();
String d01Id = plcParameterObject.getPlcParameter("D01ID1").getValue();
- String d02SitState = plcParameterObject.getPlcParameter("D02SitState").getValue();
- String d04Request = plcParameterObject.getPlcParameter("D04Request").getValue();
- String d04Id = plcParameterObject.getPlcParameter("D04ID1").getValue();
- String d05SitState = plcParameterObject.getPlcParameter("D05SitState").getValue();
+ String d02Id = plcParameterObject.getPlcParameter("D02ID1").getValue();
+ String d03State = plcParameterObject.getPlcParameter("D03State").getValue();
+ String d05State = plcParameterObject.getPlcParameter("D05State").getValue();
+ String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress();
+ String mesD05Address = plcParameterObject.getPlcParameter("MESToD05").getAddress();
- log.info("1銆佽幏鍙栧埌鐨勮姹傚瓧d01涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{};鑾峰彇鍒扮殑璇锋眰瀛梔04涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{};",
- d01Request, d01Id, d04Request, d04Id);
- if (!REQUEST_WORD.equals(d01Request) && !REQUEST_WORD.equals(d04Request)) {
+
+ log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d02Id鎵弿ID涓猴細{};", d01Id, d02Id);
+ if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d02Id)) {
log.info("涓ゆ潯绾挎湭鏀跺埌杩涚墖浠诲姟锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�");
return;
}
- if (REQUEST_WORD.equals(d02SitState) && REQUEST_WORD.equals(d05SitState)) {
+ if (REQUEST_WORD.equals(d03State) && REQUEST_WORD.equals(d05State)) {
log.info("涓ゆ潯绾垮崸杞珛鍧囧湪鎵ц浠诲姟锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�");
return;
}
Boolean flag01 = Boolean.FALSE;
Boolean flag04 = Boolean.FALSE;
//鎸夌収绾胯矾鍙婄幓鐠僫d鑾峰彇鐩搁偦涓ゅ潡鐜荤拑 鍗ц浆绔嬩笂鐨勭幓鐠�
- if (REQUEST_WORD.equals(d01Request) && !REQUEST_WORD.equals(d02SitState)) {
- flag01 = judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION);
+ if (StringUtils.isBlank(d01Id) && !REQUEST_WORD.equals(d03State)) {
+ flag01 = judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD03Address);
}
- if (REQUEST_WORD.equals(d04Request) && !REQUEST_WORD.equals(d05SitState)) {
- flag04 = judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION);
+ if (StringUtils.isBlank(d02Id) && !REQUEST_WORD.equals(d05State)) {
+ flag04 = judgeGlassTypeStatus(d02Id, Const.A10_OUT_TARGET_POSITION, mesD05Address);
}
if (flag01 && flag04) {
//姣旇緝鏈�鏃╀竴鐗囦换鍔$殑鐗堝浘id鍙婄増搴� 姹傚嚭鍗ц浆绔嬬殑绾胯矾
@@ -123,20 +124,17 @@
@Scheduled(fixedDelay = 5000)
public void plcToHomeEdgFreeCarTask() {
PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
- String e01Status = plcParameterObject.getPlcParameter("E01Status").getValue();
+ String e01Status = plcParameterObject.getPlcParameter("E01State").getValue();
if (REQUEST_WORD.equals(e01Status)) {
log.info("杩涚墖澶ц溅闈炵┖闂�");
return;
}
- String d01Request = plcParameterObject.getPlcParameter("D01Request").getValue();
String d01Id = plcParameterObject.getPlcParameter("D01ID1").getValue();
- String d04Request = plcParameterObject.getPlcParameter("D04Request").getValue();
- String d04Id = plcParameterObject.getPlcParameter("D04ID1").getValue();
- log.info("1銆佽幏鍙栧埌鐨勮姹傚瓧d01涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{};鑾峰彇鍒扮殑璇锋眰瀛梔04涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{};",
- d01Request, d01Id, d04Request, d04Id);
+ String d02Id = plcParameterObject.getPlcParameter("D02ID1").getValue();
+ log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d02Id鎵弿ID涓猴細{};", d01Id, d02Id);
+ ;
//涓ゆ潯绾块兘鏈夎繘鍗ц浆绔嬩换鍔★紝鐩存帴缁撴潫
- if (Const.BIG_STORAGE_REQUEST_IN.equals(d01Request)
- && Const.BIG_STORAGE_REQUEST_IN.equals(d04Request)) {
+ if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d02Id)) {
log.info("涓ゆ潯绾块兘瀛樺湪杩涚墖浠诲姟锛岀粨鏉熶换鍔�");
return;
}
@@ -147,23 +145,26 @@
return;
}
Integer lineFirst = lineList.get(0);
- String lineGlassId = lineFirst.equals(Const.A09_OUT_TARGET_POSITION) ? d01Id : d04Id;
+ String lineGlassId = lineFirst.equals(Const.A09_OUT_TARGET_POSITION) ? d01Id : d02Id;
+ //浠呮湁涓�鏉″厛绗﹀悎鍚姩鍚姩鏉′欢
if (lineList.size() == 1) {
- //璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
+ //濡傛灉杩涚墖璇锋眰浣嗙幓鐠冧负绌猴紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
if (StringUtils.isEmpty(lineGlassId)) {
computeTargetByLine(lineFirst);
}
return;
}
- if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d04Id)) {
+ //涓ゆ潯鍏堝潎鍙墽琛岃繘鐗囦换鍔★紝鍒ゆ柇涓ゆ潯绾挎槸鍚﹁繘鐗囪姹傛槸鍚﹂兘涓虹┖
+ if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d02Id)) {
//姣旇緝鏈�鏃╀竴鐗囦换鍔$殑鐗堝浘id鍙婄増搴� 姹傚嚭鍗ц浆绔嬬殑绾胯矾
Integer line = getStartLine();
//璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
computeTargetByLine(line);
return;
}
+ //涓�鏉$嚎涓虹┖锛屼竴鏉$嚎鏈夎繘鐗囪姹傛湁鐜荤拑
int outLine = StringUtils.isBlank(d01Id) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
- //璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
+ //鑾峰彇杩涚墖璇锋眰鐜荤拑涓虹┖鐨勶紝璁$畻浠诲姟琛ㄨ繘鐗囨牸瀛� 鍙戦�佽繘鐗囦换鍔�
computeTargetByLine(outLine);
}
@@ -234,7 +235,7 @@
/**
* 鎸夌収鐜荤拑id鍒ゆ柇鐜荤拑鐘舵�佸強鍗ц浆绔嬫槸鍚﹀彲鐩存帴鍚姩
*/
- public Boolean judgeGlassTypeStatus(String glassId, Integer line) {
+ public Boolean judgeGlassTypeStatus(String glassId, Integer line, String mesAddress) {
//1銆佽幏鍙栦换鍔¤〃涓浉閭荤幓鐠�
List<EdgGlassTaskInfo> edgGlassTaskInfoList = edgGlassTaskInfoService.list(new LambdaQueryWrapper<EdgGlassTaskInfo>()
.eq(EdgGlassTaskInfo::getLine, line)
@@ -280,6 +281,8 @@
}
}
}
+ //鍚憄lc鍙戦�佽繘鐗囩‘璁�
+ S7object.getinstance().plccontrol.writeWord(mesAddress, (short) 1);
//璁板綍鏃犳硶鏀句笅鐜荤拑锛屽悗缁垽鏂惎鍔�
return Boolean.TRUE;
}
@@ -365,9 +368,20 @@
cageDetails.setState(Const.GLASS_STATE_IN);
bigStorageCageDetailsService.save(cageDetails);
}
+ //todo:鎸夌収杩涚墖淇℃伅鍚戞墦杞﹀彂閫佽繘杞︽暟鎹�
+ sendTaskListToPLC(taskList);
return Boolean.TRUE;
}
+ private void sendTaskListToPLC(List<BigStorageCageFeedTask> taskList) {
+ S7control s7control = S7object.getinstance().plccontrol;
+ PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject;
+ for (int i = 1; i <= taskList.size(); i++) {
+ s7control.writeWord(plcMesObject.getPlcParameter("StartAddToImport" + i).getAddress(), Short.parseShort(taskList.get(i).getLine() + ""));
+ s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport1" + i).getAddress(), Short.parseShort(taskList.get(i).getTargetSlot() + ""));
+ }
+ }
+
private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list) {
//浠诲姟鏁版嵁 鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲� 鐜荤拑闂撮殧
List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>();
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json
index 1b538cf..1b4d72d 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json
@@ -1,91 +1,335 @@
{
- "plcAddressBegin":"DB14.0",
- "plcAddressLenght":"84",
- "dataType":"word",
- "parameteInfor":[
- {
- "codeId": "D01Request",
- "addressIndex":"0",
- "addressLenght":"2",
- "ratio":"1",
- "unit":"m/min"
- },
- {
- "codeId": "D01ID1",
- "addressIndex":"2",
- "addressLenght":"6",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D04Request",
- "addressIndex":"34",
- "addressLenght":"2",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D04ID1",
- "addressIndex":"10",
- "addressLenght":"36",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "E01Status",
- "addressIndex":"2",
- "addressLenght":"68",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "E02Status",
- "addressIndex":"2",
- "addressLenght":"70",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "MaxTaskNo",
- "addressIndex":"2",
- "addressLenght":"72",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D02MaxWidth",
- "addressIndex":"2",
- "addressLenght":"74",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D05MaxWidth",
- "addressIndex":"2",
- "addressLenght":"76",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "GlassGap",
- "addressIndex":"2",
- "addressLenght":"78",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D02SitState",
- "addressIndex":"80",
- "addressLenght":"2",
- "ratio":"1",
- "unit":""
- },
- {
- "codeId": "D05SitState",
- "addressIndex":"82",
- "addressLenght":"2",
- "ratio":"1",
- "unit":""
- }
- ]
+ "plcAddressBegin": "DB14.0",
+ "plcAddressLenght": "894",
+ "dataType": "word",
+ "parameteInfor": [{
+ "codeId": "D01ID",
+ "addressIndex": "0",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D02ID",
+ "addressIndex": "32",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID1",
+ "addressIndex": "64",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID2",
+ "addressIndex": "96",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID3",
+ "addressIndex": "128",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID4",
+ "addressIndex": "160",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID5",
+ "addressIndex": "192",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03ID6",
+ "addressIndex": "224",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D04ID",
+ "addressIndex": "256",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID1",
+ "addressIndex": "288",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID2",
+ "addressIndex": "328",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID3",
+ "addressIndex": "352",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID4",
+ "addressIndex": "384",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID5",
+ "addressIndex": "416",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05ID6",
+ "addressIndex": "448",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID1",
+ "addressIndex": "480",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID2",
+ "addressIndex": "512",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID3",
+ "addressIndex": "544",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID4",
+ "addressIndex": "576",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID5",
+ "addressIndex": "608",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01ID6",
+ "addressIndex": "640",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID1",
+ "addressIndex": "672",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID2",
+ "addressIndex": "704",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID3",
+ "addressIndex": "736",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID4",
+ "addressIndex": "768",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID5",
+ "addressIndex": "800",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02ID6",
+ "addressIndex": "832",
+ "addressLenght": "32",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "MESToD03",
+ "addressIndex": "888",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "MESToD05",
+ "addressIndex": "890",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "MESToPLC",
+ "addressIndex": "892",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport1",
+ "addressIndex": "914",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport2",
+ "addressIndex": "916",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport3",
+ "addressIndex": "918",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport4",
+ "addressIndex": "920",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport5",
+ "addressIndex": "922",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "StartAddToImport6",
+ "addressIndex": "924",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport1",
+ "addressIndex": "926",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport2",
+ "addressIndex": "928",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport3",
+ "addressIndex": "930",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport4",
+ "addressIndex": "932",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport5",
+ "addressIndex": "934",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "TargetAddToImport6",
+ "addressIndex": "936",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "deviceState",
+ "addressIndex": "864",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E01State",
+ "addressIndex": "866",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "E02State",
+ "addressIndex": "868",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D03State",
+ "addressIndex": "870",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ },
+ {
+ "codeId": "D05State",
+ "addressIndex": "872",
+ "addressLenght": "2",
+ "ratio": "1",
+ "unit": ""
+ }
+ ]
}
\ No newline at end of file
--
Gitblit v1.8.0