From 47ab1c46b5141f572381a2a27613f728e3bf96c5 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期一, 20 五月 2024 14:18:16 +0800 Subject: [PATCH] 1、卧式理片笼对接过程中bug修复 2、上片机协议修改 3、临时解决json文件打包后读取不到文件问题 4、上片新增接口修改上片机联动请求 --- hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/UpWorkstationService.java | 1 JsonFile/PlcCacheGlass.json | 64 +++++ hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java | 12 hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 45 +++ hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java | 5 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java | 11 hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java | 9 JsonFile/PlcLoadGlass.json | 78 ++++++ hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java | 2 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java | 4 hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/JsonFile/PlcLoadGlass.json | 11 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/mapper/LoadGlassMapper.java | 2 JsonFile/PlcdownGlass.json | 362 ++++++++++++++++++++++++++++++ hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java | 4 JsonFile/PlcCacheVerticalGlass.json | 57 ++++ hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterInfo.java | 2 hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java | 10 hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java | 8 18 files changed, 649 insertions(+), 38 deletions(-) diff --git a/JsonFile/PlcCacheGlass.json b/JsonFile/PlcCacheGlass.json new file mode 100644 index 0000000..01969b7 --- /dev/null +++ b/JsonFile/PlcCacheGlass.json @@ -0,0 +1,64 @@ +{ + "plcAddressBegin":"DB11.0", + "plcAddressLenght":"80", + "dataType":"word", + "parameteInfor":[ + { + "codeId": "A06_request_word", + "addressIndex":"0", + "addressLenght":"2", + "ratio":"1", + "unit":"m/min" + }, + { + "codeId": "A05_scanning_ID", + "addressIndex":"2", + "addressLenght":"30", + "ratio":"1", + "unit":"" + }, + { + "codeId": "Current_slot", + "addressIndex":"36", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "MES_confirmation_word", + "addressIndex":"38", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "A08_glass_status", + "addressIndex":"68", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "A10_glass_status", + "addressIndex":"70", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "A09_prohibit_film_production", + "addressIndex":"72", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + , + { + "codeId": "A10_prohibit_film_production", + "addressIndex":"74", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + ] +} diff --git a/JsonFile/PlcCacheVerticalGlass.json b/JsonFile/PlcCacheVerticalGlass.json new file mode 100644 index 0000000..5838dac --- /dev/null +++ b/JsonFile/PlcCacheVerticalGlass.json @@ -0,0 +1,57 @@ +{ + "plcAddressBegin":"DB.0", + "plcAddressLenght":"72", + "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":"8", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "D04ID1", + "addressIndex":"10", + "addressLenght":"6", + "ratio":"1", + "unit":"" + }, + { + "codeId": "D02Go", + "addressIndex":"20", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "D05Go", + "addressIndex":"22", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + , + { + "codeId": "DeviceStatus", + "addressIndex":"70", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + ] +} \ No newline at end of file diff --git a/JsonFile/PlcLoadGlass.json b/JsonFile/PlcLoadGlass.json new file mode 100644 index 0000000..9b0432b --- /dev/null +++ b/JsonFile/PlcLoadGlass.json @@ -0,0 +1,78 @@ +{ + "plcAddressBegin":"DB1.2000", + "plcAddressLenght":"100", + "dataType":"word", + "parameteInfor":[ + { + "codeId": "loadRequest", + "addressIndex":"0", + "addressLenght":"2", + "ratio":"1", + "unit":"m/min" + }, + { + "codeId": "PlcStatus", + "addressIndex":"10", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "MesToPlc", + "addressIndex":"20", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "InkageStatus", + "addressIndex":"22", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "WorkId", + "addressIndex":"24", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "GlassWidth", + "addressIndex":"26", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "GlassHeight", + "addressIndex":"28", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + , + { + "codeId": "MesToPlcStatus", + "addressIndex":"40", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "MesToPlcStatusId", + "addressIndex":"42", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { + "codeId": "MesTaskStatus", + "addressIndex":"56", + "addressLenght":"2", + "ratio":"1", + "unit":"" + } + ] +} \ No newline at end of file diff --git a/JsonFile/PlcdownGlass.json b/JsonFile/PlcdownGlass.json new file mode 100644 index 0000000..c813b1d --- /dev/null +++ b/JsonFile/PlcdownGlass.json @@ -0,0 +1,362 @@ +{ + "plcAddressBegin": "DB100.0", + "plcAddressLenght": "142", + "dataType": "word", + "parameteInfor": [ + { + "codeId": "RequestWord", + "addressIndex": "0", + "addressLenght": "2" + }, + { + "codeId": "G04ID", + "addressIndex": "2", + "addressLenght": "2" + }, + { + "codeId": "G06RobotTaskRequestWord", + "addressIndex": "4", + "addressLenght": "2" + }, + { + "codeId": "G06ID", + "addressIndex": "6", + "addressLenght": "2" + }, + { + "codeId": "G11RobotTaskRequestWord", + "addressIndex": "8", + "addressLenght": "2" + }, + { + "codeId": "G011ID", + "addressIndex": "10", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "12", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "14", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "16", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "18", + "addressLenght": "2" + }, + { + "codeId": "MESSendingWord", + "addressIndex": "20", + "addressLenght": "2" + }, + { + "codeId": "InputGrid", + "addressIndex": "22", + "addressLenght": "2" + }, + { + "codeId": "OutputGrid", + "addressIndex": "24", + "addressLenght": "2" + }, + { + "codeId": "OutputID", + "addressIndex": "26", + "addressLenght": "2" + }, + { + "codeId": "FrontOrRearLowerSlice", + "addressIndex": "28", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "30", + "addressLenght": "2" + }, + { + "codeId": "G06RobotTaskReply", + "addressIndex": "32", + "addressLenght": "2" + }, + { + "codeId": "G06Rack", + "addressIndex": "34", + "addressLenght": "2" + }, + { + "codeId": "G11RobotTaskReply", + "addressIndex": "36", + "addressLenght": "2" + }, + { + "codeId": "G11Rack", + "addressIndex": "38", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "40", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "42", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "44", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "46", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "48", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "50", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "52", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "54", + "addressLenght": "2" + }, + { + "codeId": "MESTaskState", + "addressIndex": "56", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "58", + "addressLenght": "2" + }, + { + "codeId": "AlarmState", + "addressIndex": "60", + "addressLenght": "2" + }, + { + "codeId": "Alarm1", + "addressIndex": "62", + "addressLenght": "2" + }, + { + "codeId": "Alarm2", + "addressIndex": "64", + "addressLenght": "2" + }, + { + "codeId": "Alarm3", + "addressIndex": "66", + "addressLenght": "2" + }, + { + "codeId": "Alarm4", + "addressIndex": "68", + "addressLenght": "2" + }, + { + "codeId": "neirong", + "addressIndex": "70", + "addressLenght": "2" + }, + { + "codeId": "device", + "addressIndex": "72", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "74", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "76", + "addressLenght": "2" + }, + { + "codeId": "InOut1", + "addressIndex": "78", + "addressLenght": "2" + }, + { + "codeId": "InOut2", + "addressIndex": "80", + "addressLenght": "2" + }, + { + "codeId": "InOut3", + "addressIndex": "82", + "addressLenght": "2" + }, + { + "codeId": "InOut4", + "addressIndex": "84", + "addressLenght": "2" + }, + { + "codeId": "InOut5", + "addressIndex": "86", + "addressLenght": "2" + }, + { + "codeId": "InOut6", + "addressIndex": "88", + "addressLenght": "2" + }, + { + "codeId": "InOut7", + "addressIndex": "90", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "92", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "94", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "96", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "98", + "addressLenght": "2" + }, + { + "codeId": "spare", + "addressIndex": "100", + "addressLenght": "2" + }, + { + "codeId": "G04ActionState", + "addressIndex": "102", + "addressLenght": "2" + }, + { + "codeId": "G05ActionState", + "addressIndex": "104", + "addressLenght": "2" + }, + { + "codeId": "G06ActionState", + "addressIndex": "106", + "addressLenght": "2" + }, + { + "codeId": "G07ActionState", + "addressIndex": "108", + "addressLenght": "2" + }, + { + "codeId": "G08ActionState", + "addressIndex": "110", + "addressLenght": "2" + }, + { + "codeId": "G09ActionState", + "addressIndex": "112", + "addressLenght": "2" + }, + { + "codeId": "G10ActionState", + "addressIndex": "114", + "addressLenght": "2" + }, + { + "codeId": "G11ActionState", + "addressIndex": "116", + "addressLenght": "2" + }, + { + "codeId": "G12ActionState", + "addressIndex": "118", + "addressLenght": "2" + }, + { + "codeId": "G13ActionState", + "addressIndex": "120", + "addressLenght": "2" + }, + { + "codeId": "G04IDS", + "addressIndex": "122", + "addressLenght": "2" + }, + { + "codeId": "G05IDS", + "addressIndex": "124", + "addressLenght": "2" + }, + { + "codeId": "G06IDS", + "addressIndex": "126", + "addressLenght": "2" + }, + { + "codeId": "G07IDS", + "addressIndex": "128", + "addressLenght": "2" + }, + { + "codeId": "G08IDS", + "addressIndex": "130", + "addressLenght": "2" + }, + { + "codeId": "G09IDS", + "addressIndex": "132", + "addressLenght": "2" + }, + { + "codeId": "G10IDS", + "addressIndex": "134", + "addressLenght": "2" + }, + { + "codeId": "G11IDS", + "addressIndex": "136", + "addressLenght": "2" + }, + { + "codeId": "G12IDS", + "addressIndex": "138", + "addressLenght": "2" + }, + { + "codeId": "G13ID", + "addressIndex": "140", + "addressLenght": "2" + } + ] +} \ No newline at end of file diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterInfo.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterInfo.java index 38155f0..313adc2 100644 --- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterInfo.java +++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterInfo.java @@ -105,7 +105,7 @@ if (addressLength < 2) { return null; } - int wordindex = index; + int wordindex = Integer.parseInt(stringdatas[1]) + index; return stringdatas[0] + "." + wordindex; /* if (addressLength == 2) { diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java index de9760b..f13c19b 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/S7object.java @@ -6,7 +6,6 @@ import com.mes.tools.S7control; - /** * @Author : zhoush * @Date: 2024/4/9 15:13 @@ -25,10 +24,9 @@ private S7object() { if (plccontrol == null) { plccontrol = new S7control(plcType, ip, port, 0, 0); - - String PlcCacheGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); - //log.info(PLCAutoMes.class.getResource("").getPath()); - PlcMesObject = InitUtil.initword(PlcCacheGlass); + String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCacheGlass.json"; +// String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath(); + PlcMesObject = InitUtil.initword(PlcLoadGlass); } } @@ -54,7 +52,7 @@ e.printStackTrace(); } - byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); + byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); PlcMesObject.setPlcParameterList(getplcvlues); } diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java index 2969896..f94d854 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java @@ -1,5 +1,6 @@ package com.mes.edgstoragecage.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.toolkit.JoinWrappers; import com.github.yulichang.wrapper.MPJLambdaWrapper; @@ -37,14 +38,18 @@ @Override public EdgStorageCage selectNearestEmpty(int currentSlot) { - return this.selectJoinOne(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>() + List<EdgStorageCage> emptyList = this.selectJoinList(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>() .selectAll(EdgStorageCage.class) .leftJoin(EdgStorageCageDetails.class, on -> on .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot) .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)) .isNull(EdgStorageCageDetails::getSlot) - .last("order by abs(t.slot - " + currentSlot + ") asc limit 1") + .last("order by abs(t.slot - " + currentSlot + ") asc limit 2") ); + if (CollectionUtil.isEmpty(emptyList) || emptyList.size() < 2) { + return null; + } + return emptyList.get(0); } /** diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java index 7e387a2..9f8583a 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java @@ -55,7 +55,7 @@ /** * 鑶滅郴 */ - private Integer filmsid; + private String filmsid; /** * 纾ㄥ墠瀹� 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 e956d94..dc9db3c 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 @@ -7,6 +7,7 @@ import com.github.yulichang.query.MPJQueryWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.mes.common.S7object; +import com.mes.common.WebSocketServer; import com.mes.common.config.Const; import com.mes.device.PlcParameterObject; import com.mes.edgglasstask.entity.EdgGlassTaskInfo; @@ -51,6 +52,9 @@ @Autowired EdgGlassTaskInfoService edgGlassTaskInfoService; + + @Autowired + WebSocketServer webServerService; @Value("${mes.threshold}") private int threshold; @@ -111,6 +115,27 @@ inTo(glassIdeValue, confirmationWrodAddress, currentSlot); } } + } + + public void plcToHomeEdgTask() { + // log.info("鎺ㄦ暟鎹�"); + // jsonObject.append("params", new short[] { 30, 40, }); +// ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home"); +// if (sendwServer != null) { +// for (WebSocketServer webserver : sendwServer) { +// webserver.sendMessage(jsonObject.toString()); +// if (webserver != null) { +// +// List<String> messages = webserver.getMessages(); +// +// if (!messages.isEmpty()) { +// // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛� +// webserver.clearMessages(); +// } +// } +// +// } +// } } /** @@ -191,7 +216,7 @@ } EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); - endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out08Glassstate); + endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate); } else { //鍒ゆ柇涓ゆ潯绾挎槸鍚﹂兘绌洪棽 endcell = out08Glassstate == 1 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; @@ -249,11 +274,13 @@ private List<EdgStorageCageDetails> queryEdgAllGlass(String glassId) { List<EdgStorageCageDetails> glassList = new ArrayList<>(); //鑾峰彇寰呰繘鐗囩幓鐠� - GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() - .eq(GlassInfo::getGlassId, glassId)); - EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); - BeanUtils.copyProperties(one, resultDetails); - glassList.add(resultDetails); + if(StringUtils.isNotBlank(glassId)){ + GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() + .eq(GlassInfo::getGlassId, glassId)); + EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); + BeanUtils.copyProperties(one, resultDetails); + glassList.add(resultDetails); + } //鑾峰彇绗煎唴鐜荤拑 List<EdgStorageCageDetails> details = edgStorageCageDetailsService.list(new LambdaQueryWrapper<EdgStorageCageDetails>() .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); @@ -399,9 +426,13 @@ MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>(); wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount) + .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) .last("order by count(t.glass_id) desc limit 2"); List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); + if (CollectionUtil.isEmpty(list)){ + return null; + } log.info("鑾峰彇绗煎瓙鍐呮暟閲忓墠浜岀殑鐜荤拑鏁伴噺锛歿}", list); //鑾峰彇瀹介珮鎷嶇涓�鐨勭幓鐠冧俊鎭� EdgStorageCageDetails firstSize = list.get(0); @@ -526,7 +557,7 @@ private boolean saveGlassSize(EdgStorageCageDetails glassInfo) { EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo(); BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo); - edgGlassTaskInfo.setHeight((int) (glassInfo.getEdgHeight() * ratio)); + edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio)); edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio)); edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio)); edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE); diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java index 102ff13..785ef2f 100644 --- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java +++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java @@ -24,9 +24,7 @@ private S7object() { if (plccontrol == null) { plccontrol = new S7control(plcType, ip, port, 0, 0); - - String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheVerticalGlass.json").getPath(); - //log.info(PLCAutoMes.class.getResource("").getPath()); + String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCacheVerticalGlass.json"; PlcMesObject = InitUtil.initword(PlcLoadGlass); } } diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java index 43dcc90..c38d086 100644 --- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java +++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java @@ -2,9 +2,10 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; + +import java.io.Serializable; /** * <p> @@ -54,7 +55,7 @@ /** * 鑶滅郴 */ - private Integer filmsid; + private String filmsid; /** * 纾ㄥ墠瀹� diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java index d25f5ea..ed8f92d 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java @@ -13,8 +13,8 @@ */ public class S7object extends Thread { public S7control plccontrol; // PLC閫氳绫诲疄渚� - private EPlcType plcType = EPlcType.S1200; // 瑗块棬瀛怭LC绫诲瀷 - private String ip = "192.168.10.1"; // plc ip鍦板潃 + private EPlcType plcType = EPlcType.S200_SMART; // 瑗块棬瀛怭LC绫诲瀷 + private String ip = "192.168.10.100"; // plc ip鍦板潃 private int port = 102; // plc 绔彛鍙� @@ -24,9 +24,7 @@ private S7object() { if (plccontrol == null) { plccontrol = new S7control(plcType, ip, port, 0, 0); - - String PlcLoadGlass = S7object.class.getResource("/JsonFile/PlcLoadGlass.json").getPath(); - //log.info(PLCAutoMes.class.getResource("").getPath()); + String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcLoadGlass.json"; PlcMesObject = InitUtil.initword(PlcLoadGlass); } } diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java index 984060f..f770a89 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/controller/UpWorkstationController.java @@ -2,8 +2,6 @@ import com.mes.utils.Result; -import com.mes.workstation.entity.GlassInfo; -import com.mes.workstation.entity.UpWorkSequence; import com.mes.workstation.entity.UpWorkstation; import com.mes.workstation.service.UpWorkstationService; import io.swagger.annotations.ApiOperation; @@ -55,5 +53,14 @@ // // } + + @ApiOperation("淇敼涓婄墖mes鑱斿姩璇锋眰瀛�") + @PostMapping("/updateMesInkageLoad") + @ResponseBody + public Result<String> updateMesInkageLoad(@RequestBody short inKageWord) { + String result = upWorkstationService.updateMesInkageLoad(inKageWord); + return Result.success(result); + } + } diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/mapper/LoadGlassMapper.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/mapper/LoadGlassMapper.java index aedecb4..93ba7fb 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/mapper/LoadGlassMapper.java +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/mapper/LoadGlassMapper.java @@ -11,7 +11,7 @@ public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { //鍒ゆ柇浼樺厛宸ヤ綅鍚哥墖 @Select("select b.layout_sequence,a.number from up_workstation a left join up_patten_usage b " + - "on a.pattern_width=b.width and a.pattern_heigth=b.width " + + "on a.pattern_width=b.width and a.pattern_height=b.height " + "and a.pattern_thickness=b.thickness where a.workstation_id=#{id}") Map<String, Object> selectPriority(int id); diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/UpWorkstationService.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/UpWorkstationService.java index 28547f4..bd2a6c8 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/UpWorkstationService.java +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/UpWorkstationService.java @@ -37,5 +37,6 @@ void updateGlassMessage(UpWorkstation upwork); + String updateMesInkageLoad(short inKageWord); } diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java index 93af99f..2781919 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/workstation/service/impl/UpWorkstationServiceImpl.java @@ -3,10 +3,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mes.common.S7object; +import com.mes.device.PlcParameterObject; import com.mes.engineering.entity.Engineering; import com.mes.uppattenusage.entity.UpPattenUsage; import com.mes.uppattenusage.mapper.UpPattenUsageMapper; -import com.mes.workstation.entity.UpWorkSequence; import com.mes.workstation.entity.UpWorkstation; import com.mes.workstation.mapper.UpWorkstationMapper; import com.mes.workstation.service.UpWorkstationService; @@ -84,7 +85,12 @@ } } + @Override + public String updateMesInkageLoad(short inKageWord) { + PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; + log.info("淇敼璁惧涓ゆ爧璇锋眰涓簕}锛�0鑱旂嚎锛�1鑱斿姩", inKageWord); + S7object.getinstance().plccontrol.WriteWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); + return "success"; + } - -} } \ No newline at end of file diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/JsonFile/PlcLoadGlass.json b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/JsonFile/PlcLoadGlass.json index 1a32fde..d85b3d8 100644 --- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/JsonFile/PlcLoadGlass.json +++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/resources/JsonFile/PlcLoadGlass.json @@ -1,6 +1,6 @@ { - "plcAddressBegin":"DB14.0", - "plcAddressLenght":"98", + "plcAddressBegin":"DB1.2000", + "plcAddressLenght":"100", "dataType":"word", "parameteInfor":[ { @@ -25,6 +25,13 @@ "unit":"" }, { + "codeId": "InkageStatus", + "addressIndex":"22", + "addressLenght":"2", + "ratio":"1", + "unit":"" + }, + { "codeId": "WorkId", "addressIndex":"24", "addressLenght":"2", diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java index 7ec3d2e..92f56b5 100644 --- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java +++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/S7object.java @@ -24,9 +24,7 @@ private S7object() { if (plccontrol == null) { plccontrol = new S7control(plcType, ip, port, 0, 0); - - String PlcCacheGlass=S7object.class.getResource("/JsonFile/PlcdownGlass.json").getPath(); - //log.info(PLCAutoMes.class.getResource("").getPath()); + String PlcCacheGlass = System.getProperty("user.dir") + "/JsonFile/PlcdownGlass.json"; PlcMesObject = InitUtil.initword(PlcCacheGlass); } } -- Gitblit v1.8.0