From 9e97ded305585c0bdc22aef3468dd031567c38a3 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期四, 09 五月 2024 14:04:00 +0800 Subject: [PATCH] 卧式理片笼线程改造优化 --- hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/PlcHomeEdg.java | 71 +++++++++++++++++------------------ 1 files changed, 34 insertions(+), 37 deletions(-) diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/PlcHomeEdg.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/PlcHomeEdg.java index 5c0a7ab..7331a33 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/PlcHomeEdg.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/PlcHomeEdg.java @@ -1,6 +1,5 @@ package com.mes.common; -import cn.hutool.core.date.DateTime; import cn.hutool.json.JSONObject; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.mes.edgstoragecage.entity.EdgStorageCage; @@ -16,10 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import javax.annotation.Resource; +import java.util.*; @Service @Slf4j @@ -34,7 +31,7 @@ EdgStorageCageService edgStorageCageService; @Autowired EdgStorageCageDetailsService edgStorageCageDetailsService; - @Autowired + @Resource private EdgStorageCageDetailsMapper edgStorageCageDetailsMapper; private Map<String, String> mapParameter = new HashMap<String, String>(); @@ -44,28 +41,28 @@ private void initialize() { - mapParameter.put("A06_request_word", "DB11.0"); //work - mapParameter.put("A05_scanning_ID", "DB11.2"); - mapParameter.put("MES_confirmation_word", "DB11.40"); - mapParameter.put("A09_glass_status", "DB11.70"); - //mapParameter.put("A10_glass_status", "DB11.72"); - mapParameter.put("A09_prohibit_film_production", "DB11.74"); - mapParameter.put("A10_prohibit_film_production", "DB11.76"); - mapSettings.put("territoryPoor", 3); - mapType.put("A06_request_word", "Word"); - mapType.put("A05_scanning_ID", "String"); - mapType.put("MES_confirmation_word", "Word"); - mapType.put("A09_glass_status", "Word"); - //mapType.put("A10_glass_status", "Word"); - mapType.put("A09_prohibit_film_production", "Word"); - mapType.put("A10_prohibit_film_production", "Word"); -// mapValue.put("A06_request_word","1");//璇锋眰瀛� -// mapValue.put("A05_scanning_ID","7");//璇锋眰ID -// mapValue.put("MES_confirmation_word","0");//MES鍙戦�佸瓧 -// mapValue.put("A09_glass_status","0");//A09鐜荤拑鐘舵�� -// mapValue.put("A10_glass_status","0");//A09鐜荤拑鐘舵�� -// mapValue.put("A09_prohibit_film_production","0");//A9绂佹鍑虹墖 -// mapValue.put("A10_prohibit_film_production","0");//A10绂佹鍑虹墖 +// mapParameter.put("A06_request_word", "DB11.0"); //work +// mapParameter.put("A05_scanning_ID", "DB11.2"); +// mapParameter.put("MES_confirmation_word", "DB11.40"); +// mapParameter.put("A09_glass_status", "DB11.70"); +// //mapParameter.put("A10_glass_status", "DB11.72"); +// mapParameter.put("A09_prohibit_film_production", "DB11.74"); +// mapParameter.put("A10_prohibit_film_production", "DB11.76"); +// mapSettings.put("territoryPoor", 3); +// mapType.put("A06_request_word", "Word"); +// mapType.put("A05_scanning_ID", "String"); +// mapType.put("MES_confirmation_word", "Word"); +// mapType.put("A09_glass_status", "Word"); +// //mapType.put("A10_glass_status", "Word"); +// mapType.put("A09_prohibit_film_production", "Word"); +// mapType.put("A10_prohibit_film_production", "Word"); + mapValue.put("A06_request_word", "1");//璇锋眰瀛� + mapValue.put("A05_scanning_ID", "11111111111");//璇锋眰ID + mapValue.put("MES_confirmation_word", "0");//MES鍙戦�佸瓧 + mapValue.put("A09_glass_status", "0");//A09鐜荤拑鐘舵�� + mapValue.put("A10_glass_status", "0");//A09鐜荤拑鐘舵�� + mapValue.put("A09_prohibit_film_production", "0");//A9绂佹鍑虹墖 + mapValue.put("A10_prohibit_film_production", "0");//A10绂佹鍑虹墖 } @@ -90,9 +87,10 @@ taskCache.setStartCell(0); taskCache.setEndCell(edgStorageCage.getSlot()); taskCache.setTaskType(1); - taskCache.setCreateTime(new DateTime()); + taskCache.setCreateTime(new Date()); edgStorageCageDetailsMapper.updateById(edgStorageCageDetails); taskCacheService.insertTaskCache(taskCache); + S7object.getinstance().plccontrol.WriteWord(mapParameter.get("MES_confirmation_word"), (short) 1); } else { log.info("涓嶅瓨鍦ㄧ┖鏍�"); } @@ -127,8 +125,9 @@ taskCache.setStartCell(outEdgStorageCageDetails.getSlot()); taskCache.setEndCell(endcell); taskCache.setTaskType(2); - taskCache.setCreateTime(new DateTime()); + taskCache.setCreateTime(new Date()); taskCacheService.insertTaskCache(taskCache); + S7object.getinstance().plccontrol.WriteWord(mapParameter.get("MES_confirmation_word"), (short) 1); } @@ -150,18 +149,16 @@ } mapValue.put(key, value); } + + S7object.getinstance().plccontrol.WriteWord(S7object.getinstance().PlcMesObject.getPlcParameter("A06_request_word").getAddress(), (short)1); try { Thread.sleep(1000); - taskCacheService = WebSocketServer.applicationContext.getBean(TaskCacheService.class); - glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class); - edgStorageCageService = WebSocketServer.applicationContext.getBean(EdgStorageCageService.class); - edgStorageCageDetailsMapper = WebSocketServer.applicationContext.getBean(EdgStorageCageDetailsMapper.class); // initialize();//鍒濆鍖栨暟鎹� - if ("0".equals(mapValue.get("A06_request_word"))) { + if ("0".equals(S7object.getinstance().PlcMesObject.getPlcParameter("A06_request_word"))) { //娓呴櫎 S7object.getinstance().plccontrol.WriteWord(mapParameter.get("MES_confirmation_word"), (short) 0); - } else if ("1".equals(mapValue.get("A06_request_word")) && - "0".equals(mapValue.get("MES_confirmation_word"))) { + } else if ("1".equals(S7object.getinstance().PlcMesObject.getPlcParameter("A06_request_word")) && + "0".equals(S7object.getinstance().PlcMesObject.getPlcParameter("MES_confirmation_word"))) { inTo(); } else if ("2".equals(mapValue.get("A06_request_word")) && -- Gitblit v1.8.0