mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+2
@@ -60,4 +60,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode FILE_READ_ERR = new ErrorCode(1_002_029_012, "文件读取错误");
|
||||
ErrorCode FILE_ADD_ERR = new ErrorCode(1_002_029_012, "文件已经存在是否强制保存");
|
||||
ErrorCode FILE_UPLOAD_ERR = new ErrorCode(1_002_029_012, "文件内容为空");
|
||||
|
||||
ErrorCode SOURCE_NOT_EXITS_ERROR = new ErrorCode(1_002_029_013, "源数据查询失败");
|
||||
}
|
||||
|
||||
+14
-3
@@ -3,12 +3,10 @@ package com.cf.imes.module.executor.controller.admin.plan;
|
||||
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.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.SavePlanPlateResultReqVO;
|
||||
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.util.RandomUtils;
|
||||
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;
|
||||
@@ -109,4 +107,17 @@ public class OptimizePlanController {
|
||||
return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/saveOptimizationResults")
|
||||
@Operation(summary = "保存优化后的数据")
|
||||
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||
public CommonResult<Boolean> saveOptimizationResults(@Valid @RequestBody SavePlanPlateResultReqVO req ) {
|
||||
|
||||
optimizePlanService.saveOptimizationResults(req);
|
||||
|
||||
return CommonResult.success(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class PlanController {
|
||||
@GetMapping("getNotPlanOrderListPage")
|
||||
@Operation(summary = "获取未排单的板材生产单板材分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
||||
public CommonResult<List<OrderRespVOCopy>> getOrderPage(@Valid OrderPageReqVOCopy pageReqVO) {
|
||||
public CommonResult<PageResult<OrderRespVOCopy>> getOrderPage(@Valid OrderPageReqVOCopy pageReqVO) {
|
||||
return success(planService.getOrderPage(pageReqVO));
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -1,14 +1,12 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.bo;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizePlateDetialRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.OptimizeRemainPlate;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetialRespVO;
|
||||
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.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -28,8 +26,11 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class OrderSource {
|
||||
|
||||
@Schema(description = "优化时数据")
|
||||
private List<OptimizePlateDetialRespVO> optimizePlateDetialRespVO;
|
||||
@Schema(description = "优化后的大板数据")
|
||||
private List<OptimizeBoardModelDO> optimizeBoardModelDOS;
|
||||
|
||||
@Schema(description = "优化后的余料板数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<OptimizeRemainPlate> optimizeRemainPlates;
|
||||
|
||||
@Schema(description = "机台数据")
|
||||
private MachineDTO machineDTO;
|
||||
@@ -41,7 +42,7 @@ public class OrderSource {
|
||||
private List<OrderDO> orderList;
|
||||
|
||||
@Schema(description = "板材-大板列表")
|
||||
private List<GoodsDO> goodsList;
|
||||
private List<GoodsReqVO> goodsList;
|
||||
|
||||
@Schema(description = "小板列表")
|
||||
private List<PlateDetialRespVO> plateList;
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "优化后的余料板数据")
|
||||
public class OptimizeRemainPlate {
|
||||
|
||||
|
||||
@Schema(description = "余料板ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "源排单ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long initPlanId;
|
||||
|
||||
|
||||
@Schema(description = "排单ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long planId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "状态(未使用 = 0, 已使用 = 1)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer status;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsName;
|
||||
|
||||
|
||||
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String material;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String color;
|
||||
|
||||
|
||||
@Schema(description = "宽", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal width;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "长", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal length;
|
||||
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String brand;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "排单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String planCode;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer count;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal thickness;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "轮廓", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String outLineJson;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String remark;
|
||||
|
||||
|
||||
@Schema(description = "排版样式", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer placeStyle;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||
|
||||
@Data
|
||||
@Schema(description = "优化后的生产单数据")
|
||||
public class SaveOrderReqVO {
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "自定义单号")
|
||||
private String customOrderNo;
|
||||
|
||||
@Schema(description = "客户")
|
||||
private String customer;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "客户电话")
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "经销商")
|
||||
private String dealer;
|
||||
|
||||
@Schema(description = "经销商电话")
|
||||
private String dealerPhoneNumber;
|
||||
|
||||
@Schema(description = "业务员")
|
||||
private String salesman;
|
||||
|
||||
@Schema(description = "拆单员")
|
||||
private String splitter;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "交付日期")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||
private Date deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "生产单排序号")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.saveOptimize;
|
||||
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetialRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SavePlanPlateResultReqVO {
|
||||
|
||||
|
||||
// @Schema(description = "优化后的生产单数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// private List<OrderDO> orderList;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化后的大板列表数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<OptimizeBoardModelDO> optimizeBoardModelDOS;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化后的余料板数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<OptimizeRemainPlate> optimizeRemainPlates;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化后的小板列表数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<PlateDetialRespVO> plateList;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化后新增的小板ID")
|
||||
private List<Long> addPlateIds;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "优化后删除的小板ID")
|
||||
private List<Long> deletePlateIds;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单商品表")
|
||||
@Data
|
||||
public class GoodsReqVO {
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4109")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "余料板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4109")
|
||||
private Long remainId;
|
||||
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12114")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "设计端商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "832")
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹路")
|
||||
private Integer texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "7305")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String creator;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "更新人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String updater;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] updateTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 优化时对应的数据")
|
||||
@Data
|
||||
public class OptimizePlateDetialRespVO {
|
||||
|
||||
@Schema(description = "大板ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long boardId;
|
||||
|
||||
@Schema(description = "大板名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String plateName;
|
||||
|
||||
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String color;
|
||||
|
||||
@Schema(description = "是否有纹路", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean hasTexture;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "小板数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long plateNum;
|
||||
|
||||
@Schema(description = "大板数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long boardNum;
|
||||
|
||||
@Schema(description = "余料板数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String remainPlateNum;
|
||||
|
||||
@Schema(description = "前N", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double topN;
|
||||
|
||||
@Schema(description = "最后", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double eventually;
|
||||
|
||||
@Schema(description = "开料刀", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String knifeName;
|
||||
|
||||
@Schema(description = "尺寸规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String spec;
|
||||
}
|
||||
+8
-8
@@ -41,16 +41,16 @@ public class OrderRespVOCopy {
|
||||
private int num;
|
||||
@Schema(description = "平方")
|
||||
private BigDecimal area = new BigDecimal("0");
|
||||
@Schema(description = "商品id")
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
// @Schema(description = "商品id")
|
||||
// private String goodsId;
|
||||
// @Schema(description = "商品名称")
|
||||
// private String goodsName;
|
||||
|
||||
@Schema(description = "订单对应的板件的信息")
|
||||
private List<PlatePage> platePages;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
private String color;
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
private String material;
|
||||
// @Schema(description = "颜色")
|
||||
// private String color;
|
||||
// @Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
// private String material;
|
||||
}
|
||||
+12
-1
@@ -14,16 +14,23 @@ public class PlateDetialRespVO {
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "房间ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long roomId;
|
||||
|
||||
@Schema(description = "房间名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String roomName;
|
||||
|
||||
|
||||
@Schema(description = "柜体ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long bodyId;
|
||||
|
||||
|
||||
@Schema(description = "柜体名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bodyName;
|
||||
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String orderId;
|
||||
private Long orderId;
|
||||
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@@ -166,6 +173,10 @@ public class PlateDetialRespVO {
|
||||
private Integer type;
|
||||
|
||||
|
||||
@Schema(description = "加工组ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long processGroupId;
|
||||
|
||||
|
||||
@Schema(description = "加工组名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String processGroupName;
|
||||
|
||||
|
||||
+2
-2
@@ -11,6 +11,6 @@ import lombok.Data;
|
||||
public class PlateReqPageVO extends PageParam {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private String goodsId;
|
||||
// @Schema(description = "商品id")
|
||||
// private String goodsId;
|
||||
}
|
||||
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.goods;
|
||||
|
||||
|
||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "优化后的大板信息")
|
||||
public class OptimizeBoardModelDO extends ESDocument {
|
||||
|
||||
@Schema(description = "排单ID")
|
||||
private Long planId;
|
||||
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
|
||||
@Schema(description = "大板原长")
|
||||
private BigDecimal orgLength;
|
||||
@Schema(description = "大板原宽")
|
||||
private BigDecimal orgWidth;
|
||||
|
||||
|
||||
@Schema(description = "大板开料长")
|
||||
private BigDecimal length;
|
||||
@Schema(description = "大板开料宽")
|
||||
private BigDecimal width;
|
||||
@Schema(description = "大板厚度")
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "修边值")
|
||||
private BigDecimal cutBorder;
|
||||
|
||||
|
||||
@Schema(description = "开料刀直径")
|
||||
private BigDecimal diameter;
|
||||
|
||||
|
||||
@Schema(description = "开料刀路间隙")
|
||||
private BigDecimal cutKnifeGap;
|
||||
|
||||
|
||||
@Schema(description = "预铣值")
|
||||
private BigDecimal preMillingSize;
|
||||
|
||||
|
||||
@Schema(description = "是否辅助开料")
|
||||
private Boolean isHelpCut;
|
||||
|
||||
|
||||
@Schema(description = "同刀辅助开料偏移")
|
||||
private BigDecimal helpCutGap;
|
||||
|
||||
|
||||
@Schema(description = "开料刀ID")
|
||||
private Integer cutKnifeId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "辅助刀ID")
|
||||
private Integer helpKnifeId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "是否已优化")
|
||||
private Boolean isOptimized;
|
||||
|
||||
|
||||
@Schema(description = "大板数")
|
||||
private Integer boardCount;
|
||||
|
||||
|
||||
@Schema(description = "余料板数")
|
||||
private Integer remainBoardCount;
|
||||
|
||||
|
||||
@Schema(description = "最小板号")
|
||||
private Integer minBoardId;
|
||||
|
||||
|
||||
@Schema(description = "最大板号")
|
||||
private Integer maxBoardId;
|
||||
|
||||
|
||||
@Schema(description = "总平均利用率")
|
||||
private BigDecimal avgUsageRateAll;
|
||||
|
||||
|
||||
@Schema(description = "前N块板(不包含最后一块板)的平均利用率")
|
||||
private BigDecimal avgUsageRateExcludeLastBoard;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "最后一块板的利用率")
|
||||
private BigDecimal usageRateLastBoard;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "使用大板情况--大板优化数据")
|
||||
private String usedBoardInfo;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "小板排版情况--小板优化数据")
|
||||
private String blockPlaceInfo;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "余料板排版情况--余料板优化数据")
|
||||
private String remainBoardInfo;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+21
-4
@@ -1,8 +1,6 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.remainplaten;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
@@ -91,6 +89,25 @@ public class RemainPlateDO extends BaseDO {
|
||||
/**
|
||||
* 轮廊数据,Json 串
|
||||
*/
|
||||
private String outline;
|
||||
private String outLineJson;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long organId;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为开料添加,0否,1是
|
||||
*/
|
||||
private Boolean isCutting;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为开料添加,0否,1是
|
||||
*/
|
||||
private Integer useType;
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -5,9 +5,11 @@ import java.util.*;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.cf.imes.module.executor.controller.admin.goods.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 生产单商品 Mapper
|
||||
@@ -36,4 +38,10 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
.orderByDesc(GoodsDO::getId));
|
||||
}
|
||||
|
||||
|
||||
List<GoodsReqVO> selectGoodsList(@Param("orderId") Long orderId);
|
||||
|
||||
|
||||
List<GoodsReqVO> selectGoodsListByOrderIds(@Param("orderIds") List<Long> orderIds);
|
||||
|
||||
}
|
||||
+1
-1
@@ -53,7 +53,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
}
|
||||
|
||||
|
||||
List<OrderRespVOCopy> selectOrderPage(/*@Param("page") IPage page,*/ @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
IPage<OrderRespVOCopy> selectOrderPage(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
default List<OrderDO> selectOrderCheck(OrderPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<OrderDO> wrapper = new MPJLambdaWrapper<OrderDO>()
|
||||
|
||||
+8
@@ -5,13 +5,16 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.OptimizeRemainPlate;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,4 +38,9 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
|
||||
|
||||
PlateDetailRespVO selectPlateNumList(@Param("orderId") Long orderId);
|
||||
|
||||
|
||||
void deleteByPlateId(@Param("deletePlateIds") List<Long> deletePlateIds);
|
||||
|
||||
|
||||
}
|
||||
+1
-4
@@ -63,7 +63,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
}
|
||||
|
||||
// IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||
List<PlatePage> selectPlatePage(/*@Param("page") IPage<PlatePage> page,*/ @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||
List<PlatePage> selectPlatePage(/*@Param("page") IPage<PlatePage> page,*/ @Param("orderId")Long organId/*, @Param("goodsId") String goodsId*/);
|
||||
|
||||
IPage<PlateResList> selectPlateByPlanId(@Param("page") IPage<PlateResList> page, @Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
|
||||
|
||||
@@ -98,9 +98,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
List<PlateDetialRespVO> selectPlateDetialListByIds(@Param("orderIds") List<Long> orderIds);
|
||||
|
||||
|
||||
List<OptimizePlateDetialRespVO> selectPlate(@Param("orderId") Long orderId);
|
||||
|
||||
List<OptimizePlateDetialRespVO> selectPlateListByOrderIds(@Param("orderIds") List<Long> orderIds);
|
||||
|
||||
List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
}
|
||||
+15
-1
@@ -3,10 +3,13 @@ package com.cf.imes.module.executor.dal.mysql.remainplaten;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.OptimizeRemainPlate;
|
||||
import com.cf.imes.module.executor.controller.admin.remainplate.vo.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
|
||||
@@ -27,9 +30,20 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
.eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
|
||||
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline())
|
||||
.eqIfPresent(RemainPlateDO::getOutLineJson, reqVO.getOutline())
|
||||
.betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RemainPlateDO::getId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default List<RemainPlateDO> selectByPlanId(Long planId, Long userOrganId) {
|
||||
return selectList( new LambdaQueryWrapperX<RemainPlateDO>()
|
||||
.eq(RemainPlateDO::getPlanId, planId)
|
||||
.eq(RemainPlateDO::getOrganId, userOrganId));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.cf.imes.module.executor.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 生产单明细类型
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/6/7 14:50
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum OrderItemType {
|
||||
|
||||
BOARD(1, "板材"),
|
||||
|
||||
PARTS(2, "五金/配件"),
|
||||
|
||||
OTHER(3, "其他"),
|
||||
|
||||
QUOTE_PARTS(4, "报价配件");
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private final Integer code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.executor.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 排单状态
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/6/7 14:25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum OrderPlanStatusEnum {
|
||||
NEW(0, "新单"),
|
||||
|
||||
APPLY(1, "板材已申请"),
|
||||
|
||||
OPENING(2, "开料中"),
|
||||
|
||||
OPENED(3, "已开料");
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private final Integer code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.executor.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 生产单板件排单过滤类型
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/6/7 14:31
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum OrderPlateFilterTypeEnum {
|
||||
HAS_CUT_THROUGH_SHAPE(1, "有挖穿造型"),
|
||||
|
||||
HAS_CUT_PUNCH(2, "有挖穿孔"),
|
||||
|
||||
HAS_2D_KNIFE_PATHS(4, "有二维刀路"),
|
||||
|
||||
STACKABLE(8, "可叠");
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private final Integer code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
}
|
||||
+8
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.service.optimizeplan;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.SavePlanPlateResultReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -10,6 +11,8 @@ public interface OptimizePlanService {
|
||||
|
||||
String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_remain_plate_model";
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
Boolean addRemain(AddRemainReqVO vo);
|
||||
@@ -29,4 +32,9 @@ public interface OptimizePlanService {
|
||||
OrderSource getOrderSourceByOrderId(Long orderId);
|
||||
|
||||
OrderSource getOrderSourceByPlanId(Long planId);
|
||||
|
||||
|
||||
void saveOptimizationResults(SavePlanPlateResultReqVO req);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+277
-55
@@ -1,25 +1,35 @@
|
||||
package com.cf.imes.module.executor.service.optimizeplan;
|
||||
|
||||
import cn.hutool.Hutool;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.RemainTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.dto.Material;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.OptimizeRemainPlate;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.SavePlanPlateResultReqVO;
|
||||
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.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
@@ -35,41 +45,32 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
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.enums.ErrorCodeConstants;
|
||||
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.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.http2.DefaultHttp2Headers;
|
||||
import io.netty.handler.codec.http2.DefaultHttp2HeadersDecoder;
|
||||
import io.netty.handler.codec.http2.DefaultHttp2HeadersEncoder;
|
||||
import io.netty.handler.codec.http2.Http2Headers;
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNKNOWN;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.organ.core.context.OrganContextHolder.getOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||
import static com.cf.imes.module.executor.util.OrganIdUtils.getUserOrganId;
|
||||
|
||||
import io.netty.handler.codec.http2.Http2HeadersEncoder;
|
||||
import io.netty.handler.codec.http2.Http2HeadersDecoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -110,6 +111,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Resource
|
||||
private ESDocumentService esDocumentService;
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Override
|
||||
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
||||
return planMapper.selectPlateListByPlanId(planId);
|
||||
@@ -182,7 +186,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
planMapper.updateById(PlanDO.builder()
|
||||
.id(planId)
|
||||
.status(2)
|
||||
.status(PlanStatusEnum.DURINGCUTTING.getStatus())
|
||||
.build());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -196,27 +200,27 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
//余料板规格
|
||||
List<OptimizeParamResVO.RawSize> rawSizes = new ArrayList<>();
|
||||
List<Integer> remainPlateCount = new ArrayList<>();
|
||||
if(CollectionUtil.isNotEmpty(remainPlateDOS)) {
|
||||
if (CollectionUtil.isNotEmpty(remainPlateDOS)) {
|
||||
Map<String, List<OutlineDTO>> map = remainPlateDOS.stream()
|
||||
.map(e -> OutlineDTO.builder()
|
||||
.list(JsonUtils.parseArray(e.getOutline(), PointDTO.class))
|
||||
.list(JsonUtils.parseArray(e.getOutLineJson(), PointDTO.class))
|
||||
.length(e.getLength())
|
||||
.width(e.getWidth())
|
||||
.build()
|
||||
)
|
||||
.filter(e -> e.getList().size() == 4 && RectangleChecker.checkRectangle(e.getList()))
|
||||
.collect(Collectors.groupingBy(e -> e.getLength() + "," + e.getWidth()));
|
||||
map.entrySet().forEach(e-> {
|
||||
map.entrySet().forEach(e -> {
|
||||
String[] split = e.getKey().split(",");
|
||||
BigDecimal length = new BigDecimal(split[0]);
|
||||
BigDecimal width = new BigDecimal(split[1]);
|
||||
List<OutlineDTO> outlines = e.getValue();
|
||||
rawSizes.add(OptimizeParamResVO.RawSize.builder()
|
||||
.length(length)
|
||||
.width(width)
|
||||
.x(new BigDecimal(outlines.get(0).getList().get(0).getX()))
|
||||
.y(new BigDecimal(outlines.get(0).getList().get(0).getY()))
|
||||
.build());
|
||||
.length(length)
|
||||
.width(width)
|
||||
.x(new BigDecimal(outlines.get(0).getList().get(0).getX()))
|
||||
.y(new BigDecimal(outlines.get(0).getList().get(0).getY()))
|
||||
.build());
|
||||
remainPlateCount.add(outlines.size());
|
||||
});
|
||||
}
|
||||
@@ -231,7 +235,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
*/
|
||||
MPJLambdaWrapper<GoodsDO> wrapper = new MPJLambdaWrapperX<GoodsDO>()
|
||||
.distinct()
|
||||
.select(GoodsDO::getId ,GoodsDO::getWidth, GoodsDO::getHeight)
|
||||
.select(GoodsDO::getId, GoodsDO::getWidth, GoodsDO::getHeight)
|
||||
.leftJoin(PlateDO.class, PlateDO::getGoodsId, GoodsDO::getGoodsId)
|
||||
.leftJoin(OrderItemDO.class, OrderItemDO::getPlanId, PlateDO::getPlateNo)
|
||||
.leftJoin(PlanItemDO.class, PlanItemDO::getItemId, OrderItemDO::getId)
|
||||
@@ -239,10 +243,10 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
GoodsDO goodsDO = goodsMapper.selectJoinOne(GoodsDO.class, wrapper);
|
||||
rawSizes.add(OptimizeParamResVO.RawSize.builder()
|
||||
.width(goodsDO.getWidth())
|
||||
.length(goodsDO.getHeight())
|
||||
.x(new BigDecimal("0"))
|
||||
.y(new BigDecimal("0"))
|
||||
.width(goodsDO.getWidth())
|
||||
.length(goodsDO.getHeight())
|
||||
.x(new BigDecimal("0"))
|
||||
.y(new BigDecimal("0"))
|
||||
.build());
|
||||
return OptimizeParamResVO.builder()
|
||||
.plates(plates)
|
||||
@@ -257,7 +261,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
OptimizeParamRespVO optimizePlanParam = planMapper.getOptimizePlanParam(planId);
|
||||
|
||||
if(Objects.isNull(optimizePlanParam)) {
|
||||
if (Objects.isNull(optimizePlanParam)) {
|
||||
return RandomUtils.randomPojo(OptimizeParamRespVO.class);
|
||||
}
|
||||
//暂时先mock
|
||||
@@ -268,7 +272,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||
plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class));
|
||||
if( CollectionUtil.isNotEmpty(optimizePlanParam.getPlateList())) {
|
||||
if (CollectionUtil.isNotEmpty(optimizePlanParam.getPlateList())) {
|
||||
optimizePlanParam.getPlateList().get(0).setPlateDetailList(plateDetailVOS);
|
||||
}
|
||||
optimizePlanParam.setMaterialList(list);
|
||||
@@ -279,10 +283,10 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
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())) {
|
||||
if (!Objects.isNull(req.getPackageId())) {
|
||||
sql = sql.replace("#{packageId}", req.getPackageId() + "");
|
||||
}
|
||||
if(!Objects.isNull(req.getPlanId())) {
|
||||
if (!Objects.isNull(req.getPlanId())) {
|
||||
sql = sql.replace("#{planId}", req.getPlanId() + "");
|
||||
}
|
||||
return orderMapper.selectDynamicSqlString(sql);
|
||||
@@ -290,62 +294,74 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
@Override
|
||||
public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) {
|
||||
if(!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||
throw exception(154112,"生产单id与排单id只能传一个");
|
||||
if (!Objects.isNull(orderId) && !Objects.isNull(planId)) {
|
||||
throw exception(154112, "生产单id与排单id只能传一个");
|
||||
}
|
||||
OrderSource orderSource;
|
||||
if(!Objects.isNull(orderId)) {
|
||||
if (ObjectUtil.isNotNull(orderId)) {
|
||||
orderSource = getOrderSourceByOrderId(orderId);
|
||||
orderSource.setMachineDTO(machineApi.getMachineDetail(machineId).getCheckedData());
|
||||
return orderSource;
|
||||
}
|
||||
if(!Objects.isNull(planId)) {
|
||||
if (ObjectUtil.isNotNull(planId)) {
|
||||
orderSource = getOrderSourceByPlanId(planId);
|
||||
orderSource.setMachineDTO(machineApi.getMachineDetail(machineId).getCheckedData());
|
||||
return orderSource;
|
||||
}
|
||||
throw exception(154112,"生产单id或排单id不能都空");
|
||||
throw exception(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderSource getOrderSourceByOrderId(Long orderId) {
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
if(Objects.isNull(orderDO)) {
|
||||
if (Objects.isNull(orderDO)) {
|
||||
throw exception(ORDER_NOT_EXISTS);
|
||||
}
|
||||
OrderSource orderSource = new OrderSource();
|
||||
|
||||
List<OptimizePlateDetialRespVO> optimizePlateDetialRespVO = plateMapper.selectPlate(orderId);
|
||||
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrderId, orderId)
|
||||
);
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrderId, orderId)
|
||||
// );
|
||||
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsList(orderId);
|
||||
|
||||
// PlanDO planDO = planMapper.selectByOrderId(orderId);
|
||||
|
||||
List<PlateDetialRespVO> plateDOS = plateMapper.selectPlateDetialList(orderId);
|
||||
|
||||
Integer size = plateDOS.size();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = buildRespByOrderId(orderId, ORDER_PLATE_MODEL,size);
|
||||
// 造型数据的尺寸长度
|
||||
Integer orderModelSize = plateDOS.size();
|
||||
|
||||
|
||||
List<OrderModelDO> orderModelDOS = buildRespByOrderId(orderId, ORDER_PLATE_MODEL, orderModelSize);
|
||||
|
||||
|
||||
// 大板数据的尺寸长度
|
||||
Integer boardSize = goodsDOS.stream().map(m -> m.getId()).collect(Collectors.toList()).size();
|
||||
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByOrderId(orderId, ORDER_REMAIN_PLATE_MODEL, boardSize);
|
||||
|
||||
|
||||
|
||||
orderSource.setOptimizePlateDetialRespVO(optimizePlateDetialRespVO);
|
||||
// orderSource.setPlan(planDO);
|
||||
orderSource.setOrderList(Collections.singletonList(orderDO));
|
||||
orderSource.setPlateList(plateDOS);
|
||||
orderSource.setGoodsList(goodsDOS);
|
||||
orderSource.setPlateModels(orderModelDOS);
|
||||
orderSource.setOptimizeBoardModelDOS(optimizeBoardModelDOS);
|
||||
return orderSource;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public OrderSource getOrderSourceByPlanId(Long planId) {
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
if(Objects.isNull(planDO)) {
|
||||
if (Objects.isNull(planDO)) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
MPJLambdaWrapper<OrderItemDO> wrapper = new MPJLambdaWrapperX<OrderItemDO>()
|
||||
@@ -356,35 +372,179 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<OrderItemDO> orderItemDOS = orderItemMapper.selectJoinList(OrderItemDO.class, wrapper);
|
||||
List<Long> orderIds = orderItemDOS.stream().map(OrderItemDO::getOrderId).collect(Collectors.toList());
|
||||
|
||||
List<OptimizePlateDetialRespVO> optimizePlateDetialRespVOS = plateMapper.selectPlateListByOrderIds(orderIds);
|
||||
|
||||
List<OrderDO> orderDOS = orderMapper.selectBatchIds(orderIds);
|
||||
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, orderIds));
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, orderIds));
|
||||
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsListByOrderIds(orderIds);
|
||||
|
||||
List<PlateDetialRespVO> plateDOS = plateMapper.selectPlateDetialListByIds(orderIds);
|
||||
|
||||
Integer size = plateDOS.size();
|
||||
// 造型数据的尺寸长度
|
||||
Integer orderModelSize = plateDOS.size();
|
||||
|
||||
List<OrderModelDO> orderModelDOS = buildRespByOrderIds(orderIds, ORDER_PLATE_MODEL, orderModelSize);
|
||||
|
||||
|
||||
// 大板数据的尺寸长度
|
||||
Integer boardSize = goodsDOS.stream().map(m -> m.getId()).collect(Collectors.toList()).size();
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByOrderIds(orderIds, ORDER_REMAIN_PLATE_MODEL, boardSize);
|
||||
|
||||
|
||||
List<RemainPlateDO> remainPlateDOS = remainPlateMapper.selectByPlanId(planId,getUserOrganId());
|
||||
|
||||
List<OptimizeRemainPlate> optimizeRemainPlates = BeanUtils.toBean(remainPlateDOS, OptimizeRemainPlate.class);
|
||||
|
||||
|
||||
List<OrderModelDO> orderModelDOS = buildRespByOrderIds(orderIds, ORDER_PLATE_MODEL,size);
|
||||
return OrderSource.builder()
|
||||
.optimizePlateDetialRespVO(optimizePlateDetialRespVOS)
|
||||
.orderList(orderDOS)
|
||||
.plan(planDO)
|
||||
.goodsList(goodsDOS)
|
||||
.plateList(plateDOS)
|
||||
.plateModels(orderModelDOS)
|
||||
.optimizeBoardModelDOS(optimizeBoardModelDOS)
|
||||
.optimizeRemainPlates(optimizeRemainPlates)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
// 保存优化后的数据
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOptimizationResults(SavePlanPlateResultReqVO req) {
|
||||
|
||||
private List<OrderModelDO> buildRespByOrderIds(Collection<Long> orderIds, String index,Integer size) {
|
||||
|
||||
// 判断当前的大板数据是否已经优化,有优化,更新,没有,新增
|
||||
if (req.getOptimizeBoardModelDOS().get(0).getIsOptimized().equals(true)) {
|
||||
try {
|
||||
// 更新大板的优化数据
|
||||
BulkResponse bulkResponse = esDocumentService.bulkUpdate(ORDER_REMAIN_PLATE_MODEL, req.getOptimizeBoardModelDOS());
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
throw new ServiceException(500, "未知异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// 保存优化后的大板数据
|
||||
batchSaveBoardModel(req.getOptimizeBoardModelDOS());
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(req.getOptimizeRemainPlates())) {
|
||||
ArrayList<RemainPlateDO> remainPlateDOS = new ArrayList();
|
||||
|
||||
for (OptimizeRemainPlate optimizeRemainPlate : req.getOptimizeRemainPlates()) {
|
||||
remainPlateDOS.add(RemainPlateDO.builder()
|
||||
.id(optimizeRemainPlate.getId())
|
||||
.planId(optimizeRemainPlate.getPlanId())
|
||||
.initPlanId(optimizeRemainPlate.getInitPlanId())
|
||||
.organId(getUserOrganId())
|
||||
.status(optimizeRemainPlate.getStatus())
|
||||
.isCutting(true)
|
||||
.useType(RemainTypeEnum.PATCHINGPLATE.getType())
|
||||
.goodsId(optimizeRemainPlate.getGoodsId().toString())
|
||||
.name(optimizeRemainPlate.getGoodsName())
|
||||
.material(optimizeRemainPlate.getMaterial())
|
||||
.color(optimizeRemainPlate.getColor())
|
||||
.width(optimizeRemainPlate.getWidth())
|
||||
.length(optimizeRemainPlate.getLength())
|
||||
.thickness(optimizeRemainPlate.getThickness())
|
||||
.brand(optimizeRemainPlate.getBrand())
|
||||
.placeStyle(optimizeRemainPlate.getPlaceStyle())
|
||||
.store("")
|
||||
.count(optimizeRemainPlate.getCount())
|
||||
.remark(optimizeRemainPlate.getRemark())
|
||||
.outLineJson(optimizeRemainPlate.getOutLineJson())
|
||||
.build());
|
||||
}
|
||||
|
||||
remainPlateMapper.updateBatch(remainPlateDOS);
|
||||
// for (RemainPlateDO remainPlateDO : remainPlateDOS) {
|
||||
//
|
||||
//// if(remainPlateDO.getId() != null){
|
||||
//// remainPlateMapper.insert(remainPlateDO);
|
||||
////
|
||||
//// }
|
||||
//
|
||||
// remainPlateMapper.updateById(remainPlateDO);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 有新增小板,往数据库新增小板
|
||||
if (CollectionUtil.isNotEmpty(req.getAddPlateIds())) {
|
||||
|
||||
List<PlateDetialRespVO> addPlates = req.getPlateList().stream()
|
||||
.filter(m -> req.getAddPlateIds().contains(m.getId()))
|
||||
.map(m -> m.setId(null))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
// List<Long> collect = req.getPlateList().stream().map(m -> m.getId()).collect(Collectors.toList());
|
||||
// List<Long> addPlateIds = req.getAddPlateIds().stream().filter(m -> !collect.contains(m)).collect(Collectors.toList());
|
||||
// List<PlateDetialRespVO> addPlates = req.getPlateList().stream()
|
||||
// .filter(m -> addPlateIds.contains(m.getId()))
|
||||
// .map(m->m.setId(null))
|
||||
// .collect(Collectors.toList());
|
||||
// 批量新增小板信息
|
||||
List<PlateDO> plateDOS = BeanUtils.toBean(addPlates, PlateDO.class);
|
||||
|
||||
plateMapper.insertBatch(plateDOS);
|
||||
|
||||
// 批量新增生产单明细表信息
|
||||
ArrayList<OrderItemDO> orderItemDOS = new ArrayList();
|
||||
|
||||
for (PlateDetialRespVO plateDetialRespVO : req.getPlateList()) {
|
||||
orderItemDOS.add(OrderItemDO.builder()
|
||||
.id(plateDetialRespVO.getItemId())
|
||||
.bodyId(plateDetialRespVO.getBodyId())
|
||||
.groupId(plateDetialRespVO.getProcessGroupId())
|
||||
.orderId(plateDetialRespVO.getOrderId())
|
||||
.type(1)
|
||||
.plateId(plateDetialRespVO.getId())
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
orderItemMapper.insertBatch(orderItemDOS);
|
||||
|
||||
}
|
||||
|
||||
// 有删除的小板ID,删除小板
|
||||
if (CollectionUtil.isNotEmpty(req.getDeletePlateIds())) {
|
||||
|
||||
// 删除生产单板件表的小板
|
||||
plateMapper.deleteBatchIds(req.getDeletePlateIds());
|
||||
|
||||
// 删除生产单明细表中对应的小板数据
|
||||
orderItemMapper.deleteByPlateId(req.getDeletePlateIds());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<OrderModelDO> buildRespByOrderIds(Collection<Long> orderIds, String index, Integer size) {
|
||||
List<FieldValue> fieldValues = orderIds.stream().map(FieldValue::of).toList();
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.terms(b -> b.field("orderId").terms(e->e.value(fieldValues))));
|
||||
builder.query(q -> q.terms(b -> b.field("orderId").terms(e -> e.value(fieldValues))));
|
||||
try {
|
||||
SearchResponse<OrderModelDO> search = elasticsearchClient.search(builder.build(), OrderModelDO.class);
|
||||
List<Hit<OrderModelDO>> hits = search.hits().hits();
|
||||
@@ -417,6 +577,68 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存优化后的大板的数据
|
||||
*
|
||||
* @param optimizeBoardModelDOS
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchSaveBoardModel(List<OptimizeBoardModelDO> optimizeBoardModelDOS) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_REMAIN_PLATE_MODEL, optimizeBoardModelDOS);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
throw new ServiceException(500, "未知异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<OptimizeBoardModelDO> buildBoardByOrderId(Long orderId, String index,Integer size) {
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.term(b -> b.field("orderId").value(orderId)));
|
||||
try {
|
||||
SearchResponse<OptimizeBoardModelDO> search = elasticsearchClient.search(builder.build(), OptimizeBoardModelDO.class);
|
||||
List<Hit<OptimizeBoardModelDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<OptimizeBoardModelDO> buildBoardByOrderIds(Collection<Long> orderIds, String index, Integer size) {
|
||||
List<FieldValue> fieldValues = orderIds.stream().map(FieldValue::of).toList();
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.size(size);
|
||||
builder.query(q -> q.terms(b -> b.field("orderId").terms(e -> e.value(fieldValues))));
|
||||
try {
|
||||
SearchResponse<OptimizeBoardModelDO> search = elasticsearchClient.search(builder.build(), OptimizeBoardModelDO.class);
|
||||
List<Hit<OptimizeBoardModelDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
return hits.stream().map(Hit::source).collect(Collectors.toList());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -53,7 +53,8 @@ public interface PlanService {
|
||||
*/
|
||||
PageResult<PlanRespVO> getPlanPage(PlanPageReqVO pageReqVO);
|
||||
|
||||
List<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO);
|
||||
|
||||
PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO);
|
||||
|
||||
List<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO);
|
||||
|
||||
|
||||
+30
-21
@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.PlanFilterTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
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.framework.mybatis.core.query.QueryWrapperX;
|
||||
@@ -120,10 +123,10 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
if (CollectionUtil.isNotEmpty(itemIds)) {
|
||||
ArrayList<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
for (Long plateId : itemIds) {
|
||||
for (Long itemId : itemIds) {
|
||||
planItemDOS.add(PlanItemDO.builder()
|
||||
.planId(planId)
|
||||
.itemId(plateId)
|
||||
.itemId(itemId)
|
||||
.build());
|
||||
}
|
||||
planItemMapper.insertBatch(planItemDOS);
|
||||
@@ -179,7 +182,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if (planDO == null) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
if (planDO.getStatus().equals(2) || planDO.getStatus().equals(3)) {
|
||||
if (planDO.getStatus().equals(PlanStatusEnum.DURINGCUTTING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENEDMATERIAL.getStatus())) {
|
||||
throw exception(PLAN_NOT_ALLOW_DELETE);
|
||||
}
|
||||
// 删除
|
||||
@@ -233,7 +236,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<CuttingRespDTO> machines = machineApi.list(macheineIds).getCheckedData();
|
||||
|
||||
|
||||
|
||||
List<Long> planIds = planDOPageResult.getList().stream().map(PlanDO::getId).collect(Collectors.toList());
|
||||
// // 根据排单ID查询排单明细表对应的明细ID
|
||||
// List<PlanItemDO> itemDOS = planItemMapper.selectList(new LambdaQueryWrapperX<PlanItemDO>().in(PlanItemDO::getPlanId, ids));
|
||||
@@ -283,13 +285,13 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO) {
|
||||
// PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
public PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO) {
|
||||
PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
.eqIfPresent("a.id", pageReqVO.getOrderId())
|
||||
.isNull("opi.id")
|
||||
.isNull("opi.item_id")
|
||||
.eqIfPresent("a.customer", pageReqVO.getConsignee())
|
||||
.eqIfPresent("a.custom_order_no", pageReqVO.getDefaultId())
|
||||
.eqIfPresent("a.address", pageReqVO.getConsigneeAddress())
|
||||
@@ -299,30 +301,37 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("op.is_door", pageReqVO.getIsDoor())
|
||||
.betweenIfPresent("op.height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
|
||||
.betweenIfPresent("op.width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()})
|
||||
.groupBy("a.id","og.id","og.goods_name","og.color","og.material","op.goods_id")
|
||||
.groupBy("a.id", " a.order_date", "a.delivery_date", "a.customer", "a.address", "a.custom_order_no")
|
||||
.orderByDesc("a.create_time");
|
||||
List<Integer> filterTypes = new ArrayList<>();
|
||||
if (Objects.nonNull(pageReqVO.getHoleThrough()) && pageReqVO.getHoleThrough()) {
|
||||
filterTypes.add(1);
|
||||
filterTypes.add(PlanFilterTypeEnum.DIGGINGTHROUGHTHESHAPE.getType());
|
||||
}
|
||||
if (Objects.nonNull(pageReqVO.getBurrow()) && pageReqVO.getBurrow()) {
|
||||
filterTypes.add(2);
|
||||
filterTypes.add(PlanFilterTypeEnum.THEREAREPERFORATEDHOLES.getType());
|
||||
}
|
||||
if (Objects.nonNull(pageReqVO.getTwoDimensionalToolPath()) && pageReqVO.getTwoDimensionalToolPath()) {
|
||||
filterTypes.add(4);
|
||||
filterTypes.add(PlanFilterTypeEnum.TWODIMENSIONALCUTTINGPATH.getType());
|
||||
}
|
||||
|
||||
queryWrapperX.inIfPresent("op.filter_type", filterTypes);
|
||||
|
||||
List<OrderRespVOCopy> orderRespVOCopies = orderMapper.selectOrderPage(queryWrapperX);
|
||||
IPage<OrderRespVOCopy> orderRespVOCopies = orderMapper.selectOrderPage(page, queryWrapperX);
|
||||
|
||||
for (OrderRespVOCopy orderRespVOCopy : orderRespVOCopies) {
|
||||
List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
for (OrderRespVOCopy orderRespVOCopy : records) {
|
||||
|
||||
List<PlatePage> platePages = plateMapper.selectPlatePage(orderRespVOCopy.getOrderId(), orderRespVOCopy.getGoodsId());
|
||||
List<PlatePage> platePages = plateMapper.selectPlatePage(orderRespVOCopy.getOrderId()/*, orderRespVOCopy.getGoodsId()*/);
|
||||
orderRespVOCopy.setPlatePages(platePages);
|
||||
|
||||
}
|
||||
return orderRespVOCopies;
|
||||
|
||||
|
||||
if (CollectionUtil.isEmpty(records)) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
return new PageResult<>(orderRespVOCopies.getRecords(), orderRespVOCopies.getTotal());
|
||||
|
||||
|
||||
// IPage<OrderRespVOCopy> orderDOPageResult = orderMapper.selectOrderPage(queryWrapperX);
|
||||
@@ -336,7 +345,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public List<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO) {
|
||||
// PageDTO<PlatePage> page = new PageDTO<>(pageVO.getPageNo(), pageVO.getPageSize());
|
||||
List<PlatePage> pageRes = plateMapper.selectPlatePage(/*page, */pageVO.getOrderId(), pageVO.getGoodsId());
|
||||
List<PlatePage> pageRes = plateMapper.selectPlatePage(/*page, */pageVO.getOrderId()/*, pageVO.getGoodsId()*/);
|
||||
return pageRes;
|
||||
}
|
||||
|
||||
@@ -370,7 +379,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if (planDO == null) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
if (planDO.getStatus().equals(0) || planDO.getStatus().equals(1)) {
|
||||
if (planDO.getStatus().equals(PlanStatusEnum.NEWORDER.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.BOARDHASBEENAPPLIEDFOR.getStatus())) {
|
||||
throw exception(PLAN_NOT_ALLOW_CANCEL);
|
||||
}
|
||||
Set<Long> itemIds = planItemMapper.selectList(new LambdaQueryWrapperX<PlanItemDO>().eq(PlanItemDO::getPlanId, id))
|
||||
@@ -386,13 +395,13 @@ public class PlanServiceImpl implements PlanService {
|
||||
QueryWrapperX<PlateDO> queryWrapperX = new QueryWrapperX<>();
|
||||
List<Integer> filterTypes = new ArrayList<>();
|
||||
if (Objects.nonNull(vo.getHoleThrough()) && vo.getHoleThrough()) {
|
||||
filterTypes.add(1);
|
||||
filterTypes.add(PlanFilterTypeEnum.DIGGINGTHROUGHTHESHAPE.getType());
|
||||
}
|
||||
if (Objects.nonNull(vo.getBurrow()) && vo.getBurrow()) {
|
||||
filterTypes.add(2);
|
||||
filterTypes.add(PlanFilterTypeEnum.THEREAREPERFORATEDHOLES.getType());
|
||||
}
|
||||
if (Objects.nonNull(vo.getTwoDimensionalToolPath()) && vo.getTwoDimensionalToolPath()) {
|
||||
filterTypes.add(4);
|
||||
filterTypes.add(PlanFilterTypeEnum.TWODIMENSIONALCUTTINGPATH.getType());
|
||||
}
|
||||
|
||||
queryWrapperX.eq("p.plan_id", vo.getPlanId())
|
||||
@@ -446,7 +455,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public Boolean setSort(List<SortVO> list) {
|
||||
ArrayList<PlanDO> planDOS = new ArrayList<>();
|
||||
list.forEach(e->{
|
||||
list.forEach(e -> {
|
||||
planDOS.add(PlanDO.builder()
|
||||
.id(e.getPlanId())
|
||||
.sort(e.getSort())
|
||||
|
||||
+18
-7
@@ -9,11 +9,11 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
@@ -26,6 +26,9 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.processStepItem.ProcessStepItemMapper;
|
||||
import com.cf.imes.module.executor.util.RandomUtils;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,6 +39,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -201,7 +206,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<BodyPlateDetailVO> getPlateModelByPlateId(List<Long> bodyIds) {
|
||||
public List<BodyPlateDetailVO> getPlateModelByPlateId(List<Long> bodyIds) {
|
||||
List<BodyPlateIdDTO> list = plateMapper.selectJoinList(BodyPlateIdDTO.class, new MPJLambdaWrapperX<PlateDO>()
|
||||
.selectAs(PlateDO::getId, "plateId")
|
||||
.leftJoin(OrderItemDO.class, OrderItemDO::getPlateId, PlateDO::getId)
|
||||
@@ -215,12 +220,15 @@ public class PlateServiceImpl implements PlateService {
|
||||
}));
|
||||
|
||||
List<BodyPlateDetailVO> bodyPlateDetailVOS = new ArrayList<>();
|
||||
List<List<List<Object>>> data = new ArrayList<>();
|
||||
map.entrySet().forEach(e->{
|
||||
bodyPlateDetailVOS.add(BodyPlateDetailVO.builder()
|
||||
.orderModelList(e.getValue())
|
||||
.bodyId(e.getKey())
|
||||
.build()
|
||||
);
|
||||
bodyPlateDetailVOS.add(BodyPlateDetailVO.builder()
|
||||
// 将造型的数据转换成 抽取后的数据结构
|
||||
.orderModelList(e.getValue())
|
||||
// .orderModelList(e.getValue())
|
||||
.bodyId(e.getKey())
|
||||
.build()
|
||||
);
|
||||
});
|
||||
return bodyPlateDetailVOS;
|
||||
}
|
||||
@@ -229,6 +237,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private List<OrderModelDO> buildRespByPlateIds(Collection<Long> plateIds, String index) {
|
||||
//
|
||||
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.cf.imes.module.executor.util;
|
||||
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前用户的组织ID
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public class OrganIdUtils {
|
||||
|
||||
public static Long getUserOrganId(){
|
||||
|
||||
return SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
|
||||
}
|
||||
}
|
||||
+32
@@ -9,4 +9,36 @@
|
||||
文档可见:https://www.cf.com/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
|
||||
<select id="selectGoodsList" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO">
|
||||
|
||||
|
||||
select
|
||||
og.*,
|
||||
orp.id as remainId
|
||||
from order_goods og
|
||||
left join order_remain_plate orp on og.id = orp.goods_id
|
||||
where og.order_id = #{orderId}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectGoodsListByOrderIds"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.GoodsReqVO">
|
||||
|
||||
select
|
||||
og.*,
|
||||
orp.id as remainId
|
||||
from order_goods og
|
||||
left join order_remain_plate orp on og.id = orp.goods_id
|
||||
where og.order_id in
|
||||
|
||||
<foreach item="id" collection="orderIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+5
-5
@@ -4,12 +4,12 @@
|
||||
|
||||
<select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
|
||||
og.goods_name, og.color, og.material, op.goods_id, count(op.id) as num, sum(op.area) as area
|
||||
count(op.id) as num, sum(op.area) as area
|
||||
from `order` a
|
||||
inner join order_plate op on a.id = op.order_id and op.is_cancel = 0
|
||||
inner join order_goods og on op.goods_id = og.id
|
||||
left join order_item oi on a.id = oi.order_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id
|
||||
left join order_item oi on a.id = oi.order_id
|
||||
inner join order_plate op on oi.plate_id = op.id
|
||||
inner join order_goods og on op.goods_id = og.id
|
||||
left join order_plan_item opi on oi.id = opi.item_id
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
|
||||
+16
@@ -2,6 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper">
|
||||
|
||||
|
||||
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
|
||||
SELECT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
|
||||
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt, p.unregular_point_count, p.front_hole_count,
|
||||
@@ -129,4 +130,19 @@
|
||||
|
||||
|
||||
|
||||
<delete id="deleteByPlateId" parameterType="java.lang.Long">
|
||||
|
||||
|
||||
delete from order_item where plate_id in
|
||||
<foreach item="id" collection="deletePlateIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
+24
-95
@@ -1,43 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.plate.PlateMapper">
|
||||
|
||||
|
||||
<select id="selectPlatePage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
<!-- select a.id as plateId, a.name, a.width, a.height, a.thickness, a.area,-->
|
||||
<!-- b.custom_order_no, b.customer, b.address, b.remark, b.id as orderId,-->
|
||||
<!-- c.goods_name, c.material, c.color, c.goods_id-->
|
||||
<!-- from order_plate a-->
|
||||
<!-- LEFT JOIN order_plan_item p on a.id = p.item_id-->
|
||||
<!-- LEFT JOIN order_item oi on p.item_id = oi.id-->
|
||||
<!-- LEFT JOIN `order` b on oi.order_id = b.id-->
|
||||
<!-- LEFT JOIN order_goods c on a.order_id = c.order_id-->
|
||||
<!-- <where>-->
|
||||
<!-- p.id is null-->
|
||||
<!-- and a.is_cancel = 0-->
|
||||
<!-- <if test="orderId !=null">-->
|
||||
<!-- and a.order_id = #{orderId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="goodsId !=null and goodsId != '' ">-->
|
||||
<!-- and c.goods_id = #{goodsId}-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
|
||||
select a.id as plateId, a.name, a.width, a.height, a.thickness, a.area,
|
||||
b.custom_order_no, b.customer, b.address, b.remark, b.id as orderId,
|
||||
c.goods_name, c.material, c.color, c.goods_id,oi.num,
|
||||
CASE WHEN a.unregular_point_count = 0 THEN '否' ELSE '是' END AS specialShaped,
|
||||
CASE WHEN front_model_count = 0 or a.back_hole_count or a.side_hole_count THEN '否' ELSE '是' END AS profiling
|
||||
c.goods_name, c.material, c.color, c.goods_id,oi.num,a.is_special_shaped as specialShaped,a.is_sculpt as profiling
|
||||
|
||||
from order_plate a
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id
|
||||
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id
|
||||
LEFT JOIN `order` b on a.order_id = b.id
|
||||
LEFT JOIN order_goods c on a.goods_id = c.id
|
||||
left join order_plan_item opi on oi.id = opi.item_id
|
||||
<where>
|
||||
a.is_cancel = 0
|
||||
and opi.item_id is null
|
||||
<if test="orderId !=null">
|
||||
and a.order_id = #{orderId}
|
||||
</if>
|
||||
<if test="goodsId !=null and goodsId != '' ">
|
||||
and c.id = #{goodsId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
|
||||
@@ -47,7 +30,7 @@
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
||||
select a.order_id, a.plate_no , a.name as plateName,a.is_special_shaped,a.is_sculpt, e.material, e.color, e.width, e.height, e.thickness, b.room_id, b.body_id
|
||||
from order_plate a
|
||||
LEFT JOIN order_item b ON a.id = b.plate_id
|
||||
LEFT JOIN order_item b ON a.id = b.plate_id AND a.order_id = b.order_id
|
||||
LEFT JOIN order_goods e ON e.id = a.goods_id AND e.order_id = a.order_id
|
||||
LEFT JOIN order_plan_item p ON b.id = p.item_id
|
||||
${ew.customSqlSegment}
|
||||
@@ -80,11 +63,17 @@
|
||||
|
||||
<select id="selectBatchOrderIdsAndGoodsIds" resultType="java.lang.Long">
|
||||
select oi.id from order_plate op
|
||||
join order_item oi on op.id = oi.plate_id
|
||||
where ( op.order_id, op.goods_id ) in
|
||||
join order_item oi on op.id = oi.plate_id and op.order_id = oi.order_id
|
||||
where op.order_id in
|
||||
<foreach collection="itemList" item="item" open="(" close=")" separator=",">
|
||||
(#{item.orderId},#{item.goodsId})
|
||||
(#{item.orderId})
|
||||
</foreach>
|
||||
and
|
||||
op.goods_id in
|
||||
<foreach collection="itemList" item="item" open="(" close=")" separator=",">
|
||||
(#{item.goodsId})
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@@ -127,9 +116,12 @@
|
||||
<resultMap id="PlateDetialMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlateDetialRespVO">
|
||||
|
||||
<result property="itemId" column="itemId"/>
|
||||
<result property="bodyId" column="bodyId"/>
|
||||
<result property="goodsName" column="goodsName"/>
|
||||
<result property="roomId" column="roomId"/>
|
||||
<result property="bodyName" column="bodyName"/>
|
||||
<result property="roomName" column="roomName"/>
|
||||
<result property="processGroupId" column="processGroupId"/>
|
||||
<result property="processGroupName" column="processGroupName"/>
|
||||
<result property="hasHole" column="hasHole"/>
|
||||
|
||||
@@ -141,8 +133,11 @@
|
||||
select distinct op.*,
|
||||
oi.id as itemId,
|
||||
ogs.goods_name as goodsName,
|
||||
ob.id as bodyId,
|
||||
ob.room_id as roomId,
|
||||
ob.name as bodyName,
|
||||
ob.room_name as roomName,
|
||||
og.id as processGroupId,
|
||||
og.name as processGroupName,
|
||||
CASE WHEN op.unregular_point_count = 0 and op.front_hole_count = 0 and op.back_hole_count = 0 and op.side_hole_count = 0 THEN false ELSE true END AS hasHole
|
||||
from order_plate op
|
||||
@@ -184,75 +179,9 @@
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlateMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.OptimizePlateDetialRespVO">
|
||||
|
||||
<result property="boardNum" column="boardNum"/>
|
||||
<result property="plateNum" column="plateNum"/>
|
||||
<result property="hasTexture" column="hasTexture"/>
|
||||
<result property="boardId" column="boardId"/>
|
||||
<result property="plateName" column="plateName"/>
|
||||
<result property="material" column="material"/>
|
||||
<result property="color" column="color"/>
|
||||
<result property="thickness" column="thickness"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="remainPlateNum" column="remainPlateNum"/>
|
||||
|
||||
</resultMap>
|
||||
<select id="selectPlate"
|
||||
resultMap="PlateMap"
|
||||
parameterType="java.lang.Long">
|
||||
|
||||
select count(distinct og.id) as boardNum,
|
||||
count(distinct op.id) as plateNum,
|
||||
(case
|
||||
when p.texture ='' then false
|
||||
else true end ) as hasTexture,
|
||||
og.id as boardId,
|
||||
og.goods_name as plateName,
|
||||
og.material as material,
|
||||
og.color as color,
|
||||
og.thickness as thickness,
|
||||
og.spec as spec,
|
||||
orp.count as remainPlateNum
|
||||
from order_goods og
|
||||
left join order_plate op on og.id = op.goods_id
|
||||
left join plate p on og.goods_id = p.id
|
||||
left join order_remain_plate orp on op.id = orp.plan_id
|
||||
where og.order_id = #{orderId}
|
||||
group by boardId,plateName,material,color,thickness,spec,remainPlateNum,hasTexture;
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlateListByOrderIds"
|
||||
resultMap="PlateMap"
|
||||
parameterType="java.lang.Long">
|
||||
|
||||
select count(distinct og.id) as boardNum,
|
||||
count(distinct op.id) as plateNum,
|
||||
(case
|
||||
when p.texture ='' then false
|
||||
else true end ) as hasTexture,
|
||||
og.id as boardId,
|
||||
og.goods_name as plateName,
|
||||
og.material as material,
|
||||
og.color as color,
|
||||
og.thickness as thickness,
|
||||
og.spec as spec,
|
||||
orp.count as remainPlateNum
|
||||
from order_goods og
|
||||
left join order_plate op on og.id = op.goods_id
|
||||
left join plate p on og.goods_id = p.id
|
||||
left join order_remain_plate orp on op.id = orp.plan_id
|
||||
|
||||
where og.order_id in
|
||||
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
|
||||
group by boardId,plateName,material,color,thickness,spec,remainPlateNum,hasTexture;
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectPlateGoodsList" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user