Compare commits

..

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

@ -29,27 +29,6 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "产品ID", example = "2336")
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 = "预期寿命(小时)")
private BigDecimal useTime;
@ -77,7 +56,4 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
@Schema(description = "关键字(匹配编码/名称/产品型号)")
private String keyword;
}
}

@ -40,7 +40,6 @@ public class MoldBrandRespVO {
// @ExcelProperty("产品")
private String productName;
@Schema(description = "预期寿命/次")
@ExcelProperty("预期寿命/次")
private BigDecimal useTime;
@ -76,4 +75,4 @@ public class MoldBrandRespVO {
@DictFormat("mes_org_type")
private String orgType;
// , converter = OrgTypeConverter.class
}
}

@ -1,7 +1,5 @@
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 lombok.*;
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.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 模具型号新增/修改 Request VO")
@Data
@ -19,7 +16,7 @@ public class MoldBrandSaveReqVO {
private Long id;
@Schema(description = "型号编码", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "型号编码不能为空")
@NotEmpty(message = "型号编码不能为空")
private String code;
@Schema(description = "型号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ -27,41 +24,13 @@ public class MoldBrandSaveReqVO {
private String name;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
// @NotEmpty(message = "规格不能为空")
@NotEmpty(message = "规格不能为空")
private String moldType;
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336")
// @NotNull(message = "产品ID不能为空")
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 = "预期寿命(小时)")
private BigDecimal useTime;
@ -84,4 +53,4 @@ public class MoldBrandSaveReqVO {
@Schema(description = "工序", example = "你说的对")
private String orgType;
}
}

@ -23,18 +23,6 @@ public class MoldPageReqVO extends PageParam {
@Schema(description = "模具名称", example = "芋艿")
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")
private Long unitId;
@ -80,4 +68,4 @@ public class MoldPageReqVO extends PageParam {
@Schema(description = "附件地址")
private String fileUrl;
}
}

@ -28,9 +28,6 @@ public class MoldProductRespVO {
@ExcelProperty("产品")
private String productName;
@Schema(description = "产品名称快照", example = "产品A")
private String productNameSnapshot;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@ -43,4 +40,4 @@ public class MoldProductRespVO {
@Schema(description = "型号id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15258")
@ExcelProperty("型号id")
private Long brandId;
}
}

@ -1,10 +1,5 @@
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 lombok.*;
import java.util.*;
@ -36,22 +31,6 @@ public class MoldRespVO {
@ExcelProperty("模具名称")
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")
private Long unitId;
@ -107,19 +86,4 @@ public class MoldRespVO {
@ExcelProperty("附件地址")
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 = "模具名称不能为空")
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")
// @NotNull(message = "单位ID不能为空")
private Long unitId;
@ -69,4 +57,4 @@ public class MoldSaveReqVO {
@Schema(description = "附件地址")
private String fileUrl;
}
}

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

@ -113,49 +113,5 @@ public class MoldRepairRespVO {
@ExcelProperty("维修状态")
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 = "验收日期")
private LocalDateTime confirmDate;
//
// @Schema(description = "维修结果")
// private String repairResult;
@Schema(description = "维修结果")
private String repairStatus;
private String repairResult;
@Schema(description = "维修人员")
private String acceptedBy;
@ -83,37 +80,4 @@ public class MoldRepairSaveReqVO {
@Schema(description = "关键件Id")
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
*/
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;
/**
* 寿()
*/
@ -112,4 +76,4 @@ public class MoldBrandDO extends BaseDO {
// @Schema(description = "工序", example = "你说的对")
private String orgType;
}
}

@ -35,13 +35,9 @@ public class MoldBrandProductDO extends BaseDO {
* ID
*/
private Long productId;
/**
*
*/
private String productName;
/**
*
*/
private String remark;
}
}

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

@ -117,59 +117,4 @@ public class MoldRepairDO extends BaseDO {
*/
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
public interface MoldBrandMapper extends BaseMapperX<MoldBrandDO> {
default LambdaQueryWrapperX<MoldBrandDO> buildQueryWrapper(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());
}
default PageResult<MoldBrandDO> selectPage(MoldBrandPageReqVO reqVO) {
queryWrapper
/* .likeIfPresent(MoldBrandDO::getCode, reqVO.getCode())
.likeIfPresent(MoldBrandDO::getName, reqVO.getName())*/
LambdaQueryWrapperX<MoldBrandDO> moldBrandDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
moldBrandDOLambdaQueryWrapperX
.eqIfPresent(MoldBrandDO::getCode, reqVO.getCode())
.likeIfPresent(MoldBrandDO::getName, reqVO.getName())
.eqIfPresent(MoldBrandDO::getMoldType, reqVO.getMoldType())
.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::getMaintainType, reqVO.getMaintainType())
.eqIfPresent(MoldBrandDO::getMaintainTime, reqVO.getMaintainTime())
@ -59,33 +39,35 @@ public interface MoldBrandMapper extends BaseMapperX<MoldBrandDO> {
.betweenIfPresent(MoldBrandDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MoldBrandDO::getId);
//关键字(匹配编码/名称/产品型号)
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())
);
}
// 单独处理 ids 条件
if (StringUtils.isNotBlank(reqVO.getIds())) {
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
.map(String::trim)
.map(Long::valueOf)
.collect(Collectors.toList());
queryWrapper.in(MoldBrandDO::getId, idList);
moldBrandDOLambdaQueryWrapperX.in(MoldBrandDO::getId, idList);
}
return queryWrapper;
}
default PageResult<MoldBrandDO> selectPage(MoldBrandPageReqVO reqVO) {
return selectPage(reqVO, buildQueryWrapper(reqVO));
}
return selectPage(reqVO, moldBrandDOLambdaQueryWrapperX);
}
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())
.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
public interface MoldMapper extends BaseMapperX<MoldDO> {
default LambdaQueryWrapperX<MoldDO> buildQueryWrapper(MoldPageReqVO reqVO) {
default PageResult<MoldDO> selectPage(MoldPageReqVO reqVO) {
LambdaQueryWrapperX<MoldDO> wrapper = new LambdaQueryWrapperX<>();
wrapper
.likeIfPresent(MoldDO::getCode, reqVO.getCode())
.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::getMachineId, reqVO.getMachineId())
.likeIfPresent(MoldDO::getMachineName, reqVO.getMachineName())
@ -55,15 +51,7 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
if (reqVO.getStatuss() != null && !reqVO.getStatuss().isEmpty()) {
wrapper.in(MoldDO::getStatus, reqVO.getStatuss());
}
return wrapper;
}
default PageResult<MoldDO> selectPage(MoldPageReqVO reqVO) {
return selectPage(reqVO, buildQueryWrapper(reqVO));
}
default List<MoldDO> selectList(MoldPageReqVO reqVO) {
return selectList(buildQueryWrapper(reqVO));
return selectPage(reqVO, wrapper);
}
// 保持原有方法以兼容旧代码
@ -81,10 +69,6 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
return selectList(new LambdaQueryWrapperX<MoldDO>()
.eqIfPresent(MoldDO::getCode, reqVO.getCode())
.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())
.orderByDesc(MoldDO::getId));
}
@ -94,6 +78,4 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
.eq(MoldDO::getBrandId, brandId)
.orderByDesc(MoldDO::getId));
}
String selectPrintTemplate();
}
}

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

