mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
1、cad拆单造型/侧面造型/二维刀路修正判定规则;2、订单详情接口增加属性;3、新增cad任务查询接口、修复cad异步拆单任务和生产单的关联缺失;
This commit is contained in:
+9
@@ -63,6 +63,15 @@ public class OrderPlatesDetailReqVO {
|
|||||||
@Schema(description = "是否造型", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "是否造型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Boolean isSculpt;
|
private Boolean isSculpt;
|
||||||
|
|
||||||
|
@Schema(description = "是否侧面造型")
|
||||||
|
private boolean isSideSculpt;
|
||||||
|
|
||||||
|
@Schema(description = "是否二维刀路")
|
||||||
|
private boolean has2DModel;
|
||||||
|
|
||||||
|
@Schema(description = "是否侧面二维刀路")
|
||||||
|
private boolean hasSide2DModel;
|
||||||
|
|
||||||
@Schema(description = "是否排孔", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "是否排孔", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Boolean isRowHole;
|
private Boolean isRowHole;
|
||||||
|
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.orderImportTask;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskRespVO;
|
||||||
|
import com.cf.imes.module.executor.service.orderImport.OrderImportTaskService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2025/5/15 9:19
|
||||||
|
*/
|
||||||
|
@Tag(name = "管理后台 - 生产单导入任务管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/executor/order/task")
|
||||||
|
public class OrderImportTaskController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderImportTaskService orderImportTaskService;
|
||||||
|
|
||||||
|
@GetMapping("")
|
||||||
|
@Operation(summary = "生产单导入任务查询")
|
||||||
|
public CommonResult<PageResult<OrderImportTaskRespVO>> webCadOrderImport(@Valid OrderImportTaskPageReqVO reqVO) {
|
||||||
|
return CommonResult.success(orderImportTaskService.getPage(reqVO));
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.orderImportTask.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2025/5/15 9:33
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 生产单导入任务分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OrderImportTaskPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "生产单号")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "导入文件名")
|
||||||
|
private String fileName;
|
||||||
|
}
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.orderImportTask.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2025/5/15 10:15
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 生产单导入任务 Response VO")
|
||||||
|
@Data
|
||||||
|
public class OrderImportTaskRespVO {
|
||||||
|
@Schema(description = "任务号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "关联生产单号")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
@Schema(description = "导入文件名")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
@Schema(description = "导入状态:0:创建未消费、10:创建已接收、20:消费成功、30:消费失败、40:消费超时")
|
||||||
|
private Integer importStatus;
|
||||||
|
|
||||||
|
@Schema(description = "任务状态:0:未导入、10:导入成功、20:导入失败")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "导入类型:0:EXCEL、1:JSON、2:XML、3:API")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
+9
@@ -160,6 +160,15 @@ public class PlateRespVO extends PageParam {
|
|||||||
@ExcelProperty("是否造型")
|
@ExcelProperty("是否造型")
|
||||||
private Boolean isSculpt;
|
private Boolean isSculpt;
|
||||||
|
|
||||||
|
@Schema(description = "是否侧面造型")
|
||||||
|
private boolean isSideSculpt;
|
||||||
|
|
||||||
|
@Schema(description = "是否二维刀路")
|
||||||
|
private boolean has2DModel;
|
||||||
|
|
||||||
|
@Schema(description = "是否侧面二维刀路")
|
||||||
|
private boolean hasSide2DModel;
|
||||||
|
|
||||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||||
@ExcelProperty("备注")
|
@ExcelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|||||||
+5
@@ -40,6 +40,11 @@ public class OrderImportTaskDO extends BaseDO {
|
|||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Long organId;
|
private Long organId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入类型,参考OrderImportTypeEnum
|
* 导入类型,参考OrderImportTypeEnum
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.dal.mysql.orderImport;
|
package com.cf.imes.module.executor.dal.mysql.orderImport;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -11,5 +11,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @since 2025/1/9 11:42
|
* @since 2025/1/9 11:42
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface OrderImportTaskMapper extends BaseMapper<OrderImportTaskDO> {
|
public interface OrderImportTaskMapper extends BaseMapperX<OrderImportTaskDO> {
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package com.cf.imes.module.executor.service.orderImport;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskRespVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2025/5/13 16:41
|
||||||
|
*/
|
||||||
|
public interface OrderImportTaskService {
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<OrderImportTaskRespVO> getPage(OrderImportTaskPageReqVO pageReqVO);
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package com.cf.imes.module.executor.service.orderImport;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.orderImportTask.vo.OrderImportTaskRespVO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.orderImport.OrderImportTaskMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2025/5/13 16:41
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderImportTaskServiceImpl implements OrderImportTaskService {
|
||||||
|
@Resource
|
||||||
|
private OrderImportTaskMapper orderImportTaskMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderImportTaskRespVO> getPage(OrderImportTaskPageReqVO pageReqVO) {
|
||||||
|
LambdaQueryWrapperX<OrderImportTaskDO> queryWrapper = new LambdaQueryWrapperX<OrderImportTaskDO>()
|
||||||
|
.eq(OrderImportTaskDO::getOrganId, OrganContextHolder.getOrganId())
|
||||||
|
.eqIfPresent(OrderImportTaskDO::getOrderId, pageReqVO.getOrderId())
|
||||||
|
.betweenIfPresent(OrderImportTaskDO::getCreateTime, pageReqVO.getCreateTime())
|
||||||
|
.eqIfPresent(OrderImportTaskDO::getFileName, pageReqVO.getFileName())
|
||||||
|
.orderByDesc(OrderImportTaskDO::getCreateTime);
|
||||||
|
return BeanUtils.toBean(orderImportTaskMapper.selectPage(pageReqVO, queryWrapper), OrderImportTaskRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
|
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
|
||||||
SELECT DISTINCT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
|
SELECT DISTINCT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
|
||||||
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt, p.unregular_point_count, p.front_hole_count,
|
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt,p.is_side_sculpt,p.has_2d_model, p.has_side_2d_model, p.unregular_point_count, p.front_hole_count,
|
||||||
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness,p.remark,g.color,p.is_row_hole, p.custom_plate_no
|
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness,p.remark,g.color,p.is_row_hole, p.custom_plate_no
|
||||||
FROM order_item i
|
FROM order_item i
|
||||||
RIGHT JOIN `order_plate` p ON i.plate_id = p.id
|
RIGHT JOIN `order_plate` p ON i.plate_id = p.id
|
||||||
|
|||||||
-4
@@ -5,8 +5,6 @@ import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
|||||||
import com.cf.imes.module.plan.service.orderImport.WebCadOrderImportService;
|
import com.cf.imes.module.plan.service.orderImport.WebCadOrderImportService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -24,8 +22,6 @@ import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.IMPORT
|
|||||||
@Tag(name = "管理后台 - 生产单导入管理")
|
@Tag(name = "管理后台 - 生产单导入管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/plan/order")
|
@RequestMapping("/plan/order")
|
||||||
@Validated
|
|
||||||
@Slf4j
|
|
||||||
public class OrderImportController {
|
public class OrderImportController {
|
||||||
@Resource
|
@Resource
|
||||||
private WebCadOrderImportService webCadOrderImportService;
|
private WebCadOrderImportService webCadOrderImportService;
|
||||||
|
|||||||
+16
-1
@@ -57,7 +57,7 @@ public class WebCadDataBlockReqVO {
|
|||||||
private Double offsetX;
|
private Double offsetX;
|
||||||
private Double offsetY;
|
private Double offsetY;
|
||||||
private Boolean isArcBase;
|
private Boolean isArcBase;
|
||||||
private Boolean isSpecialShape;
|
private boolean isSpecialShape;
|
||||||
private String remark;
|
private String remark;
|
||||||
private Double kaiLiaoHeight;
|
private Double kaiLiaoHeight;
|
||||||
private Double kaiLiaoWidth;
|
private Double kaiLiaoWidth;
|
||||||
@@ -82,6 +82,9 @@ public class WebCadDataBlockReqVO {
|
|||||||
private boolean has2DModel;
|
private boolean has2DModel;
|
||||||
private boolean has3DModel;
|
private boolean has3DModel;
|
||||||
private String boardTypeName;
|
private String boardTypeName;
|
||||||
|
private boolean isModel;
|
||||||
|
private boolean isSideModel;
|
||||||
|
private boolean hasSide2DModel;
|
||||||
|
|
||||||
private List<List<String>> allRemarkList;
|
private List<List<String>> allRemarkList;
|
||||||
|
|
||||||
@@ -90,6 +93,18 @@ public class WebCadDataBlockReqVO {
|
|||||||
|
|
||||||
private List<Integer> groupIds = new ArrayList<>();
|
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
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public static class FrontBackHolesDTO {
|
public static class FrontBackHolesDTO {
|
||||||
|
|||||||
+2
-2
@@ -51,12 +51,12 @@ public class OrderImportTaskDO extends BaseDO {
|
|||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入状态
|
* 导入状态,参考OrderImportStatusEnum
|
||||||
*/
|
*/
|
||||||
private Integer importStatus;
|
private Integer importStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消费状态
|
* 消费状态,参考OrderImportTaskStatusEnum
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
+15
@@ -224,6 +224,21 @@ public class PlateDO extends BaseDO {
|
|||||||
* 是否造型
|
* 是否造型
|
||||||
*/
|
*/
|
||||||
private Boolean isSculpt;
|
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;
|
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 com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -11,5 +11,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @since 2025/1/9 11:42
|
* @since 2025/1/9 11:42
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@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;
|
package com.cf.imes.module.plan.service.orderImport;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
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.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
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.id.core.util.SnowflakeIdWorker3rd;
|
||||||
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants;
|
||||||
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
|
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.config.ChenfengCacheProperties;
|
||||||
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
||||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
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.OrderImportStatusEnum;
|
||||||
import com.cf.imes.module.executor.enums.OrderImportTaskStatusEnum;
|
import com.cf.imes.module.executor.enums.OrderImportTaskStatusEnum;
|
||||||
import com.cf.imes.module.executor.enums.OrderImportTypeEnum;
|
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.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.dataobject.orderImport.OrderImportTaskDO;
|
||||||
import com.cf.imes.module.plan.dal.mysql.goods.GoodsMapper;
|
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.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.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_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_IMPORT_ORGANID_EMPTY_ERROR;
|
||||||
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_NOT_EXISTS_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产单导入服务Service实现类
|
* 生产单导入服务Service实现类
|
||||||
@@ -154,6 +161,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
boolean initAsyncSuccess = false;
|
boolean initAsyncSuccess = false;
|
||||||
|
|
||||||
Long taskId = null;
|
Long taskId = null;
|
||||||
|
OrderDO orderDO = null;
|
||||||
JsonFactory factory = new JsonFactory();
|
JsonFactory factory = new JsonFactory();
|
||||||
try (GZIPInputStream gzipInputStream = new GZIPInputStream(file.getInputStream());
|
try (GZIPInputStream gzipInputStream = new GZIPInputStream(file.getInputStream());
|
||||||
JsonParser parser = factory.createParser(gzipInputStream)) {
|
JsonParser parser = factory.createParser(gzipInputStream)) {
|
||||||
@@ -173,6 +181,8 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
plateCount = parser.getIntValue();
|
plateCount = parser.getIntValue();
|
||||||
} else if ("fileName".equals(fieldName)) {
|
} else if ("fileName".equals(fieldName)) {
|
||||||
fileName = parser.getText();
|
fileName = parser.getText();
|
||||||
|
} else if ("OrderNo".equals(fieldName)) {
|
||||||
|
orderDO = analyzeOrder(parser.getText(), organId);
|
||||||
} else if ("blockData".equals(fieldName)) {
|
} else if ("blockData".equals(fieldName)) {
|
||||||
if (plateCount < webcadAsyncPlateThreshold) {
|
if (plateCount < webcadAsyncPlateThreshold) {
|
||||||
// 上锁
|
// 上锁
|
||||||
@@ -182,7 +192,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
WebCadDataReqVO webCadDataReqVO = mapper.readValue(parser, WebCadDataReqVO.class);
|
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);
|
idWorker, orderInputProcessor, goodsMapper, rawGoodsMapper, customPlateNoGenerateService, systemConfigApi, cadImportPlateNumThreshold, jdbcTemplate);
|
||||||
webCadOrderImportFactory.analyzeTempData(webCadDataReqVO);
|
webCadOrderImportFactory.analyzeTempData(webCadDataReqVO);
|
||||||
} else {
|
} else {
|
||||||
@@ -196,7 +206,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
JsonNode node = mapper.readTree(parser);
|
JsonNode node = mapper.readTree(parser);
|
||||||
|
|
||||||
// 缓存请求,创建导入任务
|
// 缓存请求,创建导入任务
|
||||||
taskId = initiateTask(node, organId, fileName);
|
taskId = initiateTask(node, organId, orderDO.getId(), fileName);
|
||||||
|
|
||||||
// 上锁
|
// 上锁
|
||||||
addAsyncLock(taskId);
|
addAsyncLock(taskId);
|
||||||
@@ -237,6 +247,36 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
return sync;
|
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
|
* @return
|
||||||
* @throws IOException
|
* @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();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
File file = new File(webcadJsonCachePath + File.separator + taskId + ".json");
|
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");
|
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
|
* @param block
|
||||||
*/
|
*/
|
||||||
private void createPlate(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO 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;
|
boolean isRawHole = (block.getFrontHoleCount() + block.getBackHoleCount()) > 0;
|
||||||
|
|
||||||
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
||||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(unRegular));
|
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(isSpecialShape));
|
||||||
|
|
||||||
// 柜体长宽深
|
// 柜体长宽深
|
||||||
orderBodyDO.setWidth(block.getCabinetWidth());
|
orderBodyDO.setWidth(block.getCabinetWidth());
|
||||||
@@ -712,8 +718,11 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.holeFace(block.getHoleFace())
|
.holeFace(block.getHoleFace())
|
||||||
.isDoor(block.getIsDoor())
|
.isDoor(block.getIsDoor())
|
||||||
.openDoorType(block.getOpenDoorType())
|
.openDoorType(block.getOpenDoorType())
|
||||||
.isSpecialShaped(unRegular)
|
.isSpecialShaped(isSpecialShape)
|
||||||
.isSculpt(isModel)
|
.isSculpt(isModel)
|
||||||
|
.isSideSculpt(sideModel)
|
||||||
|
.has2DModel(has2DModel)
|
||||||
|
.hasSide2DModel(hasSide2DModel)
|
||||||
.isRowHole(isRawHole)
|
.isRowHole(isRawHole)
|
||||||
.customPlateNoBuilder(new StringBuilder())
|
.customPlateNoBuilder(new StringBuilder())
|
||||||
.holeArrange(block.getHoleArrange())
|
.holeArrange(block.getHoleArrange())
|
||||||
|
|||||||
+48
-65
@@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
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.generator.SnowFlakeGenerator;
|
||||||
import com.cf.imes.framework.mybatis.core.injector.BaseBatchMapper;
|
import com.cf.imes.framework.mybatis.core.injector.BaseBatchMapper;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
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.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.WebCadDataBlockRemarkVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataBlockReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataBlockReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderImport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
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.PointDetail;
|
||||||
import com.cf.imes.module.plan.dal.elasticsearch.PointList;
|
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.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.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.plate.PlateMapper;
|
||||||
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
||||||
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
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_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_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_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;
|
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 static final int BATCH_THRESHOLD_NUMBER = 1000;
|
||||||
|
|
||||||
private OrderMapper orderMapper;
|
|
||||||
|
|
||||||
private SnowFlakeGenerator snowFlakeGenerator;
|
private SnowFlakeGenerator snowFlakeGenerator;
|
||||||
|
|
||||||
private OrderBodyMapper orderBodyMapper;
|
private OrderBodyMapper orderBodyMapper;
|
||||||
@@ -184,7 +176,7 @@ public class WebCadOrderImportFactory {
|
|||||||
private boolean plateNumReachThreshold = false;
|
private boolean plateNumReachThreshold = false;
|
||||||
|
|
||||||
public WebCadOrderImportFactory(Long organId,
|
public WebCadOrderImportFactory(Long organId,
|
||||||
OrderMapper orderMapper,
|
OrderDO orderDO,
|
||||||
SnowFlakeGenerator snowFlakeGenerator,
|
SnowFlakeGenerator snowFlakeGenerator,
|
||||||
OrderBodyMapper orderBodyMapper,
|
OrderBodyMapper orderBodyMapper,
|
||||||
PlateMapper plateMapper,
|
PlateMapper plateMapper,
|
||||||
@@ -197,7 +189,8 @@ public class WebCadOrderImportFactory {
|
|||||||
int cadImportPlateNumThreshold,
|
int cadImportPlateNumThreshold,
|
||||||
JdbcTemplate jdbcTemplate) {
|
JdbcTemplate jdbcTemplate) {
|
||||||
this.organId = organId;
|
this.organId = organId;
|
||||||
this.orderMapper = orderMapper;
|
this.orderDO = orderDO;
|
||||||
|
this.orderId = orderDO.getId();
|
||||||
this.snowFlakeGenerator = snowFlakeGenerator;
|
this.snowFlakeGenerator = snowFlakeGenerator;
|
||||||
this.orderBodyMapper = orderBodyMapper;
|
this.orderBodyMapper = orderBodyMapper;
|
||||||
this.plateMapper = plateMapper;
|
this.plateMapper = plateMapper;
|
||||||
@@ -217,18 +210,10 @@ public class WebCadOrderImportFactory {
|
|||||||
|
|
||||||
public void analyzeTempData(WebCadDataReqVO webCadDataReqVO) {
|
public void analyzeTempData(WebCadDataReqVO webCadDataReqVO) {
|
||||||
try {
|
try {
|
||||||
// 获取自定义板编号配置
|
log.debug("====================【cad拆单校验板件数量开始】====================");
|
||||||
plateNoGenerateConfigVO = customPlateNoGenerateService.getPlateNoGenerateConfig(orderId);
|
// 校验板件数量
|
||||||
|
analyzePlateNum();
|
||||||
log.debug("====================【cad拆单获取封边配置开始】====================");
|
log.debug("====================【cad拆单校验板件数量结束】====================");
|
||||||
// 获取系统配置-封边对应配置
|
|
||||||
getOrgSealEdgeConfig();
|
|
||||||
log.debug("====================【cad拆单获取封边配置结束】====================");
|
|
||||||
|
|
||||||
log.debug("====================【cad拆单解析生产单开始】====================");
|
|
||||||
// 解析生产单信息
|
|
||||||
analyzeOrder(webCadDataReqVO.getOrderNo());
|
|
||||||
log.debug("====================【cad拆单解析生产单结束】====================");
|
|
||||||
|
|
||||||
log.debug("====================【cad拆单解析板材开始】====================");
|
log.debug("====================【cad拆单解析板材开始】====================");
|
||||||
// 板材id对应板件
|
// 板材id对应板件
|
||||||
@@ -318,30 +303,9 @@ public class WebCadOrderImportFactory {
|
|||||||
/**
|
/**
|
||||||
* 解析生产单信息
|
* 解析生产单信息
|
||||||
*
|
*
|
||||||
* @param orderNo
|
* @param
|
||||||
*/
|
*/
|
||||||
private void analyzeOrder(String orderNo) {
|
private void analyzePlateNum() {
|
||||||
// 查询生产单信息
|
|
||||||
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();
|
|
||||||
|
|
||||||
// 解析已有生产单下板件数量,超过两万不再导入
|
// 解析已有生产单下板件数量,超过两万不再导入
|
||||||
Long existPlateCount = plateMapper.selectCount(new LambdaQueryWrapper<PlateDO>()
|
Long existPlateCount = plateMapper.selectCount(new LambdaQueryWrapper<PlateDO>()
|
||||||
.eq(PlateDO::getOrderId, orderId)
|
.eq(PlateDO::getOrderId, orderId)
|
||||||
@@ -496,6 +460,9 @@ public class WebCadOrderImportFactory {
|
|||||||
if (CollUtil.isEmpty(douleRoomTree)) {
|
if (CollUtil.isEmpty(douleRoomTree)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 获取自定义板编号配置
|
||||||
|
plateNoGenerateConfigVO = customPlateNoGenerateService.getPlateNoGenerateConfig(orderId);
|
||||||
|
|
||||||
// 所有房间名
|
// 所有房间名
|
||||||
List<String> roomNames = douleRoomTree.stream().map(WebCadDataDoubleRoomTreeReqVO::getName).collect(Collectors.toList());
|
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 roomId
|
||||||
* @param roomName
|
* @param roomName
|
||||||
* @param listBody
|
* @param listBody
|
||||||
@@ -598,15 +565,21 @@ public class WebCadOrderImportFactory {
|
|||||||
* @param block
|
* @param block
|
||||||
*/
|
*/
|
||||||
private void createPlate(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO 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;
|
boolean isRawHole = (block.getFrontHoleCount() + block.getBackHoleCount()) > 0;
|
||||||
|
|
||||||
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
orderBodyDO.setPlateNum(orderBodyDO.getPlateNum() + 1);
|
||||||
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(unRegular));
|
orderBodyDO.setUnregularNum(orderBodyDO.getUnregularNum() + BooleanUtil.toInt(isSpecialShape));
|
||||||
|
|
||||||
// 柜体长宽深
|
// 柜体长宽深
|
||||||
orderBodyDO.setWidth(block.getCabinetWidth());
|
orderBodyDO.setWidth(block.getCabinetWidth());
|
||||||
@@ -649,8 +622,11 @@ public class WebCadOrderImportFactory {
|
|||||||
.holeFace(block.getHoleFace())
|
.holeFace(block.getHoleFace())
|
||||||
.isDoor(block.getIsDoor())
|
.isDoor(block.getIsDoor())
|
||||||
.openDoorType(block.getOpenDoorType())
|
.openDoorType(block.getOpenDoorType())
|
||||||
.isSpecialShaped(unRegular)
|
.isSpecialShaped(isSpecialShape)
|
||||||
.isSculpt(isModel)
|
.isSculpt(isModel)
|
||||||
|
.isSideSculpt(sideModel)
|
||||||
|
.has2DModel(has2DModel)
|
||||||
|
.hasSide2DModel(hasSide2DModel)
|
||||||
.isRowHole(isRawHole)
|
.isRowHole(isRawHole)
|
||||||
.customPlateNoBuilder(new StringBuilder())
|
.customPlateNoBuilder(new StringBuilder())
|
||||||
.holeArrange(block.getHoleArrange())
|
.holeArrange(block.getHoleArrange())
|
||||||
@@ -692,7 +668,7 @@ public class WebCadOrderImportFactory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plateDOS.add(plateDO);
|
plateDOS.add(plateDO);
|
||||||
// orderPlateBatchInsertWithinThreshold(plateMapper, plateDOS, false);
|
orderPlateBatchInsertWithinThreshold(plateDOS, false);
|
||||||
|
|
||||||
// 创建es造型数据
|
// 创建es造型数据
|
||||||
createModel(plateDO, block, plateRemark);
|
createModel(plateDO, block, plateRemark);
|
||||||
@@ -1201,6 +1177,10 @@ public class WebCadOrderImportFactory {
|
|||||||
if (ObjectUtil.isNull(parts)) {
|
if (ObjectUtil.isNull(parts)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.debug("====================【cad拆单获取封边配置开始】====================");
|
||||||
|
// 获取系统配置-封边对应配置
|
||||||
|
getOrgSealEdgeConfig();
|
||||||
|
log.debug("====================【cad拆单获取封边配置结束】====================");
|
||||||
|
|
||||||
for (WebCadDataDoubleRoomTreeReqVO room : parts) {
|
for (WebCadDataDoubleRoomTreeReqVO room : parts) {
|
||||||
// 房间名
|
// 房间名
|
||||||
@@ -1637,7 +1617,7 @@ public class WebCadOrderImportFactory {
|
|||||||
private void orderPlateBatchInsertWithinThreshold(List<PlateDO> list, boolean isLast) {
|
private void orderPlateBatchInsertWithinThreshold(List<PlateDO> list, boolean isLast) {
|
||||||
// 达到批量的阈值就做一次插入
|
// 达到批量的阈值就做一次插入
|
||||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || 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() {
|
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||||
@Override
|
@Override
|
||||||
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||||
@@ -1677,18 +1657,21 @@ public class WebCadOrderImportFactory {
|
|||||||
ps.setLong(33, item.getModuleTypeId());
|
ps.setLong(33, item.getModuleTypeId());
|
||||||
ps.setBoolean(34, item.getIsSpecialShaped());
|
ps.setBoolean(34, item.getIsSpecialShaped());
|
||||||
ps.setBoolean(35, item.getIsSculpt());
|
ps.setBoolean(35, item.getIsSculpt());
|
||||||
ps.setBoolean(36, item.getIsRowHole());
|
ps.setBoolean(36, item.getIsSideSculpt());
|
||||||
ps.setBoolean(37, item.getIsOptimized());
|
ps.setBoolean(37, item.getHas2DModel());
|
||||||
ps.setInt(38, item.getIsCutted());
|
ps.setBoolean(38, item.getHasSide2DModel());
|
||||||
ps.setString(39, item.getFilterType());
|
ps.setBoolean(39, item.getIsRowHole());
|
||||||
ps.setString(40, item.getRemark());
|
ps.setBoolean(40, item.getIsOptimized());
|
||||||
ps.setBoolean(41, item.getIsCancel());
|
ps.setInt(41, item.getIsCutted());
|
||||||
ps.setBoolean(42, item.getDeleted());
|
ps.setString(42, item.getFilterType());
|
||||||
ps.setString(43, item.getCustomPlateNo());
|
ps.setString(43, item.getRemark());
|
||||||
ps.setTimestamp(44, Timestamp.valueOf(item.getCreateTime()));
|
ps.setBoolean(44, item.getIsCancel());
|
||||||
ps.setTimestamp(45, Timestamp.valueOf(item.getUpdateTime()));
|
ps.setBoolean(45, item.getDeleted());
|
||||||
ps.setString(46, item.getCreator());
|
ps.setString(46, item.getCustomPlateNo());
|
||||||
ps.setString(47, item.getUpdater());
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user