Merge branch 'test' of https://git.will-way.cn/zgty/zt-qms into test

This commit is contained in:
2026-02-12 18:09:07 +08:00
17 changed files with 200 additions and 40 deletions

View File

@@ -37,7 +37,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
@RestController @RestController
@RequestMapping("/qms/resource/material-product") @RequestMapping("/qms/resource/material-product")
@Validated @Validated
@FileUploadController(source = "resource.materialproduct") @FileUploadController(source = "resource.materialproduct", codeKey = "data.fileUploadBusinessCode")
@DeptDataPermissionIgnore(enable = "true") @DeptDataPermissionIgnore(enable = "true")
public class MaterialProductController extends AbstractFileUploadController implements BusinessControllerMarker{ public class MaterialProductController extends AbstractFileUploadController implements BusinessControllerMarker{
@@ -134,8 +134,8 @@ public class MaterialProductController extends AbstractFileUploadController impl
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('qms:material-product:query')") // @PreAuthorize("@ss.hasPermission('qms:material-product:query')")
public CommonResult<MaterialProductRespVO> getMaterialProduct(@RequestParam("id") Long id) { public CommonResult<MaterialProductRespVO> getMaterialProduct(@RequestParam("id") Long id) {
MaterialProductDO materialProduct = materialProductService.getMaterialProductInfo(id); MaterialProductRespVO materialProduct = materialProductService.getMaterialProductInfoWithFiles(id);
return success(BeanUtils.toBean(materialProduct, MaterialProductRespVO.class)); return success(materialProduct);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")

View File

@@ -41,6 +41,10 @@ public class MaterialBatchRespVO {
@ExcelProperty("物料大类型号") @ExcelProperty("物料大类型号")
private String productModelNo; private String productModelNo;
@Schema(description = "标签模板key")
@ExcelProperty("标签模板key")
private String labelTemplateKey;
@Schema(description = "批次编号") @Schema(description = "批次编号")
@ExcelProperty("批次编号") @ExcelProperty("批次编号")
private String batchNo; private String batchNo;

View File

@@ -16,6 +16,9 @@ public class MaterialInventoryInboundDetailPageReqVO extends PageParam {
@Schema(description = "入库单ID", example = "30205") @Schema(description = "入库单ID", example = "30205")
private Long inboundId; private Long inboundId;
@Schema(description = "物料大类id", example = "30205")
private Long productId;
@Schema(description = "批次id", example = "16666") @Schema(description = "批次id", example = "16666")
private Long batchId; private Long batchId;

View File

@@ -7,6 +7,7 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 入库 Response VO") @Schema(description = "管理后台 - 入库 Response VO")
@Data @Data
@@ -93,4 +94,8 @@ public class MaterialInventoryInboundRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "入库明细")
@ExcelProperty("入库明细")
private List<MaterialInventoryInboundDetailRespVO> detailList;
} }

View File

@@ -3,6 +3,8 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileWithUrlRespDTO;
import com.zt.plat.module.qms.core.aspect.annotation.Dict; import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@@ -163,4 +165,11 @@ public class MaterialProductRespVO {
@Schema(description = "子物料分类") @Schema(description = "子物料分类")
private List<MaterialProductRespVO> children; private List<MaterialProductRespVO> children;
@Schema(description = "附件上传code")
private String fileUploadBusinessCode = "qms_resource_material_product";
@Schema(description = "附件对象")
private List<BusinessFileWithUrlRespDTO> businessFileRet;
} }

View File

@@ -9,6 +9,8 @@ import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null; import jakarta.validation.constraints.Null;
import lombok.Data; import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 物料大类新增/修改 Request VO") @Schema(description = "管理后台 - 物料大类新增/修改 Request VO")
@Data @Data
public class MaterialProductSaveReqVO { public class MaterialProductSaveReqVO {
@@ -102,4 +104,7 @@ public class MaterialProductSaveReqVO {
@Schema(description = "备注") @Schema(description = "备注")
private String remark; private String remark;
@Schema(description = "删除的文件id")
private List<Long> deleteFileIdList;
} }

View File

@@ -117,6 +117,7 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName) .selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode) .selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo) .selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.selectAs(MaterialProductDO::getLabelTemplateKey, MaterialBatchRespVO::getLabelTemplateKey)
.selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate) .selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate)
.selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate) .selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId) .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
@@ -124,7 +125,6 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
// 只查询工段 // 只查询工段
.ne(MaterialBatchDO::getParentId, 0) .ne(MaterialBatchDO::getParentId, 0)
.eq(MaterialBatchDO::getSubmitStatus, 1) .eq(MaterialBatchDO::getSubmitStatus, 1)
.eq(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds) .in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId()) .eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo()) .likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
@@ -140,10 +140,10 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark()) .eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark())
// 已处理 // 已处理
.le(reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity) .apply(reqVO.getTreatment(), "t.INB_END_QTY >= t.INB_QTY")
// 未处理 // 未处理
.gt(!reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity) .apply(!reqVO.getTreatment(), "t.INB_END_QTY < t.INB_QTY")
.orderByDesc(MaterialBatchDO::getParentId); .orderByDesc(MaterialBatchDO::getId);
if (reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2) { if (reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2) {
wrapper.between(MaterialBatchDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1]); wrapper.between(MaterialBatchDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1]);
} }