@ -27,7 +27,7 @@ public interface MoldTicketManagementMapper extends BaseMapperX<MoldTicketManage
ticketManagementDOLambdaQueryWrapperX
.eqIfPresent(MoldTicketManagementDO::getTaskId, reqVO.getTaskId())
.eqIfPresent(MoldTicketManagementDO::getPlanId, reqVO.getPlanId())
.likeIfPresent(MoldTicketManagementDO::getPlanNo, reqVO.getPlanNo())
.eqIfPresent(MoldTicketManagementDO::getPlanNo, reqVO.getPlanNo())
.likeIfPresent(MoldTicketManagementDO::getMoldName, reqVO.getMoldName())
.eqIfPresent(MoldTicketManagementDO::getPlanType, reqVO.getPlanType())
.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;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
@Getter
@ -9,7 +10,6 @@ public enum QrcodeBizTypeEnum {
PRODUCT("PRODUCTMATERIAL", "产品物料"),
EQUIPMENT("EQUIPMENT", "设备"),
DEVICE_LINE("DEVICE_LINE", "设备产线"),
KEY_PART("KEY_PART", "关键件"),
MOLD("MOLD", "模具"),
SPARE("SPARE", "备件");
@ -25,4 +25,4 @@ public enum QrcodeBizTypeEnum {
}
return null;
}
}
}

@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.common.enums.QrcodeBizTypeEnum;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.Valid;
import java.util.Collection;
import java.io.UnsupportedEncodingException;
import java.util.Map;
@ -67,8 +66,6 @@ public interface QrcodeRecordService {
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);
void deleteByBiz(QrcodeBizTypeEnum bizType, Long bizId);
@ -83,4 +80,4 @@ public interface QrcodeRecordService {
String scene,
CodeTypeEnum codeType
) throws UnsupportedEncodingException;
}
}

@ -35,7 +35,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
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
public Map<String, Object> resolveScanBizId(String type, Long id, String code) {
Map<String, Object> result = new HashMap<>();
@ -624,4 +602,4 @@ public class QrcodeRecordServiceImpl implements QrcodeRecordService {
}
}
}

@ -8,12 +8,5 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见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>

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

