mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
优化生产大板字段类型更改,未排单接口查询速度优化
This commit is contained in:
+2
-1
@@ -30,11 +30,12 @@ public interface GlobalErrorCodeConstants {
|
||||
|
||||
// ========== 服务端错误段 ==========
|
||||
|
||||
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常");
|
||||
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常,请联系客服处理");
|
||||
ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
|
||||
ErrorCode ERROR_CONFIGURATION = new ErrorCode(502, "错误的配置项");
|
||||
ErrorCode ES_ERROR_UPDATE = new ErrorCode(503, "ES文档更新失败");
|
||||
ErrorCode ES_ERROR_DELETE = new ErrorCode(504, "ES文档删除失败");
|
||||
ErrorCode DATA_EXCEPTION_ERROR = new ErrorCode(505, "数据异常,请联系客服处理");
|
||||
|
||||
// ========== 自定义错误段 ==========
|
||||
ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求
|
||||
|
||||
+4
@@ -236,6 +236,10 @@ public class GlobalExceptionHandler {
|
||||
return tableNotExistsResult;
|
||||
}
|
||||
|
||||
if(ex instanceof NullPointerException){
|
||||
return CommonResult.error(DATA_EXCEPTION_ERROR.getCode(), DATA_EXCEPTION_ERROR.getMsg());
|
||||
}
|
||||
|
||||
// 情况二:部分特殊的库的处理
|
||||
if (Objects.equals("io.github.resilience4j.ratelimiter.RequestNotPermitted", ex.getClass().getName())) {
|
||||
return requestNotPermittedExceptionHandler(req, ex);
|
||||
|
||||
+7
-6
@@ -1,12 +1,13 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import lombok.*;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -24,7 +25,7 @@ public class GoodsPageReqVO extends PageParam {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
+4
-6
@@ -1,14 +1,12 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单商品 Response VO")
|
||||
@Data
|
||||
@@ -29,7 +27,7 @@ public class GoodsRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("商品名称")
|
||||
|
||||
+2
-4
@@ -1,11 +1,9 @@
|
||||
package com.cf.imes.module.executor.controller.admin.goods.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单商品新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -21,7 +19,7 @@ public class GoodsSaveReqVO {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
-8
@@ -128,13 +128,5 @@ public class OptimizePlanController {
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "ES批量删除测试")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:delete')")
|
||||
public CommonResult<String> deleteTest(@RequestParam("id") List<Long> id) {
|
||||
return success(optimizePlanService.deleteTest(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class PlanController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建排单")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:create')")
|
||||
public CommonResult<Map<Long,Long>> createPlan(@Validated(CreateGroup.class) @RequestBody PlanSaveReqVO createReqVO) {
|
||||
public CommonResult<Map<String,Long>> createPlan(@Validated(CreateGroup.class) @RequestBody PlanSaveReqVO createReqVO) {
|
||||
return success(planService.createPlan(createReqVO));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class OrderIds {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class NotPlanGoodsRespVO {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class OptimizeRemainPlate {
|
||||
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
|
||||
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class GoodsReqVO {
|
||||
private Long rawGoodsId;
|
||||
|
||||
@Schema(description = "商品 ID-大板的实际ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class NotPlanOrderPlateRespVO {
|
||||
private List<OrderIds> orderIdList;
|
||||
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class OrderGoodsResp {
|
||||
@Schema(description = "生产单id")
|
||||
private List<OrderIds> orderIds;
|
||||
@Schema(description = "商品id-商品编号")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "商品材质")
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class OrderPageReqVOCopy extends PageParam {
|
||||
|
||||
// todo 目前商品ID的数据筛选只解决了非混单的情况(非混单,数据类型为Long即可,混单情况需要改变),混单数据筛选待解决
|
||||
@Schema(description = "商品ID-板材库对应的大板ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "大板分类ID")
|
||||
private List<Long> ids;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class OrderRespVOCopy {
|
||||
@Schema(description = "平方")
|
||||
private BigDecimal area = new BigDecimal("0");
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
// @Schema(description = "商品名称")
|
||||
// private String goodsName;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.math.BigDecimal;
|
||||
public class PlanGoodsVO {
|
||||
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "材质")
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class PlanSaveReqVO {
|
||||
|
||||
@Schema(description = "板材库大板id")
|
||||
@NotNull
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "余料板ID")
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class PlateDetialRespVO {
|
||||
|
||||
|
||||
@Schema(description = "大板实际ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class PlateInfoVO {
|
||||
|
||||
|
||||
@Schema(description = "板材库对应的大板ID-大板实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class PlatePage {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "板名称")
|
||||
private String name;
|
||||
@Schema(description = "商品名称")
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class OptimizationSavePlateReqVO {
|
||||
|
||||
|
||||
@Schema(description = "商品ID-大板的实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹")
|
||||
private Integer texture;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class OptimizeBoardModelDO extends ESDocument {
|
||||
|
||||
|
||||
@Schema(description = "大板的实际ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
|
||||
@Schema(description = "生产单已优化小板数量")
|
||||
|
||||
+6
-15
@@ -9,7 +9,6 @@ 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.goods.vo.GoodsPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderRoomBodyList;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.NotPlanGoodsRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -80,14 +79,9 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
void deletedById(@Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectGoods(@Param("page") IPage page, @Param("goodsIds") List<Long> goodsIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
List<NotPlanGoodsRespVO> selectGoodsPlateList(@Param("goodIds") List<Long> goodIds,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<GoodsDO> selectListByGoodsId(Long goodsId, Long organId) {
|
||||
default List<GoodsDO> selectListByGoodsId(String goodsId, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -112,7 +106,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
|
||||
default List<GoodsDO> selectListByGoodsIdList(List<Long> goodsIds,List<Long> orderIds, Long organId) {
|
||||
default List<GoodsDO> selectListByGoodsIdList(List<String> goodsIds,List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -122,10 +116,10 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
}
|
||||
|
||||
|
||||
List<GoodsDO> seleTestSQL(@Param("filed") String filed,@Param("goodsIds") List<Long> goodsIds ,@Param("organId") Long organId);
|
||||
List<GoodsDO> seleTestSQL(@Param("filed") String filed,@Param("goodsIds") List<String> goodsIds ,@Param("organId") Long organId);
|
||||
|
||||
|
||||
default GoodsDO selectGoodsId(Long orderId, Long goodsId, Long organId) {
|
||||
default GoodsDO selectGoodsId(Long orderId, String goodsId, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
@@ -135,11 +129,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
}
|
||||
|
||||
default PageResult<GoodsDO> selectTestSQL(OrderPageReqVOCopy pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, getUserOrganId())
|
||||
.orderByDesc(GoodsDO::getId));
|
||||
}
|
||||
|
||||
|
||||
IPage<OrderGoodsResp> selectOrderGoodsList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<GoodsDO> wrapper);
|
||||
@@ -204,4 +193,6 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
|
||||
List<OrderRoomBodyList> selectNoPlanRoomBody(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderPlate(@Param("page") IPage page,@Param("organId") Long organId);
|
||||
}
|
||||
+10
-1
@@ -201,10 +201,11 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateIdList(List<Long> goodsIdList, Long organId) {
|
||||
default List<PlateDO> selectPlateIdList(List<Long> orderIds,List<Long> goodsIdList, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.inIfPresent(PlateDO::getOrderId,orderIds)
|
||||
.inIfPresent(PlateDO::getGoodsId,goodsIdList)
|
||||
.eq(PlateDO::getType, OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())
|
||||
.select(PlateDO::getId));
|
||||
@@ -223,6 +224,14 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
}
|
||||
|
||||
List<PlatePage> selectNoPlanPlateList(@Param(Constants.WRAPPER) Wrapper<PlateDO> queryWrapperX2);
|
||||
|
||||
|
||||
void updatePlateOptimized(@Param("orderIdList") List<Long> orderIdList,@Param("ids") List<Long> ids,@Param("organId") Long organId);
|
||||
|
||||
|
||||
void updateNoPlateOptimized(@Param("orderIdList") List<Long> orderIdList,@Param("ids") List<Long> ids,@Param("organId") Long organId);
|
||||
|
||||
|
||||
// List<PlateDO> selectTestSQL(@Param("sql") String sql);
|
||||
|
||||
|
||||
+1
-4
@@ -5,7 +5,6 @@ import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.CuttingSta
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.SavePlanPlateResultReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.AddRemainReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.GetSourceDataReq;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPageReqVOCopy;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.OptimizeBoardModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
@@ -18,7 +17,7 @@ public interface OptimizePlanService {
|
||||
|
||||
String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_remain_plate_model";
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||
|
||||
@@ -49,6 +48,4 @@ public interface OptimizePlanService {
|
||||
List<OptimizeBoardModelDO> buildBoardByOrderIds(Collection<Long> orderIds, String index, Integer size);
|
||||
|
||||
|
||||
String deleteTest(List<Long> id);
|
||||
|
||||
}
|
||||
|
||||
-18
@@ -14,7 +14,6 @@ import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
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.MPJLambdaWrapperX;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessGroupList;
|
||||
@@ -23,13 +22,10 @@ import com.cf.imes.module.executor.controller.admin.plan.bo.ProcessStepSalaryIds
|
||||
import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.CutedBoardInfo;
|
||||
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.orderBody.OrderBodyDO;
|
||||
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.planitem.PlanItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
@@ -986,20 +982,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String deleteTest(List<Long> orderIds) {
|
||||
|
||||
Long a = 1801515154546884609L;
|
||||
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = buildBoardByPlanId(a, ORDER_REMAIN_PLATE_MODEL, 999);
|
||||
|
||||
System.out.println("哈哈哈哈哈1 "+optimizeBoardModelDOS);
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public interface PlanService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Map<Long,Long> createPlan(@Valid PlanSaveReqVO createReqVO);
|
||||
Map<String,Long> createPlan(@Valid PlanSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单开料排单
|
||||
|
||||
+92
-110
@@ -109,7 +109,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_remain_plate_model";
|
||||
String ORDER_REMAIN_PLATE_MODEL = "imes_order_optimize_plate_model";
|
||||
|
||||
@Resource
|
||||
private ElasticsearchClient elasticsearchClient;
|
||||
@@ -119,7 +119,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<Long,Long> createPlan(PlanSaveReqVO createReqVO) {
|
||||
public Map<String,Long> createPlan(PlanSaveReqVO createReqVO) {
|
||||
|
||||
// todo 目前只考虑了非混单的情况,混单的情况待考虑
|
||||
List<PlanSaveReqVO.Item> itemList = createReqVO.getItemList();
|
||||
@@ -128,22 +128,30 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<GoodsDO> goodsDOS = new ArrayList<>();
|
||||
|
||||
// <大板实际ID,排单ID>
|
||||
Map<Long,Long> goodsPlanId = new HashMap<>();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
|
||||
Map<Long, List<PlanSaveReqVO.Item>> groupedItems = itemList.stream()
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
|
||||
// <大板实际ID,排单ID>
|
||||
Map<String,Long> goodsPlanId = new HashMap<>();
|
||||
|
||||
Map<String, List<PlanSaveReqVO.Item>> groupedItems = itemList.stream()
|
||||
.collect(Collectors.groupingBy(PlanSaveReqVO.Item::getGoodsId));
|
||||
|
||||
|
||||
for (Map.Entry<Long, List<PlanSaveReqVO.Item>> entry : groupedItems.entrySet()) {
|
||||
for (Map.Entry<String, List<PlanSaveReqVO.Item>> entry : groupedItems.entrySet()) {
|
||||
|
||||
List<PlanSaveReqVO.Item> items = entry.getValue();
|
||||
|
||||
List<Long> orderIds = items.stream().map(PlanSaveReqVO.Item::getOrderId).distinct().toList();
|
||||
|
||||
orderIdList.addAll(orderIds);
|
||||
|
||||
// 创建计划
|
||||
PlanDO plan = BeanUtils.toBean(createReqVO, PlanDO.class);
|
||||
plan.setId(identifierGenerator.nextId(plan).longValue());
|
||||
plan.setSort(0L);
|
||||
String orderNos = items.stream().map(PlanSaveReqVO.Item::getOrderId).distinct().toList().toString();
|
||||
String orderNos = orderIds.toString();
|
||||
plan.setOrderNos(orderNos);
|
||||
plan.setProduceTime(null);
|
||||
|
||||
@@ -155,6 +163,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectPlanGoodsList(goodsIds, getUserOrganId()).stream().map(m -> m.setPlanId(plan.getId())).toList();
|
||||
|
||||
ids.addAll(goodsDOList.stream().map(GoodsDO::getId).toList());
|
||||
|
||||
goodsDOS.addAll(goodsDOList);
|
||||
|
||||
|
||||
@@ -166,6 +176,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
goodsMapper.updateBatch(goodsDOS);
|
||||
|
||||
plateMapper.updatePlateOptimized(orderIdList,ids,getUserOrganId());
|
||||
|
||||
return goodsPlanId;
|
||||
|
||||
@@ -185,11 +196,11 @@ public class PlanServiceImpl implements PlanService {
|
||||
if(!(updateReqVO.getItemList() == null)){
|
||||
|
||||
// todo 目前之解决非混单的情况,混单的情况待解决
|
||||
Long goodsId = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getGoodsId).distinct().toList().get(0);
|
||||
String goodsId = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getGoodsId).distinct().toList().get(0);
|
||||
|
||||
|
||||
// todo 目前只解决非混单的情况
|
||||
Long goodsIds = BeanUtils.toBean(goodsMapper.selectPlanGoods(plan.getId(), getUserOrganId()).stream().map(GoodsDO::getGoodsId).toList(), Long.class).get(0);
|
||||
String goodsIds = goodsMapper.selectPlanGoods(plan.getId(), getUserOrganId()).stream().map(GoodsDO::getGoodsId).toList().get(0);
|
||||
|
||||
if(!goodsId.equals(goodsIds)){
|
||||
throw exception(PLATE_ERROR);
|
||||
@@ -200,12 +211,26 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<Long> ids = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getId).toList();
|
||||
|
||||
List<Long> orderIds = updateReqVO.getItemList().stream().map(PlanSaveReqVO.Item::getOrderId).toList();
|
||||
|
||||
// 修改新增的大板对应的板材为已优化
|
||||
plateMapper.updatePlateOptimized(orderIds,ids,getUserOrganId());
|
||||
|
||||
List<GoodsDO> goodsDOS = new ArrayList<>(goodsMapper.selectPlanGoodsList(ids, getUserOrganId())
|
||||
.stream().map(m -> m.setPlanId(plan.getId())).toList());
|
||||
|
||||
if (!updateReqVO.getDeleteIds().isEmpty()){
|
||||
|
||||
goodsDOS.addAll(goodsMapper.selectPlanGoodsList(updateReqVO.getDeleteIds(), getUserOrganId()).stream().map(m -> m.setPlanId(null)).toList());
|
||||
List<GoodsDO> goodsDOList = goodsMapper.selectPlanGoodsList(updateReqVO.getDeleteIds(), getUserOrganId());
|
||||
|
||||
List<Long> goodsIdList = goodsDOList.stream().map(GoodsDO::getId).distinct().toList();
|
||||
|
||||
List<Long> orderIdList = goodsDOList.stream().map(GoodsDO::getOrderId).distinct().toList();
|
||||
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIdList,goodsIdList,getUserOrganId());
|
||||
|
||||
goodsDOS.addAll(goodsDOList.stream().map(m -> m.setPlanId(null)).toList());
|
||||
|
||||
}
|
||||
|
||||
@@ -297,25 +322,25 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
// 删除排单信息,商品表里的 planId , ES优化数据,更新排单对应的余料板的排单ID为0
|
||||
// 删除排单信息, ES优化数据,更新排单对应的余料板的排单ID为0
|
||||
planMapper.deleteBatchIds(ids);
|
||||
// planItemMapper.delete(new LambdaQueryWrapperX<PlanItemDO>().in(PlanItemDO::getPlanId, ids));
|
||||
goodsMapper.deletePlanGoods(ids,getUserOrganId());
|
||||
remainPlateMapper.deletePlanRemainPlate(ids,getUserOrganId());
|
||||
|
||||
remainPlateMapper.deletePlanRemainPlate(ids,getUserOrganId());
|
||||
|
||||
|
||||
// 排单对应的自增板的删除 todo 目前值解决了非混单的情况
|
||||
List<OptimizeBoardModelDO> boardModelDOS = buildBoardByPlanIds(ids, ORDER_REMAIN_PLATE_MODEL, ids.size());
|
||||
if(!boardModelDOS.isEmpty()) {
|
||||
|
||||
// List<Long> goodsIds = boardModelDOS.stream().map(OptimizeBoardModelDO::getGoodsId).toList();
|
||||
|
||||
// List<Long> goodsIdList = goodsMapper.selectListByGoodsIdList(goodsIds, orderIds, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
List<Long> goodsIdList = goodsMapper.selectPlanGoodsListByPlanIdList(ids, getUserOrganId()).stream().map(GoodsDO::getId).toList();
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(goodsIdList, getUserOrganId());
|
||||
|
||||
// 修改删除的大板对应的小板为未优化
|
||||
plateMapper.updateNoPlateOptimized(orderIds,goodsIdList,getUserOrganId());
|
||||
|
||||
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateIdList(orderIds,goodsIdList, getUserOrganId());
|
||||
if(!plateDOS.isEmpty()) {
|
||||
List<Long> plateIds = plateDOS.stream().map(PlateDO::getId).toList();
|
||||
|
||||
@@ -331,6 +356,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
// 删除商品表里的 planId
|
||||
goodsMapper.deletePlanGoods(ids,getUserOrganId());
|
||||
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
|
||||
List<Long> diff;
|
||||
@@ -402,31 +430,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
return BeanUtils.toBean(planDO, PlanRespVO.class);
|
||||
|
||||
// MPJLambdaWrapper<OrderItemDO> wrapper = new MPJLambdaWrapperX<OrderItemDO>().select(OrderItemDO::getOrderId)
|
||||
// .rightJoin(PlanItemDO.class, PlanItemDO::getItemId, OrderItemDO::getId)
|
||||
// .isNotNull(OrderItemDO::getId);
|
||||
// Set<Long> orderIds = orderItemMapper.selectJoinList(OrderItemDO.class, wrapper).stream().map(OrderItemDO::getOrderId).collect(Collectors.toSet());
|
||||
//
|
||||
// /*Set<Long> orderIds = planOrderMapper.selectList(new LambdaQueryWrapperX<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planDO.getPlanNo()))
|
||||
// .stream()
|
||||
// .map(e -> e.getOrderId())
|
||||
// .collect(Collectors.toSet());*/
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
// .eq(GoodsDO::getOrganId,getUserOrganId())
|
||||
// .in(GoodsDO::getOrderId, orderIds));
|
||||
// List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
// .eq(PlateDO::getOrganId,getUserOrganId())
|
||||
// .in(PlateDO::getGoodsId, goodsDOS.stream().map(GoodsDO::getGoodsId).collect(Collectors.toSet())));
|
||||
// List<PlateInfoVO> plateInfoVOS = goodsDOS.stream().map(e -> PlateInfoVO.builder()
|
||||
// .material(e.getMaterial())
|
||||
// .width(e.getWidth())
|
||||
// .height(e.getHeight())
|
||||
// .thickness(e.getThickness())
|
||||
// .area(e.getHeight().multiply(e.getWidth()).setScale(2, RoundingMode.HALF_UP))
|
||||
// .count(plateDOS.stream().filter(f -> Objects.equals(f.getGoodsId(), e.getGoodsId())).collect(Collectors.toSet()).size())
|
||||
// .build())
|
||||
// .collect(Collectors.toList());
|
||||
// respVO.setPlateInfoList(plateInfoVOS);
|
||||
|
||||
}
|
||||
|
||||
@@ -577,25 +580,28 @@ public class PlanServiceImpl implements PlanService {
|
||||
PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
List<Integer> statusList = new ArrayList<>();
|
||||
List<Long> goodsIds = new ArrayList<>();
|
||||
statusList.add(OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
statusList.add(OrderStatusEnum.IN_PRODUCTION.getStatus());
|
||||
statusList.add(OrderStatusEnum.SORTED.getStatus());
|
||||
|
||||
// todo 修改排单数据筛选,目前只解决了非混单的情况,混单情况待解决
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
|
||||
if(pageReqVO.getGoodsId() != null) {
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(pageReqVO.getGoodsId(), getUserOrganId());
|
||||
goodsIds.addAll(goodsDOS.stream().map(GoodsDO::getId).toList());
|
||||
}
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
.eq("o.organ_id",getUserOrganId())
|
||||
.eq("o.deleted",false)
|
||||
.in("o.status",statusList)
|
||||
.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.plan_id",0)
|
||||
.eq("og.deleted",false)
|
||||
// .eq("og.organ_id",getUserOrganId())
|
||||
// .eq("og.plan_id",0)
|
||||
// .eq("og.deleted",false)
|
||||
// .isNull("opi.item_id")
|
||||
// todo 修改排单数据筛选,目前只解决了非混单的情况,混单情况待解决
|
||||
.inIfPresent("og.id",goodsDOS.isEmpty() ? null :goodsDOS.stream().map(GoodsDO::getId).toList())
|
||||
.inIfPresent("og.id",goodsIds)
|
||||
.inIfPresent("o.id",pageReqVO.getOrderIds())
|
||||
.likeIfPresent("o.id", pageReqVO.getOrderId() != null ? pageReqVO.getOrderId().toString() : null)
|
||||
.inIfPresent("og.id",pageReqVO.getIds())
|
||||
@@ -609,8 +615,8 @@ 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("o.id", " o.order_date", "o.delivery_date", "o.customer", "o.address", "o.custom_order_no","o.status")
|
||||
.having("count(op.id) != 0")
|
||||
// .groupBy("o.id", " o.order_date", "o.delivery_date", "o.customer", "o.address", "o.custom_order_no","o.status")
|
||||
// .having("count(op.id) != 0")
|
||||
.orderByDesc("o.order_date");
|
||||
|
||||
String filterTypes = "";
|
||||
@@ -627,12 +633,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
queryWrapperX.likeIfPresent("op.filter_type", insertSeparator(filterTypes));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// todo 目前修改一半,速度无法再进行特别的优化,需等后面修改表结构再进行优化
|
||||
IPage<OrderRespVOCopy> orderRespVOCopies = orderMapper.selectOrderPage(page,queryWrapperX);
|
||||
|
||||
@@ -640,16 +640,34 @@ public class PlanServiceImpl implements PlanService {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
// List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
//
|
||||
// orderRespVOCopies.setRecords(records.stream().peek(m -> {
|
||||
//
|
||||
// m.setNum((int) m.getPlatePages().stream().map(PlatePage::getPlateId).count());
|
||||
//
|
||||
// m.setArea(m.getPlatePages().stream().map(PlatePage::getArea).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// m.setPlatePages(null);
|
||||
//
|
||||
// }).toList());
|
||||
List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
|
||||
List<Long> orderIds = records.stream().map(OrderRespVOCopy::getOrderId).toList();
|
||||
|
||||
|
||||
QueryWrapperX<PlateDO> queryWrapperX2 = new QueryWrapperX<>();
|
||||
queryWrapperX2
|
||||
.eq("organ_id",getUserOrganId())
|
||||
.eq("deleted",false)
|
||||
.in("order_id",orderIds)
|
||||
.eq("isOptimized",false)
|
||||
.inIfPresent("goods_id",goodsIds)
|
||||
.inIfPresent("goods_id",pageReqVO.getIds())
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getRectangle() != null ? false: null)
|
||||
.eqIfPresent("is_special_shaped", pageReqVO.getSpecialShaped())
|
||||
.eqIfPresent("is_sculpt", pageReqVO.getSculpt())
|
||||
.eqIfPresent("is_door", pageReqVO.getIsDoor())
|
||||
.betweenIfPresent("height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
|
||||
.betweenIfPresent("width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()});
|
||||
|
||||
List<PlatePage> plateList = plateMapper.selectNoPlanPlateList(queryWrapperX2);
|
||||
|
||||
|
||||
orderRespVOCopies.setRecords(records.stream().peek(m->{
|
||||
m.setNum((int) plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getPlateId).count());
|
||||
|
||||
m.setArea(plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getArea).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
}).toList());
|
||||
|
||||
|
||||
return new PageResult<>(orderRespVOCopies.getRecords(), orderRespVOCopies.getTotal());
|
||||
@@ -796,9 +814,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eq("o.organ_id",getUserOrganId())
|
||||
.eq("o.deleted",false)
|
||||
.in("o.status",statusList)
|
||||
.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.plan_id",0)
|
||||
.eq("og.deleted",false)
|
||||
// .eq("og.organ_id",getUserOrganId())
|
||||
// .eq("og.plan_id",0)
|
||||
// .eq("og.deleted",false)
|
||||
|
||||
.inIfPresent("og.order_id", pageReqVO.getOrderIds())
|
||||
.inIfPresent("og.id", pageReqVO.getIds())
|
||||
@@ -834,9 +852,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
IPage<OrderGoodsResp> orderGoodsResps = orderMapper.selectOrderIds(page,queryWrapperX);
|
||||
|
||||
|
||||
// IPage<OrderGoodsResp> orderGoodsResps = goodsMapper.selectOrderGoodsList(page, queryWrapperX);
|
||||
|
||||
|
||||
if (CollectionUtil.isEmpty(orderGoodsResps.getRecords())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
@@ -845,7 +860,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<OrderGoodsResp> records = orderGoodsResps.getRecords();
|
||||
|
||||
|
||||
List<Long> goodsIdList = records.stream().map(OrderGoodsResp::getGoodsId).toList();
|
||||
List<String> goodsIdList = records.stream().map(OrderGoodsResp::getGoodsId).toList();
|
||||
|
||||
|
||||
queryWrapperX.in("og.goods_id", goodsIdList);
|
||||
|
||||
@@ -853,33 +869,12 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<OrderGoodsResp> goodsResp = orderMapper.selectGoodsListByGoodsId(queryWrapperX);
|
||||
|
||||
|
||||
//
|
||||
// Map<Long, List<OrderGoodsResp>> collect = records.stream().collect(Collectors.groupingBy(OrderGoodsResp::getGoodsId));
|
||||
|
||||
|
||||
// for (OrderGoodsResp orderGoodsResp : goodsResp) {
|
||||
//
|
||||
// List<OrderGoodsResp> orderGoodsResps1 = collect.get(orderGoodsResp.getGoodsId());
|
||||
//
|
||||
//
|
||||
// if (orderGoodsResps1 != null) {
|
||||
// // 合并 otherObjectList 到 obj1 副本中
|
||||
// orderGoodsResps1.get().addAll(obj2.getOtherObjectList());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
for (OrderGoodsResp record : records) {
|
||||
|
||||
|
||||
List<OrderIds> orderIdsList = new ArrayList<>();
|
||||
|
||||
|
||||
List<List<OrderIds>> list = goodsResp.stream().filter(f -> f.getGoodsId().equals(record.getGoodsId())).map(OrderGoodsResp::getOrderIds).toList();
|
||||
|
||||
|
||||
if(!list.isEmpty()){
|
||||
|
||||
orderIdsList = list.stream().flatMap(Collection::stream).toList();
|
||||
@@ -887,24 +882,11 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
record.setOrderIds(orderIdsList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
orderGoodsResps.setRecords(records);
|
||||
|
||||
// for (Map.Entry<Long, List<OrderGoodsResp>> entry : collect.entrySet()) {
|
||||
//
|
||||
// List<List<OrderIds>> list = entry.getValue().stream().map(OrderGoodsResp::getOrderIds).toList();
|
||||
//
|
||||
// List<OrderIds> orderds = list.stream().flatMap(Collection::stream).toList();
|
||||
//
|
||||
// List<OrderGoodsResp> list1 = records.stream().filter(f -> f.getGoodsId().equals(entry.getKey())).map(m -> m.setOrderIds(orderds)).toList();
|
||||
//
|
||||
// orderGoodsResps.setRecords(list1);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
return new PageResult<>(orderGoodsResps.getRecords(), orderGoodsResps.getTotal());
|
||||
|
||||
@@ -969,6 +951,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
queryWrapperX.eq("og.organ_id",getUserOrganId())
|
||||
.eq("og.deleted",false)
|
||||
.in("og.plan_id", vo.getPlanIds())
|
||||
.eqIfPresent("op.is_door", vo.getIsDoor())
|
||||
.eqIfPresent("op.is_special_shaped", vo.getRectangle() != null ? false: null)
|
||||
@@ -976,8 +959,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("op.is_sculpt", vo.getSculpt())
|
||||
.betweenIfPresent("op.width", new BigDecimal[]{vo.getWidthMinRang(), vo.getWidthMaxRang()})
|
||||
.betweenIfPresent("op.height", new BigDecimal[]{vo.getLongMinRang(), vo.getLongMaxRang()})
|
||||
.likeIfPresent("op.filter_type", insertSeparator(filterTypes))
|
||||
.orderByDesc("op.order_id");
|
||||
.likeIfPresent("op.filter_type", insertSeparator(filterTypes));
|
||||
|
||||
PageDTO<PlateResList> page = new PageDTO<>(vo.getPageNo(), vo.getPageSize());
|
||||
|
||||
|
||||
+2
-3
@@ -48,8 +48,7 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.THE_CURRENT_BOARD_IS_NOT_SELECTED;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单板件 Service 实现类
|
||||
@@ -114,7 +113,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
private void validatePlateExists(Long id) {
|
||||
if (plateMapper.selectById(id) == null) {
|
||||
throw exception(PLATE_NOT_EXISTS);
|
||||
throw exception(REMAIN_PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-57
@@ -58,63 +58,6 @@
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectGoods" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp" parameterType="map">
|
||||
|
||||
|
||||
select distinct
|
||||
c.goods_id as goodsId,
|
||||
c.width as width,
|
||||
c.height as height,
|
||||
c.thickness as thickness,
|
||||
c.goods_name as goodsName,
|
||||
c.material as material,
|
||||
c.color as color
|
||||
|
||||
from order_goods c
|
||||
|
||||
where
|
||||
c.organ_id = 1
|
||||
and c.goods_id in
|
||||
<foreach item="goodsIds" collection="goodsIds" open="(" separator="," close=")">
|
||||
#{goodsIds}
|
||||
</foreach>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectGoodsPlateList"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.saveOptimize.NotPlanGoodsRespVO">
|
||||
|
||||
select distinct
|
||||
og.goods_id,
|
||||
og.height,
|
||||
og.width,
|
||||
og.color,
|
||||
og.goods_name,
|
||||
og.thickness,
|
||||
og.spec,
|
||||
count(distinct op.id) as plateNum
|
||||
from order_goods og
|
||||
left join order_plate op on og.id = op.goods_id and og.organ_id = op.organ_id
|
||||
|
||||
where og.organ_id = #{organId} and og.goods_id in
|
||||
|
||||
<foreach item="goodIds" collection="goodIds" open="(" separator="," close=")">
|
||||
#{goodIds}
|
||||
</foreach>
|
||||
|
||||
group by og.goods_id,og.height,og.width,og.color,og.goods_name,og.thickness,og.spec ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="seleTestSQL" resultType="java.util.Map">
|
||||
|
||||
@@ -359,6 +302,7 @@
|
||||
left join order_item oi on op.organ_id = oi.organ_id and op.order_id = oi.order_id and op.id = oi.plate_id
|
||||
|
||||
where og.organ_id = #{organId}
|
||||
and og.deleted = false
|
||||
and og.plan_id in
|
||||
<foreach collection="planIds" item="planIds" open="(" close=")" separator=",">
|
||||
#{planIds}
|
||||
@@ -421,6 +365,21 @@
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectOrderPlate"
|
||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
|
||||
|
||||
|
||||
|
||||
select distinct order_id,
|
||||
create_time as updateTime
|
||||
from order_goods
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and plan_id = 0
|
||||
order by create_time;
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+30
-77
@@ -35,21 +35,17 @@
|
||||
<select id="selectOrderPage" resultMap="OrderPageMap">
|
||||
|
||||
select distinct
|
||||
o.id as orderId,
|
||||
o.order_date as orderDate,
|
||||
o.delivery_date as deliveryDate,
|
||||
o.customer as customer,
|
||||
o.address as address,
|
||||
o.custom_order_no as defineId,
|
||||
o.status as status,
|
||||
count( op.id) as num ,
|
||||
sum(op.area) as area
|
||||
o.id as orderId,
|
||||
o.order_date as orderDate,
|
||||
o.delivery_date as deliveryDate,
|
||||
o.customer as customer,
|
||||
o.address as address,
|
||||
o.custom_order_no as defineId,
|
||||
o.status as status
|
||||
|
||||
from orders o
|
||||
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -57,70 +53,23 @@
|
||||
</select>
|
||||
|
||||
|
||||
<!-- <where>
|
||||
a.deleted = false
|
||||
<!-- select distinct
|
||||
o.id as orderId,
|
||||
o.order_date as orderDate,
|
||||
o.delivery_date as deliveryDate,
|
||||
o.customer as customer,
|
||||
o.address as address,
|
||||
o.custom_order_no as defineId,
|
||||
o.status as status,
|
||||
count( op.id) as num ,
|
||||
sum(op.area) as area
|
||||
|
||||
and a.organ_id = #{organId}
|
||||
from orders o
|
||||
|
||||
and ( a.status = 3 or a.status = 2 or a.status = 1 )
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
|
||||
and opi.item_id is null
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted-->
|
||||
|
||||
<if test="pageReqVO.ids !=null">
|
||||
|
||||
and op.goods_id in
|
||||
<foreach collection="pageReqVO.ids" item="pageReqVO.ids" open="(" close=")" separator=",">
|
||||
#{pageReqVO.ids}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.orderId !=null">
|
||||
and a.id like concat('%',#{pageReqVO.orderId},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.consignee !=null">
|
||||
and a.customer like concat('%',#{pageReqVO.consignee},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.defaultId !=null">
|
||||
and a.custom_order_no like concat('%',#{pageReqVO.defaultId},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.consigneeAddress !=null">
|
||||
and a.address like concat('%',#{pageReqVO.consigneeAddress},'%')
|
||||
</if>
|
||||
|
||||
<if test="pageReqVO.createTime !=null">
|
||||
between #{pageReqVO.createTime.[0]} and #{pageReqVO.createTime.[1]}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
group by a.id, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no,a.create_time,a.update_time,a.status
|
||||
order by a.update_time desc ;-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- select distinct a.id
|
||||
|
||||
from `orders` a
|
||||
left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id
|
||||
inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id
|
||||
|
||||
${ew.customSqlSegment}-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id
|
||||
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||
-->
|
||||
<select id="selectDynamicSqlString" resultType="java.util.Map">
|
||||
${sqlStr}
|
||||
</select>
|
||||
@@ -305,8 +254,10 @@
|
||||
og.spec
|
||||
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@@ -324,8 +275,10 @@
|
||||
og.order_id as orderId,
|
||||
og.id as id
|
||||
from orders o
|
||||
left join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id
|
||||
left join order_plate op on og.organ_id = op.organ_id and og.id = op.goods_id and og.deleted = op.deleted
|
||||
|
||||
join order_goods og on o.organ_id = og.organ_id and o.id = og.order_id and og.plan_id = 0 and o.deleted = og.deleted
|
||||
|
||||
join order_plate op on o.organ_id = op.organ_id and o.deleted = op.deleted and o.id = op.order_id and op.isOptimized = false
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
+72
@@ -410,6 +410,7 @@
|
||||
AND organ_id = #{organId} and order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deletedById">
|
||||
DELETE FROM order_plate
|
||||
WHERE id IN
|
||||
@@ -865,4 +866,75 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<resultMap id="PlatePageMap" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
|
||||
<result property="orderId" column="orderId"/>
|
||||
<result property="plateId" column="plateId"/>
|
||||
<result property="area" column="area"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="selectNoPlanPlateList" resultMap="PlatePageMap">
|
||||
|
||||
select
|
||||
order_id as orderId,
|
||||
id as plateId,
|
||||
area as area
|
||||
|
||||
from order_plate
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updatePlateOptimized" parameterType="java.lang.Long">
|
||||
|
||||
update order_plate
|
||||
|
||||
set isOptimized = true
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
|
||||
and order_id in
|
||||
<foreach item="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||
#{orderIdList}
|
||||
</foreach>
|
||||
|
||||
and goods_id in
|
||||
<foreach item="ids" collection="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
and isOptimized = false
|
||||
|
||||
</update>
|
||||
|
||||
<update id="updateNoPlateOptimized">
|
||||
|
||||
update order_plate
|
||||
|
||||
set isOptimized = false
|
||||
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and order_id in
|
||||
<foreach item="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||
#{orderIdList}
|
||||
</foreach>
|
||||
and goods_id in
|
||||
<foreach item="ids" collection="ids" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
|
||||
and isOptimized = true
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
+60
-54
@@ -123,6 +123,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORGAN_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "名字为【{}】的组织已存在");
|
||||
ErrorCode ORGAN_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "域名为【{}】的组织已存在");
|
||||
ErrorCode ORGAN_DATA_CODE_NOT_EXISTS = new ErrorCode(1_002_015_006, "组织未配置数据源标识");
|
||||
ErrorCode ORGAN_ALREADY_EXISTS = new ErrorCode(1_002_015_007, "该新增组织已授权机台数量无需重复新增!");
|
||||
|
||||
// ========== 组织套餐 1-002-016-000 ==========
|
||||
ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "组织套餐不存在");
|
||||
@@ -196,12 +197,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode PROCESS_STATUS_DISABLE = new ErrorCode(1_002_027_003, "工序状态以已禁用");
|
||||
ErrorCode PROCESS_NAME_EXISTS = new ErrorCode(1_002_027_004, "工序名称已存在");
|
||||
|
||||
//=========== 工序组信息 1-002-029-000 ============
|
||||
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_029_010, "工序组不存在");
|
||||
ErrorCode PROCESS_GROUP_USED = new ErrorCode(1_002_029_011, "工序组已使用,禁止删除 ");
|
||||
ErrorCode PROCESS_GROUP_NAME_EXISTS = new ErrorCode(1_002_029_012, "工序名称已存在");
|
||||
ErrorCode PROCESS_GROUP_CUTTING_ERROR = new ErrorCode(1_002_029_012, "开料工序类型已经存在,禁止重复");
|
||||
ErrorCode PROCESS_GROUP_PACKING_ERROR = new ErrorCode(1_002_029_012, "打包工序类型已经存在,禁止重复");
|
||||
|
||||
// ========== 机台 1-002-029-000 ==========
|
||||
ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在");
|
||||
@@ -219,6 +214,9 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MACHINE_NUM_ERROR = new ErrorCode(1_002_029_011, "当前模板创建的机台数量已达到最大值,无法继续创建");
|
||||
ErrorCode MACHINE_NAME_ERROR = new ErrorCode(1_002_029_012, "当前机台名称已存在,请重新输入机台名称");
|
||||
ErrorCode MACHINETEMPLATE_NAME_ERROR = new ErrorCode(1_002_029_013, "当前机台模板的名称已存在,请重新输入机台模板名称");
|
||||
ErrorCode LABELINGMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_014, "当前机台关联的贴标机数据有误,请在高级配置中重新配置贴标机或选择其他模板");
|
||||
ErrorCode DRILLMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_015, "当前机台关联的钻孔机数据有误,请在钻孔模块中重新配置钻孔机或选择其他模板");
|
||||
|
||||
|
||||
// ========== 标签模板 1-002-300-000 ==========
|
||||
ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在");
|
||||
@@ -228,71 +226,79 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "默认标签模板无法删除");
|
||||
ErrorCode LABEL_ERROR = new ErrorCode(1_002_300_005, "当前标签错误,请重新配置标签");
|
||||
|
||||
|
||||
// ========== 系统数据源 1_002_301_000 ==========
|
||||
ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在");
|
||||
|
||||
|
||||
//=========== 工序组信息 1-002-031-000 ============
|
||||
ErrorCode PLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "板材不存在");
|
||||
|
||||
//=========== 板材信息 1-002-032-000 ============
|
||||
ErrorCode PLATE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_032_001, "导入板材数据不能为空!");
|
||||
ErrorCode PLATE_EXISTS = new ErrorCode(1_002_032_002, "板材存在");
|
||||
ErrorCode THE_CURRENT_BOARD_IS_NOT_SELECTED = new ErrorCode(1_002_032_003, "当前板材没有选择房间和柜体,请选择");
|
||||
ErrorCode THE_BOARD_HAS_BEEN_CUT_INTO_PIECES = new ErrorCode(1_002_032_004, "当前排单已有板材开料,禁止修改");
|
||||
//=========== 工序组信息 1-002-032-000 ============
|
||||
ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_032_001, "工序组不存在");
|
||||
ErrorCode PROCESS_GROUP_USED = new ErrorCode(1_002_032_002, "工序组已使用,禁止删除 ");
|
||||
ErrorCode PROCESS_GROUP_NAME_EXISTS = new ErrorCode(1_002_032_003, "工序名称已存在");
|
||||
ErrorCode PROCESS_GROUP_CUTTING_ERROR = new ErrorCode(1_002_032_004, "开料工序类型已经存在,禁止重复");
|
||||
ErrorCode PROCESS_GROUP_PACKING_ERROR = new ErrorCode(1_002_032_005, "打包工序类型已经存在,禁止重复");
|
||||
|
||||
|
||||
|
||||
//=========== 板材信息 1-002-033-000 ============
|
||||
ErrorCode REMAIN_PLATE_NOT_EXISTS = new ErrorCode(1_002_032_002, "板材不存在");
|
||||
|
||||
//=========== 板材信息 1-002-034-000 ============
|
||||
ErrorCode PROCESS_USER_NOT_EXISTS = new ErrorCode(1_002_032_002, "工序用户不存在");
|
||||
ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_032_003, "工序用户存在");
|
||||
|
||||
|
||||
//=========== 工序的生产状态 1-002-034-000 ============
|
||||
ErrorCode UNPROCESSED_BEFORE_PROCESSING = new ErrorCode(1_002_034_666, "未加工状态方可进行加工");
|
||||
|
||||
|
||||
// ========== 新增外部配件 1-002-035-000 ==========
|
||||
ErrorCode THE_ACCESSORY_NAME_CANNOT_BE_DUPLICATED = new ErrorCode(1_002_035_666, "配件名称不能重复");
|
||||
ErrorCode PLATE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_001, "导入板材数据不能为空!");
|
||||
ErrorCode PLATE_EXISTS = new ErrorCode(1_002_033_002, "板材存在");
|
||||
ErrorCode THE_CURRENT_BOARD_IS_NOT_SELECTED = new ErrorCode(1_002_033_003, "当前板材没有选择房间和柜体,请选择");
|
||||
ErrorCode THE_BOARD_HAS_BEEN_CUT_INTO_PIECES = new ErrorCode(1_002_033_004, "当前排单已有板材开料,禁止修改");
|
||||
ErrorCode REMAIN_PLATE_NOT_EXISTS = new ErrorCode(1_002_033_005, "板材不存在");
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_006, "设计板材不存在");
|
||||
ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_007, "生产板材导入数据不可以为空");
|
||||
ErrorCode PLATENO_ERROR = new ErrorCode(1_002_033_008, "当前板编号无对应包裹信息");
|
||||
|
||||
|
||||
|
||||
|
||||
//=========== 板材信息 1-002-035-000 ============
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_001, "设计板材不存再");
|
||||
ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_002, "生产板材导入数据不可以为空");
|
||||
ErrorCode PLATENO_ERROR = new ErrorCode(1_002_033_003, "当前板编号无对应包裹信息");
|
||||
|
||||
//=========== 配件信息 1-002-035-000 ============
|
||||
ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_034_001, "生产配件导入数据不可以为空");
|
||||
|
||||
//=========== 柜体信息 1-002-035-000 ============
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_035_001, "柜体信息不存在");
|
||||
|
||||
//=========== 柜体信息 1-002-035-000 ============
|
||||
ErrorCode ORDER_GROUP_NOT_EXISTS = new ErrorCode(1_002_036_001, "加工组信息不存在");
|
||||
//=========== 工序信息 1-002-034-000 ============
|
||||
ErrorCode PROCESS_USER_NOT_EXISTS = new ErrorCode(1_002_034_001, "工序用户不存在");
|
||||
ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_034_002, "工序用户存在");
|
||||
ErrorCode UNPROCESSED_BEFORE_PROCESSING = new ErrorCode(1_002_034_003, "未加工状态方可进行加工");
|
||||
|
||||
|
||||
//=========== 包裹信息 1-002-038-000 ============
|
||||
ErrorCode THE_CURRENT_PACKAGE_HAS_AN_UNSEALED_PACKAGE = new ErrorCode(1_002_038_666, "当前包裹还有未封包包裹");
|
||||
ErrorCode THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT = new ErrorCode(1_002_038_777, "当前包裹类型错误");
|
||||
ErrorCode FAILED_TO_MODIFY_THE_STATUS_OF_THE_CURRENT_PRODUCTION_ORDER = new ErrorCode(1_002_038_778, "修改当前生产单的工序状态和生产单的状态失败");
|
||||
ErrorCode NO_OPTIMIZATION_INFORMATION_AVAILABLE = new ErrorCode(1_002_038_779, "当前订单无优化信息");
|
||||
ErrorCode NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE = new ErrorCode(1_002_038_780, "已经是{}一条了");
|
||||
|
||||
// ========== 配件信息 1-002-035-000 ==========
|
||||
ErrorCode THE_ACCESSORY_NAME_CANNOT_BE_DUPLICATED = new ErrorCode(1_002_035_001, "配件名称不能重复");
|
||||
ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_035_002, "生产配件导入数据不可以为空");
|
||||
|
||||
|
||||
|
||||
//=========== 柜体信息 1-002-036-000 ============
|
||||
ErrorCode ORDER_BODY_NOT_EXISTS = new ErrorCode(1_002_036_001, "柜体信息不存在");
|
||||
|
||||
|
||||
|
||||
//=========== 加工组信息 1-002-037-000 ============
|
||||
ErrorCode ORDER_GROUP_NOT_EXISTS = new ErrorCode(1_002_037_001, "加工组信息不存在");
|
||||
|
||||
|
||||
|
||||
//=========== 包裹信息 1-002-040-000 ============
|
||||
ErrorCode THE_CURRENT_PACKAGE_HAS_AN_UNSEALED_PACKAGE = new ErrorCode(1_002_040_001, "当前包裹还有未封包包裹");
|
||||
ErrorCode THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT = new ErrorCode(1_002_040_002, "当前包裹类型错误");
|
||||
ErrorCode FAILED_TO_MODIFY_THE_STATUS_OF_THE_CURRENT_PRODUCTION_ORDER = new ErrorCode(1_002_040_003, "修改当前生产单的工序状态和生产单的状态失败");
|
||||
ErrorCode NO_OPTIMIZATION_INFORMATION_AVAILABLE = new ErrorCode(1_002_040_004, "当前订单无优化信息");
|
||||
ErrorCode NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE = new ErrorCode(1_002_040_005, "已经是{}一条了");
|
||||
|
||||
|
||||
//=========== 断言提示信息 1-002-041-000 ============
|
||||
ErrorCode ORDER_DATE_ERROR = new ErrorCode(1_002_041_001, "生产单信息不存在,请重新进入或切换生产单");
|
||||
ErrorCode ORDER_PLATE_ERROR = new ErrorCode(1_002_041_002, "生产单对应的板材信息不存在");
|
||||
|
||||
|
||||
|
||||
//=========== 应用信息 1-002-037-000 ============
|
||||
ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(1_002_037_001, "应用信息不存在");
|
||||
ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_037_001, "应用登陆失败");
|
||||
|
||||
ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误");
|
||||
ErrorCode DATA_ERR = new ErrorCode(1_002_038_002, "数据错误,需要清除数据重新导入");
|
||||
|
||||
ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_001, "余料板正在使用中,禁止修改");
|
||||
ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_002, "余料板未使用");
|
||||
ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_003, "余料板使用类型为不可核销类型");
|
||||
ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_004, "未选中余料板,请选择余料板");
|
||||
ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_003, "余料板正在使用中,禁止修改");
|
||||
ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_004, "余料板未使用");
|
||||
ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_005, "余料板使用类型为不可核销类型");
|
||||
ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "未选中余料板,请选择余料板");
|
||||
ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(1_002_038_007, "应用信息不存在");
|
||||
ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_038_008, "应用登陆失败");
|
||||
|
||||
|
||||
//=========== 用户的系统配置 1-002-039-000 ============
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.cf.imes.module.system.service.machine.MachineService;
|
||||
import com.cf.imes.module.system.service.machine.MachineTemplateService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,7 +42,7 @@ public class MachineController {
|
||||
@Operation(summary = "创建机台")
|
||||
//@PreAuthorize("@ss.hasPermission('machine::create')")
|
||||
@OperateLog(logArgs = false)
|
||||
public CommonResult<Long> createCutting(@Validated(CreateGroup.class) @RequestBody CuttingSaveReqVO createReqVO) {
|
||||
public CommonResult<Long> createCutting(@Validated(CreateGroup.class) @RequestBody CuttingSaveReqVO createReqVO) throws JsonProcessingException {
|
||||
return success(machineService.createCutting(createReqVO));
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.machine;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
@@ -22,7 +23,7 @@ public interface MachineService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createCutting(@Valid CuttingSaveReqVO createReqVO);
|
||||
Long createCutting(@Valid CuttingSaveReqVO createReqVO) throws JsonProcessingException;
|
||||
|
||||
/**
|
||||
* 更新机台
|
||||
@@ -69,7 +70,9 @@ public interface MachineService {
|
||||
|
||||
Map<Integer, List<MachineVO>> getMachineTree(Long type);
|
||||
|
||||
Boolean auth(MachineOrgAuthReq vo);
|
||||
Boolean authInsert(MachineOrgAuthReq vo);
|
||||
|
||||
Boolean authUpdate(MachineOrgAuthReq vo);
|
||||
|
||||
PageResult<OrganMachineResp> organMachinePage(OrganMachinePage page);
|
||||
|
||||
|
||||
+153
-37
@@ -32,7 +32,9 @@ import com.cf.imes.module.system.dal.mysql.machine.MachineMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateLimitMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.organ.OrganMapper;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -46,6 +48,7 @@ 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.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -92,7 +95,7 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createCutting(CuttingSaveReqVO createReqVO) {
|
||||
public Long createCutting(CuttingSaveReqVO createReqVO) throws JsonProcessingException {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
assert loginUser != null;
|
||||
|
||||
@@ -114,7 +117,9 @@ public class MachineServiceImpl implements MachineService {
|
||||
// 插入
|
||||
machineDO = MachineConvert.convert(createReqVO);
|
||||
|
||||
machineDO.setSetting(copyMachineDO.getSetting());
|
||||
String updatedJsonString = handleMachineSpecificConfiguration(machineDO, machineDO.getMachineType(),copyMachineDO.getSetting(),true);
|
||||
|
||||
machineDO.setSetting(updatedJsonString == null ? copyMachineDO.getSetting() : zipString(updatedJsonString));
|
||||
|
||||
machineDO.setId(null);
|
||||
|
||||
@@ -133,11 +138,13 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
// 创建新的机器对象
|
||||
machineDO = MachineConvert.convert(createReqVO);
|
||||
machineDO.setSetting(machineTemplateDO.getSetting());
|
||||
machineMapper.insert(machineDO);
|
||||
|
||||
// 处理不同机台类型的配置
|
||||
handleMachineSpecificConfiguration(machineDO, machineTemplateDO);
|
||||
String updatedJsonString = handleMachineSpecificConfiguration(machineDO, machineTemplateDO.getMachineType(), machineTemplateDO.getSetting(),false);
|
||||
|
||||
machineDO.setSetting(updatedJsonString == null ? machineTemplateDO.getSetting() : zipString(updatedJsonString));
|
||||
machineMapper.insert(machineDO);
|
||||
|
||||
|
||||
// 返回新机器的ID
|
||||
return machineDO.getId();
|
||||
@@ -146,67 +153,176 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
|
||||
// 判断机台的模板是否是钻孔机或封边机
|
||||
private void handleMachineSpecificConfiguration(MachineDO machineDO, MachineTemplateDO machineTemplateDO) {
|
||||
Integer machineType = machineTemplateDO.getMachineType();
|
||||
private String handleMachineSpecificConfiguration(MachineDO machineDO, Integer machineType,String machineSetting,Boolean isMachine) throws JsonProcessingException {
|
||||
|
||||
String updatedJsonString = null;
|
||||
|
||||
if (MachineTypeEnum.CUTTING.getType().equals(machineType)) {
|
||||
handleCuttingMachineConfiguration(machineDO, machineTemplateDO);
|
||||
updatedJsonString = handleCuttingMachineConfiguration(machineDO, machineSetting,isMachine);
|
||||
} else if (MachineTypeEnum.BANDING.getType().equals(machineType)) {
|
||||
handleBandingMachineConfiguration(machineDO, machineTemplateDO);
|
||||
updatedJsonString = handleBandingMachineConfiguration(machineDO, machineSetting,isMachine);
|
||||
}
|
||||
|
||||
return updatedJsonString;
|
||||
}
|
||||
|
||||
|
||||
// 创建贴标机
|
||||
private void handleCuttingMachineConfiguration(MachineDO machineDO, MachineTemplateDO machineTemplateDO) {
|
||||
private String handleCuttingMachineConfiguration(MachineDO machineDO, String machineSetting,Boolean isMachine) throws JsonProcessingException {
|
||||
|
||||
JsonNode cuttingSetting = JsonUtils.parseTree(unzipString(machineTemplateDO.getSetting()));
|
||||
String unzipMachineSetting = unzipString(machineSetting);
|
||||
|
||||
JsonNode cuttingSetting = JsonUtils.parseTree(unzipMachineSetting);
|
||||
|
||||
JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef");
|
||||
|
||||
boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean();
|
||||
|
||||
if (isAutoLabelEnabled && advancedConfigsRef.has("autoLabelModel")) {
|
||||
Integer autoLabelModel = advancedConfigsRef.get("autoLabelModel").asInt();
|
||||
createAndInsertMachine(autoLabelModel, machineDO, "开料" + machineDO.getName() + "-贴标机");
|
||||
Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt();
|
||||
|
||||
MachineDO newMachine ;
|
||||
|
||||
if(isMachine){
|
||||
|
||||
MachineDO machine = machineMapper.selectById(autoLabelModelId);
|
||||
if (machine != null) {
|
||||
newMachine = MachineDO.builder()
|
||||
.labelId(machine.getLabelId())
|
||||
.machineType(machine.getMachineType())
|
||||
.brandId(machine.getBrandId())
|
||||
.setting(machine.getSetting())
|
||||
.name("开料" + machineDO.getName() + "-贴标机")
|
||||
.build();
|
||||
|
||||
machineMapper.insert(newMachine);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipMachineSetting, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("advancedConfigsRef");
|
||||
advancedConfigs.put("autoLabelModel", newMachine.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MachineTemplateDO machineTemplate = machineTemplateMapper.selectById(autoLabelModelId);
|
||||
if (machineTemplate != null) {
|
||||
newMachine = MachineDO.builder()
|
||||
.labelId(machineDO.getLabelId())
|
||||
.machineType(machineTemplate.getMachineType())
|
||||
.brandId(machineTemplate.getBrandId())
|
||||
.setting(machineTemplate.getSetting())
|
||||
.name("开料" + machineDO.getName() + "-贴标机")
|
||||
.build();
|
||||
|
||||
machineMapper.insert(newMachine);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipMachineSetting, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("advancedConfigsRef");
|
||||
advancedConfigs.put("autoLabelModel", newMachine.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// 创建钻孔机
|
||||
private void handleBandingMachineConfiguration(MachineDO machineDO, MachineTemplateDO machineTemplateDO) {
|
||||
JsonNode drillSetting = JsonUtils.parseTree(unzipString(machineTemplateDO.getSetting()));
|
||||
private String handleBandingMachineConfiguration(MachineDO machineDO, String machineSetting,Boolean isMachine) throws JsonProcessingException {
|
||||
|
||||
String unzipMachineSetting = unzipString(machineSetting);
|
||||
|
||||
JsonNode drillSetting = JsonUtils.parseTree(unzipMachineSetting);
|
||||
|
||||
JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef");
|
||||
|
||||
boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean();
|
||||
|
||||
if (isDrillEnabled && cuttingModuleRef.has("drillModel")) {
|
||||
Integer drillModel = cuttingModuleRef.get("drillModel").asInt();
|
||||
createAndInsertMachine(drillModel, machineDO, "开料" + machineDO.getName() + "钻孔机");
|
||||
Integer drillModelId = cuttingModuleRef.get("drillModel").asInt();
|
||||
|
||||
MachineDO newMachine ;
|
||||
|
||||
if(isMachine){
|
||||
|
||||
MachineDO machine = machineMapper.selectById(drillModelId);
|
||||
if (machine != null) {
|
||||
newMachine = MachineDO.builder()
|
||||
.labelId(machine.getLabelId())
|
||||
.machineType(machine.getMachineType())
|
||||
.brandId(machine.getBrandId())
|
||||
.setting(machine.getSetting())
|
||||
.name("封边" + machineDO.getName() + "-钻孔机")
|
||||
.build();
|
||||
|
||||
machineMapper.insert(newMachine);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipMachineSetting, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("cuttingModuleRef");
|
||||
advancedConfigs.put("drillModel", newMachine.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串并打印输出
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MachineTemplateDO machineTemplate = machineTemplateMapper.selectById(drillModelId);
|
||||
if (machineTemplate != null) {
|
||||
newMachine = MachineDO.builder()
|
||||
.labelId(machineDO.getLabelId())
|
||||
.machineType(machineTemplate.getMachineType())
|
||||
.brandId(machineTemplate.getBrandId())
|
||||
.setting(machineTemplate.getSetting())
|
||||
.name("封边" + machineDO.getName() + "-钻孔机")
|
||||
.build();
|
||||
|
||||
machineMapper.insert(newMachine);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipMachineSetting, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("cuttingModuleRef");
|
||||
advancedConfigs.put("drillModel", newMachine.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串并打印输出
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void createAndInsertMachine(Integer modelId, MachineDO parentMachine, String machineName) {
|
||||
MachineTemplateDO template = machineTemplateMapper.selectById(modelId);
|
||||
|
||||
if (template != null) {
|
||||
MachineDO newMachine = MachineDO.builder()
|
||||
.labelId(parentMachine.getLabelId())
|
||||
.machineType(template.getMachineType())
|
||||
.brandId(template.getBrandId())
|
||||
.setting(template.getSetting())
|
||||
.name(machineName)
|
||||
.build();
|
||||
|
||||
machineMapper.insert(newMachine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+68
-20
@@ -24,6 +24,7 @@ import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateLimitM
|
||||
import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.organ.OrganMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -92,12 +93,12 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
MachineTemplateDO machineTemplateDO = machineTemplateMapper.selectMachine(reqVO.getBrandId(), reqVO.getMachineId());
|
||||
|
||||
templateDO.setSetting(machineTemplateDO.getSetting());
|
||||
String updatedJsonString = handleMachineType(templateDO.getName(),machineTemplateDO.getMachineType(),machineTemplateDO.getSetting());
|
||||
|
||||
templateDO.setSetting(updatedJsonString == null ? machineTemplateDO.getSetting() : JsonUtils.zipString(updatedJsonString));
|
||||
|
||||
machineTemplateMapper.insert(templateDO);
|
||||
|
||||
handleMachineType(machineTemplateDO, templateDO);
|
||||
|
||||
return templateDO.getId();
|
||||
}
|
||||
|
||||
@@ -481,68 +482,115 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
|
||||
// 判断机台模板的类型
|
||||
private void handleMachineType(MachineTemplateDO machineTemplateDO, MachineTemplateDO templateDO) {
|
||||
private String handleMachineType(String machineName,Integer machineType,String machineSetting) {
|
||||
|
||||
if(machineTemplateDO.getMachineType().equals(MachineTypeEnum.CUTTING.getType())) {
|
||||
handleCuttingMachine(machineTemplateDO, templateDO);
|
||||
} else if(machineTemplateDO.getMachineType().equals(MachineTypeEnum.BANDING.getType())) {
|
||||
handleBandingMachine(machineTemplateDO, templateDO);
|
||||
String updatedJsonString = null;
|
||||
|
||||
if(machineType.equals(MachineTypeEnum.CUTTING.getType())) {
|
||||
updatedJsonString = handleCuttingMachine(machineName, machineSetting);
|
||||
} else if(machineType.equals(MachineTypeEnum.BANDING.getType())) {
|
||||
updatedJsonString = handleBandingMachine(machineName, machineSetting);
|
||||
}
|
||||
return updatedJsonString;
|
||||
}
|
||||
|
||||
private void handleCuttingMachine(MachineTemplateDO machineTemplateDO, MachineTemplateDO templateDO) {
|
||||
|
||||
JsonNode cuttingSetting = JsonUtils.parseTree(unzipString(machineTemplateDO.getSetting()));
|
||||
private String handleCuttingMachine(String machineName, String machineSetting) {
|
||||
|
||||
String unzipString = unzipString(machineSetting);
|
||||
|
||||
JsonNode cuttingSetting = JsonUtils.parseTree(unzipString);
|
||||
|
||||
JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef");
|
||||
|
||||
boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean();
|
||||
|
||||
if(isAutoLabelEnabled && advancedConfigsRef.get("autoLabelBrand") != null && advancedConfigsRef.get("autoLabelModel") != null){
|
||||
|
||||
Integer autoLabelModel = advancedConfigsRef.get("autoLabelModel").asInt();
|
||||
MachineTemplateDO labelingMachineTemplateDO = machineTemplateMapper.selectById(autoLabelModel);
|
||||
Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt();
|
||||
|
||||
if(labelingMachineTemplateDO != null) {
|
||||
try {
|
||||
|
||||
MachineTemplateDO labelingMachineTemplateDO = machineTemplateMapper.selectById(autoLabelModelId);
|
||||
|
||||
MachineTemplateDO labelingMachineDO = MachineTemplateDO.builder()
|
||||
.machineType(labelingMachineTemplateDO.getMachineType())
|
||||
.brandId(labelingMachineTemplateDO.getBrandId())
|
||||
.setting(labelingMachineTemplateDO.getSetting())
|
||||
.name("开料" + templateDO.getName() + "-贴标机")
|
||||
.name("开料" + machineName + "-贴标机")
|
||||
.build();
|
||||
|
||||
machineTemplateMapper.insert(labelingMachineDO);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipString, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("advancedConfigsRef");
|
||||
advancedConfigs.put("autoLabelModel", labelingMachineDO.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
throw exception(LABELINGMACHINE_RELATED_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void handleBandingMachine(MachineTemplateDO machineTemplateDO, MachineTemplateDO templateDO) {
|
||||
private String handleBandingMachine(String machineName, String machineSetting){
|
||||
|
||||
String unzipString = unzipString(machineSetting);
|
||||
|
||||
JsonNode drillSetting = JsonUtils.parseTree(unzipString);
|
||||
|
||||
JsonNode drillSetting = JsonUtils.parseTree(unzipString(machineTemplateDO.getSetting()));
|
||||
JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef");
|
||||
|
||||
boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean();
|
||||
|
||||
if(isDrillEnabled && cuttingModuleRef.get("drillBrand") != null && cuttingModuleRef.get("drillModel") != null){
|
||||
|
||||
Integer drillModel = cuttingModuleRef.get("drillModel").asInt();
|
||||
MachineTemplateDO drillMachineTemplateDO = machineTemplateMapper.selectById(drillModel);
|
||||
Integer drillModelId = cuttingModuleRef.get("drillModel").asInt();
|
||||
|
||||
if(drillMachineTemplateDO != null) {
|
||||
try {
|
||||
|
||||
MachineTemplateDO drillMachineTemplateDO = machineTemplateMapper.selectById(drillModelId);
|
||||
|
||||
MachineTemplateDO drillMachineDO = MachineTemplateDO.builder()
|
||||
.machineType(drillMachineTemplateDO.getMachineType())
|
||||
.brandId(drillMachineTemplateDO.getBrandId())
|
||||
.setting(drillMachineTemplateDO.getSetting())
|
||||
.name("开料" + templateDO.getName() + "钻孔机")
|
||||
.name("封边" + machineName + "-钻孔机")
|
||||
.build();
|
||||
|
||||
machineTemplateMapper.insert(drillMachineDO);
|
||||
|
||||
// 创建 ObjectMapper 对象
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
// 将 JSON 字符串解析为 Map
|
||||
Map map = mapper.readValue(unzipString, Map.class);
|
||||
|
||||
// 修改值
|
||||
Map<String, Object> advancedConfigs = (Map<String, Object>) map.get("cuttingModuleRef");
|
||||
advancedConfigs.put("drillModel", drillMachineDO.getId());
|
||||
|
||||
// 将 Map 转换为 JSON 字符串
|
||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
throw exception(DRILLMACHINE_RELATED_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,83 @@
|
||||
PUT imes_order_remain_plate_model
|
||||
PUT imes_order_optimize_plate_model
|
||||
{
|
||||
"settings": {},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"avgUsageRateAll": {
|
||||
"type": "long"
|
||||
},
|
||||
"avgUsageRateExcludeLastBoard": {
|
||||
"type": "long"
|
||||
},
|
||||
"blockPlaceInfo": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"boardCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"createTime": {
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"creator": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"cutBorder": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutKnifeGap": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutKnifeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutedBoardInfo": {
|
||||
"properties": {
|
||||
"cutedBoardList": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutedBoardNumber": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"diameter": {
|
||||
"type": "long"
|
||||
},
|
||||
"goodsId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"helpCutGap": {
|
||||
"type": "long"
|
||||
},
|
||||
"helpKnifeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"planId": {
|
||||
"type": "long"
|
||||
"isHelpCut": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isOptimized": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"length": {
|
||||
"type": "long"
|
||||
},
|
||||
"width": {
|
||||
"maxBoardId": {
|
||||
"type": "long"
|
||||
},
|
||||
"thickness": {
|
||||
"minBoardId": {
|
||||
"type": "long"
|
||||
},
|
||||
"orderId": {
|
||||
"type": "long"
|
||||
},
|
||||
"orgLength": {
|
||||
@@ -24,50 +86,73 @@ PUT imes_order_remain_plate_model
|
||||
"orgWidth": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutBorder": {
|
||||
"organId": {
|
||||
"type": "long"
|
||||
},
|
||||
"diameter": {
|
||||
"placeBlockNumber": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutKnifeGap": {
|
||||
"placeBoardNumber": {
|
||||
"type": "long"
|
||||
},
|
||||
"planId": {
|
||||
"type": "long"
|
||||
},
|
||||
"preMillingSize": {
|
||||
"type": "long"
|
||||
},
|
||||
"isHelpCut": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"helpCutGap": {
|
||||
"type": "long"
|
||||
},
|
||||
"cutKnifeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"helpKnifeId": {
|
||||
"type": "long"
|
||||
},
|
||||
"isOptimized": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"boardCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"remainBoardCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"minBoardId": {
|
||||
"remainBoardInfo": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"remainBoardList": {
|
||||
"properties": {
|
||||
"color": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"count": {
|
||||
"type": "long"
|
||||
},
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"isHandAdd": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"length": {
|
||||
"type": "float"
|
||||
},
|
||||
"material": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"texture": {
|
||||
"type": "long"
|
||||
},
|
||||
"thickness": {
|
||||
"type": "float"
|
||||
},
|
||||
"width": {
|
||||
"type": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thickness": {
|
||||
"type": "long"
|
||||
},
|
||||
"maxBoardId": {
|
||||
"type": "long"
|
||||
"updateTime": {
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"avgUsageRateAll": {
|
||||
"type": "long"
|
||||
},
|
||||
"avgUsageRateExcludeLastBoard": {
|
||||
"type": "long"
|
||||
"updater": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"usageRateLastBoard": {
|
||||
"type": "long"
|
||||
@@ -81,38 +166,9 @@ PUT imes_order_remain_plate_model
|
||||
}
|
||||
}
|
||||
},
|
||||
"blockPlaceInfo": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"remainBoardInfo": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"createTime": {
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"creator": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "date",
|
||||
"format": "strict_date_optional_time||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"updater": {
|
||||
"type": "keyword"
|
||||
"width": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
Reference in New Issue
Block a user