From 8a5de4d84a614cc29e946553f2f4e1b33924bc3a Mon Sep 17 00:00:00 2001 From: judy <278197488@qq.com> Date: Sat, 13 Jul 2024 12:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E8=B4=A7=E9=87=8A=E6=94=BE=E7=A0=81?= =?UTF-8?q?=E5=A4=B4=E6=94=B9=E4=B8=BAagv=E4=B8=8A=E6=8A=A5=E6=97=B6?= =?UTF-8?q?=E5=8F=96=E6=B6=88=20=E4=BB=BB=E5=8A=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E4=BB=8E=E6=80=BB=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=94=B9=E4=B8=BA=E5=8D=95=E4=B8=AA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkj/wms/scheduled/ScheduledTasks.java | 1897 +++++++++-------- .../service/impl/BusinPickupServiceImpl.java | 2 +- .../impl/IBusinEnptyContainerServiceImpl.java | 11 +- .../java/com/shkj/wms/third/rcs/RCSUtil.java | 3 +- 4 files changed, 956 insertions(+), 957 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 268043f..a4c0a38 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 @@ -109,7 +109,7 @@ public class ScheduledTasks { BasePointDeviceMapper basePointDeviceMapper; @Autowired - private IBaseStorageService iBaseStorageService; + private IBaseStorageService iBaseStorageService; @Resource SysStockDetailMapper sysStockDetailMapper; @@ -131,7 +131,7 @@ public class ScheduledTasks { @Resource IBaseBarcodesInService iBaseBarcodesInService; @Resource - IBaseBarcodesOutService iBaseBarcodesOutService ; + IBaseBarcodesOutService iBaseBarcodesOutService; @Resource BusinDataTaskMapper businDataTaskMapper; @@ -152,7 +152,7 @@ public class ScheduledTasks { } //呼叫AGC - public Result callAGV(Long taskId,int taskType, List points){ + public Result callAGV(Long taskId, int taskType, List points) { AGVMoveBo moveBo = new AGVMoveBo(); @@ -162,7 +162,8 @@ public class ScheduledTasks { Result booleanResult = rcsUtil.moveByAGV(moveBo); return booleanResult; } - public Result callAGV(Long taskId,int taskType, List points,String agvno){ + + public Result callAGV(Long taskId, int taskType, List points, String agvno) { AGVMoveBo moveBo = new AGVMoveBo(); @@ -174,10 +175,9 @@ public class ScheduledTasks { return booleanResult; } -// @PostConstruct + // @PostConstruct // @Scheduled(cron = "0/3 * * * * ? ") @Scheduled(fixedRate = 200) - @Transactional(rollbackFor = Exception.class) public void task() { log.info("开始获取需要执行的任务"); //获取待下发任务数据 @@ -229,28 +229,35 @@ public class ScheduledTasks { taskQueryBo.setTaskType("21"); List businDataTaskVo21 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); businDataTaskVos.addAll(businDataTaskVo21); - for (BusinDataTaskVo businDataTaskVo : businDataTaskVos) { - String taskType = businDataTaskVo.getTaskType(); - Long taskId = businDataTaskVo.getId(); - Long containerId = businDataTaskVo.getContainerId(); - - BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); - - //任务类型 0 正常入库 1维修异常 2扫码异常 3入库冲孔 4 正常出库 5紧急出库 6越库出库 7手工入库 8呼叫空治具 - if (taskType.equals("0") || taskType.equals("7")) { - //获取要出入库的条码信息 - List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); - if(ObjectUtils.isEmpty(businDataTaskGoodsVos)){ - continue; - } - BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0); - String vehicheModel = goodsVo.getVehicheModel(); - String color = goodsVo.getColor(); - String startPoint = businDataTaskVo.getTaskPath(); - String goodsNo = goodsVo.getGoodsNo(); + doTask(businDataTaskVo); + } + } + + + @Transactional(rollbackFor = Exception.class) + void doTask(BusinDataTaskVo businDataTaskVo) { + + String taskType = businDataTaskVo.getTaskType(); + Long taskId = businDataTaskVo.getId(); + Long containerId = businDataTaskVo.getContainerId(); + + BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); - //是否有紧急出库,如果有紧急出库则优先紧急出库 + //任务类型 0 正常入库 1维修异常 2扫码异常 3入库冲孔 4 正常出库 5紧急出库 6越库出库 7手工入库 8呼叫空治具 + if (taskType.equals("0") || taskType.equals("7")) { + //获取要出入库的条码信息 + List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); +// if (ObjectUtils.isEmpty(businDataTaskGoodsVos)) { +// continue; +// } + BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0); + String vehicheModel = goodsVo.getVehicheModel(); + String color = goodsVo.getColor(); + String startPoint = businDataTaskVo.getTaskPath(); + String goodsNo = goodsVo.getGoodsNo(); + + //是否有紧急出库,如果有紧急出库则优先紧急出库 // BusinDataTaskOutVo businDataTaskOutVo = checkOutTaskData(goodsVo.getGoodsNo()); // if (businDataTaskOutVo !=null){ // String outTaskType = businDataTaskOutVo.getTaskType(); @@ -269,7 +276,7 @@ public class ScheduledTasks { // } // // } - //查询获取每个货区的比例 + //查询获取每个货区的比例 // BaseStorageQueryListBo baseStorageQueryListBo = new BaseStorageQueryListBo(); // // Map dataScopeBranchmap = new HashMap(); @@ -319,127 +326,111 @@ public class ScheduledTasks { // String randome = allocationTasksUtils.randome(); - BasePointDeviceVo pointDevice= new BasePointDeviceVo(); - BasePointDeviceVo basePointDeviceVo = new BasePointDeviceVo(); - //立库输送线接驳点-入 - String toLocation = ""; - int agvTaskType=0; - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - Long plcId = null; - Long stkPlcId=null; + BasePointDeviceVo pointDevice = new BasePointDeviceVo(); + BasePointDeviceVo basePointDeviceVo = new BasePointDeviceVo(); + //立库输送线接驳点-入 + String toLocation = ""; + int agvTaskType = 0; + BusinTaskExeBo exeBo = new BusinTaskExeBo(); + Long plcId = null; + Long stkPlcId = null; - String agvno=null; - //获取派生 - // TODO 由于逻辑区域换成与车型相匹配,不是与派生匹配,所以注释掉 + String agvno = null; + //获取派生 + // TODO 由于逻辑区域换成与车型相匹配,不是与派生匹配,所以注释掉 // Long dervieId = getLocationByDervie(vehicheModel, color); - String randome = "P01"; - if (businDataTaskVo.getWarehouseType().equals("1")) { - randome = "P01"; - } else if (businDataTaskVo.getWarehouseType().equals("2")) { - randome = "P02"; + String randome = "P01"; + if (businDataTaskVo.getWarehouseType().equals("1")) { + randome = "P01"; + } else if (businDataTaskVo.getWarehouseType().equals("2")) { + randome = "P02"; + } + //从Redis中获取randome,如果没有设置为P01 + //randome = ObjectUtils.isEmpty(redisTemplate.opsForValue().get("randome").toString()) ? "P01" : redisTemplate.opsForValue().get("randome").toString(); + //randome = "P02"; + if ("P01".equals(randome)) { + //根据车型分配库位 先判断该任务是否已经分配了货位 + Result locationVoResult = null; + if (ObjectUtils.isEmpty(businDataTaskVo.getToRow())) { + // locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos); + // TODO: 2024/6/28 zjx + locationVoResult = iBaseLocationService.assignEmptyLocationByStock(goodsNo, vehicheModel, DateUtils.getDate(), businDataTaskGoodsVos); + } - //从Redis中获取randome,如果没有设置为P01 - //randome = ObjectUtils.isEmpty(redisTemplate.opsForValue().get("randome").toString()) ? "P01" : redisTemplate.opsForValue().get("randome").toString(); - //randome = "P02"; - if ("P01".equals(randome)) { - //根据车型分配库位 先判断该任务是否已经分配了货位 - Result locationVoResult = null; - if(ObjectUtils.isEmpty(businDataTaskVo.getToRow())){ - // locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos); - // TODO: 2024/6/28 zjx - locationVoResult = iBaseLocationService.assignEmptyLocationByStock( goodsNo, vehicheModel,DateUtils.getDate(),businDataTaskGoodsVos); + if (ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode() == HttpStatus.SUCCESS.getCode()) { + //如果是P01则设置randome为P02 + redisTemplate.opsForValue().set("randome", "P02"); + BaseLocationVo locationVo = locationVoResult.getData(); + String tunnel = locationVo.getTunnel(); + Long locationId = locationVo.getId(); + for (BusinDataTaskGoodsVo businDataTaskGoodsVo : businDataTaskGoodsVos) { + businDataTaskGoodsVo.setLocationId(locationId); + } + //回填任务的入行高列 + businDataTaskVo.setBatch(DateUtils.getDate()); + businDataTaskVo.setToColumn(locationVo.getLocationColumn()); + businDataTaskVo.setToLayer(locationVo.getLayer()); + businDataTaskVo.setToRow(locationVo.getLocationRow()); + businDataTaskVo.setTunnel(tunnel); + //获取货位对应的巷道及巷道对应的设备信息 + pointQueryBo.setTunnel(tunnel); + pointQueryBo.setDirection("0"); + basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(0); + + if (basePointDeviceVo != null) { + toLocation = basePointDeviceVo.getPointNo(); + //输送线PLCID + plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); } - if(ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode()==HttpStatus.SUCCESS.getCode()){ - //如果是P01则设置randome为P02 - redisTemplate.opsForValue().set("randome","P02"); - BaseLocationVo locationVo = locationVoResult.getData(); - String tunnel = locationVo.getTunnel(); - Long locationId = locationVo.getId(); - for (BusinDataTaskGoodsVo businDataTaskGoodsVo : businDataTaskGoodsVos) { - businDataTaskGoodsVo.setLocationId(locationId); - } - //回填任务的入行高列 - businDataTaskVo.setBatch(DateUtils.getDate()); - businDataTaskVo.setToColumn(locationVo.getLocationColumn()); - businDataTaskVo.setToLayer(locationVo.getLayer()); - businDataTaskVo.setToRow(locationVo.getLocationRow()); - businDataTaskVo.setTunnel(tunnel); - //获取货位对应的巷道及巷道对应的设备信息 - pointQueryBo.setTunnel(tunnel); - pointQueryBo.setDirection("0"); - basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(0); - - if (basePointDeviceVo != null) { - toLocation = basePointDeviceVo.getPointNo(); - //输送线PLCID - plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); - } + //获取巷道对应的堆垛机信息 + pointQueryBo.setDevType("1"); + BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo); + stkPlcId = baseDevicePlcVo.getPlcId(); - //获取巷道对应的堆垛机信息 - pointQueryBo.setDevType("1"); - BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo); - stkPlcId = baseDevicePlcVo.getPlcId(); - - exeBo.setTaskCode(taskId); - exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); - exeBo.setContainerId(containerId); - exeBo.setBaseLocationVo(locationVo); - exeBo.setTransNo("1"); - exeBo.setTransQual("1"); - - //根据取货时的的点位拿到对应的交互点用作取货完成点 - agvTaskType= Integer.valueOf(basePointDeviceVo.getIsDown()); - if (businDataTaskVo.getTaskType().equals("7")){ - if (businDataTaskVo.getTaskPath().contains("manMade")) { - agvTaskType=RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); - List agvtaskType=new ArrayList(); - agvtaskType.add("15"); - agvtaskType.add("12"); - BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper() - .in(BusinDataTask::getTaskType, agvtaskType) - .eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) - .eq(BusinDataTask::getTaskStatus, "2") - .orderByDesc(BusinDataTask::getId) - .last("limit 1")); - if (ObjectUtils.isNotEmpty(manMade01)) { - agvno = manMade01.getAgvNo(); - } - } else if (businDataTaskVo.getTaskPath().contains("Artificial")) { - agvTaskType=RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); - String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); - String[] idArrs = idArr.split("_"); - agvno = idArrs[1]; + exeBo.setTaskCode(taskId); + exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); + exeBo.setContainerId(containerId); + exeBo.setBaseLocationVo(locationVo); + exeBo.setTransNo("1"); + exeBo.setTransQual("1"); + + //根据取货时的的点位拿到对应的交互点用作取货完成点 + agvTaskType = Integer.valueOf(basePointDeviceVo.getIsDown()); + if (businDataTaskVo.getTaskType().equals("7")) { + if (businDataTaskVo.getTaskPath().contains("manMade")) { + agvTaskType = RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); + List agvtaskType = new ArrayList(); + agvtaskType.add("15"); + agvtaskType.add("12"); + BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper() + .in(BusinDataTask::getTaskType, agvtaskType) + .eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) + .eq(BusinDataTask::getTaskStatus, "2") + .orderByDesc(BusinDataTask::getId) + .last("limit 1")); + if (ObjectUtils.isNotEmpty(manMade01)) { + agvno = manMade01.getAgvNo(); } + } else if (businDataTaskVo.getTaskPath().contains("Artificial")) { + agvTaskType = RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); + String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); + String[] idArrs = idArr.split("_"); + agvno = idArrs[1]; } } - if(ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode()==HttpStatus.ERROR.getCode()){ - //如果是P02则设置randome为P01 - redisTemplate.opsForValue().set("randome","P01"); - String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); - pointQueryBo.setGroupNo(tepairGroup); - BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - toLocation=pointDeviceout.getPointNo(); - agvTaskType=Integer.valueOf( pointDeviceout.getIsDown()); - exeBo.setTaskCode(taskId); - exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); - exeBo.setContainerId(containerId); - exeBo.setTransNo("1"); - exeBo.setTransQual("1"); - } - } - if ("P02".equals(randome)){ + if (ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode() == HttpStatus.ERROR.getCode()) { //如果是P02则设置randome为P01 - redisTemplate.opsForValue().set("randome","P01"); + redisTemplate.opsForValue().set("randome", "P01"); String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); pointQueryBo.setGroupNo(tepairGroup); BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - toLocation=pointDeviceout.getPointNo(); - agvTaskType=Integer.valueOf( pointDeviceout.getIsDown()); + toLocation = pointDeviceout.getPointNo(); + agvTaskType = Integer.valueOf(pointDeviceout.getIsDown()); exeBo.setTaskCode(taskId); exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); exeBo.setContainerId(containerId); @@ -447,67 +438,83 @@ public class ScheduledTasks { exeBo.setTransQual("1"); } + } + if ("P02".equals(randome)) { + //如果是P02则设置randome为P01 + redisTemplate.opsForValue().set("randome", "P01"); + String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); + pointQueryBo.setGroupNo(tepairGroup); + BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); + toLocation = pointDeviceout.getPointNo(); + agvTaskType = Integer.valueOf(pointDeviceout.getIsDown()); + exeBo.setTaskCode(taskId); + exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); + exeBo.setContainerId(containerId); + exeBo.setTransNo("1"); + exeBo.setTransQual("1"); + } + - List points = new ArrayList<>(); - points.add(startPoint); + List points = new ArrayList<>(); + points.add(startPoint); - String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); - BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); - pointQueryBoup.setGroupNo(tepairGroup); + String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); + BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); + pointQueryBoup.setGroupNo(tepairGroup); - pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); - if(!businDataTaskVo.getTaskType().equals("7")) { - points.add(pointDevice.getHandshakePoint()); - } + pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); + if (!businDataTaskVo.getTaskType().equals("7")) { + points.add(pointDevice.getHandshakePoint()); + } - points.add(toLocation); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - if(!businDataTaskVo.getTaskType().equals("7")) { - snPointMap.put("2", pointDevice.getHandshakePoint()); - snPointMap.put("3", toLocation); - }else{ - snPointMap.put("2",toLocation); - } + points.add(toLocation); + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + if (!businDataTaskVo.getTaskType().equals("7")) { + snPointMap.put("2", pointDevice.getHandshakePoint()); + snPointMap.put("3", toLocation); + } else { + snPointMap.put("2", toLocation); + } - businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); - businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); - //呼叫AGV - Result booleanResult =new Result<>(); - if(businDataTaskVo.getTaskType().equals("7")){ - booleanResult= rcsUtil.callAGV(taskId, agvTaskType,points,businDataTaskVo.getToRow(),agvno); - }else{ - booleanResult=rcsUtil.callAGV(taskId, agvTaskType,points,businDataTaskVo.getToRow()); - log.error("入库呼叫AGV任务号:"+taskId + " 结果:" + booleanResult.getCode() + "返回信息:" + booleanResult.getMsg()); - } - if (booleanResult.getCode() == HttpStatus.ERROR.getCode()){ - BusinDataTask businDataTask = new BusinDataTask(); - businDataTask.setId(businDataTaskVo.getId()); - businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - iBusinDataTaskService.updateById(businDataTask); - return; - } + businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); + businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); + //呼叫AGV + Result booleanResult = new Result<>(); + if (businDataTaskVo.getTaskType().equals("7")) { + booleanResult = rcsUtil.callAGV(taskId, agvTaskType, points, businDataTaskVo.getToRow(), agvno); + } else { + booleanResult = rcsUtil.callAGV(taskId, agvTaskType, points, businDataTaskVo.getToRow()); + log.error("入库呼叫AGV任务号:" + taskId + " 结果:" + booleanResult.getCode() + "返回信息:" + booleanResult.getMsg()); + } + if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { + BusinDataTask businDataTask = new BusinDataTask(); + businDataTask.setId(businDataTaskVo.getId()); + businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + iBusinDataTaskService.updateById(businDataTask); + return; + } - //呼叫AGV成功 - if (booleanResult.getCode()== HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskPath(toLocation); - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + //呼叫AGV成功 + if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskPath(toLocation); + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - //生成入库单 - if (randome.equals("P01")){ - Result stringResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); + //生成入库单 + if (randome.equals("P01")) { + Result stringResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); - //生成入库单成功 - if (stringResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTransId(stringResult.getData()); - } else { - businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); - businDataTaskVo.setExceptionMsg("生成入库单失败"); - } + //生成入库单成功 + if (stringResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTransId(stringResult.getData()); + } else { + businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); + businDataTaskVo.setExceptionMsg("生成入库单失败"); } - } + + } // else { // if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){ // redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,0); @@ -523,44 +530,43 @@ public class ScheduledTasks { // businDataTaskVo.setTaskStatus("-2"); // } // } - //立库输送线PLCID - businDataTaskVo.setDpsNoOne(plcId); - //巷道堆垛机PLCID - businDataTaskVo.setDpsNoTwo(stkPlcId); - iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); + //立库输送线PLCID + businDataTaskVo.setDpsNoOne(plcId); + //巷道堆垛机PLCID + businDataTaskVo.setDpsNoTwo(stkPlcId); + iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); - } - else if (taskType.equals("2")) { - Long plcId=0L; - Long stkPlcId=0L; - Boolean NUMBER=true; - //维修异常 呼叫AGV - //获取起始点位 - String startPoint = businDataTaskVo.getTaskPath(); - //查询维修地点是否有空闲 - String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group); + } else if (taskType.equals("2")) { + Long plcId = 0L; + Long stkPlcId = 0L; + Boolean NUMBER = true; + //维修异常 呼叫AGV + //获取起始点位 + String startPoint = businDataTaskVo.getTaskPath(); + //查询维修地点是否有空闲 + String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group); // String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); - pointQueryBo.setGroupNo(tepairGroup); - BasePointDeviceVo basePointDeviceVo = null; - List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); - List points = new ArrayList<>(); - points.add(startPoint); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - //获取机械手上报点 - String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); - BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); - pointQueryBoup.setGroupNo(tepairGroupin); - BasePointDeviceVo pointDevice= new BasePointDeviceVo(); - pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); - points.add(pointDevice.getHandshakePoint()); - snPointMap.put("2",pointDevice.getHandshakePoint()); - BaseLocationVo locationVo = null; - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - // TODO 中科 测试 需要还原 已还原 - System.out.println(" 测试 需要还原 已还原"); - //无空闲区 分配异常区库位 + pointQueryBo.setGroupNo(tepairGroup); + BasePointDeviceVo basePointDeviceVo = null; + List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); + List points = new ArrayList<>(); + points.add(startPoint); + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + //获取机械手上报点 + String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); + BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); + pointQueryBoup.setGroupNo(tepairGroupin); + BasePointDeviceVo pointDevice = new BasePointDeviceVo(); + pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); + points.add(pointDevice.getHandshakePoint()); + snPointMap.put("2", pointDevice.getHandshakePoint()); + BaseLocationVo locationVo = null; + BusinTaskExeBo exeBo = new BusinTaskExeBo(); + // TODO 中科 测试 需要还原 已还原 + System.out.println(" 测试 需要还原 已还原"); + //无空闲区 分配异常区库位 // if (basePointDeviceVos.size() ==0) { // NUMBER=false; // @@ -604,63 +610,64 @@ public class ScheduledTasks { //// exeBo.setTransQual("1"); // } // }else { - basePointDeviceVo = basePointDeviceVos.get(0); + basePointDeviceVo = basePointDeviceVos.get(0); // } - //plcId =basePointDeviceVo.getPlcId(); + //plcId =basePointDeviceVo.getPlcId(); // String toPointNo = basePointDeviceVo.getPointNo(); // snPointMap.put("3",toPointNo); // points.add(toPointNo); // int agvTaskType = Integer.valueOf(basePointDeviceVo.getIsDown()); - System.out.println("中科 测试 需要删除"); - // TODO 中科 测试 需要删除 - String toPointNo = basePointDeviceVo.getPointNo();; - int agvTaskType = 33; - snPointMap.put("3","XX"); - points.add("XX"); - snPointMap.put("4","XX"); - points.add("XX"); - snPointMap.put("5",toPointNo); - points.add(toPointNo); - // TODO 中科 测试 需要删除 - businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); - businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); - Result booleanResult=new Result<>(); - //呼叫AGV - if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())){ - booleanResult = callAGV(taskId, agvTaskType, points,businDataTaskVo.getAgvNo()); - }else{ - booleanResult = callAGV(taskId, agvTaskType, points); - } - if (booleanResult.getCode() == HttpStatus.ERROR.getCode()){ - BusinDataTask businDataTask = new BusinDataTask(); - businDataTask.setId(businDataTaskVo.getId()); - businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - businDataTask.setTaskPath(toPointNo); - iBusinDataTaskService.updateById(businDataTask); - return; - } - //呼叫AGV成功 - if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - businDataTaskVo.setTaskPath(toPointNo); - // TODO 中科 测试 需要还原 - System.out.println("中科 测试 需要还原"); + System.out.println("中科 测试 需要删除"); + // TODO 中科 测试 需要删除 + String toPointNo = basePointDeviceVo.getPointNo(); + ; + int agvTaskType = 33; + snPointMap.put("3", "XX"); + points.add("XX"); + snPointMap.put("4", "XX"); + points.add("XX"); + snPointMap.put("5", toPointNo); + points.add(toPointNo); + // TODO 中科 测试 需要删除 + businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); + businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); + Result booleanResult = new Result<>(); + //呼叫AGV + if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) { + booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo()); + } else { + booleanResult = callAGV(taskId, agvTaskType, points); + } + if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { + BusinDataTask businDataTask = new BusinDataTask(); + businDataTask.setId(businDataTaskVo.getId()); + businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + businDataTask.setTaskPath(toPointNo); + iBusinDataTaskService.updateById(businDataTask); + return; + } + //呼叫AGV成功 + if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + businDataTaskVo.setTaskPath(toPointNo); + // TODO 中科 测试 需要还原 + System.out.println("中科 测试 需要还原"); // //把占用的点位改为已占用 - if (NUMBER) { - BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId()); - basePoint.setIsOccupy("1"); - iBasePointService.updateById(basePoint); - } + if (NUMBER) { + BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId()); + basePoint.setIsOccupy("1"); + iBasePointService.updateById(basePoint); + } // //更改货位状态为4已分配 // if (ObjectUtils.isNotEmpty(locationVo)){ // BaseLocation baseLocation = iBaseLocationService.getById(locationVo.getId()); // baseLocation.setLocationStatus("4"); // iBaseLocationService.updateById(baseLocation); // } - // TODO 中科 测试 需要还原 - // TODO 中科 测试 需要还原 - } + // TODO 中科 测试 需要还原 + // TODO 中科 测试 需要还原 + } // else{ // if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){ // redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,0); @@ -675,52 +682,51 @@ public class ScheduledTasks { // businDataTaskVo.setTaskStatus("-2"); // } // } - // TODO 测试注释 要打开 + // TODO 测试注释 要打开 // //更新入库条码表状态为异常 - List barcodesIns = new ArrayList<>(); - List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); - for (BusinDataTaskGoodsVo goodsVo : goodsVos) { - BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper() - .eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) - ); - baseBarcodesIn.setInStatus("4"); - baseBarcodesIn.setInDate(DateUtils.getDate()); - barcodesIns.add(baseBarcodesIn); - } - iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); - - businDataTaskVo.setDpsNoOne(plcId); - businDataTaskVo.setDpsNoTwo(stkPlcId); + List barcodesIns = new ArrayList<>(); + List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); + for (BusinDataTaskGoodsVo goodsVo : goodsVos) { + BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper() + .eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) + ); + baseBarcodesIn.setInStatus("4"); + baseBarcodesIn.setInDate(DateUtils.getDate()); + barcodesIns.add(baseBarcodesIn); } - else if (taskType.equals("1") ) { - Long plcId=0L; - Long stkPlcId=0L; - Boolean NUMBER=true; - //维修异常 呼叫AGV - //获取起始点位 - String startPoint = businDataTaskVo.getTaskPath(); - //查询维修地点是否有空闲 - String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.tepair_group); - String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); + iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); + + businDataTaskVo.setDpsNoOne(plcId); + businDataTaskVo.setDpsNoTwo(stkPlcId); + } else if (taskType.equals("1")) { + Long plcId = 0L; + Long stkPlcId = 0L; + Boolean NUMBER = true; + //维修异常 呼叫AGV + //获取起始点位 + String startPoint = businDataTaskVo.getTaskPath(); + //查询维修地点是否有空闲 + String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.tepair_group); + String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); - pointQueryBo.setGroupNo(tepairGroup); - BasePointDeviceVo basePointDeviceVo = null; - List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); - List points = new ArrayList<>(); - points.add(startPoint); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - //获取机械手上报点 - String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); - BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); - pointQueryBoup.setGroupNo(tepairGroupin); - BasePointDeviceVo pointDevice= new BasePointDeviceVo(); - pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); - points.add(pointDevice.getHandshakePoint()); - snPointMap.put("2",pointDevice.getHandshakePoint()); - BaseLocationVo locationVo = null; - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - // TODO 中科 测试 需要还原 已还原 + pointQueryBo.setGroupNo(tepairGroup); + BasePointDeviceVo basePointDeviceVo = null; + List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); + List points = new ArrayList<>(); + points.add(startPoint); + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + //获取机械手上报点 + String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); + BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); + pointQueryBoup.setGroupNo(tepairGroupin); + BasePointDeviceVo pointDevice = new BasePointDeviceVo(); + pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); + points.add(pointDevice.getHandshakePoint()); + snPointMap.put("2", pointDevice.getHandshakePoint()); + BaseLocationVo locationVo = null; + BusinTaskExeBo exeBo = new BusinTaskExeBo(); + // TODO 中科 测试 需要还原 已还原 // System.out.println("中科 测试 需要还原 已还原"); // //无空闲区 分配异常区库位 // if (basePointDeviceVos.size() ==0) { @@ -788,37 +794,37 @@ public class ScheduledTasks { // }else{ // snPointMap.put("3",toPointNo); // } + // TODO 中科 测试 需要还原 + System.out.println("中科 测试 需要删除"); + // TODO 中科 测试 需要删除 + String toPointNo = "KW18"; + int agvTaskType = 24; + snPointMap.put("3", toPointNo); + points.add(toPointNo); + // TODO 中科 测试 需要删除 + + businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); + businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); + Result booleanResult = new Result<>(); + //呼叫AGV + if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) { + booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo()); + } else { + booleanResult = callAGV(taskId, agvTaskType, points); + } + if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { + BusinDataTask businDataTask = new BusinDataTask(); + businDataTask.setId(businDataTaskVo.getId()); + businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + businDataTask.setTaskPath(toPointNo); + iBusinDataTaskService.updateById(businDataTask); + return; + } + //呼叫AGV成功 + if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + businDataTaskVo.setTaskPath(toPointNo); // TODO 中科 测试 需要还原 - System.out.println("中科 测试 需要删除"); - // TODO 中科 测试 需要删除 - String toPointNo = "KW18"; - int agvTaskType = 24; - snPointMap.put("3",toPointNo); - points.add(toPointNo); - // TODO 中科 测试 需要删除 - - businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); - businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); - Result booleanResult=new Result<>(); - //呼叫AGV - if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())){ - booleanResult = callAGV(taskId, agvTaskType, points,businDataTaskVo.getAgvNo()); - }else{ - booleanResult = callAGV(taskId, agvTaskType, points); - } - if (booleanResult.getCode() == HttpStatus.ERROR.getCode()){ - BusinDataTask businDataTask = new BusinDataTask(); - businDataTask.setId(businDataTaskVo.getId()); - businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - businDataTask.setTaskPath(toPointNo); - iBusinDataTaskService.updateById(businDataTask); - return; - } - //呼叫AGV成功 - if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - businDataTaskVo.setTaskPath(toPointNo); - // TODO 中科 测试 需要还原 // System.out.println("中科 测试 需要还原"); //// 把占用的点位改为已占用 // if (NUMBER) { @@ -844,7 +850,7 @@ public class ScheduledTasks { // } // } // TODO 中科 测试 需要还原 - } + } // else{ // if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){ // redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,0); @@ -859,159 +865,158 @@ public class ScheduledTasks { // businDataTaskVo.setTaskStatus("-2"); // } // } - // TODO 测试注释 要打开 + // TODO 测试注释 要打开 // //更新入库条码表状态为异常 - List barcodesIns = new ArrayList<>(); - List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); - for (BusinDataTaskGoodsVo goodsVo : goodsVos) { - BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper() - .eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) - ); - baseBarcodesIn.setInStatus("4"); - baseBarcodesIn.setInDate(DateUtils.getDate()); - barcodesIns.add(baseBarcodesIn); - } - iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); - - businDataTaskVo.setDpsNoOne(plcId); - businDataTaskVo.setDpsNoTwo(stkPlcId); + List barcodesIns = new ArrayList<>(); + List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); + for (BusinDataTaskGoodsVo goodsVo : goodsVos) { + BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper() + .eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) + ); + baseBarcodesIn.setInStatus("4"); + baseBarcodesIn.setInDate(DateUtils.getDate()); + barcodesIns.add(baseBarcodesIn); } - else if (taskType.equals("3")) { - Long plcId = 0L; - Long stkPlcId=0L; - Boolean NUMBER=true; - //需要冲孔,呼叫AGV - //获取起始点位 - String startPoint = businDataTaskVo.getTaskPath(); - String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); - //冲孔模式是自动,并且是启用的,并且待冲孔任务小于最大冲孔任务量,,则可以到冲孔,否在到入库 - BasePunchRecordVo basePunchRecordVos = iBasePunchService.selectBasePunchRecord(new BasePunch()); - BasePointDeviceVo basePointDeviceVo = null; - List points = new ArrayList<>(); - points.add(startPoint); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - //获取机械手上报点 - String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); - BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); - pointQueryBoup.setGroupNo(tepairGroupin); - BasePointDeviceVo pointDevice= new BasePointDeviceVo(); - pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); - points.add(pointDevice.getHandshakePoint()); - snPointMap.put("2",pointDevice.getHandshakePoint()); - BaseLocationVo locationVo = null; + iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); + + businDataTaskVo.setDpsNoOne(plcId); + businDataTaskVo.setDpsNoTwo(stkPlcId); + } else if (taskType.equals("3")) { + Long plcId = 0L; + Long stkPlcId = 0L; + Boolean NUMBER = true; + //需要冲孔,呼叫AGV + //获取起始点位 + String startPoint = businDataTaskVo.getTaskPath(); + String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); + //冲孔模式是自动,并且是启用的,并且待冲孔任务小于最大冲孔任务量,,则可以到冲孔,否在到入库 + BasePunchRecordVo basePunchRecordVos = iBasePunchService.selectBasePunchRecord(new BasePunch()); + BasePointDeviceVo basePointDeviceVo = null; + List points = new ArrayList<>(); + points.add(startPoint); + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + //获取机械手上报点 + String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); + BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); + pointQueryBoup.setGroupNo(tepairGroupin); + BasePointDeviceVo pointDevice = new BasePointDeviceVo(); + pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); + points.add(pointDevice.getHandshakePoint()); + snPointMap.put("2", pointDevice.getHandshakePoint()); + BaseLocationVo locationVo = null; - if (businDataTaskVo.getWarehouseType().equals("2")) { - NUMBER = false; - String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); - pointQueryBo.setGroupNo(tepairGroup1); - BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - basePointDeviceVo = pointDeviceout; + if (businDataTaskVo.getWarehouseType().equals("2")) { + NUMBER = false; + String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); + pointQueryBo.setGroupNo(tepairGroup1); + BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); + basePointDeviceVo = pointDeviceout; + } else { + if (basePunchRecordVos != null) { + Long punchId = basePunchRecordVos.getId(); + //获取冲孔机设备对用的点位 + String punchingGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_group); + pointQueryBo.setGroupNo(punchingGroup); + pointQueryBo.setDevCode(punchId); + + List tempList = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); + basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(0); + if (tempList.get(0).getPointNo().contains("KW11")) { + basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(1); + } } else { - if (basePunchRecordVos != null) { - Long punchId = basePunchRecordVos.getId(); - //获取冲孔机设备对用的点位 - String punchingGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_group); - pointQueryBo.setGroupNo(punchingGroup); - pointQueryBo.setDevCode(punchId); - - List tempList = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); - basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(0); - if (tempList.get(0).getPointNo().contains("KW11")) { - basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(1); - } - } else { - NUMBER = false; - //先入待冲孔区 - Long punchingArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); + 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); - } - businDataTaskVo.setToColumn(locationVo.getLocationColumn()); - businDataTaskVo.setToLayer(locationVo.getLayer()); - businDataTaskVo.setToRow(locationVo.getLocationRow()); - //获取货位及巷道; - String tunnel = locationVo.getTunnel(); - businDataTaskVo.setTunnel(tunnel); + List baseLocationVos = baseLocationMapper.getLocationByAreaId(punchingArea); + if (baseLocationVos.size() > 0) { + locationVo = baseLocationVos.get(0); + } + businDataTaskVo.setToColumn(locationVo.getLocationColumn()); + businDataTaskVo.setToLayer(locationVo.getLayer()); + businDataTaskVo.setToRow(locationVo.getLocationRow()); + //获取货位及巷道; + String tunnel = locationVo.getTunnel(); + businDataTaskVo.setTunnel(tunnel); // 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"); - List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); - if (basePointDeviceVos.size() > 0) { - basePointDeviceVo = basePointDeviceVos.get(0); - basePointDeviceVo.setPlcId(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id))); - } + 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"); + List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); + if (basePointDeviceVos.size() > 0) { + 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(); + //获取巷道对应的堆垛机信息 + 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=""; - toPointNo = basePointDeviceVo.getPointNo(); - if (basePointDeviceVo != null){ - plcId=basePointDeviceVo.getPlcId(); } + } + String toPointNo = ""; + toPointNo = basePointDeviceVo.getPointNo(); + if (basePointDeviceVo != null) { + plcId = basePointDeviceVo.getPlcId(); + } - points.add(toPointNo); - snPointMap.put("3",toPointNo); + 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; + int agvTaskType; + if (toPointNo.equals("KW12")) { + agvTaskType = 24; + } else { + agvTaskType = 27; + } + // TODO 中科 测试 需要删除 + businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); + businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); + //呼叫AGV + Result callAGVResult = callAGV(taskId, agvTaskType, points); + //下发任务成功 + if (callAGVResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskPath(toPointNo); + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + log.info("任务" + businDataTaskVo.getId() + "修改目的地成功"); + if (toPointNo.equals("KW12")) { + //记录冲孔机排队数量 + Long punchId = basePunchRecordVos.getId(); + BasePunchRecordAddBo recordAddBo = new BasePunchRecordAddBo(); + recordAddBo.setTaskCode(taskId); + recordAddBo.setPunchNo(punchId); + recordAddBo.setAgvNo(businDataTaskVo.getAgvNo()); + recordAddBo.setIsState("0"); + iBasePunchRecordService.insertBasePunchRecord(BeanUtil.toBean(recordAddBo, BasePunchRecord.class)); } - // TODO 中科 测试 需要删除 - businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); - businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); - //呼叫AGV - Result callAGVResult = callAGV(taskId, agvTaskType, points); - //下发任务成功 - if (callAGVResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskPath(toPointNo); - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - log.info("任务"+businDataTaskVo.getId()+"修改目的地成功"); - if (toPointNo.equals("KW12")){ - //记录冲孔机排队数量 - Long punchId = basePunchRecordVos.getId(); - BasePunchRecordAddBo recordAddBo = new BasePunchRecordAddBo(); - recordAddBo.setTaskCode(taskId); - recordAddBo.setPunchNo(punchId); - recordAddBo.setAgvNo(businDataTaskVo.getAgvNo()); - recordAddBo.setIsState("0"); - iBasePunchRecordService.insertBasePunchRecord(BeanUtil.toBean(recordAddBo, BasePunchRecord.class)); - } - //更改货位状态为4已分配 - if (ObjectUtils.isNotEmpty(locationVo)){ - BaseLocation baseLocation = iBaseLocationService.getById(locationVo.getId()); - baseLocation.setLocationStatus("4"); - iBaseLocationService.updateById(baseLocation); - } + //更改货位状态为4已分配 + if (ObjectUtils.isNotEmpty(locationVo)) { + BaseLocation baseLocation = iBaseLocationService.getById(locationVo.getId()); + baseLocation.setLocationStatus("4"); + iBaseLocationService.updateById(baseLocation); } + } // else{ // //呼叫agv失败超过三次将状态改为-2(临时) // if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){ @@ -1026,118 +1031,117 @@ public class ScheduledTasks { // } // businDataTaskVo.setExceptionMsg(callAGVResult.getMsg()); // } - businDataTaskVo.setDpsNoOne(plcId); - businDataTaskVo.setDpsNoTwo(stkPlcId); - } - else if (taskType.equals("4") || taskType.equals("5")) { - String randome=null; - //出库任务(正常出库、紧急出库) - //获取要出库的物料信息 - List businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); - - //拿到按比例分配的库区 + businDataTaskVo.setDpsNoOne(plcId); + businDataTaskVo.setDpsNoTwo(stkPlcId); + } else if (taskType.equals("4") || taskType.equals("5")) { + String randome = null; + //出库任务(正常出库、紧急出库) + //获取要出库的物料信息 + List businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); + + //拿到按比例分配的库区 // randome = allocationTasksUtils.randomeout(); - //测试时使用 - randome="P01"; - //TODO 测试注释 要到开 + //测试时使用 + 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()); - //根据GoodsNo查看立库是否有库存 - List list = iSysStockDetailService.list(new LambdaQueryWrapper() - .in(SysStockDetail::getGoodsNo, goodsno) - .eq(SysStockDetail::getQty, "1") - .isNull(SysStockDetail::getOutQty) - .isNull(SysStockDetail::getLocationId)); - if (ObjectUtils.isEmpty(list)) { - businDataTaskVo.setDistinction("1"); - } 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(frompoint); - } + if (businDataTaskVo.getDistinction().equals("2")) { + int number = businDataTaskGoodsVos.size(); + List goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); + //根据GoodsNo查看立库是否有库存 + List list = iSysStockDetailService.list(new LambdaQueryWrapper() + .in(SysStockDetail::getGoodsNo, goodsno) + .eq(SysStockDetail::getQty, "1") + .isNull(SysStockDetail::getOutQty) + .isNull(SysStockDetail::getLocationId)); + if (ObjectUtils.isEmpty(list)) { + businDataTaskVo.setDistinction("1"); + } 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(frompoint); + } - } + } - //TODO 测试注释 要到开 + //TODO 测试注释 要到开 // if (!randome.equals("P02")) { - if (!businDataTaskVo.getDistinction().equals("2")) { + if (!businDataTaskVo.getDistinction().equals("2")) { // int number = businDataTaskGoodsVos.size(); // List goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); - //根据GoodsNo查看立库是否有库存 + //根据GoodsNo查看立库是否有库存 // log.info("查询立库库存条件:goodsno:"+goodsno); // List list = iSysStockDetailService.list(new LambdaQueryWrapper() // .in(SysStockDetail::getGoodsNo, goodsno) // .eq(SysStockDetail::getQty, "1") // .ne(SysStockDetail::getOutQty ,"1" ) // .isNotNull(SysStockDetail::getLocationId)); - //查询库存并返回库位信息 - BusinTaskExeBo businTaskExeBo = iBusinDataTaskService.outboundInfo(businDataTaskGoodsVos, String.valueOf(businDataTaskVo.getId())); - BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); - if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) { - if (ObjectUtils.isNotEmpty(businTaskExeBo)){ - ////生成出库单 - Result billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); - businDataTask.setTransId(billResult.getData()); - } - //添加货位预占和库存预占 - //获取货位信息 - BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); - location.setLocationStatus("4"); - iBaseLocationService.updateById(location); - //根据货位拿到库存信息 - List sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId())); - sysStockDetailList.stream().forEach(e -> { - e.setOutQty(1); - }); - //给库存添加出货预占 - iSysStockDetailService.updateBatchById(sysStockDetailList); + //查询库存并返回库位信息 + BusinTaskExeBo businTaskExeBo = iBusinDataTaskService.outboundInfo(businDataTaskGoodsVos, String.valueOf(businDataTaskVo.getId())); + BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); + if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) { + if (ObjectUtils.isNotEmpty(businTaskExeBo)) { + ////生成出库单 + Result billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); + businDataTask.setTransId(billResult.getData()); + } + //添加货位预占和库存预占 + //获取货位信息 + BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); + location.setLocationStatus("4"); + iBaseLocationService.updateById(location); + //根据货位拿到库存信息 + List sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId())); + sysStockDetailList.stream().forEach(e -> { + e.setOutQty(1); + }); + //给库存添加出货预占 + iSysStockDetailService.updateBatchById(sysStockDetailList); // Result taskResult =new Result<>(); - Result taskResult = outTask(businDataTask); - if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ - redisTemplate.opsForValue().set("outbound:"+businDataTask.getId(), businDataTask.toString()); - } - - - //拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以) - businDataTask.setContainerId(sysStockDetailList.get(0).getContainerCode()); - if(!"5".equals(businDataTask.getTaskType())){ - //根据过点时间更改out表里的状态信息 - List businDataTaskGoods = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper() - .eq(BusinDataTaskGoods::getTaskCode, businDataTask.getId())); - BaseBarcodesOut baseBarcodesOutServiceOne = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper() - .eq(BaseBarcodesOut::getTraverseDate, businDataTaskGoods.get(0).getTraverseDate())); - baseBarcodesOutServiceOne.setOutStatus("2"); - iBaseBarcodesOutService.updateById(baseBarcodesOutServiceOne); - } - - //添加巷道任务数和总任务数 - //tunnelTaskUtil.addOutboundTaskNum(businDataTask.getTunnel()); - } else { - if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ - businDataTask.setExceptionMsg("下发堆垛机失败"); - businDataTask.setTaskStatus(TaskStatusEnum.err.getValue()); - }else { - businDataTask.setExceptionMsg("已经下发堆垛机"); - businDataTask.setTaskStatus("-3"); - } - } - businDataTask.setDistinction(businDataTaskVo.getDistinction()); - iBusinDataTaskService.saveOrUpdate(businDataTask); - businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); - }else { - businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); - businDataTaskVo.setTaskStatus("-3"); - } + Result taskResult = outTask(businDataTask); + if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:" + businDataTask.getId()))) { + redisTemplate.opsForValue().set("outbound:" + businDataTask.getId(), businDataTask.toString()); + } + + + //拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以) + businDataTask.setContainerId(sysStockDetailList.get(0).getContainerCode()); + if (!"5".equals(businDataTask.getTaskType())) { + //根据过点时间更改out表里的状态信息 + List businDataTaskGoods = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper() + .eq(BusinDataTaskGoods::getTaskCode, businDataTask.getId())); + BaseBarcodesOut baseBarcodesOutServiceOne = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper() + .eq(BaseBarcodesOut::getTraverseDate, businDataTaskGoods.get(0).getTraverseDate())); + baseBarcodesOutServiceOne.setOutStatus("2"); + iBaseBarcodesOutService.updateById(baseBarcodesOutServiceOne); + } + + //添加巷道任务数和总任务数 + //tunnelTaskUtil.addOutboundTaskNum(businDataTask.getTunnel()); + } else { + if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:" + businDataTask.getId()))) { + businDataTask.setExceptionMsg("下发堆垛机失败"); + businDataTask.setTaskStatus(TaskStatusEnum.err.getValue()); + } else { + businDataTask.setExceptionMsg("已经下发堆垛机"); + businDataTask.setTaskStatus("-3"); + } + } + businDataTask.setDistinction(businDataTaskVo.getDistinction()); + iBusinDataTaskService.saveOrUpdate(businDataTask); + businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); + } else { + businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); + businDataTaskVo.setTaskStatus("-3"); + } // if (ObjectUtils.isNotEmpty(list)) { // @@ -1170,70 +1174,69 @@ public class ScheduledTasks { // businDataTaskVo.setTaskPath(frompoint); // } // } - } + } + } else if (taskType.equals("11") || taskType.equals("12")) { + String agvno = ""; + int AgvType = 0; + //空治具流向呼叫agv失败后再次呼叫agv + if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) { + agvno = businDataTaskVo.getAgvNo(); } - else if (taskType.equals("11")||taskType.equals("12")){ - String agvno=""; - int AgvType=0; - //空治具流向呼叫agv失败后再次呼叫agv - if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())){ - agvno=businDataTaskVo.getAgvNo(); + Map agvMap = JsonUtil.JsonStrToMap(businDataTaskVo.getPoints()); + List AgvPoints = agvMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(e -> e.getValue()).collect(Collectors.toList()); + AgvType = Integer.valueOf(businDataTaskVo.getIsDown()); + //呼叫AGV + AGVMoveBo bo = new AGVMoveBo(); + bo.setPoints(AgvPoints); + bo.setTaskId(businDataTaskVo.getId()); + bo.setRobotId(agvno); + bo.setTaskType(AgvType); + Result result = rcsUtil.moveByAGV(bo); + if (result.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskStatus("1"); + if (businDataTaskVo.getTaskType().equals(TaskTypeEnum.mechainical.getValue())) { + //更改空治具流向任务状态为进行中 + BusinDpscontainerRecord businDpscontainerRecord = businDpsContainerRecordMapper.selectByTaskid(String.valueOf(businDataTaskVo.getId())); + businDpscontainerRecord.setIsState("0"); + businDpsContainerRecordMapper.updateById(businDpscontainerRecord); } - Map agvMap = JsonUtil.JsonStrToMap(businDataTaskVo.getPoints()); - List AgvPoints = agvMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(e -> e.getValue()).collect(Collectors.toList()); - AgvType=Integer.valueOf(businDataTaskVo.getIsDown()); - //呼叫AGV - AGVMoveBo bo = new AGVMoveBo(); - bo.setPoints(AgvPoints); - bo.setTaskId(businDataTaskVo.getId()); - bo.setRobotId(agvno); - bo.setTaskType(AgvType); - Result result = rcsUtil.moveByAGV(bo); - if (result.getCode()== HttpStatus.SUCCESS.getCode()){ - businDataTaskVo.setTaskStatus("1"); - if(businDataTaskVo.getTaskType().equals(TaskTypeEnum.mechainical.getValue())) { - //更改空治具流向任务状态为进行中 - BusinDpscontainerRecord businDpscontainerRecord = businDpsContainerRecordMapper.selectByTaskid(String.valueOf(businDataTaskVo.getId())); - businDpscontainerRecord.setIsState("0"); - businDpsContainerRecordMapper.updateById(businDpscontainerRecord); - } - if (StringUtils.isNotEmpty(String.valueOf(businDataTaskVo.getLocationId()))&&0!=businDataTaskVo.getLocationId()){ - BaseLocation baseLocation = baseLocationService.getById(businDataTaskVo.getLocationId()); - baseLocation.setLocationStatus("4"); - baseLocationService.updateById(baseLocation); - } - if (StringUtils.isNotEmpty(businDataTaskVo.getRemark())){ - Long oldTaskId = Long.valueOf(businDataTaskVo.getRemark()); - BusinDataTask oldDataTask = iBusinDataTaskService.getById(oldTaskId); - oldDataTask.setTaskStatus("3"); - oldDataTask.setRemark("已取消,已被任务ID为:"+taskId+" 替代!"); - iBusinDataTaskService.updateById(oldDataTask); - businDataTaskVo.setRemark(String.valueOf(oldDataTask.getId())); + if (StringUtils.isNotEmpty(String.valueOf(businDataTaskVo.getLocationId())) && 0 != businDataTaskVo.getLocationId()) { + BaseLocation baseLocation = baseLocationService.getById(businDataTaskVo.getLocationId()); + baseLocation.setLocationStatus("4"); + baseLocationService.updateById(baseLocation); + } + if (StringUtils.isNotEmpty(businDataTaskVo.getRemark())) { + Long oldTaskId = Long.valueOf(businDataTaskVo.getRemark()); + BusinDataTask oldDataTask = iBusinDataTaskService.getById(oldTaskId); + oldDataTask.setTaskStatus("3"); + oldDataTask.setRemark("已取消,已被任务ID为:" + taskId + " 替代!"); + iBusinDataTaskService.updateById(oldDataTask); + businDataTaskVo.setRemark(String.valueOf(oldDataTask.getId())); - } - }else { - businDataTaskVo.setTaskStatus("5"); - businDataTaskVo.setExceptionMsg(result.getMsg()); } + } else { + businDataTaskVo.setTaskStatus("5"); + businDataTaskVo.setExceptionMsg(result.getMsg()); + } - } - //空治具出库 - else if(taskType.equals("15")){ - //给堆垛机下命令 - BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId); - if (ObjectUtils.isNotEmpty(businDataTask)) { - Result taskResult = outTask(businDataTask); - if (Result.isOk(taskResult)) { - //完成后更新库位状态为空闲 - BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); - location.setLocationStatus("0"); - iBaseLocationService.updateById(location); - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - /**空治具出库库存信息处理*/ - iSysStockDetailService.deleteBySysStockByLocationId(businDataTask.getLocationId()); - //根据货位拿到库存信息 + } + //空治具出库 + else if (taskType.equals("15")) { + //给堆垛机下命令 + BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId); + if (ObjectUtils.isNotEmpty(businDataTask)) { + Result taskResult = outTask(businDataTask); + if (Result.isOk(taskResult)) { + //完成后更新库位状态为空闲 + BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); + location.setLocationStatus("0"); + iBaseLocationService.updateById(location); + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + /**空治具出库库存信息处理*/ + iSysStockDetailService.deleteBySysStockByLocationId(businDataTask.getLocationId()); + //根据货位拿到库存信息 // List listT = iSysStockDetailService.list(new LambdaQueryWrapper() // .eq(SysStockDetail::getLocationId,businDataTask.getLocationId())); // if (listT.size()>0&&ObjectUtils.isNotEmpty(listT)){ @@ -1242,66 +1245,214 @@ public class ScheduledTasks { // sysStockDetail.setQty(sysStockDetail.getQty().subtract(new BigDecimal("1"))); // iSysStockDetailService.updateById(sysStockDetail); // } - } } } - else if (taskType.equals("10")){ - //先判断补货入库是否是一套,如果是入存货区,否则入异常区 - List businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); - Result baseLocationVoResult = iBaseLocationService.queryById(businDataTaskVo.getLocationId()); - Result taskResult = outTask(businDataTaskVo); - if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - //生成出库明细 - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - exeBo.setTaskCode(businDataTaskVo.getId()); - exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); - exeBo.setBaseLocationVo(baseLocationVoResult.getData()); - exeBo.setTransNo("2"); - exeBo.setTransQual("2"); - ////生成出库单 - Result billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); - businDataTaskVo.setTransId(billResult.getData()); - } else { - businDataTaskVo.setExceptionMsg("下发堆垛机指令失败"); - businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); + } else if (taskType.equals("10")) { + //先判断补货入库是否是一套,如果是入存货区,否则入异常区 + List businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); + Result baseLocationVoResult = iBaseLocationService.queryById(businDataTaskVo.getLocationId()); + Result taskResult = outTask(businDataTaskVo); + if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + //生成出库明细 + BusinTaskExeBo exeBo = new BusinTaskExeBo(); + exeBo.setTaskCode(businDataTaskVo.getId()); + exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); + exeBo.setBaseLocationVo(baseLocationVoResult.getData()); + exeBo.setTransNo("2"); + exeBo.setTransQual("2"); + ////生成出库单 + Result billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); + businDataTaskVo.setTransId(billResult.getData()); + } else { + businDataTaskVo.setExceptionMsg("下发堆垛机指令失败"); + businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); + } + } else if (taskType.equals(TaskTypeEnum.abnormal_delivery.getValue())) { + //异常出库 + //异常区货位 + Long abnormalArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area)); + List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(abnormalArea); + + List tunnelall = baseLocationVos.stream().map(e -> e.getTunnel()).collect(Collectors.toList()); + //拿到任务数最少的巷道 + String tunnelone = this.quickSort(tunnelall); + List tunnelLocation = baseLocationVos.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList()); + List listlocationId = new ArrayList<>(); + //如果是双深位 查看外侧的货位是否有托盘 + for (BaseLocationVo baseLovationVO : tunnelLocation) { + if (baseLovationVO.getIsDeep().equals("2")) { + BaseLocation one = baseLocationService.getOne(new LambdaQueryWrapper() + .eq(BaseLocation::getRoute, baseLovationVO.getRoute()) + .eq(BaseLocation::getIsDeep, "1") + .eq(BaseLocation::getTunnel, baseLovationVO.getTunnel()) + .eq(BaseLocation::getAreaId, baseLovationVO.getAreaId())); + if (one != null && (one.getLocationStatus().equals("4") || one.getLocationStatus().equals("1"))) { + listlocationId.add(baseLovationVO.getId()); + } } } - else if(taskType.equals(TaskTypeEnum.abnormal_delivery.getValue())){ - //异常出库 - //异常区货位 - Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area)); - List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(abnormalArea); - - List tunnelall = baseLocationVos.stream().map(e -> e.getTunnel()).collect(Collectors.toList()); - //拿到任务数最少的巷道 - String tunnelone=this.quickSort(tunnelall); - List tunnelLocation = baseLocationVos.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList()); - List listlocationId=new ArrayList<>(); - //如果是双深位 查看外侧的货位是否有托盘 - for (BaseLocationVo baseLovationVO: tunnelLocation) { - if (baseLovationVO.getIsDeep().equals("2")){ - BaseLocation one = baseLocationService.getOne(new LambdaQueryWrapper() - .eq(BaseLocation::getRoute,baseLovationVO.getRoute()) - .eq(BaseLocation::getIsDeep,"1") - .eq(BaseLocation::getTunnel,baseLovationVO.getTunnel()) - .eq(BaseLocation::getAreaId,baseLovationVO.getAreaId())); - if (one!=null&&(one.getLocationStatus().equals("4")||one.getLocationStatus().equals("1"))){ - listlocationId.add(baseLovationVO.getId()); + if (listlocationId.size() > 0) { + for (int i = 0; i < tunnelLocation.size(); i++) { + int number = i; + listlocationId.stream().forEach(e -> { + if (e.equals(tunnelLocation.get(number).getId())) { + tunnelLocation.remove(number); } - } + }); } - if (listlocationId.size()>0){ - for (int i=0;i{ - if (e.equals(tunnelLocation.get(number).getId())){ - tunnelLocation.remove(number); - } - }); - } + } + + //根据巷道分配货位 + BaseLocationVo baseLocationVo = tunnelLocation.get(0); + + businDataTaskVo.setFromColumn(baseLocationVo.getLocationColumn()); + businDataTaskVo.setFromLayer(baseLocationVo.getLayer()); + businDataTaskVo.setFromRow(baseLocationVo.getLocationRow()); + //获取货位及巷道; + String tunnel = baseLocationVo.getTunnel(); + // 获取goods信息并和当前任务关联 + List goods = new ArrayList<>(); + List goodsVo = new ArrayList<>(); + List sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper() + .eq(SysStockDetail::getLocationId, baseLocationVo.getId()) + .eq(SysStockDetail::getQty, 1) + .isNull(SysStockDetail::getOutQty)); + for (SysStockDetail sysStockDetail : sysStockDetailList) { + BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); + BusinDataTaskGoodsVo taskGoodsVo = new BusinDataTaskGoodsVo(); + taskGoods.setQrCode(sysStockDetail.getQrCode()); + taskGoods.setBranchId(sysStockDetail.getBranchId()); + taskGoods.setTaskCode(taskId); + taskGoods.setCreateTime(DateUtils.getNowDate()); + taskGoods.setGoodsNo(sysStockDetail.getGoodsNo()); + BaseGoodsData baseGoodsData = iBaseGoodsDataService.getBaseGoodsByBarcodes(sysStockDetail.getGoodsNo()); + taskGoods.setIsPunching(baseGoodsData.getIsPunching()); + taskGoods.setIsRepair("1"); + goods.add(taskGoods); + + taskGoodsVo.setQrCode(sysStockDetail.getQrCode()); + taskGoodsVo.setTaskCode(String.valueOf(taskId)); + taskGoodsVo.setGoodsNo(sysStockDetail.getGoodsNo()); + taskGoodsVo.setIsPunching(baseGoodsData.getIsPunching()); + taskGoodsVo.setIsRepair("1"); + goodsVo.add(taskGoodsVo); + } + + BasePointDeviceQueryBo pointQueryBo1 = new BasePointDeviceQueryBo(); + pointQueryBo1.setTunnel(tunnel); + pointQueryBo1.setDirection("0"); + //获取巷道对应的堆垛机信息 + pointQueryBo1.setDevType("1"); + BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo1); + Long stkPlcId = baseDevicePlcVo.getPlcId(); + Long plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); + + businDataTaskVo.setDevId(baseLocationVo.getDevId()); + businDataTaskVo.setTunnel(baseLocationVo.getTunnel()); + businDataTaskVo.setDpsNoOne(plcId); + businDataTaskVo.setDpsNoTwo(stkPlcId); + //测试使用货位id + businDataTaskVo.setLocationId(baseLocationVo.getId()); + //拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以) + businDataTaskVo.setContainerId(sysStockDetailList.get(0).getContainerCode()); + + Result taskResult1 = outTask(businDataTaskVo); + if (taskResult1.getCode() == HttpStatus.SUCCESS.getCode()) { + businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); + //生成出库单 + BusinTaskExeBo exeBo = new BusinTaskExeBo(); + exeBo.setTaskCode(taskId); + exeBo.setBusinDataTaskGoodsVo(goodsVo); + exeBo.setBaseLocationVo(baseLocationVo); + exeBo.setTransNo("2"); + exeBo.setTransQual("2"); + + Result billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); + businDataTaskVo.setTransId(billResult.getData()); + //添加货位预占和库存预占 + //获取货位信息 + baseLocationVo.setLocationStatus("4"); + iBaseLocationService.updateById(baseLocationVo); + //根据货位拿到库存信息 + sysStockDetailList.stream().forEach(e -> { + e.setOutQty(1); + }); + //给库存添加出货预占 + iSysStockDetailService.updateBatchById(sysStockDetailList); + //添加巷道任务数和总任务数 + tunnelTaskUtil.addOutboundTaskNum(businDataTaskVo.getTunnel()); + } else { + businDataTaskVo.setExceptionMsg("下发堆垛机指令失败"); + businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); + } + //新增物料明细 + boolean b = iBusinDataTaskGoodsService.saveOrUpdateBatch(goods); + + + } else if (taskType.equals(TaskTypeEnum.punching_delivery.getValue())) { + + } else if (taskType.equals(TaskTypeEnum.replenished_in.getValue())) { + String agvno = null; + if (businDataTaskVo.getTaskPath().contains("manMade")) { + List agvtaskType = new ArrayList(); + agvtaskType.add("15"); + agvtaskType.add("12"); + BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper() + .in(BusinDataTask::getTaskType, agvtaskType) + .eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) + .eq(BusinDataTask::getTaskStatus, "2") + .orderByDesc(BusinDataTask::getId) + .last("limit 1")); + if (ObjectUtils.isNotEmpty(manMade01)) { + agvno = manMade01.getAgvNo(); } + } else if (businDataTaskVo.getTaskPath().contains("Artificial")) { + String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); + String[] idArrs = idArr.split("_"); + agvno = idArrs[1]; + } + List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); + List goodsNoStr = goodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); + + iBusinDataTaskService.runReplenishIn(businDataTaskVo, agvno); + Result booleanResult = iPutInOutStorageService.reduceInventory(taskId, goodsNoStr); + } else if (taskType.equals("21")) { + // 冲孔出库 + //待冲孔区货位 + Long abnormalArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); + List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(abnormalArea); + + List tunnelall = baseLocationVos.stream().map(e -> e.getTunnel()).collect(Collectors.toList()); + //拿到任务数最少的巷道 + String tunnelone = this.quickSort(tunnelall); + List tunnelLocation = baseLocationVos.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList()); + List listlocationId = new ArrayList<>(); + //如果是双深位 查看外侧的货位是否有托盘 + for (BaseLocationVo baseLovationVO : tunnelLocation) { + if (baseLovationVO.getIsDeep().equals("2")) { + BaseLocation one = baseLocationService.getOne(new LambdaQueryWrapper() + .eq(BaseLocation::getRoute, baseLovationVO.getRoute()) + .eq(BaseLocation::getIsDeep, "1") + .eq(BaseLocation::getTunnel, baseLovationVO.getTunnel()) + .eq(BaseLocation::getAreaId, baseLovationVO.getAreaId())); + if (one != null && (one.getLocationStatus().equals("4") || one.getLocationStatus().equals("1"))) { + listlocationId.add(baseLovationVO.getId()); + } + } + } + if (listlocationId.size() > 0) { + for (int i = 0; i < tunnelLocation.size(); i++) { + int number = i; + listlocationId.stream().forEach(e -> { + if (e.equals(tunnelLocation.get(number).getId())) { + tunnelLocation.remove(number); + } + }); + } + } + if (tunnelLocation.size() > 0) { //根据巷道分配货位 BaseLocationVo baseLocationVo = tunnelLocation.get(0); @@ -1314,10 +1465,10 @@ public class ScheduledTasks { List goods = new ArrayList<>(); List goodsVo = new ArrayList<>(); List sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper() - .eq(SysStockDetail::getLocationId,baseLocationVo.getId()) - .eq(SysStockDetail::getQty,1) + .eq(SysStockDetail::getLocationId, baseLocationVo.getId()) + .eq(SysStockDetail::getQty, 1) .isNull(SysStockDetail::getOutQty)); - for (SysStockDetail sysStockDetail: sysStockDetailList) { + for (SysStockDetail sysStockDetail : sysStockDetailList) { BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); BusinDataTaskGoodsVo taskGoodsVo = new BusinDataTaskGoodsVo(); taskGoods.setQrCode(sysStockDetail.getQrCode()); @@ -1338,7 +1489,7 @@ public class ScheduledTasks { goodsVo.add(taskGoodsVo); } - BasePointDeviceQueryBo pointQueryBo1=new BasePointDeviceQueryBo(); + BasePointDeviceQueryBo pointQueryBo1 = new BasePointDeviceQueryBo(); pointQueryBo1.setTunnel(tunnel); pointQueryBo1.setDirection("0"); //获取巷道对应的堆垛机信息 @@ -1387,195 +1538,42 @@ public class ScheduledTasks { } //新增物料明细 boolean b = iBusinDataTaskGoodsService.saveOrUpdateBatch(goods); - - + } else { + businDataTaskVo.setTaskStatus("-3"); } - else if(taskType.equals(TaskTypeEnum.punching_delivery.getValue())){ - - } - else if(taskType.equals(TaskTypeEnum.replenished_in.getValue())){ - String agvno = null; - if (businDataTaskVo.getTaskPath().contains("manMade")) { - List agvtaskType=new ArrayList(); - agvtaskType.add("15"); - agvtaskType.add("12"); - BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper() - .in(BusinDataTask::getTaskType, agvtaskType) - .eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) - .eq(BusinDataTask::getTaskStatus, "2") - .orderByDesc(BusinDataTask::getId) - .last("limit 1")); - if (ObjectUtils.isNotEmpty(manMade01)) { - agvno = manMade01.getAgvNo(); - } - } else if (businDataTaskVo.getTaskPath().contains("Artificial")) { - String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); - String[] idArrs = idArr.split("_"); - agvno = idArrs[1]; - } - - List goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); - List goodsNoStr = goodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); - - iBusinDataTaskService.runReplenishIn(businDataTaskVo,agvno); - Result booleanResult = iPutInOutStorageService.reduceInventory(taskId,goodsNoStr); - } - else if (taskType.equals("21")){ - // 冲孔出库 - //待冲孔区货位 - Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); - List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(abnormalArea); - - List tunnelall = baseLocationVos.stream().map(e -> e.getTunnel()).collect(Collectors.toList()); - //拿到任务数最少的巷道 - String tunnelone=this.quickSort(tunnelall); - List tunnelLocation = baseLocationVos.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList()); - List listlocationId=new ArrayList<>(); - //如果是双深位 查看外侧的货位是否有托盘 - for (BaseLocationVo baseLovationVO: tunnelLocation) { - if (baseLovationVO.getIsDeep().equals("2")){ - BaseLocation one = baseLocationService.getOne(new LambdaQueryWrapper() - .eq(BaseLocation::getRoute,baseLovationVO.getRoute()) - .eq(BaseLocation::getIsDeep,"1") - .eq(BaseLocation::getTunnel,baseLovationVO.getTunnel()) - .eq(BaseLocation::getAreaId,baseLovationVO.getAreaId())); - if (one!=null&&(one.getLocationStatus().equals("4")||one.getLocationStatus().equals("1"))){ - listlocationId.add(baseLovationVO.getId()); - } - } - } - if (listlocationId.size()>0){ - for (int i=0;i{ - if (e.equals(tunnelLocation.get(number).getId())){ - tunnelLocation.remove(number); - } - }); - } - } - if(tunnelLocation.size()>0) { - //根据巷道分配货位 - BaseLocationVo baseLocationVo = tunnelLocation.get(0); - - businDataTaskVo.setFromColumn(baseLocationVo.getLocationColumn()); - businDataTaskVo.setFromLayer(baseLocationVo.getLayer()); - businDataTaskVo.setFromRow(baseLocationVo.getLocationRow()); - //获取货位及巷道; - String tunnel = baseLocationVo.getTunnel(); - // 获取goods信息并和当前任务关联 - List goods = new ArrayList<>(); - List goodsVo = new ArrayList<>(); - List sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper() - .eq(SysStockDetail::getLocationId, baseLocationVo.getId()) - .eq(SysStockDetail::getQty, 1) - .isNull(SysStockDetail::getOutQty)); - for (SysStockDetail sysStockDetail : sysStockDetailList) { - BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); - BusinDataTaskGoodsVo taskGoodsVo = new BusinDataTaskGoodsVo(); - taskGoods.setQrCode(sysStockDetail.getQrCode()); - taskGoods.setBranchId(sysStockDetail.getBranchId()); - taskGoods.setTaskCode(taskId); - taskGoods.setCreateTime(DateUtils.getNowDate()); - taskGoods.setGoodsNo(sysStockDetail.getGoodsNo()); - BaseGoodsData baseGoodsData = iBaseGoodsDataService.getBaseGoodsByBarcodes(sysStockDetail.getGoodsNo()); - taskGoods.setIsPunching(baseGoodsData.getIsPunching()); - taskGoods.setIsRepair("1"); - goods.add(taskGoods); - - taskGoodsVo.setQrCode(sysStockDetail.getQrCode()); - taskGoodsVo.setTaskCode(String.valueOf(taskId)); - taskGoodsVo.setGoodsNo(sysStockDetail.getGoodsNo()); - taskGoodsVo.setIsPunching(baseGoodsData.getIsPunching()); - taskGoodsVo.setIsRepair("1"); - goodsVo.add(taskGoodsVo); - } - - BasePointDeviceQueryBo pointQueryBo1 = new BasePointDeviceQueryBo(); - pointQueryBo1.setTunnel(tunnel); - pointQueryBo1.setDirection("0"); - //获取巷道对应的堆垛机信息 - pointQueryBo1.setDevType("1"); - BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo1); - Long stkPlcId = baseDevicePlcVo.getPlcId(); - Long plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); - - businDataTaskVo.setDevId(baseLocationVo.getDevId()); - businDataTaskVo.setTunnel(baseLocationVo.getTunnel()); - businDataTaskVo.setDpsNoOne(plcId); - businDataTaskVo.setDpsNoTwo(stkPlcId); - //测试使用货位id - businDataTaskVo.setLocationId(baseLocationVo.getId()); - //拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以) - businDataTaskVo.setContainerId(sysStockDetailList.get(0).getContainerCode()); - - Result taskResult1 = outTask(businDataTaskVo); - if (taskResult1.getCode() == HttpStatus.SUCCESS.getCode()) { - businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); - //生成出库单 - BusinTaskExeBo exeBo = new BusinTaskExeBo(); - exeBo.setTaskCode(taskId); - exeBo.setBusinDataTaskGoodsVo(goodsVo); - exeBo.setBaseLocationVo(baseLocationVo); - exeBo.setTransNo("2"); - exeBo.setTransQual("2"); - - Result billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); - businDataTaskVo.setTransId(billResult.getData()); - //添加货位预占和库存预占 - //获取货位信息 - baseLocationVo.setLocationStatus("4"); - iBaseLocationService.updateById(baseLocationVo); - //根据货位拿到库存信息 - sysStockDetailList.stream().forEach(e -> { - e.setOutQty(1); - }); - //给库存添加出货预占 - iSysStockDetailService.updateBatchById(sysStockDetailList); - //添加巷道任务数和总任务数 - tunnelTaskUtil.addOutboundTaskNum(businDataTaskVo.getTunnel()); - } else { - businDataTaskVo.setExceptionMsg("下发堆垛机指令失败"); - businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); - } - //新增物料明细 - boolean b = iBusinDataTaskGoodsService.saveOrUpdateBatch(goods); - }else{ - businDataTaskVo.setTaskStatus("-3"); - } - } - log.info("任务号"+businDataTaskVo.getId()+"任务状态"+businDataTaskVo.getTaskStatus()+"点位信息"+businDataTaskVo.getPoints()); - //统一提交任务数据 - iBusinDataTaskService.saveOrUpdate(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); } + log.info("任务号" + businDataTaskVo.getId() + "任务状态" + businDataTaskVo.getTaskStatus() + "点位信息" + businDataTaskVo.getPoints()); + //统一提交任务数据 + iBusinDataTaskService.saveOrUpdate(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); + } //查看堆垛机是否拥堵 - public Result PLCout(BusinDataTask businDataTask){ - Long plcId=businDataTask.getDpsNoOne(); + public Result PLCout(BusinDataTask businDataTask) { + Long plcId = businDataTask.getDpsNoOne(); WcsPlcConnect wcsPlcConnect = iWcsPlcConnectService.getById(plcId); PlcOperate stkOperate = plcInit.getPlcOperateByIp(wcsPlcConnect.getPlcIp()); List propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(plcId); - String outAddress=""; + String outAddress = ""; //根据连接的plcId获取属性 PLCReadAndWrite plcReadAndWriteD = new PLCReadAndWrite(); Map pointMap = plcReadAndWriteD.readPlcData(stkOperate, wcsPlcConnect.getPointTables()); - for (WcsPlcProperty wcsPlcProperty:propertyList){ - if (wcsPlcProperty.getPointType().equals("3")&&wcsPlcProperty.getTunnel().equals(businDataTask.getTunnel())){ - outAddress= wcsPlcProperty.getAddress(); + for (WcsPlcProperty wcsPlcProperty : propertyList) { + if (wcsPlcProperty.getPointType().equals("3") && wcsPlcProperty.getTunnel().equals(businDataTask.getTunnel())) { + outAddress = wcsPlcProperty.getAddress(); } } - if (pointMap.containsKey(outAddress)&&Boolean.valueOf(pointMap.get(outAddress).toString())){ - return Result.ok(); + if (pointMap.containsKey(outAddress) && Boolean.valueOf(pointMap.get(outAddress).toString())) { + return Result.ok(); } return Result.err(); } // 出库任务 - public Result outTask(BusinDataTask businDataTask){ + public Result outTask(BusinDataTask businDataTask) { //查看输送线是否拥堵 Result booleanResult = this.PLCout(businDataTask); - if (HttpStatus.ERROR.getCode()==booleanResult.getCode()){ + if (HttpStatus.ERROR.getCode() == booleanResult.getCode()) { return Result.err(); } String fromLayer = businDataTask.getFromLayer(); @@ -1591,32 +1589,32 @@ public class ScheduledTasks { PlcOperate stkOperate = plcInit.getPlcOperateByIp(basePointVo.getPlcIp()); List propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(plcId); - String plcTaskId =""; - String plcToRow =""; - String plcToColumn =""; - String plcToLayer =""; - String plcHs =""; - String plcCommand=""; - String plcNulladdress=""; - String Overonaddress=""; + String plcTaskId = ""; + String plcToRow = ""; + String plcToColumn = ""; + String plcToLayer = ""; + String plcHs = ""; + String plcCommand = ""; + String plcNulladdress = ""; + String Overonaddress = ""; for (WcsPlcProperty stkProperty : propertyList) { //获取要堆垛机要写入的点位 if (stkProperty.getPointType().equals("101")) { plcTaskId = stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("104")){ + } else if (stkProperty.getPointType().equals("104")) { plcToRow = stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("105")){ - plcToColumn =stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("106")){ - plcToLayer=stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("107")){ - plcHs=stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("102")){ - plcCommand=stkProperty.getAddress(); - }else if (stkProperty.getPointType().equals("12")){ - plcNulladdress=stkProperty.getAddress(); - }else if(stkProperty.getPointType().equals("4")){ - Overonaddress= stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("105")) { + plcToColumn = stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("106")) { + plcToLayer = stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("107")) { + plcHs = stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("102")) { + plcCommand = stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("12")) { + plcNulladdress = stkProperty.getAddress(); + } else if (stkProperty.getPointType().equals("4")) { + Overonaddress = stkProperty.getAddress(); } } WcsPlcConnect plcConnect = iWcsPlcConnectService.getById(plcId); @@ -1624,13 +1622,13 @@ public class ScheduledTasks { PLCReadAndWrite plcReadAndWriteD = new PLCReadAndWrite(); Map pointDMap = plcReadAndWriteD.readPlcData(stkOperate, plcConnect.getPointTables()); - if (pointDMap.containsKey(plcNulladdress)&&Boolean.valueOf(pointDMap.get(plcNulladdress).toString())&&(pointDMap.get(Overonaddress).equals("0"))) { + if (pointDMap.containsKey(plcNulladdress) && Boolean.valueOf(pointDMap.get(plcNulladdress).toString()) && (pointDMap.get(Overonaddress).equals("0"))) { //请求出库 给堆垛机下命令判断是否 加锁 加锁则返回 - if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:"+businDataTask.getTunnel())) - && redisTemplate.opsForValue().get("stackerLock:"+businDataTask.getTunnel()).toString().equals("true")){ + if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel())) + && redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) { return Result.err(); - }else { - redisTemplate.opsForValue().set("stackerLock:"+businDataTask.getTunnel(), "true"); + } else { + redisTemplate.opsForValue().set("stackerLock:" + businDataTask.getTunnel(), "true"); } //给堆垛机写命令 Map allMap = new HashMap<>(1); @@ -1655,52 +1653,52 @@ public class ScheduledTasks { allMap.put(plcCommand, plcCommandMap); PLCReadAndWrite plcReadAndWrite = new PLCReadAndWrite(); - if (plcReadAndWrite.execWrite(stkOperate, JsonUtil.toJSONString(allMap))){ + if (plcReadAndWrite.execWrite(stkOperate, JsonUtil.toJSONString(allMap))) { //解锁 //redisTemplate.opsForValue().set("stackerLock", "false"); return Result.ok(); - }else { + } else { //解锁 //redisTemplate.opsForValue().set("stackerLock", "false"); return Result.err(); } - } - else { + } else { return Result.err(); } } //检查当前物料号是否有出库任务(正常出库,紧急出库) - public BusinDataTaskOutVo checkOutTaskData(String goods){ - BusinDataTaskOutVo businDataTaskOutVo=null; + public BusinDataTaskOutVo checkOutTaskData(String goods) { + BusinDataTaskOutVo businDataTaskOutVo = null; BusinTaskQueryBo queryBo = new BusinTaskQueryBo(); // queryBo.setTaskType("'4','5'"); queryBo.setGoodsNo(goods); List businDataTaskOutVos = iBusinDataTaskService.selectOutBoundDataTask(goods); - if (businDataTaskOutVos.size()>0){ - businDataTaskOutVo = businDataTaskOutVos.get(0); + if (businDataTaskOutVos.size() > 0) { + businDataTaskOutVo = businDataTaskOutVos.get(0); } return businDataTaskOutVo; } /** * 入库时有对应出库任务,将入库任务改为出库任务,直接将物料运往出库点位 + * * @param businDataTaskOutVo * @param businDataTaskVo */ - public void updateOutTask(BusinDataTaskOutVo businDataTaskOutVo,BusinDataTaskVo businDataTaskVo,String pointout){ + public void updateOutTask(BusinDataTaskOutVo businDataTaskOutVo, BusinDataTaskVo businDataTaskVo, String pointout) { Long taskId = businDataTaskVo.getId(); BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); - String outPoint =""; + String outPoint = ""; pointQueryBo.setGroupNo(pointout); BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - if (pointDeviceout==null){ + if (pointDeviceout == null) { log.error("请维护紧急出库接驳点"); } - outPoint=pointDeviceout.getPointNo(); - int outtaskType=Integer.valueOf(pointDeviceout.getIsDown()); + outPoint = pointDeviceout.getPointNo(); + int outtaskType = Integer.valueOf(pointDeviceout.getIsDown()); //拿到机械手下料口上报取货完成点位 @@ -1715,10 +1713,10 @@ public class ScheduledTasks { businDataTaskout.setTaskStatus("3"); //更新入库任务对应信息 String startPoint = businDataTaskVo.getTaskPath(); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - snPointMap.put("2",pointDevice.getHandshakePoint()); - snPointMap.put("3",outPoint); + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + snPointMap.put("2", pointDevice.getHandshakePoint()); + snPointMap.put("3", outPoint); List points = new ArrayList<>(); points.add(startPoint); points.add(pointDevice.getHandshakePoint()); @@ -1726,8 +1724,8 @@ public class ScheduledTasks { businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); businDataTaskVo.setIsDown(String.valueOf(outtaskType)); - Result booleanResult =rcsUtil.callAGV(taskId, outtaskType,points); - if (booleanResult.getCode()== HttpStatus.SUCCESS.getCode()) { + Result booleanResult = rcsUtil.callAGV(taskId, outtaskType, points); + if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { businDataTaskVo.setTaskPath(outPoint); businDataTaskVo.setTaskType("5"); businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); @@ -1742,16 +1740,16 @@ public class ScheduledTasks { * 空治具出库流程 */ @Scheduled(cron = "0/5 * * * * ? ") - public void exeEmptyContainerFromWare(){ - if(ObjectUtils.isEmpty(redisTemplate.opsForValue().get(RedisConstant.out_empty_type))){ + public void exeEmptyContainerFromWare() { + if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(RedisConstant.out_empty_type))) { log.info("暂未设置空治具出库"); return; } // 将redis 中的值转成字符串 String outEmptyType = redisTemplate.opsForValue().get(RedisConstant.out_empty_type).toString(); - if("开启".equals(outEmptyType)){ + if ("开启".equals(outEmptyType)) { iBusinEnptyContainerService.emptyContainerFromWare(); - }else{ + } else { log.info("暂未设置空治具 “开始” 出库"); } @@ -1759,11 +1757,12 @@ public class ScheduledTasks { /** * 异常出库 + * * @author Comair * @date 2023/8/12 19:32 */ // @Scheduled(cron = "0 0/1 * * * ? ") - public void abnormalDelivery(){ + public void abnormalDelivery() { //查询维修地点是否有空闲 String repairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.tepair_group); BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); @@ -1771,7 +1770,7 @@ public class ScheduledTasks { BasePointDeviceVo basePointDeviceVo = null; List basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); // 查询是否有待出库的待维修保险杠 - Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area)); + Long abnormalArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area)); List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(abnormalArea); // 判断是否符合生成任务 if (ObjectUtils.isNotEmpty(basePointDeviceVos) && ObjectUtils.isNotEmpty(baseLocationVos.size())) { @@ -1802,16 +1801,17 @@ public class ScheduledTasks { /** * 冲孔出库 + * * @author Comair * @date 2023/8/12 19:33 */ @Scheduled(cron = "0 0/1 * * * ? ") - public void punchingDelivery(){ + public void punchingDelivery() { // 查询冲孔机是否符合并可以出库冲孔 BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); BasePunchRecordVo basePunchRecordVos = iBasePunchService.selectBasePunchRecord(new BasePunch()); // 查询是否有待出库的待冲孔保险杠 - Long punchingArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); + Long punchingArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); List baseLocationVos = baseLocationMapper.getOutLocationByAreaId(punchingArea); // 判断是否符合生成任务 if (ObjectUtils.isNotEmpty(basePunchRecordVos) && basePunchRecordVos.getRecordQty() < 5 && ObjectUtils.isNotEmpty(baseLocationVos)) { @@ -1822,8 +1822,8 @@ public class ScheduledTasks { pointQueryBo.setDevCode(punchId); List tempList = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); - BasePointDeviceVo basePointDeviceVo =tempList.get(0); - if(tempList.get(0).getPointNo().contains("KW11")){ + BasePointDeviceVo basePointDeviceVo = tempList.get(0); + if (tempList.get(0).getPointNo().contains("KW11")) { basePointDeviceVo = tempList.get(1); } @@ -1856,33 +1856,34 @@ public class ScheduledTasks { /** * 返回任务数最少的巷道号 - * @author Comair - * @date 2023/8/12 20:57 + * * @param tunnelAll * @return java.lang.String + * @author Comair + * @date 2023/8/12 20:57 */ - public String quickSort(List tunnelAll){ - String tunnel= ""; - Map tunnelmap =new HashMap<>(); - tunnelAll.stream().forEach(e->{ - tunnelmap.put(e, tunnelTaskUtil.getTotalTaskNum(e,1)); + public String quickSort(List tunnelAll) { + String tunnel = ""; + Map tunnelmap = new HashMap<>(); + tunnelAll.stream().forEach(e -> { + tunnelmap.put(e, tunnelTaskUtil.getTotalTaskNum(e, 1)); }); List collect = tunnelmap.values().stream().sorted().collect(Collectors.toList()); for (String key : tunnelmap.keySet()) { - if (tunnelmap.get(key).equals(collect.get(0))){ - tunnel=key; + if (tunnelmap.get(key).equals(collect.get(0))) { + tunnel = key; } } return tunnel; } - public void inTask(Long taskId,Long containerId){ + public void inTask(Long taskId, Long containerId) { //获取待下发任务数据 BusinDataTask businDataTaskVo = businDataTaskMapper.selectById(taskId); //获取要出入库的条码信息 List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); - if(ObjectUtils.isEmpty(businDataTaskGoodsVos) || !businDataTaskVo.getTaskType().equals("0")){ + if (ObjectUtils.isEmpty(businDataTaskGoodsVos) || !businDataTaskVo.getTaskType().equals("0")) { return; } BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); @@ -1893,16 +1894,16 @@ public class ScheduledTasks { String startPoint = businDataTaskVo.getTaskPath(); - BasePointDeviceVo pointDevice= new BasePointDeviceVo(); + BasePointDeviceVo pointDevice = new BasePointDeviceVo(); BasePointDeviceVo basePointDeviceVo = new BasePointDeviceVo(); //立库输送线接驳点-入 String toLocation = ""; - int agvTaskType=0; + int agvTaskType = 0; BusinTaskExeBo exeBo = new BusinTaskExeBo(); Long plcId = null; - Long stkPlcId=null; + Long stkPlcId = null; - String agvno=null; + String agvno = null; //获取派生 // TODO 由于逻辑区域换成与车型相匹配,不是与派生匹配,所以注释掉 // Long dervieId = getLocationByDervie(vehicheModel, color); @@ -1917,15 +1918,15 @@ public class ScheduledTasks { if ("P01".equals(randome)) { //根据车型分配库位 先判断该任务是否已经分配了货位 Result locationVoResult = null; - if(ObjectUtils.isEmpty(businDataTaskVo.getToRow())){ - // locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos); + if (ObjectUtils.isEmpty(businDataTaskVo.getToRow())) { + // locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos); // TODO: 2024/6/28 zjx - locationVoResult = iBaseLocationService.assignEmptyLocationByStock( goodsNo, vehicheModel,DateUtils.getDate(),businDataTaskGoodsVos); + locationVoResult = iBaseLocationService.assignEmptyLocationByStock(goodsNo, vehicheModel, DateUtils.getDate(), businDataTaskGoodsVos); } - if(ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode()==HttpStatus.SUCCESS.getCode()){ + if (ObjectUtils.isNotEmpty(locationVoResult) && locationVoResult.getCode() == HttpStatus.SUCCESS.getCode()) { //如果是P01则设置randome为P02 - redisTemplate.opsForValue().set("randome","P02"); + redisTemplate.opsForValue().set("randome", "P02"); BaseLocationVo locationVo = locationVoResult.getData(); String tunnel = locationVo.getTunnel(); Long locationId = locationVo.getId(); @@ -1962,11 +1963,11 @@ public class ScheduledTasks { exeBo.setTransQual("1"); //根据取货时的的点位拿到对应的交互点用作取货完成点 - agvTaskType= Integer.valueOf(basePointDeviceVo.getIsDown()); - if (businDataTaskVo.getTaskType().equals("7")){ + agvTaskType = Integer.valueOf(basePointDeviceVo.getIsDown()); + if (businDataTaskVo.getTaskType().equals("7")) { if (businDataTaskVo.getTaskPath().contains("manMade")) { - agvTaskType=RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); - List agvtaskType=new ArrayList(); + agvTaskType = RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); + List agvtaskType = new ArrayList(); agvtaskType.add("15"); agvtaskType.add("12"); BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper() @@ -1979,21 +1980,21 @@ public class ScheduledTasks { agvno = manMade01.getAgvNo(); } } else if (businDataTaskVo.getTaskPath().contains("Artificial")) { - agvTaskType=RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); + agvTaskType = RCSTaskTypeEnum.TO_B_AND_PUT.getValue(); String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); String[] idArrs = idArr.split("_"); agvno = idArrs[1]; } } } - if(locationVoResult.getCode()==HttpStatus.ERROR.getCode()){ + if (locationVoResult.getCode() == HttpStatus.ERROR.getCode()) { //如果是P02则设置randome为P01 - redisTemplate.opsForValue().set("randome","P01"); + redisTemplate.opsForValue().set("randome", "P01"); String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); pointQueryBo.setGroupNo(tepairGroup); BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - toLocation=pointDeviceout.getPointNo(); - agvTaskType=Integer.valueOf( pointDeviceout.getIsDown()); + toLocation = pointDeviceout.getPointNo(); + agvTaskType = Integer.valueOf(pointDeviceout.getIsDown()); exeBo.setTaskCode(taskId); exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); exeBo.setContainerId(containerId); @@ -2002,14 +2003,14 @@ public class ScheduledTasks { } } - if ("P02".equals(randome)){ + if ("P02".equals(randome)) { //如果是P02则设置randome为P01 - redisTemplate.opsForValue().set("randome","P01"); + redisTemplate.opsForValue().set("randome", "P01"); String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); pointQueryBo.setGroupNo(tepairGroup); BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); - toLocation=pointDeviceout.getPointNo(); - agvTaskType=Integer.valueOf( pointDeviceout.getIsDown()); + toLocation = pointDeviceout.getPointNo(); + agvTaskType = Integer.valueOf(pointDeviceout.getIsDown()); exeBo.setTaskCode(taskId); exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); exeBo.setContainerId(containerId); @@ -2026,32 +2027,32 @@ public class ScheduledTasks { pointQueryBoup.setGroupNo(tepairGroup); pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); - if(!businDataTaskVo.getTaskType().equals("7")) { + if (!businDataTaskVo.getTaskType().equals("7")) { points.add(pointDevice.getHandshakePoint()); } points.add(toLocation); - Map snPointMap = new HashMap<>(3); - snPointMap.put("1",startPoint); - if(!businDataTaskVo.getTaskType().equals("7")) { + Map snPointMap = new HashMap<>(3); + snPointMap.put("1", startPoint); + if (!businDataTaskVo.getTaskType().equals("7")) { snPointMap.put("2", pointDevice.getHandshakePoint()); snPointMap.put("3", toLocation); - }else{ - snPointMap.put("2",toLocation); + } else { + snPointMap.put("2", toLocation); } businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); //呼叫AGV - Result booleanResult =new Result<>(); - if(businDataTaskVo.getTaskType().equals("7")){ - booleanResult= rcsUtil.callAGV(taskId, agvTaskType,points,businDataTaskVo.getToRow(),agvno); - }else{ - booleanResult=rcsUtil.callAGV(taskId, agvTaskType,points,businDataTaskVo.getToRow()); - log.error("入库呼叫AGV任务号:"+taskId + " 结果:" + booleanResult.getCode() + "返回信息:" + booleanResult.getMsg()); + Result booleanResult = new Result<>(); + if (businDataTaskVo.getTaskType().equals("7")) { + booleanResult = rcsUtil.callAGV(taskId, agvTaskType, points, businDataTaskVo.getToRow(), agvno); + } else { + booleanResult = rcsUtil.callAGV(taskId, agvTaskType, points, businDataTaskVo.getToRow()); + log.error("入库呼叫AGV任务号:" + taskId + " 结果:" + booleanResult.getCode() + "返回信息:" + booleanResult.getMsg()); } - if (booleanResult.getCode() == HttpStatus.ERROR.getCode()){ + if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { BusinDataTask businDataTask = new BusinDataTask(); businDataTask.setId(businDataTaskVo.getId()); businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); @@ -2060,12 +2061,12 @@ public class ScheduledTasks { } //呼叫AGV成功 - if (booleanResult.getCode()== HttpStatus.SUCCESS.getCode()) { + if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { businDataTaskVo.setTaskPath(toLocation); businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); //生成入库单 - if (randome.equals("P01")){ + if (randome.equals("P01")) { Result stringResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); //生成入库单成功 diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java index 304f5e1..2205721 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java @@ -141,7 +141,7 @@ public class BusinPickupServiceImpl extends ServiceImpl businPickupList = businPickupMapper.selectList(pickupQueryWrapper); if (businPickupList.size() > 0) { BusinPickup businPickup = businPickupList.get(0); + log.info("空治具回库时,释放码头点位信息:"+JsonUtil.toJSONString(businPickup)); BasePoint basePoint = iBasePointService.selectBasePointById(Long.valueOf(businPickup.getPointNo())); basePoint.setIsActive("1"); basePoint.setIsOccupy("0"); @@ -677,8 +678,6 @@ public class RCSUtil { //更新任务数据 List collect = agvMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(e -> e.getKey()).collect(Collectors.toList()); - //log.error(collect.get(collect.size() - 1)); - log.error(bo.getSn()); businDataTask.setAgvNo(bo.getRobotId()); businDataTask.setUpdateTime(DateUtils.getNowDate());