Compare commits

..

No commits in common. 'main' and 'ck' have entirely different histories.
main ... ck

@ -1,4 +1,4 @@
version: "3.4" version: "3.4"
name: yudao-system name: yudao-system
@ -55,7 +55,6 @@ services:
- mysql - mysql
- redis - redis
admin: admin:
container_name: yudao-admin container_name: yudao-admin
build: build:

@ -29,27 +29,6 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "产品ID", example = "2336") @Schema(description = "产品ID", example = "2336")
private Long productId; private Long productId;
@Schema(description = "产品名称", example = "产品A")
private String productName;
@Schema(description = "图片")
private String images;
@Schema(description = "版本", example = "V1.0")
private String version;
@Schema(description = "状态", example = "0")
private Integer status;
@Schema(description = "排除状态", example = "4")
private Integer excludeStatus;
@Schema(description = "当前位置", example = "一号机台")
private String currentPosition;
@Schema(description = "设备名称", example = "注塑机")
private String deviceName;
@Schema(description = "预期寿命(小时)") @Schema(description = "预期寿命(小时)")
private BigDecimal useTime; private BigDecimal useTime;
@ -77,7 +56,4 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "id集合导出用") @Schema(description = "id集合导出用")
private String ids; private String ids;
@Schema(description = "关键字(匹配编码/名称/产品型号)")
private String keyword;
} }

@ -40,7 +40,6 @@ public class MoldBrandRespVO {
// @ExcelProperty("产品") // @ExcelProperty("产品")
private String productName; private String productName;
@Schema(description = "预期寿命/次") @Schema(description = "预期寿命/次")
@ExcelProperty("预期寿命/次") @ExcelProperty("预期寿命/次")
private BigDecimal useTime; private BigDecimal useTime;

@ -1,7 +1,5 @@
package cn.iocoder.yudao.module.common.controller.admin.mold.vo; package cn.iocoder.yudao.module.common.controller.admin.mold.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.common.enums.MoldBrandStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -9,7 +7,6 @@ import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 模具型号新增/修改 Request VO") @Schema(description = "管理后台 - 模具型号新增/修改 Request VO")
@Data @Data
@ -19,7 +16,7 @@ public class MoldBrandSaveReqVO {
private Long id; private Long id;
@Schema(description = "型号编码", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "型号编码", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "型号编码不能为空") @NotEmpty(message = "型号编码不能为空")
private String code; private String code;
@Schema(description = "型号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") @Schema(description = "型号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ -27,41 +24,13 @@ public class MoldBrandSaveReqVO {
private String name; private String name;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
// @NotEmpty(message = "规格不能为空") @NotEmpty(message = "规格不能为空")
private String moldType; private String moldType;
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336") @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336")
// @NotNull(message = "产品ID不能为空") // @NotNull(message = "产品ID不能为空")
private Long productId; private Long productId;
@Schema(description = "产品名称", example = "产品A")
private String productName;
@Schema(description = "产品ID列表可多选")
private List<Long> productIds;
@Schema(description = "图片", example = "https://example.com/mold.png")
private String images;
@Schema(description = "图纸", example = "https://example.com/drawing.pdf")
private String drawings;
@Schema(description = "操作手册", example = "https://example.com/manual.pdf")
private String operationManual;
@Schema(description = "操作视频", example = "https://example.com/video.mp4")
private String operationVideo;
@Schema(description = "版本", example = "V1.0")
private String version;
@Schema(description = "状态", example = "0")
@InEnum(MoldBrandStatusEnum.class)
private Integer status;
@Schema(description = "当前位置", example = "一号机台")
private String currentPosition;
@Schema(description = "预期寿命(小时)") @Schema(description = "预期寿命(小时)")
private BigDecimal useTime; private BigDecimal useTime;

@ -23,18 +23,6 @@ public class MoldPageReqVO extends PageParam {
@Schema(description = "模具名称", example = "芋艿") @Schema(description = "模具名称", example = "芋艿")
private String name; private String name;
@Schema(description = "类型")
private String type;
@Schema(description = "安装位置")
private String installLocation;
@Schema(description = "材质")
private String material;
@Schema(description = "数量")
private Integer quantity;
@Schema(description = "单位ID", example = "19527") @Schema(description = "单位ID", example = "19527")
private Long unitId; private Long unitId;

@ -28,9 +28,6 @@ public class MoldProductRespVO {
@ExcelProperty("产品") @ExcelProperty("产品")
private String productName; private String productName;
@Schema(description = "产品名称快照", example = "产品A")
private String productNameSnapshot;
@Schema(description = "备注", example = "你猜") @Schema(description = "备注", example = "你猜")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;

@ -1,10 +1,5 @@
package cn.iocoder.yudao.module.common.controller.admin.mold.vo; package cn.iocoder.yudao.module.common.controller.admin.mold.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
@ -36,22 +31,6 @@ public class MoldRespVO {
@ExcelProperty("模具名称") @ExcelProperty("模具名称")
private String name; private String name;
@Schema(description = "类型")
@ExcelProperty("类型")
private String type;
@Schema(description = "安装位置")
@ExcelProperty("安装位置")
private String installLocation;
@Schema(description = "材质")
@ExcelProperty("材质")
private String material;
@Schema(description = "数量")
@ExcelProperty("数量")
private Integer quantity;
@Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19527") @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19527")
private Long unitId; private Long unitId;
@ -107,19 +86,4 @@ public class MoldRespVO {
@ExcelProperty("附件地址") @ExcelProperty("附件地址")
private String fileUrl; private String fileUrl;
@Schema(description = "压网时间")
@ExcelProperty("压网时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime pressureNetTime;
@Schema(description = "压网天数")
@ExcelProperty("压网天数")
private Long pressureNetDays;
} }

@ -23,18 +23,6 @@ public class MoldSaveReqVO {
@NotEmpty(message = "模具名称不能为空") @NotEmpty(message = "模具名称不能为空")
private String name; private String name;
@Schema(description = "类型")
private String type;
@Schema(description = "安装位置")
private String installLocation;
@Schema(description = "材质")
private String material;
@Schema(description = "数量")
private Integer quantity;
@Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19527") @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19527")
// @NotNull(message = "单位ID不能为空") // @NotNull(message = "单位ID不能为空")
private Long unitId; private Long unitId;

@ -72,8 +72,6 @@ public class MoldRepairPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "维修结果")
private Integer repairStatus;
@Schema(description = "ids集合导出用") @Schema(description = "ids集合导出用")
private String ids; private String ids;

@ -113,49 +113,5 @@ public class MoldRepairRespVO {
@ExcelProperty("维修状态") @ExcelProperty("维修状态")
private String repairStatusName; private String repairStatusName;
@Schema(description = "故障等级 1-一般 2-严重 3-紧急")
@ExcelProperty("故障等级")
private Integer faultLevel;
@Schema(description = "是否停机")
@ExcelProperty("是否停机")
private Boolean shutdown;
@Schema(description = "故障现象")
@ExcelProperty("故障现象")
private String faultPhenomenon;
@Schema(description = "故障描述")
@ExcelProperty("故障描述")
private String faultDescription;
@Schema(description = "故障图片,多个逗号分隔")
@ExcelProperty("故障图片")
private String faultImages;
@Schema(description = "停机时长")
@ExcelProperty("停机时长")
private String shutdownDuration;
@Schema(description = "故障原因")
@ExcelProperty("故障原因")
private String faultReason;
@Schema(description = "处理措施")
@ExcelProperty("处理措施")
private String treatmentMeasures;
@Schema(description = "更换配件")
@ExcelProperty("更换配件")
private String replacementParts;
@Schema(description = "维修总结/维修内容")
@ExcelProperty("维修总结/维修内容")
private String repairSummary;
@Schema(description = "维修后图片,多个逗号分隔")
@ExcelProperty("维修后图片")
private String repairedImages;
} }

@ -52,12 +52,9 @@ public class MoldRepairSaveReqVO {
@Schema(description = "验收日期") @Schema(description = "验收日期")
private LocalDateTime confirmDate; private LocalDateTime confirmDate;
//
// @Schema(description = "维修结果")
// private String repairResult;
@Schema(description = "维修结果") @Schema(description = "维修结果")
private String repairStatus; private String repairResult;
@Schema(description = "维修人员") @Schema(description = "维修人员")
private String acceptedBy; private String acceptedBy;
@ -83,37 +80,4 @@ public class MoldRepairSaveReqVO {
@Schema(description = "关键件Id") @Schema(description = "关键件Id")
private Long componentId; private Long componentId;
@Schema(description = "故障等级 1-一般 2-严重 3-紧急")
private Integer faultLevel;
@Schema(description = "是否停机")
private Boolean shutdown;
@Schema(description = "故障现象")
private String faultPhenomenon;
@Schema(description = "故障描述")
private String faultDescription;
@Schema(description = "故障图片,多个逗号分隔")
private String faultImages;
@Schema(description = "停机时长")
private String shutdownDuration;
@Schema(description = "故障原因")
private String faultReason;
@Schema(description = "处理措施")
private String treatmentMeasures;
@Schema(description = "更换配件")
private String replacementParts;
@Schema(description = "维修总结/维修内容")
private String repairSummary;
@Schema(description = "维修后图片,多个逗号分隔")
private String repairedImages;
} }

@ -47,42 +47,6 @@ public class MoldBrandDO extends BaseDO {
* ID * ID
*/ */
private Long productId; private Long productId;
/**
*
*/
private String productName;
/**
*
*/
private String images;
/**
*
*/
private String drawings;
/**
*
*/
private String operationManual;
/**
*
*/
private String operationVideo;
/**
*
*/
private String version;
/**
*
*/
private Integer status;
/**
*
*/
private String currentPosition;
/** /**
* 寿() * 寿()
*/ */

@ -35,10 +35,6 @@ public class MoldBrandProductDO extends BaseDO {
* ID * ID
*/ */
private Long productId; private Long productId;
/**
*
*/
private String productName;
/** /**
* *
*/ */

@ -40,22 +40,6 @@ public class MoldDO extends BaseDO {
* *
*/ */
private String name; private String name;
/**
*
*/
private String type;
/**
*
*/
private String installLocation;
/**
*
*/
private String material;
/**
*
*/
private Integer quantity;
/** /**
* ID * ID
*/ */
@ -135,10 +119,4 @@ public class MoldDO extends BaseDO {
@TableField(exist = false) @TableField(exist = false)
private String qrcodeUrl; private String qrcodeUrl;
/**
*
*/
@TableField(exist = false)
private String templateJson;
} }

@ -117,59 +117,4 @@ public class MoldRepairDO extends BaseDO {
*/ */
private Integer repairStatus; private Integer repairStatus;
/**
* 1- 2- 3-
*/
private Integer faultLevel;
/**
*
*/
private Boolean shutdown;
/**
*
*/
private String faultPhenomenon;
/**
*
*/
private String faultDescription;
/**
*
*/
private String faultImages;
/**
*
*/
private String shutdownDuration;
/**
*
*/
private String faultReason;
/**
*
*/
private String treatmentMeasures;
/**
*
*/
private String replacementParts;
/**
* /
*/
private String repairSummary;
/**
*
*/
private String repairedImages;
} }

@ -21,34 +21,14 @@ import java.util.stream.Collectors;
@Mapper @Mapper
public interface MoldBrandMapper extends BaseMapperX<MoldBrandDO> { public interface MoldBrandMapper extends BaseMapperX<MoldBrandDO> {
default LambdaQueryWrapperX<MoldBrandDO> buildQueryWrapper(MoldBrandPageReqVO reqVO) { default PageResult<MoldBrandDO> selectPage(MoldBrandPageReqVO reqVO) {
LambdaQueryWrapperX<MoldBrandDO> queryWrapper = new LambdaQueryWrapperX<>();
if(StringUtils.isNotBlank(reqVO.getCode())&&StringUtils.isNotBlank(reqVO.getName())&&reqVO.getCode().equals(reqVO.getName())){
if(reqVO.getCode().contains("MOLD-")){
queryWrapper.eq(MoldBrandDO::getId, reqVO.getCode().replace("MOLD-",""));
}else{
queryWrapper.and(w -> w
.like(MoldBrandDO::getCode, reqVO.getCode())
.or()
.like(MoldBrandDO::getName, reqVO.getName())
);
}
}else{
queryWrapper.likeIfPresent(MoldBrandDO::getCode, reqVO.getCode())
.likeIfPresent(MoldBrandDO::getName, reqVO.getName());
}
queryWrapper LambdaQueryWrapperX<MoldBrandDO> moldBrandDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
/* .likeIfPresent(MoldBrandDO::getCode, reqVO.getCode()) moldBrandDOLambdaQueryWrapperX
.likeIfPresent(MoldBrandDO::getName, reqVO.getName())*/ .eqIfPresent(MoldBrandDO::getCode, reqVO.getCode())
.likeIfPresent(MoldBrandDO::getName, reqVO.getName())
.eqIfPresent(MoldBrandDO::getMoldType, reqVO.getMoldType()) .eqIfPresent(MoldBrandDO::getMoldType, reqVO.getMoldType())
.eqIfPresent(MoldBrandDO::getProductId, reqVO.getProductId()) .eqIfPresent(MoldBrandDO::getProductId, reqVO.getProductId())
.likeIfPresent(MoldBrandDO::getProductName, reqVO.getProductName())
.likeIfPresent(MoldBrandDO::getImages, reqVO.getImages())
.likeIfPresent(MoldBrandDO::getVersion, reqVO.getVersion())
.eqIfPresent(MoldBrandDO::getStatus, reqVO.getStatus())
.neIfPresent(MoldBrandDO::getStatus, reqVO.getExcludeStatus())
.likeIfPresent(MoldBrandDO::getCurrentPosition, reqVO.getCurrentPosition())
.eqIfPresent(MoldBrandDO::getUseTime, reqVO.getUseTime()) .eqIfPresent(MoldBrandDO::getUseTime, reqVO.getUseTime())
.eqIfPresent(MoldBrandDO::getMaintainType, reqVO.getMaintainType()) .eqIfPresent(MoldBrandDO::getMaintainType, reqVO.getMaintainType())
.eqIfPresent(MoldBrandDO::getMaintainTime, reqVO.getMaintainTime()) .eqIfPresent(MoldBrandDO::getMaintainTime, reqVO.getMaintainTime())
@ -59,33 +39,35 @@ public interface MoldBrandMapper extends BaseMapperX<MoldBrandDO> {
.betweenIfPresent(MoldBrandDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MoldBrandDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MoldBrandDO::getId); .orderByDesc(MoldBrandDO::getId);
//关键字(匹配编码/名称/产品型号) // 单独处理 ids 条件
if (StringUtils.isNotBlank(reqVO.getKeyword())) {
queryWrapper.and(wrapper ->
wrapper.like(MoldBrandDO::getCode, reqVO.getKeyword())
.or()
.like(MoldBrandDO::getName, reqVO.getKeyword())
.or()
.like(MoldBrandDO::getProductName, reqVO.getKeyword())
);
}
if (StringUtils.isNotBlank(reqVO.getIds())) { if (StringUtils.isNotBlank(reqVO.getIds())) {
List<Long> idList = Arrays.stream(reqVO.getIds().split(",")) List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
.map(String::trim) .map(String::trim)
.map(Long::valueOf) .map(Long::valueOf)
.collect(Collectors.toList()); .collect(Collectors.toList());
queryWrapper.in(MoldBrandDO::getId, idList); moldBrandDOLambdaQueryWrapperX.in(MoldBrandDO::getId, idList);
}
return queryWrapper;
} }
default PageResult<MoldBrandDO> selectPage(MoldBrandPageReqVO reqVO) { return selectPage(reqVO, moldBrandDOLambdaQueryWrapperX);
return selectPage(reqVO, buildQueryWrapper(reqVO));
}
}
default List<MoldBrandDO> selectBy(MoldBrandPageReqVO reqVO) { default List<MoldBrandDO> selectBy(MoldBrandPageReqVO reqVO) {
return selectList(buildQueryWrapper(reqVO)); return selectList(new LambdaQueryWrapperX<MoldBrandDO>()
.eqIfPresent(MoldBrandDO::getCode, reqVO.getCode())
.likeIfPresent(MoldBrandDO::getName, reqVO.getName())
.eqIfPresent(MoldBrandDO::getMoldType, reqVO.getMoldType())
.eqIfPresent(MoldBrandDO::getProductId, reqVO.getProductId())
.eqIfPresent(MoldBrandDO::getUseTime, reqVO.getUseTime())
.eqIfPresent(MoldBrandDO::getMaintainType, reqVO.getMaintainType())
.eqIfPresent(MoldBrandDO::getMaintainTime, reqVO.getMaintainTime())
.eqIfPresent(MoldBrandDO::getMoldSize, reqVO.getMoldSize())
.eqIfPresent(MoldBrandDO::getRemark, reqVO.getRemark())
.eqIfPresent(MoldBrandDO::getIsEnable, reqVO.getIsEnable())
.eqIfPresent(MoldBrandDO::getOrgType, reqVO.getOrgType())
.betweenIfPresent(MoldBrandDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MoldBrandDO::getId));
} }
} }

@ -32,10 +32,4 @@ public interface MoldBrandProductMapper extends BaseMapperX<MoldBrandProductDO>
.eqIfPresent(MoldBrandProductDO::getBrandId, reqVO.getBrandId()) .eqIfPresent(MoldBrandProductDO::getBrandId, reqVO.getBrandId())
.orderByDesc(MoldBrandProductDO::getId)); .orderByDesc(MoldBrandProductDO::getId));
} }
default List<MoldBrandProductDO> selectListByBrandIds(Collection<Long> brandIds) {
return selectList(new LambdaQueryWrapperX<MoldBrandProductDO>()
.inIfPresent(MoldBrandProductDO::getBrandId, brandIds)
.orderByDesc(MoldBrandProductDO::getId));
}
} }

@ -21,15 +21,11 @@ import java.util.stream.Collectors;
@Mapper @Mapper
public interface MoldMapper extends BaseMapperX<MoldDO> { public interface MoldMapper extends BaseMapperX<MoldDO> {
default LambdaQueryWrapperX<MoldDO> buildQueryWrapper(MoldPageReqVO reqVO) { default PageResult<MoldDO> selectPage(MoldPageReqVO reqVO) {
LambdaQueryWrapperX<MoldDO> wrapper = new LambdaQueryWrapperX<>(); LambdaQueryWrapperX<MoldDO> wrapper = new LambdaQueryWrapperX<>();
wrapper wrapper
.likeIfPresent(MoldDO::getCode, reqVO.getCode()) .likeIfPresent(MoldDO::getCode, reqVO.getCode())
.likeIfPresent(MoldDO::getName, reqVO.getName()) .likeIfPresent(MoldDO::getName, reqVO.getName())
.likeIfPresent(MoldDO::getType, reqVO.getType())
.likeIfPresent(MoldDO::getInstallLocation, reqVO.getInstallLocation())
.likeIfPresent(MoldDO::getMaterial, reqVO.getMaterial())
.eqIfPresent(MoldDO::getQuantity, reqVO.getQuantity())
.eqIfPresent(MoldDO::getUnitId, reqVO.getUnitId()) .eqIfPresent(MoldDO::getUnitId, reqVO.getUnitId())
.eqIfPresent(MoldDO::getMachineId, reqVO.getMachineId()) .eqIfPresent(MoldDO::getMachineId, reqVO.getMachineId())
.likeIfPresent(MoldDO::getMachineName, reqVO.getMachineName()) .likeIfPresent(MoldDO::getMachineName, reqVO.getMachineName())
@ -55,15 +51,7 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
if (reqVO.getStatuss() != null && !reqVO.getStatuss().isEmpty()) { if (reqVO.getStatuss() != null && !reqVO.getStatuss().isEmpty()) {
wrapper.in(MoldDO::getStatus, reqVO.getStatuss()); wrapper.in(MoldDO::getStatus, reqVO.getStatuss());
} }
return wrapper; return selectPage(reqVO, wrapper);
}
default PageResult<MoldDO> selectPage(MoldPageReqVO reqVO) {
return selectPage(reqVO, buildQueryWrapper(reqVO));
}
default List<MoldDO> selectList(MoldPageReqVO reqVO) {
return selectList(buildQueryWrapper(reqVO));
} }
// 保持原有方法以兼容旧代码 // 保持原有方法以兼容旧代码
@ -81,10 +69,6 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
return selectList(new LambdaQueryWrapperX<MoldDO>() return selectList(new LambdaQueryWrapperX<MoldDO>()
.eqIfPresent(MoldDO::getCode, reqVO.getCode()) .eqIfPresent(MoldDO::getCode, reqVO.getCode())
.likeIfPresent(MoldDO::getName, reqVO.getName()) .likeIfPresent(MoldDO::getName, reqVO.getName())
.likeIfPresent(MoldDO::getType, reqVO.getType())
.likeIfPresent(MoldDO::getInstallLocation, reqVO.getInstallLocation())
.likeIfPresent(MoldDO::getMaterial, reqVO.getMaterial())
.eqIfPresent(MoldDO::getQuantity, reqVO.getQuantity())
.eqIfPresent(MoldDO::getBrandId, reqVO.getBrandId()) .eqIfPresent(MoldDO::getBrandId, reqVO.getBrandId())
.orderByDesc(MoldDO::getId)); .orderByDesc(MoldDO::getId));
} }
@ -94,6 +78,4 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
.eq(MoldDO::getBrandId, brandId) .eq(MoldDO::getBrandId, brandId)
.orderByDesc(MoldDO::getId)); .orderByDesc(MoldDO::getId));
} }
String selectPrintTemplate();
} }

