生产单新增逻辑

This commit is contained in:
lym
2024-04-08 14:07:22 +08:00
106 changed files with 2069 additions and 955 deletions
@@ -129,6 +129,10 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>uk.co.jemos.podam</groupId>
<artifactId>podam</artifactId>
</dependency>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
@@ -4,7 +4,9 @@ import com.cf.imes.framework.common.pojo.CommonResult;
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.service.optimizeplan.OptimizePlanService;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
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.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -15,6 +17,7 @@ import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author there
@@ -74,11 +77,23 @@ public class OptimizePlanController {
}
@GetMapping("/getOptimizePlanParam")
@Operation(summary = "获取优化排单参数 (未完成)")
@Operation(summary = "获取优化排单参数 (mock)")
@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
return CommonResult.success(optimizePlanService.getOptimizePlanParam(planId));
OptimizeParamRespVO optimizePlanParam = optimizePlanService.getOptimizePlanParam(planId);
return CommonResult.success(optimizePlanParam);
}
@GetMapping("/getLabelDataSourceValue")
@Operation(summary = "获取标签数据源value")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<Map<String,Object>> getLabelDataSourceValue(@Valid GetSourceDataReq req ) {
return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req));
}
}
@@ -0,0 +1,56 @@
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 = "自增板信息")
private String zzInfo;
@Schema(description = "大板ID")
private Integer bi;
@Schema(description = "小板号")
private Long bo;
@Schema(description = "位置X")
private Double x;
@Schema(description = "位置Y")
private Double y;
@Schema(description = "优化顺序")
private Double pi;
@Schema(description = "放置方式")
private Double ps;
@Schema(description = "开料顺序")
private Double ci;
@Schema(description = "下刀点位置")
private Double ca;
@Schema(description = "下刀点")
private Double cp;
@Schema(description = "未移动")
private Boolean ia;
@Schema(description = "是否重叠isOverlap")
private Boolean io;
@Schema(description = "是否排钻")
private Boolean dh;
@Schema(description = "是否造型")
private Boolean dm;
@Schema(description = "超限板 标识")
private Integer of;
@Schema(description = "板类型 普通=0 自增=1 ,余料=2(失效)")
private Integer type;
@Schema(description = "点阵")
private List<Point> points;
@Schema(description = "原造型偏移信息")
private OldSizeOutOff olgSizeOutOff;
@Schema(description = "尺寸扩展信息(造型)")
private SizeOutOff sizeOutOff;
@Schema(description = "跟优化位置 漂移多少?X")
private Double placeOffX;
@Schema(description = "跟优化位置 漂移多少?Y")
private Double placeOffY;
}
@@ -0,0 +1,9 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import java.awt.Point;
import java.util.ArrayList;
public class ContourData {
private ArrayList<Point> pts; //点集(二维向量(x,y))
private Integer[] buls; //凸度(0直线段 >0逆时针方向 <0顺时针方向)
}
@@ -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 javax.swing.*;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:58
*/
@Data
public class HoleDetail {
private Integer holeId;
@Schema(description = "孔类别 大孔 = 0, 小孔 = 10, 木削 = 20, 木削大孔 = 21, 层板钉 = 30, 通孔 = 40, 造型孔 = -10, 连接杆 = 50")
private Integer holeType;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
@Schema(description = "坐标x")
private Integer pointX;
@Schema(description = "坐标y")
private Integer pointY;
@Schema(description = "坐标z")
private Integer pointZ;
@Schema(description = "半径")
private Integer radius;
@Schema(description = "深度")
private Integer depth;
@Schema(description = "起点坐标")
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 Material {
@Schema(description = "生产单id")
private String orderId;
@Schema(description = "商品id")
private Integer goodsId;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "规范")
private String specification;
@Schema(description = "材质")
private String metrial;
@Schema(description = "颜色")
private String color;
@Schema(description = "品牌")
private String brank;
@Schema(description = "")
private Integer width;
@Schema(description = "")
private Integer length;
@Schema(description = "")
private Integer thickness;
@Schema(description = "修边值")
private Integer border;
@Schema(description = "开料刀直径")
private Integer cutDia;
@Schema(description = "开料间隙")
private Integer cutGap;
@Schema(description = "IsSorted")
private Boolean isSorted;
@Schema(description = "大板数")
private Integer boardCount;
@Schema(description = "最小大板ID")
private Integer minBoardId;
@Schema(description = "最大大板ID")
private Integer maxBoardId;
@Schema(description = "平均利用率")
private Double avgLyr_All;
@Schema(description = "前N平均利用率")
private Integer avgLyr_NoLastOne;
@Schema(description = "尾张利用率")
private Double lyr_LastOne;
@Schema(description = "组织id")
private Integer organId;
@Schema(description = "使用板信息列表")
private List<UsedBoardMessage> usedBoardMessageList;
@Schema(description = "小板信息列表")
private List<BlockPlaceMessage> blockPlaceMessageList;
@Schema(description = "状态")
private Integer state;
@Schema(description = "有波纹")
private Boolean hasWave;
@Schema(description = "板材原宽")
private Integer orgWidth;
@Schema(description = "板材原长")
private Integer orgLength;
@Schema(description = "余料板数")
private Integer boardCountRemain;
@Schema(description = "余料板情况")
private String remainBoardMessage;
@Schema(description = "预洗值")
private Integer preCutValue;
@Schema(description = "废料板列表")
private List<ScrapBoard> scrapBoardList;
@Schema(description = "是否辅助开料")
private Boolean helpCut;
@Schema(description = "同刀辅助 厚度")
private Integer sameKnifeHelpCutGap;
@Schema(description = "开料刀ID")
private Integer cutKnifeID;
@Schema(description = "辅助刀ID")
private Integer helpKnifeID;
@Schema(description = "最后保存时间")
private Date lastSaveDate;
}
@@ -0,0 +1,32 @@
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;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:53
*/
@Data
public class ModelDetail {
@Schema(description = "造型ID")
private Integer modelId;
@Schema(description = "线ID")
private Integer lineId;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
@Schema(description = "刀号")
private String knifeName;
@Schema(description = "刀半径")
private Integer knifeRadius;
@Schema(description = "深度")
private Integer depth;
@Schema(description = "造型轮廓")
private OriginModelingData originModeling;
private List<ModelPoint> modelPoint;
private List<ModelOffSet> modelOffSet;
}
@@ -0,0 +1,19 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @projectName: cf_imes_server
* @author: 晨丰科技
* @date: 2024/3/22 16:51
*/
public class ModelOffSet {
private String name;
@Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30")
private Integer face;
private Integer value;
private Integer radius;
private Integer deep;
private Integer angle;
}
@@ -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 ModelPoint {
private Integer lineId;
private Integer pointId;
private Integer pointX;
private Integer pointY;
private Integer radius;
private Integer depth;
private Integer curve;
}
@@ -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 OldPointDetail {
@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,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author Beal
*/
@Data
public class OldSizeOutOff {
private Integer left;
private Integer right;
private Integer upper;
private Integer under;
@Schema(description = "板外扩宽")
private Integer width;
@Schema(description = "板外扩长")
private Integer length;
@Schema(description = "排版外扩宽")
private Integer outWidth;
@Schema(description = "排版外扩长")
private Integer outLength;
private Boolean hasDone;
}
@@ -0,0 +1,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Dictionary;
public class OriginModelingData {
@Schema(description = "轮郭")
private ContourData outline;
@Schema(description = "孔轮廓")
private Dictionary<String, ContourData> holes;
@Schema(description ="厚度" )
private Integer thickness;
@Schema(description = "0正面、1反面、2侧面")
private Integer dir;
@Schema(description = "刀半径")
private Integer knifeRadius;
@Schema(description = "槽加长")
private Integer addLen;
@Schema(description = "槽加宽")
private Integer addWidth;
@Schema(description = "槽加深")
private Integer addDepth;
}
@@ -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,31 @@
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 = "余料号")
private Long scrapNo;
@Schema(description = "是否异形")
private Boolean isUnRegular;
@Schema(description = "是否重叠")
private Boolean isOverlap;
@Schema(description = "是否已录入")
private Boolean isInstored;
private List<Point> points;
private String remark;
@Schema(description = "坐标X")
private Double placeX;
@Schema(description = "坐标Y")
private Double placeY;
@Schema(description = "开料宽")
private Double placeWidth;
@Schema(description = "开料长")
private Double placeLength;
}
@@ -0,0 +1,45 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Beal
*/
@NoArgsConstructor
@Data
public class ScrapBoard {
@Schema(description ="源排单号")
private String planCode;
@Schema(description ="使用排单号")
private String usedPlanCode;
@Schema(description ="ID")
private Long id;
@Schema(description ="排单ID")
private Long planId;
@Schema(description ="源排单ID")
private Long oldPlanId;
@Schema(description ="未使用 = 0, 已使用 = 1")
private Integer status;
@Schema(description ="正面 = 0, 正面右转 = 1, 正面后转 = 2, 正面左转 = 3, 反面 = 4, 反面右转 = 5, 反面后转 = 6, 反面左转 = 7")
private Integer placedStyle;
@Schema(description ="仓库")
private String storeHouse;
@Schema(description ="Count")
private Integer count;
@Schema(description ="备注")
private String remark;
@Schema(description ="OutLineJson")
private String outLineJson;
@Schema(description ="组织id")
private Integer organId;
@Schema(description ="原始多段线")
private List<ScrapPt> basePolyline;
@Schema(description ="放置的多段线")
private List<ScrapPt> placedPolyline;
private Boolean isUsed;
}
@@ -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,24 @@
package com.cf.imes.module.executor.controller.admin.plan.dto;
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 OriginModelingData originModeling;
private List<ModelPoint> modelPoint;
private List<ModelOffSet> modelOffSet;
}
@@ -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;
/**
* @author Beal
*/
@Data
public class SizeOutOff {
private Double left;
private Double right;
private Double upper;
private Double under;
@Schema(description = "板外扩宽")
private Double width;
@Schema(description = "板外扩长")
private Double length;
@Schema(description = "排版外扩 宽")
private Double outWidth;
@Schema(description = "排版外扩 长")
private Double outLength;
private Boolean hasDone;
}
@@ -0,0 +1,39 @@
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 = "大板id")
private Integer bi;
@Schema(description = "")
private Integer w;
@Schema(description = "长度")
private Integer l;
@Schema(description = "余料板ID")
private Integer si;
@Schema(description = "仓库号")
private String so;
@Schema(description = "余料板号,大板为空")
private String no;
@Schema(description = "RM")
private String rm;
@Schema(description = "是否锁定")
private Boolean lK;
@Schema(description = "余料母板")
private List<ScrapPt> scrapPtList;
@Schema(description = "余料空间")
private List<ScrapBlock> scrapBlocks;
@Schema(description = "左边不能加工区域,有造型")
private Boolean le;
@Schema(description = "右边不能加工区域,有造型")
private Boolean re;
@Schema(description = "WLs")
private List<String> wLs;
}
@@ -0,0 +1,29 @@
package com.cf.imes.module.executor.controller.admin.plan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author Beal
*/
@Data
@Schema(description = "")
public class GetSourceDataReq {
@Schema(description = "生产单id")
@NotNull(message = "生产单id不能空")
private Long orderId;
@Schema(description = "数据源id")
@NotNull(message = "数据源id不能空")
private Long dataSourceId;
@Schema(description = "排单id")
private Long planId;
@Schema(description = "包裹id")
private Long packageId;
}
@@ -1,12 +1,14 @@
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.plan.dto.Material;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@@ -17,6 +19,9 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT
* @author Beal
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OptimizeParamRespVO {
@Schema(description = "排单id")
private Long planId;
@@ -28,12 +33,11 @@ public class OptimizeParamRespVO {
private Integer type;
@Schema(description = "排单状态 0 新单,1 板材已申请,2 开料中,3 已开料")
private Integer status;
@Schema(description = "是否支付")
private Boolean isPay;
@Schema(description = "机台 ID")
private Long machineId;
@Schema(description = "计划时间")
private LocalDateTime planTime;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date planTime;
@Schema(description = "生产单号")
private String orderNos;
@Schema(description = "排单优化文件地址")
@@ -47,13 +51,16 @@ public class OptimizeParamRespVO {
@Schema(description = "生产时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date produceTime;
@Schema(description = "生产单列表")
private List<OrderResp> orderList;
@Schema(description = "商品列表")
private List<GoodsRespVO> goodsList;
@Schema(description = "大板使用信息列表")
private List<Material> materialList;
/*@Schema(description = "商品列表")
private List<GoodsRespVO> goodsList;*/
@Schema(description = "小板列表")
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,45 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import 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 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 = "原始点详情列表")
private List<OldPointDetail> olgPointDetailList;
@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 com.alibaba.excel.annotation.*;
/**
* @author Beal
*/
@Schema(description = "管理后台 - 生产单板件 Response VO")
@Data
@ExcelIgnoreUnannotated
@@ -163,4 +166,8 @@ public class PlateRespVO {
@Schema(description = "板材材质")
private String material;
@Schema(description = "小板详情列表")
private List<PlateDetailVO> plateDetailList;
}
@@ -17,6 +17,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 生产单表 order_{N} Mapper
@@ -88,4 +89,5 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
return selectList(wrapper);
}
Map<String, Object> selectDynamicSqlString(@Param("sqlStr") String sqlStr);
}
@@ -1,6 +1,7 @@
package com.cf.imes.module.executor.framework.rpc.config;
import com.cf.imes.module.infra.api.file.FileApi;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import com.cf.imes.module.system.api.machine.MachineApi;
import com.cf.imes.module.system.api.process.ProcessGroupApi;
import com.cf.imes.module.system.api.user.AdminUserApi;
@@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.optimizeplan;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import java.util.List;
import java.util.Map;
public interface OptimizePlanService {
List<PlateOptimize> getPlateListByPlanId(Long planId);
@@ -16,4 +17,6 @@ public interface OptimizePlanService {
OptimizeParamResVO getOptimizeParam(Long planId);
OptimizeParamRespVO getOptimizePlanParam(Long planId);
Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req);
}
@@ -5,7 +5,9 @@ import cn.hutool.core.util.StrUtil;
import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cf.imes.module.executor.controller.admin.plan.dto.Material;
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
@@ -15,12 +17,15 @@ import com.cf.imes.module.executor.dal.dataobject.remainplaten.OutlineDTO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.PointDTO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
import com.cf.imes.module.executor.util.RandomUtils;
import com.cf.imes.module.executor.util.RectangleChecker;
import com.cf.imes.module.infra.api.file.FileApi;
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.stereotype.Service;
@@ -58,6 +63,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
@Resource
private GoodsMapper goodsMapper;
@Resource
private DataSourceApi dataSourceApi;
@Resource
private OrderMapper orderMapper;
@Override
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
return planMapper.selectPlateListByPlanId(planId);
@@ -202,7 +213,38 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
@Override
public OptimizeParamRespVO getOptimizePlanParam(Long planId) {
return planMapper.getOptimizePlanParam(planId);
OptimizeParamRespVO optimizePlanParam = planMapper.getOptimizePlanParam(planId);
if(Objects.isNull(optimizePlanParam)) {
return RandomUtils.randomPojo(OptimizeParamRespVO.class);
}
//暂时先mock
ArrayList<Material> list = new ArrayList<>();
list.add(RandomUtils.randomPojo(Material.class));
list.add(RandomUtils.randomPojo(Material.class));
ArrayList<PlateDetailVO> plateDetailVOS = new ArrayList<>();
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
if( CollectionUtil.isNotEmpty(optimizePlanParam.getPlateList())) {
optimizePlanParam.getPlateList().get(0).setPlateDetailList(plateDetailVOS);
}
optimizePlanParam.setMaterialList(list);
return optimizePlanParam;
}
@Override
public Map<String, Object> getLabelDataSourceValue(GetSourceDataReq req) {
String sqlStr = dataSourceApi.getSqlById(req.getDataSourceId()).getCheckedData();
String sql = sqlStr.replace("#{orderId}", req.getOrderId() + "");
if(!Objects.isNull(req.getPackageId())) {
sql = sql.replace("#{packageId}", req.getPackageId() + "");
}
if(!Objects.isNull(req.getPlanId())) {
sql = sql.replace("#{planId}", req.getPlanId() + "");
}
return orderMapper.selectDynamicSqlString(sql);
}
@@ -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());
}
}
@@ -1,11 +1,13 @@
package com.cf.imes.module.executor.util.deviseData;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.swing.*;
import java.util.Dictionary;
/**
@@ -18,12 +20,20 @@ import java.util.Dictionary;
@Accessors(chain = false) // 设置 chain = false,避免生产单导入有问
public class IOriginModelingData {
private IContourData outline; //轮郭
private Dictionary<String, IContourData> holes; //孔轮廓
private Integer thickness; //厚度
private Integer dir; // 0正面、1反面、2侧面
private Integer knifeRadius; //刀半径
private Integer addLen; //槽加长
private Integer addWidth; //槽加宽
private Integer addDepth; //槽加深
@Schema(description = "轮郭")
private IContourData outline;
@Schema(description = "孔轮廓")
private Dictionary<String, IContourData> holes;
@Schema(description ="厚度" )
private Integer thickness;
@Schema(description = "0正面、1反面、2侧面")
private Integer dir;
@Schema(description = "刀半径")
private Integer knifeRadius;
@Schema(description = "槽加长")
private Integer addLen;
@Schema(description = "槽加宽")
private Integer addWidth;
@Schema(description = "槽加深")
private Integer addDepth;
}
@@ -12,4 +12,8 @@
${ew.customSqlSegment}
group by orderId, p.id
</select>
<select id="selectDynamicSqlString" resultType="java.util.Map">
${sqlStr}
</select>
</mapper>
@@ -20,25 +20,26 @@
</resultMap>
<resultMap id="optimizeMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO">
<result column="planId" property="planId"/>
<result column="plan_id" property="planId"/>
<result column="plan_no" property="planNo"/>
<result column="sort" property="sort"/>
<result column="type" property="type"/>
<result column="status" property="status"/>
<result column="is_pay" property="isPay"/>
<result column="op_type" property="type"/>
<result column="op_status" property="status"/>
<result column="machine_id" property="machineId"/>
<result column="plan_time" property="planTime"/>
<result column="remark" property="remark"/>
<collection property="goodsList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO"/>
<collection property="orderList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderResp"/>
<result column="op_remark" property="remark"/>
<result column="produce_time" property="produceTime" />
<result column="operator" property="operator"/>
<collection property="plateList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO" >
<result column="plateId" property="id"/>
<result column="plan_no" property="plateNo"/>
<result column="type" property="type"/>
<result column="goods_id" property="goodsId"/>
<result column="width" property="width"/>
<result column="height" property="height"/>
<result column="thickness" property="thickness"/>
<result column="opl_order_id" property="orderId"/>
<result column="opl_type" property="type"/>
<result column="opl_name" property="name"/>
<result column="opl_goods_id" property="goodsId"/>
<result column="opl_width" property="width"/>
<result column="opl_height" property="height"/>
<result column="opl_thickness" property="thickness"/>
<result column="split_width" property="splitWidth"/>
<result column="split_height" property="splitHeight"/>
<result column="split_thickness" property="splitThickness"/>
@@ -54,21 +55,58 @@
<result property="frontHoleCount" column="front_hole_count"/>
<result property="backHoleCount" column="back_hole_count"/>
<result property="sideHoleCount" column="side_hole_count"/>
<result property="frontModelCount" column="front_model_count"/>
<result property="backModelCount" column="back_model_count"/>
<result property="isDoor" column="is_door"/>
<result property="openDoorType" column="open_door_type"/>
<result property="offsetX" column="offset_x"/>
<result property="offsetY" column="offset_y"/>
<result property="isArcAcross" column="is_arc_across"/>
<result property="moduleTypeId" column="module_typeId"/>
<result property="filterType" column="filter_type"/>
<result property="moduleTypeId" column="module_type_id"/>
<result property="filterType" column="filter_type"/>
<result property="isCancel" column="is_cancel"/>
<result property="createTime" column="create_time"/>
<result property="remark" column="opl_remark"/>
<result property="createTime" column="opl_create_time"/>
</collection>
<collection property="orderList" javaType="java.util.List" ofType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderResp">
<result property="orderId" column="o_id"/>
<result property="type" column="o_type"/>
<result property="status" column="o_status"/>
<result property="dataType" column="data_type"/>
<result property="customOrderNo" column="custom_order_no"/>
<result column="customer" property="customer"/>
<result column="address" property="address"/>
<result column="phone_number" property="phoneNumber"/>
<result column="dealer" property="dealer"/>
<result column="dealer_phone_number" property="dealerPhoneNumber"/>
<result column="salesman" property="salesman"/>
<result column="splitter" property="splitter"/>
<result column="o_status" property="status"/>
<result column="delivery_date" property="deliveryDate"/>
<result column="o_remark" property="remark"/>
</collection>
</resultMap>
<select id="getOptimizePlanParam" resultMap="optimizeMap">
select op.id as plan_id, op.plan_no, op.type as op_type, op.status as op_status, op.machine_id, op.plan_time, op.produce_time, op.remark as op_remark, op.operator,
oi.order_id, opl.id as plateId, opl.order_id opl_order_id, opl.name opl_name, opl.plate_no, opl.type as opl_type, opl.goods_id as opl_goods_id, opl.width opl_width,
opl.height opl_height, opl.thickness as opl_thickness, opl.split_width, opl.split_height, opl.split_thickness, opl.seal_left, opl.seal_right,
opl.seal_up, opl.seal_down, opl.area, opl.texture, opl.hole_face, opl.hole_arrange, opl.unregular_point_count, opl.front_hole_count,
opl.back_hole_count, opl.side_hole_count, opl.front_model_count, opl.back_model_count, opl.is_door, opl.open_door_type, opl.offset_x, opl.offset_y,
opl.is_arc_across, opl.module_type_id, opl.filter_type, opl.remark opl_remark, opl.is_cancel, opl.create_time as opl_create_time,
o.id as o_id, o.type as o_type, o.data_type, o.status o_status, o.custom_order_no, o.customer,
o.address, o.phone_number, o.dealer, o.dealer_phone_number, o.salesman, o.splitter, o.remark as o_remark, o.delivery_date
from order_plan op
left JOIN order_plan_item opi on op.id = opi.plan_id
left join order_item oi on opi.item_id = oi.id
left join order_plate opl on oi.plate_id = opl.id
left join `order` o on oi.order_id = o.id
where op.id = #{planId}
</select>
<select id="selectPlateListByPlanId"
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
select a.goods_id, a.goods_name, a.material, a.color, a.width, a.height, a.thickness, count(b.id) as plateNum, d.*
@@ -81,14 +119,4 @@
</select>
<select id="getOptimizePlanParam" resultMap="optimizeMap">
select op.*, oi.order_id, opl.id as plateId, opl.*, og.*
from order_plan op
left JOIN order_plan_item opi on op.id = opi.plan_id
left join order_item oi on opi.item_id = oi.id
left join order_plate opl on oi.plate_id = opl.id
left join order_goods og on opl.goods_id = og.goods_id
where op.id = #{planId}
</select>
</mapper>