| | |
| | | for (BasContainer container : containers) { |
| | | String codeType = container.getCodeType(); // 获取正则表达式 |
| | | if (barcode.matches(codeType)) { // 判断条码是否符合这个正则 |
| | | List<String> areaList2 = JSONObject.parseArray(container.getAreas(), String.class); |
| | | if (!areaList2.contains(area)) { |
| | | List<Integer> areaList2 = container.getAreas(); |
| | | if (!areaList2.contains(Integer.parseInt(area))) { |
| | | matches2 = false; |
| | | continue; |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized R generateTasks(PdaGeneralParam param, Long loginUserId) { |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getSite,param.getTransferStationNo()).orderByDesc(DeviceSite::getId),false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | // DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getSite,param.getTransferStationNo()).orderByDesc(DeviceSite::getId),false); |
| | | // if (Objects.isNull(deviceSite)) { |
| | | // throw new CoolException("站点不存在!!"); |
| | | // } |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, param.getTransferStationNo())); |
| | | if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("站点不存在或站点不处于空库状态!!"); |
| | | } |
| | | DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite())); |
| | | DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(station.getStationName())); |
| | | if (Cools.isEmpty(deviceBind)) { |
| | | throw new CoolException("库位规则未知"); |
| | | } |
| | | WarehouseAreas warehouseArea = warehouseAreasService.getById(deviceBind.getTypeId()); |
| | | if (Cools.isEmpty(warehouseArea)) { |
| | | throw new CoolException("未找到所属库区信息"); |
| | | } |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, station.getStationName()) |
| | | .eq(DeviceSite::getAreaIdEnd, warehouseArea.getId()) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPITY_IN.type).last("limit 1")); |
| | | if (Cools.isEmpty(deviceSite)) { |
| | | throw new CoolException("无可用路径!!"); |
| | | } |
| | | |
| | | // BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>() |
| | |
| | | .setTaskType(TaskType.TASK_TYPE_EMPITY_IN.type) |
| | | .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)//lsh待修改 |
| | | .setTargLoc(targetLoc) |
| | | .setOrgSite(deviceSite.getSite()) |
| | | .setOrgSite(station.getStationName()) |
| | | .setBarcode(param.getContainerNo()) |
| | | .setTargSite(deviceSite.getDeviceSite()) |
| | | .setTargSite(deviceSite.getDeviceCode()) |
| | | .setCreateBy(loginUserId) |
| | | .setUpdateBy(loginUserId); |
| | | if (!taskService.save(task)) { |
| | | throw new CoolException("任务保存失败!!"); |
| | | } |
| | | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, deviceSite.getSite())); |
| | | if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("站点不存在或站点不处于空库状态!!"); |
| | | } |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | |
| | |
| | | return R.ok("任务生成完毕!"); |
| | | } |
| | | |
| | | @Override |
| | | public R checkAgvStation(PdaGeneralParam param, Long loginUserId) { |
| | | if (Cools.isEmpty(param.getTransferStationNo())) { |
| | | return R.error("无参数"); |
| | | } |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationId, param.getTransferStationNo())); |
| | | if (Cools.isEmpty(basStation)) { |
| | | return R.error("未找到匹配站点"); |
| | | } |
| | | return R.ok(basStation); |
| | | } |
| | | |
| | | } |