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:
+18
-1
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.executor.service.optimizeplan;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
@@ -22,6 +21,7 @@ import co.elastic.clients.elasticsearch.sql.TranslateResponse;
|
||||
import co.elastic.clients.json.JsonData;
|
||||
import co.elastic.clients.json.JsonpMappingException;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
@@ -30,6 +30,7 @@ import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
@@ -73,6 +74,8 @@ import com.cf.imes.module.system.api.systemconfig.dto.ProcessSchemeDTO;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -98,6 +101,7 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RefreshScope
|
||||
public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
@Resource
|
||||
@@ -151,6 +155,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
@Resource
|
||||
private PlateGoodMapper plateGoodMapper;
|
||||
|
||||
@Value("${chenfeng.plan.create.plate-threshold:20000}")
|
||||
private int planCreatePlateThreshold;
|
||||
|
||||
private static final String FIELD_ORDER_ID = "orderId";
|
||||
private static final String FIELD_PLATE_ID = "plateId";
|
||||
private static final String FIELD_PLAN_ID = "planId";
|
||||
@@ -773,6 +780,16 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
AssertUtils.notEmpty(orderDOS,THIS_ORDER_PLATE_DATA_ERROR);
|
||||
|
||||
// 查询未排单的小板数量
|
||||
Long unplanPlateNum = plateMapper.selectCount(new LambdaQueryWrapper<PlateDO>()
|
||||
.in(PlateDO::getOrderId, orderIds)
|
||||
.in(PlateDO::getGoodsId, orderGoodsIds)
|
||||
.eq(PlateDO::getPlanId, 0)
|
||||
.eq(PlateDO::getDeleted, false));
|
||||
if (planCreatePlateThreshold < unplanPlateNum) {
|
||||
throw ServiceExceptionUtil.exception(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold);
|
||||
}
|
||||
|
||||
List<PlateDetailRespVO> plateDetailRespVOS = plateMapper.selectNoPlanPlate(orderIds, orderGoodsIds, getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDetailRespVOS,ORDER_PLATE_ERROR);
|
||||
|
||||
+1
@@ -342,6 +342,7 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode PLAN_IS_OPERATOR = new ErrorCode(1_002_041_052, "当前排单正在被用户:{} 操作,无法继续操作");
|
||||
public static final ErrorCode PLAN_IS_OPERATOR_NOT = new ErrorCode(1_002_041_053, "排单:{} ,正在被用户:{} 操作,无法继续操作");
|
||||
public static final ErrorCode ORDER_PLAN_DATA_ERROR = new ErrorCode(1_002_041_054, "生产单/排单数据有误,请查看对应的数据");
|
||||
public static final ErrorCode ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR = new ErrorCode(1_002_041_055, "达到排单板件上限{}片,请减少选择板件数量后创建排单");
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user