| | |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | |
| | | import org.jeecg.modules.dnc.entity.*; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.apache.commons.collections4.ListUtils; |
| | | |
| | |
| | | b = partsPermissionService.save(permission); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | //添加默认工序 |
| | | ProcessStream processStream = new ProcessStream(); |
| | | processStream.setProductId(partsInfo.getProductId()); |
| | | processStream.setComponentId(partsInfo.getComponentId()); |
| | | processStream.setPartsId(partsInfo.getPartsId()); |
| | | processStream.setProcessCode("1"); |
| | | b = processStreamService.save(processStream); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | // if(!b) |
| | | // ExceptionCast.cast(CommonCode.FAIL); |
| | | //添加用户权限 |
| | | PermissionStream stream = new PermissionStream(); |
| | | stream.setProductId(partsInfo.getProductId()); |
| | | stream.setComponentId(partsInfo.getComponentId()); |
| | | stream.setPartsId(partsInfo.getPartsId()); |
| | | stream.setUserId(userId); |
| | | //添加日志 |
| | | NcLogInfo ncLogInfogx = new NcLogInfo(); |
| | | //模块 |
| | | ncLogInfogx.setModuleInfo("产品结构树"); |
| | | //类型 |
| | | ncLogInfogx.setOperateType(2); |
| | | //日志内容 |
| | | ncLogInfogx.setLogContent("零件名称:"+partsInfo.getPartsName()+"生成默认工序,工序号:"+processStream.getProcessCode()); |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfogx); |
| | | // //添加日志 |
| | | // NcLogInfo ncLogInfogx = new NcLogInfo(); |
| | | // //模块 |
| | | // ncLogInfogx.setModuleInfo("产品结构树"); |
| | | // //类型 |
| | | // ncLogInfogx.setOperateType(2); |
| | | // //日志内容 |
| | | // ncLogInfogx.setLogContent("零件名称:"+partsInfo.getPartsName()+"生成默认工序,工序号:"+processStream.getProcessCode()); |
| | | // iNcLogInfoService.saveLogNcInfos(ncLogInfogx); |
| | | return permissionStreamService.save(stream); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList) { |
| | | public boolean assignAddDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) { |
| | | if(partsInfo == null || departmentList == null || departmentList.isEmpty()) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | List<PartsDepartment> partsDepartments = new ArrayList<>(); |
| | | List<PermissionStream> permissionStreamList = new ArrayList<>(); |
| | | departmentList.forEach(item -> { |
| | | PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); |
| | | PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId()); |
| | | if(en == null) { |
| | | en = new PartsDepartment(); |
| | | en.setDepartId(item.getDepartId()); |
| | | en.setDepartId(item.getId()); |
| | | en.setPartsId(partsInfo.getPartsId()); |
| | | partsDepartments.add(en); |
| | | } |
| | | PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId()); |
| | | PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), |
| | | partsInfo.getPartsId(), item.getId()); |
| | | if(stream == null) { |
| | | stream = new PermissionStream(); |
| | | stream.setDepartId(item.getDepartId()); |
| | | stream.setDepartId(item.getId()); |
| | | stream.setProductId(partsInfo.getProductId()); |
| | | stream.setComponentId(partsInfo.getComponentId()); |
| | | stream.setPartsId(partsInfo.getPartsId()); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList) { |
| | | public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) { |
| | | if(partsInfo == null || departmentList == null || departmentList.isEmpty()) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | List<PartsDepartment> partsDepartments = new ArrayList<>(); |
| | | List<PermissionStream> permissionStreamList = new ArrayList<>(); |
| | | departmentList.forEach(item -> { |
| | | PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); |
| | | PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId()); |
| | | if(en != null) { |
| | | partsDepartments.add(en); |
| | | } |
| | | PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId()); |
| | | PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), |
| | | partsInfo.getPartsId(), item.getId()); |
| | | if(stream != null) { |
| | | permissionStreamList.add(stream); |
| | | } |