!2213 拆单时板材备注写入排钻信息

pull/2204/MERGE
cf-erp 1 year ago committed by ChenX
parent e70382a55b
commit 6717dbcc71

@ -10,12 +10,13 @@ import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline
import { ObjectId } from "../../DatabaseServices/ObjectId";
import { TemplateRecord } from "../../DatabaseServices/Template/TemplateRecord";
import { CoordinateSystem } from "../../Geometry/CoordinateSystem";
import { AsVector2, equalv3, GetBoxArr, ZeroVec } from "../../Geometry/GeUtils";
import { AsVector2, GetBoxArr, ZeroVec, equalv3 } from "../../Geometry/GeUtils";
import { IContourData } from "../../Production/Convert2PtsBul";
import { I2DModeling, I3DContourData, I3DModeling, IDrillingOption, IHardwareType, IModelingData, ISpliteHardwareData, ISpliteOrderData, Production } from '../../Production/Product';
import { EMetalsType } from "../../UI/Components/RightPanel/RightPanelInterface";
import { BoardOpenDir, FaceDirection, ISealingData, LinesType } from "../../UI/Store/BoardInterface";
// import { DownPanelStore } from "../../UI/Store/DownPanelStore";
import { userConfig } from "../../Editor/UserConfig";
import { GetCountOption, ICountType, lookOverBoardInfosTool } from "../LookOverBoardInfos/LookOverBoardInfosTool";
import { HardwareCompositeEntity } from './../../DatabaseServices/Hardware/HardwareCompositeEntity';
import { ProcessingGroupRecord } from './../../DatabaseServices/ProcessingGroup/ProcessingGroupRecord';
@ -127,7 +128,7 @@ export class ErpParseData
let boardData = Production.GetBoardSplitOrderData(entity);
if (!boardData)
return;//返回空数据,提示用户修改,结束拆单
this.UpdateBoardDrillRemark(boardData);
// if (boardData.info.isRect)
// {
//矩形和异形封边
@ -173,11 +174,9 @@ export class ErpParseData
block.KaiLiaoHeight = boardData.info.kaiLiaoHeight;
let kaiLiaoArray = [boardData.info.kaiLiaoWidth, boardData.info.kaiLiaoHeight];
block.CadData = JSON.stringify([pointInfoArray, basepositionArray, cadModelArray, offsetArray, kaiLiaoArray]);
let filter = (remark: [string, string]) => { return !remark[0].startsWith('jl-') && !remark[0].startsWith('$'); };
block.RemarkJson = JSON.stringify(this.GetRemark(boardData.info.remarks, filter).map(t => t[1]));
//铰链备注处理,后期去掉
let jlFilter = (remark: [string, string]) => { return remark[0].startsWith('jl-') || remark[0].startsWith('$'); };
block.RemarkExtra = JSON.stringify(this.GetRemark(boardData.info.remarks, jlFilter));
const extraFilter = (remark) => { return remark.startsWith('jl-') || remark.startsWith('$') || remark.startsWith('#drills'); };
block.RemarkJson = JSON.stringify(boardData.info.remarks.filter(t => !extraFilter(t[0])));
block.RemarkExtra = JSON.stringify(boardData.info.remarks.filter(t => extraFilter(t[0])));
//新增板材备注列表
block.AllRemarkList = boardData.info.remarks;
let boxSize = boxSizeList.get(entity);
@ -715,12 +714,6 @@ export class ErpParseData
}
return add;
}
GetRemark(remarks: [string, string][], filter: (block: [string, string]) => boolean)
{
if (filter)
return remarks.filter(t => filter(t));
return remarks;
}
GetDrillObjects(drills: ICountType[], RoomName: string, BoxName: string, specFun: (name: string) => { spec: string, count: number; }[])
{
return drills.map(t =>
@ -893,6 +886,40 @@ export class ErpParseData
return object;
});
}
UpdateBoardDrillRemark(spliteData: ISpliteOrderData)
{
if (userConfig.chaidanOption.drillRemark === false) return;
const fun = (holes: IDrillingOption[], frontOrSide: FrontOrSide) =>
{
const holeList = holes.map(t => { return { name: t.type == (GangDrillType.Wood || t.type == GangDrillType.WoodPXL) ? '木销' : t.name, type: t.type, face: t.face }; });
let groupList = this.groupBy(holeList, ['name', 'type', 'face']);
let infos: { name: string, type: string, face: string, count: number; }[] = [];
for (const g of groupList)
{
const holeMap = { 0: '偏心轮', 10: '预埋件', };
const holeType = frontOrSide == FrontOrSide. ? holeMap[this.GetHoleType(g.keyList[1])] : '连接杆';
let face = '';
if (frontOrSide == FrontOrSide.)
face = { 0: '正面', 1: '反面' }[g.keyList[2]];
else
face = { 0: '上侧面', 1: '右侧面', 2: '下侧面', 3: '左侧面' }[g.keyList[2]];
infos.push({ name: g.keyList[0], type: holeType, face: face, count: g.value.length });
}
return infos;
};
let list = [...fun(spliteData.holes.frontBackHoles, FrontOrSide.), ...fun(spliteData.holes.sideHoles, FrontOrSide.)];
if (list.length > 0)
{
let remarks = spliteData.info.remarks.slice();
let drillRemark = remarks.find(t => t[0] == '#drills');
if (drillRemark)
drillRemark[1] = JSON.stringify(list);
else
remarks.push(['#drills', JSON.stringify(list)]);
spliteData.info.remarks = remarks;
}
}
groupBy(data: any[], fileds: string[])
{
let groupList = {};

@ -77,6 +77,7 @@ export class IHostApplicationServices
noModeingData: "", //非造型遭数据
statTk: false,//统计通孔排钻
statSt: false,//统计双头排钻
drillRemark: false//拆单获取排钻备注
};
@ProxyValue viewSize = {

@ -5,8 +5,8 @@ import { RenderType } from "../GraphicsSystem/RenderType";
import { IConfigOption } from "../UI/Components/Board/UserConfigComponent";
import { IBaseOption, IGrooveOption } from "../UI/Store/BoardInterface";
import { IConfigStore } from "../UI/Store/BoardStore";
import { DrillingOption } from "../UI/Store/drillInterface";
import { IWineRackOption } from "../UI/Store/WineRackInterface";
import { DrillingOption } from "../UI/Store/drillInterface";
import { ICursorConfig } from "./ICursorConfig";
export interface IMaxSizeProps extends IBaseOption
@ -117,6 +117,7 @@ export class UserConfig implements IConfigStore
noModeingData: "", //非造型遭数据
statTk: false,//统计通孔排钻
statSt: false,//统计双头排钻
drillRemark: false//拆单获取排钻备注
};
@observable viewSize = {
minViewHeight: 1e-3,

@ -6,7 +6,7 @@ import { Board } from "../DatabaseServices/Entity/Board";
import { Circle } from "../DatabaseServices/Entity/Circle";
import { ExtrudeContourCurve } from "../DatabaseServices/Entity/Extrude";
import { Line } from "../DatabaseServices/Entity/Line";
import { angleTo, equaln, equalv3, isParallelTo, XAxis } from "../Geometry/GeUtils";
import { XAxis, angleTo, equaln, equalv3, isParallelTo } from "../Geometry/GeUtils";
import { FaceDirection } from "../UI/Store/BoardInterface";
import { IBoardHoleInfo, IDrillingOption } from "./Product";
@ -155,7 +155,8 @@ export class ParseBoardHoleData
depth,
face,
endPt,
angle
angle,
name: d.GroupId.Object['name']
});
}
@ -191,6 +192,7 @@ export class ParseBoardHoleData
depth: z0 < 1e-6 ? z1 : this._Board.Thickness - z0,
face: z0 < 1e-6 ? FaceDirection.Back : FaceDirection.Front,
angle: angleTo(XAxis, x),
name: d.GroupId.Object['name']
});
}
}
@ -244,6 +246,7 @@ export class ParseBoardHoleData
radius: cir.Radius,
depth,
face,
name: d.GroupId.Object['name']
});
}
}

