From 5ff9a07bd109d7f0fb5c6373baa253ab196df6e1 Mon Sep 17 00:00:00 2001 From: Comair <1464848666@qq.com> Date: Wed, 19 Feb 2025 10:18:16 +0700 Subject: [PATCH] =?UTF-8?q?plc=E7=82=B9=E4=BD=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=87=BA=E5=BA=93=E5=A2=9E=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=9C=B0=E5=9B=BE=E5=A2=9E=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/shkj/common/constant/RedisConstant.java | 2 ++ .../main/java/com/shkj/wcs/plc/PlcEventTask.java | 8 ++++---- .../src/main/java/com/shkj/wcs/plc/PlcInit.java | 3 +++ .../service/impl/BusinOutInPlanServiceImpl.java | 15 ++++++++++++++- .../impl/BusinPlcExceptionServiceImpl.java | 4 +++- .../src/main/java/com/shkj/wms/vo/BaseMoldVo.java | 4 ++++ .../resources/mapper/wms/SysStockDetailMapper.xml | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/shkj-common/src/main/java/com/shkj/common/constant/RedisConstant.java b/shkj-common/src/main/java/com/shkj/common/constant/RedisConstant.java index fec5256..60f255e 100644 --- a/shkj-common/src/main/java/com/shkj/common/constant/RedisConstant.java +++ b/shkj-common/src/main/java/com/shkj/common/constant/RedisConstant.java @@ -20,6 +20,8 @@ public class RedisConstant { public static String redisReqWare ="reqWare:"; //请求接料 public static String redisReqMate ="reqMate:"; + //出库 + public static String redisOutBound ="outBound:"; //任务对应的plc连接Id public static String redistaskPlc ="taskPlcId:"; diff --git a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java index 9c86f72..16c7773 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java @@ -79,7 +79,7 @@ public class PlcEventTask { @Autowired PlcInit plcInit; - // @Scheduled(fixedDelay = 5000) + @Scheduled(fixedDelay = 5000) public void init() { //查询需要连接的PLC,初始化连接对象 List plcList =(List) redisTemplate.opsForValue().get(RedisConstant.redisPlcListConnect); @@ -101,7 +101,7 @@ public class PlcEventTask { //输送线心跳 - // @Scheduled(fixedDelay = 4000) + @Scheduled(fixedDelay = 4000) public void writePlcheartbeatDps() { //根据连接的plcId获取属性 PlcOperate plcOperate = plcInit.getPlcOperate_dps(); @@ -130,7 +130,7 @@ public class PlcEventTask { } //堆垛机心跳 - // @Scheduled(fixedDelay = 4000) + @Scheduled(fixedDelay = 4000) public void writePlcheartbeatStk() { //根据连接的plcId获取属性 PlcOperate plcOperate = plcInit.getPlcOperate_stk(); @@ -210,7 +210,7 @@ public class PlcEventTask { String address = property.getAddress(); businPlcException = new BusinPlcException(); if (pointType.equals("99")) { - log.info("地址:"+address+" 报警内容:"+devpName); + //log.info("地址:"+address+" 报警内容:"+devpName); if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))) { String message = MessageUtils.message(devpName); log.info("报警内容转多语言:"+message); diff --git a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcInit.java b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcInit.java index 300d297..5e6b6fc 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcInit.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/plc/PlcInit.java @@ -47,6 +47,9 @@ public class PlcInit { if (plcList.size() == 0) { return; } + //初始化系統时,把plc点位信息写入Redis + redisTemplate.opsForValue().set(RedisConstant.redisPlcListConnect,plcList); + for (WcsPlcConnectVo conn : plcList) { redisTemplate.opsForValue().set(RedisConstant.redisPlcConnect+conn.getDevCode(),conn); PlcHelper plc = new PlcHelper(conn.getPlcType(), conn.getPlcIp(), conn.getPlcFactory(), conn.getPort()); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java index 9dd9282..f845957 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinOutInPlanServiceImpl.java @@ -621,6 +621,8 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl moldBarcodeList = bo.getMoldBarcodeList(); List baseMoldBarcodeList = baseMoldService.queryByMoldBarcodeList(moldBarcodeList); if (CollectionUtils.isEmpty(baseMoldBarcodeList)) { @@ -755,6 +758,14 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl sysStockDetails = sysStockDetailService.queryByMoldBarcodeLocationList(moldBarcodeList); @@ -879,7 +893,6 @@ public class BusinOutInPlanServiceImpl extends ServiceImpl sysDictDataList = iSysDictDataService.selectDictDataList(sysDictData); List allList = new ArrayList<>(); for (SysDictData dictData : sysDictDataList) { - List businPlcExceptionList = (List)redisTemplate.opsForValue().get(RedisConstant.redisPlcExecMsg + dictData.getDictValue()); + List businPlcExceptionList = (List)redisTemplate.opsForValue().get(redisPlcExecMsg + dictData.getDictValue()); if(businPlcExceptionList != null){ for (BusinPlcException businPlcException : businPlcExceptionList) { businPlcException.setExecMsg(MessageUtils.message(businPlcException.getExecMsg())); diff --git a/shkj-wms/src/main/java/com/shkj/wms/vo/BaseMoldVo.java b/shkj-wms/src/main/java/com/shkj/wms/vo/BaseMoldVo.java index bc0db34..ba76ea6 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/vo/BaseMoldVo.java +++ b/shkj-wms/src/main/java/com/shkj/wms/vo/BaseMoldVo.java @@ -38,4 +38,8 @@ public class BaseMoldVo extends BaseMold { * 托盘编号 */ private String containerName; + /** + * 货位编号 + */ + private String locationName; } diff --git a/shkj-wms/src/main/resources/mapper/wms/SysStockDetailMapper.xml b/shkj-wms/src/main/resources/mapper/wms/SysStockDetailMapper.xml index beac3b2..b634f6e 100644 --- a/shkj-wms/src/main/resources/mapper/wms/SysStockDetailMapper.xml +++ b/shkj-wms/src/main/resources/mapper/wms/SysStockDetailMapper.xml @@ -376,7 +376,7 @@