From 4cdcf7b4165fdcbaff1c96f85ec53c5f944fd038 Mon Sep 17 00:00:00 2001 From: zhangchao <zc857179121@qq.com> Date: 星期五, 22 十一月 2024 10:56:44 +0800 Subject: [PATCH] 1 --- src/main/resources/application-loc.yml | 25 ++++---- src/main/java/com/zy/common/config/ScheduleConfig.java | 13 ++- src/main/java/com/zy/asrs/controller/AgvMapController.java | 101 ++++++++++++++++++++------------- src/main/resources/application.yml | 2 4 files changed, 83 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/AgvMapController.java b/src/main/java/com/zy/asrs/controller/AgvMapController.java index 284fc10..550bbac 100644 --- a/src/main/java/com/zy/asrs/controller/AgvMapController.java +++ b/src/main/java/com/zy/asrs/controller/AgvMapController.java @@ -32,6 +32,8 @@ @Autowired private RedisUtil redisUtil; + private Integer max = 10000; + private static final List<String> DISABLE_LOC_NO = new ArrayList<String>() {{ // add("0200101"); // add("0300101"); @@ -53,13 +55,13 @@ //to do // floor = 2; - BasMap basMap = agvBasMapService.selectLatestMap(lev,floor); + BasMap basMap = agvBasMapService.selectLatestMap(lev, floor); //瑙f瀽json鍦板浘鏁版嵁 List<ArrayList> arrayLists = JSON.parseArray(basMap.getData(), ArrayList.class); //鑾峰彇褰撳墠妤煎眰搴撲綅鏁版嵁 - List<AgvLocMast> locMasts = agvLocMastService.selectLocByLevAndFloor(lev,floor); + List<AgvLocMast> locMasts = agvLocMastService.selectLocByLevAndFloor(lev, floor); for (AgvLocMast locMast : locMasts) { Integer row = locMast.getRow1(); Integer bay = locMast.getBay1(); @@ -68,19 +70,19 @@ int x = bay; int y = row; //2妤� - if(floor == 1 && lev == 1){ + if (floor == 1 && lev == 1) { x = generateMap1Bay(bay); } - if(floor == 1 && lev == 2){ + if (floor == 1 && lev == 2) { y = generateMap4Row(row); } //2妤� - if(floor == 2){ + if (floor == 2) { y = generateMap2Row(row); //y = generateMap2Bay(bay); } ////3妤� - if(floor == 3){ + if (floor == 3) { y = generateMap3Row(row); // x = generateMap3Bay(bay); } @@ -89,7 +91,7 @@ Object o = rowData.get(y); JSONObject jsonObject = JSON.parseObject(o.toString()); - jsonObject.put("value","0"); + jsonObject.put("value", "0"); jsonObject.put("locNo", locMast.getLocNo());//璁剧疆搴撲綅鍙� jsonObject.put("locSts", locMast.getLocSts());//搴撲綅鐘舵�� @@ -100,12 +102,13 @@ return JSONObject.toJSONString(arrayLists); } - private Integer generateMap1Bay(int bay){ + + private Integer generateMap1Bay(int bay) { int y = bay; - Integer[] bayAdd = {1,3,5,7,9,11,13,15,17,19}; - for(int i=0; i<bayAdd.length; i++){ - if(bay > bayAdd[i]){ - y ++; + Integer[] bayAdd = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}; + for (int i = 0; i < bayAdd.length; i++) { + if (bay > bayAdd[i]) { + y++; } } @@ -113,12 +116,12 @@ } - private Integer generateMap4Row(int row){ + private Integer generateMap4Row(int row) { int x = row; - Integer[] rowAdd = {1,3,5,7,9,11,13,15,17,19,21}; - for(int i=0; i<rowAdd.length; i++){ - if(row > rowAdd[i]){ - x ++; + Integer[] rowAdd = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21}; + for (int i = 0; i < rowAdd.length; i++) { + if (row > rowAdd[i]) { + x++; } } @@ -126,50 +129,68 @@ } - private Integer generateMap2Row(int row){ + private Integer generateMap2Row(int row) { int x = row; - Integer[] rowAdd = {2,4,6,7,8,10,12,13,15,17,19,20,22,24}; - for(int i=0; i<rowAdd.length; i++){ - if(row > rowAdd[i]){ - x ++; + Integer[] rowAdd = {2, 4, 6, 7, 8, 10, 12, 13, 15, 17, 19, 20, 22, 24}; + for (int i = 0; i < rowAdd.length; i++) { + if (row > rowAdd[i]) { + x++; } } - if(row >20) x += 9; + if (row > 20) x += 9; return x; } - private Integer generateMap2Bay(int bay){ + private Integer generateMap2Bay(int bay) { int y = bay; - if(y > 28){ - y ++; + if (y > 28) { + y++; } - if(y > 57){ - y ++; + if (y > 57) { + y++; } return y; } - private Integer generateMap3Row(int row){ + private Integer generateMap3Row(int row) { int x = row; - Integer[] rowAdd = {2,4,6,8,10,12,14,15,17,19,21,22,24,26,28,30,32}; - for(int i=0; i<rowAdd.length; i++){ - if(row >= rowAdd[i]){ - x ++; + Integer[] rowAdd = {2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 22, 24, 26, 28, 30, 32}; + for (int i = 0; i < rowAdd.length; i++) { + if (row >= rowAdd[i]) { + x++; } } - if(row >8) x += 9; + if (row > 8) x += 9; return x; } - private Integer generateMap3Bay(int bay){ - int y = 76-bay; - if(bay >= 18) y --; - if(bay >= 26) y --; - if(bay >= 50) y --; + private Integer generateMap3Bay(int bay) { + int y = 76 - bay; + if (bay >= 18) y--; + if (bay >= 26) y--; + if (bay >= 50) y--; return y; } + + + public static void main(String[] args) { + AgvMapController a = new AgvMapController(); + System.out.println(a.generateMap4Row(4)); + + System.out.println(a.process(1)); + } + + private List<Integer> process(int start) { + List<Integer> l = new ArrayList<>(); + while (start <= max) { + l.add(start); + start = start + 2; + } + return l; + } + @RequestMapping("/map/searchData/auth") @ManagerAuth @@ -179,7 +200,7 @@ @RequestParam("specs") String specs, @RequestParam("matnr") String matnr, @RequestParam("maktx") String maktx - ) { + ) { List<AgvLocDetl> locDetls = agvLocDetlService.searchByLike(orderNo, matnr, maktx, specs, locNo); ArrayList<AgvLocDetl> lists = new ArrayList<>(); diff --git a/src/main/java/com/zy/common/config/ScheduleConfig.java b/src/main/java/com/zy/common/config/ScheduleConfig.java index b46c8d7..25b3a15 100644 --- a/src/main/java/com/zy/common/config/ScheduleConfig.java +++ b/src/main/java/com/zy/common/config/ScheduleConfig.java @@ -5,16 +5,19 @@ import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.*; @Configuration public class ScheduleConfig implements SchedulingConfigurer { @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { - //taskRegistrar.setScheduler(Executors.newScheduledThreadPool(12)); - taskRegistrar.setScheduler(Executors.newFixedThreadPool(12)); + //閲囩敤瀹氶暱鐨勭嚎绋嬫睜锛岄槻姝㈠畾鏃朵换鍔″紓甯告椂瀵艰嚧澶ч噺绾跨▼琚崰鐢紱 + + // 鍒涘缓涓�涓� ScheduledThreadPoolExecutor锛屾牳蹇冪嚎绋嬫暟涓� 12锛屾渶澶х嚎绋嬫暟涓� 24 + ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(12, new ThreadPoolExecutor.CallerRunsPolicy()); + // 璁剧疆鏈�澶х嚎绋嬫暟涓� 24 + executor.setMaximumPoolSize(24); + taskRegistrar.setScheduler(executor); } } diff --git a/src/main/resources/application-loc.yml b/src/main/resources/application-loc.yml index a2e5a20..3d2e3f0 100644 --- a/src/main/resources/application-loc.yml +++ b/src/main/resources/application-loc.yml @@ -72,17 +72,18 @@ password: Wlzh44338 agv: - # url: localhost:8080 - # taskCreatePath: /agv/task/create - # containerMoveInPath: /agv/container/moveIn - # containerMoveOutPath: /agv/container/moveOut - # containerArrivedPath: /agv/containerArrived - url: 192.168.103.12:8182 - taskCreatePath: /rcms/services/rest/hikRpcService/genAgvSchedulingTask - taskCancelPath: /rcms/services/rest/hikRpcService/cancelTask - containerMoveInPath: /expand/api/moveIn/container - containerMoveOutPath: /expand/api/moveOut/container - containerArrivedPath: /conveyor/containerArrived + url: localhost:8080 + taskCreatePath: /agv/task/create + taskCancelPath: /rcms/services/rest/hikRpcService/cancelTask + containerMoveInPath: /agv/container/moveIn + containerMoveOutPath: /agv/container/moveOut + containerArrivedPath: /agv/containerArrived +# url: 192.168.103.12:8182 +# taskCreatePath: /rcms/services/rest/hikRpcService/genAgvSchedulingTask +# taskCancelPath: /rcms/services/rest/hikRpcService/cancelTask +# containerMoveInPath: /expand/api/moveIn/container +# containerMoveOutPath: /expand/api/moveOut/container +# containerArrivedPath: /conveyor/containerArrived u8: report: false @@ -92,7 +93,7 @@ # url: http://39.184.149.30:8877 # orderReportPath: /DBMS/U8/CM/add mes: - report: true + report: false url: https://v3-ali.blacklake.cn/api/openapi/domain/web/v1/route orderReportPath: /inventory/open/v2/transfer_order/ordinary/_execute pakinReportPath: /inventory/open/v2/inbound_order/execute/_inbound diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f2026f2..22524fb 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: #dev loc prod - active: prod \ No newline at end of file + active: loc \ No newline at end of file -- Gitblit v1.9.1