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
@RequestMapping("/qms/resource/material-product")
@Validated
@FileUploadController(source = "resource.materialproduct")
@FileUploadController(source = "resource.materialproduct", codeKey = "data.fileUploadBusinessCode")
@DeptDataPermissionIgnore(enable = "true")
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")
// @PreAuthorize("@ss.hasPermission('qms:material-product:query')")
public CommonResult<MaterialProductRespVO> getMaterialProduct(@RequestParam("id") Long id) {
MaterialProductDO materialProduct = materialProductService.getMaterialProductInfo(id);
return success(BeanUtils.toBean(materialProduct, MaterialProductRespVO.class));
MaterialProductRespVO materialProduct = materialProductService.getMaterialProductInfoWithFiles(id);
return success(materialProduct);
}
@GetMapping("/export-excel")

View File

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

View File

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

View File

@@ -7,6 +7,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 入库 Response VO")
@Data
@@ -93,4 +94,8 @@ public class MaterialInventoryInboundRespVO {
@ExcelProperty("创建时间")
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.ExcelProperty;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -163,4 +165,11 @@ public class MaterialProductRespVO {
@Schema(description = "子物料分类")
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 lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 物料大类新增/修改 Request VO")
@Data
public class MaterialProductSaveReqVO {
@@ -102,4 +104,7 @@ public class MaterialProductSaveReqVO {
@Schema(description = "备注")
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::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.selectAs(MaterialProductDO::getLabelTemplateKey, MaterialBatchRespVO::getLabelTemplateKey)
.selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate)
.selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
@@ -124,7 +125,6 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
// 只查询工段
.ne(MaterialBatchDO::getParentId, 0)
.eq(MaterialBatchDO::getSubmitStatus, 1)
.eq(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
@@ -140,10 +140,10 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.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)
.orderByDesc(MaterialBatchDO::getParentId);
.apply(!reqVO.getTreatment(), "t.INB_END_QTY < t.INB_QTY")
.orderByDesc(MaterialBatchDO::getId);
if (reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2) {
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(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
.eqIfPresent(MaterialInfomationDO::getProductId, reqVO.getProductId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId())

View File

@@ -1,5 +1,8 @@
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.zt.plat.framework.common.pojo.PageResult;
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.MaterialLifecycleDetailRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import groovy.util.logging.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 物料通用流程明细 Mapper
@@ -87,4 +94,22 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
.in(MaterialLifecycleDetailDO::getLifecycleId, lfcIds);
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;
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.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.core.constant.DataTypeConstant;
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.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 物料大类 Mapper
@@ -57,17 +61,39 @@ public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
.orderByDesc(MaterialProductDO::getId));
}
default boolean checkIsExistsBatchByPdt(Long id){
default boolean checkIsExistsBatchByPdt(List<Long> ids){
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>()
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
.eq(MaterialBatchDO::getProductId, id);
.innerJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
.in(MaterialProductDO::getId, ids);
return this.exists(wrapperX);
}
default boolean checkIsExistsDataByPdts(List<Long> ids){
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>()
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
.in(MaterialBatchDO::getProductId, ids);
return this.exists(wrapperX);
default Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds) {
MPJLambdaWrapper<MaterialProductDO> wrapper = new MPJLambdaWrapper<MaterialProductDO>()
.select(MaterialProductDO::getId)
.selectCount(MaterialInfomationDO::getId, "quantity")
.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