@ -27,7 +27,7 @@ public interface MoldRepairMapper extends BaseMapperX<MoldRepairDO> {
LambdaQueryWrapperX<MoldRepairDO> moldRepairDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>(); LambdaQueryWrapperX<MoldRepairDO> moldRepairDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
moldRepairDOLambdaQueryWrapperX moldRepairDOLambdaQueryWrapperX
.likeIfPresent(MoldRepairDO::getRepairCode, reqVO.getRepairCode()) .eqIfPresent(MoldRepairDO::getRepairCode, reqVO.getRepairCode())
.likeIfPresent(MoldRepairDO::getRepairName, reqVO.getRepairName()) .likeIfPresent(MoldRepairDO::getRepairName, reqVO.getRepairName())
.eqIfPresent(MoldRepairDO::getMoldId, reqVO.getMoldId()) .eqIfPresent(MoldRepairDO::getMoldId, reqVO.getMoldId())
.eqIfPresent(MoldRepairDO::getMoldCode, reqVO.getMoldCode()) .eqIfPresent(MoldRepairDO::getMoldCode, reqVO.getMoldCode())
@ -38,7 +38,6 @@ public interface MoldRepairMapper extends BaseMapperX<MoldRepairDO> {
.betweenIfPresent(MoldRepairDO::getRequireDate, reqVO.getRequireDate()) .betweenIfPresent(MoldRepairDO::getRequireDate, reqVO.getRequireDate())
.betweenIfPresent(MoldRepairDO::getFinishDate, reqVO.getFinishDate()) .betweenIfPresent(MoldRepairDO::getFinishDate, reqVO.getFinishDate())
.betweenIfPresent(MoldRepairDO::getConfirmDate, reqVO.getConfirmDate()) .betweenIfPresent(MoldRepairDO::getConfirmDate, reqVO.getConfirmDate())
.eqIfPresent(MoldRepairDO::getRepairStatus, reqVO.getRepairStatus())
.eqIfPresent(MoldRepairDO::getRepairResult, reqVO.getRepairResult()) .eqIfPresent(MoldRepairDO::getRepairResult, reqVO.getRepairResult())
.eqIfPresent(MoldRepairDO::getAcceptedBy, reqVO.getAcceptedBy()) .eqIfPresent(MoldRepairDO::getAcceptedBy, reqVO.getAcceptedBy())
.eqIfPresent(MoldRepairDO::getConfirmBy, reqVO.getConfirmBy()) .eqIfPresent(MoldRepairDO::getConfirmBy, reqVO.getConfirmBy())

@ -27,7 +27,7 @@ public interface MoldTicketManagementMapper extends BaseMapperX<MoldTicketManage
ticketManagementDOLambdaQueryWrapperX ticketManagementDOLambdaQueryWrapperX
.eqIfPresent(MoldTicketManagementDO::getTaskId, reqVO.getTaskId()) .eqIfPresent(MoldTicketManagementDO::getTaskId, reqVO.getTaskId())
.eqIfPresent(MoldTicketManagementDO::getPlanId, reqVO.getPlanId()) .eqIfPresent(MoldTicketManagementDO::getPlanId, reqVO.getPlanId())
.likeIfPresent(MoldTicketManagementDO::getPlanNo, reqVO.getPlanNo()) .eqIfPresent(MoldTicketManagementDO::getPlanNo, reqVO.getPlanNo())
.likeIfPresent(MoldTicketManagementDO::getMoldName, reqVO.getMoldName()) .likeIfPresent(MoldTicketManagementDO::getMoldName, reqVO.getMoldName())
.eqIfPresent(MoldTicketManagementDO::getPlanType, reqVO.getPlanType()) .eqIfPresent(MoldTicketManagementDO::getPlanType, reqVO.getPlanType())
.likeIfPresent(MoldTicketManagementDO::getConfigName, reqVO.getConfigName()) .likeIfPresent(MoldTicketManagementDO::getConfigName, reqVO.getConfigName())

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.common.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum MoldBrandStatusEnum implements IntArrayValuable {
ON_MACHINE(0, "在机"),
STANDBY(1, "待用"),
REPAIRING(2, "维修"),
SCRAPPED(3, "报废"),
IN_STOCK(4, "在库");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(MoldBrandStatusEnum::getStatus).toArray();
private final Integer status;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.common.enums; package cn.iocoder.yudao.module.common.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
@Getter @Getter
@ -9,10 +10,8 @@ public enum QrcodeBizTypeEnum {
PRODUCT("PRODUCTMATERIAL", "产品物料"), PRODUCT("PRODUCTMATERIAL", "产品物料"),
EQUIPMENT("EQUIPMENT", "设备"), EQUIPMENT("EQUIPMENT", "设备"),
DEVICE_LINE("DEVICE_LINE", "设备产线"),
KEY_PART("KEY_PART", "关键件"), KEY_PART("KEY_PART", "关键件"),
MOLD("MOLD", "模具"), MOLD("MOLD", "模具"),
PALLET("PALLET", "托盘"),
SPARE("SPARE", "备件"); SPARE("SPARE", "备件");
private final String code; private final String code;

@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.common.enums.QrcodeBizTypeEnum;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collection;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
@ -67,8 +66,6 @@ public interface QrcodeRecordService {
String selectQrcodeUrlByIdAndCode(String code, Long id, String code1); String selectQrcodeUrlByIdAndCode(String code, Long id, String code1);
Map<Long, String> selectQrcodeUrlMapByBizTypeAndIds(String bizType, Collection<Long> bizIds);
Map<String, Object> resolveScanBizId(String type, Long id, String code); Map<String, Object> resolveScanBizId(String type, Long id, String code);
void deleteByBiz(QrcodeBizTypeEnum bizType, Long bizId); void deleteByBiz(QrcodeBizTypeEnum bizType, Long bizId);

@ -35,7 +35,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -336,27 +335,6 @@ public class QrcodeRecordServiceImpl implements QrcodeRecordService {
} }
@Override
public Map<Long, String> selectQrcodeUrlMapByBizTypeAndIds(String bizType, Collection<Long> bizIds) {
if (StrUtil.isBlank(bizType) || bizIds == null || bizIds.isEmpty()) {
return new HashMap<>();
}
List<QrcodeRecordDO> records = qrcodeRecordMapper.selectList(Wrappers.<QrcodeRecordDO>lambdaQuery()
.eq(QrcodeRecordDO::getBizType, bizType)
.in(QrcodeRecordDO::getBizId, bizIds)
.eq(QrcodeRecordDO::getStatus, 1)
.orderByDesc(QrcodeRecordDO::getId));
return records.stream()
.filter(record -> StrUtil.isNotBlank(record.getQrcodeFileUrl()))
.collect(Collectors.toMap(
QrcodeRecordDO::getBizId,
QrcodeRecordDO::getQrcodeFileUrl,
(first, second) -> first
));
}
@Override @Override
public Map<String, Object> resolveScanBizId(String type, Long id, String code) { public Map<String, Object> resolveScanBizId(String type, Long id, String code) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();

@ -8,12 +8,5 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/ 文档可见https://www.iocoder.cn/MyBatis/x-plugins/
--> -->
<select id="selectPrintTemplate" resultType="java.lang.String">
select template_json
from mes_print_template
where deleted = 0
and template_type = 4
and template_biz_type = 1
</select>
</mapper> </mapper>

@ -16,9 +16,9 @@
mtm.task_time, mtm.task_time,
CONCAT( '(', su.username, ')', su.nickname) as operator CONCAT( '(', su.username, ')', su.nickname) as operator
from from
mes_mold_ticket_results mtr besure.mes_mold_ticket_results mtr
left join mes_mold_ticket_management mtm on mtm.id = mtr.management_id left join besure.mes_mold_ticket_management mtm on mtm.id = mtr.management_id
left join system_users su on mtm.operator = su.id left join besure.system_users su on mtm.operator = su.id
WHERE 1=1 WHERE 1=1
<!-- ID集合过滤 --> <!-- ID集合过滤 -->
<if test="ids != null and ids != ''"> <if test="ids != null and ids != ''">

@ -9,6 +9,5 @@ public interface DictTypeConstants {
String AUDIT_STATUS = "erp_audit_status"; // 审核状态 String AUDIT_STATUS = "erp_audit_status"; // 审核状态
String STOCK_RECORD_BIZ_TYPE = "erp_stock_record_biz_type"; // 库存明细的业务类型 String STOCK_RECORD_BIZ_TYPE = "erp_stock_record_biz_type"; // 库存明细的业务类型
String PRODUCT_CATEGORY_TYPE = "erp_product_category_type"; // 产品分类类型
} }

@ -6,22 +6,36 @@ import lombok.RequiredArgsConstructor;
import java.util.Arrays; import java.util.Arrays;
/**
* ERP
*
* TODO 稿==退
*
* @author
*/
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter @Getter
public enum ErpAuditStatus implements IntArrayValuable { public enum ErpAuditStatus implements IntArrayValuable {
DRAFT(0, "待提交"), DRAFT(0, "草稿"), // 审核中
UN_APPROVE(1, "已驳回"), UN_APPROVE(1, "驳回"), // 审核通过
PROCESS(10, "审核中"), PROCESS(10, "审核"), // 审核中
APPROVE(20, "审核通过"); APPROVE(20, "审核"); // 审核通过
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpAuditStatus::getStatus).toArray(); public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpAuditStatus::getStatus).toArray();
/**
*
*/
private final Integer status; private final Integer status;
/**
*
*/
private final String name; private final String name;
@Override @Override
public int[] array() { public int[] array() {
return ARRAYS; return ARRAYS;
} }
} }

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.erp.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
@Getter
public enum ErpStockInStatusEnum implements IntArrayValuable {
WAIT_IN(0, "待入库"),
IN_STOCK(20, "已入库");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockInStatusEnum::getStatus).toArray();
private final Integer status;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.erp.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
@Getter
public enum ErpStockOutStatusEnum implements IntArrayValuable {
WAIT_OUT(0, "待出库"),
OUT_STOCK(20, "已出库");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockOutStatusEnum::getStatus).toArray();
private final Integer status;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,38 +0,0 @@
package cn.iocoder.yudao.module.erp.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
@Getter
public enum ErpStockOutUsageTypeEnum implements IntArrayValuable {
REPAIR_RECEIVE(1, "维修领用"),
MAINTENANCE_RECEIVE(2, "保养领用"),
OTHER_OUT(3, "其他出库");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockOutUsageTypeEnum::getType).toArray();
private final Integer type;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
public static String getNameByType(Integer type) {
if (type == null) {
return null;
}
for (ErpStockOutUsageTypeEnum value : values()) {
if (value.getType().equals(type)) {
return value.getName();
}
}
return null;
}
}

@ -13,11 +13,6 @@ public interface ErrorCodeConstants {
ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_030_100_000, "供应商不存在"); ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_030_100_000, "供应商不存在");
ErrorCode SUPPLIER_NOT_ENABLE = new ErrorCode(1_030_100_000, "供应商({})未启用"); ErrorCode SUPPLIER_NOT_ENABLE = new ErrorCode(1_030_100_000, "供应商({})未启用");
// ========== ERP 包装方案1-030-104-000 ==========
ErrorCode PACKAGING_SCHEME_NOT_EXISTS = new ErrorCode(1_030_104_000, "包装方案不存在");
ErrorCode PACKAGING_SCHEME_CODE_DUPLICATE = new ErrorCode(1_030_104_001, "包装方案编码已存在");
ErrorCode PACKAGING_SCHEME_NAME_DUPLICATE = new ErrorCode(1_030_104_002, "包装方案名称已存在");
// ========== ERP 采购订单1-030-101-000 ========== // ========== ERP 采购订单1-030-101-000 ==========
ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_030_101_000, "采购订单不存在"); ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_030_101_000, "采购订单不存在");
ErrorCode PURCHASE_ORDER_DELETE_FAIL_APPROVE = new ErrorCode(1_030_101_001, "采购订单({})已审核,无法删除"); ErrorCode PURCHASE_ORDER_DELETE_FAIL_APPROVE = new ErrorCode(1_030_101_001, "采购订单({})已审核,无法删除");
@ -95,15 +90,6 @@ public interface ErrorCodeConstants {
// ========== ERP 仓库 1-030-400-000 ========== // ========== ERP 仓库 1-030-400-000 ==========
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_030_400_000, "仓库不存在"); ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_030_400_000, "仓库不存在");
ErrorCode WAREHOUSE_NOT_ENABLE = new ErrorCode(1_030_400_001, "仓库({})未启用"); ErrorCode WAREHOUSE_NOT_ENABLE = new ErrorCode(1_030_400_001, "仓库({})未启用");
ErrorCode WAREHOUSE_AREA_CODE_EXISTS = new ErrorCode(1_030_400_002, "仓库库区编码不存在");
ErrorCode WAREHOUSE_AREA_DELETE_FAIL_EXISTS_LOCATION = new ErrorCode(1_030_400_003, "仓库库区删除失败,请先删除对应库位信息");
ErrorCode WAREHOUSE_AREA_NOT_EXISTS = new ErrorCode(1_030_400_004, "仓库库区不存在");
ErrorCode WAREHOUSE_LOCATION_CODE_EXISTS = new ErrorCode(1_030_400_005, "库位编码不存在");
ErrorCode WAREHOUSE_LOCATION_NOT_EXISTS = new ErrorCode(1_030_400_006, "库位不存在");
ErrorCode WAREHOUSE_LOCATION_WAREHOUSE_AREA_NOT_MATCH = new ErrorCode(1_030_400_007, "暂无匹配库位信息");
ErrorCode PALLET_NOT_EXISTS = new ErrorCode(1_030_400_008, "托盘不存在");
ErrorCode PALLET_CODE_EXISTS = new ErrorCode(1_030_400_009, "托盘编码已存在");
ErrorCode PALLET_CODE_EMPTY = new ErrorCode(1_030_400_010, "托盘编码不能为空");
// ========== ERP 其它入库单 1-030-401-000 ========== // ========== ERP 其它入库单 1-030-401-000 ==========
ErrorCode STOCK_IN_NOT_EXISTS = new ErrorCode(1_030_401_000, "其它入库单不存在"); ErrorCode STOCK_IN_NOT_EXISTS = new ErrorCode(1_030_401_000, "其它入库单不存在");
@ -112,14 +98,6 @@ public interface ErrorCodeConstants {
ErrorCode STOCK_IN_APPROVE_FAIL = new ErrorCode(1_030_401_003, "审核失败,只有未审核的入库单才能审核"); ErrorCode STOCK_IN_APPROVE_FAIL = new ErrorCode(1_030_401_003, "审核失败,只有未审核的入库单才能审核");
ErrorCode STOCK_IN_NO_EXISTS = new ErrorCode(1_030_401_004, "生成入库单失败,请重新提交"); ErrorCode STOCK_IN_NO_EXISTS = new ErrorCode(1_030_401_004, "生成入库单失败,请重新提交");
ErrorCode STOCK_IN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_401_005, "其它入库单({})已审核,无法修改"); ErrorCode STOCK_IN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_401_005, "其它入库单({})已审核,无法修改");
ErrorCode STOCK_IN_UPDATE_FAIL_PROCESS = new ErrorCode(1_030_401_006, "其它入库单({})审核中,无法修改");
ErrorCode STOCK_IN_DELETE_FAIL_PROCESS = new ErrorCode(1_030_401_007, "其它入库单({})审核中,无法删除");
ErrorCode STOCK_IN_SUBMIT_FAIL_STATUS = new ErrorCode(1_030_401_008, "提交审核失败,只有待提交或已驳回的入库单才能提交");
ErrorCode STOCK_IN_SUBMIT_FAIL_USER = new ErrorCode(1_030_401_009, "提交审核失败,只有创建人才能提交审核");
ErrorCode STOCK_IN_SUBMIT_FAIL_AUDIT_USER_EMPTY = new ErrorCode(1_030_401_010, "提交审核失败,请选择审核人");
ErrorCode STOCK_IN_AUDIT_FAIL_STATUS = new ErrorCode(1_030_401_011, "审核失败,只有审核中的入库单才能审核");
ErrorCode STOCK_IN_AUDIT_FAIL_USER = new ErrorCode(1_030_401_012, "审核失败,当前用户不是指定审核人");
ErrorCode STOCK_IN_AUDIT_FAIL_RESULT = new ErrorCode(1_030_401_013, "审核失败,审核结果只支持通过或驳回");
ErrorCode STOCK_ALERADY_IN = new ErrorCode(1_030_401_005, "模具({})已经入库,无法继续操作入库"); ErrorCode STOCK_ALERADY_IN = new ErrorCode(1_030_401_005, "模具({})已经入库,无法继续操作入库");
ErrorCode STOCK_ALERADY_OUT = new ErrorCode(1_030_401_005, "模具({})已经出库,无法继续操作出库"); ErrorCode STOCK_ALERADY_OUT = new ErrorCode(1_030_401_005, "模具({})已经出库,无法继续操作出库");
@ -131,17 +109,6 @@ public interface ErrorCodeConstants {
ErrorCode STOCK_OUT_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的出库单才能审核"); ErrorCode STOCK_OUT_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的出库单才能审核");
ErrorCode STOCK_OUT_NO_EXISTS = new ErrorCode(1_030_402_004, "生成出库单失败,请重新提交"); ErrorCode STOCK_OUT_NO_EXISTS = new ErrorCode(1_030_402_004, "生成出库单失败,请重新提交");
ErrorCode STOCK_OUT_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "其它出库单({})已审核,无法修改"); ErrorCode STOCK_OUT_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "其它出库单({})已审核,无法修改");
ErrorCode STOCK_OUT_UPDATE_FAIL_PROCESS = new ErrorCode(1_030_402_006, "其它出库单({})审核中,无法修改");
ErrorCode STOCK_OUT_DELETE_FAIL_PROCESS = new ErrorCode(1_030_402_007, "其它出库单({})审核中,无法删除");
ErrorCode STOCK_OUT_SUBMIT_FAIL_STATUS = new ErrorCode(1_030_402_008, "提交审核失败,只有待提交或已驳回的出库单才能提交审核");
ErrorCode STOCK_OUT_SUBMIT_FAIL_USER = new ErrorCode(1_030_402_009, "提交审核失败,只有创建人才能提交审核");
ErrorCode STOCK_OUT_SUBMIT_FAIL_AUDIT_USER_EMPTY = new ErrorCode(1_030_402_010, "提交审核失败,请选择审核人");
ErrorCode STOCK_OUT_AUDIT_FAIL_STATUS = new ErrorCode(1_030_402_011, "审核失败,只有审核中的出库单才能审核");
ErrorCode STOCK_OUT_AUDIT_FAIL_USER = new ErrorCode(1_030_402_012, "审核失败,当前用户不是指定审核人");
ErrorCode STOCK_OUT_AUDIT_FAIL_RESULT = new ErrorCode(1_030_402_013, "审核失败,审核结果只支持通过或驳回");
ErrorCode STOCK_OUT_PACKAGE_COUNT_EXCEED = new ErrorCode(1_030_402_014, "出库失败,产品({})在仓库({})的库存包数为{},小于出库包数{}");
ErrorCode STOCK_OUT_PALLET_PACKAGE_COUNT_EXCEED = new ErrorCode(1_030_402_015, "出库失败,托盘({})的当前包数为{},小于出库包数{}");
ErrorCode PALLET_ALREADY_HAS_DIFFERENT_PRODUCT = new ErrorCode(1_030_400_011, "入库失败,托盘({})已装载产品({}),不能混装其他产品");
// ========== ERP 库存调拨单 1-030-403-000 ========== // ========== ERP 库存调拨单 1-030-403-000 ==========
ErrorCode STOCK_MOVE_NOT_EXISTS = new ErrorCode(1_030_402_000, "库存调拨单不存在"); ErrorCode STOCK_MOVE_NOT_EXISTS = new ErrorCode(1_030_402_000, "库存调拨单不存在");
@ -158,17 +125,6 @@ public interface ErrorCodeConstants {
ErrorCode STOCK_CHECK_APPROVE_FAIL = new ErrorCode(1_030_403_003, "审核失败,只有未审核的盘点单才能审核"); ErrorCode STOCK_CHECK_APPROVE_FAIL = new ErrorCode(1_030_403_003, "审核失败,只有未审核的盘点单才能审核");
ErrorCode STOCK_CHECK_NO_EXISTS = new ErrorCode(1_030_403_004, "生成盘点号失败,请重新提交"); ErrorCode STOCK_CHECK_NO_EXISTS = new ErrorCode(1_030_403_004, "生成盘点号失败,请重新提交");
ErrorCode STOCK_CHECK_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_403_005, "库存盘点单({})已审核,无法修改"); ErrorCode STOCK_CHECK_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_403_005, "库存盘点单({})已审核,无法修改");
ErrorCode STOCK_CHECK_DELETE_FAIL_PROCESS = new ErrorCode(1_030_403_006, "库存盘点单({})审核中,无法删除");
ErrorCode STOCK_CHECK_UPDATE_FAIL_PROCESS = new ErrorCode(1_030_403_007, "库存盘点单({})审核中,无法修改");
ErrorCode STOCK_CHECK_SUBMIT_FAIL_STATUS = new ErrorCode(1_030_403_008, "提交审核失败,只有待提交或已驳回的盘点单才能提交审核");
ErrorCode STOCK_CHECK_SUBMIT_FAIL_USER = new ErrorCode(1_030_403_009, "提交审核失败,只有创建人才能提交审核");
ErrorCode STOCK_CHECK_SUBMIT_FAIL_AUDIT_USER_EMPTY = new ErrorCode(1_030_403_010, "提交审核失败,请选择审核人");
ErrorCode STOCK_CHECK_AUDIT_FAIL_STATUS = new ErrorCode(1_030_403_011, "审核失败,只有审核中的盘点单才能审核");
ErrorCode STOCK_CHECK_AUDIT_FAIL_USER = new ErrorCode(1_030_403_012, "审核失败,当前用户不是指定审核人");
ErrorCode STOCK_CHECK_AUDIT_FAIL_RESULT = new ErrorCode(1_030_403_013, "审核失败,审核结果只支持通过或驳回");
ErrorCode STOCK_CHECK_SOURCE_TYPE_NOT_EXISTS = new ErrorCode(1_030_403_014, "盘点单生成来源类型不存在");
ErrorCode STOCK_CODE_EXISTS = new ErrorCode(1_030_403_014, "盘点单编码已存在");
// ========== ERP 产品库存 1-030-404-000 ========== // ========== ERP 产品库存 1-030-404-000 ==========
ErrorCode STOCK_COUNT_NEGATIVE = new ErrorCode(1_030_404_000, "操作失败,产品({})所在仓库({})的库存:{},小于变更数量:{}"); ErrorCode STOCK_COUNT_NEGATIVE = new ErrorCode(1_030_404_000, "操作失败,产品({})所在仓库({})的库存:{},小于变更数量:{}");
@ -196,8 +152,6 @@ public interface ErrorCodeConstants {
ErrorCode PRODUCT_UNIT_NOT_EXISTS = new ErrorCode(1_030_502_000, "产品单位不存在"); ErrorCode PRODUCT_UNIT_NOT_EXISTS = new ErrorCode(1_030_502_000, "产品单位不存在");
ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位"); ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位");
ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除"); ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除");
ErrorCode PRODUCT_UNIT_CONVERT_SELF_NOT_ALLOWED = new ErrorCode(1_030_502_003, "不能设置自己的单位换算自己的单位");
ErrorCode PRODUCT_PURCHASE_UNIT_CONVERT_QUANTITY_INVALID = new ErrorCode(1_030_502_004, "采购单位换算数量必须大于0");
// ========== ERP 结算账户 1-030-600-000 ========== // ========== ERP 结算账户 1-030-600-000 ==========
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在"); ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在");
@ -228,19 +182,15 @@ public interface ErrorCodeConstants {
ErrorCode MOLD_CODE_EMPTY = new ErrorCode(1_003_000_005, "模具编码不能为空"); ErrorCode MOLD_CODE_EMPTY = new ErrorCode(1_003_000_005, "模具编码不能为空");
ErrorCode MOLD_BRAND_CODE_DUPLICATE = new ErrorCode(1_003_000_006, "模具品牌编码已存在"); ErrorCode MOLD_BRAND_CODE_DUPLICATE = new ErrorCode(1_003_000_006, "模具品牌编码已存在");
ErrorCode MOLD_BRAND_CODE_EMPTY = new ErrorCode(1_003_000_007, "模具品牌编码不能为空"); ErrorCode MOLD_BRAND_CODE_EMPTY = new ErrorCode(1_003_000_007, "模具品牌编码不能为空");
// ========== 模具组相关 1_112_000 ==========
ErrorCode MOLD_SET_NOT_EXISTS = new ErrorCode(1_112_001, "模具组不存在");
ErrorCode MOLD_PRESSURE_NET_RECORD_NOT_EXISTS = new ErrorCode(1_112_002, "子模具压网记录不存在");
ErrorCode MOLD_SET_CODE_EMPTY = new ErrorCode(1_003_000_005, "模具组编码不能为空");
// ========== 编码规则相关 1_111_000 ==========
ErrorCode AUTOCODE_RECORD_NOT_EXISTS = new ErrorCode(1_111_003, "编码生成记录不存在"); ErrorCode AUTOCODE_RECORD_NOT_EXISTS = new ErrorCode(1_111_003, "编码生成记录不存在");
ErrorCode AUTOCODE_RULE_NOT_EXISTS = new ErrorCode(1_111_004, "编码规则不存在"); ErrorCode AUTOCODE_RULE_NOT_EXISTS = new ErrorCode(1_111_004, "编码规则不存在");
ErrorCode AUTOCODE_PART_NOT_EXISTS = new ErrorCode(1_111_005, "编码规则组成不存在"); ErrorCode AUTOCODE_PART_NOT_EXISTS = new ErrorCode(1_111_005, "编码规则组成不存在");
ErrorCode AUTOCODE_GEN_NOT_UNIQUE = new ErrorCode(1_111_006, "编码已存在"); ErrorCode AUTOCODE_GEN_NOT_UNIQUE = new ErrorCode(1_111_006, "编码已存在");
ErrorCode PRODUCT_REFERENCES_EXIST = new ErrorCode(1_003_000_000, "存在产品已被引用,请先删除引用。"); ErrorCode PRODUCT_REFERENCES_EXIST = new ErrorCode(1_003_000_000, "存在产品已被引用,请先删除引用。");
} }

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum ErpStockCheckApproveActionEnum {
SUBMIT("SUBMIT"),
AUTO_APPROVE("AUTO_APPROVE"),
APPROVE("APPROVE"),
REJECT("REJECT");
private final String actionType;
}

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
@Getter
public enum ErpStockCheckSourceTypeEnum implements IntArrayValuable {
BY_LOCATION(1, "按库存"),
BY_PRODUCT(2, "按产品");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockCheckSourceTypeEnum::getType).toArray();
private final Integer type;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum ErpStockInApproveActionEnum {
SUBMIT("SUBMIT"),
APPROVE("APPROVE"),
REJECT("REJECT"),
AUTO_APPROVE("AUTO_APPROVE");
private final String actionType;
}

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum ErpStockOutApproveActionEnum {
SUBMIT("SUBMIT"),
APPROVE("APPROVE"),
REJECT("REJECT"),
AUTO_APPROVE("AUTO_APPROVE");
private final String actionType;
}

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ErpStockOutModeEnum implements IntArrayValuable {
BY_PALLET(1, "按托出库"),
SPLIT_PALLET(2, "拆托出库");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockOutModeEnum::getMode).toArray();
private final Integer mode;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -25,11 +25,6 @@ public enum ErpStockRecordBizTypeEnum implements IntArrayValuable {
OTHER_OUT(20, "其他出库"), OTHER_OUT(20, "其他出库"),
OTHER_OUT_CANCEL(21, "其他出库(作废)"), OTHER_OUT_CANCEL(21, "其他出库(作废)"),
MATERIAL_IN(25, "物料入库"),
MATERIAL_IN_CANCEL(26, "物料入库(作废)"),
MATERIAL_OUT(27, "物料出库"),
MATERIAL_OUT_CANCEL(28, "物料出库(作废)"),
MOVE_IN(30, "调拨入库"), MOVE_IN(30, "调拨入库"),
MOVE_IN_CANCEL(31, "调拨入库(作废)"), MOVE_IN_CANCEL(31, "调拨入库(作废)"),
MOVE_OUT(32, "调拨出库"), MOVE_OUT(32, "调拨出库"),
@ -52,20 +47,15 @@ public enum ErpStockRecordBizTypeEnum implements IntArrayValuable {
PURCHASE_RETURN(80, "采购退货出库"), PURCHASE_RETURN(80, "采购退货出库"),
PURCHASE_RETURN_CANCEL(81, "采购退货出库(作废)"), PURCHASE_RETURN_CANCEL(81, "采购退货出库(作废)"),
SPARE_PARTS(90, "备件入库"), SPARE_PARTS(90, "备件入库"),
SPARE_PARTS_INVALIDATION(91, "备件入库(作废)"), SPARE_PARTS_INVALIDATION(91, "备件入库(作废)"),
SPARE_PARTS_OUT(100, "备件出库"), SPARE_PARTS_OUT(100, "备件出库"),
SPARE_PARTS_OUT_INVALIDATION(101, "备件出库(作废)"), SPARE_PARTS_OUT_INVALIDATION(101, "备件出库(作废)"),
KEY_PART_OUT(100, "关键件出库"),
KEY_PART_OUT_INVALIDATION(101, "关键件出库(作废)"),
PRODUCT_WAREHOUSING(110, "产品入库"), PRODUCT_WAREHOUSING(110, "产品入库"),
PRODUCT_WAREHOUSING_VOID(111, "产品入库(作废)"), PRODUCT_WAREHOUSING_VOID(111, "产品入库(作废)"),
PRODUCT_OUT(112, "产品出库"),
PRODUCT_OUT_CANCEL(113, "产品出库(作废)"),
RAW_MATERIAL_OUT(27, "原料出库"),
RAW_MATERIAL_OUT_CANCEL(28, "原料出库(作废)"),
; ;
@ -99,6 +89,7 @@ public enum ErpStockRecordBizTypeEnum implements IntArrayValuable {
if (type == null) { if (type == null) {
return null; return null;
} }
// status = 10 表示作废
if (Objects.equals(status, 10)) { if (Objects.equals(status, 10)) {
return type + 1; return type + 1;
} }

@ -27,16 +27,6 @@
<artifactId>yudao-module-erp-api</artifactId> <artifactId>yudao-module-erp-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-mes-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 --> <!-- 业务组件 -->

@ -13,8 +13,6 @@ import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandProductDO;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO; import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO; import cn.iocoder.yudao.module.common.dal.dataobject.moldrepair.MoldRepairDO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandPageRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO; import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldBrandTreeRespVO;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService; import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
@ -47,7 +45,7 @@ public class MoldBrandController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建模具型号") @Operation(summary = "创建模具型号")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:create')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:create')")
public CommonResult<Long> createMoldBrand(@Valid @RequestBody MoldBrandSaveReqVO createReqVO) throws UnsupportedEncodingException { public CommonResult<Long> createMoldBrand(@Valid @RequestBody MoldBrandSaveReqVO createReqVO) {
return success(moldBrandService.createMoldBrand(createReqVO)); return success(moldBrandService.createMoldBrand(createReqVO));
} }
@ -73,26 +71,22 @@ public class MoldBrandController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<MoldBrandRespVO> getMoldBrand(@RequestParam("id") Long id) { public CommonResult<MoldBrandRespVO> getMoldBrand(@RequestParam("id") Long id) {
MoldBrandRespVO respVO = moldBrandService.getMoldBrandDetail(id); MoldBrandDO moldBrand = moldBrandService.getMoldBrand(id);
moldBrandService.fillLatestOperateDeviceName(respVO); return success(BeanUtils.toBean(moldBrand, MoldBrandRespVO.class));
return success(respVO);
} }
@GetMapping("/getBrandList") @GetMapping("/getBrandList")
@Operation(summary = "获得模具型号列表") @Operation(summary = "获得模具型号列表")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<List<MoldBrandRespVO>> getBrandList(MoldBrandPageReqVO pageReqVO) { public CommonResult<List<MoldBrandDO>> getBrandList(MoldBrandPageReqVO pageReqVO) {
PageResult<MoldBrandRespVO> pageResult = moldBrandService.getMoldBrandPage(pageReqVO); List<MoldBrandDO> brandDOList = moldBrandService.selectBy(pageReqVO);
return success(pageResult.getList()); return success(brandDOList);
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得模具型号分页") @Operation(summary = "获得模具型号分页")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<MoldBrandPageRespVO> getMoldBrandPage(@Valid MoldBrandPageReqVO pageReqVO) { public CommonResult<PageResult<MoldBrandRespVO>> getMoldBrandPage(@Valid MoldBrandPageReqVO pageReqVO) {
MoldBrandPageRespVO respVO = moldBrandService.getMoldBrandPageWithStatistics(pageReqVO); PageResult<MoldBrandRespVO> pageResult = moldBrandService.getMoldBrandPage(pageReqVO);
if (respVO != null && respVO.getPageResult() != null) { return success(pageResult);
moldBrandService.fillLatestOperateDeviceName(respVO.getPageResult().getList());
}
return success(respVO);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ -142,8 +136,8 @@ public class MoldBrandController {
@GetMapping("/mold/list") @GetMapping("/mold/list")
@Operation(summary = "获得模具列表") @Operation(summary = "获得模具列表")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<List<MoldDO>> getMoldList(@Valid MoldPageReqVO pageReqVO) { public CommonResult<List<MoldDO>> getMoldList() {
List<MoldDO> moldDOList = moldBrandService.getMoldList(pageReqVO); List<MoldDO> moldDOList = moldBrandService.getMoldList();
return success(moldDOList); return success(moldDOList);
} }
@ -157,8 +151,8 @@ public class MoldBrandController {
@PutMapping("/mold/update") @PutMapping("/mold/update")
@Operation(summary = "更新模具") @Operation(summary = "更新模具")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:update')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:update')")
public CommonResult<Boolean> updateMold(@Valid @RequestBody MoldSaveReqVO updateReqVO) { public CommonResult<Boolean> updateMold(@Valid @RequestBody MoldDO mold) {
moldBrandService.updateMold(updateReqVO); moldBrandService.updateMold(mold);
return success(true); return success(true);
} }
@ -173,10 +167,10 @@ public class MoldBrandController {
@GetMapping("/mold/get") @GetMapping("/mold/get")
@Operation(summary = "获得模具") @Operation(summary = "获得模具")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')") @PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<MoldDO> getMold(@RequestParam(value = "id", required = false) Long id, public CommonResult<MoldDO> getMold(@RequestParam("id") Long id) {
@RequestParam(value = "code", required = false) String code) { return success(moldBrandService.getMold(id));
return success(moldBrandService.getMold(id, code));
} }
@GetMapping("/mold/export-excel") @GetMapping("/mold/export-excel")

@ -1,106 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldPressureNetRecordPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldPressureNetRecordRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldPressureNetRecordSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldPressureNetRecordDO;
import cn.iocoder.yudao.module.erp.service.mold.MoldPressureNetRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
@Tag(name = "管理后台 - 子模具压网记录")
@RestController
@RequestMapping("/erp/mold-pressure-net-record")
@Validated
public class MoldPressureNetRecordController {
@Resource
private MoldPressureNetRecordService moldPressureNetRecordService;
@PostMapping("/create")
@Operation(summary = "创建子模具压网记录")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:create')")
public CommonResult<Long> createMoldPressureNetRecord(@Valid @RequestBody MoldPressureNetRecordSaveReqVO createReqVO) {
return success(moldPressureNetRecordService.createMoldPressureNetRecord(createReqVO));
}
@PostMapping("/batch-create")
@Operation(summary = "批量创建子模具压网记录")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:create')")
public CommonResult<Boolean> createMoldPressureNetRecordBatch(@Valid @RequestBody List<MoldPressureNetRecordSaveReqVO> createReqVOList) {
moldPressureNetRecordService.createBatchMoldPressureNetRecord(createReqVOList);
return success(true);
}
@PutMapping("/update")
@Operation(summary = "更新子模具压网记录")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:update')")
public CommonResult<Boolean> updateMoldPressureNetRecord(@Valid @RequestBody MoldPressureNetRecordSaveReqVO updateReqVO) {
moldPressureNetRecordService.updateMoldPressureNetRecord(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除子模具压网记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:mold-brand:delete')")
public CommonResult<Boolean> deleteMoldPressureNetRecord(@RequestParam("id") Long id) {
moldPressureNetRecordService.deleteMoldPressureNetRecord(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得子模具压网记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<MoldPressureNetRecordRespVO> getMoldPressureNetRecord(@RequestParam("id") Long id) {
MoldPressureNetRecordDO record = moldPressureNetRecordService.getMoldPressureNetRecord(id);
return success(BeanUtils.toBean(record, MoldPressureNetRecordRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得子模具压网记录分页")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
public CommonResult<PageResult<MoldPressureNetRecordRespVO>> getMoldPressureNetRecordPage(@Valid MoldPressureNetRecordPageReqVO pageReqVO) {
PageResult<MoldPressureNetRecordDO> pageResult = moldPressureNetRecordService.getMoldPressureNetRecordPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MoldPressureNetRecordRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出子模具压网记录 Excel")
@PreAuthorize("@ss.hasPermission('erp:mold-brand:query')")
@ApiAccessLog(operateType = EXPORT)
public void exportMoldPressureNetRecordExcel(@Valid MoldPressureNetRecordPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MoldPressureNetRecordDO> list = moldPressureNetRecordService.getMoldPressureNetRecordPage(pageReqVO).getList();
ExcelUtils.write(response, "子模具压网记录.xls", "数据", MoldPressureNetRecordRespVO.class,
BeanUtils.toBean(list, MoldPressureNetRecordRespVO.class));
}
}

@ -29,9 +29,6 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "产品ID", example = "2336") @Schema(description = "产品ID", example = "2336")
private Long productId; private Long productId;
@Schema(description = "设备名称", example = "注塑机")
private String deviceName;
@Schema(description = "预期寿命(小时)") @Schema(description = "预期寿命(小时)")
private BigDecimal useTime; private BigDecimal useTime;

@ -1,32 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 模具型号分页 Response VO")
@Data
public class MoldBrandPageRespVO {
@Schema(description = "分页结果", requiredMode = Schema.RequiredMode.REQUIRED)
private PageResult<MoldBrandRespVO> pageResult;
@Schema(description = "全部数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Long allCount;
@Schema(description = "在机数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Long onMachineCount;
@Schema(description = "待用数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
private Long standbyCount;
@Schema(description = "在库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "8")
private Long inStockCount;
@Schema(description = "维修数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
private Long repairingCount;
@Schema(description = "报废数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Long scrappedCount;
}

@ -11,7 +11,6 @@ import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*; import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
@Schema(description = "管理后台 - 模具型号 Response VO") @Schema(description = "管理后台 - 模具型号 Response VO")
@ -41,50 +40,6 @@ public class MoldBrandRespVO {
// @ExcelProperty("产品") // @ExcelProperty("产品")
private String productName; private String productName;
@Schema(description = "图片", example = "https://example.com/mold.png")
@ExcelProperty("图片")
private String images;
@Schema(description = "图纸", example = "https://example.com/drawing.pdf")
@ExcelProperty("图纸")
private String drawings;
@Schema(description = "操作手册", example = "https://example.com/manual.pdf")
@ExcelProperty("操作手册")
private String operationManual;
@Schema(description = "操作视频", example = "https://example.com/video.mp4")
@ExcelProperty("操作视频")
private String operationVideo;
@Schema(description = "版本", example = "V1.0")
@ExcelProperty("版本")
private String version;
@Schema(description = "状态", example = "0")
@ExcelProperty("状态")
private Integer status;
@Schema(description = "当前位置", example = "一号机台")
@ExcelProperty("当前位置")
private String currentPosition;
@Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336")
private Long deviceId;
@Schema(description = "当前设备", example = "")
@ExcelProperty("当前设备")
private String deviceName;
@Schema(description = "子模数", example = "0")
private Long childMoldCount;
@Schema(description = "产品ID列表")
private List<Long> productIds;
@Schema(description = "产品列表")
private List<ErpProductDO> products;
@Schema(description = "预期寿命/次") @Schema(description = "预期寿命/次")
@ExcelProperty("预期寿命/次") @ExcelProperty("预期寿命/次")
private BigDecimal useTime; private BigDecimal useTime;
@ -120,11 +75,4 @@ public class MoldBrandRespVO {
@DictFormat("mes_org_type") @DictFormat("mes_org_type")
private String orgType; private String orgType;
// , converter = OrgTypeConverter.class // , converter = OrgTypeConverter.class
@Schema(description = "二维码", example = "")
private String qrCodeUrl;
@Schema(description = "打印模板", example = "")
private String templateJson;
} }

@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 模具型号状态统计 Response VO")
@Data
public class MoldBrandStatusStatisticsRespVO {
@Schema(description = "全部数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Long allCount;
@Schema(description = "在机数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Long onMachineCount;
@Schema(description = "待用数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
private Long standbyCount;
@Schema(description = "在库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "8")
private Long inStockCount;
@Schema(description = "维修数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
private Long repairingCount;
@Schema(description = "报废数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Long scrappedCount;
}

@ -1,42 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 子模具压网记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MoldPressureNetRecordPageReqVO extends PageParam {
@Schema(description = "模具组ID", example = "1")
private Long moldBrandId;
@Schema(description = "模具组名称", example = "A组")
private String moldBrandName;
@Schema(description = "子模具ID", example = "1")
private Long moldId;
@Schema(description = "子模具名称", example = "子模具A")
private String moldName;
@Schema(description = "压网时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] pressureNetTime;
@Schema(description = "备注", example = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,49 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 子模具压网记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MoldPressureNetRecordRespVO {
@Schema(description = "ID", example = "1")
@ExcelProperty("ID")
private Long id;
@Schema(description = "模具组ID", example = "1")
@ExcelProperty("模具组ID")
private Long moldBrandId;
@Schema(description = "模具组名称", example = "A组")
@ExcelProperty("模具组名称")
private String moldBrandName;
@Schema(description = "子模具ID", example = "1")
@ExcelProperty("子模具ID")
private Long moldId;
@Schema(description = "子模具名称", example = "子模具A")
@ExcelProperty("子模具名称")
private String moldName;
@Schema(description = "压网时间")
@ExcelProperty("压网时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime pressureNetTime;
@Schema(description = "备注", example = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -1,44 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.mold.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 子模具压网记录新增/修改 Request VO")
@Data
public class MoldPressureNetRecordSaveReqVO {
@Schema(description = "ID", example = "1")
private Long id;
@Schema(description = "模具组ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "模具组ID不能为空")
private Long moldBrandId;
@Schema(description = "模具组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "A组")
private String moldBrandName;
@Schema(description = "子模具ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "子模具ID不能为空")
private Long moldId;
@Schema(description = "子模具名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "子模具A")
private String moldName;
@Schema(description = "压网时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "压网时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime pressureNetTime;
@Schema(description = "备注", example = "备注")
private String remark;
}

@ -85,13 +85,4 @@ public class MoldRespVO {
@ExcelProperty("附件地址") @ExcelProperty("附件地址")
private String fileUrl; private String fileUrl;
@Schema(description = "压网时间")
@ExcelProperty("压网时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime pressureNetTime;
@Schema(description = "压网天数", example = "5")
@ExcelProperty("压网天数")
private Long pressureNetDays;
} }

@ -1,151 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.common.enums.QrcodeBizTypeEnum;
import cn.iocoder.yudao.module.common.service.qrcordrecord.QrcodeRecordService;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.vo.ErpPalletPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.vo.ErpPalletRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.vo.ErpPalletSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.pallet.ErpPalletDO;
import cn.iocoder.yudao.module.erp.service.pallet.ErpPalletService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Tag(name = "管理后台 - ERP 托盘")
@RestController
@RequestMapping("/erp/pallet")
@Validated
public class ErpPalletController {
@Resource
private ErpPalletService palletService;
@Resource
private QrcodeRecordService qrcodeService;
@PostMapping("/create")
@Operation(summary = "创建托盘")
@PreAuthorize("@ss.hasPermission('erp:pallet:create')")
public CommonResult<ErpPalletRespVO> createPallet(@Valid @RequestBody ErpPalletSaveReqVO createReqVO) {
Long id = palletService.createPallet(createReqVO);
return success(buildPalletRespVO(palletService.getPallet(id)));
}
@PutMapping("/update")
@Operation(summary = "更新托盘")
@PreAuthorize("@ss.hasPermission('erp:pallet:update')")
public CommonResult<ErpPalletRespVO> updatePallet(@Valid @RequestBody ErpPalletSaveReqVO updateReqVO) {
palletService.updatePallet(updateReqVO);
return success(buildPalletRespVO(palletService.getPallet(updateReqVO.getId())));
}
@DeleteMapping("/delete")
@Operation(summary = "删除托盘")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:pallet:delete')")
public CommonResult<Boolean> deletePallet(@RequestParam("id") Long id) {
palletService.deletePallet(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得托盘")
@Parameter(name = "id", description = "编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('erp:pallet:query')")
public CommonResult<ErpPalletRespVO> getPallet(@RequestParam("id") Long id) {
ErpPalletDO pallet = palletService.getPallet(id);
return success(buildPalletRespVO(pallet));
}
@GetMapping("/page")
@Operation(summary = "获得托盘分页")
@PreAuthorize("@ss.hasPermission('erp:pallet:query')")
public CommonResult<PageResult<ErpPalletRespVO>> getPalletPage(@Valid ErpPalletPageReqVO pageReqVO) {
PageResult<ErpPalletDO> pageResult = palletService.getPalletPage(pageReqVO);
Map<Long, String> qrcodeMap = qrcodeService.selectQrcodeUrlMapByBizTypeAndIds(QrcodeBizTypeEnum.PALLET.getCode(),
convertList(pageResult.getList(), ErpPalletDO::getId));
List<ErpPalletRespVO> list = convertList(pageResult.getList(), pallet -> buildPalletRespVO(pallet, qrcodeMap));
return success(new PageResult<>(list, pageResult.getTotal()));
}
@GetMapping("/export-excel")
@Operation(summary = "导出托盘 Excel")
@PreAuthorize("@ss.hasPermission('erp:pallet:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPalletExcel(@Valid ErpPalletPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
PageResult<ErpPalletDO> pageResult = palletService.getPalletPage(pageReqVO);
Map<Long, String> qrcodeMap = qrcodeService.selectQrcodeUrlMapByBizTypeAndIds(QrcodeBizTypeEnum.PALLET.getCode(),
convertList(pageResult.getList(), ErpPalletDO::getId));
List<ErpPalletRespVO> list = convertList(pageResult.getList(), pallet -> buildPalletRespVO(pallet, qrcodeMap));
ExcelUtils.write(response, "托盘.xls", "数据", ErpPalletRespVO.class, list);
}
@GetMapping("/simple-list")
@Operation(summary = "获得托盘精简列表")
@Parameter(name = "status", description = "托盘状态", example = "1")
public CommonResult<List<ErpPalletRespVO>> getPalletSimpleList(@RequestParam(value = "status", required = false) Integer status) {
List<ErpPalletDO> list = palletService.getPalletListByStatus(status);
Map<Long, String> qrcodeMap = qrcodeService.selectQrcodeUrlMapByBizTypeAndIds(QrcodeBizTypeEnum.PALLET.getCode(),
convertList(list, ErpPalletDO::getId));
return success(convertList(list, item -> buildPalletRespVO(item, qrcodeMap)));
}
@PostMapping("/regenerate-code")
public CommonResult<Boolean> regenerateCode(@RequestParam("id") Long id,
@RequestParam("code") String code) throws UnsupportedEncodingException {
palletService.regenerateCode(id, code);
return success(true);
}
private ErpPalletRespVO buildPalletRespVO(ErpPalletDO pallet) {
if (pallet == null) {
return null;
}
ErpPalletRespVO respVO = BeanUtils.toBean(pallet, ErpPalletRespVO.class);
fillPackagingInfo(respVO);
String qrcode = qrcodeService.selectQrcodeUrlByIdAndCode(QrcodeBizTypeEnum.PALLET.getCode(), pallet.getId(), pallet.getCode());
if (qrcode != null) {
respVO.setQrcode(qrcode);
}
return respVO;
}
private ErpPalletRespVO buildPalletRespVO(ErpPalletDO pallet, Map<Long, String> qrcodeMap) {
ErpPalletRespVO respVO = BeanUtils.toBean(pallet, ErpPalletRespVO.class);
fillPackagingInfo(respVO);
String qrcode = qrcodeMap.get(pallet.getId());
if (qrcode != null) {
respVO.setQrcode(qrcode);
}
return respVO;
}
private void fillPackagingInfo(ErpPalletRespVO respVO) {
if (respVO == null) {
return;
}
respVO.setPackageCount(respVO.getProductCount());
}
}

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ErpPalletStatusEnum implements IntArrayValuable {
IDLE(1, "空闲"),
OCCUPIED(2, "占用"),
SCRAPPED(3, "报废");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpPalletStatusEnum::getStatus).toArray();
private final Integer status;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ErpPalletTypeEnum implements IntArrayValuable {
PLASTIC(1, "塑料"),
STEEL(2, "钢质"),
WOOD(3, "木托盘");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpPalletTypeEnum::getType).toArray();
private final Integer type;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,62 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.enums.ErpPalletStatusEnum;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.enums.ErpPalletTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 托盘分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpPalletPageReqVO extends PageParam {
@Schema(description = "托盘编码", example = "TP202506100001")
private String code;
@Schema(description = "托盘类型", example = "1")
@InEnum(ErpPalletTypeEnum.class)
private Integer palletType;
@Schema(description = "托盘状态", example = "1")
@InEnum(ErpPalletStatusEnum.class)
private Integer status;
@Schema(description = "排除的托盘状态", example = "3")
private Integer excludeStatus;
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
@Schema(description = "库区编号", example = "11")
private Long areaId;
@Schema(description = "生产任务单号", example = "PLAN20250610001")
private String planCode;
@Schema(description = "产品编号", example = "1001")
private Long productId;
@Schema(description = "采购日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] purchaseDate;
@Schema(description = "投入使用日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate[] useDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,91 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 托盘 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpPalletRespVO {
@Schema(description = "托盘编号", example = "1")
@ExcelProperty("托盘编号")
private Long id;
@Schema(description = "托盘编码", example = "TP202506100001")
@ExcelProperty("托盘编码")
private String code;
@Schema(description = "托盘类型", example = "1")
@ExcelProperty("托盘类型")
private Integer palletType;
@Schema(description = "托盘规格", example = "1200×1000×150")
@ExcelProperty("托盘规格")
private String specification;
@Schema(description = "额定承载重量", example = "1000")
@ExcelProperty("额定承载重量")
private BigDecimal ratedLoadWeight;
@Schema(description = "单位", example = "kg")
@ExcelProperty("单位")
private String unit;
@Schema(description = "托盘状态", example = "1")
@ExcelProperty("托盘状态")
private Integer status;
@Schema(description = "仓库编号", example = "1")
@ExcelProperty("仓库编号")
private Long warehouseId;
@Schema(description = "库区编号", example = "11")
@ExcelProperty("库区编号")
private Long areaId;
@Schema(description = "生产任务单号", example = "PLAN20250610001")
@ExcelProperty("生产任务单号")
private String planCode;
@Schema(description = "产品编号", example = "1001")
@ExcelProperty("产品编号")
private Long productId;
@Schema(description = "产品名称", example = "产品A")
@ExcelProperty("产品名称")
private String productName;
@Schema(description = "产品数量", example = "120")
@ExcelProperty("产品数量")
private BigDecimal productCount;
@Schema(description = "当前包数", example = "20")
private BigDecimal packageCount;
@Schema(description = "二维码", example = "https://xxx.com/qrcode/pallet/1")
@ExcelProperty("二维码")
private String qrcode;
@Schema(description = "采购日期", example = "2025-06-10")
@ExcelProperty("采购日期")
private LocalDate purchaseDate;
@Schema(description = "投入使用日期", example = "2025-06-11")
@ExcelProperty("投入使用日期")
private LocalDate useDate;
@Schema(description = "备注", example = "用于成品周转")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -1,76 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.pallet.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.enums.ErpPalletStatusEnum;
import cn.iocoder.yudao.module.erp.controller.admin.pallet.enums.ErpPalletTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
@Schema(description = "管理后台 - ERP 托盘新增/修改 Request VO")
@Data
public class ErpPalletSaveReqVO {
@Schema(description = "托盘编号", example = "1")
private Long id;
@Schema(description = "托盘编码", example = "TP202506100001")
private String code;
@Schema(description = "托盘类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "托盘类型不能为空")
@InEnum(ErpPalletTypeEnum.class)
private Integer palletType;
@Schema(description = "托盘规格(长×宽×高)", example = "1200×1000×150")
private String specification;
@Schema(description = "额定承载重量", example = "1000")
private BigDecimal ratedLoadWeight;
@Schema(description = "单位", example = "kg")
private String unit;
@Schema(description = "托盘状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "托盘状态不能为空")
@InEnum(ErpPalletStatusEnum.class)
private Integer status;
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
@Schema(description = "库区编号", example = "11")
private Long areaId;
@Schema(description = "生产任务单号", example = "PLAN20250610001")
private String planCode;
@Schema(description = "产品编号", example = "1001")
private Long productId;
@Schema(description = "产品名称", example = "产品A")
private String productName;
@Schema(description = "产品数量", example = "120")
private BigDecimal productCount;
@Schema(description = "二维码", example = "https://xxx.com/qrcode/pallet/1")
private String qrcode;
@Schema(description = "采购日期", example = "2025-06-10")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate purchaseDate;
@Schema(description = "投入使用日期", example = "2025-06-11")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDate useDate;
@Schema(description = "备注", example = "用于成品周转")
private String remark;
}

@ -1,108 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme.ErpPackagingSchemePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme.ErpPackagingSchemeRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme.ErpPackagingSchemeSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpPackagingSchemeDO;
import cn.iocoder.yudao.module.erp.service.product.ErpPackagingSchemeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Tag(name = "管理后台 - ERP 包装方案")
@RestController
@RequestMapping("/erp/packaging-scheme")
@Validated
public class ErpPackagingSchemeController {
@Resource
private ErpPackagingSchemeService packagingSchemeService;
@PostMapping("/create")
@Operation(summary = "创建包装方案")
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:create')")
public CommonResult<Long> createPackagingScheme(@Valid @RequestBody ErpPackagingSchemeSaveReqVO createReqVO) {
return success(packagingSchemeService.createPackagingScheme(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新包装方案")
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:update')")
public CommonResult<Boolean> updatePackagingScheme(@Valid @RequestBody ErpPackagingSchemeSaveReqVO updateReqVO) {
packagingSchemeService.updatePackagingScheme(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除包装方案")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:delete')")
public CommonResult<Boolean> deletePackagingScheme(@RequestParam("id") Long id) {
packagingSchemeService.deletePackagingScheme(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得包装方案")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:query')")
public CommonResult<ErpPackagingSchemeRespVO> getPackagingScheme(@RequestParam("id") Long id) {
ErpPackagingSchemeDO scheme = packagingSchemeService.getPackagingScheme(id);
return success(BeanUtils.toBean(scheme, ErpPackagingSchemeRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得包装方案分页")
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:query')")
public CommonResult<PageResult<ErpPackagingSchemeRespVO>> getPackagingSchemePage(@Valid ErpPackagingSchemePageReqVO pageReqVO) {
PageResult<ErpPackagingSchemeDO> pageResult = packagingSchemeService.getPackagingSchemePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpPackagingSchemeRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得包装方案精简列表", description = "只包含已启用的包装方案")
public CommonResult<List<ErpPackagingSchemeRespVO>> getPackagingSchemeSimpleList() {
List<ErpPackagingSchemeDO> list = packagingSchemeService.getPackagingSchemeListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, item -> BeanUtils.toBean(item, ErpPackagingSchemeRespVO.class)));
}
@GetMapping("/export-excel")
@Operation(summary = "导出包装方案 Excel")
@PreAuthorize("@ss.hasPermission('erp:packaging-scheme:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPackagingSchemeExcel(@Valid ErpPackagingSchemePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpPackagingSchemeDO> list = packagingSchemeService.getPackagingSchemePage(pageReqVO).getList();
ExcelUtils.write(response, "包装方案.xls", "数据", ErpPackagingSchemeRespVO.class,
BeanUtils.toBean(list, ErpPackagingSchemeRespVO.class));
}
}

@ -8,8 +8,6 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryListReqVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryListReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryRespVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategorySaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategorySaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryTreeRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProductCategoryTypeGroupRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductCategoryService; import cn.iocoder.yudao.module.erp.service.product.ErpProductCategoryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -23,10 +21,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -82,30 +77,12 @@ public class ErpProductCategoryController {
return success(BeanUtils.toBean(list, ErpProductCategoryRespVO.class)); return success(BeanUtils.toBean(list, ErpProductCategoryRespVO.class));
} }
@GetMapping("/group-tree")
@Operation(summary = "按类型分组获得产品分类树")
@PreAuthorize("@ss.hasPermission('erp:product-category:query')")
public CommonResult<List<ErpProductCategoryTypeGroupRespVO>> getProductCategoryGroupTree(@Valid ErpProductCategoryListReqVO listReqVO) {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO);
Map<Integer, List<ErpProductCategoryDO>> typeMap = new LinkedHashMap<>();
for (ErpProductCategoryDO category : list) {
typeMap.computeIfAbsent(category.getType(), key -> new ArrayList<>()).add(category);
}
List<ErpProductCategoryTypeGroupRespVO> result = new ArrayList<>();
for (Map.Entry<Integer, List<ErpProductCategoryDO>> entry : typeMap.entrySet()) {
ErpProductCategoryTypeGroupRespVO group = new ErpProductCategoryTypeGroupRespVO();
group.setType(entry.getKey());
group.setChildren(buildCategoryTree(entry.getValue()));
result.add(group);
}
return success(result);
}
@GetMapping("/simple-list") @GetMapping("/simple-list")
@Operation(summary = "获得产品分类精简列表", description = "只包含被开启的分类,主要用于前端的下拉选项") @Operation(summary = "获得产品分类精简列表", description = "只包含被开启的分类,主要用于前端的下拉选项")
public CommonResult<List<ErpProductCategoryRespVO>> getProductCategorySimpleList(@RequestParam("type") Integer type) { public CommonResult<List<ErpProductCategoryRespVO>> getProductCategorySimpleList() {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList( List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(
new ErpProductCategoryListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()).setType(type)); new ErpProductCategoryListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
return success(convertList(list, category -> new ErpProductCategoryRespVO() return success(convertList(list, category -> new ErpProductCategoryRespVO()
.setId(category.getId()).setName(category.getName()).setParentId(category.getParentId()).setSort(category.getSort()))); .setId(category.getId()).setName(category.getName()).setParentId(category.getParentId()).setSort(category.getSort())));
} }
@ -117,31 +94,9 @@ public class ErpProductCategoryController {
public void exportProductCategoryExcel(@Valid ErpProductCategoryListReqVO listReqVO, public void exportProductCategoryExcel(@Valid ErpProductCategoryListReqVO listReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO); List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO);
// 导出 Excel
ExcelUtils.write(response, "产品分类.xls", "数据", ErpProductCategoryRespVO.class, ExcelUtils.write(response, "产品分类.xls", "数据", ErpProductCategoryRespVO.class,
BeanUtils.toBean(list, ErpProductCategoryRespVO.class)); BeanUtils.toBean(list, ErpProductCategoryRespVO.class));
} }
private List<ErpProductCategoryTreeRespVO> buildCategoryTree(List<ErpProductCategoryDO> categories) {
Map<Long, ErpProductCategoryTreeRespVO> nodeMap = new LinkedHashMap<>();
for (ErpProductCategoryDO category : categories) {
ErpProductCategoryTreeRespVO node = BeanUtils.toBean(category, ErpProductCategoryTreeRespVO.class);
node.setChildren(new ArrayList<>());
node.setLeaf(true);
nodeMap.put(category.getId(), node);
}
List<ErpProductCategoryTreeRespVO> roots = new ArrayList<>();
for (ErpProductCategoryDO category : categories) {
ErpProductCategoryTreeRespVO node = nodeMap.get(category.getId());
Long parentId = category.getParentId();
ErpProductCategoryTreeRespVO parent = parentId == null ? null : nodeMap.get(parentId);
if (parent == null || ErpProductCategoryDO.PARENT_ID_ROOT.equals(parentId)) {
roots.add(node);
continue;
}
parent.getChildren().add(node);
parent.setLeaf(false);
}
return roots;
}
} }

@ -104,10 +104,10 @@ public class ErpProductController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得产品") @Operation(summary = "获得产品")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:product:query')") @PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<ErpProductRespVO> getProduct(@RequestParam(value = "id", required = false) Long id, public CommonResult<ErpProductRespVO> getProduct(@RequestParam("id") Long id) {
@RequestParam(value = "code", required = false) String code) { return success(productService.getProduct(id));
return success(productService.getProduct(id, code));
} }
@GetMapping("/page") @GetMapping("/page")
@ -124,26 +124,17 @@ public class ErpProductController {
.setName(product.getName()).setBarCode(product.getBarCode()) .setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName()) .setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName()) .setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchaseUnitId(product.getPurchaseUnitId()).setPurchaseUnitName(product.getPurchaseUnitName()) .setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice())
.setMinPrice(product.getMinPrice()).setImages(product.getImages())));
} }
@GetMapping("/simple-list-product") @GetMapping("/simple-list-product")
@Operation(summary = "获得产品精简列表", description = "只包含被开启的产品,主要用于前端的下拉选项") @Operation(summary = "获得产品精简列表", description = "只包含被开启的产品,主要用于前端的下拉选项")
public CommonResult<List<ErpProductRespVO>> getProductSimpleList( public CommonResult<List<ErpProductRespVO>> getProductSimpleList() {
@Parameter(name = "categoryType", description = "产品分类类型", example = "1") List<ErpProductRespVO> list = productService.getProductVOListByCategory(ProductTypeEnum.PRODUCT.getTypeId());
@RequestParam(name = "categoryType", required = false) Integer categoryType) {
// List<ErpProductRespVO> list = productService.getProductVOListByCategory(ProductTypeEnum.PRODUCT.getTypeId(), categoryType);
List<ErpProductRespVO> list = productService.getProductVOListByCategory(null, categoryType);
return success(convertList(list, product -> new ErpProductRespVO().setId(product.getId()) return success(convertList(list, product -> new ErpProductRespVO().setId(product.getId())
.setName(product.getName()).setBarCode(product.getBarCode()) .setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName()) .setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName()) .setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchaseUnitId(product.getPurchaseUnitId()).setPurchaseUnitName(product.getPurchaseUnitName()) .setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice())
.setMinPrice(product.getMinPrice()).setImages(product.getImages())));
} }
@GetMapping("/simple-list-item") @GetMapping("/simple-list-item")
@Operation(summary = "获得原料精简列表", description = "只包含被开启的原料,主要用于前端的下拉选项") @Operation(summary = "获得原料精简列表", description = "只包含被开启的原料,主要用于前端的下拉选项")
@ -153,10 +144,7 @@ public class ErpProductController {
.setName(product.getName()).setBarCode(product.getBarCode()) .setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName()) .setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName()) .setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchaseUnitId(product.getPurchaseUnitId()).setPurchaseUnitName(product.getPurchaseUnitName()) .setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice())
.setMinPrice(product.getMinPrice()).setImages(product.getImages())));
} }
@Resource @Resource
private ErpProductCategoryService productCategoryService; private ErpProductCategoryService productCategoryService;
@ -178,10 +166,7 @@ public class ErpProductController {
.setName(product.getName()).setBarCode(product.getBarCode()) .setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName()) .setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName()) .setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchaseUnitId(product.getPurchaseUnitId()).setPurchaseUnitName(product.getPurchaseUnitName()) .setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice())
.setMinPrice(product.getMinPrice()).setImages(product.getImages())));
} }
@GetMapping("/simple-list-component") @GetMapping("/simple-list-component")
@Operation(summary = "获得备件精简列表", description = "用于前端的下拉选项") @Operation(summary = "获得备件精简列表", description = "用于前端的下拉选项")
@ -191,10 +176,7 @@ public class ErpProductController {
.setName(product.getName()).setBarCode(product.getBarCode()) .setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName()) .setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName()) .setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchaseUnitId(product.getPurchaseUnitId()).setPurchaseUnitName(product.getPurchaseUnitName()) .setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice())
.setMinPrice(product.getMinPrice()).setImages(product.getImages())));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出产品 Excel") @Operation(summary = "导出产品 Excel")

@ -10,15 +10,6 @@ public class ErpProductCategoryListReqVO {
@Schema(description = "分类名称", example = "芋艿") @Schema(description = "分类名称", example = "芋艿")
private String name; private String name;
@Schema(description = "分类编码", example = "S110")
private String code;
@Schema(description = "父分类编号", example = "0")
private Long parentId;
@Schema(description = "分类类型", example = "1")
private Integer type;
@Schema(description = "开启状态", example = "1") @Schema(description = "开启状态", example = "1")
private Integer status; private Integer status;

@ -2,14 +2,12 @@ package cn.iocoder.yudao.module.erp.controller.admin.product.vo.category;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
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 io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.PRODUCT_CATEGORY_TYPE;
import static cn.iocoder.yudao.module.system.enums.DictTypeConstants.COMMON_STATUS;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 产品分类 Response VO") @Schema(description = "管理后台 - ERP 产品分类 Response VO")
@ -37,14 +35,9 @@ public class ErpProductCategoryRespVO {
@ExcelProperty("分类排序") @ExcelProperty("分类排序")
private Integer sort; private Integer sort;
@Schema(description = "分类类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "分类类型", converter = DictConvert.class)
@DictFormat(PRODUCT_CATEGORY_TYPE)
private Integer type;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "开启状态", converter = DictConvert.class) @ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat(COMMON_STATUS) @DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)

@ -29,10 +29,6 @@ public class ErpProductCategorySaveReqVO {
@NotNull(message = "分类排序不能为空") @NotNull(message = "分类排序不能为空")
private Integer sort; private Integer sort;
@Schema(description = "分类类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// @NotNull(message = "分类类型不能为空")
private Integer type;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "开启状态不能为空") @NotNull(message = "开启状态不能为空")
private Integer status; private Integer status;

@ -1,20 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Schema(description = "管理后台 - ERP 产品分类树状 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ErpProductCategoryTreeRespVO extends ErpProductCategoryRespVO {
@Schema(description = "子分类列表")
private List<ErpProductCategoryTreeRespVO> children;
@Schema(description = "是否叶子节点", example = "true")
private Boolean leaf = true;
}

@ -1,18 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - ERP 产品分类按类型分组 Response VO")
@Data
public class ErpProductCategoryTypeGroupRespVO {
@Schema(description = "分类类型", example = "1")
private Integer type;
@Schema(description = "该类型下的树状分类列表")
private List<ErpProductCategoryTreeRespVO> children;
}

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 包装方案分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpPackagingSchemePageReqVO extends PageParam {
@Schema(description = "方案编码", example = "BZFA202501010001")
private String code;
@Schema(description = "方案名称", example = "标准包装方案")
private String name;
@Schema(description = "状态", example = "0")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,56 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 包装方案 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpPackagingSchemeRespVO {
@Schema(description = "包装方案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("编号")
private Long id;
@Schema(description = "方案编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "BZFA202501010001")
@ExcelProperty("方案编码")
private String code;
@Schema(description = "方案名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "标准包装方案")
@ExcelProperty("方案名称")
private String name;
@Schema(description = "每包数量(件)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
@ExcelProperty("每包数量(件)")
private BigDecimal packageQuantity;
@Schema(description = "每托包数(包)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
@ExcelProperty("每托包数(包)")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量(件)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
@ExcelProperty("每托总数量(件)")
private BigDecimal palletTotalQuantity;
@Schema(description = "备注", example = "默认包装")
@ExcelProperty("备注")
private String remark;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -1,48 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.packagingscheme;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 包装方案新增/修改 Request VO")
@Data
public class ErpPackagingSchemeSaveReqVO {
@Schema(description = "包装方案编号", example = "1")
private Long id;
@Schema(description = "方案编码", example = "BZFA202501010001")
private String code;
@Schema(description = "方案名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "标准包装方案")
@NotBlank(message = "方案名称不能为空")
private String name;
@Schema(description = "每包数量(件)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
@NotNull(message = "每包数量不能为空")
@DecimalMin(value = "0", inclusive = false, message = "每包数量必须大于 0")
private BigDecimal packageQuantity;
@Schema(description = "每托包数(包)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
@NotNull(message = "每托包数不能为空")
@DecimalMin(value = "0", inclusive = false, message = "每托包数必须大于 0")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量(件)", example = "2000")
private BigDecimal palletTotalQuantity;
@Schema(description = "备注", example = "默认包装")
private String remark;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@NotNull(message = "状态不能为空")
@InEnum(CommonStatusEnum.class)
private Integer status;
}

@ -62,15 +62,6 @@ public class ErpProductImportExcelVO {
@ExcelIgnore @ExcelIgnore
private Long unitId; // 单位ID private Long unitId; // 单位ID
@ExcelIgnore
private Long purchaseUnitId; // 采购单位ID
@ExcelIgnore
private String purchaseUnitName; // 采购单位名称
@ExcelIgnore
private BigDecimal purchaseUnitConvertQuantity; // 采购单位换算数量
@ExcelIgnore @ExcelIgnore
private LocalDateTime createTime; private LocalDateTime createTime;

@ -15,9 +15,6 @@ public class ErpProductListReqVO {
@Schema(description = "产品分类编号", example = "11161") @Schema(description = "产品分类编号", example = "11161")
private Long categoryId; private Long categoryId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "产品编号", example = "11161") @Schema(description = "产品编号", example = "11161")
private String code; private String code;

@ -20,9 +20,6 @@ public class ErpProductPageReqVO extends PageParam {
@Schema(description = "产品分类编号", example = "11161") @Schema(description = "产品分类编号", example = "11161")
private Long categoryId; private Long categoryId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;

@ -33,9 +33,6 @@ public class ErpProductRespVO extends ErpProductDO {
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11161") @Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11161")
private Long categoryId; private Long categoryId;
@Schema(description = "产品分类类型")
private Integer categoryType;
@Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果") @Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果")
@ExcelProperty("产品分类") @ExcelProperty("产品分类")
private String categoryName; private String categoryName;
@ -53,18 +50,6 @@ public class ErpProductRespVO extends ErpProductDO {
@ExcelProperty("单位") @ExcelProperty("单位")
private String unitName; private String unitName;
@Schema(description = "采购单位编号", example = "8890")
@ExcelProperty("采购单位编号")
private Long purchaseUnitId;
@Schema(description = "采购单位", example = "包")
@ExcelProperty("采购单位")
private String purchaseUnitName;
@Schema(description = "采购单位换算数量", example = "100")
@ExcelProperty("采购单位换算数量")
private BigDecimal purchaseUnitConvertQuantity;
@Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("产品状态") @ExcelProperty("产品状态")
private Integer status; private Integer status;
@ -105,31 +90,6 @@ public class ErpProductRespVO extends ErpProductDO {
@ExcelProperty("预警库存") @ExcelProperty("预警库存")
private BigDecimal safetyNumber; private BigDecimal safetyNumber;
@Schema(description = "默认仓库 ID", example = "1")
private Long defaultWarehouseId;
@Schema(description = "默认仓库名称", example = "成品仓")
private String defaultWarehouseName;
@Schema(description = "是否易损件", example = "1")
private Integer fragileFlag;
@Schema(description = "采购周期(天)", example = "30")
private Integer purchaseCycle;
@Schema(description = "备件等级", example = "A")
private String sparePartLevel;
@Schema(description = "品牌", example = "SKF")
private String brand;
@Schema(description = "型号", example = "6205-2RS")
private String model;
@Schema(description = "图片", example = "https://xxx.com/a.png")
@ExcelProperty("图片")
private String images;
@Schema(description = "二维码地址", example = "") @Schema(description = "二维码地址", example = "")
private String qrcodeUrl; private String qrcodeUrl;
// //
@ -139,24 +99,10 @@ public class ErpProductRespVO extends ErpProductDO {
// @Schema(description = "关联模具D列表", example = "[11,15,23]") // @Schema(description = "关联模具D列表", example = "[11,15,23]")
// private List<Long> moldIds; // private List<Long> moldIds;
@Schema(description = "打印模板Json", example = "")
private String templateJson;
@Schema(description = "关联设备列表") @Schema(description = "关联设备列表")
private List<ProductRelationRespVO> devices; private List<ProductRelationRespVO> devices;
@Schema(description = "关联模具列表") @Schema(description = "关联模具列表")
private List<ProductRelationRespVO> molds; private List<ProductRelationRespVO> molds;
@Schema(description = "可用包装方案列表")
private List<ProductPackagingSchemeRespVO> packagingSchemes;
@Schema(description = "默认包装方案 ID", example = "1")
private Long defaultPackagingSchemeId;
@Schema(description = "供应商列表")
private List<ProductSupplierRespVO> suppliers;
@Schema(description = "默认供应商 ID", example = "1")
private Long defaultSupplierId;
} }

@ -1,33 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 产品关联包装方案 Response VO")
@Data
public class ProductPackagingSchemeRespVO {
@Schema(description = "关联记录 ID", example = "1")
private Long id;
@Schema(description = "包装方案 ID", example = "1")
private Long packagingSchemeId;
@Schema(description = "包装方案名称", example = "标准包装方案")
private String packagingSchemeName;
@Schema(description = "每包数量(件)", example = "100")
private BigDecimal packageQuantity;
@Schema(description = "每托包数(包)", example = "20")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量(件)", example = "2000")
private BigDecimal palletTotalQuantity;
@Schema(description = "是否默认方案", example = "1")
private Integer defaultStatus;
}

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 产品关联包装方案 Request VO")
@Data
public class ProductPackagingSchemeSaveReqVO {
@Schema(description = "包装方案 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "包装方案 ID 不能为空")
private Long packagingSchemeId;
@Schema(description = "是否默认方案", example = "1")
private Integer defaultStatus;
}

@ -4,7 +4,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -36,15 +35,6 @@ public class ProductSaveReqVO {
@NotNull(message = "单位编号不能为空") @NotNull(message = "单位编号不能为空")
private Long unitId; private Long unitId;
@Schema(description = "采购单位编号", example = "8890")
private Long purchaseUnitId;
@Schema(description = "采购单位名称", example = "包")
private String purchaseUnitName;
@Schema(description = "采购单位换算数量", example = "100")
private BigDecimal purchaseUnitConvertQuantity;
@Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "产品状态不能为空") @NotNull(message = "产品状态不能为空")
private Integer status; private Integer status;
@ -73,44 +63,9 @@ public class ProductSaveReqVO {
@Schema(description = "预警库存", example = "161.87") @Schema(description = "预警库存", example = "161.87")
private BigDecimal safetyNumber; private BigDecimal safetyNumber;
@Schema(description = "默认仓库 ID", example = "1")
private Long defaultWarehouseId;
@Schema(description = "是否易损件", example = "1")
private Integer fragileFlag;
@Schema(description = "采购周期(天)", example = "30")
private Integer purchaseCycle;
@Schema(description = "备件等级", example = "A")
private String sparePartLevel;
@Schema(description = "品牌", example = "SKF")
private String brand;
@Schema(description = "型号", example = "6205-2RS")
private String model;
@Schema(description = "图片", example = "https://xxx.com/a.png")
private String images;
@Schema(description = "关联设备ID列表", example = "[11,15,23]") @Schema(description = "关联设备ID列表", example = "[11,15,23]")
private List<Long> deviceIds; private List<Long> deviceIds;
@Schema(description = "关联模具D列表", example = "[11,15,23]") @Schema(description = "关联模具D列表", example = "[11,15,23]")
private List<Long> moldIds; private List<Long> moldIds;
@Schema(description = "可用包装方案列表")
@Valid
private List<ProductPackagingSchemeSaveReqVO> packagingSchemes;
@Schema(description = "默认包装方案 ID", example = "1")
private Long defaultPackagingSchemeId;
@Schema(description = "供应商列表")
@Valid
private List<ProductSupplierSaveReqVO> suppliers;
@Schema(description = "默认供应商 ID", example = "1")
private Long defaultSupplierId;
} }

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 产品关联供应商 Response VO")
@Data
public class ProductSupplierRespVO {
@Schema(description = "关联记录 ID", example = "1")
private Long id;
@Schema(description = "供应商 ID", example = "1")
private Long supplierId;
@Schema(description = "供应商名称", example = "默认供应商")
private String supplierName;
@Schema(description = "是否默认供应商", example = "1")
private Integer defaultStatus;
}

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 产品关联供应商 Request VO")
@Data
public class ProductSupplierSaveReqVO {
@Schema(description = "供应商 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "供应商 ID 不能为空")
private Long supplierId;
@Schema(description = "是否默认供应商", example = "1")
private Integer defaultStatus;
}

@ -6,30 +6,16 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.ratelimiter.core.annotation.RateLimiter; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckApproveRecordRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckAuditReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckGenerateByLocationReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckGenerateByProductReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSubmitReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckApproveRecordDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductUnitService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockCheckService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockCheckService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.erp.service.warehousearea.WarehouseAreaService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -37,32 +23,21 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - ERP 库存盘点单") @Tag(name = "管理后台 - ERP 库存调拨单")
@RestController @RestController
@RequestMapping("/erp/stock-check") @RequestMapping("/erp/stock-check")
@Validated @Validated
@ -72,24 +47,19 @@ public class ErpStockCheckController {
private ErpStockCheckService stockCheckService; private ErpStockCheckService stockCheckService;
@Resource @Resource
private ErpProductService productService; private ErpProductService productService;
@Resource
private ErpProductUnitService productUnitService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource @Resource
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建库存盘点单") @Operation(summary = "创建库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:create')") @PreAuthorize("@ss.hasPermission('erp:stock-check:create')")
public CommonResult<Long> createStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO createReqVO) { public CommonResult<Long> createStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO createReqVO) {
return success(stockCheckService.createStockCheck(createReqVO)); return success(stockCheckService.createStockCheck(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新库存盘点单") @Operation(summary = "更新库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update')") @PreAuthorize("@ss.hasPermission('erp:stock-check:update')")
public CommonResult<Boolean> updateStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO updateReqVO) { public CommonResult<Boolean> updateStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO updateReqVO) {
stockCheckService.updateStockCheck(updateReqVO); stockCheckService.updateStockCheck(updateReqVO);
@ -97,56 +67,16 @@ public class ErpStockCheckController {
} }
@PutMapping("/update-status") @PutMapping("/update-status")
@Operation(summary = "更新库存盘点单状态") @Operation(summary = "更新库存调拨单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update')") @PreAuthorize("@ss.hasPermission('erp:stock-check:update-status')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockCheckStatus(@RequestParam("id") Long id, public CommonResult<Boolean> updateStockCheckStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) { @RequestParam("status") Integer status) {
stockCheckService.updateStockCheckStatus(id, status); stockCheckService.updateStockCheckStatus(id, status);
return success(true); return success(true);
} }
@PutMapping("/submit")
@Operation(summary = "提交库存盘点单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-check:submit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> submitStockCheckAudit(@Valid @RequestBody ErpStockCheckSubmitReqVO submitReqVO) {
stockCheckService.submitStockCheckAudit(submitReqVO);
return success(true);
}
@PutMapping("/audit")
@Operation(summary = "审核库存盘点单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:audit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> auditStockCheck(@Valid @RequestBody ErpStockCheckAuditReqVO auditReqVO) {
stockCheckService.auditStockCheck(auditReqVO);
return success(true);
}
@GetMapping("/approve-record-list")
@Operation(summary = "获得库存盘点单审核记录")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<List<ErpStockCheckApproveRecordRespVO>> getApproveRecordList(@RequestParam("id") Long id) {
return success(buildApproveRecordRespList(stockCheckService.getStockCheckApproveRecordList(id)));
}
@PostMapping("/generate-items/by-location")
@Operation(summary = "按仓库/库区生成盘点项")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<List<ErpStockCheckRespVO.Item>> generateItemsByLocation(@Valid @RequestBody ErpStockCheckGenerateByLocationReqVO reqVO) {
return success(stockCheckService.generateStockCheckItemsByLocation(reqVO));
}
@PostMapping("/generate-items/by-product")
@Operation(summary = "按产品生成盘点项")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<List<ErpStockCheckRespVO.Item>> generateItemsByProduct(@Valid @RequestBody ErpStockCheckGenerateByProductReqVO reqVO) {
return success(stockCheckService.generateStockCheckItemsByProduct(reqVO));
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除库存盘点单") @Operation(summary = "删除库存调拨单")
@Parameter(name = "ids", description = "编号数组", required = true) @Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-check:delete')") @PreAuthorize("@ss.hasPermission('erp:stock-check:delete')")
public CommonResult<Boolean> deleteStockCheck(@RequestParam("ids") List<Long> ids) { public CommonResult<Boolean> deleteStockCheck(@RequestParam("ids") List<Long> ids) {
@ -155,7 +85,7 @@ public class ErpStockCheckController {
} }
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得库存盘点单") @Operation(summary = "获得库存调拨单")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')") @PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<ErpStockCheckRespVO> getStockCheck(@RequestParam("id") Long id) { public CommonResult<ErpStockCheckRespVO> getStockCheck(@RequestParam("id") Long id) {
@ -163,100 +93,56 @@ public class ErpStockCheckController {
if (stockCheck == null) { if (stockCheck == null) {
return success(null); return success(null);
} }
return success(buildStockCheckRespVO(stockCheck, List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckId(id);
stockCheckService.getStockCheckItemListByCheckId(id), Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
stockCheckService.getStockCheckApproveRecordList(id))); convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
return success(BeanUtils.toBean(stockCheck, ErpStockCheckRespVO.class, stockCheckVO ->
stockCheckVO.setItems(BeanUtils.toBean(stockCheckItemList, ErpStockCheckRespVO.Item.class, item ->
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))))));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得库存盘点单分页") @Operation(summary = "获得库存调拨单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')") @PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<PageResult<ErpStockCheckRespVO>> getStockCheckPage(@Valid ErpStockCheckPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockCheckRespVO>> getStockCheckPage(@Valid ErpStockCheckPageReqVO pageReqVO) {
return success(buildStockCheckVOPageResult(stockCheckService.getStockCheckPage(pageReqVO))); PageResult<ErpStockCheckDO> pageResult = stockCheckService.getStockCheckPage(pageReqVO);
return success(buildStockCheckVOPageResult(pageResult));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出库存盘点单 Excel") @Operation(summary = "导出库存调拨单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-check:export')") @PreAuthorize("@ss.hasPermission('erp:stock-check:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportStockCheckExcel(@Valid ErpStockCheckPageReqVO pageReqVO, public void exportStockCheckExcel(@Valid ErpStockCheckPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockCheckRespVO> list = buildStockCheckVOPageResult(stockCheckService.getStockCheckPage(pageReqVO)).getList(); List<ErpStockCheckRespVO> list = buildStockCheckVOPageResult(stockCheckService.getStockCheckPage(pageReqVO)).getList();
ExcelUtils.write(response, "库存盘点单.xls", "数据", ErpStockCheckRespVO.class, list); // 导出 Excel
ExcelUtils.write(response, "库存调拨单.xls", "数据", ErpStockCheckRespVO.class, list);
} }
private PageResult<ErpStockCheckRespVO> buildStockCheckVOPageResult(PageResult<ErpStockCheckDO> pageResult) { private PageResult<ErpStockCheckRespVO> buildStockCheckVOPageResult(PageResult<ErpStockCheckDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) { if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal()); return PageResult.empty(pageResult.getTotal());
} }
// 1.1 盘点项
List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckIds( List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckIds(
convertSet(pageResult.getList(), ErpStockCheckDO::getId)); convertSet(pageResult.getList(), ErpStockCheckDO::getId));
Map<Long, List<ErpStockCheckItemDO>> stockCheckItemMap = convertMultiMap(stockCheckItemList, ErpStockCheckItemDO::getCheckId); Map<Long, List<ErpStockCheckItemDO>> stockCheckItemMap = convertMultiMap(stockCheckItemList, ErpStockCheckItemDO::getCheckId);
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(), // 1.2 产品信息
stockCheck -> Stream.of(NumberUtils.parseLong(stockCheck.getCreator()), stockCheck.getAuditUserId()))); Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
// 1.3 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), stockCheck -> Long.parseLong(stockCheck.getCreator())));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockCheckRespVO.class, stockCheck -> { return BeanUtils.toBean(pageResult, ErpStockCheckRespVO.class, stockCheck -> {
stockCheck.setItems(buildItemRespList(stockCheckItemMap.get(stockCheck.getId()))); stockCheck.setItems(BeanUtils.toBean(stockCheckItemMap.get(stockCheck.getId()), ErpStockCheckRespVO.Item.class,
stockCheck.setProductNames(CollUtil.join(stockCheck.getItems(), ",", ErpStockCheckRespVO.Item::getProductName)); item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
fillUserInfo(stockCheck, userMap); .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
}); stockCheck.setProductNames(CollUtil.join(stockCheck.getItems(), "", ErpStockCheckRespVO.Item::getProductName));
} MapUtils.findAndThen(userMap, Long.parseLong(stockCheck.getCreator()), user -> stockCheck.setCreatorName(user.getNickname()));
private ErpStockCheckRespVO buildStockCheckRespVO(ErpStockCheckDO stockCheck, List<ErpStockCheckItemDO> stockCheckItemList,
List<ErpStockCheckApproveRecordDO> approveRecords) {
ErpStockCheckRespVO stockCheckVO = BeanUtils.toBean(stockCheck, ErpStockCheckRespVO.class);
stockCheckVO.setItems(buildItemRespList(stockCheckItemList));
stockCheckVO.setProductNames(CollUtil.join(stockCheckVO.getItems(), ",", ErpStockCheckRespVO.Item::getProductName));
stockCheckVO.setApproveRecords(buildApproveRecordRespList(approveRecords));
fillUserInfo(stockCheckVO);
return stockCheckVO;
}
private List<ErpStockCheckRespVO.Item> buildItemRespList(List<ErpStockCheckItemDO> itemList) {
if (CollUtil.isEmpty(itemList)) {
return new ArrayList<>();
}
Map<Long, ErpProductDO> productMap = productService.getProductMap(convertSet(itemList, ErpStockCheckItemDO::getProductId));
Map<Long, ErpProductUnitDO> unitMap = productUnitService.getProductUnitMap(convertSet(itemList, item -> {
ErpProductDO product = productMap.get(item.getProductId());
return product != null ? product.getUnitId() : null;
}));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSet(itemList, ErpStockCheckItemDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(convertSet(itemList, ErpStockCheckItemDO::getAreaId));
return BeanUtils.toBean(itemList, ErpStockCheckRespVO.Item.class, item -> {
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()));
MapUtils.findAndThen(productMap, item.getProductId(), product ->
MapUtils.findAndThen(unitMap, product.getUnitId(), unit -> item.setProductUnitName(unit.getName())));
MapUtils.findAndThen(warehouseMap, item.getWarehouseId(), warehouse -> item.setWarehouseName(warehouse.getName()));
if (item.getAreaName() == null) {
MapUtils.findAndThen(areaMap, item.getAreaId(), area -> item.setAreaName(area.getAreaName()));
}
});
}
private void fillUserInfo(ErpStockCheckRespVO stockCheck) {
List<Long> userIds = new ArrayList<>();
userIds.add(NumberUtils.parseLong(stockCheck.getCreator()));
userIds.add(stockCheck.getAuditUserId());
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
fillUserInfo(stockCheck, userMap);
}
private void fillUserInfo(ErpStockCheckRespVO stockCheck, Map<Long, AdminUserRespDTO> userMap) {
MapUtils.findAndThen(userMap, NumberUtils.parseLong(stockCheck.getCreator()), user -> stockCheck.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, stockCheck.getAuditUserId(), user -> stockCheck.setAuditUserName(user.getNickname()));
}
private List<ErpStockCheckApproveRecordRespVO> buildApproveRecordRespList(List<ErpStockCheckApproveRecordDO> records) {
if (CollUtil.isEmpty(records)) {
return new ArrayList<>();
}
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(records,
record -> Stream.of(NumberUtils.parseLong(record.getCreator()), record.getTargetUserId())));
return BeanUtils.toBean(records, ErpStockCheckApproveRecordRespVO.class, record -> {
MapUtils.findAndThen(userMap, NumberUtils.parseLong(record.getCreator()), user -> record.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, record.getTargetUserId(), user -> record.setTargetUserName(user.getNickname()));
}); });
} }

@ -9,19 +9,13 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPackagingSchemeRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.pallet.ErpPalletDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.service.pallet.ErpPalletService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockRecordService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService; import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.erp.service.warehousearea.WarehouseAreaService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
@ -38,12 +32,8 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -61,27 +51,20 @@ public class ErpStockController {
private ErpProductService productService; private ErpProductService productService;
@Resource @Resource
private ErpWarehouseService warehouseService; private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private ErpStockRecordService stockRecordService;
@Resource
private ErpPalletService palletService;
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得产品库存") @Operation(summary = "获得产品库存")
@Parameters({ @Parameters({
@Parameter(name = "id", description = "编号", example = "1"), @Parameter(name = "id", description = "编号", example = "1"), // 方案一:传递 id
@Parameter(name = "productId", description = "产品编号", example = "10"), @Parameter(name = "productId", description = "产品编号", example = "10"), // 方案二:传递 productId + warehouseId
@Parameter(name = "warehouseId", description = "仓库编号", example = "2") @Parameter(name = "warehouseId", description = "仓库编号", example = "2")
}) })
@PreAuthorize("@ss.hasPermission('erp:stock:query')") @PreAuthorize("@ss.hasPermission('erp:stock:query')")
public CommonResult<ErpStockRespVO> getStock(@RequestParam(value = "id", required = false) Long id, public CommonResult<ErpStockRespVO> getStock(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "productId", required = false) Long productId, @RequestParam(value = "productId", required = false) Long productId,
@RequestParam(value = "warehouseId", required = false) Long warehouseId, @RequestParam(value = "warehouseId", required = false) Long warehouseId) {
@RequestParam(value = "areaId", required = false) Long areaId) { ErpStockDO stock = id != null ? stockService.getStock(id) : stockService.getStock(productId, warehouseId);
ErpStockDO stock = id != null ? stockService.getStock(id) : stockService.getStock(productId, warehouseId, areaId); return success(BeanUtils.toBean(stock, ErpStockRespVO.class));
return success(buildStockRespVO(stock));
} }
@GetMapping("/get-count") @GetMapping("/get-count")
@ -107,6 +90,7 @@ public class ErpStockController {
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockRespVO> list = buildStockVOPageResult(stockService.getStockPage(pageReqVO)).getList(); List<ErpStockRespVO> list = buildStockVOPageResult(stockService.getStockPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "产品库存.xls", "数据", ErpStockRespVO.class, list); ExcelUtils.write(response, "产品库存.xls", "数据", ErpStockRespVO.class, list);
} }
@ -118,221 +102,11 @@ public class ErpStockController {
convertSet(pageResult.getList(), ErpStockDO::getProductId)); convertSet(pageResult.getList(), ErpStockDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockDO::getWarehouseId)); convertSet(pageResult.getList(), ErpStockDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(
convertSet(pageResult.getList(), ErpStockDO::getAreaId));
Map<String, Long> palletCountMap = buildPalletCountMap(pageResult.getList());
return BeanUtils.toBean(pageResult, ErpStockRespVO.class, stock -> { return BeanUtils.toBean(pageResult, ErpStockRespVO.class, stock -> {
MapUtils.findAndThen(productMap, stock.getProductId(), product -> { MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName()).setBarCode(product.getBarCode())
stock.setProductName(product.getName()).setBarCode(product.getBarCode()) .setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName())
.setCategoryType(product.getCategoryType());
fillProductExtraInfo(stock, product);
fillPackagingSnapshot(stock, product);
});
stock.setPalletCount(palletCountMap.getOrDefault(buildStockKey(stock.getProductId(), stock.getWarehouseId(), stock.getAreaId()), 0L));
stock.setPackagingRule(buildPackagingRule(stock));
stock.setStockDisplay(buildStockDisplay(stock));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName())); MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
if (stock.getAreaName() == null) {
MapUtils.findAndThen(areaMap, stock.getAreaId(), area -> stock.setAreaName(area.getAreaName()));
}
fillRecentRecordTime(stock);
}); });
} }
private ErpStockRespVO buildStockRespVO(ErpStockDO stock) {
if (stock == null) {
return null;
}
ErpStockRespVO respVO = BeanUtils.toBean(stock, ErpStockRespVO.class);
ErpProductRespVO product = productService.getProduct(stock.getProductId());
if (product != null) {
respVO.setProductName(product.getName());
respVO.setBarCode(product.getBarCode());
respVO.setCategoryName(product.getCategoryName());
if (respVO.getUnitName() == null) {
respVO.setUnitName(product.getUnitName());
}
if (respVO.getCategoryType() == null) {
respVO.setCategoryType(product.getCategoryType());
}
fillProductExtraInfo(respVO, product);
fillPackagingSnapshot(respVO, product);
}
fillDerivedFields(respVO);
respVO.setPalletCount(getPalletCount(respVO));
respVO.setPackagingRule(buildPackagingRule(respVO));
respVO.setStockDisplay(buildStockDisplay(respVO));
ErpWarehouseDO warehouse = warehouseService.getWarehouse(stock.getWarehouseId());
if (warehouse != null) {
respVO.setWarehouseName(warehouse.getName());
}
if (respVO.getAreaName() == null && respVO.getAreaId() != null) {
WarehouseAreaDO area = warehouseAreaService.getWarehouseArea(respVO.getAreaId());
if (area != null) {
respVO.setAreaName(area.getAreaName());
}
}
fillRecentRecordTime(respVO);
return respVO;
}
private void fillRecentRecordTime(ErpStockRespVO stock) {
stock.setRecentInTime(stockRecordService.getLatestRecordTime(
stock.getProductId(), stock.getWarehouseId(), stock.getAreaId(), true));
stock.setRecentOutTime(stockRecordService.getLatestRecordTime(
stock.getProductId(), stock.getWarehouseId(), stock.getAreaId(), false));
}
private void fillProductExtraInfo(ErpStockRespVO stock, ErpProductRespVO product) {
if (stock.getUnitId() == null) {
stock.setUnitId(product.getUnitId());
}
if (stock.getPurchaseUnitId() == null) {
stock.setPurchaseUnitId(product.getPurchaseUnitId());
}
if (stock.getPurchaseUnitName() == null) {
stock.setPurchaseUnitName(product.getPurchaseUnitName());
}
if (stock.getPurchaseUnitConvertQuantity() == null) {
stock.setPurchaseUnitConvertQuantity(product.getPurchaseUnitConvertQuantity());
}
if (stock.getDefaultPackagingSchemeId() == null) {
stock.setDefaultPackagingSchemeId(product.getDefaultPackagingSchemeId());
}
if (stock.getDefaultPackagingScheme() == null) {
stock.setDefaultPackagingScheme(findDefaultPackagingScheme(product));
}
}
private void fillPackagingSnapshot(ErpStockRespVO stock, ErpProductRespVO product) {
if (stock.getDefaultPackagingSchemeName() != null
&& stock.getPackageQuantity() != null
&& stock.getPalletPackageQuantity() != null
&& stock.getPalletTotalQuantity() != null) {
return;
}
ProductPackagingSchemeRespVO defaultScheme = findDefaultPackagingScheme(product);
if (defaultScheme == null) {
return;
}
if (stock.getDefaultPackagingSchemeName() == null) {
stock.setDefaultPackagingSchemeName(defaultScheme.getPackagingSchemeName());
}
if (stock.getPackageQuantity() == null) {
stock.setPackageQuantity(defaultScheme.getPackageQuantity());
}
if (stock.getPalletPackageQuantity() == null) {
stock.setPalletPackageQuantity(defaultScheme.getPalletPackageQuantity());
}
if (stock.getPalletTotalQuantity() == null) {
stock.setPalletTotalQuantity(defaultScheme.getPalletTotalQuantity());
}
}
private void fillDerivedFields(ErpStockRespVO stock) {
if (stock.getUnitName() == null && stock.getUnitId() != null) {
// no-op: 目前库存单位名称只能从产品侧回填
}
if (stock.getDefaultPackagingSchemeId() == null && stock.getDefaultPackagingScheme() != null) {
stock.setDefaultPackagingSchemeId(stock.getDefaultPackagingScheme().getPackagingSchemeId());
}
}
private ProductPackagingSchemeRespVO findDefaultPackagingScheme(ErpProductRespVO product) {
if (product == null || product.getDefaultPackagingSchemeId() == null || CollUtil.isEmpty(product.getPackagingSchemes())) {
return null;
}
return product.getPackagingSchemes().stream()
.filter(item -> product.getDefaultPackagingSchemeId().equals(item.getPackagingSchemeId()))
.findFirst()
.orElse(null);
}
private String buildPackagingRule(ErpStockRespVO stock) {
if (stock == null) {
return null;
}
if (isProductType(stock.getCategoryType())) {
if (stock.getPackageQuantity() == null || stock.getPalletPackageQuantity() == null) {
return null;
}
return "1托=" + formatNumber(stock.getPalletPackageQuantity()) + "包 1包=" + formatNumber(stock.getPackageQuantity()) + "个";
}
if (stock.getPurchaseUnitName() == null || stock.getPurchaseUnitConvertQuantity() == null) {
return null;
}
return "1" + stock.getPurchaseUnitName() + "=" + formatNumber(stock.getPurchaseUnitConvertQuantity()) + "个";
}
private String buildStockDisplay(ErpStockRespVO stock) {
if (stock == null || stock.getCount() == null) {
return null;
}
if (isProductType(stock.getCategoryType())) {
if (stock.getPackageQuantity() == null || stock.getPackageQuantity().compareTo(BigDecimal.ZERO) <= 0) {
return formatNumber(stock.getCount()) + stock.getUnitName();
}
BigDecimal packageCount = stock.getCount().divide(stock.getPackageQuantity(), 0, RoundingMode.CEILING);
return formatNumber(BigDecimal.valueOf(stock.getPalletCount() != null ? stock.getPalletCount() : 0L)) + "\u6258"
+ formatNumber(packageCount) + "\u5305" + formatNumber(stock.getCount()) + stock.getUnitName();
}
if (stock.getPurchaseUnitConvertQuantity() == null || stock.getPurchaseUnitConvertQuantity().compareTo(BigDecimal.ZERO) <= 0
|| stock.getPurchaseUnitName() == null || stock.getUnitName() == null) {
return formatNumber(stock.getCount()) + stock.getUnitName();
}
BigDecimal purchaseCount = stock.getCount().divideToIntegralValue(stock.getPurchaseUnitConvertQuantity());
BigDecimal unitCount = stock.getCount().remainder(stock.getPurchaseUnitConvertQuantity());
StringBuilder display = new StringBuilder();
appendQuantity(display, purchaseCount, stock.getPurchaseUnitName(), true);
appendQuantity(display, unitCount, stock.getUnitName(), false);
return display.length() > 0 ? display.toString() : formatNumber(stock.getCount()) + stock.getUnitName();
}
private void appendQuantity(StringBuilder display, BigDecimal quantity, String unitName, boolean keepZero) {
if (quantity == null || quantity.compareTo(BigDecimal.ZERO) <= 0 || unitName == null) {
if (!keepZero) {
return;
}
if (display.length() > 0) {
display.append(",");
}
display.append("0").append(unitName);
return;
}
if (display.length() > 0) {
display.append(",");
}
display.append(formatNumber(quantity)).append(unitName);
}
private boolean isProductType(Integer categoryType) {
return Integer.valueOf(1).equals(categoryType);
}
private Map<String, Long> buildPalletCountMap(List<ErpStockDO> stockList) {
if (CollUtil.isEmpty(stockList)) {
return new HashMap<>();
}
return palletService.getOccupiedPalletList(convertSet(stockList, ErpStockDO::getProductId),
convertSet(stockList, ErpStockDO::getWarehouseId), convertSet(stockList, ErpStockDO::getAreaId)).stream()
.collect(Collectors.groupingBy(pallet -> buildStockKey(pallet.getProductId(), pallet.getWarehouseId(), pallet.getAreaId()),
Collectors.counting()));
}
private Long getPalletCount(ErpStockRespVO stock) {
return palletService.getOccupiedPalletList(Collections.singleton(stock.getProductId()),
Collections.singleton(stock.getWarehouseId()), Collections.singleton(stock.getAreaId())).stream()
.filter(pallet -> buildStockKey(stock.getProductId(), stock.getWarehouseId(), stock.getAreaId())
.equals(buildStockKey(pallet.getProductId(), pallet.getWarehouseId(), pallet.getAreaId())))
.count();
}
private String buildStockKey(Long productId, Long warehouseId, Long areaId) {
return String.valueOf(productId) + "_" + String.valueOf(warehouseId) + "_" + String.valueOf(areaId);
}
private String formatNumber(BigDecimal value) {
return value == null ? "0" : value.stripTrailingZeros().toPlainString();
}
} }

@ -6,44 +6,31 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.ratelimiter.core.annotation.RateLimiter; import cn.iocoder.yudao.framework.ratelimiter.core.annotation.RateLimiter;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO; import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInApproveRecordRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInAuditReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSubmitReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.StockInTypeEnum; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.StockInTypeEnum;
import cn.iocoder.yudao.module.erp.dal.dataobject.pallet.ErpPalletDO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO; import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInApproveRecordDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemPalletDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.enums.ErpStockInStatusEnum;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.erp.service.mold.MoldService; import cn.iocoder.yudao.module.erp.service.mold.MoldService;
import cn.iocoder.yudao.module.erp.service.pallet.ErpPalletService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService; import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.erp.service.warehousearea.WarehouseAreaService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -55,22 +42,14 @@ import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - ERP 其它入库单") @Tag(name = "管理后台 - ERP 其它入库单")
@ -87,16 +66,10 @@ public class ErpStockInController {
private ErpProductService productService; private ErpProductService productService;
@Resource @Resource
private ErpSupplierService supplierService; private ErpSupplierService supplierService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private MoldBrandService moldBrandService;
@Resource @Resource
private MoldService moldService; private MoldService moldService;
@Resource
private ErpPalletService palletService;
@Resource @Resource
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@ -121,36 +94,11 @@ public class ErpStockInController {
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS) @RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockInStatus(@RequestParam("id") Long id, public CommonResult<Boolean> updateStockInStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status, @RequestParam("status") Integer status,
@RequestParam(name = "bizType", required = false) Integer bizType) { @RequestParam(name = "status",required = false) Integer bizType) {
stockInService.updateStockInStatus(id, status,bizType); stockInService.updateStockInStatus(id, status,bizType);
return success(true); return success(true);
} }
@PutMapping("/submit")
@Operation(summary = "提交入库单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-in:submit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> submitStockInAudit(@Valid @RequestBody ErpStockInSubmitReqVO submitReqVO) {
stockInService.submitStockInAudit(submitReqVO);
return success(true);
}
@PutMapping("/audit")
@Operation(summary = "审核入库单")
@PreAuthorize("@ss.hasPermission('erp:stock-in:audit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> auditStockIn(@Valid @RequestBody ErpStockInAuditReqVO auditReqVO) {
stockInService.auditStockIn(auditReqVO);
return success(true);
}
@GetMapping("/approve-record-list")
@Operation(summary = "获得其它入库单审核记录")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<List<ErpStockInApproveRecordRespVO>> getApproveRecordList(@RequestParam("id") Long id) {
return success(buildApproveRecordRespList(stockInService.getStockInApproveRecordList(id)));
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除其它入库单") @Operation(summary = "删除其它入库单")
@Parameter(name = "ids", description = "编号数组", required = true) @Parameter(name = "ids", description = "编号数组", required = true)
@ -169,18 +117,45 @@ public class ErpStockInController {
if (stockIn == null) { if (stockIn == null) {
return success(null); return success(null);
} }
return success(buildStockInRespVO(stockIn, List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInId(id);
stockInService.getStockInItemListByInId(id), if (Objects.equals(stockIn.getInType(), "模具入库")) {
stockInService.getStockInApproveRecordList(id))); Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
return success(BeanUtils.toBean(stockIn, ErpStockInRespVO.class, stockInVO ->
stockInVO.setItems(BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
.setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()));
}))));
} else {
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
return success(BeanUtils.toBean(stockIn, ErpStockInRespVO.class, stockInVO ->
stockInVO.setItems(BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
}))));
}
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得其它入库单分页") @Operation(summary = "获得其它入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')") @PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> getStockInPage(@Valid ErpStockInPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockInRespVO>> getStockInPage(@Valid ErpStockInPageReqVO pageReqVO) {
fillPageReqDefault(pageReqVO); if(StringUtils.isEmpty(pageReqVO.getInType())){
applyItemFilter(pageReqVO); List<String> list = new ArrayList<>();
return success(buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO))); list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
pageReqVO.setInTypeList(list);
}
PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(pageResult));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ -189,278 +164,52 @@ public class ErpStockInController {
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportStockInExcel(@Valid ErpStockInPageReqVO pageReqVO, public void exportStockInExcel(@Valid ErpStockInPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
fillPageReqDefault(pageReqVO);
applyItemFilter(pageReqVO);
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockInRespVO> list = buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)).getList(); List<ErpStockInRespVO> list = buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它入库单.xls", "数据", ErpStockInRespVO.class, list); ExcelUtils.write(response, "其它入库单.xls", "数据", ErpStockInRespVO.class, list);
} }
private void applyItemFilter(ErpStockInPageReqVO pageReqVO) {
if (pageReqVO.getProductId() == null && pageReqVO.getWarehouseId() == null) {
return;
}
List<Long> ids = stockInService.getStockInIdsByItemFilter(pageReqVO.getProductId(), pageReqVO.getWarehouseId());
if (StringUtils.isNotBlank(pageReqVO.getIds())) {
List<Long> reqIds = Stream.of(pageReqVO.getIds().split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.map(Long::valueOf)
.collect(Collectors.toList());
ids = ids.stream().filter(reqIds::contains).collect(Collectors.toList());
}
if (CollUtil.isEmpty(ids)) {
pageReqVO.setIds("-1");
return;
}
pageReqVO.setIds(CollUtil.join(ids, ","));
pageReqVO.setProductId(null);
pageReqVO.setWarehouseId(null);
}
private void fillPageReqDefault(ErpStockInPageReqVO pageReqVO) {
if (StringUtils.isEmpty(pageReqVO.getInType())) {
List<String> list = new ArrayList<>();
list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
list.add(StockInTypeEnum..getValue());
pageReqVO.setInTypeList(list);
}
}
private PageResult<ErpStockInRespVO> buildStockInVOPageResult(PageResult<ErpStockInDO> pageResult) { private PageResult<ErpStockInRespVO> buildStockInVOPageResult(PageResult<ErpStockInDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) { if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal()); return PageResult.empty(pageResult.getTotal());
} }
List<ErpStockInDO> stockIns = pageResult.getList(); // 1.1 入库项
Map<Long, List<ErpStockInItemDO>> itemMap = stockInService.getStockInItemListByInIds( List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInIds(
convertSet(stockIns, ErpStockInDO::getId)).stream() convertSet(pageResult.getList(), ErpStockInDO::getId));
.collect(Collectors.groupingBy(ErpStockInItemDO::getInId)); Map<Long, List<ErpStockInItemDO>> stockInItemMap = convertMultiMap(stockInItemList, ErpStockInItemDO::getInId);
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(stockIns, // 1.2 产品信息
item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getStockUserId(), item.getAuditUserId()))); Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
// 1.3 供应商信息
Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap( Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
convertSet(stockIns, ErpStockInDO::getSupplierId)); convertSet(pageResult.getList(), ErpStockInDO::getSupplierId));
List<ErpStockInItemDO> allItems = convertListByFlatMap(itemMap.values(), Collection::stream); // 1.4 管理员信息
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(allItems, ErpStockInItemDO::getWarehouseId)); convertSet(pageResult.getList(), stockIn -> Long.parseLong(stockIn.getCreator())));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap( // 1.7 模具信息
convertSet(allItems, ErpStockInItemDO::getAreaId)); Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
Map<Long, ErpProductRespVO> productMap = productService.getProductSimpleVOMap( convertSet(stockInItemList, ErpStockInItemDO::getProductId));
convertSet(allItems, ErpStockInItemDO::getProductId));
Map<Long, MoldBrandDO> moldMap = moldBrandService.getMoldVOMap(
convertSet(allItems, ErpStockInItemDO::getMoldSetId));
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = moldService.getMoldListMapByBrandIds(
convertSet(allItems, ErpStockInItemDO::getMoldSetId));
Map<Long, List<ErpStockInItemPalletDO>> itemPalletMap = stockInService.getStockInItemPalletListByInIds(
convertSet(stockIns, ErpStockInDO::getId)).stream()
.collect(Collectors.groupingBy(ErpStockInItemPalletDO::getInItemId));
Map<Long, ErpPalletDO> palletMap = palletService.getPalletMap(
convertSet(convertListByFlatMap(itemPalletMap.values(), Collection::stream), ErpStockInItemPalletDO::getPalletId));
Map<String, ErpStockDO> stockMap = buildStockMap(allItems);
List<ErpStockInRespVO> list = convertList(stockIns, stockIn -> buildStockInRespVO(
stockIn, itemMap.getOrDefault(stockIn.getId(), Collections.emptyList()), Collections.emptyList(),
userMap, supplierMap, stockMap, warehouseMap, areaMap, productMap, moldMap, moldListMap,
itemPalletMap, palletMap));
return new PageResult<>(list, pageResult.getTotal());
}
private ErpStockInRespVO buildStockInRespVO(ErpStockInDO stockIn, List<ErpStockInItemDO> stockInItemList,
List<ErpStockInApproveRecordDO> approveRecords) {
return buildStockInRespVO(stockIn, stockInItemList, approveRecords,
null, null, null, null, null, null, null, null, null, null);
}
private ErpStockInRespVO buildStockInRespVO(ErpStockInDO stockIn, List<ErpStockInItemDO> stockInItemList,
List<ErpStockInApproveRecordDO> approveRecords,
Map<Long, AdminUserRespDTO> pageUserMap,
Map<Long, ErpSupplierDO> pageSupplierMap,
Map<String, ErpStockDO> pageStockMap,
Map<Long, ErpWarehouseDO> pageWarehouseMap,
Map<Long, WarehouseAreaDO> pageAreaMap,
Map<Long, ErpProductRespVO> pageProductMap,
Map<Long, MoldBrandDO> pageMoldMap,
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> pageMoldListMap,
Map<Long, List<ErpStockInItemPalletDO>> pageItemPalletMap,
Map<Long, ErpPalletDO> pagePalletMap) {
ErpStockInRespVO stockInVO = BeanUtils.toBean(stockIn, ErpStockInRespVO.class);
stockInVO.setStatusName(getStockInStatusName(stockIn.getStatus()));
Map<Long, ErpWarehouseDO> warehouseMap = pageWarehouseMap != null ? pageWarehouseMap : warehouseService.getWarehouseMap(
convertSet(stockInItemList, ErpStockInItemDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = pageAreaMap != null ? pageAreaMap : warehouseAreaService.getWarehouseAreaMap(
convertSet(stockInItemList, ErpStockInItemDO::getAreaId));
Map<Long, AdminUserRespDTO> userMap = pageUserMap != null ? pageUserMap : adminUserApi.getUserMap(convertListByFlatMap(
Collections.singletonList(stockIn), item -> Stream.of(NumberUtils.parseLong(item.getCreator()),
item.getStockUserId(), item.getAuditUserId())));
Map<Long, List<ErpStockInItemPalletDO>> itemPalletMap = pageItemPalletMap != null ? pageItemPalletMap
: stockInService.getStockInItemPalletListByInId(stockIn.getId()).stream()
.collect(Collectors.groupingBy(ErpStockInItemPalletDO::getInItemId));
Map<Long, ErpPalletDO> palletMap = pagePalletMap != null ? pagePalletMap : palletService.getPalletMap(
convertSet(convertListByFlatMap(itemPalletMap.values(), Collection::stream), ErpStockInItemPalletDO::getPalletId));
MapUtils.findAndThen(userMap, NumberUtils.parseLong(stockIn.getCreator()), user -> stockInVO.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, stockIn.getStockUserId(), user -> stockInVO.setStockUserName(user.getNickname()));
MapUtils.findAndThen(userMap, stockIn.getAuditUserId(), user -> stockInVO.setAuditUserName(user.getNickname()));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockInRespVO.class, stockIn -> {
if (Objects.equals(stockIn.getInType(), "模具入库")) { if (Objects.equals(stockIn.getInType(), "模具入库")) {
Map<Long, MoldBrandDO> moldMap = pageMoldMap != null ? pageMoldMap : moldBrandService.getMoldVOMap( stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
convertSet(stockInItemList, ErpStockInItemDO::getMoldSetId)); item -> MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = pageMoldListMap != null ? pageMoldListMap .setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()))));
: moldService.getMoldListMapByBrandIds(convertSet(stockInItemList, ErpStockInItemDO::getMoldSetId)); stockIn.setProductNames(CollUtil.join(stockIn.getItems(), "", ErpStockInRespVO.Item::getProductName));
stockInVO.setItems(convertList(stockInItemList, source -> {
ErpStockInRespVO.Item item = BeanUtils.toBean(source, ErpStockInRespVO.Item.class);
ErpStockDO stock = pageStockMap != null ? pageStockMap.get(buildStockKey(source.getMoldSetId(), source.getWarehouseId(), source.getAreaId()))
: stockService.getStock(source.getMoldSetId(), source.getWarehouseId(), source.getAreaId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
item.setMoldList(moldListMap.getOrDefault(source.getMoldSetId(), new ArrayList<>()));
fillWarehouseInfo(item, source, warehouseMap, areaMap);
item.setPallets(buildStockInPalletRespList(itemPalletMap.get(source.getId()), palletMap));
MapUtils.findAndThen(moldMap, source.getMoldSetId(), mold -> {
item.setMoldSetName(mold.getName());
item.setProductName(mold.getName());
item.setProductBarCode(mold.getCode());
});
return item;
}));
stockInVO.setMoldSetNames(CollUtil.join(stockInVO.getItems(), ",", ErpStockInRespVO.Item::getMoldSetName));
stockInVO.setProductNames(stockInVO.getMoldSetNames());
} else { } else {
Map<Long, ErpProductRespVO> productMap = pageProductMap != null ? pageProductMap : productService.getProductSimpleVOMap( stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
convertSet(stockInItemList, ErpStockInItemDO::getProductId)); item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
List<ErpStockInRespVO.Item> items = BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> { .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
ErpStockDO stock = pageStockMap != null ? pageStockMap.get(buildStockKey(item.getProductId(), item.getWarehouseId(), item.getAreaId())) stockIn.setProductNames(CollUtil.join(stockIn.getItems(), "", ErpStockInRespVO.Item::getProductName));
: stockService.getStock(item.getProductId(), item.getWarehouseId(), item.getAreaId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
if (StringUtils.isBlank(item.getWarehouseName())) {
MapUtils.findAndThen(warehouseMap, item.getWarehouseId(), warehouse -> item.setWarehouseName(warehouse.getName()));
}
if (StringUtils.isBlank(item.getAreaName())) {
MapUtils.findAndThen(areaMap, item.getAreaId(), area -> item.setAreaName(area.getAreaName()));
}
item.setPallets(buildStockInPalletRespList(itemPalletMap.get(item.getId()), palletMap));
MapUtils.findAndThen(productMap, item.getProductId(), product -> {
item.setProductName(product.getName());
item.setProductBarCode(product.getBarCode());
item.setProductUnitName(product.getUnitName());
item.setCategoryType(product.getCategoryType());
item.setSupplierId(product.getDefaultSupplierId());
if (product.getDefaultSupplierId() != null && CollUtil.isNotEmpty(product.getSuppliers())) {
product.getSuppliers().stream()
.filter(supplier -> Objects.equals(supplier.getSupplierId(), product.getDefaultSupplierId()))
.findFirst()
.ifPresent(supplier -> item.setSupplierName(supplier.getSupplierName()));
}
});
});
stockInVO.setItems(Objects.equals(stockIn.getInType(), StockInTypeEnum..getValue())
? mergeProductStockInItems(items) : items);
stockInVO.setProductNames(CollUtil.join(stockInVO.getItems(), ",", ErpStockInRespVO.Item::getProductName));
}
if (stockIn.getSupplierId() != null) {
Map<Long, ErpSupplierDO> supplierMap = pageSupplierMap != null ? pageSupplierMap
: supplierService.getSupplierMap(Collections.singleton(stockIn.getSupplierId()));
MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockInVO.setSupplierName(supplier.getName()));
}
stockInVO.setApproveRecords(buildApproveRecordRespList(approveRecords));
return stockInVO;
}
private Map<String, ErpStockDO> buildStockMap(List<ErpStockInItemDO> items) {
if (CollUtil.isEmpty(items)) {
return Collections.emptyMap();
}
boolean containsNullArea = items.stream().anyMatch(item -> item.getAreaId() == null);
return stockService.getStockList(
convertSet(convertListByFlatMap(items, item -> Stream.of(item.getProductId(), item.getMoldSetId())), Function.identity()),
convertSet(items, ErpStockInItemDO::getWarehouseId),
containsNullArea ? null : convertSet(items, ErpStockInItemDO::getAreaId)).stream()
.collect(Collectors.toMap(stock -> buildStockKey(stock.getProductId(), stock.getWarehouseId(), stock.getAreaId()),
Function.identity(), (left, right) -> left, HashMap::new));
}
private List<ErpStockInRespVO.Item> mergeProductStockInItems(List<ErpStockInRespVO.Item> items) {
if (CollUtil.isEmpty(items)) {
return Collections.emptyList();
}
Map<String, ErpStockInRespVO.Item> itemMap = new LinkedHashMap<>();
for (ErpStockInRespVO.Item sourceItem : items) {
String key = buildProductItemMergeKey(sourceItem.getProductId(), sourceItem.getProductPrice(),
sourceItem.getPackagingSchemeId(), sourceItem.getInputUnitType(), sourceItem.getInputCount(),
sourceItem.getRelateTask(), sourceItem.getTaskId(), sourceItem.getRemark());
ErpStockInRespVO.Item targetItem = itemMap.get(key);
if (targetItem == null) {
itemMap.put(key, copyMergedStockInItem(sourceItem));
continue;
} }
targetItem.setCount(defaultZero(targetItem.getCount()).add(defaultZero(sourceItem.getCount()))); MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockIn.setSupplierName(supplier.getName()));
targetItem.setPackageCount(defaultZero(targetItem.getPackageCount()).add(defaultZero(sourceItem.getPackageCount()))); MapUtils.findAndThen(userMap, Long.parseLong(stockIn.getCreator()), user -> stockIn.setCreatorName(user.getNickname()));
targetItem.getPallets().addAll(sourceItem.getPallets());
}
return new ArrayList<>(itemMap.values());
}
private ErpStockInRespVO.Item copyMergedStockInItem(ErpStockInRespVO.Item sourceItem) {
ErpStockInRespVO.Item targetItem = BeanUtils.toBean(sourceItem, ErpStockInRespVO.Item.class);
targetItem.setPallets(new ArrayList<>(sourceItem.getPallets() != null ? sourceItem.getPallets() : Collections.emptyList()));
return targetItem;
}
private String buildProductItemMergeKey(Object... values) {
return java.util.Arrays.stream(values).map(String::valueOf).collect(Collectors.joining("_"));
}
private BigDecimal defaultZero(BigDecimal value) {
return value != null ? value : BigDecimal.ZERO;
}
private String buildStockKey(Long productId, Long warehouseId, Long areaId) {
return String.valueOf(productId) + "_" + String.valueOf(warehouseId) + "_" + String.valueOf(areaId);
}
private List<ErpStockInRespVO.Item.PalletItem> buildStockInPalletRespList(List<ErpStockInItemPalletDO> itemPallets,
Map<Long, ErpPalletDO> palletMap) {
if (CollUtil.isEmpty(itemPallets)) {
return Collections.emptyList();
}
return convertList(itemPallets, itemPallet -> {
ErpStockInRespVO.Item.PalletItem palletItem = new ErpStockInRespVO.Item.PalletItem();
palletItem.setPalletId(itemPallet.getPalletId());
palletItem.setWarehouseId(itemPallet.getWarehouseId());
palletItem.setAreaId(itemPallet.getAreaId());
palletItem.setCount(itemPallet.getCount());
palletItem.setPackageCount(itemPallet.getPackageCount());
MapUtils.findAndThen(palletMap, itemPallet.getPalletId(), pallet -> palletItem.setPalletCode(pallet.getCode()));
return palletItem;
});
}
private List<ErpStockInApproveRecordRespVO> buildApproveRecordRespList(List<ErpStockInApproveRecordDO> records) {
if (CollUtil.isEmpty(records)) {
return new ArrayList<>();
}
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(records,
record -> Stream.of(NumberUtils.parseLong(record.getCreator()), record.getTargetUserId())));
return BeanUtils.toBean(records, ErpStockInApproveRecordRespVO.class, record -> {
MapUtils.findAndThen(userMap, NumberUtils.parseLong(record.getCreator()), user -> record.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, record.getTargetUserId(), user -> record.setTargetUserName(user.getNickname()));
record.setFromStatusName(getStockInStatusName(record.getFromStatus()));
record.setToStatusName(getStockInStatusName(record.getToStatus()));
}); });
} }
private void fillWarehouseInfo(ErpStockInRespVO.Item item, ErpStockInItemDO source,
Map<Long, ErpWarehouseDO> warehouseMap,
Map<Long, WarehouseAreaDO> areaMap) {
item.setWarehouseName(ObjectUtils.defaultIfNull(source.getWarehouseName(), item.getWarehouseName()));
item.setAreaName(ObjectUtils.defaultIfNull(source.getAreaName(), item.getAreaName()));
if (StringUtils.isBlank(item.getWarehouseName())) {
MapUtils.findAndThen(warehouseMap, source.getWarehouseId(), warehouse -> item.setWarehouseName(warehouse.getName()));
}
if (StringUtils.isBlank(item.getAreaName())) {
MapUtils.findAndThen(areaMap, source.getAreaId(), area -> item.setAreaName(area.getAreaName()));
}
}
@PostMapping("/createMesStockIn") @PostMapping("/createMesStockIn")
@Operation(summary = "创建生产入库单") @Operation(summary = "创建生产入库单")
@PreAuthorize("@ss.hasPermission('erp:stock-in:create')") @PreAuthorize("@ss.hasPermission('erp:stock-in:create')")
@ -468,36 +217,21 @@ public class ErpStockInController {
createReqVO.setInType(StockInTypeEnum..getValue()); createReqVO.setInType(StockInTypeEnum..getValue());
return success(stockInService.createStockIn(createReqVO)); return success(stockInService.createStockIn(createReqVO));
} }
@GetMapping("/pageMesStockIn") @GetMapping("/pageMesStockIn")
@Operation(summary = "获得生产入库单分页") @Operation(summary = "获得生产入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')") @PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> pageMesStockIn(@Valid ErpStockInPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockInRespVO>> pageMesStockIn(@Valid ErpStockInPageReqVO pageReqVO) {
pageReqVO.setInType(StockInTypeEnum..getValue()); pageReqVO.setInType(StockInTypeEnum..getValue());
fillPageReqDefault(pageReqVO); PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO))); return success(buildStockInVOPageResult(pageResult));
} }
@GetMapping("/pageComponent") @GetMapping("/pageComponent")
@Operation(summary = "获得备件入库单分页") @Operation(summary = "获得备件入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')") @PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> pageComponent(@Valid ErpStockInPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockInRespVO>> pageComponent(@Valid ErpStockInPageReqVO pageReqVO) {
pageReqVO.setInType(StockInTypeEnum..getValue()); pageReqVO.setInType(StockInTypeEnum..getValue());
fillPageReqDefault(pageReqVO); PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO))); return success(buildStockInVOPageResult(pageResult));
}
@PutMapping("/update-mold-status")
@Operation(summary = "更新模具入库单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateMoldStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockInService.updateMoldStatus(id, status);
return success(true);
} }
private String getStockInStatusName(Integer status) {
return ErpStockInStatusEnum.IN_STOCK.getStatus().equals(status) ? "已入库" : "待入库";
}
} }

