mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、cad拆单造型/侧面造型/二维刀路修正判定规则;2、订单详情接口增加属性;3、新增cad任务查询接口、修复cad异步拆单任务和生产单的关联缺失;
This commit is contained in:
-4
@@ -5,8 +5,6 @@ import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.plan.service.orderImport.WebCadOrderImportService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -24,8 +22,6 @@ import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT
|
||||
@Tag(name = "管理后台 - 生产单导入管理")
|
||||
@RestController
|
||||
@RequestMapping("/plan/order")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class OrderImportController {
|
||||
@Resource
|
||||
private WebCadOrderImportService webCadOrderImportService;
|
||||
|
||||
+16
-1
@@ -57,7 +57,7 @@ public class WebCadDataBlockReqVO {
|
||||
private Double offsetX;
|
||||
private Double offsetY;
|
||||
private Boolean isArcBase;
|
||||
private Boolean isSpecialShape;
|
||||
private boolean isSpecialShape;
|
||||
private String remark;
|
||||
private Double kaiLiaoHeight;
|
||||
private Double kaiLiaoWidth;
|
||||
@@ -82,6 +82,9 @@ public class WebCadDataBlockReqVO {
|
||||
private boolean has2DModel;
|
||||
private boolean has3DModel;
|
||||
private String boardTypeName;
|
||||
private boolean isModel;
|
||||
private boolean isSideModel;
|
||||
private boolean hasSide2DModel;
|
||||
|
||||
private List<List<String>> allRemarkList;
|
||||
|
||||
@@ -90,6 +93,18 @@ public class WebCadDataBlockReqVO {
|
||||
|
||||
private List<Integer> groupIds = new ArrayList<>();
|
||||
|
||||
public void setIsSpecialShape(boolean specialShape) {
|
||||
isSpecialShape = specialShape;
|
||||
}
|
||||
|
||||
public void setIsSideModel(boolean sideModel) {
|
||||
isSideModel = sideModel;
|
||||
}
|
||||
|
||||
public void setIsModel(boolean model) {
|
||||
isModel = model;
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class FrontBackHolesDTO {
|
||||
|
||||
+2
-2
@@ -51,12 +51,12 @@ public class OrderImportTaskDO extends BaseDO {
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 导入状态
|
||||
* 导入状态,参考OrderImportStatusEnum
|
||||
*/
|
||||
private Integer importStatus;
|
||||
|
||||
/**
|
||||
* 消费状态
|
||||
* 消费状态,参考OrderImportTaskStatusEnum
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
+15
@@ -224,6 +224,21 @@ public class PlateDO extends BaseDO {
|
||||
* 是否造型
|
||||
*/
|
||||
private Boolean isSculpt;
|
||||
|
||||
/**
|
||||
* 是否侧面造型
|
||||
*/
|
||||
private Boolean isSideSculpt;
|
||||
|
||||
/**
|
||||
* 是否二维刀路
|
||||
*/
|
||||
private Boolean has2DModel;
|
||||
|
||||
/**
|
||||
* 是否侧面二维刀路
|
||||
*/
|
||||
private Boolean hasSide2DModel;
|
||||
/**
|
||||
* 是否造型
|
||||
*/
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.plan.dal.mysql.orderImport;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -11,5 +11,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @since 2025/1/9 11:42
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderImportTaskMapper extends BaseMapper<OrderImportTaskDO> {
|
||||
public interface OrderImportTaskMapper extends BaseMapperX<OrderImportTaskDO> {
|
||||
}
|
||||
|
||||
+55
-24
@@ -1,11 +1,14 @@
|
||||
package com.cf.imes.module.plan.service.orderImport;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
@@ -13,10 +16,13 @@ import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.redis.config.ChenfengCacheProperties;
|
||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||
import com.cf.imes.module.executor.enums.DataTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportTaskStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataReqVO;
|
||||
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||
import com.cf.imes.module.plan.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.order.OrderMapper;
|
||||
@@ -59,6 +65,7 @@ import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.ge
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_FAILED;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_NOT_EXISTS_ERROR;
|
||||
|
||||
/**
|
||||
* 生产单导入服务Service实现类
|
||||
@@ -154,6 +161,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
boolean initAsyncSuccess = false;
|
||||
|
||||
Long taskId = null;
|
||||
OrderDO orderDO = null;
|
||||
JsonFactory factory = new JsonFactory();
|
||||
try (GZIPInputStream gzipInputStream = new GZIPInputStream(file.getInputStream());
|
||||
JsonParser parser = factory.createParser(gzipInputStream)) {
|
||||
@@ -173,6 +181,8 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
plateCount = parser.getIntValue();
|
||||
} else if ("fileName".equals(fieldName)) {
|
||||
fileName = parser.getText();
|
||||
} else if ("OrderNo".equals(fieldName)) {
|
||||
orderDO = analyzeOrder(parser.getText(), organId);
|
||||
} else if ("blockData".equals(fieldName)) {
|
||||
if (plateCount < webcadAsyncPlateThreshold) {
|
||||
// 上锁
|
||||
@@ -182,7 +192,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
WebCadDataReqVO webCadDataReqVO = mapper.readValue(parser, WebCadDataReqVO.class);
|
||||
WebCadOrderImportFactory webCadOrderImportFactory = new WebCadOrderImportFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper,
|
||||
WebCadOrderImportFactory webCadOrderImportFactory = new WebCadOrderImportFactory(organId, orderDO, snowFlakeGenerator, orderBodyMapper, plateMapper,
|
||||
idWorker, orderInputProcessor, goodsMapper, rawGoodsMapper, customPlateNoGenerateService, systemConfigApi, cadImportPlateNumThreshold, jdbcTemplate);
|
||||
webCadOrderImportFactory.analyzeTempData(webCadDataReqVO);
|
||||
} else {
|
||||
@@ -196,7 +206,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
JsonNode node = mapper.readTree(parser);
|
||||
|
||||
// 缓存请求,创建导入任务
|
||||
taskId = initiateTask(node, organId, fileName);
|
||||
taskId = initiateTask(node, organId, orderDO.getId(), fileName);
|
||||
|
||||
// 上锁
|
||||
addAsyncLock(taskId);
|
||||
@@ -237,6 +247,36 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
return sync;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析生产单信息
|
||||
*
|
||||
* @param orderNo
|
||||
*/
|
||||
private OrderDO analyzeOrder(String orderNo, Long organId) {
|
||||
// 查询生产单信息
|
||||
OrderDO orderDOFromOrderNo = orderMapper.selectOne(new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, NumberUtil.parseLong(orderNo))
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false));
|
||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
} else {
|
||||
Integer status = orderDOFromOrderNo.getStatus();
|
||||
// 更新生产单来源为webcad
|
||||
LambdaUpdateWrapper<OrderDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, orderDOFromOrderNo.getId())
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.set(OrderDO::getDataType, DataTypeEnum.API_IMPORT.getStatus());
|
||||
// 如果导入生产单为空单,则更新为新单
|
||||
if (OrderStatusEnum.EMPTY.getStatus().equals(status)) {
|
||||
lambdaUpdateWrapper.set(OrderDO::getStatus, OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
}
|
||||
orderMapper.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
return orderDOFromOrderNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存请求,发起异步
|
||||
*
|
||||
@@ -245,9 +285,20 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private Long initiateTask(JsonNode node, Long organId, String fileName) throws IOException {
|
||||
private Long initiateTask(JsonNode node, Long organId, Long orderId, String fileName) throws IOException {
|
||||
// 创建任务
|
||||
Long taskId = createImportTask(organId, fileName);
|
||||
Long taskId = (Long) snowFlakeGenerator.nextId(null);
|
||||
// 创建导入任务
|
||||
OrderImportTaskDO orderImportTaskDO = OrderImportTaskDO.builder()
|
||||
.id(taskId)
|
||||
.type(OrderImportTypeEnum.API.getType())
|
||||
.importStatus(OrderImportStatusEnum.IMPORT_NOT_YET.getStatus())
|
||||
.status(OrderImportTaskStatusEnum.CREATE_NOT_CONSUME.getStatus())
|
||||
.fileName(fileName)
|
||||
.orderId(orderId)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderImportTaskMapper.insert(orderImportTaskDO);
|
||||
// 缓存请求到本地磁盘
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
File file = new File(webcadJsonCachePath + File.separator + taskId + ".json");
|
||||
@@ -334,24 +385,4 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
||||
FileUtil.del(webcadJsonCachePath + File.separator + taskId + ".json");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建导入任务
|
||||
*
|
||||
* @return taskId
|
||||
*/
|
||||
private Long createImportTask(Long organId, String fileName) {
|
||||
Long taskId = (Long) snowFlakeGenerator.nextId(null);
|
||||
// 创建导入任务
|
||||
OrderImportTaskDO orderImportTaskDO = OrderImportTaskDO.builder()
|
||||
.id(taskId)
|
||||
.type(OrderImportTypeEnum.API.getType())
|
||||
.importStatus(OrderImportStatusEnum.IMPORT_NOT_YET.getStatus())
|
||||
.status(OrderImportTaskStatusEnum.CREATE_NOT_CONSUME.getStatus())
|
||||
.fileName(fileName)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderImportTaskMapper.insert(orderImportTaskDO);
|
||||
return taskId;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-5
@@ -661,15 +661,21 @@ public class WebCadOrderImportAsyncFactory {
|
||||
* @param block
|
||||
*/
|
||||
private void createPlate(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block) {
|
||||
// 是否矩形,不是矩形那就是异形
|
||||
Boolean unRegular = !block.getIsRect();
|
||||
// 是否异形
|
||||
Boolean isSpecialShape = block.isSpecialShape();
|
||||
// 是否侧面造型
|
||||
boolean sideModel = block.isSideModel();
|
||||
// 是否有二维刀路
|
||||
boolean has2DModel = block.isHas2DModel();
|
||||
// 是否有侧面二维刀路
|
||||
boolean hasSide2DModel = block.isHasSide2DModel();
|
||||
// 是否造型
|
||||
boolean isModel = (block.getFrontModelCount() + block.getBackModelCount()) > 0 || block.isHas2DModel() || block.isHas3DModel();
|
||||
boolean isModel = block.isModel() || sideModel || has2DModel || hasSide2DModel || block.isHas3DModel();
|
||||
// 是否排孔
|
||||
boolean isRawHole = (block.getFrontHoleCount() + block.getBackHoleCount()) > 0;
|
||||
|
||||
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(unRegular));
|
||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(isSpecialShape));
|
||||
|
||||
// 柜体长宽深
|
||||
orderBodyDO.setWidth(block.getCabinetWidth());
|
||||
@@ -712,8 +718,11 @@ public class WebCadOrderImportAsyncFactory {
|
||||
.holeFace(block.getHoleFace())
|
||||
.isDoor(block.getIsDoor())
|
||||
.openDoorType(block.getOpenDoorType())
|
||||
.isSpecialShaped(unRegular)
|
||||
.isSpecialShaped(isSpecialShape)
|
||||
.isSculpt(isModel)
|
||||
.isSideSculpt(sideModel)
|
||||
.has2DModel(has2DModel)
|
||||
.hasSide2DModel(hasSide2DModel)
|
||||
.isRowHole(isRawHole)
|
||||
.customPlateNoBuilder(new StringBuilder())
|
||||
.holeArrange(block.getHoleArrange())
|
||||
|
||||
+48
-65
@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
@@ -17,9 +16,7 @@ import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
||||
import com.cf.imes.framework.mybatis.core.injector.BaseBatchMapper;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.enums.DataTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderItemTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataBlockRemarkVO;
|
||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataBlockReqVO;
|
||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
||||
@@ -46,9 +43,7 @@ import com.cf.imes.module.plan.dal.elasticsearch.Point;
|
||||
import com.cf.imes.module.plan.dal.elasticsearch.PointDetail;
|
||||
import com.cf.imes.module.plan.dal.elasticsearch.PointList;
|
||||
import com.cf.imes.module.plan.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
||||
@@ -78,7 +73,6 @@ import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPO
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_NOT_EXISTS_ERROR;
|
||||
import static com.cf.imes.module.plan.service.order.OrderInputProcessor.ORDER_PLATE_MODEL;
|
||||
|
||||
/**
|
||||
@@ -94,8 +88,6 @@ public class WebCadOrderImportFactory {
|
||||
*/
|
||||
private static final int BATCH_THRESHOLD_NUMBER = 1000;
|
||||
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
private SnowFlakeGenerator snowFlakeGenerator;
|
||||
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
@@ -184,7 +176,7 @@ public class WebCadOrderImportFactory {
|
||||
private boolean plateNumReachThreshold = false;
|
||||
|
||||
public WebCadOrderImportFactory(Long organId,
|
||||
OrderMapper orderMapper,
|
||||
OrderDO orderDO,
|
||||
SnowFlakeGenerator snowFlakeGenerator,
|
||||
OrderBodyMapper orderBodyMapper,
|
||||
PlateMapper plateMapper,
|
||||
@@ -197,7 +189,8 @@ public class WebCadOrderImportFactory {
|
||||
int cadImportPlateNumThreshold,
|
||||
JdbcTemplate jdbcTemplate) {
|
||||
this.organId = organId;
|
||||
this.orderMapper = orderMapper;
|
||||
this.orderDO = orderDO;
|
||||
this.orderId = orderDO.getId();
|
||||
this.snowFlakeGenerator = snowFlakeGenerator;
|
||||
this.orderBodyMapper = orderBodyMapper;
|
||||
this.plateMapper = plateMapper;
|
||||
@@ -217,18 +210,10 @@ public class WebCadOrderImportFactory {
|
||||
|
||||
public void analyzeTempData(WebCadDataReqVO webCadDataReqVO) {
|
||||
try {
|
||||
// 获取自定义板编号配置
|
||||
plateNoGenerateConfigVO = customPlateNoGenerateService.getPlateNoGenerateConfig(orderId);
|
||||
|
||||
log.debug("====================【cad拆单获取封边配置开始】====================");
|
||||
// 获取系统配置-封边对应配置
|
||||
getOrgSealEdgeConfig();
|
||||
log.debug("====================【cad拆单获取封边配置结束】====================");
|
||||
|
||||
log.debug("====================【cad拆单解析生产单开始】====================");
|
||||
// 解析生产单信息
|
||||
analyzeOrder(webCadDataReqVO.getOrderNo());
|
||||
log.debug("====================【cad拆单解析生产单结束】====================");
|
||||
log.debug("====================【cad拆单校验板件数量开始】====================");
|
||||
// 校验板件数量
|
||||
analyzePlateNum();
|
||||
log.debug("====================【cad拆单校验板件数量结束】====================");
|
||||
|
||||
log.debug("====================【cad拆单解析板材开始】====================");
|
||||
// 板材id对应板件
|
||||
@@ -318,30 +303,9 @@ public class WebCadOrderImportFactory {
|
||||
/**
|
||||
* 解析生产单信息
|
||||
*
|
||||
* @param orderNo
|
||||
* @param
|
||||
*/
|
||||
private void analyzeOrder(String orderNo) {
|
||||
// 查询生产单信息
|
||||
OrderDO orderDOFromOrderNo = orderMapper.selectOne(new LambdaUpdateWrapper<OrderDO>()
|
||||
.eq(OrderDO::getId, NumberUtil.parseLong(orderNo))
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false));
|
||||
if (ObjectUtil.isNull(orderDOFromOrderNo)) {
|
||||
throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo);
|
||||
} else {
|
||||
Integer status = orderDOFromOrderNo.getStatus();
|
||||
// 更新生产单来源为webcad
|
||||
LambdaUpdateWrapper<OrderDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderDO>().eq(OrderDO::getId, orderDOFromOrderNo.getId())
|
||||
.set(OrderDO::getDataType, DataTypeEnum.API_IMPORT.getStatus());
|
||||
// 如果导入生产单为空单,则更新为新单
|
||||
if (OrderStatusEnum.EMPTY.getStatus().equals(status)) {
|
||||
lambdaUpdateWrapper.set(OrderDO::getStatus, OrderStatusEnum.NEW_ORDER.getStatus());
|
||||
}
|
||||
orderMapper.update(lambdaUpdateWrapper);
|
||||
}
|
||||
orderDO = orderDOFromOrderNo;
|
||||
orderId = orderDOFromOrderNo.getId();
|
||||
|
||||
private void analyzePlateNum() {
|
||||
// 解析已有生产单下板件数量,超过两万不再导入
|
||||
Long existPlateCount = plateMapper.selectCount(new LambdaQueryWrapper<PlateDO>()
|
||||
.eq(PlateDO::getOrderId, orderId)
|
||||
@@ -496,6 +460,9 @@ public class WebCadOrderImportFactory {
|
||||
if (CollUtil.isEmpty(douleRoomTree)) {
|
||||
return;
|
||||
}
|
||||
// 获取自定义板编号配置
|
||||
plateNoGenerateConfigVO = customPlateNoGenerateService.getPlateNoGenerateConfig(orderId);
|
||||
|
||||
// 所有房间名
|
||||
List<String> roomNames = douleRoomTree.stream().map(WebCadDataDoubleRoomTreeReqVO::getName).collect(Collectors.toList());
|
||||
|
||||
@@ -553,7 +520,7 @@ public class WebCadOrderImportFactory {
|
||||
/**
|
||||
* 成倍创建柜体板件
|
||||
*
|
||||
* @param cadBody
|
||||
* @param count
|
||||
* @param roomId
|
||||
* @param roomName
|
||||
* @param listBody
|
||||
@@ -598,15 +565,21 @@ public class WebCadOrderImportFactory {
|
||||
* @param block
|
||||
*/
|
||||
private void createPlate(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block) {
|
||||
// 是否矩形,不是矩形那就是异形
|
||||
Boolean unRegular = !block.getIsRect();
|
||||
// 是否异形
|
||||
Boolean isSpecialShape = block.isSpecialShape();
|
||||
// 是否侧面造型
|
||||
boolean sideModel = block.isSideModel();
|
||||
// 是否有二维刀路
|
||||
boolean has2DModel = block.isHas2DModel();
|
||||
// 是否有侧面二维刀路
|
||||
boolean hasSide2DModel = block.isHasSide2DModel();
|
||||
// 是否造型
|
||||
boolean isModel = (block.getFrontModelCount() + block.getBackModelCount()) > 0 || block.isHas2DModel() || block.isHas3DModel();
|
||||
boolean isModel = block.isModel() || sideModel || has2DModel || hasSide2DModel || block.isHas3DModel();
|
||||
// 是否排孔
|
||||
boolean isRawHole = (block.getFrontHoleCount() + block.getBackHoleCount()) > 0;
|
||||
|
||||
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(unRegular));
|
||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(isSpecialShape));
|
||||
|
||||
// 柜体长宽深
|
||||
orderBodyDO.setWidth(block.getCabinetWidth());
|
||||
@@ -649,8 +622,11 @@ public class WebCadOrderImportFactory {
|
||||
.holeFace(block.getHoleFace())
|
||||
.isDoor(block.getIsDoor())
|
||||
.openDoorType(block.getOpenDoorType())
|
||||
.isSpecialShaped(unRegular)
|
||||
.isSpecialShaped(isSpecialShape)
|
||||
.isSculpt(isModel)
|
||||
.isSideSculpt(sideModel)
|
||||
.has2DModel(has2DModel)
|
||||
.hasSide2DModel(hasSide2DModel)
|
||||
.isRowHole(isRawHole)
|
||||
.customPlateNoBuilder(new StringBuilder())
|
||||
.holeArrange(block.getHoleArrange())
|
||||
@@ -692,7 +668,7 @@ public class WebCadOrderImportFactory {
|
||||
return;
|
||||
}
|
||||
plateDOS.add(plateDO);
|
||||
// orderPlateBatchInsertWithinThreshold(plateMapper, plateDOS, false);
|
||||
orderPlateBatchInsertWithinThreshold(plateDOS, false);
|
||||
|
||||
// 创建es造型数据
|
||||
createModel(plateDO, block, plateRemark);
|
||||
@@ -1201,6 +1177,10 @@ public class WebCadOrderImportFactory {
|
||||
if (ObjectUtil.isNull(parts)) {
|
||||
return;
|
||||
}
|
||||
log.debug("====================【cad拆单获取封边配置开始】====================");
|
||||
// 获取系统配置-封边对应配置
|
||||
getOrgSealEdgeConfig();
|
||||
log.debug("====================【cad拆单获取封边配置结束】====================");
|
||||
|
||||
for (WebCadDataDoubleRoomTreeReqVO room : parts) {
|
||||
// 房间名
|
||||
@@ -1637,7 +1617,7 @@ public class WebCadOrderImportFactory {
|
||||
private void orderPlateBatchInsertWithinThreshold(List<PlateDO> list, boolean isLast) {
|
||||
// 达到批量的阈值就做一次插入
|
||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_side_sculpt,has_2d_model,has_side_2d_model,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||
@@ -1677,18 +1657,21 @@ public class WebCadOrderImportFactory {
|
||||
ps.setLong(33, item.getModuleTypeId());
|
||||
ps.setBoolean(34, item.getIsSpecialShaped());
|
||||
ps.setBoolean(35, item.getIsSculpt());
|
||||
ps.setBoolean(36, item.getIsRowHole());
|
||||
ps.setBoolean(37, item.getIsOptimized());
|
||||
ps.setInt(38, item.getIsCutted());
|
||||
ps.setString(39, item.getFilterType());
|
||||
ps.setString(40, item.getRemark());
|
||||
ps.setBoolean(41, item.getIsCancel());
|
||||
ps.setBoolean(42, item.getDeleted());
|
||||
ps.setString(43, item.getCustomPlateNo());
|
||||
ps.setTimestamp(44, Timestamp.valueOf(item.getCreateTime()));
|
||||
ps.setTimestamp(45, Timestamp.valueOf(item.getUpdateTime()));
|
||||
ps.setString(46, item.getCreator());
|
||||
ps.setString(47, item.getUpdater());
|
||||
ps.setBoolean(36, item.getIsSideSculpt());
|
||||
ps.setBoolean(37, item.getHas2DModel());
|
||||
ps.setBoolean(38, item.getHasSide2DModel());
|
||||
ps.setBoolean(39, item.getIsRowHole());
|
||||
ps.setBoolean(40, item.getIsOptimized());
|
||||
ps.setInt(41, item.getIsCutted());
|
||||
ps.setString(42, item.getFilterType());
|
||||
ps.setString(43, item.getRemark());
|
||||
ps.setBoolean(44, item.getIsCancel());
|
||||
ps.setBoolean(45, item.getDeleted());
|
||||
ps.setString(46, item.getCustomPlateNo());
|
||||
ps.setTimestamp(47, Timestamp.valueOf(item.getCreateTime()));
|
||||
ps.setTimestamp(48, Timestamp.valueOf(item.getUpdateTime()));
|
||||
ps.setString(49, item.getCreator());
|
||||
ps.setString(50, item.getUpdater());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user