fix:物料大类的实例配单独的编号规则;
This commit is contained in:
@@ -180,7 +180,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_032_160_000, "试剂耗材不存在");
|
||||
ErrorCode MATERIAL_PRODUCT_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料分类/大类不存在");
|
||||
ErrorCode MATERIAL_PRODUCT_PARENT_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料分类/大类的父类不存在");
|
||||
ErrorCode MATERIAL_PRODUCT_CODE_MODELNO_EXISTED = new ErrorCode(1_032_160_000, "物料大类【编码+型号】重复");
|
||||
ErrorCode MATERIAL_PRODUCT_CODE_SPECIFICATION_EXISTED = new ErrorCode(1_032_160_000, "物料大类【编码+规格】重复");
|
||||
ErrorCode MATERIAL_CATEGORY_EXISTS_CHILDREN = new ErrorCode(1_032_160_000, "分类下含有子分类或物料大类,不可删除");
|
||||
ErrorCode MATERIAL_PRODUCT_EXISTS_BATCH = new ErrorCode(1_032_160_000, "物料大类下存在物料批次,不可删除");
|
||||
ErrorCode MATERIAL_PRODUCTS_EXISTS_CATEGORY = new ErrorCode(1_032_160_000, "物料大类列表中存在分类数据");
|
||||
|
||||
@@ -215,6 +215,7 @@ public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler
|
||||
// 添加到上下文中,避免重复计算
|
||||
loginUser.setContext(QMS_PERMISSION_CONTEXT_KEY, qmsDataPermission);
|
||||
}
|
||||
|
||||
Long ctxDeptId = DeptContextHolder.getDeptId();
|
||||
// 计算有效的部门与自查标记:当存在上下文部门且未被忽略时,强制仅使用该部门,以避免默认全量或空权限分支
|
||||
Set<Long> effectiveDeptIds = qmsDataPermission.getDeptIds();
|
||||
@@ -234,9 +235,10 @@ public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler
|
||||
}
|
||||
|
||||
// 情况二:仅在有效部门集合为空且不可查看自己时,才认为无权限;若上下文提供部门,则跳过该兜底
|
||||
if (CollUtil.isEmpty(effectiveDeptIds) && Boolean.FALSE.equals(effectiveSelf)) {
|
||||
return new EqualsTo(null, null); // WHERE null = null,可以保证返回的数据为空
|
||||
}
|
||||
// TODO 这个逻辑暂时先注释,好像是存在用户角色时,不会设置部门
|
||||
// if (CollUtil.isEmpty(effectiveDeptIds) && Boolean.FALSE.equals(effectiveSelf)) {
|
||||
// return new EqualsTo(null, null); // WHERE null = null,可以保证返回的数据为空
|
||||
// }
|
||||
|
||||
// 情况三,拼接 Dept 和 Company User 的条件,最后组合
|
||||
Expression deptExpression = buildDeptExpression(tableName, deptIdCol, tableAlias, effectiveDeptIds);
|
||||
|
||||
@@ -153,7 +153,7 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
||||
MaterialBatchImportExcelVO.builder()
|
||||
.productName("无水硼砂")
|
||||
.productCode("W11174909")
|
||||
.productModelNo("95%")
|
||||
.productSpecification("95%")
|
||||
.supplier("供应商 1")
|
||||
.manufacturerDate(LocalDate.parse("2026-03-15"))
|
||||
.dueDate(LocalDate.parse("2026-08-11"))
|
||||
@@ -164,7 +164,7 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
||||
MaterialBatchImportExcelVO.builder()
|
||||
.productName("氧化钙")
|
||||
.productCode("W10102372")
|
||||
.productModelNo("AR500g/瓶")
|
||||
.productSpecification("AR")
|
||||
.supplier("供应商 2")
|
||||
.manufacturerDate(LocalDate.parse("2026-04-16"))
|
||||
.dueDate(LocalDate.parse("2026-09-18"))
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.zt.plat.module.qms.resource.material.controller.admin;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.export.MaterialLedgerExportVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.query.MaterialInfomationQueryVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.resp.MaterialInfomationLedgerRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||
import com.zt.plat.module.qms.resource.material.service.MaterialInfomationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -35,6 +41,7 @@ import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Tag(name = "管理后台 - 物料实例")
|
||||
@RestController
|
||||
@RequestMapping("/qms/resource/material-infomation")
|
||||
@@ -126,18 +133,33 @@ public class MaterialInfomationController implements BusinessControllerMarker {
|
||||
}
|
||||
|
||||
@GetMapping("/export-ledger")
|
||||
@Operation(summary = "导出危化品台账")
|
||||
@Operation(summary = "导出台账")
|
||||
public void exportHazardousLedger(@Valid MaterialInfomationPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||
|
||||
// ArrayList<MaterialHazardousLedgerExportVO> exportVOS = getLedgerExportVOS();
|
||||
// 暂时只获取危化品台账
|
||||
pageReqVO.setHazardous(1);
|
||||
PageResult<MaterialInfomationLedgerRespVO> pageResult = materialInfomationService.getMaterialInventoryLedgerPage(pageReqVO);
|
||||
// // 3. 导出 Excel
|
||||
// ComplexExcelUtils.writeHazardousLedger(
|
||||
// response, "危险化学品管理台账.xls", "危险化学品管理台账", exportVOS
|
||||
//
|
||||
// );
|
||||
|
||||
// 导出 Excel
|
||||
List<MaterialInfomationLedgerRespVO> list = pageResult.getList();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
ExcelUtils.write(response, "物料危化品库存台账.xls", "危化品库存台账", MaterialLedgerExportVO.class,
|
||||
BeanUtils.toBean(list, MaterialLedgerExportVO.class));
|
||||
return;
|
||||
}
|
||||
List<MaterialLedgerExportVO> exportVOS = list.stream().map(respVO -> {
|
||||
MaterialLedgerExportVO exportVO = BeanUtils.toBean(respVO, MaterialLedgerExportVO.class);
|
||||
JSONObject productCustomConfig = respVO.getProductCustomConfig();
|
||||
if (productCustomConfig == null) return exportVO;
|
||||
MaterialLedgerExportVO extraProps = productCustomConfig.get("extraProps", MaterialLedgerExportVO.class);
|
||||
if (extraProps == null) return exportVO;
|
||||
BeanUtil.copyProperties(extraProps, exportVO, CopyOptions.create().setIgnoreNullValue(true));
|
||||
return exportVO;
|
||||
}).toList();
|
||||
ExcelUtils.write(response, "物料危化品库存台账.xls", "危化品库存台账",
|
||||
MaterialLedgerExportVO.class,
|
||||
exportVOS);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ public class MaterialBatchRespVO {
|
||||
@ExcelProperty("物料大类编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "物料大类规格")
|
||||
@ExcelProperty("物料大类规格")
|
||||
private String productSpecification;
|
||||
|
||||
@Schema(description = "物料大类型号")
|
||||
@ExcelProperty("物料大类型号")
|
||||
private String productModelNo;
|
||||
@@ -94,6 +98,10 @@ public class MaterialBatchRespVO {
|
||||
@ExcelProperty("供应商id")
|
||||
private Long supplierId;
|
||||
|
||||
@Schema(description = "供应商")
|
||||
@ExcelProperty("供应商")
|
||||
private String supplierName;
|
||||
|
||||
@Schema(description = "生产日期")
|
||||
@ExcelProperty("生产日期")
|
||||
private LocalDateTime manufacturerDate;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class MaterialBatchImportExcelVO {
|
||||
@ExcelProperty("物料编码")
|
||||
private String productCode;
|
||||
|
||||
@ExcelProperty("物料型号")
|
||||
private String productModelNo;
|
||||
@ExcelProperty("物料规格")
|
||||
private String productSpecification;
|
||||
|
||||
@ExcelProperty("供应商")
|
||||
private String supplier;
|
||||
|
||||
@@ -134,6 +134,16 @@ public class MaterialInfomationDO extends BusinessBaseDO {
|
||||
@TableField("MNGR_USER_NAME")
|
||||
private String managerUserName;
|
||||
/**
|
||||
* 所属部门id
|
||||
*/
|
||||
@TableField("BLG_DEPT_ID")
|
||||
private Long belongDepartmentId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("BLG_DEPT_NAME")
|
||||
private String belongDepartmentName;
|
||||
/**
|
||||
* 开封状态,0-未开封,1-已开封
|
||||
*/
|
||||
@TableField("OPN_STS")
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierDO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||
@@ -48,7 +49,7 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
||||
.orderByDesc(MaterialBatchDO::getId));
|
||||
}
|
||||
|
||||
@QmsPermission(moduleDataRoleCodes = "ytjyAdmin", deptIdColumn = "ASN_DEPT_ID")
|
||||
@QmsPermission(deptIdColumn = "ASN_DEPT_ID")
|
||||
default PageResult<MaterialBatchRespVO> selectPageWithPdtInfo(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
|
||||
|
||||
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
|
||||
@@ -56,14 +57,17 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
||||
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
|
||||
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
|
||||
.selectAs(MaterialProductDO::getStandardCapacity, MaterialBatchRespVO::getStandardCapacity)
|
||||
.selectAs(MaterialProductDO::getSpecification, MaterialBatchRespVO::getProductSpecification)
|
||||
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
|
||||
// 标签模板,用于入库
|
||||
.selectAs(MaterialProductDO::getLabelTemplateKey, MaterialBatchRespVO::getLabelTemplateKey)
|
||||
// 生产日期和到期日期,用于验收和入库
|
||||
.selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate)
|
||||
.selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate)
|
||||
.selectAs(SupplierDO::getName, MaterialBatchRespVO::getSupplierName)
|
||||
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
|
||||
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialBatchDO::getParentId)
|
||||
.leftJoin(SupplierDO.class, SupplierDO::getId, MaterialBatchDO::getSupplierId)
|
||||
// 只要批次
|
||||
.eq(MaterialBatchGongType.batch.name().equals(reqVO.getDataType()), MaterialBatchDO::getParentId, 0)
|
||||
// 只要工段
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO;
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceProductDO;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
||||
@@ -55,6 +56,7 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
||||
.orderByDesc(MaterialInfomationDO::getId));
|
||||
}
|
||||
|
||||
@QmsPermission(deptIdColumn = "BLG_DEPT_ID")
|
||||
default PageResult<MaterialInfomationRespVO> selectPageWithPdtInfo(MaterialInfomationPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<MaterialInfomationDO> wrapper = new MPJLambdaWrapperX<MaterialInfomationDO>()
|
||||
.select(MaterialInfomationDO::getId,
|
||||
@@ -233,7 +235,7 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
||||
default PageResult<MaterialInfomationLedgerRespVO> selectInventoryLedgerPage(MaterialInfomationPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<MaterialInfomationDO> wrapper = new MPJLambdaWrapperX<MaterialInfomationDO>()
|
||||
.select(MaterialInfomationDO::getProductId)
|
||||
.selectAs(MaterialInfomationDO::getDeptId, MaterialInfomationLedgerRespVO::getDepartmentId)
|
||||
.selectAs(MaterialInfomationDO::getBelongDepartmentId, MaterialInfomationLedgerRespVO::getDepartmentId)
|
||||
.select(MaterialInfomationDO::getLocationId)
|
||||
.selectCount(MaterialInfomationDO::getId, MaterialInfomationLedgerRespVO::getDepartmentInventoryQuantity)
|
||||
.innerJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||
@@ -241,7 +243,7 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
||||
.eq(MaterialInfomationDO::getUsageStatus, 0)
|
||||
.likeIfExists(MaterialProductDO::getName, reqVO.getName())
|
||||
.groupBy(MaterialInfomationDO::getProductId,
|
||||
MaterialInfomationDO::getDeptId,
|
||||
MaterialInfomationDO::getBelongDepartmentId,
|
||||
MaterialInfomationDO::getLocationId);
|
||||
|
||||
return selectJoinPage(reqVO, MaterialInfomationLedgerRespVO.class, wrapper);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user