Compare commits

...

6 Commits

Author SHA1 Message Date
shusir
56eb717371 fix:存放位置数据权限调整 2026-03-26 10:26:59 +08:00
shusir
b93a5741a1 fix:物料盘点出入库因事务将private改为public 2026-03-26 10:22:57 +08:00
YBP
0f288f65a4 添加管理员角色常量 2026-03-26 09:52:19 +08:00
shusir
9244510903 Merge remote-tracking branch 'origin/test' into test 2026-03-25 18:08:52 +08:00
shusir
4fa4371f0c fix:物料抽象出实例的入库方法 2026-03-25 18:08:06 +08:00
YBP
f09bb8f904 文件记录-重构-通用申请流程 2026-03-25 18:03:25 +08:00
55 changed files with 631 additions and 961 deletions

View File

@@ -24,4 +24,6 @@ public interface QmsPermissionConstant {
String SAMPLE_WAREHOUSE_ADMIN = "sample_warehouse_admin"; //样品库管理员 String SAMPLE_WAREHOUSE_ADMIN = "sample_warehouse_admin"; //样品库管理员
String DEVICE_MANAGER = "qms_device_manager"; //设备管理员 String DEVICE_MANAGER = "qms_device_manager"; //设备管理员
String ADMIN_ROLE = "ytjyAdmin"; // 超级管理员 标识
} }

View File

@@ -61,6 +61,9 @@ public class ConfigWarehouseLocationPageReqVO extends PageParam {
@Schema(description = "查询时进行权限过滤") @Schema(description = "查询时进行权限过滤")
private String permissionFilterFlag; private String permissionFilterFlag;
@Schema(description = "是否为管理员-可查看全部数据")
private Boolean adminFlag;
@Schema(description = "查询用-权限角色") @Schema(description = "查询用-权限角色")
private Set<Long> roleIds; private Set<Long> roleIds;

View File

@@ -16,6 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 存放位置 Mapper * 存放位置 Mapper
@@ -29,9 +30,7 @@ public interface ConfigWarehouseLocationMapper extends BaseMapperX<ConfigWarehou
MPJLambdaWrapperX<ConfigWarehouseLocationDO> wrapper = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<ConfigWarehouseLocationDO> wrapper = new MPJLambdaWrapperX<>();
//仓库 //仓库
wrapper.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId) wrapper.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId);
// 权限
.leftJoin(ConfigPermissionDO.class, ConfigPermissionDO::getSourceId, ConfigWarehouseLocationDO::getId);
wrapper.selectAll(ConfigWarehouseLocationDO.class) wrapper.selectAll(ConfigWarehouseLocationDO.class)
.selectAs(ConfigWarehouseLocationParDO::getName, ConfigWarehouseLocationRespVO::getWarehouseName) .selectAs(ConfigWarehouseLocationParDO::getName, ConfigWarehouseLocationRespVO::getWarehouseName)
.selectAs(ConfigWarehouseLocationParDO::getCode, ConfigWarehouseLocationRespVO::getWarehouseCode) .selectAs(ConfigWarehouseLocationParDO::getCode, ConfigWarehouseLocationRespVO::getWarehouseCode)
@@ -48,12 +47,19 @@ public interface ConfigWarehouseLocationMapper extends BaseMapperX<ConfigWarehou
.eqIfPresent(ConfigWarehouseLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(ConfigWarehouseLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigWarehouseLocationDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(ConfigWarehouseLocationDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigWarehouseLocationDO::getRemark, reqVO.getRemark()) .eqIfPresent(ConfigWarehouseLocationDO::getRemark, reqVO.getRemark())
// 角色权限 ;
.and(CollUtil.isNotEmpty(reqVO.getRoleIds()), wrapper1 -> Boolean adminFlag = reqVO.getAdminFlag();
wrapper1.in(ConfigPermissionDO::getTargetId, reqVO.getRoleIds()) // 角色权限 - 使用 exists 子查询
.or() if (adminFlag == null || !adminFlag && CollUtil.isNotEmpty(reqVO.getRoleIds())) {
.eqIfExists(ConfigWarehouseLocationDO::getCreator, SecurityFrameworkUtils.getLoginUserId())) String roleIdsStr = reqVO.getRoleIds().stream()
.orderByDesc(ConfigWarehouseLocationDO::getSortNo); .map(String::valueOf)
.collect(Collectors.joining(","));
wrapper.and(wrapper1 ->
wrapper1.exists("SELECT 1 FROM t_cfg_perm WHERE t_cfg_perm.SRC_ID = t.ID AND t_cfg_perm.deleted = 0 AND t_cfg_perm.TGT_ID IN (" + roleIdsStr + ")")
);
}
wrapper.orderByDesc(ConfigWarehouseLocationDO::getSortNo);
return selectJoinPage(reqVO, ConfigWarehouseLocationRespVO.class, wrapper); return selectJoinPage(reqVO, ConfigWarehouseLocationRespVO.class, wrapper);
} }

