diff --git a/shkj-wms/src/main/java/com/shkj/wms/domain/BusinDataTaskGoods.java b/shkj-wms/src/main/java/com/shkj/wms/domain/BusinDataTaskGoods.java index bcad7bd..bc09ea4 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/domain/BusinDataTaskGoods.java +++ b/shkj-wms/src/main/java/com/shkj/wms/domain/BusinDataTaskGoods.java @@ -69,4 +69,6 @@ public class BusinDataTaskGoods implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; + + private String createBy; } diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java index 76659a7..54eb917 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java @@ -514,91 +514,103 @@ public class BusinDataTaskServiceImpl extends ServiceImpl sysStockDetailVoList =null; - //检查货位是否是双深位 - Result booleanResult = checkIsSleep(baseLocationVo); - if (!Result.isOk(booleanResult)){ - return booleanResult; - } - //确认出库的货位是否有库存信息 - Result> stockListResult = iSysStockDetailService.queryByLocation(baseLocationVo.getId()); - if (Result.isOk(stockListResult)){ - sysStockDetailVoList = stockListResult.getData(); - if (sysStockDetailVoList == null && sysStockDetailVoList.size() ==0 ){ - return Result.err().msg("此货位未查询到保险杠信息,请确认!"+locationCode); + try { + BaseLocationVo baseLocationVo = iBaseLocationService.queryLocationByCode(locationCode); + if (baseLocationVo == null){ + return Result.err().msg("未查询到货位信息,请确认!"+locationCode); + } + if (baseLocationVo.getLocationStatus().equals("4") || baseLocationVo.getLocationStatus().equals("0")){ + return Result.err().msg("此货位出库中或已出库,请确认!"+locationCode+" 库位状态:"+baseLocationVo.getLocationStatus()); + } + List sysStockDetailVoList =null; + //检查货位是否是双深位 + Result booleanResult = checkIsSleep(baseLocationVo); + if (!Result.isOk(booleanResult)){ + return booleanResult; + } + //确认出库的货位是否有库存信息 + Result> stockListResult = iSysStockDetailService.queryByLocation(baseLocationVo.getId()); + if (Result.isOk(stockListResult)){ + sysStockDetailVoList = stockListResult.getData(); + if (sysStockDetailVoList == null && sysStockDetailVoList.size() ==0 ){ + return Result.err().msg("此货位未查询到保险杠信息,请确认!"+locationCode); + } } - } - //预占库存 - baseLocationVo.setLocationStatus("4"); - BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); - iBaseLocationService.updateById(baseLocation); - - //需要搬运到的码头信息 - String toPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_out_point); - String[] toPoints = toPoint.split("、"); - - List pointList = iBasePointService.list(new LambdaQueryWrapper() - .in(BasePoint::getPointNo, toPoints) - .eq(BasePoint::getIsOccupy,"0") - ); - String taskPath=""; - if (pointList !=null && pointList.size()>0){ - taskPath=pointList.get(0).getPointNo(); - } - if (StringUtils.isEmpty(taskPath)){ - return Result.err().msg("搬运码头无空闲,不可出库"); - } - //生成作业任务 - int index=0; - List taskGoodsList = new ArrayList<>(); - List sysStockDetails = new ArrayList<>(); - for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) { - Long taskId=0L; - if(index ==0) { - BusinDataTask task = new BusinDataTask(); - task.setTaskType(TaskTypeEnum.named_loc.getValue()); - task.setPriority("2"); - task.setIsTop("0"); - task.setBatch(sysStockDetailVo.getBatch()); - task.setTaskStatus(TaskStatusEnum.wait_put.getValue()); - task.setIsUrgent("0"); - task.setCreateTime(DateUtils.getNowDate()); - task.setTaskPath(taskPath); - task.setDistinction("1"); - task.setContainerId(sysStockDetailVo.getContainerCode()); - task.setFromRow(baseLocationVo.getLocationRow()); - task.setFromLayer(baseLocationVo.getLayer()); - task.setFromColumn(baseLocationVo.getLocationColumn()); - task.setTunnel(baseLocationVo.getTunnel()); - businDataTaskMapper.insertBusinDataTask(task); - taskId = task.getId(); - index++; + + //需要搬运到的码头信息 + String toPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_out_point); + String[] toPoints = toPoint.split("、"); + + List pointList = iBasePointService.list(new LambdaQueryWrapper() + .in(BasePoint::getPointNo, toPoints) + .eq(BasePoint::getIsOccupy,"0") + .eq(BasePoint::getIsActive,"1") + ); + String taskPath=""; + if (pointList !=null && pointList.size()==0){ + return Result.err().msg("搬运码头无空闲,不可出库"); } - //保险杠信息 - BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); - taskGoods.setGoodsNo(sysStockDetailVo.getGoodsNo()); - taskGoods.setTaskCode(taskId); - taskGoods.setIsPunching(sysStockDetailVo.getIsPuch()); - taskGoods.setBranchId(SecurityUtils.getCurrentBranchId()); - taskGoodsList.add(taskGoods); + BasePoint basePoint = pointList.get(0); + taskPath= basePoint.getPointNo(); + //预占码头信息 + basePoint.setIsOccupy("1"); + iBasePointService.updateBasePoint(basePoint); + //预占库存 + baseLocationVo.setLocationStatus("4"); + BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); + iBaseLocationService.updateById(baseLocation); + //生成作业任务 + int index=0; + List taskGoodsList = new ArrayList<>(); + List sysStockDetails = new ArrayList<>(); + Long taskId=0L; + for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) { + if(index ==0) { + BusinDataTask task = new BusinDataTask(); + task.setTaskType(TaskTypeEnum.named_loc.getValue()); + task.setPriority("2"); + task.setIsTop("0"); + task.setBatch(sysStockDetailVo.getBatch()); + task.setTaskStatus(TaskStatusEnum.wait_put.getValue()); + task.setIsUrgent("0"); + task.setCreateTime(DateUtils.getNowDate()); + task.setTaskPath(taskPath); + task.setDistinction("1"); + task.setContainerId(sysStockDetailVo.getContainerCode()); + task.setFromRow(baseLocationVo.getLocationRow()); + task.setFromLayer(baseLocationVo.getLayer()); + task.setFromColumn(baseLocationVo.getLocationColumn()); + task.setTunnel(baseLocationVo.getTunnel()); + task.setLocationId(baseLocationVo.getId()); + this.save(task); + taskId = task.getId(); + index++; + } - //出库预占 - sysStockDetailVo.setOutQty(sysStockDetailVo.getQty().intValue()); - SysStockDetail sysStockDetail = BeanUtil.toBean(sysStockDetailVo, SysStockDetail.class); - sysStockDetail.setOutTime(DateUtils.getNowDate()); - sysStockDetails.add(sysStockDetail); + //保险杠信息 + BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); + taskGoods.setGoodsNo(sysStockDetailVo.getGoodsNo()); + taskGoods.setQrCode(sysStockDetailVo.getQrCode()); + taskGoods.setTaskCode(taskId); + taskGoods.setIsPunching(sysStockDetailVo.getIsPuch()); + taskGoods.setBranchId(SecurityUtils.getCurrentBranchId()); + taskGoods.setCreateBy(SecurityUtils.getUsername()); + taskGoodsList.add(taskGoods); + + //出库预占 + sysStockDetailVo.setOutQty(sysStockDetailVo.getQty().intValue()); + SysStockDetail sysStockDetail = BeanUtil.toBean(sysStockDetailVo, SysStockDetail.class); + sysStockDetail.setOutTime(DateUtils.getNowDate()); + sysStockDetails.add(sysStockDetail); + } + iSysStockDetailService.updateBatchById(sysStockDetails); + return iBusinDataTaskGoodsService.saveBatch(taskGoodsList)?Result.ok():Result.err().msg("指定货位出库失败"); + }catch (Exception e){ + log.error("指定货位出库失败:"+e.getMessage()); + return Result.err().msg("指定货位出库失败"); } - iSysStockDetailService.updateBatchById(sysStockDetails); - return iBusinDataTaskGoodsService.saveBatch(taskGoodsList)?Result.ok():Result.err().msg("指定货位出库失败"); } @Override