@ -4,11 +4,11 @@ import { lookOverBoardInfosTool } from "../Add-on/LookOverBoardInfos/LookOverBoa
import { HostApplicationServices } from "../ApplicationServices/HostApplicationServices";
import { EBoardKeyList } from "../Common/BoardKeyList";
import { MergeCurvelist } from "../Common/CurveUtils";
import { ParseExpr, safeEval } from "../Common/eval";
import { Log } from "../Common/Log";
import { ShowSelectObjects } from "../Common/ShowSelectObjects";
import { Intent, Toaster } from "../Common/Toaster";
import { FixedNotZero, LINK_FUZZ } from "../Common/Utils";
import { ParseExpr, safeEval } from "../Common/eval";
import { CylinderHole, GangDrillType } from "../DatabaseServices/3DSolid/CylinderHole";
import { ExtrudeHole } from "../DatabaseServices/3DSolid/ExtrudeHole";
import { Hole } from "../DatabaseServices/3DSolid/Hole";
@ -23,7 +23,7 @@ import { HardwareCompositeEntity } from "../DatabaseServices/Hardware/HardwareCo
import { HardwareTopline } from "../DatabaseServices/Hardware/HardwareTopline";
import { Shape } from "../DatabaseServices/Shape";
import { CanDrawHoleFuzz } from "../Geometry/DrillParse/BoardGetFace";
import { angleTo, equaln, equalv3, IsBetweenA2B, isIntersect2, isParallelTo, isPerpendicularityTo, MoveMatrix, XAxis } from "../Geometry/GeUtils";
import { IsBetweenA2B, MoveMatrix, XAxis, angleTo, equaln, equalv3, isIntersect2, isParallelTo, isPerpendicularityTo } from "../Geometry/GeUtils";
import { GetBoardSealingData, GetSealedBoardContour } from "../GraphicsSystem/CalcEdgeSealing";
import { FeedingToolPath, GetModelingFromCustomDrill } from "../GraphicsSystem/ToolPath/FeedingToolPath";
import { EMetalsType, IHardwareOption, IToplineOption } from "../UI/Components/RightPanel/RightPanelInterface";
@ -59,6 +59,7 @@ export interface IDrillingOption
face: FaceDirection;
endPt?: Vector3;
angle?: number;
name: string;
}
export interface IBoardHoleInfo
@ -482,6 +483,7 @@ export namespace Production
radius: nail.Radius,
depth,
face,
name: nail.GroupId.Object['name']
});
}
}
@ -498,7 +500,8 @@ export namespace Production
position: center,
radius: cu.Radius,
depth: m.thickness,
face: m.dir as number
face: m.dir as number,
name: cu.GroupId.Object['name']
}
);
}
@ -662,7 +665,8 @@ export namespace Production
radius: cyHole.Radius,//排钻半径
depth,//排钻的插入深度
face,//板在哪个边上
angle
angle,
name: cyHole.GroupId.Object['name']
});
}
@ -724,6 +728,7 @@ export namespace Production
depth,
face: z0 < CanDrawHoleFuzz ? FaceDirection.Back : FaceDirection.Front,
angle: angle,
name: d.GroupId.Object['name']
});
}
else
@ -776,6 +781,7 @@ export namespace Production
radius: cir.Radius,
depth,
face,
name: d.GroupId.Object['name']
});
}
}

@ -90,6 +90,11 @@ export class ChaiDanPanel extends React.Component
checked={userConfig.chaidanOption.statSt}
onChange={() => userConfig.chaidanOption.statSt = !userConfig.chaidanOption.statSt}
/>
<Checkbox
label="拆单获取排钻备注"
checked={userConfig.chaidanOption.drillRemark}
onChange={() => userConfig.chaidanOption.drillRemark = !userConfig.chaidanOption.drillRemark}
/>
</Card>
);
}

Loading…
Cancel
Save