From d5e9f8bd39923fa60cfc44abae36dfeb17b417a0 Mon Sep 17 00:00:00 2001 From: judy <278197488@qq.com> Date: Mon, 22 Jul 2024 09:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B7=E9=81=93=E5=86=85=E7=A7=BB=E5=BA=93?= =?UTF-8?q?=E7=BB=99=E5=A0=86=E5=9E=9B=E6=9C=BA=E4=B8=8B=E5=8F=91=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/shkj/wms/scheduled/ScheduledTasks.java | 17 +++++++++++++---- .../service/impl/BusinDataTaskServiceImpl.java | 17 ++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java index 8b5b60e..34170e6 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java +++ b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java @@ -1584,6 +1584,9 @@ public class ScheduledTasks { else if (taskType.equals(TaskTypeEnum.seat_adjustment.getValue())){ BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); moveTask(businDataTask); + }else if (taskType.equals(TaskTypeEnum.relocation_out.getValue())){ + BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); + Result taskResult = outTask(businDataTask); } log.info("任务号" + businDataTaskVo.getId() + "任务状态" + businDataTaskVo.getTaskStatus() + "点位信息" + businDataTaskVo.getPoints()); //统一提交任务数据 @@ -1673,6 +1676,7 @@ public class ScheduledTasks { //请求出库 给堆垛机下命令判断是否 加锁 加锁则返回 if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel())) && redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) { + log.info("出库时下发时,堆垛机加锁中"+businDataTask.getId()); return Result.err(); } else { redisTemplate.opsForValue().set("stackerLock:" + businDataTask.getTunnel(), "true"); @@ -1701,12 +1705,8 @@ public class ScheduledTasks { PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); if (plcReadAndWrite.execWrite(stkOperate, JsonUtil.toJSONString(allMap))) { - //解锁 - //redisTemplate.opsForValue().set("stackerLock", "false"); return Result.ok(); } else { - //解锁 - //redisTemplate.opsForValue().set("stackerLock", "false"); return Result.err(); } } else { @@ -1766,6 +1766,15 @@ public class ScheduledTasks { PLCReadAndWrite plcReadAndWriteD = new PLCReadAndWrite(); Map pointDMap = plcReadAndWriteD.readPlcData(stkOperate, plcConnect.getPointTables()); if (pointDMap.containsKey(readNullPoint)&&Boolean.valueOf(pointDMap.get(readNullPoint).toString())&&pointDMap.get(overonaddress).equals("0")) { + //请求出库 给堆垛机下命令判断是否 加锁 加锁则返回 + if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel())) + && redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) { + log.info("移库任务下发时,堆垛机加锁中"+businDataTask.getId()); + return Result.err(); + } else { + redisTemplate.opsForValue().set("stackerLock:" + businDataTask.getTunnel(), "true"); + } + //给堆垛机写命令 Map allMap = new HashMap<>(1); Map plcTaskIdMap = new HashMap<>(1); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java index 174c111..e5c4743 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java @@ -286,8 +286,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl dbTableColumnNames = pointDeviceout.stream().map(BasePointDeviceVo::getPointNo).collect(Collectors.toList()); String urgencyBefore = null; String urgencyAfter = null; - for (String str : dbTableColumnNames - ) { + for (String str : dbTableColumnNames) { // TODO 中科 测试 需要还原 if (str.equals(ParameterConstants.ParameterSystem.assemble_point_after)) { urgencyAfter = str; @@ -329,8 +328,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl tunnelLocQtyDicSort = new LinkedHashMap<>(); tunnelLocQtyDic.entrySet().stream().sorted(Map.Entry.comparingByValue().reversed()).forEachOrdered(e -> tunnelLocQtyDicSort.put(e.getKey(), e.getValue().intValue())); - //log.info("查询到的保险杠所在的货位信息:"+JsonUtil.toJSONString(tunnelVo)); + List tunnelall = tunnelVo.stream().map(e -> e.getTunnel()).collect(Collectors.toList()); - // log.info("查询到保险杠所在的巷道:"+JsonUtil.toJSONString(tunnelall)); //拿到任务数最少的巷道并且库存量是最大的 String tunnelone = this.quickSortTaskQty(tunnelLocQtyDicSort); log.info("任务数最少的巷道:" + tunnelone); @@ -1158,15 +1153,11 @@ public class BusinDataTaskServiceImpl extends ServiceImpl sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper() .eq(SysStockDetail::getLocationId, baseLocationVo.getId()) .eq(SysStockDetail::getQty, 1) .isNull(SysStockDetail::getOutQty)); -// List sysStockDetailList = iSysStockDetailService.queryList(stockDetailQueryBo); -// System.out.println("是否相等"+sysStockDetailList.get(0).getGoodsNo().equals(businDataTaskGoodsList.get(0).getGoodsNo())); + for (SysStockDetail stockDetail : sysStockDetailList) { businDataTaskGoodsList.stream().forEach( e -> {