!1426 功能:BBS统计通孔,双头杆数量

pull/1426/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent 6aeb76389e
commit 3ecb8538b8

@ -12,6 +12,7 @@ import { HardwareCompositeEntity } from "../../DatabaseServices/Hardware/Hardwar
import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline"; import { HardwareTopline } from "../../DatabaseServices/Hardware/HardwareTopline";
import { equaln } from "../../Geometry/GeUtils"; import { equaln } from "../../Geometry/GeUtils";
import { IHardwareType, Production } from "../../Production/Product"; import { IHardwareType, Production } from "../../Production/Product";
import { HoleInBoard } from "../DrawDrilling/HoleUtils";
export interface ICountType<T = IHardwareType> export interface ICountType<T = IHardwareType>
{ {
@ -121,46 +122,72 @@ class LookOverBoardInfosTool
{ {
for (let ids of idList) for (let ids of idList)
{ {
let holes = ids.map(id => id.Object) as Hole[];
if (!holes[0] || !HoleInBoard(holes, b))
continue;
let isTk = false;
let spliteName = "";
let hole: Hole;
let pxlCount = 0;
findHole: findHole:
for (let objId of ids) for (let objId of ids)
{ {
let gd = objId.Object; let gd = objId.Object as CylinderHole | ExtrudeHole;
if (!gd?.IsErase) if (!gd || gd.IsErase) break;
const group = gd.GroupId?.Object as GroupRecord;
if (!group)
{ {
if (gd instanceof CylinderHole) Toaster({ message: `柜名:${b.BoardProcessOption.cabinetName} 板名:${b.Name} 的排钻的编组丢失,统计排钻个数时会丢失该个数!`, timeout: 5000, intent: Intent.DANGER });
switch (gd.Type) break;
{ }
case GangDrillType.Ljg:
case GangDrillType.Pxl: if (gd instanceof CylinderHole)
case GangDrillType.Ymj: switch (gd.Type)
case GangDrillType.Ljg:
case GangDrillType.TK:
let spiteName = (gd.GroupId?.Object as GroupRecord)?.Name ?? "未命名";
//读取拆单名
addDrillToMap(spiteName, gd);
break findHole;
case GangDrillType.Wood:
case GangDrillType.WoodPXL:
addDrillToMap("木销", gd);
break findHole;
}
else
{ {
//TODO:统计自定义排钻 case GangDrillType.Pxl:
if (gd instanceof ExtrudeHole) pxlCount++;
{ break;
if (gd?.GroupId?.Object) case GangDrillType.Ljg:
{ case GangDrillType.Ymj:
let name = (gd.GroupId.Object as GroupRecord).Name; break;
let ents = (gd.GroupId.Object as GroupRecord).Entitys; case GangDrillType.TK:
addDrillToMap(name, ents[0].Object as Hole); isTk = true;
} break;
else case GangDrillType.Wood:
{ case GangDrillType.WoodPXL:
Toaster({ message: `柜名:${b.BoardProcessOption.cabinetName} 板名:${b.Name} 的排钻的编组丢失,统计排钻个数时会丢失该个数!`, timeout: 5000, intent: Intent.DANGER }); spliteName = "木销";
} break;
} default:
break findHole;
} }
else
{
if (gd.isThrough)
isTk = true;
}
if (!spliteName)
spliteName = group.Name ?? "未命名";
if (!hole)
hole = gd;
}
if (spliteName && hole)
{
if (isTk)
{
addDrillToMap("通孔" + spliteName, hole);
}
else if (pxlCount === 2)
{
addDrillToMap("双头" + spliteName, hole);
}
else
{
addDrillToMap(spliteName, hole);
} }
} }
} }

@ -324,6 +324,7 @@ export class Board extends ExtrudeSolid
{ {
if (br.__OriginalEnt__) if (br.__OriginalEnt__)
{ {
br._Name = this._Name;
br._DrillList = new Map(this._DrillList.entries()); br._DrillList = new Map(this._DrillList.entries());
br._LayerNails = [...this._LayerNails]; br._LayerNails = [...this._LayerNails];
br.ProcessingGroupList = [...this.ProcessingGroupList]; br.ProcessingGroupList = [...this.ProcessingGroupList];

@ -229,7 +229,6 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
this.InitWidth(); this.InitWidth();
let selectCtrl = app.Editor.SelectCtrl; let selectCtrl = app.Editor.SelectCtrl;
let dr = new DrillingReactor();
const UpdateByRedoUndo = (historyRec: CommandHistoryRecord) => const UpdateByRedoUndo = (historyRec: CommandHistoryRecord) =>
{ {
loop1: loop1:
@ -295,7 +294,7 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
e.stopPropagation(); e.stopPropagation();
return true; return true;
}), }),
end(dr, dr.StartReactor, () => end(app._drillingReactor, app._drillingReactor.StartReactor, () =>
{ {
this.UpdateDrillCount(this.dataList.realBr); this.UpdateDrillCount(this.dataList.realBr);
}), }),
@ -869,125 +868,123 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
const listItemHeight = 23; const listItemHeight = 23;
return ( return (
<> <div
<div className={Classes.DIALOG_CONTAINER}
className={Classes.DIALOG_CONTAINER} style={{ width: "100%", height: "100%" }}
style={{ width: "100%", height: "100%" }} >
> <div className={Classes.DIALOG + " br-lookover"}>
<div className={Classes.DIALOG + " br-lookover"}> <ModalHeader
<ModalHeader title="板件属性"
title="板件属性" icon="bold"
icon="bold" close={() => { this.OnOk(ModalState.Cancel); }}
close={() => { this.OnOk(ModalState.Cancel); }} isPinBtn={true}
isPinBtn={true} />
/> <div className={Classes.DIALOG_BODY + " flex " + Classes.CARD} style={{ height: 400, width: "100%" }}>
<div className={Classes.DIALOG_BODY + " flex " + Classes.CARD} style={{ height: 400, width: "100%" }}> {/* 列表 */}
{/* 列表 */} <Card>
<Card> <AutoSizer>
<AutoSizer>
{
({ height, width }) => (
<>
<BoardList
height={height}
width={width}
dragDivH={this.dragDivH}
searchRes={this.searchRes}
selectedBrOnList={this.selectedBrOnList}
UpdateDisplayData={this.UpdateDisplayData}
isCtrlDown={this.isCtrlDown}
processGroupMap={this.processGroupMap}
modifyBoardData={this.modifyBoardData}
UpdateSeletctedBr={this.UpdateSeletctedBr}
ModifyBoard={this.ModifyBoard}
/>
{/* 配件信息 */}
{
<div>
<Divider style={{ height: 1, width: width * 0.99 }} />
<Rnd
className="drag-handle"
disableDragging={true}
enableResizing={{ top: true }}
maxHeight={335}
onResize={(e, direction, ref, delta, position) =>
{
this.dragDivH = ref.clientHeight;
this.setState({ dragDivH: ref.clientHeight });
}}
>
<>
<div style={{ height: this.state.dragDivH - 1, width: width, overflow: "auto", paddingLeft: 10, paddingTop: 4, marginTop: 1 }} >
{/* 配件信息 */}
<PartsTable partsCount={this.drillCount} titles={["配件拆单名", "数量", "单位"]} type={PartsType.Hole} />
<PartsTable partsCount={this.sealCount} titles={["配件拆单名", "宽度", "颜色", "数量", "单位"]} type={PartsType.Edge} />
<PartsTable partsCount={this.hardwareCount} titles={HardwareTitles} type={PartsType.Hardware} />
<PartsTable partsCount={this.areaCount} titles={AreaTitle} type={PartsType.Area} />
</div>
</>
</Rnd>
</div>
}
</>
)
}
</AutoSizer>
</Card>
</div>
<ModalFooter hasConfig={false}>
<label className={Classes.LABEL + " " + Classes.INLINE}>
<label>{`总计 ${this.searchRes.dataBr.length} 块板, `}</label>
<label>{`总计 ${this.CalcArea()}平方 `}</label>
</label>
<InputGroup className={"search"} type="search" placeholder="关键字查找..." dir="auto"
onChange={(e) => { this.searchingStr = e.target.value; this.SearchData(); }}
onFocus={this.ConvertBoardListDataToArray}
value={this.searchingStr} />
<Button
text="重置"
intent={Intent.DANGER}
onClick={() =>
{ {
this.modifyBoardData = new Map(); ({ height, width }) => (
this.dataList.dataBr = []; <>
this.dataList.realBr.forEach((b) => { this.dataList.dataBr.push(b.Clone()); }); <BoardList
Object.assign(this.searchRes, this.dataList); height={height}
}} width={width}
/> dragDivH={this.dragDivH}
<Button searchRes={this.searchRes}
intent={Intent.PRIMARY} selectedBrOnList={this.selectedBrOnList}
text="查看选中板" UpdateDisplayData={this.UpdateDisplayData}
onClick={this.LookSelectBr} isCtrlDown={this.isCtrlDown}
/> processGroupMap={this.processGroupMap}
<Button modifyBoardData={this.modifyBoardData}
intent={Intent.DANGER} UpdateSeletctedBr={this.UpdateSeletctedBr}
text="清除所有选中" ModifyBoard={this.ModifyBoard}
onClick={this.ClearSelectedBr} />
/> {/* 配件信息 */}
<Button {
intent={Intent.PRIMARY} <div>
text="显示同属性板件" <Divider style={{ height: 1, width: width * 0.99 }} />
disabled={!(this.selectedBrOnList.length === 1)} <Rnd
onClick={() => { this.CheckOutSameTypeBr(this.BoardList); }} className="drag-handle"
/> disableDragging={true}
<Button enableResizing={{ top: true }}
text="应用数据修改" maxHeight={335}
intent={Intent.SUCCESS} onResize={(e, direction, ref, delta, position) =>
onClick={() => {
{ this.OnOk(ModalState.Ok, { type: EFindType.Modify }); }} /> this.dragDivH = ref.clientHeight;
{/* <Button this.setState({ dragDivH: ref.clientHeight });
}}
>
<>
<div style={{ height: this.state.dragDivH - 1, width: width, overflow: "auto", paddingLeft: 10, paddingTop: 4, marginTop: 1 }} >
{/* 配件信息 */}
<PartsTable partsCount={this.drillCount} titles={["配件拆单名", "数量", "单位"]} type={PartsType.Hole} />
<PartsTable partsCount={this.sealCount} titles={["配件拆单名", "宽度", "颜色", "数量", "单位"]} type={PartsType.Edge} />
<PartsTable partsCount={this.hardwareCount} titles={HardwareTitles} type={PartsType.Hardware} />
<PartsTable partsCount={this.areaCount} titles={AreaTitle} type={PartsType.Area} />
</div>
</>
</Rnd>
</div>
}
</>
)
}
</AutoSizer>
</Card>
</div>
<ModalFooter hasConfig={false}>
<label className={Classes.LABEL + " " + Classes.INLINE}>
<label>{`总计 ${this.searchRes.dataBr.length} 块板, `}</label>
<label>{`总计 ${this.CalcArea()}平方 `}</label>
</label>
<InputGroup className={"search"} type="search" placeholder="关键字查找..." dir="auto"
onChange={(e) => { this.searchingStr = e.target.value; this.SearchData(); }}
onFocus={this.ConvertBoardListDataToArray}
value={this.searchingStr} />
<Button
text="重置"
intent={Intent.DANGER}
onClick={() =>
{
this.modifyBoardData = new Map();
this.dataList.dataBr = [];
this.dataList.realBr.forEach((b) => { this.dataList.dataBr.push(b.Clone()); });
Object.assign(this.searchRes, this.dataList);
}}
/>
<Button
intent={Intent.PRIMARY}
text="查看选中板"
onClick={this.LookSelectBr}
/>
<Button
intent={Intent.DANGER}
text="清除所有选中"
onClick={this.ClearSelectedBr}
/>
<Button
intent={Intent.PRIMARY}
text="显示同属性板件"
disabled={!(this.selectedBrOnList.length === 1)}
onClick={() => { this.CheckOutSameTypeBr(this.BoardList); }}
/>
<Button
text="应用数据修改"
intent={Intent.SUCCESS}
onClick={() =>
{ this.OnOk(ModalState.Ok, { type: EFindType.Modify }); }} />
{/* <Button
// 待补充 // 待补充
text="修改选择板件的板材" /> */} text="修改选择板件的板材" /> */}
<Button <Button
intent={Intent.PRIMARY} intent={Intent.PRIMARY}
text="导出CSV" text="导出CSV"
onClick={this.HandleExportCSV} onClick={this.HandleExportCSV}
/> />
</ModalFooter> </ModalFooter>
</div>
</div> </div>
</> </div>
); );
} }
} }

@ -163,72 +163,76 @@ export class KnifeManage extends Component<IKnifeManageProps, IKnifeManageState>
}; };
private handleCreateKnife = async (name: string, currentDir: IDirectoryProps, callback: Function) => private handleCreateKnife = async (name: string, currentDir: IDirectoryProps, callback: Function) =>
{ {
let plRes = await app.Editor.GetSelection({ await CommandWrap(async () =>
Once: true,
AllowNone: false,
Msg: "选择闭合轮廓",
Filter: {
filterTypes: [Polyline],
},
});
if (plRes.Status !== PromptStatus.OK)
{ {
return; let plRes = await app.Editor.GetSelection({
}; Once: true,
AllowNone: false,
Msg: "选择闭合轮廓",
Filter: {
filterTypes: [Polyline],
},
});
if (plRes.Status !== PromptStatus.OK)
{
return;
};
let pl = GetCloseContour(plRes.SelectSet.SelectEntityList[0] as Polyline); let pl = GetCloseContour(plRes.SelectSet.SelectEntityList[0] as Polyline);
if (!pl) if (!pl)
{ {
return; return;
} }
if (!pl) return; if (!pl) return;
let ptRes = await app.Editor.GetPoint({ let ptRes = await app.Editor.GetPoint({
Msg: "指定基点" Msg: "指定基点"
}); });
//基点移动到基点 //基点移动到基点
pl.ApplyMatrix(MoveMatrix(ptRes.Point.negate())) pl.ApplyMatrix(MoveMatrix(ptRes.Point.negate()))
.ApplyMatrix(new Matrix4().extractRotation(pl.OCSInv)); .ApplyMatrix(new Matrix4().extractRotation(pl.OCSInv));
let vf = new CADFiler(); let vf = new CADFiler();
pl.WriteFile(vf); pl.WriteFile(vf);
pl.Erase(); pl.Erase();
let fileJson = JSON.stringify(vf.Data); let fileJson = JSON.stringify(vf.Data);
let logo = getPolylineSVG(pl); let logo = getPolylineSVG(pl);
let data: { err_code: RequestStatus; }; let data: { err_code: RequestStatus; };
if (this.currentInfo.id) if (this.currentInfo.id)
{ {
data = await PostJson(ToplineUrls.update, { data = await PostJson(ToplineUrls.update, {
topline_id: this.currentInfo.id, topline_id: this.currentInfo.id,
logo, logo,
file: deflate(fileJson), file: deflate(fileJson),
zip_type: "gzip", zip_type: "gzip",
}); });
} }
else else
{ {
data = await PostJson(ToplineUrls.create, { data = await PostJson(ToplineUrls.create, {
dir_id: currentDir.id, dir_id: currentDir.id,
name, name,
logo, logo,
file: deflate(fileJson), file: deflate(fileJson),
zip_type: "gzip", zip_type: "gzip",
}); });
} }
if (data.err_code === RequestStatus.Ok)
{
AppToaster.show({
message: "刀具创建成功,默认半径3,夹角45°",
timeout: 3000,
intent: Intent.SUCCESS
});
await callback();
}
}, this.currentInfo.id ? "更新刀具" : "选择刀具");
if (data.err_code === RequestStatus.Ok)
{
AppToaster.show({
message: "刀具创建成功,默认半径3,夹角45°",
timeout: 3000,
intent: Intent.SUCCESS
});
await callback();
}
}; };
handleRenameKP = async (name: string) => handleRenameKP = async (name: string) =>

@ -62,7 +62,7 @@ export class ModelingComponent2 extends React.Component<{ store?: Modeling2Store
<div> <div>
{ {
d.items.map((item, i) => d.items.map((item, i) =>
<div key={i}> <div key={d1items[i].id}>
{ {
!is3D && <ToasterInput !is3D && <ToasterInput
type={CheckObjectType.OnlyNumber} type={CheckObjectType.OnlyNumber}

@ -13,6 +13,7 @@ export interface IKnifeInfo2
export interface IVModelingInfo export interface IVModelingInfo
{ {
id: string;
offset: number; offset: number;
depth: number; depth: number;
knife: IKnifeInfo2; knife: IKnifeInfo2;
@ -39,10 +40,15 @@ export class Modeling2Store implements IConfigStore
@observable modelingItems: IModeling2Item[] = []; @observable modelingItems: IModeling2Item[] = [];
@observable uiModeingItems: IUiVModeing[] = []; @observable uiModeingItems: IUiVModeing[] = [];
isUpdate = true; isUpdate = true;
private _ModelingItemId = 0;
constructor() constructor()
{ {
this.InitModelingItems(); this.InitModelingItems();
} }
get Id()
{
return `${Date.now()}-${this._ModelingItemId++}`;
}
@action @action
InitModelingItems() InitModelingItems()
{ {
@ -57,6 +63,7 @@ export class Modeling2Store implements IConfigStore
dir: FaceDirection.Front, dir: FaceDirection.Front,
items: [ items: [
{ {
id: this.Id,
offset: 0, offset: 0,
depth: 0, depth: 0,
knife: { id: "", name: "", props: { radius: 3, angle: 45 } } knife: { id: "", name: "", props: { radius: 3, angle: 45 } }
@ -96,10 +103,12 @@ export class Modeling2Store implements IConfigStore
{ {
const items = this.modelingItems[index].items; const items = this.modelingItems[index].items;
items.push({ const newItem = {
...items[0], ...items[0],
knife: { ...items[0].knife, props: { ...items[0].knife.props } } knife: { ...items[0].knife, props: { ...items[0].knife.props } }
}); };
newItem.id = this.Id;
items.push(newItem);
this.uiModeingItems[index].items.push({ this.uiModeingItems[index].items.push({
offset: "0", offset: "0",
depth: "0", depth: "0",
@ -114,6 +123,7 @@ export class Modeling2Store implements IConfigStore
ChangeModelingValue(index: number, data: I2DModeling) ChangeModelingValue(index: number, data: I2DModeling)
{ {
let newItems: IVModelingInfo[] = data.items.map(item => ({ let newItems: IVModelingInfo[] = data.items.map(item => ({
id: this.Id,
offset: item.offset, offset: item.offset,
depth: item.depth, depth: item.depth,
knife: { knife: {
@ -133,6 +143,7 @@ export class Modeling2Store implements IConfigStore
ChangeModelingValue3D(index: number, item: { knife: IKnifeInfo, dir: FaceDirection; }) ChangeModelingValue3D(index: number, item: { knife: IKnifeInfo, dir: FaceDirection; })
{ {
let newItem = { let newItem = {
id: this.Id,
dir: item.dir, dir: item.dir,
offset: 0, offset: 0,
depth: 0, depth: 0,
@ -170,6 +181,8 @@ export class Modeling2Store implements IConfigStore
uiItems.length = items.length; uiItems.length = items.length;
for (let j = 0; j < items.length; j++) for (let j = 0; j < items.length; j++)
{ {
if (!items[j].id)
items[j].id = this.Id;
if (uiItems[j]) if (uiItems[j])
{ {
uiItems[j].depth = items[j].depth.toString(); uiItems[j].depth = items[j].depth.toString();

Loading…
Cancel
Save