View File

@@ -52,6 +52,7 @@ public interface MaterialInventoryInboundDetailMapper extends BaseMapperX<Materi
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId) .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
.leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId) .leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId) .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
.eqIfPresent(MaterialInfomationDO::getProductId, reqVO.getProductId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId()) .eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId()) .eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId()) .eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId())

View File

@@ -1,5 +1,8 @@
package com.zt.plat.module.qms.resource.material.dal.mapper; package com.zt.plat.module.qms.resource.material.dal.mapper;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
@@ -8,9 +11,13 @@ import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.*; import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import groovy.util.logging.Slf4j;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 物料通用流程明细 Mapper * 物料通用流程明细 Mapper
@@ -87,4 +94,22 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
.in(MaterialLifecycleDetailDO::getLifecycleId, lfcIds); .in(MaterialLifecycleDetailDO::getLifecycleId, lfcIds);
return selectJoinList(MaterialLifecycleDetailRespVO.class, wrapper); return selectJoinList(MaterialLifecycleDetailRespVO.class, wrapper);
} }
default Map<Long, Long> getMadeCountMapByDetailIds(List<Long> detailIds) {
MPJLambdaWrapper<MaterialLifecycleDetailDO> wrapper = new MPJLambdaWrapper<MaterialLifecycleDetailDO>()
.select(MaterialLifecycleDetailDO::getId)
.selectCount(MaterialStandardSolutionDO::getId, "quantity")
.leftJoin(MaterialStandardSolutionDO.class, MaterialStandardSolutionDO::getDetailId, MaterialLifecycleDetailDO::getId)
.in(MaterialLifecycleDetailDO::getId, detailIds)
.groupBy(MaterialLifecycleDetailDO::getId);
List<Map<String, Object>> maps = selectJoinMaps(wrapper);
if (CollUtil.isEmpty(maps)) return new HashMap<>();
return maps.stream().collect(Collectors.toMap(
map -> (Long) map.get("ID"),
map -> (Long) map.get("QUANTITY")
));
}
} }

View File

@@ -1,16 +1,20 @@
package com.zt.plat.module.qms.resource.material.dal.mapper; package com.zt.plat.module.qms.resource.material.dal.mapper;
import cn.hutool.core.collection.CollUtil;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; 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.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.core.constant.DataTypeConstant; import com.zt.plat.module.qms.core.constant.DataTypeConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 物料大类 Mapper * 物料大类 Mapper
@@ -57,17 +61,39 @@ public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
.orderByDesc(MaterialProductDO::getId)); .orderByDesc(MaterialProductDO::getId));
} }
default boolean checkIsExistsBatchByPdt(Long id){ default boolean checkIsExistsBatchByPdt(List<Long> ids){
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>() MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>()
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId) .innerJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
.eq(MaterialBatchDO::getProductId, id); .in(MaterialProductDO::getId, ids);
return this.exists(wrapperX); return this.exists(wrapperX);
} }
default boolean checkIsExistsDataByPdts(List<Long> ids){ default Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds) {
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>() MPJLambdaWrapper<MaterialProductDO> wrapper = new MPJLambdaWrapper<MaterialProductDO>()
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId) .select(MaterialProductDO::getId)
.in(MaterialBatchDO::getProductId, ids); .selectCount(MaterialInfomationDO::getId, "quantity")
return this.exists(wrapperX); .leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getProductId, MaterialProductDO::getId)
.in(MaterialProductDO::getId, mtrlIds)
.eq(MaterialInfomationDO::getUsageStatus, 0)
.groupBy(MaterialProductDO::getId);
List<Map<String, Object>> maps = selectJoinMaps(wrapper);
if (CollUtil.isEmpty(maps)) return new HashMap<>();
return maps.stream().collect(Collectors.toMap(
map -> (Long) map.get("ID"),
map -> (Long) map.get("QUANTITY")
));
}
default boolean checkIsExistsSolutionByPdt(List<Long> ids) {
MPJLambdaWrapperX<MaterialProductDO> wrapperXMakeApply = new MPJLambdaWrapperX<MaterialProductDO>()
.innerJoin(MaterialLifecycleDetailDO.class, MaterialLifecycleDetailDO::getProductId, MaterialProductDO::getId)
.in(MaterialProductDO::getId, ids);
MPJLambdaWrapperX<MaterialProductDO> wrapperXMake = new MPJLambdaWrapperX<MaterialProductDO>()
.innerJoin(MaterialInfomationDO.class, MaterialInfomationDO::getProductId, MaterialProductDO::getId)
.innerJoin(MaterialStandardSolutionDO.class, MaterialStandardSolutionDO::getInfomationId, MaterialInfomationDO::getId)
.in(MaterialProductDO::getId, ids);
return this.exists(wrapperXMakeApply) || this.exists(wrapperXMake);
} }
} }

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