cad拆单 加工组和部件关联关系分离

This commit is contained in:
gaoqr
2026-06-22 16:09:56 +08:00
parent 9f20bf1c43
commit 3e5cab857a
2 changed files with 82 additions and 124 deletions
@@ -1574,46 +1574,23 @@ public class WebCadOrderImportAsyncFactory {
orderGroupMap.put(groupMapKey, orderGroupDO); orderGroupMap.put(groupMapKey, orderGroupDO);
} }
if (CollUtil.isNotEmpty(partComponentIds)) { OrderItemDO orderItemDO = OrderItemDO
for (Long partComponentId : partComponentIds) { .builder()
OrderItemDO orderItemDO = OrderItemDO .id((Long) snowFlakeGenerator.nextId(null))
.builder() .orderId(orderId)
.id((Long) snowFlakeGenerator.nextId(null)) .type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
.orderId(orderId) .roomId(roomId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .bodyId(bodyId)
.roomId(roomId) .groupId(orderGroupDO.getId())
.bodyId(bodyId) .partsId(part.getImesPartsId())
.groupId(orderGroupDO.getId()) .packageId(0L)
.partsId(part.getImesPartsId()) .plateId(0L)
.packageId(0L) .num(part.getNum())
.plateId(0L) .cadViewId(cadViewId)
.num(part.getNum()) .organId(organId)
.compId(partComponentId) .build();
.cadViewId(cadViewId) orderItemDOS.add(orderItemDO);
.organId(organId) orderItemBatchInsertWithinThreshold(orderItemDOS, false);
.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())
.cadViewId(cadViewId)
.organId(organId)
.build();
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
}
} }
OrderItemDO orderItemDO = OrderItemDO OrderItemDO orderItemDO = OrderItemDO
.builder() .builder()
@@ -1626,32 +1603,33 @@ public class WebCadOrderImportAsyncFactory {
.packageId(0L) .packageId(0L)
.plateId(0L) .plateId(0L)
.num(partNum) .num(partNum)
.groupId(0L) // 用于统计加工组下配件的总数
.organId(organId) .organId(organId)
.build(); .build();
orderItemDOS.add(orderItemDO); orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false); orderItemBatchInsertWithinThreshold(orderItemDOS, false);
} else { } else {
if (CollUtil.isNotEmpty(partComponentIds)) { OrderItemDO orderItemDO = OrderItemDO
for (Long partComponentId : partComponentIds) { .builder()
OrderItemDO orderItemDO = OrderItemDO .id((Long) snowFlakeGenerator.nextId(null))
.builder() .orderId(orderId)
.id((Long) snowFlakeGenerator.nextId(null)) .type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
.orderId(orderId) .roomId(roomId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .bodyId(bodyId)
.roomId(roomId) .partsId(part.getImesPartsId())
.bodyId(bodyId) .packageId(0L)
.partsId(part.getImesPartsId()) .plateId(0L)
.packageId(0L) .num(part.getNum())
.plateId(0L) .cadViewId(cadViewId)
.num(part.getNum()) .organId(organId)
.compId(partComponentId) .build();
.cadViewId(cadViewId) orderItemDOS.add(orderItemDO);
.organId(organId) orderItemBatchInsertWithinThreshold(orderItemDOS, false);
.build(); }
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false); // 创建部件的关联关系
} if (CollUtil.isNotEmpty(partComponentIds)) {
} else { for (Long partComponentId : partComponentIds) {
OrderItemDO orderItemDO = OrderItemDO OrderItemDO orderItemDO = OrderItemDO
.builder() .builder()
.id((Long) snowFlakeGenerator.nextId(null)) .id((Long) snowFlakeGenerator.nextId(null))
@@ -1663,6 +1641,7 @@ public class WebCadOrderImportAsyncFactory {
.packageId(0L) .packageId(0L)
.plateId(0L) .plateId(0L)
.num(part.getNum()) .num(part.getNum())
.compId(partComponentId)
.cadViewId(cadViewId) .cadViewId(cadViewId)
.organId(organId) .organId(organId)
.build(); .build();
@@ -1761,95 +1761,74 @@ public class WebCadOrderImportFactory {
orderGroupMap.put(groupMapKey, orderGroupDO); orderGroupMap.put(groupMapKey, orderGroupDO);
} }
if (CollUtil.isNotEmpty(partComponentIds)) { OrderItemDO orderItemDO = OrderItemDO
for (Long partComponentId : partComponentIds) { .builder()
OrderItemDO orderItemDO = OrderItemDO .id((Long) snowFlakeGenerator.nextId(null))
.builder() .orderId(orderId)
.id((Long) snowFlakeGenerator.nextId(null)) .type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
.orderId(orderId) .roomId(roomId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .bodyId(bodyId)
.roomId(roomId) .groupId(orderGroupDO.getId())
.bodyId(bodyId) .partsId(part.getImesPartsId())
.groupId(orderGroupDO.getId()) .packageId(0L)
.partsId(part.getImesPartsId()) .plateId(0L)
.packageId(0L) .num(part.getNum())
.plateId(0L) .cadViewId(cadViewId)
.num(part.getNum()) .organId(organId)
.compId(partComponentId) .build();
.cadViewId(cadViewId) orderItemDOS.add(orderItemDO);
.organId(organId) orderItemBatchInsertWithinThreshold(orderItemDOS, false);
.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())
.cadViewId(cadViewId)
.organId(organId)
.build();
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
}
} }
OrderItemDO orderItemDO = OrderItemDO OrderItemDO orderItemDO = OrderItemDO
.builder() .builder()
.id((Long) snowFlakeGenerator.nextId(null)) .id((Long) snowFlakeGenerator.nextId(null))
.orderId(orderId) .orderId(orderId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
.roomId(roomId) .roomId(roomId)
.bodyId(bodyId) .bodyId(bodyId)
.partsId(part.getImesPartsId()) .partsId(part.getImesPartsId())
.packageId(0L) .packageId(0L)
.plateId(0L) .plateId(0L)
.num(partNum) .num(partNum)
.groupId(0L) // 用于统计加工组下配件的总数
.organId(organId) .organId(organId)
.build(); .build();
orderItemDOS.add(orderItemDO); orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false); orderItemBatchInsertWithinThreshold(orderItemDOS, false);
} else { } else {
if(CollUtil.isNotEmpty(partComponentIds)) { OrderItemDO orderItemDO = OrderItemDO
for (Long partComponentId : partComponentIds) { .builder()
OrderItemDO orderItemDO = OrderItemDO .id((Long) snowFlakeGenerator.nextId(null))
.builder() .orderId(orderId)
.id((Long) snowFlakeGenerator.nextId(null)) .type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
.orderId(orderId) .roomId(roomId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .bodyId(bodyId)
.roomId(roomId) .partsId(part.getImesPartsId())
.bodyId(bodyId) .packageId(0L)
.partsId(part.getImesPartsId()) .plateId(0L)
.packageId(0L) .num(part.getNum())
.plateId(0L) .cadViewId(cadViewId)
.num(part.getNum()) .organId(organId)
.compId(partComponentId) .build();
.cadViewId(cadViewId) orderItemDOS.add(orderItemDO);
.organId(organId) orderItemBatchInsertWithinThreshold(orderItemDOS, false);
.build(); }
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false); // 创建部件的关联关系
} if(CollUtil.isNotEmpty(partComponentIds)) {
} else { for (Long partComponentId : partComponentIds) {
OrderItemDO orderItemDO = OrderItemDO OrderItemDO orderItemDO = OrderItemDO
.builder() .builder()
.id((Long) snowFlakeGenerator.nextId(null)) .id((Long) snowFlakeGenerator.nextId(null))
.orderId(orderId) .orderId(orderId)
.type(OrderItemTypeEnum.PLATE_ITEM.getStatus()) .type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
.roomId(roomId) .roomId(roomId)
.bodyId(bodyId) .bodyId(bodyId)
.partsId(part.getImesPartsId()) .partsId(part.getImesPartsId())
.packageId(0L) .packageId(0L)
.plateId(0L) .plateId(0L)
.num(part.getNum()) .num(part.getNum())
.compId(partComponentId)
.cadViewId(cadViewId) .cadViewId(cadViewId)
.organId(organId) .organId(organId)
.build(); .build();