| | |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.PakinIOStatus; |
| | | import com.vincent.rsf.server.manager.enums.StationTypeEnum; |
| | | import com.vincent.rsf.server.manager.enums.TaskType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.service.impl.DeviceSiteServiceImpl; |
| | | import com.vincent.rsf.server.manager.utils.LocManageUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private BasContainerService basContainerService; |
| | | @Autowired |
| | | private DeviceSiteServiceImpl deviceSiteService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | //生成任务 |
| | | AGVInTaskStart(waitPakinPda, loginUserId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R AGVBindAndInTaskStart(String barcode) { |
| | | //验证条码 |
| | | boolean b = checkStaStatus(barcode); |
| | | if (!b) { |
| | | return R.error("条码未找到对应规则"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean AGVBindAndInTaskStart(String barcode, String sta) { |
| | | //验证条码 |
| | | checkStaStatus(barcode,sta); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | String sta = waitPakinPda.getStaNo(); |
| | | String area = waitPakinPda.getArea(); |
| | | if (Cools.isEmpty(sta)) { |
| | | throw new CoolException("接驳位条码不能为空"); |
| | | throw new CoolException("起点不能为空"); |
| | | } |
| | | if (Cools.isEmpty(area)) { |
| | | throw new CoolException("目标库区不能为空"); |
| | | } |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, sta) |
| | | .eq(DeviceSite::getAreaIdEnd, Long.parseLong(area)) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_IN.type).last("limit 1")); |
| | | if (Cools.isEmpty(deviceSite)) { |
| | | throw new CoolException("无可用路径!!"); |
| | | } |
| | | |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, sta) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | ); |
| | | if (Cools.isEmpty(basStation)) { |
| | | throw new CoolException("未找到接驳站点信息,请检查站点状态"); |
| | | throw new CoolException("未找到起点站点信息,请检查站点状态"); |
| | | } |
| | | if (Cools.isEmpty(basStation.getBarcode())) { |
| | | throw new CoolException("数据错误,接驳站无条码信息"); |
| | |
| | | } |
| | | String targetLoc = LocManageUtil.getTargetLoc(Long.parseLong(area)); |
| | | |
| | | taskService.generateAGVTasks(waitPakin, targetLoc, sta, loginUserId); |
| | | taskService.generateAGVTasks(waitPakin, targetLoc, sta, deviceSite.getTarget(),loginUserId); |
| | | |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!basStationService.updateById(basStation)) { |
| | |
| | | throw new CoolException("容器码不能为空"); |
| | | } |
| | | if (Cools.isEmpty(sta)) { |
| | | throw new CoolException("接驳位条码不能为空"); |
| | | throw new CoolException("站点信息不能为空"); |
| | | } |
| | | WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, barcode) |
| | | .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) |
| | | ); |
| | | if (Cools.isEmpty(waitPakin)) { |
| | | throw new CoolException("容器码未找到组托信息,请检查组托状态"); |
| | | } |
| | | |
| | | BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getBarcode, barcode) |
| | | , false |
| | |
| | | ); |
| | | if (Cools.isEmpty(basStation)) { |
| | | throw new CoolException("未找到站点信息"); |
| | | } |
| | | if (!basStation.getUseStatus().equals("O")) { |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | if (!Cools.isEmpty(basStation.getContainerType())) { |
| | | List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class); |
| | |
| | | break; // 找到匹配的就退出循环 |
| | | } |
| | | } |
| | | // boolean matches = containers.stream() |
| | | // .map(BasContainer::getCodeType) |
| | | // .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | } |
| | |
| | | if (!basStation.getUseStatus().equals("O")) { |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | if (basStation.getType().equals(StationTypeEnum.STATION_TYPE_MUTI.type)) { |
| | | throw new CoolException("站点为光电站点,禁止呼叫AGV"); |
| | | } |
| | | |
| | | List<String> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), String.class); |
| | | if (!areaList.contains(area)) { |
| | |
| | | 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.valueOf(area))) { |
| | | matches2 = false; |
| | | continue; |
| | | } |
| | |
| | | throw new CoolException("查询到的容器不支持目标库区"); |
| | | } |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | throw new CoolException("容器与站点不匹配"); |
| | | } |
| | | } else { |
| | | throw new CoolException("数据异常:验证基础信息"); |
| | |
| | | |
| | | return basStation; |
| | | } |
| | | private boolean checkStaStatus(String barcode) { |
| | | if (Cools.isEmpty(barcode)) { |
| | | throw new CoolException("容器码不能为空"); |
| | | } |
| | | WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, barcode) |
| | | .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) |
| | | ); |
| | | if (Cools.isEmpty(waitPakin)) { |
| | | throw new CoolException("容器码未找到组托信息,请检查组托状态"); |
| | | } |
| | | BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getBarcode, barcode) |
| | | , false |
| | | ); |
| | | if (!Cools.isEmpty(isBarcodeSta)) { |
| | | throw new CoolException("该条码已被" + isBarcodeSta.getStationName() + "站绑定"); |
| | | } |
| | | |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>()); |
| | | boolean matches = false; |
| | | for (BasContainer container : containers) { |
| | | String codeType = container.getCodeType(); // 获取正则表达式 |
| | | if (barcode.matches(codeType)) { // 判断条码是否符合这个正则 |
| | | matches = true; |
| | | return true; |
| | | } |
| | | } |
| | | // boolean matches = containers.stream() |
| | | // .map(BasContainer::getCodeType) |
| | | // .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } |