From e62cdaccc98da27cfd155a7e6d9268cbdabd20c7 Mon Sep 17 00:00:00 2001 From: Comair <1464848666@qq.com> Date: Thu, 25 Jul 2024 21:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=8B=E6=9D=BF3=E6=95=B0=E6=8D=AEsql?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=86=B2=E5=AD=94=E6=9D=A0=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=9D=87=E8=A1=A1=E5=88=86=E9=85=8D=20=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E5=8F=8A=E4=B8=80=E9=94=AE=E5=87=BA=E5=BA=93=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkj/wms/mapper/BaseLocationMapper.java | 2 + .../java/com/shkj/wms/plc/PlcEventTask.java | 14 +- .../main/java/com/shkj/wms/plc/PlcInit.java | 2 +- .../shkj/wms/scheduled/ScheduledTasks.java | 97 ++++--------- .../wms/service/IBaseLocationService.java | 8 ++ .../impl/BaseBarcodesInServiceImpl.java | 2 +- .../service/impl/BaseLocationServiceImpl.java | 132 ++++++++++++++++++ .../impl/BusinDataTaskServiceImpl.java | 1 + .../impl/IBusinEnptyContainerServiceImpl.java | 7 +- .../impl/PutInOutStorageServiceImpl.java | 1 + .../wms/service/impl/StackServiceImpl.java | 2 +- .../java/com/shkj/wms/third/rcs/RCSUtil.java | 38 ++--- .../mapper/wms/BaseLocationMapper.xml | 31 ++++ .../resources/mapper/wms/SysStockMapper.xml | 40 ++---- 14 files changed, 251 insertions(+), 126 deletions(-) diff --git a/shkj-wms/src/main/java/com/shkj/wms/mapper/BaseLocationMapper.java b/shkj-wms/src/main/java/com/shkj/wms/mapper/BaseLocationMapper.java index 57efb20..db5c92d 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/mapper/BaseLocationMapper.java +++ b/shkj-wms/src/main/java/com/shkj/wms/mapper/BaseLocationMapper.java @@ -104,5 +104,7 @@ public interface BaseLocationMapper extends BaseMapper { List queryTargetLocation(BaseLocationUrgentBo bo); + List queryBaseLocationListByGoodsPunching(BaseLocationQueryListBo bo); + } diff --git a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java index 9580304..72c1001 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java +++ b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java @@ -136,7 +136,7 @@ public class PlcEventTask { private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(8); - // @Scheduled(fixedRate = 200) + @Scheduled(fixedRate = 200) public void init() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -219,7 +219,7 @@ public class PlcEventTask { } } - // @Scheduled(fixedRate = 200) + @Scheduled(fixedRate = 200) public void init1() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -237,7 +237,7 @@ public class PlcEventTask { } } - // @Scheduled(fixedRate = 200) + @Scheduled(fixedRate = 200) public void init2() { //查询需要连接的PLC,初始化连接对象 List plcList = iWcsPlcConnectService.selectWcsPlcConnectList(new WcsPlcConnect().setIsActive("1")); @@ -255,7 +255,7 @@ public class PlcEventTask { } } - // @Scheduled(fixedDelay = 6000) + @Scheduled(fixedDelay = 6000) public void writePlcheartbeat() { //根据连接的plcId获取属性 PlcOperate plcOperate = plcInit.getPlcOperate_41(); @@ -523,7 +523,7 @@ public class PlcEventTask { tunnel = businDataTaskServiceById.getTunnel(); String taskType = businDataTaskServiceById.getTaskType(); if (!taskType.equals("4") && !taskType.equals("5") && !taskType.equals("15") - && !taskType.equals("16") && !taskType.equals("21") && !taskType.equals("9")) { + && !taskType.equals("16") && !taskType.equals("21") && !taskType.equals("9") && !taskType.equals("25")) { //增加库存 Result booleanResult = iPutInOutStorageService.productDeposit(taskId); //处理成功 返回状态,写入状态位为0 @@ -849,7 +849,9 @@ public class PlcEventTask { agvTaskType = Integer.valueOf(abnormalWaitPintDeviceVo.getIsDown()); } else if (businDataTask.getTaskType().equals(TaskTypeEnum.relocation_out.getValue())) { // TODO 跨巷道移库AGV的模板尚未提供 - } else { + } else if(businDataTask.getTaskType().equals(TaskTypeEnum.named_loc.getValue())){ + + }else { agvPoints.add(businDataTask.getTaskPath()); snPointMap.put("3", businDataTask.getTaskPath()); diff --git a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java index a778a7b..4c94631 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java +++ b/shkj-wms/src/main/java/com/shkj/wms/plc/PlcInit.java @@ -42,7 +42,7 @@ public class PlcInit { RedisTemplate redisTemplate; private ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - //@PostConstruct + @PostConstruct public void init(){ log.info("初始化连接对象"); executorService.scheduleWithFixedDelay( 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 63efa8f..a68fedb 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 @@ -943,15 +943,24 @@ public class ScheduledTasks { basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(1); } } else { - - NUMBER = false; //先入待冲孔区 Long punchingArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); - List baseLocationVos = baseLocationMapper.getLocationByAreaId(punchingArea); - if (baseLocationVos.size() > 0) { - locationVo = baseLocationVos.get(0); + List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); + AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo(); + assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVos); + //冲孔杠分配货位 + Result locationVoResult = iBaseLocationService.assignEmptyLocatioPunching(assingEmptyLocBo); + + if (ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode() == HttpStatus.SUCCESS.getCode()) { + //如果是P01则设置randome为P02 + redisTemplate.opsForValue().set("randome", "P02"); + locationVo = locationVoResult.getData(); + } + if(locationVo == null){ + log.info("冲孔杠分配货位为空"); + return; } businDataTaskVo.setToColumn(locationVo.getLocationColumn()); businDataTaskVo.setToLayer(locationVo.getLayer()); @@ -960,16 +969,6 @@ public class ScheduledTasks { String tunnel = locationVo.getTunnel(); businDataTaskVo.setTunnel(tunnel); businDataTaskVo.setLocationId(locationVo.getId()); -// Result baseLocationVoResult = iBaseLocationService.queryById(locationVo.getId()); - List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - exeBo.setTaskCode(taskId); - exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); - exeBo.setContainerId(containerId); - exeBo.setBaseLocationVo(locationVo); - exeBo.setTransNo("1"); - exeBo.setTransQual("1"); - // iPutInOutStorageService.exeTaskPutinStorage(exeBo); //获取巷道对应的立库输送线接驳口 pointQueryBo.setTunnel(tunnel); pointQueryBo.setDirection("0"); @@ -978,16 +977,10 @@ public class ScheduledTasks { basePointDeviceVo = basePointDeviceVos.get(0); basePointDeviceVo.setPlcId(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id))); } - //获取巷道对应的堆垛机信息 pointQueryBo.setDevType("1"); BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo); stkPlcId = baseDevicePlcVo.getPlcId(); -// points.add(basePointDeviceVo.getHandshakePoint()); -// points.add(basePointDeviceVo.getHandshakePoint()); -// snPointMap.put("3",basePointDeviceVo.getHandshakePoint()); -// snPointMap.put("4",basePointDeviceVo.getHandshakePoint()); - } } String toPointNo = ""; @@ -998,16 +991,12 @@ public class ScheduledTasks { points.add(toPointNo); snPointMap.put("3", toPointNo); -// String toPointNo="KW18"; -// points.add(toPointNo); -// snPointMap.put("3",toPointNo); int agvTaskType; if (toPointNo.equals("KW12")) { agvTaskType = 24; } else { agvTaskType = 27; } - // TODO 中科 测试 需要删除 businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); //呼叫AGV @@ -1058,12 +1047,6 @@ public class ScheduledTasks { //获取要出库的物料信息 List businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); - //拿到按比例分配的库区 - // randome = allocationTasksUtils.randomeout(); - //测试时使用 - randome = "P01"; - //TODO 测试注释 要到开 -// if (randome.equals("P02")) { if (businDataTaskVo.getDistinction().equals("2")) { int number = businDataTaskGoodsVos.size(); List goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); @@ -1086,7 +1069,6 @@ public class ScheduledTasks { businDataTaskVo.setTaskType(TaskTypeEnum.thirteen_out.getValue()); businDataTaskVo.setTaskPath(frompoint); } - } //TODO 测试注释 要到开 @@ -1142,9 +1124,6 @@ public class ScheduledTasks { baseBarcodesOutServiceOne.setOutStatus("2"); iBaseBarcodesOutService.updateById(baseBarcodesOutServiceOne); } - - //添加巷道任务数和总任务数 - //tunnelTaskUtil.addOutboundTaskNum(businDataTask.getTunnel()); } else { if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:" + businDataTask.getId()))) { businDataTask.setExceptionMsg("下发堆垛机失败"); @@ -1161,38 +1140,6 @@ public class ScheduledTasks { businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); businDataTaskVo.setTaskStatus("-3"); } - -// if (ObjectUtils.isNotEmpty(list)) { -// -// -// }else { -// businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); -// businDataTaskVo.setTaskStatus("-3"); -// } -// else { -// //如果立库没有库存那么查看平库是否有库存 -// int numberT = businDataTaskGoodsVos.size(); -// List goodsnoT = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); -// //根据GoodsNo查看立库是否有库存 -// List listT = iSysStockDetailService.list(new LambdaQueryWrapper() -// .in(SysStockDetail::getGoodsNo, goodsno) -// .eq(SysStockDetail::getQty, "1") -// .isNull(SysStockDetail::getOutQty) -// .isNull(SysStockDetail::getLocationId)); -// if (ObjectUtils.isEmpty(listT)) { -// businDataTaskVo.setTaskStatus("-3"); -// }else { -// String frompoint = null; -// String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_out01); -// pointQueryBo.setGroupNo(tepairGroup); -// BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); -// frompoint = pointDeviceout.getPointNo(); -// businDataTaskVo.setTaskStatus(TaskStatusEnum.four_out.getValue()); -// businDataTaskVo.setTaskType(TaskTypeEnum.thirteen_out.getValue()); -// businDataTaskVo.setTaskPath(TaskTypeEnum.thirteen_out.getValue()); -// businDataTaskVo.setTaskPath(frompoint); -// } -// } } } @@ -1606,6 +1553,17 @@ public class ScheduledTasks { } else if("25".equals(taskType)){ BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); + //获取货位对应的巷道及巷道对应的设备信息 + pointQueryBo.setTunnel(businDataTask.getTunnel()); + pointQueryBo.setDirection("0"); + BasePointDeviceVo basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(0); + + Long plcId=0L; + if (basePointDeviceVo != null) { + plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); + } + businDataTask.setDpsNoOne(plcId); + businDataTaskVo.setDpsNoOne(plcId); Result taskResult = outTask(businDataTask); businDataTaskVo.setUpdateTime(DateUtils.getNowDate()); if (Result.isOk(taskResult)) { @@ -2080,11 +2038,6 @@ public class ScheduledTasks { Long stkPlcId = null; String agvno = null; - //获取派生 - // TODO 由于逻辑区域换成与车型相匹配,不是与派生匹配,所以注释掉 -// Long dervieId = getLocationByDervie(vehicheModel, color); - - String randome = "P01"; if (businDataTaskVo.getWarehouseType().equals("1")) { randome = "P01"; diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/IBaseLocationService.java b/shkj-wms/src/main/java/com/shkj/wms/service/IBaseLocationService.java index a9614d7..3f61031 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/IBaseLocationService.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/IBaseLocationService.java @@ -157,6 +157,14 @@ public interface IBaseLocationService extends IService { Result assignEmptyLocationAll(AssingEmptyLocBo assingEmptyLocBo); + + /** + * 冲孔杠分配货位 + * @param assingEmptyLocBo + * @return + */ + Result assignEmptyLocatioPunching(AssingEmptyLocBo assingEmptyLocBo); + /** * 检查货位是否有对应双深位 * diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseBarcodesInServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseBarcodesInServiceImpl.java index 6be3d5f..a2a5f06 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseBarcodesInServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseBarcodesInServiceImpl.java @@ -129,7 +129,7 @@ public class BaseBarcodesInServiceImpl extends ServiceImpl bos) { - log.info("上游同步入库条码:"+JsonUtil.toJSONString(bos)); + // log.info("上游同步入库条码:"+JsonUtil.toJSONString(bos)); BaseBarcodesIn baseBarcodesIn = null; BaseGoodsData baseGoodsData = null; diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java index 685ff3c..a1678cc 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java @@ -1014,6 +1014,138 @@ public class BaseLocationServiceImpl extends ServiceImpl assignEmptyLocatioPunching(AssingEmptyLocBo assingEmptyLocBo){ + List businDataTaskGoodsVos = assingEmptyLocBo.getBusinDataTaskGoodsVos(); + String goodsNo =""; + String vehicheModel = assingEmptyLocBo.getVehicheModel(); + String batch = assingEmptyLocBo.getBatch(); + + BaseLocationVo locationVo = null; + if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) { + BusinDataTaskGoodsVo businDataTaskGoodsVo = businDataTaskGoodsVos.get(0); + String taskCode = businDataTaskGoodsVo.getTaskCode(); + goodsNo=businDataTaskGoodsVo.getGoodsNo(); + log.info("冲孔入库分配货位任务号:" + taskCode + " 保险杠编号:" + goodsNo); + }else + { + return Result.err().msg("无保险杠信息"); + } + BaseLocationQueryListBo bo = new BaseLocationQueryListBo(); + bo.setGoodsNo(goodsNo); + bo.setLocationStatus("0"); + log.info("冲孔保险杠分配货位查询条件:" + JsonUtil.toJSONString(bo)); + List baseLocationVos = this.baseMapper.queryBaseLocationListByGoodsPunching(bo); + if (baseLocationVos.size() == 0) { + //查看缓冲区是否还有货位 + Long bufferArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area)); + List baseLocationVoList = baseLocationMapper.getLocationByAreaId(bufferArea); + log.info("冲孔保险杠保险杠缓冲区分配到的货位信息:" + baseLocationVoList.size()); + if (baseLocationVoList.size() < 0) { + log.info("冲孔保险杠车型及缓冲区都未查询到空货位"); + return Result.err().msg("冲孔保险杠保险杠分配货位暂无空货位可用"); + } + //baseLocationVos.addAll(baseLocationVoList); + baseLocationVos = baseLocationVoList; + } + + //拿到所有可用货位,根据巷道号对双深位的巷道进行处理 + //空货位所在巷道列表,同时过滤掉已有入库任务的巷道 + List tunnelList = baseLocationVos.stream().map(e -> e.getTunnel()).distinct().collect(Collectors.toList()); + log.info("保险杠分配货位查询到的货位对应的巷道信息:" + JsonUtil.toJSONString(tunnelList)); + //从存在空货位的巷道里选择较优的巷道进行入库 + //首选选择任务数为空或者任务数最少的巷道 + //任务数相同时选取空货位最多的巷道;24.06.27改为查询库存数量最少并且空货位数最多的 + List tunnelResult = new ArrayList<>(); + Integer minTaskNum = 0; + Integer maxEmptyLocationNum = 0; + Integer minGoodsQty = 0; + for (int i = 0; i < tunnelList.size(); i++) { + String tunnel = tunnelList.get(i); + Integer taskNum = tunnelTaskUtil.getTotalTaskNum(tunnel, 0); + List currTunnelLocationVos = baseLocationVos.stream().filter(e -> tunnel.equals(e.getTunnel())).collect(Collectors.toList()); + int curEmptyNum = currTunnelLocationVos.size(); + BaseLocationVo baseLocationVo = currTunnelLocationVos.get(0); + int currGoodsQty = 0; + if (baseLocationVo.getGoodQty() != null) { + currGoodsQty = baseLocationVo.getGoodQty(); + } + + //获取巷道内库存数量最少并且空货位数最多的 + log.info("保险杠分配之前----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty); + if (minTaskNum == 0 && taskNum.equals(minTaskNum)) { + if (i != 0) { + if (currGoodsQty < minGoodsQty) { + minGoodsQty = currGoodsQty; + if (curEmptyNum > maxEmptyLocationNum) { + tunnelResult.clear(); + tunnelResult.add(tunnel); + maxEmptyLocationNum = curEmptyNum; + } + } + } else { + minGoodsQty = currGoodsQty; + minTaskNum = taskNum; + tunnelResult.add(tunnel); + maxEmptyLocationNum = curEmptyNum; + } + } else if (minTaskNum == 0) { + if (i == 0) { + minGoodsQty = currGoodsQty; + minTaskNum = taskNum; + tunnelResult.add(tunnel); + maxEmptyLocationNum = curEmptyNum; + } + } else if (minTaskNum != 0 && taskNum.equals(minTaskNum)) { + if (currGoodsQty < minGoodsQty) { + minGoodsQty = currGoodsQty; + if (curEmptyNum > maxEmptyLocationNum) { + tunnelResult.clear(); + tunnelResult.add(tunnel); + maxEmptyLocationNum = curEmptyNum; + } + } + } else if (minTaskNum != 0 && taskNum < minTaskNum) { + minGoodsQty = currGoodsQty; + minTaskNum = taskNum; + tunnelResult.clear(); + tunnelResult.add(tunnel); + maxEmptyLocationNum = curEmptyNum; + } + + log.info("保险杠分配之后----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty); + } + + log.info("巷道的任务数量:" + JsonUtil.toJSONString(tunnelResult)); + //从选取的巷道中选择库位 + if (tunnelResult.size() > 0) { + String tunnel = tunnelResult.get(0); + List resultLocationList = baseLocationVos.stream().filter(e -> tunnel.equals(e.getTunnel())).collect(Collectors.toList()); + locationVo = resultLocationList.get(0); + log.info("分配的货位:" + JsonUtil.toJSONString(locationVo)); + //巷道中货位数大于1时,进行分配 + if (resultLocationList.size() > 0) { + //判断是否是双深位相关 + BaseLocationVo assginLocation = assginLocation(resultLocationList, batch, vehicheModel, businDataTaskGoodsVos); + if (assginLocation != null) { + locationVo = assginLocation; + log.info("最终分配的货位信息:" + assginLocation); + } + } + } + + if (locationVo != null) { + //确定分配该库位,并将库位状态改为已分配 + this.changeLocationStatus(locationVo.getId(), "4"); + locationVo.setLocationStatus("4"); + return Result.ok().data(locationVo); + } else { + // TODO 是否需要逻辑处理,如果在选取的巷道中货位为空时!! + return Result.err(); + } + } + + /** * 保险杠分配货位检查是否是双深位 * @param locationList 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 f3f9b98..bd97344 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 @@ -564,6 +564,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl taskGoodsList = new ArrayList<>(); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/IBusinEnptyContainerServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/IBusinEnptyContainerServiceImpl.java index 7beb609..939e7e3 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/IBusinEnptyContainerServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/IBusinEnptyContainerServiceImpl.java @@ -358,7 +358,10 @@ public class IBusinEnptyContainerServiceImpl extends ServiceImpl baseLocationVoList = baseLocationMapper.getEmptyContainerFromLocation(emptyconArea); List tunnelList = baseLocationVoList.stream().map(e -> e.getTunnel()).distinct().collect(Collectors.toList()); - + if (tunnelList.size() == 0){ + log.error("无空托可以出库"); + return; + } //从存在存放空治具货位的巷道里选择较优的巷道进行入库 //首选选择任务数为空或者任务数最少的巷道 //任务数相同时选取存放空治具货位最多的巷道 @@ -483,7 +486,7 @@ public class IBusinEnptyContainerServiceImpl extends ServiceImpl() .eq(SysStockDetail::getLocationId, baseLocationVo.getId()) .eq(SysStockDetail::getQty, "1") - .isNull(SysStockDetail::getOutQty)); + .isNull(SysStockDetail::getOutQty).last("limit 1")); Long containerId=null; if (ObjectUtils.isNotEmpty(sysStockDetail)) { containerId = sysStockDetail.getContainerCode(); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java index 224dd4a..9ae6f63 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java @@ -1068,6 +1068,7 @@ public class PutInOutStorageServiceImpl extends ServiceImpl productDeposit(Long taskId) { + log.info("增加库存任务号:"+taskId); BusinBillHeadBodyQueryBo bodyQueryBo =new BusinBillHeadBodyQueryBo(); bodyQueryBo.setTaskId(taskId); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/StackServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/StackServiceImpl.java index af98d72..133576d 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/StackServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/StackServiceImpl.java @@ -349,7 +349,7 @@ public class StackServiceImpl implements IStackService { } businDataTask.setTaskPath(toLocation); - iBusinDataTaskService.insertBusinDataTask(businDataTask); + iBusinDataTaskService.save(businDataTask); Long taskId =businDataTask.getId(); List goodsList = new ArrayList<>(); diff --git a/shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java b/shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java index bc65207..ceefb11 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java +++ b/shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java @@ -1496,26 +1496,28 @@ public class RCSUtil { if (StringUtils.isNotEmpty(agvData)) { RcsThirdResult thirdResult = JSONObject.parseObject(agvData, RcsThirdResult.class); List redisList = new ArrayList<>(); - List list = JSONArray.parseArray(thirdResult.getData().toString(), BusinAgvRealInfo.class); - BusinAgvRealRedisInfo businAgvRealRedisInfo = null; - for (BusinAgvRealInfo businAgvRealInfo : list) { - businAgvRealRedisInfo = new BusinAgvRealRedisInfo(); - String agvState = businAgvRealInfo.getAgvState(); - String online = businAgvRealInfo.getOnline(); - int agvId = businAgvRealInfo.getId(); - businAgvRealRedisInfo.setId(agvId); - businAgvRealRedisInfo.setTaskId(businAgvRealInfo.getTaskId()); - - //如果在线状态是离线,则为离线,其他为AGV状态信息 - if (online.equals("false")) { - businAgvRealRedisInfo.setAgvState(online); - } else { - businAgvRealRedisInfo.setAgvState(agvState); + + if (JsonUtil.toJSONString(thirdResult.getData()).equals("{}")){ + List list = JSONArray.parseArray(thirdResult.getData().toString(), BusinAgvRealInfo.class); + BusinAgvRealRedisInfo businAgvRealRedisInfo = null; + for (BusinAgvRealInfo businAgvRealInfo : list) { + businAgvRealRedisInfo = new BusinAgvRealRedisInfo(); + String agvState = businAgvRealInfo.getAgvState(); + String online = businAgvRealInfo.getOnline(); + int agvId = businAgvRealInfo.getId(); + businAgvRealRedisInfo.setId(agvId); + businAgvRealRedisInfo.setTaskId(businAgvRealInfo.getTaskId()); + + //如果在线状态是离线,则为离线,其他为AGV状态信息 + if (online.equals("false")) { + businAgvRealRedisInfo.setAgvState(online); + } else { + businAgvRealRedisInfo.setAgvState(agvState); + } + businAgvRealRedisInfo.setErrors(businAgvRealInfo.getErrors()); + redisList.add(businAgvRealRedisInfo); } - businAgvRealRedisInfo.setErrors(businAgvRealInfo.getErrors()); - redisList.add(businAgvRealRedisInfo); } - redisTemplate.opsForValue().set(RedisConstant.redisAgvRealInfo, redisList); } else { log.info("AGV实时数据为空"); diff --git a/shkj-wms/src/main/resources/mapper/wms/BaseLocationMapper.xml b/shkj-wms/src/main/resources/mapper/wms/BaseLocationMapper.xml index f42170e..5184e69 100644 --- a/shkj-wms/src/main/resources/mapper/wms/BaseLocationMapper.xml +++ b/shkj-wms/src/main/resources/mapper/wms/BaseLocationMapper.xml @@ -535,6 +535,37 @@ ORDER BY bl.route asc,is_deep desc + + + +