自定义板编号生成功能实现

This commit is contained in:
gaoqr
2024-11-27 17:31:42 +08:00
parent 1ea586b316
commit 137c1a0485
28 changed files with 1646 additions and 158 deletions
@@ -1,12 +1,14 @@
package com.cf.imes.module.system.api.customplateno;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.customplateno.dto.CustomPlateNoSeqRespDTO;
import com.cf.imes.module.system.api.customplateno.dto.CustomPlateNoSeqDTO;
import com.cf.imes.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
@@ -22,5 +24,9 @@ public interface CustomPlateNoSeqApi {
@GetMapping(PREFIX + "/organ")
@Operation(summary = "获取组织下自定义版编号序号")
CommonResult<CustomPlateNoSeqRespDTO> getOrgCustomPlateNoSeq();
CommonResult<CustomPlateNoSeqDTO> getOrgCustomPlateNoSeq();
@PostMapping(PREFIX + "/organ")
@Operation(summary = "更新组织下自定义版编号序号")
CommonResult<Boolean> modifyOrgCustomPlateNoSeq(@RequestBody CustomPlateNoSeqDTO customPlateNoSeqDTO);
}
@@ -15,7 +15,7 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CustomPlateNoSeqRespDTO implements Serializable {
public class CustomPlateNoSeqDTO implements Serializable {
private static final long serialVersionUID = -3415615478757941611L;
private Long id;
@@ -48,15 +48,15 @@ public class CustomPlateNoSeqRespDTO implements Serializable {
/**
* 上次年
*/
private int lastYear;
private Integer lastYear;
/**
* 上次月
*/
private int lastMonth;
private Integer lastMonth;
/**
* 上次天
*/
private int lastDay;
private Integer lastDay;
}
@@ -349,5 +349,5 @@ public class ErrorCodeConstants {
//=========== 系统配置 1-002-040-000 ============
public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "系统配置不存在");
public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "不支持的系统配置类型");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_BOARD_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "系统配置:自定义板编号保存解析失败,请检查配置规则或联系客服");
public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "系统配置:自定义板编号保存解析失败,请检查配置规则或联系客服");
}
@@ -0,0 +1,61 @@
package com.cf.imes.module.system.enums.customplateno;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 自定义板编号规则编码枚举
*
* @author Gqr
* @since 2024/11/11 15:20
*/
@AllArgsConstructor
public enum CustomPlateNoRuleCodeEnum {
/**
* 自定义
*/
CUSTOM("custom"),
/**
* 日期
*/
DATE("date"),
/**
* 生产单序号
*/
ORDERNO("orderNo"),
/**
* 板件序号
*/
PLATENO("plateNo"),
/**
* 房间号序号
*/
ROOMNO("roomNo"),
/**
* 柜体序号
*/
BODYNO("bodyNo");
@Getter
private String ruleCode;
/**
* 是否匹配
*
* @param ruleCode
* @return
*/
public static CustomPlateNoRuleCodeEnum match(String ruleCode) {
for (CustomPlateNoRuleCodeEnum codeEnum : CustomPlateNoRuleCodeEnum.values()) {
if (codeEnum.ruleCode.equals(ruleCode)) {
return codeEnum;
}
}
return null;
}
}
@@ -0,0 +1,70 @@
package com.cf.imes.module.system.enums.customplateno;
import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author Gqr
* @since 2024/11/19 9:40
*/
@AllArgsConstructor
public enum ResetModeEnum {
/**
* 不清零,累加
*/
ACCUMULATION(0),
/**
* 按位数
*/
DIGIT(1),
/**
* 按年
*/
YEAR(2),
/**
* 按月
*/
MONTH(3),
/**
* 按天
*/
DAY(4),
/**
* 按生产单
*/
ORDER(5),
/**
* 按房间
*/
ROOM(6),
/**
* 按柜体
*/
BODY(7);
@Getter
private int mode;
/**
* 根据mode获取对应枚举
*
* @param mode
* @return
*/
public static ResetModeEnum getByMode(int mode) {
for (ResetModeEnum modeEnum : ResetModeEnum.values()) {
if (ObjectUtil.equal(modeEnum.getMode(), mode)) {
return modeEnum;
}
}
return null;
}
}