mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +08:00
新增webcad生产单导入:1、代码规范修复;2、拆单完成内存清理补充;
This commit is contained in:
+60
-43
@@ -640,37 +640,7 @@ public class WebCadOrderImportFactory {
|
|||||||
createBlockUnknownBody(roomId, roomName, bodyName, listBody);
|
createBlockUnknownBody(roomId, roomName, bodyName, listBody);
|
||||||
} else {
|
} else {
|
||||||
// 成倍数量
|
// 成倍数量
|
||||||
Integer bodyMultipleNum = cadBody.getCount();
|
multiCreateBodyPlate(cadBody, roomId, roomName, roomBodyKey, listBody);
|
||||||
for (int i = 0; i < bodyMultipleNum; i++) {
|
|
||||||
Long bodyId = (Long) snowFlakeGenerator.nextId(null);
|
|
||||||
OrderBodyDO orderBodyDO = OrderBodyDO.builder().id(bodyId).orderId(orderId).organId(organId)
|
|
||||||
.roomId(roomId).roomName(roomName).name(bodyName).width(0.0).height(0.0)
|
|
||||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").deleted(false).build();
|
|
||||||
orderBodyDO.setCreator(operatorName);
|
|
||||||
orderBodyDO.setUpdater(operatorName);
|
|
||||||
orderBodyDO.setCreateTime(now);
|
|
||||||
orderBodyDO.setUpdateTime(now);
|
|
||||||
|
|
||||||
// 缓存成倍的柜体信息
|
|
||||||
String multiRoomBodyName = roomBodyKey + i;
|
|
||||||
orderBodyDO.setMultiRoomBodyName(multiRoomBodyName);
|
|
||||||
bodyMap.put(multiRoomBodyName, orderBodyDO);
|
|
||||||
|
|
||||||
// 达到阈值了不再创建板件
|
|
||||||
if(plateNumReachThreshold) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (WebCadDataBlockReqVO block : listBody) {
|
|
||||||
if (!plateNumReachThreshold) {
|
|
||||||
// 创建板件相关数据:order_plate、order_item、es.orderModels
|
|
||||||
createPlate(orderBodyDO, block);
|
|
||||||
} else {
|
|
||||||
// 达到阈值了跳出循环,不再创建板件
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -682,6 +652,49 @@ public class WebCadOrderImportFactory {
|
|||||||
orderModelsBatchInsertWithinThreshold(true);
|
orderModelsBatchInsertWithinThreshold(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成倍创建柜体板件
|
||||||
|
*
|
||||||
|
* @param cadBody
|
||||||
|
* @param roomId
|
||||||
|
* @param roomName
|
||||||
|
* @param roomBodyKey
|
||||||
|
* @param listBody
|
||||||
|
*/
|
||||||
|
private void multiCreateBodyPlate(WebCadDataDoubleRoomTreeReqVO.ChildrenDTO cadBody, Long roomId, String roomName, String roomBodyKey, List<WebCadDataBlockReqVO> listBody) {
|
||||||
|
Integer bodyMultipleNum = cadBody.getCount();
|
||||||
|
for (int i = 0; i < bodyMultipleNum; i++) {
|
||||||
|
Long bodyId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
|
OrderBodyDO orderBodyDO = OrderBodyDO.builder().id(bodyId).orderId(orderId).organId(organId)
|
||||||
|
.roomId(roomId).roomName(roomName).name(cadBody.getName()).width(0.0).height(0.0)
|
||||||
|
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").deleted(false).build();
|
||||||
|
orderBodyDO.setCreator(operatorName);
|
||||||
|
orderBodyDO.setUpdater(operatorName);
|
||||||
|
orderBodyDO.setCreateTime(now);
|
||||||
|
orderBodyDO.setUpdateTime(now);
|
||||||
|
|
||||||
|
// 缓存成倍的柜体信息
|
||||||
|
String multiRoomBodyName = roomBodyKey + i;
|
||||||
|
orderBodyDO.setMultiRoomBodyName(multiRoomBodyName);
|
||||||
|
bodyMap.put(multiRoomBodyName, orderBodyDO);
|
||||||
|
|
||||||
|
// 达到阈值了不再创建板件
|
||||||
|
if (plateNumReachThreshold) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (WebCadDataBlockReqVO block : listBody) {
|
||||||
|
if (!plateNumReachThreshold) {
|
||||||
|
// 创建板件相关数据:order_plate、order_item、es.orderModels
|
||||||
|
createPlate(orderBodyDO, block);
|
||||||
|
} else {
|
||||||
|
// 达到阈值了跳出循环,不再创建板件
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建不需要成倍的房间柜体以及其下的板件
|
* 创建不需要成倍的房间柜体以及其下的板件
|
||||||
*
|
*
|
||||||
@@ -813,7 +826,7 @@ public class WebCadOrderImportFactory {
|
|||||||
|
|
||||||
//批量保存板件
|
//批量保存板件
|
||||||
// 达到板件数量阈值,停止入库,更新全局参数停止后续入库
|
// 达到板件数量阈值,停止入库,更新全局参数停止后续入库
|
||||||
currentPlateNum+=1;
|
currentPlateNum += 1;
|
||||||
if (currentPlateNum > cadImportPlateNumThreshold) {
|
if (currentPlateNum > cadImportPlateNumThreshold) {
|
||||||
plateNumReachThreshold = true;
|
plateNumReachThreshold = true;
|
||||||
return;
|
return;
|
||||||
@@ -1785,7 +1798,7 @@ public class WebCadOrderImportFactory {
|
|||||||
private void orderItemBatchInsertWithinThreshold(List<OrderItemDO> list, boolean isLast) {
|
private void orderItemBatchInsertWithinThreshold(List<OrderItemDO> list, boolean isLast) {
|
||||||
// 达到批量的阈值就做一次插入
|
// 达到批量的阈值就做一次插入
|
||||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
orderItemMapper.insertBatchSomeColumn(list);
|
orderItemMapper.insertBatchSomeColumn(list);
|
||||||
if (!isLast) {
|
if (!isLast) {
|
||||||
// 存储完成清理 list
|
// 存储完成清理 list
|
||||||
list.clear();
|
list.clear();
|
||||||
@@ -1802,7 +1815,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)) {
|
||||||
plateMapper.insertBatchSomeColumn(list);
|
plateMapper.insertBatchSomeColumn(list);
|
||||||
if (!isLast) {
|
if (!isLast) {
|
||||||
// 存储完成清理 list
|
// 存储完成清理 list
|
||||||
list.clear();
|
list.clear();
|
||||||
@@ -1819,7 +1832,7 @@ public class WebCadOrderImportFactory {
|
|||||||
private void orderPartBatchInsertWithinThreshold(List<OrderPartsDO> list, boolean isLast) {
|
private void orderPartBatchInsertWithinThreshold(List<OrderPartsDO> list, boolean isLast) {
|
||||||
// 达到批量的阈值就做一次插入
|
// 达到批量的阈值就做一次插入
|
||||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
orderPartsMapper.insertBatchSomeColumn(list);
|
orderPartsMapper.insertBatchSomeColumn(list);
|
||||||
if (!isLast) {
|
if (!isLast) {
|
||||||
// 存储完成清理 list
|
// 存储完成清理 list
|
||||||
list.clear();
|
list.clear();
|
||||||
@@ -1976,16 +1989,20 @@ public class WebCadOrderImportFactory {
|
|||||||
* 清空所有列表
|
* 清空所有列表
|
||||||
*/
|
*/
|
||||||
private void clearAll() {
|
private void clearAll() {
|
||||||
orderPartsDOS.clear();
|
|
||||||
orderGroupDOS.clear();
|
|
||||||
orderGroupMap.clear();
|
|
||||||
plateDOS.clear();
|
|
||||||
orderItemDOS.clear();
|
|
||||||
orderModelDOS.clear();
|
|
||||||
roomBodyMap.clear();
|
roomBodyMap.clear();
|
||||||
bodyMap.clear();
|
bodyMap.clear();
|
||||||
sealEdgeConfigList.clear();
|
orderGroupMap.clear();
|
||||||
processGroupMap.clear();
|
|
||||||
materialMap.clear();
|
materialMap.clear();
|
||||||
|
existRoomMap.clear();
|
||||||
|
processGroupMap.clear();
|
||||||
|
|
||||||
|
plateDOS.clear();
|
||||||
|
orderItemDOS.clear();
|
||||||
|
orderGroupDOS.clear();
|
||||||
|
orderPartsDOS.clear();
|
||||||
|
orderModelDOS.clear();
|
||||||
|
rawGoodsDOS.clear();
|
||||||
|
goodsDOS.clear();
|
||||||
|
sealEdgeConfigList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user