新增获取优化排单参数 (未完成)接口

This commit is contained in:
yangsb
2024-03-27 16:22:53 +08:00
parent 3c3453f985
commit e462c496af
24 changed files with 684 additions and 5 deletions
@@ -125,6 +125,10 @@
<groupId>com.cf.imes</groupId> <groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-data-permission</artifactId> <artifactId>cf-spring-boot-starter-biz-data-permission</artifactId>
</dependency> </dependency>
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<!-- 设置构建的 jar 包名 --> <!-- 设置构建的 jar 包名 -->
@@ -1,10 +1,13 @@
package com.cf.imes.module.executor.controller.admin.plan; package com.cf.imes.module.executor.controller.admin.plan;
import cn.hutool.core.util.RandomUtil;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.plan.vo.*; import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService; import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
import com.cf.imes.module.executor.util.RandomUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@@ -76,9 +79,12 @@ public class OptimizePlanController {
@GetMapping("/getOptimizePlanParam") @GetMapping("/getOptimizePlanParam")
@Operation(summary = "获取优化排单参数 (未完成)") @Operation(summary = "获取优化排单参数 (未完成)")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')") @PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<OptimizeParamRespVO> getOptimizePlanParam (@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) { @Parameter(name = "planId", description = "排单id", required = false)
public CommonResult<OptimizeParamRespVO> getOptimizePlanParam (@RequestParam (required = false) Long planId) {
OptimizeParamRespVO data = RandomUtils.randomPojo(OptimizeParamRespVO.class);
return CommonResult.success(data);
//todo //todo
return CommonResult.success(optimizePlanService.getOptimizePlanParam(planId)); //return CommonResult.success(optimizePlanService.getOptimizePlanParam(planId));
} }
} }
@@ -0,0 +1,52 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class BlockPlaceMessage {
@Schema(description = "zzInfo")
private String zzInfo;
@Schema(description = "Bi")
private Integer bi;
@Schema(description = "Bo")
private Long bo;
@Schema(description = "X")
private Double x;
@Schema(description = "Y")
private Double y;
@Schema(description = "Pi")
private Double pi;
@Schema(description = "Ps")
private Double ps;
@Schema(description = "Ci")
private Double ci;
@Schema(description = "Ca")
private Double ca;
@Schema(description = "CP")
private Double cP;
private Boolean iA;
private Boolean iO;
@Schema(description = "Dh")
private Boolean dh;
@Schema(description = "Dm")
private Boolean dm;
@Schema(description = "OF")
private Integer oF;
private Integer type;
private List<Point> pointList;
@Schema(description = "OrgSizeOutOff")
private OrgSizeOutOff orgSizeOutOff;
@Schema(description = "SizeOutOff")
private SizeOutOff sizeOutOff;
@Schema(description = "PlaceOffX")
private Double placeOffX;
@Schema(description = "PlaceOffY")
private Double placeOffY;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:58
*/
@Data
public class HoleDetail {
private Integer holeId;
private Integer holeType;// 请定义HoleType枚举类型
private Integer face; // 请定义FaceType枚举类型
private Integer pointX;
private Integer pointY;
private Integer pointZ;
private Integer radius;
private Integer depth;
private Integer endPoint;
private Integer pointX2;
private Integer pointY2;
private Integer angle;
}
@@ -0,0 +1,87 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author Beal
*/
@Data
public class Metrial {
@Schema(description = "生产单id")
private String orderId;
@Schema(description = "商品id")
private Integer goodsID;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "Specification")
private String specification;
@Schema(description = "材质")
private String metrial;
@Schema(description = "颜色")
private String color;
@Schema(description = "Brank")
private String brank;
@Schema(description = "")
private Integer width;
@Schema(description = "")
private Integer length;
@Schema(description = "")
private Integer thickness;
@Schema(description = "Border")
private Integer border;
@Schema(description = "CutDia")
private Integer cutDia;
@Schema(description = "CutGap")
private Integer cutGap;
@Schema(description = "IsSorted")
private Boolean isSorted;
@Schema(description = "BoardCount")
private Integer boardCount;
@Schema(description = "MinBoardID")
private Integer minBoardID;
@Schema(description = "MaxBoardID")
private Integer maxBoardID;
@Schema(description = "AvgLyr_All")
private Double avgLyr_All;
@Schema(description = "AvgLyr_NoLastOne")
private Integer avgLyr_NoLastOne;
@Schema(description = "Lyr_LastOne")
private Double lyr_LastOne;
@Schema(description = "organId")
private Integer organId;
@Schema(description = "usedBoardMessageList")
private List<UsedBoardMessage> usedBoardMessageList;
@Schema(description = "blockPlaceMessageList")
private List<BlockPlaceMessage> blockPlaceMessageList;
@Schema(description = "State")
private Integer state;
@Schema(description = "HasWave")
private Boolean hasWave;
@Schema(description = "OrgWidth")
private Integer orgWidth;
@Schema(description = "OrgLength")
private Integer orgLength;
@Schema(description = "BoardCount_Remain")
private Integer boardCount_Remain;
@Schema(description = "RemainBoardMessage")
private String remainBoardMessage;
@Schema(description = "PreCutValue")
private Integer preCutValue;
@Schema(description = "ScrapBoardList")
private List<?> scrapBoardList;
@Schema(description = "HelpCut")
private Boolean helpCut;
@Schema(description = "SameKnifeHelpCutGap")
private Integer sameKnifeHelpCutGap;
@Schema(description = "CutKnifeID")
private Integer cutKnifeID;
@Schema(description = "HelpKnifeID")
private Integer helpKnifeID;
@Schema(description = "LastSaveDate")
private Date lastSaveDate;
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import com.cf.imes.module.executor.util.deviseData.IOriginModelingData;
import lombok.Data;
import java.util.List;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:53
*/
@Data
public class ModelDetail {
private Integer modelId;
private Integer lineId;
private Integer face;
private String knifeName;
private Integer knifeRadius;
private Integer depth;
private IOriginModelingData originModeling;
private List<PointList> pointList;
private List<OffSetList> offSetList;
}
@@ -0,0 +1,16 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:51
*/
public class OffSetList {
private String name;
private Integer face;// 请定义FaceType枚举类型
private Integer value;
private Integer radius;
private Integer deep;
private Integer angle;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 17:00
*/
@Data
public class OrgPointDetail {
@Schema(description = "点id")
private Long pointId;
@Schema(description = "x")
private Double pointX;
@Schema(description = "y")
private Double pointY;
@Schema(description = "曲线")
private Double curve;
@Schema(description = "密封尺寸")
private Double sealSize;
}
@@ -0,0 +1,19 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class OrgSizeOutOff {
private Integer left;
private Integer right;
private Integer upper;
private Integer under;
private Integer width;
private Integer length;
private Integer outWidth;
private Integer outLength;
private Boolean hasDone;
}
@@ -0,0 +1,12 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class Point {
private Double x;
private Double y;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:57
*/
@Data
public class PointDetail {
@Schema(description = "点id")
private Long pointId;
@Schema(description = "x")
private Double pointX;
@Schema(description = "y")
private Double pointY;
@Schema(description = "曲线")
private Double curve;
@Schema(description = "密封尺寸")
private Double sealSize;
}
@@ -0,0 +1,16 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:49
*/
public class PointList {
private Integer lineId;
private Integer pointId;
private Integer pointX;
private Integer pointY;
private Integer radius;
private Integer depth;
private Integer curve;
}
@@ -0,0 +1,30 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class ScrapBlock {
@Schema(description = "ScrapNo")
private Long scrapNo;
@Schema(description = "IsUnRegular")
private Boolean isUnRegular;
@Schema(description = "IsOverlap")
private Boolean isOverlap;
private Boolean isInstored;
private List<Point> points;
private String remark;
@Schema(description = "PlaceX")
private Double placeX;
@Schema(description = "PlaceY")
private Double placeY;
@Schema(description = "PlaceWidth")
private Double placeWidth;
@Schema(description = "PlaceLength")
private Double placeLength;
}
@@ -0,0 +1,13 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class ScrapPt {
private Double x;
private Double y;
private Double bul;
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 18:02
*/
@Data
public class SideHoleDetail {
private Integer holeID;
private Integer holeType; // 请定义HoleType枚举类型
private Integer face; // 请定义FaceType枚举类型
private Integer pointX;
private Integer pointY;
private Integer pointZ;
private Integer radius;
private Integer depth;
private String endPoint;
private Integer pointX2;
private Integer pointY2;
private Integer angle;
}
@@ -0,0 +1,25 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import com.cf.imes.module.executor.util.deviseData.IOriginModelingData;
import lombok.Data;
import java.util.List;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 17:59
*/
@Data
public class SideModelDetail {
private Integer modelId;
private Integer lineId;
private int face;
private String knifeName;
private Integer knifeRadius;
private Integer depth;
private IOriginModelingData originModeling;
private List<PointList> pointList;
private List<OffSetList> offSetList;
}
@@ -0,0 +1,19 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class SizeOutOff {
private Double left;
private Double right;
private Double upper;
private Double under;
private Double width;
private Double length;
private Double outWidth;
private Double outLength;
private Boolean hasDone;
}
@@ -0,0 +1,37 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class UsedBoardMessage {
@Schema(description = "Bi")
private Integer bi;
@Schema(description = "W")
private Integer w;
@Schema(description = "L")
private Integer l;
@Schema(description = "Si")
private Integer si;
@Schema(description = "So")
private String so;
@Schema(description = "No")
private String no;
@Schema(description = "RM")
private String rM;
@Schema(description = "LK")
private Boolean lK;
private List<ScrapPt> scrapPtList;
private List<ScrapBlock> scrapBlocks;
@Schema(description = "LE")
private Boolean lE;
@Schema(description = "RE")
private Boolean rE;
@Schema(description = "WLs")
private List<String> wLs;
}
@@ -1,6 +1,7 @@
package com.cf.imes.module.executor.controller.admin.plan.vo; package com.cf.imes.module.executor.controller.admin.plan.vo;
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO; import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO;
import com.cf.imes.module.executor.controller.admin.plan.dto.Metrial;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@@ -47,13 +48,16 @@ public class OptimizeParamRespVO {
@Schema(description = "生产时间") @Schema(description = "生产时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date produceTime; private Date produceTime;
@Schema(description = "生产单列表") @Schema(description = "生产单列表")
private List<OrderResp> orderList; private List<OrderResp> orderList;
@Schema(description = "MetrialList")
private List<Metrial> metrialList;
@Schema(description = "商品列表") @Schema(description = "商品列表")
private List<GoodsRespVO> goodsList; private List<GoodsRespVO> goodsList;
@Schema(description = "小板列表") @Schema(description = "小板列表")
private List<PlateRespVO> plateList; private List<PlateRespVO> plateList;
@Schema(description = "区域删除")
private Boolean areaDeleted;
@Schema(description = "源id")
private Long sourceNo;
} }
@@ -0,0 +1,12 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class KaiLiaoSize {
private Double width;
private Double height;
}
@@ -0,0 +1,13 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class OffSet {
private Integer x;
private Integer y;
private Integer z;
}
@@ -0,0 +1,46 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import com.cf.imes.module.executor.controller.admin.plan.dto.*;
import com.cf.imes.module.executor.controller.admin.plan.vo.PlanOptimizeDataDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author Beal
*/
@Data
public class PlateDetailVO {
@Schema(description = "生产单id")
private Long orderId;
@Schema(description = "点详情列表")
private List<PointDetail> pointDetailList;
@Schema(description = "孔详情列表")
private List<HoleDetail> holeDetailList;
@Schema(description = "模型详情列表")
private List<ModelDetail> modelDetailList;
@Schema(description = "偏移量")
private OffSet offSet;
@Schema(description = "是否新版本")
private Boolean newVersion;
@Schema(description = "org点详情列表")
private List<OrgPointDetail> orgPointDetailList;
@Schema(description = "开料尺寸")
private KaiLiaoSize kaiLiaoSize;
@Schema(description = "边模型详情列表")
private List<SideModelDetail> sideModelDetails;
@Schema(description = "边孔详情")
private List<SideHoleDetail> sideHoleDetailList;
}
@@ -9,6 +9,9 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*; import com.alibaba.excel.annotation.*;
/**
* @author Beal
*/
@Schema(description = "管理后台 - 生产单板件 Response VO") @Schema(description = "管理后台 - 生产单板件 Response VO")
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
@@ -158,4 +161,8 @@ public class PlateRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "小板详情列表")
private List<PlateDetailVO> plateDetailList;
} }
@@ -0,0 +1,137 @@
package com.cf.imes.module.executor.util;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.cf.imes.framework.common.enums.CommonStatusEnum;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
import java.lang.reflect.Type;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 随机工具类
*
* @author 晨丰科技
*/
public class RandomUtils {
private static final int RANDOM_STRING_LENGTH = 10;
private static final int TINYINT_MAX = 127;
private static final int RANDOM_DATE_MAX = 30;
private static final int RANDOM_COLLECTION_LENGTH = 5;
private static final PodamFactory PODAM_FACTORY = new PodamFactoryImpl();
static {
// 字符串
PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(String.class,
(dataProviderStrategy, attributeMetadata, map) -> randomString());
// Integer
PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Integer.class, (dataProviderStrategy, attributeMetadata, map) -> {
// 如果是 status 的字段,返回 0 或 1
if ("status".equals(attributeMetadata.getAttributeName())) {
return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
}
// 如果是 type、status 结尾的字段,返回 tinyint 范围
if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
"type", "status", "category", "scope", "result")) {
return RandomUtil.randomInt(0, TINYINT_MAX + 1);
}
return RandomUtil.randomInt();
});
// LocalDateTime
PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(LocalDateTime.class,
(dataProviderStrategy, attributeMetadata, map) -> randomLocalDateTime());
// Boolean
PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Boolean.class, (dataProviderStrategy, attributeMetadata, map) -> {
// 如果是 deleted 的字段,返回非删除
if ("deleted".equals(attributeMetadata.getAttributeName())) {
return false;
}
return RandomUtil.randomBoolean();
});
}
public static String randomString() {
return RandomUtil.randomString(RANDOM_STRING_LENGTH);
}
public static Long randomLongId() {
return RandomUtil.randomLong(0, Long.MAX_VALUE);
}
public static Integer randomInteger() {
return RandomUtil.randomInt(0, Integer.MAX_VALUE);
}
public static Date randomDate() {
return RandomUtil.randomDay(0, RANDOM_DATE_MAX);
}
public static LocalDateTime randomLocalDateTime() {
// 设置 Nano 为零的原因,避免 MySQL、H2 存储不到时间戳
return LocalDateTimeUtil.of(randomDate()).withNano(0);
}
public static Short randomShort() {
return (short) RandomUtil.randomInt(0, Short.MAX_VALUE);
}
public static <T> Set<T> randomSet(Class<T> clazz) {
return Stream.iterate(0, i -> i).limit(RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH))
.map(i -> randomPojo(clazz)).collect(Collectors.toSet());
}
public static Integer randomCommonStatus() {
return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
}
public static String randomEmail() {
return randomString() + "@qq.com";
}
public static String randomURL() {
return "https://www.cf.com/" + randomString();
}
@SafeVarargs
public static <T> T randomPojo(Class<T> clazz, Consumer<T>... consumers) {
T pojo = PODAM_FACTORY.manufacturePojo(clazz);
// 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理
if (ArrayUtil.isNotEmpty(consumers)) {
Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo));
}
return pojo;
}
@SafeVarargs
public static <T> T randomPojo(Class<T> clazz, Type type, Consumer<T>... consumers) {
T pojo = PODAM_FACTORY.manufacturePojo(clazz, type);
// 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理
if (ArrayUtil.isNotEmpty(consumers)) {
Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo));
}
return pojo;
}
@SafeVarargs
public static <T> List<T> randomPojoList(Class<T> clazz, Consumer<T>... consumers) {
int size = RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH);
return Stream.iterate(0, i -> i).limit(size).map(o -> randomPojo(clazz, consumers))
.collect(Collectors.toList());
}
}