From f09b972bb7adf8d4fd75fcb87c85973e493432a8 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期二, 30 四月 2024 11:14:20 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java | 66 +++++++++++++-------------------- 1 files changed, 26 insertions(+), 40 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java index 6244431..1868b6b 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapData.java @@ -6,10 +6,13 @@ import com.zy.asrs.common.wms.entity.LocMast; import com.zy.asrs.common.wms.service.LocMastService; import com.zy.asrs.framework.common.SpringUtils; +import com.zy.asrs.wcs.core.entity.Loc; import com.zy.asrs.wcs.core.model.MapNode; import com.zy.asrs.wcs.core.model.NavigateNode; import com.zy.asrs.wcs.core.model.enums.NavigationMapType; +import com.zy.asrs.wcs.core.service.LocService; import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.*; @@ -22,6 +25,9 @@ */ @Component public class NavigateMapData { + + @Autowired + private LocService locService; private Integer lev;//鍦板浘妤煎眰 @@ -121,33 +127,16 @@ //鑾峰彇JSON鏍煎紡鏁版嵁 public List<List<MapNode>> getJsonData(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { - try { - String mapFilename = "map_" + lev + ".json"; - - String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//鑾峰彇鏂囦欢璺緞 - File file = new File(fileName); - StringBuffer stringBuffer = new StringBuffer(); - if (file.isFile() && file.exists()) { - InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); - BufferedReader br = new BufferedReader(isr); - String lineTxt = null; - while ((lineTxt = br.readLine()) != null) { - stringBuffer.append(lineTxt); - } - br.close(); - - //瑙f瀽json鍦板浘鏁版嵁 - ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); - List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//杩囨护鍦板浘鏁版嵁 - - return lists; - } else { - System.out.println("鏂囦欢涓嶅瓨鍦�!"); - } - } catch (IOException ioException) { - ioException.printStackTrace(); + RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); + Object o = redisUtil.get(DeviceRedisConstant.MAP + lev); + if (o == null) { + return null; } - return null; + + BasMap basMap = JSON.parseObject(o.toString(), BasMap.class); + ArrayList arrayList = JSON.parseObject(basMap.getData(), ArrayList.class); + List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//杩囨护鍦板浘鏁版嵁 + return lists; } /** @@ -172,13 +161,12 @@ } //杩囨护鏁版嵁 - LocMastService locMastService = SpringUtils.getBean(LocMastService.class); //鑾峰彇褰撳墠妤煎眰搴撲綅鏁版嵁 - List<LocMast> locMasts = locMastService.list(new LambdaQueryWrapper<LocMast>() - .eq(LocMast::getLev1, lev)); - for (LocMast locMast : locMasts) { - Integer row = locMast.getRow1(); - Integer bay = locMast.getBay1(); + List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>() + .eq(Loc::getLev, lev)); + for (Loc loc : locs) { + Integer row = loc.getRow(); + Integer bay = loc.getBay(); boolean whiteFlag = false;//榛樿涓嶅瓨鍦ㄧ櫧鍚嶅崟 if (whitePoints != null) { @@ -203,17 +191,15 @@ } else if (mapType == NavigationMapType.DFX.id) { //杞﹁締鏈夎揣 //璇诲彇瀵瑰簲搴撲綅鏁版嵁锛屽皢DFX搴撲綅鐘舵�佺殑鑺傜偣缃负-1(闅滅鐗�) - if (locMast.getLocSts().equals("F") - || locMast.getLocSts().equals("D") - || locMast.getLocSts().equals("X") - || locMast.getLocSts().equals("R") - || locMast.getLocSts().equals("P") + if (loc.getLocSts$().equals("F") + || loc.getLocSts$().equals("D") + || loc.getLocSts$().equals("X") ) { mapNode.setValue(-1);//绂佺敤鑺傜偣 } } else if (mapType == NavigationMapType.NORMAL.id) { //杩囨护搴撲綅鐘舵�乆 - if (locMast.getLocSts().equals("X")) { + if (loc.getLocSts$().equals("X")) { mapNode.setValue(-1);//绂佺敤鑺傜偣 } } @@ -267,8 +253,8 @@ } } - NavigateMapData mapData = new NavigateMapData(nodes.get(0).getZ()); - List<List<MapNode>> realMap = mapData.getJsonData(-1, null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱) + this.setLev(nodes.get(0).getZ()); + List<List<MapNode>> realMap = this.getJsonData(-1, null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱) for (NavigateNode node : nodes) { if (node.getZ() != lev) { continue; -- Gitblit v1.9.1