diff --git a/src/Add-on/Erp/HostURL.ts b/src/Add-on/Erp/HostURL.ts index c36ab5e61..a6eb8969b 100644 --- a/src/Add-on/Erp/HostURL.ts +++ b/src/Add-on/Erp/HostURL.ts @@ -6,6 +6,15 @@ switch (location.hostname) { case "t.cfcad.cn": //测试环境 ErpURL.host = "https://chenfeng.tech:777"; + let hash = location.hash.replace('#', ''); + if (hash != '') + { + let branch = hash.split('=')[1]; + if (branch) + { + ErpURL.host = branch; + } + } break; case "cfcad.cn": //生产环境 ErpURL.host = "https://sc.leye.site"; diff --git a/src/Add-on/Erp/Models/CadBlockInfo.ts b/src/Add-on/Erp/Models/CadBlockInfo.ts index e625473d4..ff9ebfbf0 100644 --- a/src/Add-on/Erp/Models/CadBlockInfo.ts +++ b/src/Add-on/Erp/Models/CadBlockInfo.ts @@ -4,7 +4,6 @@ export class CadBlockPoint PointX: number; PointY: number; Curve: number; - SealSize: number; } export class CadBlockHoles { @@ -50,9 +49,10 @@ export class BasePosition YVec: string; ZVec: string; } -export class CadBlockInfo +export class CadBlockInfo { PointDetail: CadBlockPoint[]; HoleDetail: CadBlockHoles[]; ModelDetail: CadBlockModel[]; + OrgPointDetail: CadBlockPoint[]; } diff --git a/src/Add-on/Erp/ParseData.ts b/src/Add-on/Erp/ParseData.ts index a278e6dc4..902c28290 100644 --- a/src/Add-on/Erp/ParseData.ts +++ b/src/Add-on/Erp/ParseData.ts @@ -40,12 +40,7 @@ export class ErpParseData block.BoxName = boxName; block.BoardName = entity.Name; //板名称 block.BoardType = entity.BoardType; // 板类型 0:层板 1:立板 2:背板 - let boardInfo = Production.GetBoardInfo(entity); block.GoodsID = 0; - //材料,颜色 - block.Color = boardInfo.color; - block.Material = boardInfo.material; - block.MaterialName = boardInfo.boardName; //板大小 block.Width = this.GetNumberBit(entity.Width, 3); // 宽 block.Height = this.GetNumberBit(entity.Height, 3); // 高 @@ -78,6 +73,10 @@ export class ErpParseData baseposition.YVec = `${yVec.x},${yVec.y},${yVec.z}`; baseposition.ZVec = `${zVec.x},${zVec.y},${zVec.z}`; let boardData = Production.GetBoardSplitOrderData(entity); + //材料,颜色 + block.Color = boardData.info.color; + block.Material = boardData.info.material; + block.MaterialName = boardData.info.boardName; block.FrontHoleCount = boardData.holes.frontBackHoles != null ? boardData.holes.frontBackHoles.filter(t => t.face === DrillingFace.Front).length : 0; block.BackHoleCount = boardData.holes.frontBackHoles != null ? boardData.holes.frontBackHoles.filter(t => t.face === DrillingFace.Back).length : 0; block.SideHoleCount = boardData.holes.sideHoles != null ? boardData.holes.sideHoles.length : 0; @@ -91,7 +90,8 @@ export class ErpParseData let cadModelArray = this.GetCadModelArray([modelData]); block.CadDataType = CadType.WebCad; let offsetArray = [boardData.offsetTanslation.x, boardData.offsetTanslation.y, boardData.offsetTanslation.z]; - block.CadData = JSON.stringify([pointInfoArray, basepositionArray, cadModelArray, offsetArray]); + let kaiLiaoArray = [boardData.info.kaiLiaoWidth, boardData.info.kaiLiaoHeight] + block.CadData = JSON.stringify([pointInfoArray, basepositionArray, cadModelArray, offsetArray, kaiLiaoArray]); blockList.push(block); } } @@ -125,7 +125,7 @@ export class ErpParseData return w; } //获取异形数据 - GetPointDetail(points: IContourData, seals: ISealingData[]): CadBlockPoint[] + GetPointDetail(points: IContourData): CadBlockPoint[] { if (points == null || points.pts == null) return []; let pointList: CadBlockPoint[] = []; @@ -136,7 +136,6 @@ export class ErpParseData newPoint.PointX = this.GetNumberBit(points.pts[i].x, 2); newPoint.PointY = this.GetNumberBit(points.pts[i].y, 2); newPoint.Curve = this.GetNumberBit(points.buls[i], 6); - newPoint.SealSize = seals[i].size; pointList.push(newPoint); } return pointList; @@ -301,9 +300,11 @@ export class ErpParseData GetBlockPointInfo(board: ISpliteOrderData): CadBlockInfo { let pointDetail: CadBlockPoint[] = []; + let orgPointDetail: CadBlockPoint[] = []; if (board.info.isRect === false) { - pointDetail = this.GetPointDetail(board.outline, board.sealing); + pointDetail = this.GetPointDetail(board.outline); + orgPointDetail = this.GetPointDetail(board.originOutlin); } let frontModelDetail = this.GetModelDetail(board.modeling, FrontOrSide.正面反面); let sideModelDetail = this.GetModelDetail(board.sideModeling, FrontOrSide.侧面); @@ -317,6 +318,7 @@ export class ErpParseData result.PointDetail = pointDetail; result.HoleDetail = holeDetail; result.ModelDetail = modelDetail; + result.OrgPointDetail = orgPointDetail; return result; } @@ -365,7 +367,7 @@ export class ErpParseData { return points.map(p => { - return [p.PointID, p.PointX, p.PointY, p.Curve, p.SealSize]; + return [p.PointID, p.PointX, p.PointY, p.Curve]; }); } GetHolesArray(holes: CadBlockHoles[]) @@ -394,9 +396,9 @@ export class ErpParseData { return [info.BasePoint, info.XVec, info.YVec, info.ZVec]; } - GetPointInfoArray(info: CadBlockInfo): [object, object, object] + GetPointInfoArray(info: CadBlockInfo): [object, object, object, object] { - return [this.GetPointsArray(info.PointDetail), this.GetHolesArray(info.HoleDetail), this.GetModelsArray(info.ModelDetail)]; + return [this.GetPointsArray(info.PointDetail), this.GetHolesArray(info.HoleDetail), this.GetModelsArray(info.ModelDetail), this.GetPointsArray(info.OrgPointDetail)]; } GetBasePositionArray(basePosition: CadBlockBasePosition): [number, number, number] { diff --git a/src/Production/Product.ts b/src/Production/Product.ts index 60d994f48..9fa024578 100644 --- a/src/Production/Product.ts +++ b/src/Production/Product.ts @@ -76,6 +76,8 @@ interface IBoardProdInfo isRect: boolean; reamarks: any[]; + kaiLiaoWidth: number; + kaiLiaoHeight: number; } /**拆单数据 */ @@ -88,6 +90,7 @@ export interface ISpliteOrderData holes: IBoardHoleInfo; //孔信息 sideModeling: IModelingData[]; //侧面造型信息 offsetTanslation: Vector3; + originOutlin: IContourData; //不扣封边原始轮廓 } export namespace Production @@ -102,9 +105,16 @@ export namespace Production //外轮廓去掉最后的闭合点 outlinePtsBul.pts.pop(); outlinePtsBul.buls.pop(); + let size = outline.BoundingBox.getSize(new Vector3); + + //不扣除封边的轮廓信息 + let originOutlinePtsBul = ConverToPolylineAndSplitArc(br.ContourCurve.Clone()); + originOutlinePtsBul.pts.pop(); + originOutlinePtsBul.buls.pop(); return { - info: GetBoardInfo(br), + info: GetBoardInfo(br, size), + originOutlin: originOutlinePtsBul, outline: outlinePtsBul, sealing: GetBoardSealingData(br), modeling: GetBoardModelingData(br, offsetTanslation), @@ -113,7 +123,7 @@ export namespace Production offsetTanslation, }; } - export function GetBoardInfo(br: Board): IBoardProdInfo + export function GetBoardInfo(br: Board, size: Vector3): IBoardProdInfo { let data = br.BoardProcessOption; return { @@ -131,6 +141,8 @@ export namespace Production spliteWidth: data.spliteWidth, isRect: !br.IsSpecialShape, reamarks: [], + kaiLiaoWidth: size.x, + kaiLiaoHeight: size.y, }; }