mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
webcad拆单对图纸id为空的校验优化
This commit is contained in:
+25
-2
@@ -134,7 +134,13 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
|||||||
@Override
|
@Override
|
||||||
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
||||||
Set<Long> componentIds = reqVO.getComponentIds();
|
Set<Long> componentIds = reqVO.getComponentIds();
|
||||||
|
if(CollUtil.isEmpty(componentIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
// 校验订单
|
||||||
Long orderId = reqVO.getOrderId();
|
Long orderId = reqVO.getOrderId();
|
||||||
|
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||||
|
AssertUtils.notEmpty(orderDO,ORDER_NOT_EXISTS);
|
||||||
|
|
||||||
// 1、查询部件
|
// 1、查询部件
|
||||||
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
||||||
@@ -172,7 +178,13 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<OrderViewPlatePageRespVO> getViewComponentPage(OrderDetailComponentPageReqVO pageReqVO) {
|
public PageResult<OrderViewPlatePageRespVO> getViewComponentPage(OrderDetailComponentPageReqVO pageReqVO) {
|
||||||
Set<Long> componentIds = pageReqVO.getComponentIds();
|
Set<Long> componentIds = pageReqVO.getComponentIds();
|
||||||
|
if (CollUtil.isEmpty(componentIds)) {
|
||||||
|
return new PageResult<>(Collections.emptyList(), 0L);
|
||||||
|
}
|
||||||
|
// 校验订单
|
||||||
Long orderId = pageReqVO.getOrderId();
|
Long orderId = pageReqVO.getOrderId();
|
||||||
|
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||||
|
AssertUtils.notEmpty(orderDO,ORDER_NOT_EXISTS);
|
||||||
|
|
||||||
// 1、查询顶级
|
// 1、查询顶级
|
||||||
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
||||||
@@ -248,15 +260,26 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 整理出id和cadViewFileId的对应关系
|
||||||
|
Map<Long, Long> cadViewFileIdMap = orderComponentDOS.stream()
|
||||||
|
.collect(Collectors.toMap(OrderComponentDO::getId, OrderComponentDO::getCadViewFileId));
|
||||||
|
|
||||||
// 查询所有板件的视图所需信息
|
// 查询所有板件的视图所需信息
|
||||||
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
|
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
|
||||||
IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||||
null, componentIds, true);
|
null, componentIds, true);
|
||||||
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
|
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
|
||||||
|
long total = viewPlatesPage.getTotal();
|
||||||
|
|
||||||
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>();
|
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(records)) {
|
if(total > 0) {
|
||||||
resultList = BeanUtil.copyToList(records, OrderViewPlatePageRespVO.class);
|
resultList = records.stream().map(item -> {
|
||||||
|
OrderViewPlatePageRespVO vo = new OrderViewPlatePageRespVO();
|
||||||
|
BeanUtil.copyProperties(item, vo);
|
||||||
|
|
||||||
|
vo.setCadViewFileId(cadViewFileIdMap.get(item.getCompId()));
|
||||||
|
return vo;
|
||||||
|
}).toList();
|
||||||
}
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,5 +24,5 @@ public class ErrorCodeConstants {
|
|||||||
public static final ErrorCode WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR = new ErrorCode(1_005_000_014, "webcad.order.import.peek.not_exist");
|
public static final ErrorCode WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR = new ErrorCode(1_005_000_014, "webcad.order.import.peek.not_exist");
|
||||||
public static final ErrorCode WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_005_000_015, "webcad.order.import.order.update.concurrent");
|
public static final ErrorCode WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_005_000_015, "webcad.order.import.order.update.concurrent");
|
||||||
public static final ErrorCode WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_005_000_016, "webcad.order.import.goods.update.concurrent");
|
public static final ErrorCode WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR = new ErrorCode(1_005_000_016, "webcad.order.import.goods.update.concurrent");
|
||||||
|
public static final ErrorCode WEBCAD_ORDER_IMPORT_CAD_VIEW_FILE_ID_EMPTY_ERROR = new ErrorCode(1_005_000_017, "webcad.order.import.cad.view.file.id.empty.error");
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -3,6 +3,7 @@ package com.cf.imes.module.plan.service.orderImport;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
|
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
|
||||||
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.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO;
|
||||||
@@ -26,6 +27,9 @@ public class OrderImportTaskServiceImpl implements OrderImportTaskService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderImportTaskMapper orderImportTaskMapper;
|
private OrderImportTaskMapper orderImportTaskMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private I18nUtils i18nUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||||
public OrderImportTaskDO confirmOrderImport(Long taskId) {
|
public OrderImportTaskDO confirmOrderImport(Long taskId) {
|
||||||
@@ -61,7 +65,7 @@ public class OrderImportTaskServiceImpl implements OrderImportTaskService {
|
|||||||
}
|
}
|
||||||
String msg;
|
String msg;
|
||||||
if (ex instanceof ServiceException) {
|
if (ex instanceof ServiceException) {
|
||||||
msg = ex.getMessage();
|
msg = i18nUtils.getMessage(ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
msg = ORDER_IMPORT_FAIL.getMsg();
|
msg = ORDER_IMPORT_FAIL.getMsg();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -9,6 +9,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
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.util.Assert.AssertUtils;
|
||||||
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;
|
||||||
@@ -31,6 +32,7 @@ import com.cf.imes.module.plan.dal.mysql.orderBody.OrderBodyMapper;
|
|||||||
import com.cf.imes.module.plan.dal.mysql.orderImport.OrderImportTaskMapper;
|
import com.cf.imes.module.plan.dal.mysql.orderImport.OrderImportTaskMapper;
|
||||||
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.enums.ErrorCodeConstants;
|
||||||
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
||||||
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
||||||
import com.cf.imes.module.plan.service.orderImport.factory.WebCadOrderImportFactory;
|
import com.cf.imes.module.plan.service.orderImport.factory.WebCadOrderImportFactory;
|
||||||
@@ -174,6 +176,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService {
|
|||||||
|
|
||||||
// cad图纸文件id
|
// cad图纸文件id
|
||||||
cadViewFileId = webCadDataReqVO.getCadViewFileId();
|
cadViewFileId = webCadDataReqVO.getCadViewFileId();
|
||||||
|
AssertUtils.notEmpty(cadViewFileId, ErrorCodeConstants.WEBCAD_ORDER_IMPORT_CAD_VIEW_FILE_ID_EMPTY_ERROR);
|
||||||
webCadOrderImportFactory.analyzeTempData(webCadDataReqVO);
|
webCadOrderImportFactory.analyzeTempData(webCadDataReqVO);
|
||||||
} else {
|
} else {
|
||||||
sync = false;
|
sync = false;
|
||||||
|
|||||||
+2
@@ -17,6 +17,7 @@ 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.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||||
import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd;
|
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;
|
||||||
@@ -304,6 +305,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
break;
|
break;
|
||||||
case "CadViewFileId":
|
case "CadViewFileId":
|
||||||
cadViewFileId = reader.readLong();
|
cadViewFileId = reader.readLong();
|
||||||
|
AssertUtils.notEmpty(cadViewFileId, ErrorCodeConstants.WEBCAD_ORDER_IMPORT_CAD_VIEW_FILE_ID_EMPTY_ERROR);
|
||||||
break;
|
break;
|
||||||
case "ComponentGroupTree":
|
case "ComponentGroupTree":
|
||||||
analyzeCadComponentList(reader);
|
analyzeCadComponentList(reader);
|
||||||
|
|||||||
+1
@@ -30,3 +30,4 @@ order.import.plate.goods.no_match=导入失败,板材库中无板材匹配,
|
|||||||
webcad.order.import.peek.not_exist=导入失败:数据源不存在,请检查消息可靠性
|
webcad.order.import.peek.not_exist=导入失败:数据源不存在,请检查消息可靠性
|
||||||
webcad.order.import.order.update.concurrent=导入失败:生产单号{}板件数量已发生改变,请重新导入
|
webcad.order.import.order.update.concurrent=导入失败:生产单号{}板件数量已发生改变,请重新导入
|
||||||
webcad.order.import.goods.update.concurrent=导入失败:材质{}板件数量已发生改变,请重新导入
|
webcad.order.import.goods.update.concurrent=导入失败:材质{}板件数量已发生改变,请重新导入
|
||||||
|
webcad.order.import.cad.view.file.id.empty.error=导入失败:请检查CAD图纸数据是否上传成功
|
||||||
+1
@@ -30,3 +30,4 @@ order.import.plate.goods.no_match=匯入失敗,板材庫中無板材匹配,
|
|||||||
webcad.order.import.peek.not_exist=匯入失敗:資料來源不存在,請檢查訊息可靠性
|
webcad.order.import.peek.not_exist=匯入失敗:資料來源不存在,請檢查訊息可靠性
|
||||||
webcad.order.import.order.update.concurrent=匯入失敗:生產單號{}板件數量已發生變更,請重新匯入
|
webcad.order.import.order.update.concurrent=匯入失敗:生產單號{}板件數量已發生變更,請重新匯入
|
||||||
webcad.order.import.goods.update.concurrent=匯入失敗:材質{}板件數量已發生變更,請重新匯入
|
webcad.order.import.goods.update.concurrent=匯入失敗:材質{}板件數量已發生變更,請重新匯入
|
||||||
|
webcad.order.import.cad.view.file.id.empty.error=匯入失敗:請檢查CAD圖紙數據是否上傳成功
|
||||||
+1
@@ -30,3 +30,4 @@ order.import.plate.goods.no_match=Import failed: no matching plate found in plat
|
|||||||
webcad.order.import.peek.not_exist=Import failed: data source does not exist, please check message reliability
|
webcad.order.import.peek.not_exist=Import failed: data source does not exist, please check message reliability
|
||||||
webcad.order.import.order.update.concurrent=Import failed: plate quantity under production order {} has changed, please re-import
|
webcad.order.import.order.update.concurrent=Import failed: plate quantity under production order {} has changed, please re-import
|
||||||
webcad.order.import.goods.update.concurrent=Import failed: plate quantity for material {} has changed, please re-import
|
webcad.order.import.goods.update.concurrent=Import failed: plate quantity for material {} has changed, please re-import
|
||||||
|
webcad.order.import.cad.view.file.id.empty.error=Import failed: Please check if the CAD drawing data was uploaded successfully
|
||||||
Reference in New Issue
Block a user