View File

@@ -3,6 +3,7 @@ package com.zt.plat.module.qms.business.config.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.biz.system.permission.PermissionCommonApi;
import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO;
@@ -12,6 +13,7 @@ import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocat
import com.zt.plat.module.qms.enums.QmsPermissionConstant; import com.zt.plat.module.qms.enums.QmsPermissionConstant;
import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant; import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant;
import com.zt.plat.module.system.api.permission.PermissionApi; import com.zt.plat.module.system.api.permission.PermissionApi;
import com.zt.plat.module.system.api.permission.RoleApi;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@@ -45,6 +47,8 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati
@Autowired @Autowired
private PermissionApi permissionApi; private PermissionApi permissionApi;
@Autowired
private PermissionCommonApi permissionCommonApi;
@Override @Override
public ConfigWarehouseLocationRespVO save(ConfigWarehouseLocationSaveReqVO reqVo) { public ConfigWarehouseLocationRespVO save(ConfigWarehouseLocationSaveReqVO reqVo) {
@@ -182,6 +186,8 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati
// 获取当前用户角色 // 获取当前用户角色
CommonResult<Set<Long>> userRoleIds = permissionApi.getUserRoleIdListByUserId(SecurityFrameworkUtils.getLoginUserId()); CommonResult<Set<Long>> userRoleIds = permissionApi.getUserRoleIdListByUserId(SecurityFrameworkUtils.getLoginUserId());
pageReqVO.setRoleIds(userRoleIds.getData()); pageReqVO.setRoleIds(userRoleIds.getData());
CommonResult<Boolean> hasAnyRoles = permissionCommonApi.hasAnyRoles(SecurityFrameworkUtils.getLoginUserId(), QmsPermissionConstant.ADMIN_ROLE);
pageReqVO.setAdminFlag(hasAnyRoles.getData());
return configWarehouseLocationMapper.selectPage(pageReqVO); return configWarehouseLocationMapper.selectPage(pageReqVO);
} }

View File

