mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增cad拆单支持配件和部件关联
This commit is contained in:
+3
@@ -72,6 +72,9 @@ public class WebCadDataPartsReqVO {
|
||||
|
||||
private GroupDataDTO groupData;
|
||||
|
||||
// 组件id
|
||||
private List<Integer> componentIds;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class GroupDataDTO {
|
||||
|
||||
+98
-47
@@ -24,7 +24,6 @@ import com.cf.imes.module.executor.enums.DataTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderImportStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderItemTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
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.WebCadDataComponentGroupReqVO;
|
||||
@@ -810,16 +809,6 @@ public class WebCadOrderImportAsyncFactory {
|
||||
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
||||
goodsDO.setArea(goodsDO.getArea() + area);
|
||||
|
||||
// 获取缓存的部件id
|
||||
Integer cadGroupId = block.getComponentId();
|
||||
Long plateComponentId = null;
|
||||
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
plateComponentId = componentId;
|
||||
}
|
||||
}
|
||||
|
||||
// 创建order_plate
|
||||
PlateDO plateDO = PlateDO.builder()
|
||||
.id(plateId)
|
||||
@@ -900,7 +889,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
orderModelsBatchInsertWithinThreshold(false);
|
||||
|
||||
// 遍历加工组信息,生成对应的加工组和item
|
||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId, plateComponentId);
|
||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -910,10 +899,20 @@ public class WebCadOrderImportAsyncFactory {
|
||||
* @param block
|
||||
* @param plateId
|
||||
*/
|
||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId, Long componentId) {
|
||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId) {
|
||||
Long bodyId = orderBodyDO.getId();
|
||||
Long roomId = orderBodyDO.getRoomId();
|
||||
|
||||
// 获取缓存的部件id
|
||||
Integer cadGroupId = block.getComponentId();
|
||||
Long plateComponentId = null;
|
||||
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
plateComponentId = componentId;
|
||||
}
|
||||
}
|
||||
|
||||
List<Integer> groupIds = block.getGroupIds();
|
||||
if (CollUtil.isNotEmpty(groupIds)) {
|
||||
// 加工组缓存存在,一个加工组一个orderGroup+orderItem
|
||||
@@ -967,7 +966,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
.partsId(0L)
|
||||
.num(1.0)
|
||||
.organId(organId)
|
||||
.compId(componentId)
|
||||
.compId(plateComponentId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
@@ -986,7 +985,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
.partsId(0L)
|
||||
.num(1.0)
|
||||
.organId(organId)
|
||||
.compId(componentId)
|
||||
.compId(plateComponentId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
@@ -1552,6 +1551,16 @@ public class WebCadOrderImportAsyncFactory {
|
||||
// 获取orderPart
|
||||
analyzeOrderPart(part);
|
||||
|
||||
// 获取缓存的部件id
|
||||
List<Integer> cadGroupIds = part.getComponentIds();
|
||||
List<Long> partComponentIds = new ArrayList<>();
|
||||
for (Integer cadGroupId : cadGroupIds) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
partComponentIds.add(componentId);
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历加工组信息,生成对应的orderItem
|
||||
List<Integer> groupIds = part.getGroupIds();
|
||||
if (CollUtil.isNotEmpty(groupIds)) {
|
||||
@@ -1591,23 +1600,44 @@ public class WebCadOrderImportAsyncFactory {
|
||||
|
||||
orderGroupMap.put(groupMapKey, orderGroupDO);
|
||||
}
|
||||
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
if (CollUtil.isNotEmpty(partComponentIds)) {
|
||||
for (Long partComponentId : partComponentIds) {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.compId(partComponentId)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
}
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
@@ -1625,21 +1655,42 @@ public class WebCadOrderImportAsyncFactory {
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
if (CollUtil.isNotEmpty(partComponentIds)) {
|
||||
for (Long partComponentId : partComponentIds) {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.compId(partComponentId)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+98
-46
@@ -740,17 +740,6 @@ public class WebCadOrderImportFactory {
|
||||
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
||||
goodsDO.setArea(goodsDO.getArea() + area);
|
||||
|
||||
// 获取缓存的部件id
|
||||
Integer cadGroupId = block.getComponentId();
|
||||
Long plateComponentId = null;
|
||||
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
plateComponentId = componentId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String splitHeight = block.getSpliteHeight();
|
||||
String spliteWidth = block.getSpliteWidth();
|
||||
// 创建order_plate
|
||||
@@ -833,7 +822,7 @@ public class WebCadOrderImportFactory {
|
||||
orderModelsBatchInsertWithinThreshold(false);
|
||||
|
||||
// 遍历加工组信息,生成对应的加工组和item
|
||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId, plateComponentId);
|
||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,10 +1255,20 @@ public class WebCadOrderImportFactory {
|
||||
* @param block
|
||||
* @param plateId
|
||||
*/
|
||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId, Long componentId) {
|
||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId) {
|
||||
Long bodyId = orderBodyDO.getId();
|
||||
Long roomId = orderBodyDO.getRoomId();
|
||||
|
||||
// 获取缓存的部件id
|
||||
Integer cadGroupId = block.getComponentId();
|
||||
Long plateComponentId = null;
|
||||
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
plateComponentId = componentId;
|
||||
}
|
||||
}
|
||||
|
||||
List<Integer> groupIds = block.getGroupIds();
|
||||
if (CollUtil.isNotEmpty(groupIds)) {
|
||||
// 加工组缓存存在,一个加工组一个orderGroup+orderItem
|
||||
@@ -1323,7 +1322,7 @@ public class WebCadOrderImportFactory {
|
||||
.partsId(0L)
|
||||
.num(1.0)
|
||||
.organId(organId)
|
||||
.compId(componentId)
|
||||
.compId(plateComponentId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
@@ -1342,7 +1341,7 @@ public class WebCadOrderImportFactory {
|
||||
.partsId(0L)
|
||||
.num(1.0)
|
||||
.organId(organId)
|
||||
.compId(componentId)
|
||||
.compId(plateComponentId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
@@ -1480,6 +1479,16 @@ public class WebCadOrderImportFactory {
|
||||
// 获取orderPart
|
||||
analyzeOrderPart(part);
|
||||
|
||||
// 获取缓存的部件id
|
||||
List<Integer> cadGroupIds = part.getComponentIds();
|
||||
List<Long> partComponentIds = new ArrayList<>();
|
||||
for (Integer cadGroupId : cadGroupIds) {
|
||||
Long componentId = componentGroupMap.get(cadGroupId);
|
||||
if (ObjectUtil.isNotNull(componentId)) {
|
||||
partComponentIds.add(componentId);
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历加工组信息,生成对应的orderItem
|
||||
List<Integer> groupIds = part.getGroupIds();
|
||||
if (CollUtil.isNotEmpty(groupIds)) {
|
||||
@@ -1520,22 +1529,44 @@ public class WebCadOrderImportFactory {
|
||||
orderGroupMap.put(groupMapKey, orderGroupDO);
|
||||
}
|
||||
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
if (CollUtil.isNotEmpty(partComponentIds)) {
|
||||
for (Long partComponentId : partComponentIds) {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.compId(partComponentId)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.groupId(orderGroupDO.getId())
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
}
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
@@ -1553,21 +1584,42 @@ public class WebCadOrderImportFactory {
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
if(CollUtil.isNotEmpty(partComponentIds)) {
|
||||
for (Long partComponentId : partComponentIds) {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.compId(partComponentId)
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
} else {
|
||||
OrderItemDO orderItemDO = OrderItemDO
|
||||
.builder()
|
||||
.id((Long) snowFlakeGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||
.roomId(roomId)
|
||||
.bodyId(bodyId)
|
||||
.partsId(part.getImesPartsId())
|
||||
.packageId(0L)
|
||||
.plateId(0L)
|
||||
.num(part.getNum())
|
||||
.organId(organId)
|
||||
.build();
|
||||
orderItemDOS.add(orderItemDO);
|
||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user