@ -6,30 +6,21 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.ratelimiter.core.annotation.RateLimiter; import cn.iocoder.yudao.framework.ratelimiter.core.annotation.RateLimiter;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldBrandDO; import cn.iocoder.yudao.module.common.controller.admin.mold.vo.MoldRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutApproveRecordRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutAuditReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSubmitReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.StockOutTypeEnum; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.StockOutTypeEnum;
import cn.iocoder.yudao.module.erp.dal.dataobject.pallet.ErpPalletDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO; import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutApproveRecordDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemPalletDO;
import cn.iocoder.yudao.module.erp.enums.ErpStockOutStatusEnum;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.erp.service.mold.MoldService; import cn.iocoder.yudao.module.erp.service.mold.MoldService;
import cn.iocoder.yudao.module.erp.service.pallet.ErpPalletService;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService; import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService;
@ -42,14 +33,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -57,22 +41,14 @@ import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - ERP 其它出库单") @Tag(name = "管理后台 - ERP 其它出库单")
@ -89,12 +65,10 @@ public class ErpStockOutController {
private ErpProductService productService; private ErpProductService productService;
@Resource @Resource
private ErpCustomerService customerService; private ErpCustomerService customerService;
@Resource
private MoldBrandService moldBrandService;
@Resource @Resource
private MoldService moldService; private MoldService moldService;
@Resource
private ErpPalletService palletService;
@Resource @Resource
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@ -119,46 +93,11 @@ public class ErpStockOutController {
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS) @RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id, public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status, @RequestParam("status") Integer status,
@RequestParam(name = "bizType", required = false) Integer bizType) { @RequestParam(name = "status",required = false) Integer bizType) {
stockOutService.updateStockOutStatus(id, status,bizType); stockOutService.updateStockOutStatus(id, status,bizType);
return success(true); return success(true);
} }
@PutMapping("/submit")
@Operation(summary = "提交出库单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-out:submit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> submitStockOutAudit(@Valid @RequestBody ErpStockOutSubmitReqVO submitReqVO) {
stockOutService.submitStockOutAudit(submitReqVO);
return success(true);
}
@PutMapping("/audit")
@Operation(summary = "审核出库单")
@PreAuthorize("@ss.hasPermission('erp:stock-out:audit')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> auditStockOut(@Valid @RequestBody ErpStockOutAuditReqVO auditReqVO) {
stockOutService.auditStockOut(auditReqVO);
return success(true);
}
@GetMapping("/approve-record-list")
@Operation(summary = "获得其它出库单审核记录")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<List<ErpStockOutApproveRecordRespVO>> getApproveRecordList(@RequestParam("id") Long id) {
return success(buildApproveRecordRespList(stockOutService.getStockOutApproveRecordList(id)));
}
@PutMapping("/update-mold-status")
@Operation(summary = "更新模具出库单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateMoldStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockOutService.updateMoldStatus(id, status);
return success(true);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除其它出库单") @Operation(summary = "删除其它出库单")
@Parameter(name = "ids", description = "编号数组", required = true) @Parameter(name = "ids", description = "编号数组", required = true)
@ -177,284 +116,98 @@ public class ErpStockOutController {
if (stockOut == null) { if (stockOut == null) {
return success(null); return success(null);
} }
return success(buildStockOutRespVO(stockOut, List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutId(id);
stockOutService.getStockOutItemListByOutId(id), if (Objects.equals(stockOut.getOutType(), "模具出库")) {
stockOutService.getStockOutApproveRecordList(id))); Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
return success(BeanUtils.toBean(stockOut, ErpStockOutRespVO.class, stockOutVO ->
stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
.setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()));
}))));
} else {
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
return success(BeanUtils.toBean(stockOut, ErpStockOutRespVO.class, stockOutVO ->
stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
}))));
}
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得其它出库单分页") @Operation(summary = "获得其它出库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')") @PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<PageResult<ErpStockOutRespVO>> getStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockOutRespVO>> getStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
fillPageReqDefault(pageReqVO); if(StringUtils.isEmpty(pageReqVO.getOutType())){
applyItemFilter(pageReqVO); List<String> list = new ArrayList<>();
return success(buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO))); list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
pageReqVO.setOutTypeList(list);
}
PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
return success(buildStockOutVOPageResult(pageResult));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出其它出库单 Excel") @Operation(summary = "导出其它出库单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-out:export')") @PreAuthorize("@ss.hasPermission('erp:stock-out:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO, public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
fillPageReqDefault(pageReqVO);
applyItemFilter(pageReqVO);
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList(); List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它出库单.xls", "数据", ErpStockOutRespVO.class, list); ExcelUtils.write(response, "其它出库单.xls", "数据", ErpStockOutRespVO.class, list);
} }
private void applyItemFilter(ErpStockOutPageReqVO pageReqVO) {
if (pageReqVO.getProductId() == null && pageReqVO.getWarehouseId() == null) {
return;
}
List<Long> ids = stockOutService.getStockOutIdsByItemFilter(pageReqVO.getProductId(), pageReqVO.getWarehouseId());
if (StringUtils.isNotBlank(pageReqVO.getIds())) {
List<Long> reqIds = Stream.of(pageReqVO.getIds().split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.map(Long::valueOf)
.collect(Collectors.toList());
ids = ids.stream().filter(reqIds::contains).collect(Collectors.toList());
}
if (CollUtil.isEmpty(ids)) {
pageReqVO.setIds("-1");
return;
}
pageReqVO.setIds(CollUtil.join(ids, ","));
pageReqVO.setProductId(null);
pageReqVO.setWarehouseId(null);
}
private void fillPageReqDefault(ErpStockOutPageReqVO pageReqVO) {
if (StringUtils.isEmpty(pageReqVO.getOutType())) {
List<String> list = new ArrayList<>();
list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
list.add(StockOutTypeEnum..getValue());
pageReqVO.setOutTypeList(list);
}
}
private PageResult<ErpStockOutRespVO> buildStockOutVOPageResult(PageResult<ErpStockOutDO> pageResult) { private PageResult<ErpStockOutRespVO> buildStockOutVOPageResult(PageResult<ErpStockOutDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) { if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal()); return PageResult.empty(pageResult.getTotal());
} }
List<ErpStockOutDO> stockOuts = pageResult.getList(); // 1.1 出库项
Map<Long, List<ErpStockOutItemDO>> itemMap = stockOutService.getStockOutItemListByOutIds( List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutIds(
convertSet(stockOuts, ErpStockOutDO::getId)).stream() convertSet(pageResult.getList(), ErpStockOutDO::getId));
.collect(Collectors.groupingBy(ErpStockOutItemDO::getOutId)); Map<Long, List<ErpStockOutItemDO>> stockOutItemMap = convertMultiMap(stockOutItemList, ErpStockOutItemDO::getOutId);
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(stockOuts, // 1.2 产品信息
item -> Stream.of(NumberUtils.parseLong(item.getCreator()), item.getStockUserId(), item.getAuditUserId()))); Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
// 1.3 客户信息
Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap( Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
convertSet(stockOuts, ErpStockOutDO::getCustomerId)); convertSet(pageResult.getList(), ErpStockOutDO::getCustomerId));
List<ErpStockOutItemDO> allItems = convertListByFlatMap(itemMap.values(), Collection::stream); // 1.5 管理员信息
Map<Long, ErpProductRespVO> productMap = productService.getProductSimpleVOMap( Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(allItems, ErpStockOutItemDO::getProductId)); convertSet(pageResult.getList(), stockOut -> Long.parseLong(stockOut.getCreator())));
Map<Long, MoldBrandDO> moldMap = moldBrandService.getMoldVOMap( // 1.6 领料员信息
convertSet(allItems, ErpStockOutItemDO::getMoldSetId)); Map<Long, AdminUserRespDTO> responserMap = adminUserApi.getUserMap(
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = moldService.getMoldListMapByBrandIds( convertSet(pageResult.getList(), ErpStockOutDO::getResponserId));
convertSet(allItems, ErpStockOutItemDO::getMoldSetId)); // 1.7 模具信息
Map<Long, List<ErpStockOutItemPalletDO>> itemPalletMap = stockOutService.getStockOutItemPalletListByOutIds( Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(stockOuts, ErpStockOutDO::getId)).stream() convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
.collect(Collectors.groupingBy(ErpStockOutItemPalletDO::getOutItemId));
Map<Long, ErpPalletDO> palletMap = palletService.getPalletMap(
convertSet(convertListByFlatMap(itemPalletMap.values(), Collection::stream), ErpStockOutItemPalletDO::getPalletId));
Map<String, ErpStockDO> stockMap = buildStockMap(allItems);
List<ErpStockOutRespVO> list = convertList(stockOuts, stockOut -> buildStockOutRespVO(
stockOut, itemMap.getOrDefault(stockOut.getId(), Collections.emptyList()), Collections.emptyList(),
userMap, customerMap, stockMap, productMap, moldMap, moldListMap, itemPalletMap, palletMap));
return new PageResult<>(list, pageResult.getTotal());
}
private ErpStockOutRespVO buildStockOutRespVO(ErpStockOutDO stockOut, List<ErpStockOutItemDO> stockOutItemList,
List<ErpStockOutApproveRecordDO> approveRecords) {
return buildStockOutRespVO(stockOut, stockOutItemList, approveRecords,
null, null, null, null, null, null, null, null);
}
private ErpStockOutRespVO buildStockOutRespVO(ErpStockOutDO stockOut, List<ErpStockOutItemDO> stockOutItemList,
List<ErpStockOutApproveRecordDO> approveRecords,
Map<Long, AdminUserRespDTO> pageUserMap,
Map<Long, ErpCustomerDO> pageCustomerMap,
Map<String, ErpStockDO> pageStockMap,
Map<Long, ErpProductRespVO> pageProductMap,
Map<Long, MoldBrandDO> pageMoldMap,
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> pageMoldListMap,
Map<Long, List<ErpStockOutItemPalletDO>> pageItemPalletMap,
Map<Long, ErpPalletDO> pagePalletMap) {
ErpStockOutRespVO stockOutVO = BeanUtils.toBean(stockOut, ErpStockOutRespVO.class);
stockOutVO.setStatusName(getStockOutStatusName(stockOut.getStatus()));
Map<Long, AdminUserRespDTO> userMap = pageUserMap != null ? pageUserMap : adminUserApi.getUserMap(convertListByFlatMap(
Collections.singletonList(stockOut), item -> Stream.of(NumberUtils.parseLong(item.getCreator()),
item.getStockUserId(), item.getAuditUserId())));
Map<Long, List<ErpStockOutItemPalletDO>> itemPalletMap = pageItemPalletMap != null ? pageItemPalletMap
: stockOutService.getStockOutItemPalletListByOutId(stockOut.getId()).stream()
.collect(Collectors.groupingBy(ErpStockOutItemPalletDO::getOutItemId));
Map<Long, ErpPalletDO> palletMap = pagePalletMap != null ? pagePalletMap : palletService.getPalletMap(
convertSet(convertListByFlatMap(itemPalletMap.values(), Collection::stream), ErpStockOutItemPalletDO::getPalletId));
MapUtils.findAndThen(userMap, NumberUtils.parseLong(stockOut.getCreator()), user -> stockOutVO.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, stockOut.getStockUserId(), user -> stockOutVO.setStockUserName(user.getNickname()));
MapUtils.findAndThen(userMap, stockOut.getAuditUserId(), user -> stockOutVO.setAuditUserName(user.getNickname()));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockOutRespVO.class, stockOut -> {
if (Objects.equals(stockOut.getOutType(), "模具出库")) { if (Objects.equals(stockOut.getOutType(), "模具出库")) {
Map<Long, MoldBrandDO> moldMap = pageMoldMap != null ? pageMoldMap : moldBrandService.getMoldVOMap( stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
convertSet(stockOutItemList, ErpStockOutItemDO::getMoldSetId)); item -> MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = pageMoldListMap != null ? pageMoldListMap .setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()))));
: moldService.getMoldListMapByBrandIds(convertSet(stockOutItemList, ErpStockOutItemDO::getMoldSetId)); stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
stockOutVO.setItems(convertList(stockOutItemList, source -> {
ErpStockOutRespVO.Item item = BeanUtils.toBean(source, ErpStockOutRespVO.Item.class);
ErpStockDO stock = pageStockMap != null ? pageStockMap.get(buildStockKey(source.getMoldSetId(), source.getWarehouseId(), source.getAreaId()))
: stockService.getStock(source.getMoldSetId(), source.getWarehouseId(), source.getAreaId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
item.setMoldList(moldListMap.getOrDefault(source.getMoldSetId(), new ArrayList<>()));
item.setPallets(buildStockOutPalletRespList(itemPalletMap.get(source.getId()), palletMap));
MapUtils.findAndThen(moldMap, source.getMoldSetId(), mold -> {
item.setMoldSetName(mold.getName());
item.setProductName(mold.getName());
item.setProductBarCode(mold.getCode());
});
return item;
}));
stockOutVO.setMoldSetNames(CollUtil.join(stockOutVO.getItems(), ",", ErpStockOutRespVO.Item::getMoldSetName));
stockOutVO.setProductNames(stockOutVO.getMoldSetNames());
} else { } else {
Map<Long, ErpProductRespVO> productMap = pageProductMap != null ? pageProductMap : productService.getProductSimpleVOMap( stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId)); item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
List<ErpStockOutRespVO.Item> items = BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> { .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
ErpStockDO stock = pageStockMap != null ? pageStockMap.get(buildStockKey(item.getProductId(), item.getWarehouseId(), item.getAreaId())) stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
: stockService.getStock(item.getProductId(), item.getWarehouseId(), item.getAreaId()); }
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO); MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getName()));
item.setPallets(buildStockOutPalletRespList(itemPalletMap.get(item.getId()), palletMap)); MapUtils.findAndThen(userMap, Long.parseLong(stockOut.getCreator()), user -> stockOut.setCreatorName(user.getNickname()));
MapUtils.findAndThen(productMap, item.getProductId(), product -> { MapUtils.findAndThen(responserMap, stockOut.getResponserId(), user -> stockOut.setResponserName(user.getNickname()));
item.setProductName(product.getName());
item.setProductBarCode(product.getBarCode());
item.setProductUnitName(product.getUnitName());
item.setCategoryType(product.getCategoryType());
item.setSupplierId(product.getDefaultSupplierId());
if (product.getDefaultSupplierId() != null && CollUtil.isNotEmpty(product.getSuppliers())) {
product.getSuppliers().stream()
.filter(supplier -> Objects.equals(supplier.getSupplierId(), product.getDefaultSupplierId()))
.findFirst()
.ifPresent(supplier -> item.setSupplierName(supplier.getSupplierName()));
}
});
});
stockOutVO.setItems(Objects.equals(stockOut.getOutType(), StockOutTypeEnum..getValue())
? mergeProductStockOutItems(items) : items);
stockOutVO.setProductNames(CollUtil.join(stockOutVO.getItems(), ",", ErpStockOutRespVO.Item::getProductName));
}
if (CollUtil.isNotEmpty(stockOutVO.getItems())) {
ErpStockOutRespVO.Item firstItem = stockOutVO.getItems().get(0);
stockOutVO.setOutUsageType(firstItem.getOutUsageType());
stockOutVO.setOutUsageTypeName(firstItem.getOutUsageTypeName());
stockOutVO.setRepairId(firstItem.getRepairId());
stockOutVO.setRepairName(firstItem.getRepairName());
stockOutVO.setRepairDeviceId(firstItem.getRepairDeviceId());
stockOutVO.setRepairDeviceName(firstItem.getRepairDeviceName());
stockOutVO.setMaintenanceId(firstItem.getMaintenanceId());
stockOutVO.setMaintenanceName(firstItem.getMaintenanceName());
} else {
stockOutVO.setOutUsageType(null);
stockOutVO.setOutUsageTypeName(null);
stockOutVO.setRepairId(null);
stockOutVO.setRepairName(null);
stockOutVO.setRepairDeviceId(null);
stockOutVO.setRepairDeviceName(null);
stockOutVO.setMaintenanceId(null);
stockOutVO.setMaintenanceName(null);
}
if (stockOut.getCustomerId() != null) {
Map<Long, ErpCustomerDO> customerMap = pageCustomerMap != null ? pageCustomerMap
: customerService.getCustomerMap(Collections.singleton(stockOut.getCustomerId()));
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), customer -> stockOutVO.setCustomerName(customer.getName()));
}
stockOutVO.setApproveRecords(buildApproveRecordRespList(approveRecords));
return stockOutVO;
}
private Map<String, ErpStockDO> buildStockMap(List<ErpStockOutItemDO> items) {
if (CollUtil.isEmpty(items)) {
return Collections.emptyMap();
}
boolean containsNullArea = items.stream().anyMatch(item -> item.getAreaId() == null);
return stockService.getStockList(
convertSet(convertListByFlatMap(items, item -> Stream.of(item.getProductId(), item.getMoldSetId())), Function.identity()),
convertSet(items, ErpStockOutItemDO::getWarehouseId),
containsNullArea ? null : convertSet(items, ErpStockOutItemDO::getAreaId)).stream()
.collect(Collectors.toMap(stock -> buildStockKey(stock.getProductId(), stock.getWarehouseId(), stock.getAreaId()),
Function.identity(), (left, right) -> left, HashMap::new));
}
private List<ErpStockOutRespVO.Item> mergeProductStockOutItems(List<ErpStockOutRespVO.Item> items) {
if (CollUtil.isEmpty(items)) {
return Collections.emptyList();
}
Map<String, ErpStockOutRespVO.Item> itemMap = new LinkedHashMap<>();
for (ErpStockOutRespVO.Item sourceItem : items) {
String key = buildProductItemMergeKey(sourceItem.getProductId(), sourceItem.getProductPrice(),
sourceItem.getPackagingSchemeId(), sourceItem.getInputUnitType(), sourceItem.getInputCount(),
sourceItem.getOutMode(), sourceItem.getOutUsageType(), sourceItem.getRepairId(),
sourceItem.getRepairDeviceId(), sourceItem.getMaintenanceId(), sourceItem.getRemark());
ErpStockOutRespVO.Item targetItem = itemMap.get(key);
if (targetItem == null) {
itemMap.put(key, copyMergedStockOutItem(sourceItem));
continue;
}
targetItem.setCount(defaultZero(targetItem.getCount()).add(defaultZero(sourceItem.getCount())));
targetItem.setPackageCount(defaultZero(targetItem.getPackageCount()).add(defaultZero(sourceItem.getPackageCount())));
targetItem.getPallets().addAll(sourceItem.getPallets());
}
return new ArrayList<>(itemMap.values());
}
private ErpStockOutRespVO.Item copyMergedStockOutItem(ErpStockOutRespVO.Item sourceItem) {
ErpStockOutRespVO.Item targetItem = BeanUtils.toBean(sourceItem, ErpStockOutRespVO.Item.class);
targetItem.setPallets(new ArrayList<>(sourceItem.getPallets() != null ? sourceItem.getPallets() : Collections.emptyList()));
return targetItem;
}
private String buildProductItemMergeKey(Object... values) {
return java.util.Arrays.stream(values).map(String::valueOf).collect(Collectors.joining("_"));
}
private BigDecimal defaultZero(BigDecimal value) {
return value != null ? value : BigDecimal.ZERO;
}
private String buildStockKey(Long productId, Long warehouseId, Long areaId) {
return String.valueOf(productId) + "_" + String.valueOf(warehouseId) + "_" + String.valueOf(areaId);
}
private List<ErpStockOutRespVO.Item.PalletItem> buildStockOutPalletRespList(List<ErpStockOutItemPalletDO> itemPallets,
Map<Long, ErpPalletDO> palletMap) {
if (CollUtil.isEmpty(itemPallets)) {
return Collections.emptyList();
}
return convertList(itemPallets, itemPallet -> {
ErpStockOutRespVO.Item.PalletItem palletItem = new ErpStockOutRespVO.Item.PalletItem();
palletItem.setPalletId(itemPallet.getPalletId());
palletItem.setWarehouseId(itemPallet.getWarehouseId());
palletItem.setAreaId(itemPallet.getAreaId());
palletItem.setCount(itemPallet.getCount());
palletItem.setPackageCount(itemPallet.getPackageCount());
MapUtils.findAndThen(palletMap, itemPallet.getPalletId(), pallet -> palletItem.setPalletCode(pallet.getCode()));
return palletItem;
});
}
private List<ErpStockOutApproveRecordRespVO> buildApproveRecordRespList(List<ErpStockOutApproveRecordDO> records) {
if (CollUtil.isEmpty(records)) {
return new ArrayList<>();
}
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(records,
record -> Stream.of(NumberUtils.parseLong(record.getCreator()), record.getTargetUserId())));
return BeanUtils.toBean(records, ErpStockOutApproveRecordRespVO.class, record -> {
MapUtils.findAndThen(userMap, NumberUtils.parseLong(record.getCreator()), user -> record.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, record.getTargetUserId(), user -> record.setTargetUserName(user.getNickname()));
record.setFromStatusName(getStockOutStatusName(record.getFromStatus()));
record.setToStatusName(getStockOutStatusName(record.getToStatus()));
}); });
} }
@ -465,16 +218,13 @@ public class ErpStockOutController {
createReqVO.setOutType(StockOutTypeEnum..getValue()); createReqVO.setOutType(StockOutTypeEnum..getValue());
return success(stockOutService.createStockOut(createReqVO)); return success(stockOutService.createStockOut(createReqVO));
} }
@GetMapping("/pageMesStockOut") @GetMapping("/pageMesStockOut")
@Operation(summary = "获得生产领料出库单分页") @Operation(summary = "获得生产领料出库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')") @PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<PageResult<ErpStockOutRespVO>> getMesStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) { public CommonResult<PageResult<ErpStockOutRespVO>> getMesStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
pageReqVO.setOutType(StockOutTypeEnum..getValue()); pageReqVO.setOutType(StockOutTypeEnum..getValue());
return success(buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO))); PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
return success(buildStockOutVOPageResult(pageResult));
} }
private String getStockOutStatusName(Integer status) {
return ErpStockOutStatusEnum.OUT_STOCK.getStatus().equals(status) ? "已出库" : "待出库";
}
} }

