feat:提交
This commit is contained in:
@@ -852,12 +852,11 @@ export class BlockHelper {
|
||||
}
|
||||
|
||||
/** 获取开料大板内所有的排钻 未排序*/
|
||||
static async GetHoles_BoardAllBlocksByDoFace(pb: PlaceBoard) {
|
||||
static async GetHoles_BoardAllBlocksByDoFace(pb: PlaceBoard,isBackFace: boolean) {
|
||||
let allHoles: any[] = []
|
||||
const backPlaceStyleArr = [PlaceStyle.BACK, PlaceStyle.BACK_TURN_BACK, PlaceStyle.BACK_TURN_LEFT, PlaceStyle.BACK_TURN_RIGHT]
|
||||
// const backPlaceStyleArr = [PlaceStyle.BACK, PlaceStyle.BACK_TURN_BACK, PlaceStyle.BACK_TURN_LEFT, PlaceStyle.BACK_TURN_RIGHT]
|
||||
for (const block of pb.blockList) {
|
||||
|
||||
let holes = await this.getHoles_DoFace(block, backPlaceStyleArr.includes(block.placeStyle))
|
||||
let holes = await this.getHoles_DoFace(block, isBackFace)
|
||||
allHoles = allHoles.concat(holes)
|
||||
}
|
||||
|
||||
@@ -877,12 +876,11 @@ export class BlockHelper {
|
||||
return modelsArr
|
||||
}
|
||||
|
||||
static async GetModels_BoardAllBlocksByDoFace(pb: PlaceBoard) {
|
||||
static async GetModels_BoardAllBlocksByDoFace(pb: PlaceBoard,isBackFace: boolean) {
|
||||
let allModels: any[] = []
|
||||
const backPlaceStyleArr = [PlaceStyle.BACK, PlaceStyle.BACK_TURN_BACK, PlaceStyle.BACK_TURN_LEFT, PlaceStyle.BACK_TURN_RIGHT]
|
||||
for (const block of pb.blockList) {
|
||||
|
||||
let models = await this.GetModels_DoFace(block, backPlaceStyleArr.includes(block.placeStyle))
|
||||
let models = await this.GetModels_DoFace(block, isBackFace)
|
||||
allModels = allModels.concat(models)
|
||||
}
|
||||
return allModels
|
||||
|
@@ -54,8 +54,7 @@ const orderNo = ref('1920401449485860864')
|
||||
const canvasWidth = ref(1200)
|
||||
const canvasHeight = ref(650)
|
||||
const paginationCurrent = ref<any>(1)
|
||||
const paginationCurrentAll = ref<any>(1)
|
||||
const _placeShowMain = ref<any>(null)
|
||||
const paginationCurrentAll = ref<any>(1)
|
||||
const boardEditor = ref<BoardEditor>()
|
||||
const canvasMain = ref()
|
||||
const canvas = ref()
|
||||
@@ -64,10 +63,7 @@ const _handleServe = ref<OptimizeLayoutProcessor | null>(null)
|
||||
const selectVal = ref<any>()
|
||||
const plateSelectOptions = ref<any>([])
|
||||
const parserMain = ref<ParserMain>(new ParserMain())
|
||||
const testData1 = ref('')
|
||||
const paginationTotal = ref<any>(0)
|
||||
const test1 = ref(0)
|
||||
const textVal = ref(1)
|
||||
const testData1 = ref('')
|
||||
const dataBase = ref<any>(null)
|
||||
|
||||
|
||||
@@ -227,87 +223,7 @@ async function _getPlaceOrderData() {
|
||||
boardEditor.value.setSysConfig(_sysConfig);
|
||||
}
|
||||
|
||||
async function initHandleServe() {
|
||||
let newTestData = dataBase.value;
|
||||
|
||||
const handleServe = new DataHandleServe();
|
||||
handleServe.loadConfig(newTestData.sysConfig);
|
||||
|
||||
// 检查排版前条件
|
||||
let checkRes = handleServe.checkPlaceBefore(newTestData.materialList, newTestData.blockList);
|
||||
if (checkRes.length > 0) {
|
||||
console.error(checkRes);
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
let thickness = 0;
|
||||
let tableData = await getDataSource();
|
||||
|
||||
newTestData.materialList.forEach(material => {
|
||||
thickness = Math.max(material.thickness, thickness);
|
||||
material.remainBoardList = [];
|
||||
});
|
||||
|
||||
// 设置优化状态
|
||||
|
||||
isOptimizeing.value = true;
|
||||
handleServe.setPlaceTaskCallBackFun(placeTaskCallBack);
|
||||
handleServe.stopPlaceTask();
|
||||
handleServe.workerList = [];
|
||||
|
||||
// 初始化板块边界
|
||||
let blockBoardClass = new blockborderClass();
|
||||
blockBoardClass.sysConfig = newTestData.sysConfig;
|
||||
|
||||
// 初始化小板列表
|
||||
let blockList = [];
|
||||
for (const b of newTestData.blockList) {
|
||||
let block = new PlaceBlock(b);
|
||||
blockList.push(block);
|
||||
}
|
||||
|
||||
let blockDetailList = [];
|
||||
for (const bd of newTestData.blockDetailList) {
|
||||
let blockDetail = new PlaceBlockDetail(bd);
|
||||
await handleServe.resetModelContour(blockDetail);
|
||||
await handleServe.init2VModel(blockDetail);
|
||||
|
||||
blockDetailList.push(blockDetail);
|
||||
|
||||
let i = blockList.findIndex(e => e.blockId == blockDetail.blockId);
|
||||
blockList[i].blockDetail = blockDetail;
|
||||
|
||||
}
|
||||
|
||||
newTestData.blockList = blockList;
|
||||
for (const block of newTestData.blockList) {
|
||||
let pm = newTestData.materialList.find(e => e.goodsId == block.goodsId);
|
||||
let knife = handleServe.getKnifeByParams({ length: pm?.thickness });
|
||||
|
||||
pm.diameter = knife?.diameter;
|
||||
pm.cutKnifeGap = newTestData.sysConfig.blockKnifeLineSpacing || 0.01;
|
||||
|
||||
await blockBoardClass.initBlock(block, pm);
|
||||
await blockBoardClass.getBorder(block);
|
||||
await handleServe.resetModelKnife(block)
|
||||
}
|
||||
|
||||
dataBase.value = newTestData;
|
||||
|
||||
// 开始优化
|
||||
tableData.forEach((board) => {
|
||||
let pm = new PlaceMaterial(board);
|
||||
let res = handleServe.startPlaceThreed(newTestData, pm);
|
||||
|
||||
if (res) {
|
||||
console.log('优化线程异常', res);
|
||||
handleServe.terminateWorker({ goodsId: board.goodsId });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function initHandleServe1() {
|
||||
|
||||
let newTestData = dataBase.value;
|
||||
@@ -727,11 +643,7 @@ function drawCutPoint() {
|
||||
alert('请先进行优化!');
|
||||
}
|
||||
}
|
||||
/** 优化后需要进行一定的数据处理 */
|
||||
function handleDataAfterPlace() {
|
||||
console.log('handleDataAfterPlace', dataBase.value)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制开料顺序
|
||||
*/
|
||||
@@ -760,34 +672,7 @@ function drawSortingPlace() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始手动放置
|
||||
*/
|
||||
function beinManualPlace() {
|
||||
if (!boardEditor.value || !dataBase.value) return;
|
||||
|
||||
displayFlags.value.showManualPlace = !displayFlags.value.showManualPlace;
|
||||
if (displayFlags.value.showManualPlace) {
|
||||
canvasController.value.showType = BoardShowType.MANUAL_PLACE;
|
||||
displayFlags.value.showBlocks = true;
|
||||
|
||||
// 初始化拖拽相关属性
|
||||
canvasController.value.isDragingBlock = false;
|
||||
canvasController.value.clickedBlock = null;
|
||||
canvasController.value.beginDragPosition = null;
|
||||
canvasController.value.dragingBlockPoint = null;
|
||||
canvasController.value.dragedDistance = { x: 0, y: 0 };
|
||||
canvasController.value.closestBlockPoint = null;
|
||||
|
||||
boardEditor.value.switchToManualPlaceMode();
|
||||
} else {
|
||||
canvasController.value.showType = BoardShowType.NORMAL;
|
||||
|
||||
canvasController.value.clickedBlock = null;
|
||||
boardEditor.value.switchToNormalMode();
|
||||
}
|
||||
reDrawCanvas();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理画布事件
|
||||
@@ -850,37 +735,7 @@ function startPlace() {
|
||||
displayFlags.value.showModels = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止排版
|
||||
*/
|
||||
function stopPlace() {
|
||||
_handleServe.value?.stopPlaceTask();
|
||||
isOptimizeing.value = false;
|
||||
plateSelectOptions.value = dataBase.value.materialList;
|
||||
let pm = dataBase.value.materialList[0];
|
||||
selectVal.value = pm.goodsId;
|
||||
paginationCurrent.value = 1;
|
||||
paginationCurrentAll.value = pm.boardList?.length;
|
||||
|
||||
if (pm && pm.boardList && pm.boardList.length > 0) {
|
||||
const pb = pm.boardList[0];
|
||||
|
||||
// 先计算开料顺序和下刀点
|
||||
_handleServe.value?.autoCalcCutOrder(pm, pb);
|
||||
|
||||
// 设置显示标志位,显示所有内容
|
||||
displayFlags.value.showBlocks = true;
|
||||
displayFlags.value.showCutPoints = true;
|
||||
displayFlags.value.showCutOrders = true;
|
||||
displayFlags.value.showCutArrow = true;
|
||||
displayFlags.value.showCutNo = true;
|
||||
displayFlags.value.showHoles = true;
|
||||
displayFlags.value.showModels = true;
|
||||
// 重新绘制
|
||||
reDrawCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清空画布
|
||||
*/
|
||||
@@ -896,78 +751,7 @@ function clearCanvas() {
|
||||
// 清空画布
|
||||
boardEditor.value?.clearCanvas();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制画布坐标轴
|
||||
*/
|
||||
function drawCanvasAxios() {
|
||||
if (boardEditor.value) {
|
||||
boardEditor.value.drawBase();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制机台
|
||||
*/
|
||||
function drawMachine() {
|
||||
boardEditor.value?.drawMachine();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制大板
|
||||
*/
|
||||
function drawBoard() {
|
||||
if (!currentMaterial.value || !currentBoard.value) {
|
||||
alert('请先进行优化!');
|
||||
return;
|
||||
}
|
||||
boardEditor.value?.drawBoard(currentBoard.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制小板
|
||||
*/
|
||||
function drawBlock() {
|
||||
if (!currentMaterial.value || !currentBoard.value) {
|
||||
alert('请先进行优化!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置显示标志位,只显示小板
|
||||
displayFlags.value.showBlocks = true;
|
||||
displayFlags.value.showCutPoints = false;
|
||||
displayFlags.value.showCutOrders = false;
|
||||
displayFlags.value.showCutArrow = false;
|
||||
displayFlags.value.showCutNo = false;
|
||||
displayFlags.value.showHoles = false;
|
||||
displayFlags.value.showModels = false;
|
||||
// 重新绘制
|
||||
reDrawCanvas();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制孔
|
||||
*/
|
||||
function drawHole() {
|
||||
let mIndex = dataBase.value.materialList.findIndex(e => e.goodsId == selectVal.value)
|
||||
let pIndex = paginationCurrent.value - 1
|
||||
// for (const block of dataBase.value.materialList[mIndex].boardList[pIndex].blockList) {
|
||||
// boardEditor.value?.draw_holes_new(block)
|
||||
// }
|
||||
// console.log(dataBase.value.materialList[mIndex].boardList[pIndex].blockList.map(e => e.placeStyle));
|
||||
// 设置显示标志位,只显示小板和下刀点
|
||||
if (mIndex >= 0 && dataBase.value.materialList[mIndex].boardList?.length > 0) {
|
||||
const pm = dataBase.value.materialList[mIndex];
|
||||
displayFlags.value.showBlocks = true;
|
||||
displayFlags.value.showHoles = !displayFlags.value.showHoles;
|
||||
|
||||
// 重新绘制
|
||||
reDrawCanvas();
|
||||
} else {
|
||||
alert('请先进行优化!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取解析器参数
|
||||
@@ -976,13 +760,7 @@ function getParserParams() {
|
||||
handleTemplateData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取解析器文本
|
||||
*/
|
||||
function getParserTxt() {
|
||||
testData1.value = 'ceee';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理模板数据
|
||||
*/
|
||||
@@ -1006,7 +784,9 @@ async function handleTemplateData() {
|
||||
let workSpeed = _handleServe.value?.workSpeed || 8000;
|
||||
let modelSpeed = _handleServe.value?.modelSpeed || 8000;
|
||||
let holeSpeed = _handleServe.value?.holeSpeed || 8000;
|
||||
|
||||
|
||||
/** 根据哪个加工面加工 */
|
||||
let doBackFace = true
|
||||
for (const template of templateData) {
|
||||
// 必须要有指令和代码
|
||||
if (!template.value || !template.orderStr) continue;
|
||||
@@ -1024,7 +804,7 @@ async function handleTemplateData() {
|
||||
* 先对该大板内所有小板上的孔进行分析
|
||||
*/
|
||||
|
||||
let allHoles: BlockHole[] = await BlockHelper.GetHoles_BoardAllBlocksByDoFace(board)
|
||||
let allHoles: BlockHole[] = await BlockHelper.GetHoles_BoardAllBlocksByDoFace(board,doBackFace)
|
||||
// 对孔列表 根据 孔直径 排序
|
||||
allHoles = allHoles.sort((a, b) => a.radius - b.radius)
|
||||
|
||||
@@ -1084,7 +864,7 @@ async function handleTemplateData() {
|
||||
//#region 造型
|
||||
|
||||
// 所有造型
|
||||
let allModels: BlockModel[] = await BlockHelper.GetModels_BoardAllBlocksByDoFace(board)
|
||||
let allModels: BlockModel[] = await BlockHelper.GetModels_BoardAllBlocksByDoFace(board,doBackFace)
|
||||
allModels = allModels.sort((a, b) => a.knifeRadius - b.knifeRadius)
|
||||
|
||||
for (const key in allModels) {
|
||||
@@ -1389,8 +1169,7 @@ function reDrawCanvas() {
|
||||
</Select>
|
||||
|
||||
<Button v-if="!isOptimizeing" @click="startPlace">开始优化</Button>
|
||||
<Button v-if="isOptimizeing" @click="stopPlace">停止优化</Button>
|
||||
|
||||
|
||||
<Button @click="drawSortingPlace">开料顺序</Button>
|
||||
<Button @click="drawCutPoint">下刀点</Button>
|
||||
<Button @click="getParserParams"> 解析器</Button>
|
||||
@@ -1412,30 +1191,7 @@ function reDrawCanvas() {
|
||||
|
||||
<div class="contentBtns">
|
||||
<Button class="contentBtn" @click="clearCanvas">清空</Button>
|
||||
<!-- <Button class="contentBtn" @click="drawCanvasAxios">绘制坐标系</Button>
|
||||
<Button class="contentBtn" @click="drawMachine">画机台</Button>
|
||||
<Button class="contentBtn" @click="drawBoard">画大板</Button>
|
||||
<Button class="contentBtn" @click="drawBlock">画小板</Button>
|
||||
<Button class="contentBtn" @click="drawHole">画孔</Button>
|
||||
<Button class="contentBtn" @click="drawModel">画造型</Button>
|
||||
<Button class="contentBtn" @click="beinManualPlace">手动排版</Button> -->
|
||||
<!-- <Button class="contentBtn" @click="handleDataAfterPlace">看数据</Button> -->
|
||||
|
||||
<Button class="contentBtn" @click="getParserTxt">获取加工TXT</Button>
|
||||
|
||||
|
||||
<!-- 手动排版工具按钮,只在手动排版模式下显示 -->
|
||||
<!-- <template v-if="displayFlags.showManualPlace">
|
||||
<Button class="contentBtn" @click="turnOver" :disabled="!canvasController.clickedBlock">翻面</Button>
|
||||
<Button class="contentBtn" @click="turnLeft" :disabled="!canvasController.clickedBlock">左转</Button>
|
||||
<Button class="contentBtn" @click="turnRight" :disabled="!canvasController.clickedBlock">右转</Button>
|
||||
<Button class="contentBtn" @click="turnBack" :disabled="!canvasController.clickedBlock">后转</Button>
|
||||
<Button class="contentBtn" @click="lockBoard" :disabled="!canvasController.clickedBlock">
|
||||
{{ isLocked ? '解锁' : '锁定' }}
|
||||
</Button>
|
||||
<Button class="contentBtn" @click="allLock">全部锁定</Button>
|
||||
<Button class="contentBtn" @click="allUnLock">全部解锁</Button>
|
||||
</template> -->
|
||||
|
||||
|
||||
<Textarea class="testData" v-model:value="testData1"></Textarea>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user