mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
1、枚举统一魔法值
2、错误码规范 3、部分sql语句增加条件走索引,mycat语法修正
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, "源数据查询失败");
|
||||
}
|
||||
|
||||
+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;
|
||||
}
|
||||
+7
-24
@@ -1,9 +1,9 @@
|
||||
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;
|
||||
@@ -11,7 +11,6 @@ import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
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;
|
||||
@@ -35,30 +34,21 @@ 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.enums.OrderPlanStatusEnum;
|
||||
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;
|
||||
|
||||
@@ -68,9 +58,6 @@ import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.e
|
||||
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 io.netty.handler.codec.http2.Http2HeadersEncoder;
|
||||
import io.netty.handler.codec.http2.Http2HeadersDecoder;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@@ -182,7 +169,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
planMapper.updateById(PlanDO.builder()
|
||||
.id(planId)
|
||||
.status(2)
|
||||
.status(OrderPlanStatusEnum.OPENING.getCode())
|
||||
.build());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@@ -290,22 +277,18 @@ 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只能传一个");
|
||||
}
|
||||
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
|
||||
|
||||
+12
-11
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
@@ -23,6 +22,9 @@ import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.planitem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderItemType;
|
||||
import com.cf.imes.module.executor.enums.OrderPlanStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderPlateFilterTypeEnum;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -35,7 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -179,7 +180,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if (planDO == null) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
if (planDO.getStatus().equals(2) || planDO.getStatus().equals(3)) {
|
||||
if (OrderPlanStatusEnum.OPENING.getCode().equals(planDO.getStatus()) || OrderPlanStatusEnum.OPENED.getCode().equals(planDO.getStatus())) {
|
||||
throw exception(PLAN_NOT_ALLOW_DELETE);
|
||||
}
|
||||
// 删除
|
||||
@@ -303,13 +304,13 @@ public class PlanServiceImpl implements PlanService {
|
||||
.orderByDesc("a.create_time");
|
||||
List<Integer> filterTypes = new ArrayList<>();
|
||||
if (Objects.nonNull(pageReqVO.getHoleThrough()) && pageReqVO.getHoleThrough()) {
|
||||
filterTypes.add(1);
|
||||
filterTypes.add(OrderPlateFilterTypeEnum.HAS_CUT_THROUGH_SHAPE.getCode());
|
||||
}
|
||||
if (Objects.nonNull(pageReqVO.getBurrow()) && pageReqVO.getBurrow()) {
|
||||
filterTypes.add(2);
|
||||
filterTypes.add(OrderPlateFilterTypeEnum.HAS_CUT_PUNCH.getCode());
|
||||
}
|
||||
if (Objects.nonNull(pageReqVO.getTwoDimensionalToolPath()) && pageReqVO.getTwoDimensionalToolPath()) {
|
||||
filterTypes.add(4);
|
||||
filterTypes.add(OrderPlateFilterTypeEnum.HAS_2D_KNIFE_PATHS.getCode());
|
||||
}
|
||||
|
||||
queryWrapperX.inIfPresent("op.filter_type", filterTypes);
|
||||
@@ -350,7 +351,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.planId(req.getPlanId())
|
||||
.orderId(obj.getOrderId())
|
||||
.plateId(obj.getPlateId())
|
||||
.type(1)
|
||||
.type(OrderItemType.BOARD.getCode())
|
||||
.build());
|
||||
|
||||
planItemDOS.add(PlanItemDO.builder()
|
||||
@@ -370,7 +371,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
if (planDO == null) {
|
||||
throw exception(PLAN_NOT_EXISTS);
|
||||
}
|
||||
if (planDO.getStatus().equals(0) || planDO.getStatus().equals(1)) {
|
||||
if (OrderPlanStatusEnum.NEW.getCode().equals(planDO.getStatus()) || OrderPlanStatusEnum.APPLY.getCode().equals(planDO.getStatus())) {
|
||||
throw exception(PLAN_NOT_ALLOW_CANCEL);
|
||||
}
|
||||
Set<Long> itemIds = planItemMapper.selectList(new LambdaQueryWrapperX<PlanItemDO>().eq(PlanItemDO::getPlanId, id))
|
||||
@@ -386,13 +387,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(OrderPlateFilterTypeEnum.HAS_CUT_THROUGH_SHAPE.getCode());
|
||||
}
|
||||
if (Objects.nonNull(vo.getBurrow()) && vo.getBurrow()) {
|
||||
filterTypes.add(2);
|
||||
filterTypes.add(OrderPlateFilterTypeEnum.HAS_CUT_PUNCH.getCode());
|
||||
}
|
||||
if (Objects.nonNull(vo.getTwoDimensionalToolPath()) && vo.getTwoDimensionalToolPath()) {
|
||||
filterTypes.add(4);
|
||||
filterTypes.add(OrderPlateFilterTypeEnum.HAS_2D_KNIFE_PATHS.getCode());
|
||||
}
|
||||
|
||||
queryWrapperX.eq("p.plan_id", vo.getPlanId())
|
||||
|
||||
+11
-6
@@ -25,9 +25,9 @@
|
||||
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
|
||||
CASE WHEN front_model_count = 0 or a.back_hole_count = 0 or a.side_hole_count = 0 THEN '否' ELSE '是' END 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
|
||||
<where>
|
||||
@@ -47,7 +47,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,10 +80,15 @@
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user