@ -12,17 +12,10 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProduc
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockRecordDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockRecordDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockRecordService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockRecordService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService; import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.erp.service.warehousearea.WarehouseAreaService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -55,15 +48,9 @@ public class ErpStockRecordController {
@Resource @Resource
private ErpStockRecordService stockRecordService; private ErpStockRecordService stockRecordService;
@Resource @Resource
private ErpStockInService stockInService;
@Resource
private ErpStockOutService stockOutService;
@Resource
private ErpProductService productService; private ErpProductService productService;
@Resource @Resource
private ErpWarehouseService warehouseService; private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource @Resource
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@ -74,7 +61,7 @@ public class ErpStockRecordController {
@PreAuthorize("@ss.hasPermission('erp:stock-record:query')") @PreAuthorize("@ss.hasPermission('erp:stock-record:query')")
public CommonResult<ErpStockRecordRespVO> getStockRecord(@RequestParam("id") Long id) { public CommonResult<ErpStockRecordRespVO> getStockRecord(@RequestParam("id") Long id) {
ErpStockRecordDO stockRecord = stockRecordService.getStockRecord(id); ErpStockRecordDO stockRecord = stockRecordService.getStockRecord(id);
return success(buildStockRecordRespVO(stockRecord)); return success(BeanUtils.toBean(stockRecord, ErpStockRecordRespVO.class));
} }
@GetMapping("/page") @GetMapping("/page")
@ -105,82 +92,14 @@ public class ErpStockRecordController {
convertSet(pageResult.getList(), ErpStockRecordDO::getProductId)); convertSet(pageResult.getList(), ErpStockRecordDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getWarehouseId)); convertSet(pageResult.getList(), ErpStockRecordDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getAreaId));
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), record -> Long.parseLong(record.getCreator()))); convertSet(pageResult.getList(), record -> Long.parseLong(record.getCreator())));
return BeanUtils.toBean(pageResult, ErpStockRecordRespVO.class, stock -> { return BeanUtils.toBean(pageResult, ErpStockRecordRespVO.class, stock -> {
stock.setBizDirection(resolveBizDirection(stock.getBizType()));
stock.setBizDocType(resolveBizDocType(stock.getBizType(), stock.getBizId()));
MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName()) MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName())
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()) .setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
.setCategoryType(product.getCategoryType()));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName())); MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
if (stock.getAreaName() == null) {
MapUtils.findAndThen(areaMap, stock.getAreaId(), area -> stock.setAreaName(area.getAreaName()));
}
MapUtils.findAndThen(userMap, Long.parseLong(stock.getCreator()), user -> stock.setCreatorName(user.getNickname())); MapUtils.findAndThen(userMap, Long.parseLong(stock.getCreator()), user -> stock.setCreatorName(user.getNickname()));
}); });
} }
private ErpStockRecordRespVO buildStockRecordRespVO(ErpStockRecordDO stockRecord) {
if (stockRecord == null) {
return null;
}
ErpStockRecordRespVO respVO = BeanUtils.toBean(stockRecord, ErpStockRecordRespVO.class);
respVO.setBizDirection(resolveBizDirection(respVO.getBizType()));
respVO.setBizDocType(resolveBizDocType(stockRecord.getBizType(), stockRecord.getBizId()));
ErpProductRespVO product = productService.getProduct(stockRecord.getProductId());
if (product != null) {
respVO.setProductName(product.getName());
respVO.setCategoryName(product.getCategoryName());
respVO.setUnitName(product.getUnitName());
respVO.setCategoryType(product.getCategoryType());
}
ErpWarehouseDO warehouse = warehouseService.getWarehouse(stockRecord.getWarehouseId());
if (warehouse != null) {
respVO.setWarehouseName(warehouse.getName());
}
if (respVO.getAreaName() == null && respVO.getAreaId() != null) {
WarehouseAreaDO area = warehouseAreaService.getWarehouseArea(respVO.getAreaId());
if (area != null) {
respVO.setAreaName(area.getAreaName());
}
}
if (respVO.getCreator() != null) {
AdminUserRespDTO user = adminUserApi.getUser(Long.parseLong(respVO.getCreator()));
if (user != null) {
respVO.setCreatorName(user.getNickname());
}
}
return respVO;
}
private String resolveBizDocType(Integer bizType, Long bizId) {
if (bizType == null || bizId == null) {
return null;
}
String bizDirection = resolveBizDirection(bizType);
if ("入库".equals(bizDirection)) {
ErpStockInDO stockIn = stockInService.getStockIn(bizId);
return stockIn != null ? stockIn.getInType() : null;
}
if ("出库".equals(bizDirection)) {
ErpStockOutDO stockOut = stockOutService.getStockOut(bizId);
return stockOut != null ? stockOut.getOutType() : null;
}
return null;
}
private String resolveBizDirection(Integer bizType) {
if (bizType == null) {
return null;
}
return java.util.Arrays.stream(ErpStockRecordBizTypeEnum.values())
.filter(item -> java.util.Objects.equals(item.getType(), bizType))
.findFirst()
.map(item -> item.getName().contains("入库") ? "入库" : "出库")
.orElse(null);
}
} }

