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 2205721..b1470d3 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 @@ -179,13 +179,13 @@ public class BusinPickupServiceImpl extends ServiceImpl baseLocationVos = baseLocationMapper.getLocationByAreaId(abnormalArea); if(baseLocationVos.size()<=0){ //待补货区已满查询缓冲区是否还有货位 - Long bufferArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area)); - baseLocationVos = baseLocationMapper.getLocationByAreaId(bufferArea); + Long bufferArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area)); + baseLocationVos = baseLocationMapper.getLocationByAreaId(bufferArea); } if (baseLocationVos.size()<=0){ return Result.err().msg("缓冲区也没有货位了,报警报警"); @@ -289,7 +289,7 @@ public class BusinPickupServiceImpl extends ServiceImpl booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(bo.getPointNo(), bo.getContainerId(), agvno,null); if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { @@ -416,7 +416,7 @@ public class BusinPickupServiceImpl extends ServiceImpl0){ for (SysStockDetail sysStockDetail : sysStockDetailList) { SysStockDetail byId = iSysStockDetailService.getById(sysStockDetail.getId()); @@ -643,8 +643,8 @@ public class BusinPickupServiceImpl extends ServiceImpl businDataTaskList = businDataTaskService.list(new LambdaQueryWrapper() - .eq(BusinDataTask::getTaskStatus,TaskStatusEnum.four_out.getValue()) - .eq(BusinDataTask::getTaskType,TaskTypeEnum.thirteen_out.getValue())); + .eq(BusinDataTask::getTaskStatus,TaskStatusEnum.four_out.getValue()) + .eq(BusinDataTask::getTaskType,TaskTypeEnum.thirteen_out.getValue())); List taskList= new ArrayList<>(); if (businDataTaskList.size()>0) { businDataTaskList.stream().forEach(e -> { @@ -769,38 +769,82 @@ public class BusinPickupServiceImpl extends ServiceImpl pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo); - if (Result.isOk(pickupRecordesult)){ - //取货成功 - //减去任务数 - // 判断是前杠还是后杠,进行处理 redis 中的任务数 - //小组装等待点位为一个 - //String assemblePointType = RedisConstant.assemblePointBeforeTaskCount; - - String assemblePointType = RedisConstant.assemblePointAfterTaskCount; - if (buttonType.equals("front")) { - assemblePointType = RedisConstant.assemblePointBeforeTaskCount; + //Result pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo); + BusinDataTask DataTask = businDataTaskService.getOne(new LambdaQueryWrapper() + .eq(BusinDataTask::getId, businPickupAddBo.getTaskCode()) + .last("limit 1")); + String agvno=DataTask.getAgvNo(); + String point = DataTask.getTaskPath(); + log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId()); + log.info("传入的起点为:"+point); + if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("xzz:" + DataTask.getId())) + && redisTemplate.opsForValue().get("xzz:" + DataTask.getId()).toString().equals(agvno)){ + log.info("任务号为:"+DataTask.getId()+"agv号为"+agvno+"小组装已经释放,不允许重复释放"); + return Result.ok(); + } + if (ObjectUtils.isEmpty(businPickupAddBo.getContainerId())){ + businPickupAddBo.setContainerId(0L); + } + iBusinEnptyContainerService.emptyContainerFlowDir(point, businPickupAddBo.getContainerId(), agvno, null); + redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno); + DataTask.setTaskStatus("2"); + businDataTaskService.updateById(DataTask); + String assemblePointType = RedisConstant.assemblePointAfterTaskCount; + if (buttonType.equals("front")) { + assemblePointType = RedisConstant.assemblePointBeforeTaskCount; + } + if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) { + int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); + if (temp > 0) { + redisTemplate.opsForValue().set(assemblePointType, --temp); } - if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) { - int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); - if (temp > 0) { - redisTemplate.opsForValue().set(assemblePointType, --temp); - } + } + if ("4".equals(DataTask.getTaskType())||"14".equals(DataTask.getTaskType())) { + //查询任务对应的产品数量 + List businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(DataTask.getId()); + //根据过点时间,回填出库队列中的状态为已出库 + BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0); + if (goodsVo != null) { + Date traverseDate = goodsVo.getTraverseDate(); + BaseBarcodesOut baseBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper() + .eq(BaseBarcodesOut::getTraverseDate, traverseDate) + ); + baseBarcodesOut.setOutStatus("3"); + baseBarcodesOut.setOutDate(DateUtils.getDate()); + iBaseBarcodesOutService.updateById(baseBarcodesOut); } - + } +// if (Result.isOk(pickupRecordesult)){ +// //取货成功 +// //减去任务数 +// // 判断是前杠还是后杠,进行处理 redis 中的任务数 +// //小组装等待点位为一个 +// //String assemblePointType = RedisConstant.assemblePointBeforeTaskCount; +// +// String assemblePointType = RedisConstant.assemblePointAfterTaskCount; // if (buttonType.equals("front")) { -// redisTemplate.delete(RedisConstant.redisAssemblyLineFront); -// TaskwriteMap.put(frontType, "False"); -// taskidMap.put(frontAddress, TaskwriteMap); -// } else { -// redisTemplate.delete(RedisConstant.redisAssemblyLineAfter); -// TaskwriteMap.put(rearType, "False"); -// taskidMap.put(rearAddress, TaskwriteMap); +// assemblePointType = RedisConstant.assemblePointBeforeTaskCount; +// } +// if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) { +// int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); +// if (temp > 0) { +// redisTemplate.opsForValue().set(assemblePointType, --temp); +// } // } // -// Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); -// log.error("出库放行点写入是否成功:" + aBoolean + "写入的相关数据为:" + taskidMap.toString()); - } +//// if (buttonType.equals("front")) { +//// redisTemplate.delete(RedisConstant.redisAssemblyLineFront); +//// TaskwriteMap.put(frontType, "False"); +//// taskidMap.put(frontAddress, TaskwriteMap); +//// } else { +//// redisTemplate.delete(RedisConstant.redisAssemblyLineAfter); +//// TaskwriteMap.put(rearType, "False"); +//// taskidMap.put(rearAddress, TaskwriteMap); +//// } +//// +//// Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); +//// log.error("出库放行点写入是否成功:" + aBoolean + "写入的相关数据为:" + taskidMap.toString()); +// } return Result.err().msg("出库取货失败"); }