@ -9,6 +9,5 @@ public interface DictTypeConstants {
String AUDIT_STATUS = "erp_audit_status"; // 审核状态
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;
/**
* ERP
*
* TODO 稿==退
*
* @author
*/
@RequiredArgsConstructor
@Getter
public enum ErpAuditStatus implements IntArrayValuable {
DRAFT(0, "待提交"),
UN_APPROVE(1, "已驳回"),
PROCESS(10, "审核中"),
APPROVE(20, "审核通过");
DRAFT(0, "草稿"), // 审核中
UN_APPROVE(1, "驳回"), // 审核通过
PROCESS(10, "审核"), // 审核中
APPROVE(20, "审核"); // 审核通过
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpAuditStatus::getStatus).toArray();
/**
*
*/
private final Integer status;
/**
*
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

@ -13,11 +13,6 @@ public interface ErrorCodeConstants {
ErrorCode SUPPLIER_NOT_EXISTS = 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 ==========
ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_030_101_000, "采购订单不存在");
ErrorCode PURCHASE_ORDER_DELETE_FAIL_APPROVE = new ErrorCode(1_030_101_001, "采购订单({})已审核,无法删除");
@ -95,12 +90,6 @@ public interface ErrorCodeConstants {
// ========== ERP 仓库 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_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, "暂无匹配库位信息");
// ========== ERP 其它入库单 1-030-401-000 ==========
ErrorCode STOCK_IN_NOT_EXISTS = new ErrorCode(1_030_401_000, "其它入库单不存在");
@ -109,14 +98,6 @@ public interface ErrorCodeConstants {
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_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_OUT = new ErrorCode(1_030_401_005, "模具({})已经出库,无法继续操作出库");
@ -128,14 +109,6 @@ public interface ErrorCodeConstants {
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_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, "审核失败,审核结果只支持通过或驳回");
// ========== ERP 库存调拨单 1-030-403-000 ==========
ErrorCode STOCK_MOVE_NOT_EXISTS = new ErrorCode(1_030_402_000, "库存调拨单不存在");
@ -152,14 +125,6 @@ public interface ErrorCodeConstants {
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_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, "审核失败,审核结果只支持通过或驳回");
// ========== ERP 产品库存 1-030-404-000 ==========
ErrorCode STOCK_COUNT_NEGATIVE = new ErrorCode(1_030_404_000, "操作失败,产品({})所在仓库({})的库存:{},小于变更数量:{}");
@ -187,8 +152,6 @@ public interface ErrorCodeConstants {
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_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 ==========
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在");
@ -219,19 +182,15 @@ public interface ErrorCodeConstants {
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_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_RULE_NOT_EXISTS = new ErrorCode(1_111_004, "编码规则不存在");
ErrorCode AUTOCODE_PART_NOT_EXISTS = new ErrorCode(1_111_005, "编码规则组成不存在");
ErrorCode AUTOCODE_GEN_NOT_UNIQUE = new ErrorCode(1_111_006, "编码已存在");
ErrorCode PRODUCT_REFERENCES_EXIST = new ErrorCode(1_003_000_000, "存在产品已被引用,请先删除引用。");
}

@ -1,16 +0,0 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum ErpStockCheckApproveActionEnum {
SUBMIT("SUBMIT"),
APPROVE("APPROVE"),
REJECT("REJECT");
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 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;
}

@ -27,11 +27,6 @@
<artifactId>yudao-module-erp-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
@ -81,4 +76,4 @@
</dependencies>
</project>
</project>

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

@ -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")
private Long productId;
@Schema(description = "设备名称", example = "注塑机")
private String deviceName;
@Schema(description = "预期寿命(小时)")
private BigDecimal useTime;
@ -59,4 +56,4 @@ public class MoldBrandPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
}
}

@ -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 cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
@Schema(description = "管理后台 - 模具型号 Response VO")
@ -41,50 +40,6 @@ public class MoldBrandRespVO {
// @ExcelProperty("产品")
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 = "预期寿命/次")
@ExcelProperty("预期寿命/次")
private BigDecimal useTime;
@ -120,11 +75,4 @@ public class MoldBrandRespVO {
@DictFormat("mes_org_type")
private String orgType;
// , 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("附件地址")
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,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.ErpProductCategoryRespVO;
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.service.product.ErpProductCategoryService;
import io.swagger.v3.oas.annotations.Operation;
@ -23,10 +21,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
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;
@ -82,30 +77,12 @@ public class ErpProductCategoryController {
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")
@Operation(summary = "获得产品分类精简列表", description = "只包含被开启的分类,主要用于前端的下拉选项")
public CommonResult<List<ErpProductCategoryRespVO>> getProductCategorySimpleList(@RequestParam("type") Integer type) {
public CommonResult<List<ErpProductCategoryRespVO>> getProductCategorySimpleList() {
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()
.setId(category.getId()).setName(category.getName()).setParentId(category.getParentId()).setSort(category.getSort())));
}
@ -115,33 +92,11 @@ public class ErpProductCategoryController {
@PreAuthorize("@ss.hasPermission('erp:product-category:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProductCategoryExcel(@Valid ErpProductCategoryListReqVO listReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO);
// 导出 Excel
ExcelUtils.write(response, "产品分类.xls", "数据", 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;
BeanUtils.toBean(list, ErpProductCategoryRespVO.class));
}
}
}

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

@ -10,16 +10,7 @@ public class ErpProductCategoryListReqVO {
@Schema(description = "分类名称", example = "芋艿")
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")
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.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 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;
@Schema(description = "管理后台 - ERP 产品分类 Response VO")
@ -37,18 +35,13 @@ public class ErpProductCategoryRespVO {
@ExcelProperty("分类排序")
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")
@ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat(COMMON_STATUS)
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
}

@ -29,12 +29,8 @@ public class ErpProductCategorySaveReqVO {
@NotNull(message = "分类排序不能为空")
private Integer sort;
@Schema(description = "分类类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// @NotNull(message = "分类类型不能为空")
private Integer type;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "开启状态不能为空")
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,16 +62,7 @@ public class ErpProductImportExcelVO {
@ExcelIgnore
private Long unitId; // 单位ID
@ExcelIgnore
private Long purchaseUnitId; // 采购单位ID
@ExcelIgnore
private String purchaseUnitName; // 采购单位名称
@ExcelIgnore
private BigDecimal purchaseUnitConvertQuantity; // 采购单位换算数量
@ExcelIgnore
private LocalDateTime createTime;
}
}

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

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

@ -33,9 +33,6 @@ public class ErpProductRespVO extends ErpProductDO {
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11161")
private Long categoryId;
@Schema(description = "产品分类类型")
private Integer categoryType;
@Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果")
@ExcelProperty("产品分类")
private String categoryName;
@ -53,18 +50,6 @@ public class ErpProductRespVO extends ErpProductDO {
@ExcelProperty("单位")
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")
@ExcelProperty("产品状态")
private Integer status;
@ -105,31 +90,6 @@ public class ErpProductRespVO extends ErpProductDO {
@ExcelProperty("预警库存")
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 = "")
private String qrcodeUrl;
//
@ -139,24 +99,10 @@ public class ErpProductRespVO extends ErpProductDO {
// @Schema(description = "关联模具D列表", example = "[11,15,23]")
// private List<Long> moldIds;
@Schema(description = "打印模板Json", example = "")
private String templateJson;
@Schema(description = "关联设备列表")
private List<ProductRelationRespVO> devices;
@Schema(description = "关联模具列表")
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 lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ -36,15 +35,6 @@ public class ProductSaveReqVO {
@NotNull(message = "单位编号不能为空")
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")
@NotNull(message = "产品状态不能为空")
private Integer status;
@ -73,44 +63,9 @@ public class ProductSaveReqVO {
@Schema(description = "预警库存", example = "161.87")
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]")
private List<Long> deviceIds;
@Schema(description = "关联模具D列表", example = "[11,15,23]")
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,28 +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.PageResult;
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.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.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.ErpStockCheckRespVO;
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.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.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.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
@ -35,32 +23,21 @@ 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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
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.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.convertSet;
@Tag(name = "管理后台 - ERP 库存盘点单")
@Tag(name = "管理后台 - ERP 库存调拨单")
@RestController
@RequestMapping("/erp/stock-check")
@Validated
@ -70,22 +47,19 @@ public class ErpStockCheckController {
private ErpStockCheckService stockCheckService;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建库存盘点单")
@Operation(summary = "创建库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:create')")
public CommonResult<Long> createStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO createReqVO) {
return success(stockCheckService.createStockCheck(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存盘点单")
@Operation(summary = "更新库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update')")
public CommonResult<Boolean> updateStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO updateReqVO) {
stockCheckService.updateStockCheck(updateReqVO);
@ -93,56 +67,16 @@ public class ErpStockCheckController {
}
@PutMapping("/update-status")
@Operation(summary = "更新库存盘点单状态")
@Operation(summary = "更新库存调拨单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update-status')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockCheckStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
@RequestParam("status") Integer status) {
stockCheckService.updateStockCheckStatus(id, status);
return success(true);
}
@PutMapping("/submit")
@Operation(summary = "提交库存盘点单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update')")
@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:update-status')")
@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")
@Operation(summary = "删除库存盘点单")
@Operation(summary = "删除库存调拨单")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-check:delete')")
public CommonResult<Boolean> deleteStockCheck(@RequestParam("ids") List<Long> ids) {
@ -151,7 +85,7 @@ public class ErpStockCheckController {
}
@GetMapping("/get")
@Operation(summary = "获得库存盘点单")
@Operation(summary = "获得库存调拨单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<ErpStockCheckRespVO> getStockCheck(@RequestParam("id") Long id) {
@ -159,89 +93,57 @@ public class ErpStockCheckController {
if (stockCheck == null) {
return success(null);
}
return success(buildStockCheckRespVO(stockCheck,
stockCheckService.getStockCheckItemListByCheckId(id),
stockCheckService.getStockCheckApproveRecordList(id)));
List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
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")
@Operation(summary = "获得库存盘点单分页")
@Operation(summary = "获得库存调拨单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
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")
@Operation(summary = "导出库存盘点单 Excel")
@Operation(summary = "导出库存调拨单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-check:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportStockCheckExcel(@Valid ErpStockCheckPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
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) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 盘点项
List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckIds(
convertSet(pageResult.getList(), ErpStockCheckDO::getId));
Map<Long, List<ErpStockCheckItemDO>> stockCheckItemMap = convertMultiMap(stockCheckItemList, ErpStockCheckItemDO::getCheckId);
// 1.2 产品信息
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 -> {
stockCheck.setItems(buildItemRespList(stockCheckItemMap.get(stockCheck.getId())));
stockCheck.setProductNames(CollUtil.join(stockCheck.getItems(), ",", ErpStockCheckRespVO.Item::getProductName));
fillUserInfo(stockCheck);
});
}
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, ErpProductRespVO> productMap = productService.getProductVOMap(convertSet(itemList, ErpStockCheckItemDO::getProductId));
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()).setProductUnitName(product.getUnitName()));
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);
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()));
stockCheck.setItems(BeanUtils.toBean(stockCheckItemMap.get(stockCheck.getId()), ErpStockCheckRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.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()));
});
}
}
}

@ -13,11 +13,9 @@ import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockPageR
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockRespVO;
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.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
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 io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
@ -53,8 +51,6 @@ public class ErpStockController {
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@GetMapping("/get")
@Operation(summary = "获得产品库存")
@ -66,10 +62,9 @@ public class ErpStockController {
@PreAuthorize("@ss.hasPermission('erp:stock:query')")
public CommonResult<ErpStockRespVO> getStock(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "productId", required = false) Long productId,
@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, areaId);
return success(buildStockRespVO(stock));
@RequestParam(value = "warehouseId", required = false) Long warehouseId) {
ErpStockDO stock = id != null ? stockService.getStock(id) : stockService.getStock(productId, warehouseId);
return success(BeanUtils.toBean(stock, ErpStockRespVO.class));
}
@GetMapping("/get-count")
@ -107,43 +102,11 @@ public class ErpStockController {
convertSet(pageResult.getList(), ErpStockDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(
convertSet(pageResult.getList(), ErpStockDO::getAreaId));
return BeanUtils.toBean(pageResult, ErpStockRespVO.class, stock -> {
MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName()).setBarCode(product.getBarCode())
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName())
.setCategoryType(product.getCategoryType()));
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
if (stock.getAreaName() == null) {
MapUtils.findAndThen(areaMap, stock.getAreaId(), area -> stock.setAreaName(area.getAreaName()));
}
});
}
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());
respVO.setUnitName(product.getUnitName());
respVO.setCategoryType(product.getCategoryType());
}
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());
}
}
return respVO;
}
}
}

@ -6,40 +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.PageResult;
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.excel.core.util.ExcelUtils;
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.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.ErpStockInRespVO;
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.out.ErpStockOutRespVO;
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.ErpStockInApproveRecordDO;
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.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.service.mold.MoldBrandService;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import cn.iocoder.yudao.module.erp.service.mold.MoldService;
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.stock.ErpStockInService;
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.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -51,17 +42,14 @@ import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
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.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.convertListByFlatMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - ERP 其它入库单")
@ -78,14 +66,10 @@ public class ErpStockInController {
private ErpProductService productService;
@Resource
private ErpSupplierService supplierService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private MoldBrandService moldBrandService;
@Resource
private MoldService moldService;
@Resource
private AdminUserApi adminUserApi;
@ -110,36 +94,11 @@ public class ErpStockInController {
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockInStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status,
@RequestParam(name = "bizType", required = false) Integer bizType) {
stockInService.updateStockInStatus(id, status, bizType);
@RequestParam(name = "status",required = false) Integer bizType) {
stockInService.updateStockInStatus(id, status,bizType);
return success(true);
}
@PutMapping("/submit")
@Operation(summary = "提交其它入库单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-in:update')")
@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:update-status')")
@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")
@Operation(summary = "删除其它入库单")
@Parameter(name = "ids", description = "编号数组", required = true)
@ -158,17 +117,45 @@ public class ErpStockInController {
if (stockIn == null) {
return success(null);
}
return success(buildStockInRespVO(stockIn,
stockInService.getStockInItemListByInId(id),
stockInService.getStockInApproveRecordList(id)));
List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInId(id);
if (Objects.equals(stockIn.getInType(), "模具入库")) {
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")
@Operation(summary = "获得其它入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> getStockInPage(@Valid ErpStockInPageReqVO pageReqVO) {
fillPageReqDefault(pageReqVO);
return success(buildStockInVOPageResult(stockInService.getStockInPage(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);
}
PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@ -176,122 +163,53 @@ public class ErpStockInController {
@PreAuthorize("@ss.hasPermission('erp:stock-in:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportStockInExcel(@Valid ErpStockInPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
fillPageReqDefault(pageReqVO);
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockInRespVO> list = buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它入库单.xls", "数据", ErpStockInRespVO.class, list);
}
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) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
List<ErpStockInRespVO> list = convertList(pageResult.getList(), stockIn -> buildStockInRespVO(
stockIn, stockInService.getStockInItemListByInId(stockIn.getId()), Collections.emptyList()));
return new PageResult<>(list, pageResult.getTotal());
}
private ErpStockInRespVO buildStockInRespVO(ErpStockInDO stockIn, List<ErpStockInItemDO> stockInItemList,
List<ErpStockInApproveRecordDO> approveRecords) {
ErpStockInRespVO stockInVO = BeanUtils.toBean(stockIn, ErpStockInRespVO.class);
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(stockInItemList, ErpStockInItemDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(
convertSet(stockInItemList, ErpStockInItemDO::getAreaId));
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(
Collections.singletonList(stockIn), item -> Stream.of(NumberUtils.parseLong(item.getCreator()),
item.getStockUserId(), item.getAuditUserId())));
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()));
if (Objects.equals(stockIn.getInType(), "模具入库")) {
Map<Long, MoldBrandDO> moldMap = moldBrandService.getMoldVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getMoldSetId));
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = moldService.getMoldListMapByBrandIds(
convertSet(stockInItemList, ErpStockInItemDO::getMoldSetId));
stockInVO.setItems(convertList(stockInItemList, source -> {
ErpStockInRespVO.Item item = BeanUtils.toBean(source, ErpStockInRespVO.Item.class);
ErpStockDO stock = 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);
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 {
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
stockInVO.setItems(BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> {
ErpStockDO stock = 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()));
}
MapUtils.findAndThen(productMap, item.getProductId(), product -> {
item.setProductName(product.getName());
item.setProductBarCode(product.getBarCode());
item.setProductUnitName(product.getUnitName());
item.setCategoryType(product.getCategoryType());
});
}));
stockInVO.setProductNames(CollUtil.join(stockInVO.getItems(), ",", ErpStockInRespVO.Item::getProductName));
}
if (stockIn.getSupplierId() != null) {
Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(Collections.singleton(stockIn.getSupplierId()));
MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockInVO.setSupplierName(supplier.getName()));
}
stockInVO.setApproveRecords(buildApproveRecordRespList(approveRecords));
return stockInVO;
}
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()));
// 1.1 入库项
List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInIds(
convertSet(pageResult.getList(), ErpStockInDO::getId));
Map<Long, List<ErpStockInItemDO>> stockInItemMap = convertMultiMap(stockInItemList, ErpStockInItemDO::getInId);
// 1.2 产品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
// 1.3 供应商信息
Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
convertSet(pageResult.getList(), ErpStockInDO::getSupplierId));
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), stockIn -> Long.parseLong(stockIn.getCreator())));
// 1.7 模具信息
Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockInRespVO.class, stockIn -> {
if (Objects.equals(stockIn.getInType(), "模具入库")) {
stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
item -> MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
.setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()))));
stockIn.setProductNames(CollUtil.join(stockIn.getItems(), "", ErpStockInRespVO.Item::getProductName));
} else {
stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockIn.setProductNames(CollUtil.join(stockIn.getItems(), "", ErpStockInRespVO.Item::getProductName));
}
MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockIn.setSupplierName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockIn.getCreator()), user -> stockIn.setCreatorName(user.getNickname()));
});
}
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")
@Operation(summary = "创建生产入库单")
@PreAuthorize("@ss.hasPermission('erp:stock-in:create')")
@ -299,32 +217,21 @@ public class ErpStockInController {
createReqVO.setInType(StockInTypeEnum..getValue());
return success(stockInService.createStockIn(createReqVO));
}
@GetMapping("/pageMesStockIn")
@Operation(summary = "获得生产入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> pageMesStockIn(@Valid ErpStockInPageReqVO pageReqVO) {
pageReqVO.setInType(StockInTypeEnum..getValue());
fillPageReqDefault(pageReqVO);
return success(buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)));
PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(pageResult));
}
@GetMapping("/pageComponent")
@Operation(summary = "获得备件入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> pageComponent(@Valid ErpStockInPageReqVO pageReqVO) {
pageReqVO.setInType(StockInTypeEnum..getValue());
fillPageReqDefault(pageReqVO);
return success(buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)));
PageResult<ErpStockInDO> pageResult = 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);
}
}
}

@ -6,25 +6,20 @@ 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.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.excel.core.util.ExcelUtils;
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.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.ErpStockOutRespVO;
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.dal.dataobject.sale.ErpCustomerDO;
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.ErpStockOutItemDO;
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.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
@ -38,14 +33,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -53,17 +41,14 @@ import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
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.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.convertListByFlatMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - ERP 其它出库单")
@ -80,10 +65,10 @@ public class ErpStockOutController {
private ErpProductService productService;
@Resource
private ErpCustomerService customerService;
@Resource
private MoldBrandService moldBrandService;
@Resource
private MoldService moldService;
@Resource
private AdminUserApi adminUserApi;
@ -107,44 +92,9 @@ public class ErpStockOutController {
@PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
@RateLimiter(count = 1, timeUnit = TimeUnit.SECONDS)
public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status,
@RequestParam(name = "bizType", required = false) Integer bizType) {
stockOutService.updateStockOutStatus(id, status, bizType);
return success(true);
}
@PutMapping("/submit")
@Operation(summary = "提交其它出库单审核")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update')")
@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:update-status')")
@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);
@RequestParam("status") Integer status,
@RequestParam(name = "status",required = false) Integer bizType) {
stockOutService.updateStockOutStatus(id, status,bizType);
return success(true);
}
@ -166,112 +116,98 @@ public class ErpStockOutController {
if (stockOut == null) {
return success(null);
}
return success(buildStockOutRespVO(stockOut,
stockOutService.getStockOutItemListByOutId(id),
stockOutService.getStockOutApproveRecordList(id)));
List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutId(id);
if (Objects.equals(stockOut.getOutType(), "模具出库")) {
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")
@Operation(summary = "获得其它出库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<PageResult<ErpStockOutRespVO>> getStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
fillPageReqDefault(pageReqVO);
return success(buildStockOutVOPageResult(stockOutService.getStockOutPage(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);
}
PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
return success(buildStockOutVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出其它出库单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-out:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
fillPageReqDefault(pageReqVO);
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它出库单.xls", "数据", ErpStockOutRespVO.class, list);
}
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) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
List<ErpStockOutRespVO> list = convertList(pageResult.getList(), stockOut -> buildStockOutRespVO(
stockOut, stockOutService.getStockOutItemListByOutId(stockOut.getId()), Collections.emptyList()));
return new PageResult<>(list, pageResult.getTotal());
}
private ErpStockOutRespVO buildStockOutRespVO(ErpStockOutDO stockOut, List<ErpStockOutItemDO> stockOutItemList,
List<ErpStockOutApproveRecordDO> approveRecords) {
ErpStockOutRespVO stockOutVO = BeanUtils.toBean(stockOut, ErpStockOutRespVO.class);
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(
Collections.singletonList(stockOut), item -> Stream.of(NumberUtils.parseLong(item.getCreator()),
item.getResponserId(), item.getAuditUserId())));
MapUtils.findAndThen(userMap, NumberUtils.parseLong(stockOut.getCreator()), user -> stockOutVO.setCreatorName(user.getNickname()));
MapUtils.findAndThen(userMap, stockOut.getResponserId(), user -> stockOutVO.setResponserName(user.getNickname()));
MapUtils.findAndThen(userMap, stockOut.getAuditUserId(), user -> stockOutVO.setAuditUserName(user.getNickname()));
if (Objects.equals(stockOut.getOutType(), "模具出库")) {
Map<Long, MoldBrandDO> moldMap = moldBrandService.getMoldVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getMoldSetId));
Map<Long, List<cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO>> moldListMap = moldService.getMoldListMapByBrandIds(
convertSet(stockOutItemList, ErpStockOutItemDO::getMoldSetId));
stockOutVO.setItems(convertList(stockOutItemList, source -> {
ErpStockOutRespVO.Item item = BeanUtils.toBean(source, ErpStockOutRespVO.Item.class);
ErpStockDO stock = stockService.getStock(source.getMoldSetId(), source.getWarehouseId(), source.getAreaId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
item.setMoldList(moldListMap.getOrDefault(source.getMoldSetId(), new ArrayList<>()));
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 {
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId(), item.getAreaId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> {
item.setProductName(product.getName());
item.setProductBarCode(product.getBarCode());
item.setProductUnitName(product.getUnitName());
item.setCategoryType(product.getCategoryType());
});
}));
stockOutVO.setProductNames(CollUtil.join(stockOutVO.getItems(), ",", ErpStockOutRespVO.Item::getProductName));
}
if (stockOut.getCustomerId() != null) {
Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(Collections.singleton(stockOut.getCustomerId()));
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), customer -> stockOutVO.setCustomerName(customer.getName()));
}
stockOutVO.setApproveRecords(buildApproveRecordRespList(approveRecords));
return stockOutVO;
}
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()));
// 1.1 出库项
List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutIds(
convertSet(pageResult.getList(), ErpStockOutDO::getId));
Map<Long, List<ErpStockOutItemDO>> stockOutItemMap = convertMultiMap(stockOutItemList, ErpStockOutItemDO::getOutId);
// 1.2 产品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
// 1.3 客户信息
Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
convertSet(pageResult.getList(), ErpStockOutDO::getCustomerId));
// 1.5 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), stockOut -> Long.parseLong(stockOut.getCreator())));
// 1.6 领料员信息
Map<Long, AdminUserRespDTO> responserMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), ErpStockOutDO::getResponserId));
// 1.7 模具信息
Map<Long, MoldRespVO> moldMap = moldService.getMoldVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockOutRespVO.class, stockOut -> {
if (Objects.equals(stockOut.getOutType(), "模具出库")) {
stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
item -> MapUtils.findAndThen(moldMap, item.getProductId(), mold -> item.setProductName(mold.getName())
.setProductBarCode(mold.getCode()).setProductUnitName(mold.getUnitName()))));
stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
} else {
stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
}
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockOut.getCreator()), user -> stockOut.setCreatorName(user.getNickname()));
MapUtils.findAndThen(responserMap, stockOut.getResponserId(), user -> stockOut.setResponserName(user.getNickname()));
});
}
@ -282,13 +218,13 @@ public class ErpStockOutController {
createReqVO.setOutType(StockOutTypeEnum..getValue());
return success(stockOutService.createStockOut(createReqVO));
}
@GetMapping("/pageMesStockOut")
@Operation(summary = "获得生产领料出库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<PageResult<ErpStockOutRespVO>> getMesStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
pageReqVO.setOutType(StockOutTypeEnum..getValue());
return success(buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)));
PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
return success(buildStockOutVOPageResult(pageResult));
}
}
}

@ -13,11 +13,9 @@ import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockReco
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.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.stock.ErpStockRecordService;
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.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
@ -53,8 +51,6 @@ public class ErpStockRecordController {
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private WarehouseAreaService warehouseAreaService;
@Resource
private AdminUserApi adminUserApi;
@ -65,7 +61,7 @@ public class ErpStockRecordController {
@PreAuthorize("@ss.hasPermission('erp:stock-record:query')")
public CommonResult<ErpStockRecordRespVO> getStockRecord(@RequestParam("id") Long id) {
ErpStockRecordDO stockRecord = stockRecordService.getStockRecord(id);
return success(buildStockRecordRespVO(stockRecord));
return success(BeanUtils.toBean(stockRecord, ErpStockRecordRespVO.class));
}
@GetMapping("/page")
@ -96,51 +92,14 @@ public class ErpStockRecordController {
convertSet(pageResult.getList(), ErpStockRecordDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getWarehouseId));
Map<Long, WarehouseAreaDO> areaMap = warehouseAreaService.getWarehouseAreaMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getAreaId));
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), record -> Long.parseLong(record.getCreator())));
return BeanUtils.toBean(pageResult, ErpStockRecordRespVO.class, stock -> {
MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName())
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName())
.setCategoryType(product.getCategoryType()));
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
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()));
});
}
private ErpStockRecordRespVO buildStockRecordRespVO(ErpStockRecordDO stockRecord) {
if (stockRecord == null) {
return null;
}
ErpStockRecordRespVO respVO = BeanUtils.toBean(stockRecord, ErpStockRecordRespVO.class);
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;
}
}
}

@ -5,11 +5,11 @@ 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.stock.vo.warehouse.ErpWarehousePageReqVO;
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.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import io.swagger.v3.oas.annotations.Operation;
@ -80,7 +80,8 @@ public class ErpWarehouseController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
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")
@ -112,4 +113,4 @@ public class ErpWarehouseController {
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
}
}
}

@ -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,26 +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 ErpStockCheckGenerateByLocationReqVO {
@Schema(description = "仓库编号列表", example = "[1,2]")
private List<Long> warehouseIds;
@Schema(description = "库区编号列表", example = "[11,12]")
private List<Long> areaIds;
@Schema(description = "是否允许为空,默认 false", example = "false")
private Boolean allowEmpty;
public boolean validSelection() {
return (warehouseIds != null && !warehouseIds.isEmpty()) || (areaIds != null && !areaIds.isEmpty());
}
}

@ -1,17 +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;
}

@ -44,12 +44,6 @@ public class ErpStockCheckRespVO {
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "审核人名称", example = "李四")
private String auditUserName;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@ -73,9 +67,6 @@ public class ErpStockCheckRespVO {
@ExcelProperty("产品信息")
private String productNames;
@Schema(description = "审核记录")
private List<ErpStockCheckApproveRecordRespVO> approveRecords;
@Data
public static class Item {
@ -85,15 +76,6 @@ public class ErpStockCheckRespVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
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")
private Long productId;
@ -109,6 +91,7 @@ public class ErpStockCheckRespVO {
private BigDecimal actualCount;
@Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
@ -125,4 +108,4 @@ public class ErpStockCheckRespVO {
}
}
}

@ -10,15 +10,15 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 存盘点单新增/修改 Request VO")
@Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
@Data
public class ErpStockCheckSaveReqVO {
@Schema(description = "盘点编号", example = "11756")
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "盘点时间不能为空")
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库时间不能为空")
private LocalDateTime checkTime;
@Schema(description = "备注", example = "随便")
@ -27,24 +27,21 @@ public class ErpStockCheckSaveReqVO {
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "盘点项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "盘点项列表不能为空")
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "出库项列表不能为空")
@Valid
private List<Item> items;
@Data
public static class Item {
@Schema(description = "盘点项编号", example = "11756")
@Schema(description = "出库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@ -60,7 +57,8 @@ public class ErpStockCheckSaveReqVO {
@NotNull(message = "实际数量不能为空")
private BigDecimal actualCount;
@Schema(description = "盈亏数量,服务端自动按 实际数量 - 账面数量 计算", example = "100.00")
@Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
@ -68,4 +66,4 @@ public class ErpStockCheckSaveReqVO {
}
}
}

@ -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,44 +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 = "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,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;
}

@ -34,33 +34,23 @@ public class ErpStockInPageReqVO extends PageParam {
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "入库类型", example = "其它入库")
@Schema(description = "入库类型", example = "随便")
private String inType;
@Schema(description = "入库类型集合")
@Schema(description = "入库类型", example = "随便")
private List<String> inTypeList;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建")
@Schema(description = "创建")
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")
private Long productId;
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
@Schema(description = "id 集合导出使用")
@Schema(description = "id集合导出用")
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.convert.DictConvert;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ -29,7 +28,6 @@ public class ErpStockInRespVO {
@Schema(description = "供应商编号", example = "3113")
private Long supplierId;
@Schema(description = "供应商名称", example = "芋道")
@ExcelProperty("供应商名称")
private String supplierName;
@ -38,26 +36,11 @@ public class ErpStockInRespVO {
@ExcelProperty("入库时间")
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")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@ -70,7 +53,7 @@ public class ErpStockInRespVO {
@ExcelProperty("备注")
private String remark;
@Schema(description = "入库类型", example = "其它入库")
@Schema(description = "入库类型", example = "随便")
@ExcelProperty("入库类型")
private String inType;
@ -79,7 +62,6 @@ public class ErpStockInRespVO {
@Schema(description = "创建人", example = "芋道")
private String creator;
@Schema(description = "创建人名称", example = "芋道")
private String creatorName;
@ -94,73 +76,39 @@ public class ErpStockInRespVO {
@ExcelProperty("产品信息")
private String productNames;
@Schema(description = "模具组名称")
private String moldSetNames;
@Schema(description = "审核记录")
private List<ErpStockInApproveRecordRespVO> approveRecords;
@Data
public static class Item {
@Schema(description = "入库项编号", example = "11756")
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")
private Long warehouseId;
@Schema(description = "库区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long areaId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "产品单价", example = "100.00")
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count;
@Schema(description = "包装方案 ID", example = "1")
private Long packagingSchemeId;
@Schema(description = "单位输入方式", example = "包")
private String inputUnitType;
@Schema(description = "录入数量", example = "10.00")
private BigDecimal inputCount;
@Schema(description = "备注", example = "随便")
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;
@Schema(description = "产品单位名称", example = "盒")
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
private String productUnitName;
@Schema(description = "仓库名称", example = "A仓")
private String warehouseName;
@Schema(description = "库区名称", example = "A-01")
private String areaName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
@Schema(description = "库存数量", example = "100.00")
private BigDecimal stockCount;
@Schema(description = "子模具详情")
private List<MoldDO> moldList;
}
}
}

@ -1,5 +1,6 @@
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 lombok.Data;
@ -14,7 +15,7 @@ import java.util.List;
@Data
public class ErpStockInSaveReqVO {
@Schema(description = "入库编号", example = "11756")
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "供应商编号", example = "3113")
@ -24,15 +25,9 @@ public class ErpStockInSaveReqVO {
@NotNull(message = "入库时间不能为空")
private LocalDateTime inTime;
@Schema(description = "入库类型", example = "其它入库")
@Schema(description = "入库类型", example = "随便")
private String inType;
@Schema(description = "经办人编号", example = "1888")
private Long stockUserId;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "备注", example = "随便")
private String remark;
@ -44,26 +39,23 @@ public class ErpStockInSaveReqVO {
@Valid
private List<Item> items;
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId;
@Data
public static class Item {
@Schema(description = "子项 id", example = "11756")
@Schema(description = "入库项编号", example = "11756")
private Long id;
@Schema(description = "模具组 id", example = "101")
private Long moldSetId;
@Schema(description = "仓库编号", example = "3113")
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
// @NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "库区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
// @NotNull(message = "库区编号不能为空")
private Long areaId;
@Schema(description = "产品编号", example = "3113")
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
@ -73,19 +65,11 @@ public class ErpStockInSaveReqVO {
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
@Schema(description = "包装方案 ID", example = "1")
private Long packagingSchemeId;
@Schema(description = "单位输入方式", example = "包")
private String inputUnitType;
@Schema(description = "录入数量", example = "10.00")
private BigDecimal inputCount;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "设备 id", example = "100")
@Schema(description = "设备id", example = "100.00")
private Long deviceId;
}
}
}

@ -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,44 +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 = "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,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;
}

@ -25,14 +25,11 @@ public class ErpStockOutPageReqVO extends PageParam {
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "负责人 id", example = "3113")
@Schema(description = "负责人id", example = "3113")
private Long responserId;
@Schema(description = "出库类型", example = "其他出库")
@Schema(description = "出库类型", example = "随便")
private String outType;
@Schema(description = "出库类型列表", example = "[\"其他出库\",\"产品出库\"]")
@Schema(description = "出库类型", example = "随便")
private List<String> outTypeList;
@Schema(description = "出库时间")
@ -43,10 +40,7 @@ public class ErpStockOutPageReqVO extends PageParam {
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "审核人编号", example = "1")
private Long auditUserId;
@Schema(description = "备注", example = "备注信息")
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建者")
@ -58,6 +52,6 @@ public class ErpStockOutPageReqVO extends PageParam {
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
@Schema(description = "id 集合导出时使用")
@Schema(description = "id集合导出用")
private String ids;
}
}

@ -2,7 +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.convert.DictConvert;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ -29,18 +28,14 @@ public class ErpStockOutRespVO {
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "客户名称", example = "芋道")
@ExcelProperty("客户名称")
private String customerName;
@Schema(description = "负责人 id", example = "3113")
@Schema(description = "负责人id", example = "3113")
private Long responserId;
@Schema(description = "负责人", example = "张三")
@Schema(description = "负责人", example = "3113")
private String responserName;
@Schema(description = "出库类型", example = "其他出库")
@Schema(description = "出库类型", example = "随便")
private String outType;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ -51,7 +46,7 @@ public class ErpStockOutRespVO {
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@ -60,16 +55,7 @@ public class ErpStockOutRespVO {
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "是否需要审核", example = "true")
private Boolean needAudit;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "审核人名称", example = "李四")
private String auditUserName;
@Schema(description = "备注", example = "备注信息")
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@ -78,7 +64,6 @@ public class ErpStockOutRespVO {
@Schema(description = "创建人", example = "芋道")
private String creator;
@Schema(description = "创建人名称", example = "芋道")
private String creatorName;
@ -89,69 +74,47 @@ public class ErpStockOutRespVO {
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@Schema(description = "审核记录")
private List<ErpStockOutApproveRecordRespVO> approveRecords;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息")
private String productNames;
@Schema(description = "模具组名称")
private String moldSetNames;
@Schema(description = "计划单 Code", example = "PLAN20240601")
@Schema(description = "计划单Code", example = "随便")
private String planCode;
@Data
public static class Item {
@Schema(description = "出库项编号", example = "11756")
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")
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")
private Long productId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count;
@Schema(description = "备注", example = "备注信息")
@Schema(description = "备注", example = "随便")
private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
private String productUnitName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount;
private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
@Schema(description = "子模具列表")
private List<MoldDO> moldList;
}
}
}

@ -14,26 +14,21 @@ import java.util.List;
@Data
public class ErpStockOutSaveReqVO {
@Schema(description = "出库编号", example = "11756")
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "负责人 id", example = "3113")
@Schema(description = "负责人id", example = "3113")
private Long responserId;
@Schema(description = "出库类型", example = "其他出库")
@Schema(description = "出库类型", example = "随便")
private String outType;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库时间不能为空")
private LocalDateTime outTime;
@Schema(description = "审核人编号", example = "1888")
private Long auditUserId;
@Schema(description = "备注", example = "备注信息")
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
@ -44,35 +39,34 @@ public class ErpStockOutSaveReqVO {
@Valid
private List<Item> items;
@Schema(description = "计划单 Code", example = "PLAN20240601")
@Schema(description = "计划单Code", example = "随便")
private String planCode;
@Data
public static class Item {
@Schema(description = "出库项编号", example = "11756")
private Long id;
@Schema(description = "模具组 id", example = "101")
private Long moldSetId;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
// @NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "产品 id", example = "3113")
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "备注信息")
@Schema(description = "备注", example = "随便")
private String remark;
}
}
}

@ -1,21 +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 ErpStockOutSubmitReqVO {
@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;
}

@ -15,6 +15,7 @@ public enum StockOutTypeEnum {
private final String value;
// 一个可选的方法,用于根据整数值获取对应的枚举实例
public static StockOutTypeEnum fromValue(String value) {
for (StockOutTypeEnum status : StockOutTypeEnum.values()) {
if (status.getValue().equals(value)) {
@ -23,4 +24,4 @@ public enum StockOutTypeEnum {
}
throw new IllegalArgumentException("Unknown value: " + value);
}
}
}

@ -22,12 +22,8 @@ public class ErpStockRecordPageReqVO extends PageParam {
@Schema(description = "仓库编号", example = "32407")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "产品分类", example = "32407")
private Long categoryId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "业务类型", example = "10")
private Integer bizType;
@ -44,4 +40,4 @@ public class ErpStockRecordPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
}
}

@ -23,21 +23,9 @@ public class ErpStockRecordRespVO {
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10625")
private Long productId;
@Schema(description = "产品分类类型", example = "1")
@ExcelProperty(value = "产品分类类型", converter = DictConvert.class)
@DictFormat(DictTypeConstants.PRODUCT_CATEGORY_TYPE)
private Integer categoryType;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32407")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "库区名称", example = "A区")
@ExcelProperty("库区名称")
private String areaName;
@Schema(description = "出入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "11084")
@ExcelProperty("出入库数量")
private BigDecimal count;
@ -101,4 +89,4 @@ public class ErpStockRecordRespVO {
@Schema(description = "出入库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("出入库时间")
private LocalDateTime recordTime;
}
}

@ -18,15 +18,9 @@ public class ErpStockPageReqVO extends PageParam {
@Schema(description = "仓库编号", example = "2802")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "产品分类", example = "2802")
private Long categoryId;
@Schema(description = "产品分类类型", example = "1")
private Integer categoryType;
@Schema(description = "id集合导出用")
private String ids;
}
}

@ -1,7 +1,5 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ -9,8 +7,6 @@ import lombok.Data;
import java.math.BigDecimal;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.PRODUCT_CATEGORY_TYPE;
@Schema(description = "管理后台 - ERP 库存 Response VO")
@Data
@ExcelIgnoreUnannotated
@ -26,24 +22,12 @@ public class ErpStockRespVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2802")
private Long warehouseId;
@Schema(description = "库区编号", example = "1")
private Long areaId;
@Schema(description = "库区名称", example = "A区")
@ExcelProperty("库区名称")
private String areaName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "21935")
@ExcelProperty("库存数量")
private BigDecimal count;
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11161")
private Long categoryId;
@Schema(description = "产品分类类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "产品分类类型", converter = DictConvert.class)
@DictFormat(PRODUCT_CATEGORY_TYPE)
private Integer categoryType;
// ========== 产品信息 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "苹果")
@ -68,4 +52,4 @@ public class ErpStockRespVO {
@ExcelProperty("仓库名称")
private String warehouseName;
}
}

@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.erp.controller.admin.warehousearea.vo.WarehouseAreaRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.warehouselocation.vo.WarehouseLocationRespVO;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
@ -12,7 +10,6 @@ import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 仓库 Response VO")
@Data
@ -23,7 +20,7 @@ public class ErpWarehouseRespVO {
@ExcelProperty("仓库编号")
private Long id;
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "成品仓")
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("仓库名称")
private String name;
@ -35,11 +32,11 @@ public class ErpWarehouseRespVO {
@ExcelProperty("排序")
private Long sort;
@Schema(description = "备注", example = "主仓")
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "负责人", example = "张三")
@Schema(description = "负责人", example = "芋头")
@ExcelProperty("负责人")
private String principal;
@ -60,23 +57,8 @@ public class ErpWarehouseRespVO {
@ExcelProperty("是否默认")
private Boolean defaultStatus;
@Schema(description = "库区数量", example = "2")
@ExcelProperty("库区数量")
private Long areaCount;
@Schema(description = "库位数量", example = "10")
@ExcelProperty("库位数量")
private Long locationCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "库区列表")
private List<WarehouseAreaRespVO> areaList;
@Schema(description = "库位列表")
private List<WarehouseLocationRespVO> locationList;
}
}

@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse;
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.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 仓库新增/修改 Request VO")
@ -16,7 +16,7 @@ public class ErpWarehouseSaveReqVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11614")
private Long id;
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "成品仓")
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "仓库名称不能为空")
private String name;
@ -27,10 +27,10 @@ public class ErpWarehouseSaveReqVO {
@NotNull(message = "排序不能为空")
private Long sort;
@Schema(description = "备注", example = "主仓")
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "负责人", example = "张三")
@Schema(description = "负责人", example = "芋头")
private String principal;
@Schema(description = "仓储费,单位:元", example = "13973")
@ -39,9 +39,9 @@ public class ErpWarehouseSaveReqVO {
@Schema(description = "搬运费,单位:元", example = "9903")
private BigDecimal truckagePrice;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "开启状态不能为空")
@InEnum(CommonStatusEnum.class)
private Integer status;
}
}

@ -1,114 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehousearea;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import cn.iocoder.yudao.module.erp.controller.admin.warehousearea.vo.*;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehousearea.WarehouseAreaDO;
import cn.iocoder.yudao.module.erp.service.warehousearea.WarehouseAreaService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - ERP 库区信息")
@RestController
@RequestMapping("/erp/warehouse-area")
@Validated
public class WarehouseAreaController {
@Resource
private WarehouseAreaService warehouseAreaService;
@PostMapping("/create")
@Operation(summary = "创建ERP 库区信息")
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:create')")
public CommonResult<Long> createWarehouseArea(@Valid @RequestBody WarehouseAreaSaveReqVO createReqVO) {
return success(warehouseAreaService.createWarehouseArea(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新ERP 库区信息")
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:update')")
public CommonResult<Boolean> updateWarehouseArea(@Valid @RequestBody WarehouseAreaSaveReqVO updateReqVO) {
warehouseAreaService.updateWarehouseArea(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除ERP 库区信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:delete')")
public CommonResult<Boolean> deleteWarehouseArea(@RequestParam("id") Long id) {
warehouseAreaService.deleteWarehouseArea(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得ERP 库区信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:query')")
public CommonResult<WarehouseAreaRespVO> getWarehouseArea(@RequestParam("id") Long id) {
WarehouseAreaDO warehouseArea = warehouseAreaService.getWarehouseArea(id);
return success(BeanUtils.toBean(warehouseArea, WarehouseAreaRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得ERP 库区信息分页")
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:query')")
public CommonResult<PageResult<WarehouseAreaRespVO>> getWarehouseAreaPage(@Valid WarehouseAreaPageReqVO pageReqVO) {
PageResult<WarehouseAreaDO> pageResult = warehouseAreaService.getWarehouseAreaPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WarehouseAreaRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得库区精简列表", description = "只包含被开启的仓库库区,主要用于前端的下拉选项")
public CommonResult<List<WarehouseAreaRespVO>> getWarehouseSimpleList(@RequestParam(value = "warehouseId", required = false) Long warehouseId) {
List<WarehouseAreaDO> list = warehouseAreaService.getWarehouseListByStatusAndWarehouseId(CommonStatusEnum.ENABLE.getStatus(), warehouseId);
return success(convertList(list, area -> new WarehouseAreaRespVO()
.setId(area.getId())
.setWarehouseId(area.getWarehouseId())
.setAreaCode(area.getAreaCode())
.setAreaName(area.getAreaName())
.setStatus(area.getStatus())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP 库区信息 Excel")
@PreAuthorize("@ss.hasPermission('erp:warehouse-area:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportWarehouseAreaExcel(@Valid WarehouseAreaPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<WarehouseAreaDO> list = warehouseAreaService.getWarehouseAreaPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "ERP 库区信息.xls", "数据", WarehouseAreaRespVO.class,
BeanUtils.toBean(list, WarehouseAreaRespVO.class));
}
}

@ -1,41 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehousearea.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
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 = "管理后台 - ERP 库区信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehouseAreaPageReqVO extends PageParam {
@Schema(description = "所属仓库id", example = "19404")
private Long warehouseId;
@Schema(description = "库区编码")
private String areaCode;
@Schema(description = "库区名称", example = "赵六")
private String areaName;
@Schema(description = "面积(平方米)")
private BigDecimal areaSize;
@Schema(description = "库区描述", example = "你说的对")
private String description;
@Schema(description = "开启状态", example = "2")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,48 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehousearea.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - ERP 库区信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class WarehouseAreaRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1157")
@ExcelProperty("id")
private Long id;
@Schema(description = "所属仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19404")
@ExcelProperty("所属仓库id")
private Long warehouseId;
@Schema(description = "库区编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("库区编码")
private String areaCode;
@Schema(description = "库区名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("库区名称")
private String areaName;
@Schema(description = "面积(平方米)")
@ExcelProperty("面积(平方米)")
private BigDecimal areaSize;
@Schema(description = "库区描述", example = "你说的对")
@ExcelProperty("库区描述")
private String description;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("开启状态")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -1,38 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehousearea.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 库区信息新增/修改 Request VO")
@Data
public class WarehouseAreaSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1157")
private Long id;
@Schema(description = "所属仓库id", example = "19404")
private Long warehouseId;
@Schema(description = "库区编码", requiredMode = Schema.RequiredMode.REQUIRED)
// @NotEmpty(message = "库区编码不能为空")
private String areaCode;
@Schema(description = "库区名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "A区")
@NotEmpty(message = "库区名称不能为空")
private String areaName;
@Schema(description = "面积(平方米)")
private BigDecimal areaSize;
@Schema(description = "库区描述", example = "常温区")
private String description;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "开启状态不能为空")
private Integer status;
}

@ -1,110 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehouselocation;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.erp.controller.admin.warehouselocation.vo.*;
import cn.iocoder.yudao.module.erp.dal.dataobject.warehouselocation.WarehouseLocationDO;
import cn.iocoder.yudao.module.erp.service.warehouselocation.WarehouseLocationService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - ERP 库位信息")
@RestController
@RequestMapping("/erp/warehouse-location")
@Validated
public class WarehouseLocationController {
@Resource
private WarehouseLocationService warehouseLocationService;
@PostMapping("/create")
@Operation(summary = "创建ERP 库位信息")
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:create')")
public CommonResult<Long> createWarehouseLocation(@Valid @RequestBody WarehouseLocationSaveReqVO createReqVO) {
return success(warehouseLocationService.createWarehouseLocation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新ERP 库位信息")
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:update')")
public CommonResult<Boolean> updateWarehouseLocation(@Valid @RequestBody WarehouseLocationSaveReqVO updateReqVO) {
warehouseLocationService.updateWarehouseLocation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除ERP 库位信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:delete')")
public CommonResult<Boolean> deleteWarehouseLocation(@RequestParam("id") Long id) {
warehouseLocationService.deleteWarehouseLocation(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得ERP 库位信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:query')")
public CommonResult<WarehouseLocationRespVO> getWarehouseLocation(@RequestParam("id") Long id) {
WarehouseLocationDO warehouseLocation = warehouseLocationService.getWarehouseLocation(id);
return success(BeanUtils.toBean(warehouseLocation, WarehouseLocationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得ERP 库位信息分页")
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:query')")
public CommonResult<PageResult<WarehouseLocationRespVO>> getWarehouseLocationPage(@Valid WarehouseLocationPageReqVO pageReqVO) {
PageResult<WarehouseLocationDO> pageResult = warehouseLocationService.getWarehouseLocationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WarehouseLocationRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得ERP 库位信息精简列表", description = "只包含已启用的库位,主要用于前端下拉选项")
public CommonResult<List<WarehouseLocationRespVO>> getWarehouseLocationSimpleList() {
List<WarehouseLocationDO> list = warehouseLocationService.getWarehouseLocationListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, item -> new WarehouseLocationRespVO()
.setId(item.getId())
.setWarehouseId(item.getWarehouseId())
.setAreaId(item.getAreaId())
.setCode(item.getCode())
.setName(item.getName())
.setStatus(item.getStatus())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP 库位信息 Excel")
@PreAuthorize("@ss.hasPermission('erp:warehouse-location:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportWarehouseLocationExcel(@Valid WarehouseLocationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<WarehouseLocationDO> list = warehouseLocationService.getWarehouseLocationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "ERP 库位信息.xls", "数据", WarehouseLocationRespVO.class,
BeanUtils.toBean(list, WarehouseLocationRespVO.class));
}
}

@ -1,59 +0,0 @@
package cn.iocoder.yudao.module.erp.controller.admin.warehouselocation.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
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 = "管理后台 - ERP 库位信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehouseLocationPageReqVO extends PageParam {
@Schema(description = "所属仓库ID", example = "19287")
private Long warehouseId;
@Schema(description = "所属库区ID", example = "513")
private Long areaId;
@Schema(description = "库位编码")
private String code;
@Schema(description = "库位名称", example = "张三")
private String name;
@Schema(description = "面积")
private BigDecimal areaSize;
@Schema(description = "最大载重量")
private BigDecimal maxLoadWeight;
@Schema(description = "库位位置X")
private Integer positionX;
@Schema(description = "库位位置Y")
private Integer positionY;
@Schema(description = "库位位置Z")
private Integer positionZ;
@Schema(description = "是否允许产品混放")
private Boolean allowProductMix;
@Schema(description = "是否允许批次混放")
private Boolean allowBatchMix;
@Schema(description = "开启状态", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

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

Loading…
Cancel
Save