!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 { equaln } from "../../Geometry/GeUtils";
import { IHardwareType, Production } from "../../Production/Product";
import { HoleInBoard } from "../DrawDrilling/HoleUtils";
export interface ICountType<T = IHardwareType>
{
@ -121,46 +122,72 @@ class LookOverBoardInfosTool
{
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:
for (let objId of ids)
{
let gd = objId.Object;
if (!gd?.IsErase)
let gd = objId.Object as CylinderHole | ExtrudeHole;
if (!gd || gd.IsErase) break;
const group = gd.GroupId?.Object as GroupRecord;
if (!group)
{
if (gd instanceof CylinderHole)
switch (gd.Type)
{
case GangDrillType.Ljg:
case GangDrillType.Pxl:
case GangDrillType.Ymj:
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
Toaster({ message: `柜名:${b.BoardProcessOption.cabinetName} 板名:${b.Name} 的排钻的编组丢失,统计排钻个数时会丢失该个数!`, timeout: 5000, intent: Intent.DANGER });
break;
}
if (gd instanceof CylinderHole)
switch (gd.Type)
{
//TODO:统计自定义排钻
if (gd instanceof ExtrudeHole)
{
if (gd?.GroupId?.Object)
{
let name = (gd.GroupId.Object as GroupRecord).Name;
let ents = (gd.GroupId.Object as GroupRecord).Entitys;
addDrillToMap(name, ents[0].Object as Hole);
}
else
{
Toaster({ message: `柜名:${b.BoardProcessOption.cabinetName} 板名:${b.Name} 的排钻的编组丢失,统计排钻个数时会丢失该个数!`, timeout: 5000, intent: Intent.DANGER });
}
}
case GangDrillType.Pxl:
pxlCount++;
break;
case GangDrillType.Ljg:
case GangDrillType.Ymj:
break;
case GangDrillType.TK:
isTk = true;
break;
case GangDrillType.Wood:
case GangDrillType.WoodPXL:
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__)
{
br._Name = this._Name;
br._DrillList = new Map(this._DrillList.entries());
br._LayerNails = [...this._LayerNails];
br.ProcessingGroupList = [...this.ProcessingGroupList];

@ -229,7 +229,6 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
this.InitWidth();
let selectCtrl = app.Editor.SelectCtrl;
let dr = new DrillingReactor();
const UpdateByRedoUndo = (historyRec: CommandHistoryRecord) =>
{
loop1:
@ -295,7 +294,7 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
e.stopPropagation();
return true;
}),
end(dr, dr.StartReactor, () =>
end(app._drillingReactor, app._drillingReactor.StartReactor, () =>
{
this.UpdateDrillCount(this.dataList.realBr);
}),
@ -869,125 +868,123 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
const listItemHeight = 23;
return (
<>
<div
className={Classes.DIALOG_CONTAINER}
style={{ width: "100%", height: "100%" }}
>
<div className={Classes.DIALOG + " br-lookover"}>
<ModalHeader
title="板件属性"
icon="bold"
close={() => { this.OnOk(ModalState.Cancel); }}
isPinBtn={true}
/>
<div className={Classes.DIALOG_BODY + " flex " + Classes.CARD} style={{ height: 400, width: "100%" }}>
{/* 列表 */}
<Card>
<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={() =>
<div
className={Classes.DIALOG_CONTAINER}
style={{ width: "100%", height: "100%" }}
>
<div className={Classes.DIALOG + " br-lookover"}>
<ModalHeader
title="板件属性"
icon="bold"
close={() => { this.OnOk(ModalState.Cancel); }}
isPinBtn={true}
/>
<div className={Classes.DIALOG_BODY + " flex " + Classes.CARD} style={{ height: 400, width: "100%" }}>
{/* 列表 */}
<Card>
<AutoSizer>
{
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
({ 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();
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="修改选择板件的板材" /> */}
<Button
intent={Intent.PRIMARY}
text="导出CSV"
onClick={this.HandleExportCSV}
/>
</ModalFooter>
</div>
<Button
intent={Intent.PRIMARY}
text="导出CSV"
onClick={this.HandleExportCSV}
/>
</ModalFooter>
</div>
</>
</div>
);
}
}

@ -163,72 +163,76 @@ export class KnifeManage extends Component<IKnifeManageProps, IKnifeManageState>
};
private handleCreateKnife = async (name: string, currentDir: IDirectoryProps, callback: Function) =>
{
let plRes = await app.Editor.GetSelection({
Once: true,
AllowNone: false,
Msg: "选择闭合轮廓",
Filter: {
filterTypes: [Polyline],
},
});
if (plRes.Status !== PromptStatus.OK)
await CommandWrap(async () =>
{
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);
if (!pl)
{
return;
}
if (!pl) return;
let ptRes = await app.Editor.GetPoint({
Msg: "指定基点"
});
let pl = GetCloseContour(plRes.SelectSet.SelectEntityList[0] as Polyline);
if (!pl)
{
return;
}
if (!pl) return;
let ptRes = await app.Editor.GetPoint({
Msg: "指定基点"
});
//基点移动到基点
pl.ApplyMatrix(MoveMatrix(ptRes.Point.negate()))
.ApplyMatrix(new Matrix4().extractRotation(pl.OCSInv));
//基点移动到基点
pl.ApplyMatrix(MoveMatrix(ptRes.Point.negate()))
.ApplyMatrix(new Matrix4().extractRotation(pl.OCSInv));
let vf = new CADFiler();
pl.WriteFile(vf);
pl.Erase();
let vf = new CADFiler();
pl.WriteFile(vf);
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)
{
data = await PostJson(ToplineUrls.update, {
topline_id: this.currentInfo.id,
logo,
file: deflate(fileJson),
zip_type: "gzip",
});
}
else
{
data = await PostJson(ToplineUrls.create, {
dir_id: currentDir.id,
name,
logo,
file: deflate(fileJson),
zip_type: "gzip",
});
}
if (this.currentInfo.id)
{
data = await PostJson(ToplineUrls.update, {
topline_id: this.currentInfo.id,
logo,
file: deflate(fileJson),
zip_type: "gzip",
});
}
else
{
data = await PostJson(ToplineUrls.create, {
dir_id: currentDir.id,
name,
logo,
file: deflate(fileJson),
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) =>

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

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

Loading…
Cancel
Save