@ -5,17 +5,13 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.erp.controller.admin.stock.enums.ErpWarehouseCategoryEnum;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSummaryRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSaveReqVO;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService; import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseSummaryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
@ -42,8 +38,6 @@ public class ErpWarehouseController {
@Resource @Resource
private ErpWarehouseService warehouseService; private ErpWarehouseService warehouseService;
@Resource
private ErpWarehouseSummaryService warehouseSummaryService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建仓库") @Operation(summary = "创建仓库")
@ -86,7 +80,8 @@ public class ErpWarehouseController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')") @PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<ErpWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) { public CommonResult<ErpWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
return success(warehouseService.getWarehouseDetail(id)); ErpWarehouseDO warehouse = warehouseService.getWarehouse(id);
return success(BeanUtils.toBean(warehouse, ErpWarehouseRespVO.class));
} }
@GetMapping("/page") @GetMapping("/page")
@ -99,21 +94,10 @@ public class ErpWarehouseController {
@GetMapping("/simple-list") @GetMapping("/simple-list")
@Operation(summary = "获得仓库精简列表", description = "只包含被开启的仓库,主要用于前端的下拉选项") @Operation(summary = "获得仓库精简列表", description = "只包含被开启的仓库,主要用于前端的下拉选项")
@Parameter(name = "categoryType", description = "仓库分类", example = "1") public CommonResult<List<ErpWarehouseRespVO>> getWarehouseSimpleList() {
public CommonResult<List<ErpWarehouseRespVO>> getWarehouseSimpleList( List<ErpWarehouseDO> list = warehouseService.getWarehouseListByStatus(CommonStatusEnum.ENABLE.getStatus());
@RequestParam(value = "categoryType", required = false) Integer categoryType) {
List<ErpWarehouseDO> list = warehouseService.getWarehouseListByStatus(CommonStatusEnum.ENABLE.getStatus(), categoryType);
return success(convertList(list, warehouse -> new ErpWarehouseRespVO().setId(warehouse.getId()) return success(convertList(list, warehouse -> new ErpWarehouseRespVO().setId(warehouse.getId())
.setName(warehouse.getName()).setCategoryType(warehouse.getCategoryType()) .setName(warehouse.getName()).setDefaultStatus(warehouse.getDefaultStatus())));
.setDefaultStatus(warehouse.getDefaultStatus())));
}
@GetMapping("/summary")
@Operation(summary = "获得仓库总览")
@Parameter(name = "warehouseId", description = "仓库编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<ErpWarehouseSummaryRespVO> getWarehouseSummary(@RequestParam("warehouseId") Long warehouseId) {
return success(warehouseSummaryService.getWarehouseSummary(warehouseId));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")

@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum ErpWarehouseCategoryEnum implements IntArrayValuable {
PRODUCT(1, "产品"),
MATERIAL(2, "物料"),
SPARE_PART(3, "备件"),
OTHER(4, "其他");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpWarehouseCategoryEnum::getCategory).toArray();
private final Integer category;
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -1,45 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 库存盘点单审核记录 Response VO")
@Data
public class ErpStockCheckApproveRecordRespVO {
@Schema(description = "编号", example = "1")
private Long id;
@Schema(description = "盘点单编号", example = "1")
private Long stockCheckId;
@Schema(description = "操作类型", example = "SUBMIT")
private String actionType;
@Schema(description = "变更前状态", example = "0")
private Integer fromStatus;
@Schema(description = "变更后状态", example = "10")
private Integer toStatus;
@Schema(description = "目标审核人编号", example = "1")
private Long targetUserId;
@Schema(description = "目标审核人名称", example = "李四")
private String targetUserName;
@Schema(description = "备注", example = "请审核")
private String remark;
@Schema(description = "操作人", example = "1")
private String creator;
@Schema(description = "操作人名称", example = "张三")
private String creatorName;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -1,23 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - ERP 库存盘点单审核 Request VO")
@Data
public class ErpStockCheckAuditReqVO {
@Schema(description = "盘点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "盘点编号不能为空")
private Long id;
@Schema(description = "审核结果 20-通过 1-驳回", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
@NotNull(message = "审核结果不能为空")
private Integer status;
@Schema(description = "审核备注", example = "审核通过")
private String remark;
}

@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - ERP 库存盘点按仓库/库区生成盘点项 Request VO")
@Data
public class ErpStockCheckGenerateByLocationReqVO {
@Schema(description = "仓库编号列表", example = "[1,2]")
private List<Long> warehouseIds;
@Schema(description = "库区编号列表", example = "[11,12]")
private List<Long> areaIds;
@Schema(description = "是否允许为空库存,默认 true", example = "true")
private Boolean allowEmpty = Boolean.TRUE;
@Schema(description = "选择分类", example = "1")
private Integer categoryType;
public boolean validSelection() {
return (warehouseIds != null && !warehouseIds.isEmpty()) || (areaIds != null && !areaIds.isEmpty());
}
}

@ -1,23 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Schema(description = "管理后台 - ERP 库存盘点按产品生成盘点项 Request VO")
@Data
public class ErpStockCheckGenerateByProductReqVO {
@Schema(description = "产品编号列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2]")
@NotEmpty(message = "产品编号列表不能为空")
private List<Long> productIds;
@Schema(description = "是否允许为空库存,默认 true", example = "true")
private Boolean allowEmpty = Boolean.TRUE;
@Schema(description = "选择分类", example = "1")
private Integer categoryType;
}

@ -42,12 +42,6 @@ public class ErpStockCheckPageReqVO extends PageParam {
@Schema(description = "产品编号", example = "1") @Schema(description = "产品编号", example = "1")
private Long productId; private Long productId;
@Schema(description = "选择分类", example = "1")
private Integer categoryType;
@Schema(description = "盘点状态0-未盘点1-已盘点", example = "1")
private Integer checkStatus;
@Schema(description = "id集合导出用") @Schema(description = "id集合导出用")
private String ids; private String ids;
} }

@ -2,14 +2,8 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.PRODUCT_CATEGORY_TYPE;
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.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
@ -35,28 +29,8 @@ public class ErpStockCheckRespVO {
@Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("盘点时间") @ExcelProperty("盘点时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime checkTime; private LocalDateTime checkTime;
@Schema(description = "生成来源类型1-按库存2-按产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "生成来源类型", converter = DictConvert.class)
@DictFormat("erp_stock_check_source_type")
private Integer sourceType;
@Schema(description = "选择分类", example = "1")
@ExcelProperty(value = "选择分类", converter = DictConvert.class)
@DictFormat(PRODUCT_CATEGORY_TYPE)
private Integer categoryType;
@Schema(description = "盘点状态0-未盘点1-已盘点", example = "1")
@ExcelProperty("盘点状态")
private Integer checkStatus;
@Schema(description = "是否需要审核", example = "true")
private Boolean needAudit;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663") @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量") @ExcelProperty("合计数量")
private BigDecimal totalCount; private BigDecimal totalCount;
@ -70,12 +44,6 @@ public class ErpStockCheckRespVO {
@DictFormat(AUDIT_STATUS) @DictFormat(AUDIT_STATUS)
private Integer status; private Integer status;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "审核人名称", example = "李四")
private String auditUserName;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
@ -99,9 +67,6 @@ public class ErpStockCheckRespVO {
@ExcelProperty("产品信息") @ExcelProperty("产品信息")
private String productNames; private String productNames;
@Schema(description = "审核记录")
private List<ErpStockCheckApproveRecordRespVO> approveRecords;
@Data @Data
public static class Item { public static class Item {
@ -111,15 +76,6 @@ public class ErpStockCheckRespVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId; private Long warehouseId;
@Schema(description = "仓库名称", example = "成品仓")
private String warehouseName;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "库区名称", example = "A区")
private String areaName;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId; private Long productId;
@ -130,10 +86,12 @@ public class ErpStockCheckRespVO {
@NotNull(message = "账面数量不能为空") @NotNull(message = "账面数量不能为空")
private BigDecimal stockCount; private BigDecimal stockCount;
@Schema(description = "实际数量(实际库存)", example = "100.00") @Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "实际数量不能为空")
private BigDecimal actualCount; private BigDecimal actualCount;
@Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count; private BigDecimal count;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")

@ -1,13 +1,6 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check; package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockCheckSourceTypeEnum;
import lombok.Data; import lombok.Data;
import javax.validation.Valid; import javax.validation.Valid;
@ -17,58 +10,38 @@ import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - ERP 存盘点单新增/修改 Request VO") @Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
@Data @Data
public class ErpStockCheckSaveReqVO { public class ErpStockCheckSaveReqVO {
@Schema(description = "盘点编号", example = "11756") @Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id; private Long id;
@Schema(description = "盘点编码", example = "11756") @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
private String code; @NotNull(message = "出库时间不能为空")
@Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "盘点时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime checkTime; private LocalDateTime checkTime;
@Schema(description = "生成来源类型1-按库存2-按产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "生成来源类型不能为空")
@InEnum(ErpStockCheckSourceTypeEnum.class)
private Integer sourceType;
@Schema(description = "选择分类", example = "1")
private Integer categoryType;
@Schema(description = "盘点状态0-未盘点1-已盘点", example = "1")
private Integer checkStatus;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc") @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl; private String fileUrl;
@Schema(description = "盘点项列表", implementation = Item.class) @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "盘点项列表不能为空") @NotEmpty(message = "出库项列表不能为空")
@Valid @Valid
private List<Item> items; private List<Item> items;
@Data @Data
public static class Item { public static class Item {
@Schema(description = "盘点项编号", example = "11756") @Schema(description = "出库项编号", example = "11756")
private Long id; private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空") @NotNull(message = "仓库编号不能为空")
private Long warehouseId; private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空") @NotNull(message = "产品编号不能为空")
private Long productId; private Long productId;
@ -80,10 +53,12 @@ public class ErpStockCheckSaveReqVO {
@NotNull(message = "账面数量不能为空") @NotNull(message = "账面数量不能为空")
private BigDecimal stockCount; private BigDecimal stockCount;
@Schema(description = "实际数量(实际库存)", example = "100.00") @Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "实际数量不能为空")
private BigDecimal actualCount; private BigDecimal actualCount;
@Schema(description = "盈亏数量,服务端自动按 实际数量 - 账面数量 计算", example = "100.00") @Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count; private BigDecimal count;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - ERP 库存盘点单提交审核 Request VO")
@Data
public class ErpStockCheckSubmitReqVO {
@Schema(description = "盘点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "盘点编号不能为空")
private Long id;
@Schema(description = "审核人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1888")
private Long auditUserId;
@Schema(description = "提交备注", example = "请审核")
private String remark;
}

@ -1,50 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 其它入库单审核记录 Response VO")
@Data
public class ErpStockInApproveRecordRespVO {
@Schema(description = "编号", example = "1")
private Long id;
@Schema(description = "入库单编号", example = "1")
private Long stockInId;
@Schema(description = "操作类型", example = "SUBMIT")
private String actionType;
@Schema(description = "变更前状态", example = "0")
private Integer fromStatus;
@Schema(description = "变更前状态名称", example = "待入库")
private String fromStatusName;
@Schema(description = "变更后状态", example = "10")
private Integer toStatus;
@Schema(description = "变更后状态名称", example = "已入库")
private String toStatusName;
@Schema(description = "目标审核人编号", example = "1")
private Long targetUserId;
@Schema(description = "目标审核人名称", example = "李四")
private String targetUserName;
@Schema(description = "备注", example = "请审核")
private String remark;
@Schema(description = "操作人", example = "1")
private String creator;
@Schema(description = "操作人名称", example = "张三")
private String creatorName;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - ERP 其它入库单审核 Request VO")
@Data
public class ErpStockInAuditReqVO {
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "入库编号不能为空")
private Long id;
@Schema(description = "审核结果 20-通过 1-驳回", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
@NotNull(message = "审核结果不能为空")
private Integer status;
@Schema(description = "审核备注", example = "审核通过")
private String remark;
}

@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpStockInStatusEnum; import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -31,36 +31,26 @@ public class ErpStockInPageReqVO extends PageParam {
private LocalDateTime[] inTime; private LocalDateTime[] inTime;
@Schema(description = "状态", example = "10") @Schema(description = "状态", example = "10")
// @InEnum(ErpStockInStatusEnum.class) @InEnum(ErpAuditStatus.class)
private List<Integer> statusList; private Integer status;
@Schema(description = "入库类型", example = "其它入库") @Schema(description = "入库类型", example = "随便")
private String inType; private String inType;
@Schema(description = "入库类型", example = "随便")
@Schema(description = "入库类型集合")
private List<String> inTypeList; private List<String> inTypeList;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "创建") @Schema(description = "创建")
private String creator; private String creator;
@Schema(description = "审核人编号", example = "1")
private Long auditUserId;
@Schema(description = "仅看当前登录人提交和待审批的数据", example = "true")
private Boolean relatedToMe;
@Schema(hidden = true)
private Long currentUserId;
@Schema(description = "产品编号", example = "1") @Schema(description = "产品编号", example = "1")
private Long productId; private Long productId;
@Schema(description = "仓库编号", example = "1") @Schema(description = "仓库编号", example = "1")
private Long warehouseId; private Long warehouseId;
@Schema(description = "id 集合导出使用") @Schema(description = "id集合导出用")
private String ids; private String ids;
} }

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
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 io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -29,7 +28,6 @@ public class ErpStockInRespVO {
@Schema(description = "供应商编号", example = "3113") @Schema(description = "供应商编号", example = "3113")
private Long supplierId; private Long supplierId;
@Schema(description = "供应商名称", example = "芋道") @Schema(description = "供应商名称", example = "芋道")
@ExcelProperty("供应商名称") @ExcelProperty("供应商名称")
private String supplierName; private String supplierName;
@ -38,26 +36,11 @@ public class ErpStockInRespVO {
@ExcelProperty("入库时间") @ExcelProperty("入库时间")
private LocalDateTime inTime; private LocalDateTime inTime;
@Schema(description = "经办人编号", example = "1888")
private Long stockUserId;
@Schema(description = "经办人名称", example = "张三")
private String stockUserName;
@Schema(description = "是否需要审核", example = "true")
private Boolean needAudit;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "审核人名称", example = "李四")
private String auditUserName;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663") @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量") @ExcelProperty("合计数量")
private BigDecimal totalCount; private BigDecimal totalCount;
@Schema(description = "合计金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") @Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额") @ExcelProperty("合计金额")
private BigDecimal totalPrice; private BigDecimal totalPrice;
@ -66,14 +49,11 @@ public class ErpStockInRespVO {
@DictFormat(AUDIT_STATUS) @DictFormat(AUDIT_STATUS)
private Integer status; private Integer status;
@Schema(description = "状态名称", example = "待入库")
private String statusName;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
@Schema(description = "入库类型", example = "其它入库") @Schema(description = "入库类型", example = "随便")
@ExcelProperty("入库类型") @ExcelProperty("入库类型")
private String inType; private String inType;
@ -82,7 +62,6 @@ public class ErpStockInRespVO {
@Schema(description = "创建人", example = "芋道") @Schema(description = "创建人", example = "芋道")
private String creator; private String creator;
@Schema(description = "创建人名称", example = "芋道") @Schema(description = "创建人名称", example = "芋道")
private String creatorName; private String creatorName;
@ -97,139 +76,39 @@ public class ErpStockInRespVO {
@ExcelProperty("产品信息") @ExcelProperty("产品信息")
private String productNames; private String productNames;
@Schema(description = "模具组名称")
private String moldSetNames;
@Schema(description = "最近入库时间")
@ExcelProperty("最近入库时间")
private LocalDateTime recentInTime;
@Schema(description = "最近出库时间")
@ExcelProperty("最近出库时间")
private LocalDateTime recentOutTime;
@Schema(description = "审核记录")
private List<ErpStockInApproveRecordRespVO> approveRecords;
@Data @Data
public static class Item { public static class Item {
@Schema(description = "入库项编号", example = "11756") @Schema(description = "入库项编号", example = "11756")
private Long id; private Long id;
@Schema(description = "模具组 ID", example = "1")
private Long moldSetId;
@Schema(description = "模具组名称", example = "A组")
private String moldSetName;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId; private Long warehouseId;
@Schema(description = "库区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long areaId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId; private Long productId;
@Schema(description = "产品分类类型", example = "1") @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private Integer categoryType;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count; private BigDecimal count;
@Schema(description = "是否关联任务单", example = "true")
private Boolean relateTask;
@Schema(description = "任务单 ID", example = "10001")
private Long taskId;
@Schema(description = "包装方案 ID", example = "1")
private Long packagingSchemeId;
@Schema(description = "包装方案名称", example = "标准包装")
private String packagingSchemeName;
@Schema(description = "每包数量", example = "10.00")
private BigDecimal packageQuantity;
@Schema(description = "每托包数", example = "20.00")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量", example = "200.00")
private BigDecimal palletTotalQuantity;
@Schema(description = "托数", example = "2.00")
private BigDecimal palletCount;
@Schema(description = "包数", example = "40.00")
private BigDecimal packageCount;
@Schema(description = "个数", example = "400.00")
private BigDecimal pieceCount;
@Schema(description = "单位输入方式", example = "包")
private String inputUnitType;
@Schema(description = "录入数量", example = "10.00")
private BigDecimal inputCount;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "产品名称", example = "巧克力") // ========== 关联字段 ==========
private String productName;
@Schema(description = "产品条码", example = "A9985") @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode; private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
@Schema(description = "产品单位名称", example = "盒")
private String productUnitName; private String productUnitName;
@Schema(description = "默认供应商编号", example = "1") @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private Long supplierId; private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
@Schema(description = "默认供应商名称", example = "供应商A")
private String supplierName;
@Schema(description = "仓库名称", example = "A仓")
private String warehouseName;
@Schema(description = "库区名称", example = "A-01")
private String areaName;
@Schema(description = "库存数量", example = "100.00")
private BigDecimal stockCount;
@Schema(description = "托盘列表")
private List<PalletItem> pallets;
@Schema(description = "子模具详情")
private List<MoldDO> moldList;
@Data
public static class PalletItem {
@Schema(description = "托盘 ID", example = "1")
private Long palletId;
@Schema(description = "托盘编码", example = "TP20240601001")
private String palletCode;
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId;
@Schema(description = "库区编号", example = "3113")
private Long areaId;
@Schema(description = "产品数量", example = "100.00")
private BigDecimal count;
@Schema(description = "包数", example = "10")
private BigDecimal packageCount;
}
} }
} }

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in; package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -14,7 +15,7 @@ import java.util.List;
@Data @Data
public class ErpStockInSaveReqVO { public class ErpStockInSaveReqVO {
@Schema(description = "入库编号", example = "11756") @Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id; private Long id;
@Schema(description = "供应商编号", example = "3113") @Schema(description = "供应商编号", example = "3113")
@ -24,118 +25,51 @@ public class ErpStockInSaveReqVO {
@NotNull(message = "入库时间不能为空") @NotNull(message = "入库时间不能为空")
private LocalDateTime inTime; private LocalDateTime inTime;
@Schema(description = "入库类型", example = "其它入库") @Schema(description = "入库类型", example = "随便")
private String inType; private String inType;
@Schema(description = "经办人编号", example = "1888")
private Long stockUserId;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc") @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl; private String fileUrl;
@Schema(description = "入库项列表", implementation = Item.class) @Schema(description = "入库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入库项列表不能为空") @NotEmpty(message = "入库项列表不能为空")
@Valid @Valid
private List<Item> items; private List<Item> items;
@Schema(description = "仓库编号", example = "3113") @Schema(description = "仓库编号", example = "3113")
private Long warehouseId; private Long warehouseId;
@Data @Data
public static class Item { public static class Item {
@Schema(description = "子项 id", example = "11756") @Schema(description = "入库项编号", example = "11756")
private Long id; private Long id;
@Schema(description = "模具组 id", example = "101") @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long moldSetId; // @NotNull(message = "仓库编号不能为空")
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId; private Long warehouseId;
@Schema(description = "库区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
// @NotNull(message = "库区编号不能为空") @NotNull(message = "产品编号不能为空")
private Long areaId;
@Schema(description = "产品编号", example = "3113")
private Long productId; private Long productId;
@Schema(description = "产品单价", example = "100.00") @Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
@Schema(description = "产品数量", example = "100.00") @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count; private BigDecimal count;
@Schema(description = "包装方案 ID", example = "1")
private Long packagingSchemeId;
@Schema(description = "包装方案名称", example = "标准包装")
private String packagingSchemeName;
@Schema(description = "每包数量", example = "10")
private BigDecimal packageQuantity;
@Schema(description = "每托包数", example = "20")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量", example = "200")
private BigDecimal palletTotalQuantity;
@Schema(description = "托数", example = "1")
private BigDecimal palletCount;
@Schema(description = "包数", example = "10")
private BigDecimal packageCount;
@Schema(description = "个数", example = "100")
private BigDecimal pieceCount;
@Schema(description = "单位输入方式", example = "包")
private String inputUnitType;
@Schema(description = "录入数量", example = "10.00")
private BigDecimal inputCount;
@Schema(description = "是否关联任务单", example = "true")
private Boolean relateTask;
@Schema(description = "任务单ID", example = "10001")
private Long taskId;
@Schema(description = "托盘列表", implementation = PalletItem.class)
@Valid
private List<PalletItem> pallets;
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "设备 id", example = "100") @Schema(description = "设备id", example = "100.00")
private Long deviceId; private Long deviceId;
@Data
public static class PalletItem {
@Schema(description = "托盘ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "托盘ID不能为空")
private Long palletId;
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId;
@Schema(description = "库区编号", example = "3113")
private Long areaId;
@Schema(description = "产品数量", example = "100.00")
private BigDecimal count;
@Schema(description = "包数", example = "10")
private BigDecimal packageCount;
}
} }
} }

@ -1,21 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - ERP 其它入库单提交审核 Request VO")
@Data
public class ErpStockInSubmitReqVO {
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "入库编号不能为空")
private Long id;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "提交备注", example = "请审核")
private String remark;
}

@ -1,50 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 其它出库单审核记录 Response VO")
@Data
public class ErpStockOutApproveRecordRespVO {
@Schema(description = "编号", example = "1")
private Long id;
@Schema(description = "出库单编号", example = "1")
private Long stockOutId;
@Schema(description = "操作类型", example = "SUBMIT")
private String actionType;
@Schema(description = "变更前状态", example = "0")
private Integer fromStatus;
@Schema(description = "变更前状态名称", example = "待出库")
private String fromStatusName;
@Schema(description = "变更后状态", example = "10")
private Integer toStatus;
@Schema(description = "变更后状态名称", example = "已出库")
private String toStatusName;
@Schema(description = "目标审核人编号", example = "1")
private Long targetUserId;
@Schema(description = "目标审核人名称", example = "李四")
private String targetUserName;
@Schema(description = "备注", example = "请审核")
private String remark;
@Schema(description = "操作人", example = "1")
private String creator;
@Schema(description = "操作人名称", example = "张三")
private String creatorName;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - ERP 其它出库单审核 Request VO")
@Data
public class ErpStockOutAuditReqVO {
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "出库编号不能为空")
private Long id;
@Schema(description = "审核结果 20-通过 1-驳回", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
@NotNull(message = "审核结果不能为空")
private Integer status;
@Schema(description = "审核备注", example = "审核通过")
private String remark;
}

@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpStockOutStatusEnum; import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -25,14 +25,11 @@ public class ErpStockOutPageReqVO extends PageParam {
@Schema(description = "客户编号", example = "3113") @Schema(description = "客户编号", example = "3113")
private Long customerId; private Long customerId;
@Schema(description = "负责人id", example = "3113")
@Schema(description = "经办人编号", example = "3113") private Long responserId;
private Long stockUserId; @Schema(description = "出库类型", example = "随便")
@Schema(description = "出库类型", example = "其他出库")
private String outType; private String outType;
@Schema(description = "出库类型", example = "随便")
@Schema(description = "出库类型列表", example = "[\"其他出库\",\"产品出库\"]")
private List<String> outTypeList; private List<String> outTypeList;
@Schema(description = "出库时间") @Schema(description = "出库时间")
@ -40,13 +37,10 @@ public class ErpStockOutPageReqVO extends PageParam {
private LocalDateTime[] outTime; private LocalDateTime[] outTime;
@Schema(description = "状态", example = "10") @Schema(description = "状态", example = "10")
// @InEnum(ErpStockOutStatusEnum.class) @InEnum(ErpAuditStatus.class)
private List<Integer> statusList; private Integer status;
@Schema(description = "审核人编号", example = "1") @Schema(description = "备注", example = "随便")
private Long auditUserId;
@Schema(description = "备注", example = "备注信息")
private String remark; private String remark;
@Schema(description = "创建者") @Schema(description = "创建者")
@ -58,10 +52,6 @@ public class ErpStockOutPageReqVO extends PageParam {
@Schema(description = "仓库编号", example = "1") @Schema(description = "仓库编号", example = "1")
private Long warehouseId; private Long warehouseId;
@Schema(description = "id 集合导出时使用") @Schema(description = "id集合导出用")
private String ids; private String ids;
public void setResponserId(Long responserId) {
this.stockUserId = responserId;
}
} }

@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPackagingSchemeRespVO;
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 io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -30,44 +28,16 @@ public class ErpStockOutRespVO {
@Schema(description = "客户编号", example = "3113") @Schema(description = "客户编号", example = "3113")
private Long customerId; private Long customerId;
@Schema(description = "客户名称", example = "芋道") @Schema(description = "客户名称", example = "芋道")
@ExcelProperty("客户名称") @ExcelProperty("客户名称")
private String customerName; private String customerName;
@Schema(description = "负责人id", example = "3113")
@Schema(description = "经办人编号", example = "3113") private Long responserId;
private Long stockUserId; @Schema(description = "负责人", example = "3113")
private String responserName;
@Schema(description = "经办人名称", example = "张三") @Schema(description = "出库类型", example = "随便")
private String stockUserName;
@Schema(description = "出库类型", example = "其他出库")
private String outType; private String outType;
@Schema(description = "出库用途", example = "1")
private Integer outUsageType;
@Schema(description = "出库用途名称", example = "维修领用")
private String outUsageTypeName;
@Schema(description = "维修单编号", example = "1001")
private Long repairId;
@Schema(description = "维修单名称快照", example = "设备维修单A")
private String repairName;
@Schema(description = "维修单设备编号", example = "2001")
private Long repairDeviceId;
@Schema(description = "维修单设备名称快照", example = "设备A")
private String repairDeviceName;
@Schema(description = "保养单编号", example = "3001")
private Long maintenanceId;
@Schema(description = "保养单名称快照", example = "设备保养单A")
private String maintenanceName;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("出库时间") @ExcelProperty("出库时间")
private LocalDateTime outTime; private LocalDateTime outTime;
@ -76,7 +46,7 @@ public class ErpStockOutRespVO {
@ExcelProperty("合计数量") @ExcelProperty("合计数量")
private BigDecimal totalCount; private BigDecimal totalCount;
@Schema(description = "合计金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") @Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额") @ExcelProperty("合计金额")
private BigDecimal totalPrice; private BigDecimal totalPrice;
@ -85,19 +55,7 @@ public class ErpStockOutRespVO {
@DictFormat(AUDIT_STATUS) @DictFormat(AUDIT_STATUS)
private Integer status; private Integer status;
@Schema(description = "状态名称", example = "待出库") @Schema(description = "备注", example = "随便")
private String statusName;
@Schema(description = "是否需要审核", example = "true")
private Boolean needAudit;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "审核人名称", example = "李四")
private String auditUserName;
@Schema(description = "备注", example = "备注信息")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
@ -106,7 +64,6 @@ public class ErpStockOutRespVO {
@Schema(description = "创建人", example = "芋道") @Schema(description = "创建人", example = "芋道")
private String creator; private String creator;
@Schema(description = "创建人名称", example = "芋道") @Schema(description = "创建人名称", example = "芋道")
private String creatorName; private String creatorName;
@ -117,175 +74,47 @@ public class ErpStockOutRespVO {
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items; private List<Item> items;
@Schema(description = "审核记录")
private List<ErpStockOutApproveRecordRespVO> approveRecords;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息") @ExcelProperty("产品信息")
private String productNames; private String productNames;
@Schema(description = "默认包装方案") @Schema(description = "计划单Code", example = "随便")
private ProductPackagingSchemeRespVO defaultPackagingScheme;
@Schema(description = "默认包装方案ID", example = "1")
private Long defaultPackagingSchemeId;
@Schema(description = "单位ID", example = "1")
private Long unitId;
@Schema(description = "采购单位ID", example = "2")
private Long purchaseUnitId;
@Schema(description = "采购单位名称", example = "箱")
private String purchaseUnitName;
@Schema(description = "采购单位换算数量", example = "100")
private BigDecimal purchaseUnitConvertQuantity;
@Schema(description = "模具组名称")
private String moldSetNames;
@Schema(description = "计划单 Code", example = "PLAN20240601")
private String planCode; private String planCode;
@Data @Data
public static class Item { public static class Item {
@Schema(description = "出库项编号", example = "11756") @Schema(description = "出库项编号", example = "11756")
private Long id; private Long id;
@Schema(description = "模具组 ID", example = "1")
private Long moldSetId;
@Schema(description = "模具组名称", example = "A组")
private String moldSetName;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId; private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "库区名称", example = "A区")
private String areaName;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId; private Long productId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count; private BigDecimal count;
@Schema(description = "包装方案 ID", example = "1") @Schema(description = "备注", example = "随便")
private Long packagingSchemeId;
@Schema(description = "包装方案名称", example = "标准包装")
private String packagingSchemeName;
@Schema(description = "每包数量", example = "10.00")
private BigDecimal packageQuantity;
@Schema(description = "每托包数", example = "20.00")
private BigDecimal palletPackageQuantity;
@Schema(description = "每托总数量", example = "200.00")
private BigDecimal palletTotalQuantity;
@Schema(description = "托数", example = "2.00")
private BigDecimal palletCount;
@Schema(description = "包数", example = "40.00")
private BigDecimal packageCount;
@Schema(description = "个数", example = "400.00")
private BigDecimal pieceCount;
@Schema(description = "单位输入方式", example = "包")
private String inputUnitType;
@Schema(description = "录入数量", example = "10.00")
private BigDecimal inputCount;
@Schema(description = "出库方式1-按托出库 2-拆托出库", example = "1")
private Integer outMode;
@Schema(description = "出库用途", example = "1")
private Integer outUsageType;
@Schema(description = "出库用途名称", example = "维修领用")
private String outUsageTypeName;
@Schema(description = "维修单编号", example = "1001")
private Long repairId;
@Schema(description = "维修单名称快照", example = "设备维修单A")
private String repairName;
@Schema(description = "维修单设备编号", example = "2001")
private Long repairDeviceId;
@Schema(description = "维修单设备名称快照", example = "设备A")
private String repairDeviceName;
@Schema(description = "保养单编号", example = "3001")
private Long maintenanceId;
@Schema(description = "保养单名称快照", example = "设备保养单A")
private String maintenanceName;
@Schema(description = "备注", example = "备注信息")
private String remark; private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力") @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName; private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985") @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode; private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒") @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
private String productUnitName; private String productUnitName;
@Schema(description = "默认供应商编号", example = "1")
private Long supplierId;
@Schema(description = "默认供应商名称", example = "供应商A")
private String supplierName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
@Schema(description = "托盘列表")
private List<PalletItem> pallets;
@Schema(description = "子模具列表")
private List<MoldDO> moldList;
@Data
public static class PalletItem {
@Schema(description = "托盘 ID", example = "1")
private Long palletId;
@Schema(description = "托盘编码", example = "TP20240601001")
private String palletCode;
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId;
@Schema(description = "库区编号", example = "3113")
private Long areaId;
@Schema(description = "产品数量", example = "100.00")
private BigDecimal count;
@Schema(description = "包数", example = "10")
private BigDecimal packageCount;
}
} }
} }

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

Loading…
Cancel
Save