| | |
| | | @Autowired |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IProductMixService productMixService; |
| | | @Autowired |
| | | private IDocRelativeService iDocRelativeService; |
| | |
| | | boolean b = super.updateById(componentInfo); |
| | | //同步修改结构树 |
| | | ProductMix productMix = productMixService.getById(Long.parseLong(id)); |
| | | productMix.setName(componentInfo.getComponentName()); |
| | | productMix.setCode(componentInfo.getComponentCode()); |
| | | productMix.setTreeName(componentInfo.getComponentName()); |
| | | productMix.setTreeCode(componentInfo.getComponentCode()); |
| | | productMixService.updateById(productMix); |
| | | if(!b) |
| | | return false; |
| | |
| | | List<String> id =new ArrayList<>(); |
| | | id.add(treeInfoRequest.getAttributionId()); |
| | | treeInfoRequest.setComponentIds(id); |
| | | //零件 |
| | | List<DocInfo> partsInfos = partsInfoService.getByPartsInfo(treeInfoRequest); |
| | | docInfos.addAll(partsInfos); |
| | | //工艺规程版本 |
| | | List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest); |
| | | docInfos.addAll(processSpecVersions); |
| | | //工序 |
| | | List<DocInfo> processStreams = processStreamService.getByProcessStreamOtherFile(treeInfoRequest); |
| | | docInfos.addAll(processStreams); |
| | | //工步 |
| | | List<DocInfo> workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest); |
| | | docInfos.addAll(workSteps); |
| | | } |
| | | return docInfos; |
| | | } |
| | |
| | | List<Long> ids = productMixList.stream().map(ProductMix::getId).collect(Collectors.toList()); |
| | | //获取已经自身被借用的部件 |
| | | LambdaQueryWrapper<ComponentInfo> borrowQueryWrapper = new LambdaQueryWrapper<>(); |
| | | borrowQueryWrapper.in(ComponentInfo::getBorrowId,ids); |
| | | if (!ids.isEmpty()){ |
| | | borrowQueryWrapper.in(ComponentInfo::getBorrowId,ids); |
| | | } |
| | | borrowQueryWrapper.eq(ComponentInfo::getParentId,componentInfo.getComponentId()); |
| | | List<String> borrowIds= super.list(borrowQueryWrapper).stream().map(ComponentInfo::getBorrowId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentName()),ComponentInfo::getComponentName, componentInfo.getComponentName()); |
| | | queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentCode()),ComponentInfo::getComponentCode, componentInfo.getComponentCode()); |
| | | queryWrapper.isNull(ComponentInfo::getBorrowId); |
| | | queryWrapper.in(ComponentInfo::getComponentId,ids); |
| | | if (!ids.isEmpty()){ |
| | | queryWrapper.in(ComponentInfo::getComponentId,ids); |
| | | } |
| | | queryWrapper.ne(StrUtil.isNotEmpty(oldComponentInfo.getBorrowId()),ComponentInfo::getComponentId,oldComponentInfo.getBorrowId()); |
| | | if (!borrowIds.isEmpty()) { |
| | | queryWrapper.notIn(ComponentInfo::getComponentId,borrowIds); |
| | |
| | | }); |
| | | return Result.ok("部件借用成功"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean assignPermission(Object entity, Collection<SysUser> userList, boolean isAdd){ |
| | | if (isAdd) { |
| | | return assignAddUser((ComponentInfo) entity, userList); |
| | | } else { |
| | | return assignRemoveUser((ComponentInfo) entity, userList); |
| | | } |
| | | } |
| | | @Override |
| | | public boolean assignDepartPermission(Object entity, Collection<MdcProduction> departments, boolean isAdd) { |
| | | if (isAdd) { |
| | | return assignAddDepart((ComponentInfo) entity, departments); |
| | | } else { |
| | | return assignRemoveDepart((ComponentInfo) entity, departments); |
| | | } |
| | | } |
| | | } |