1-pbom-升级判断是否有工厂权限

This commit is contained in:
luoliming 2024-08-10 22:28:48 +08:00
parent 04a36e33cb
commit 19bb6ffa39
2 changed files with 13 additions and 2 deletions

View File

@ -164,8 +164,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
return new Page<>();
} else {
String queryFac= StrUtil.isBlank(query.getFacCode())? userRoleService.getUserFactory():query.getFacCode();
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserFactory(), SessionUtil.getDepartRowId(), SessionUtil.getUserCode());
, query.getPageSize()), query, queryFac, SessionUtil.getDepartRowId(), SessionUtil.getUserCode());
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return result;
}
@ -1197,7 +1199,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
@Transactional(rollbackFor = Exception.class)
public void upgrade(Long bomRowId) throws ExecutionException, InterruptedException {
BomNewPbomParentEntity parent = this.getById(bomRowId);
VUtils.isTure(Objects.isNull(parent)).throwMessage("该BOM版本不存在");
VUtils.isTure(parent.getStatus() < PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能发起变更");
//检查当前用户是否有该工厂权限
if(!userRoleService.getUserOfFactory().contains(parent.getFacCode())){
VUtils.isTure(true).throwMessage("您没有该工厂的权限,无法升级");
}
LogRecordContext.putVariable("bom",parent);
PBomUpgrade upgrade = new PBomUpgrade(parent, getAllBom(bomRowId, 0));
upgrade.upgrade();

View File

@ -81,7 +81,11 @@ public class UserRoleService {
if(userMultiplantFacRoleCount>0){
return ImmutableList.of(EBomConstant.MAIN_FACTORY_CODE_1010,EBomConstant.XIAN_TAO_FACTORY_CODE_1020);
}else {
return SessionUtil.getFullDeptName().contains("仙桃公司")? ImmutableList.of(EBomConstant.XIAN_TAO_FACTORY_CODE_1020) : ImmutableList.of(EBomConstant.MAIN_FACTORY_CODE_1010) ;
String dptCde=materialMainService.getBaseMapper().getUserDepartmentDptCode(SessionUtil.getDepartRowId());
if(StrUtil.isNotBlank(dptCde) && dptCde.contains("仙桃公司")){
return ImmutableList.of(EBomConstant.XIAN_TAO_FACTORY_CODE_1020) ;
}
return ImmutableList.of(EBomConstant.MAIN_FACTORY_CODE_1010) ;
}
}