@@ -54,7 +54,7 @@ public interface MaterialInventoryCheckDetailMapper extends BaseMapperX<Material
.eqIfPresent(MaterialInventoryCheckDetailDO::getDisposalMethod, reqVO.getDisposalMethod()) .eqIfPresent(MaterialInventoryCheckDetailDO::getDisposalMethod, reqVO.getDisposalMethod())
.eqIfPresent(MaterialInventoryCheckDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(MaterialInventoryCheckDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(MaterialInventoryCheckDetailDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MaterialInventoryCheckDetailDO::getCreateTime, reqVO.getCreateTime())
.orderByAsc(MaterialInventoryCheckDetailDO::getPresent) .orderByDesc(MaterialInventoryCheckDetailDO::getPresent)
.orderByDesc(MaterialInventoryCheckDetailDO::getId); .orderByDesc(MaterialInventoryCheckDetailDO::getId);
return selectJoinPage(reqVO, MaterialInventoryCheckDetailRespVO.class, wrapper); return selectJoinPage(reqVO, MaterialInventoryCheckDetailRespVO.class, wrapper);

View File

@@ -9,6 +9,8 @@ import lombok.Getter;
public enum MaterialInboundType { public enum MaterialInboundType {
acceptance_inbound("验收入库"), acceptance_inbound("验收入库"),
hzrd_make_inbound("危化品配置入库"),
check_inbound("盘点入库"); check_inbound("盘点入库");
private final String name; private final String name;
@@ -17,8 +19,8 @@ public enum MaterialInboundType {
this.name = name; this.name = name;
} }
public static MaterialFlowType fromName(String name) { public static MaterialInboundType fromName(String name) {
for (MaterialFlowType type : MaterialFlowType.values()) { for (MaterialInboundType type : MaterialInboundType.values()) {
if (type.getName().equals(name)) { if (type.getName().equals(name)) {
return type; return type;
} }

View File

@@ -149,10 +149,9 @@ public interface MaterialInfomationService {
* *
* @param product 大类信息 * @param product 大类信息
* @param totalOperationQuantity 总操作数量 * @param totalOperationQuantity 总操作数量
* @param productId 大类id
* @return 物料信息 * @return 物料信息
*/ */
MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity, Long productId); MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity);
/** /**
* 批量保存物料信息 - 标准溶液配置生成生成 * 批量保存物料信息 - 标准溶液配置生成生成

View File

@@ -232,13 +232,13 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
} }
@Override @Override
public MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity, Long productId) { public MaterialInfomationDO saveMaterialInfomationByHzrdMtrlMake(MaterialProductDO product, BigDecimal totalOperationQuantity) {
MaterialInfomationDO infomationDO = BeanUtils.toBean(product, MaterialInfomationDO.class); MaterialInfomationDO infomationDO = BeanUtils.toBean(product, MaterialInfomationDO.class);
infomationDO infomationDO
.setId(null) .setId(null)
.setInitialVolume(totalOperationQuantity) .setInitialVolume(totalOperationQuantity)
.setRemainingVolume(totalOperationQuantity) .setRemainingVolume(totalOperationQuantity)
.setProductId(productId) .setProductId(product.getId())
.setCode(this.getInfomationCode(product.getCustomConfig())) .setCode(this.getInfomationCode(product.getCustomConfig()))
.setManufacturerDate(LocalDate.now()) .setManufacturerDate(LocalDate.now())
.setExpirationDate(LocalDate.now().plusDays(product.getDue())) .setExpirationDate(LocalDate.now().plusDays(product.getDue()))

View File

@@ -4,8 +4,9 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -77,4 +78,15 @@ public interface MaterialInventoryInboundService {
* @param inbounds 入库 * @param inbounds 入库
*/ */
void saveBatch(List<MaterialInventoryInboundDO> inbounds); void saveBatch(List<MaterialInventoryInboundDO> inbounds);
/**
* 入库物料实例
*
* @param inbound 入库信息
* @param product 需要入库的大类
* @param totalQuantity 实例的总量
* @param infomations 需要入库的物料实例
* @return 物料实例
*/
List<MaterialInfomationDO> inboundInfomation(MaterialInventoryInboundDO inbound, MaterialProductDO product, BigDecimal totalQuantity, List<MaterialInfomationDO> infomations);
} }

View File

@@ -20,24 +20,16 @@ import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper;
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus; import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
import com.zt.plat.module.qms.resource.material.enums.MaterialInboundType; import com.zt.plat.module.qms.resource.material.enums.MaterialInboundType;
import com.zt.plat.module.system.api.dept.DeptApi;
import com.zt.plat.module.system.api.dept.dto.DeptRespDTO;
import com.zt.plat.module.system.api.user.AdminUserApi;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
@@ -146,6 +138,46 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb
materialInventoryInboundMapper.insertBatch(inbounds); materialInventoryInboundMapper.insertBatch(inbounds);
} }
@Override
public List<MaterialInfomationDO> inboundInfomation(MaterialInventoryInboundDO inboundInfo, MaterialProductDO product, BigDecimal totalOperationQuantity, List<MaterialInfomationDO> infomations) {
MaterialInboundType inboundType = MaterialInboundType.fromName(inboundInfo.getBusinessType());
// 1. 保存入库单
materialInventoryInboundMapper.insert(inboundInfo);
if (inboundType == MaterialInboundType.hzrd_make_inbound) {
MaterialInfomationDO infomation = materialInfomationService.saveMaterialInfomationByHzrdMtrlMake(product, totalOperationQuantity);
MaterialInventoryInboundDetailDO detailDO = new MaterialInventoryInboundDetailDO()
.setInboundId(inboundInfo.getId())
.setMaterialInfomationId(infomation.getId())
.setInboundUserName(inboundInfo.getApplyUser())
.setInboundUserId(inboundInfo.getApplyUserId())
.setInboundDepartmentName(inboundInfo.getApplyDepartment())
.setInboundDepartmentId(inboundInfo.getApplyDepartmentId())
.setInboundTime(LocalDateTime.now())
.setRemark(inboundInfo.getRemark());
materialInventoryInboundDetailService.saveBatch(List.of(detailDO));
return List.of(infomation);
} else if (inboundType == MaterialInboundType.check_inbound) {
// 保存入库明细
List<MaterialInventoryInboundDetailDO> inboundDetails = infomations.stream()
.map(inf -> new MaterialInventoryInboundDetailDO()
.setInboundId(inboundInfo.getId())
.setMaterialInfomationId(inf.getId())
.setInboundUserName(inboundInfo.getApplyUser())
.setInboundUserId(inboundInfo.getApplyUserId())
.setInboundDepartmentName(inboundInfo.getApplyDepartment())
.setInboundDepartmentId(inboundInfo.getApplyDepartmentId())
.setInboundTime(LocalDateTime.now())
.setRemark(inboundInfo.getRemark()))
.toList();
materialInventoryInboundDetailService.saveBatch(inboundDetails);
// 更新物料在库状态
List<Long> infIds = infomations.stream().map(MaterialInfomationDO::getId).toList();
materialInfomationService.updateByIds(infIds, new MaterialInfomationDO().setUsageStatus(0));
}
return List.of();
}
private MaterialInventoryInboundDO getInbound(MaterialInventoryInboundSaveReqVO createReqVO, MaterialBatchDO gongDO) { private MaterialInventoryInboundDO getInbound(MaterialInventoryInboundSaveReqVO createReqVO, MaterialBatchDO gongDO) {
MaterialInventoryInboundDO inbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class); MaterialInventoryInboundDO inbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();

Some files were not shown because too many files have changed in this diff Show More