!2254 优化:批量查看增加非拆单板统计选项

pull/2176/MERGE
林伟强 1 year ago committed by ChenX
parent 7aac44a609
commit 1cf02a3b0f

@ -34,7 +34,8 @@ class LookOverBoardInfosTool
private drillTypeMap: Map<string, (Hole | IHardwareType)[]> = new Map();
private sealMap: Map<string, number> = new Map();
private boardMap = new Map<string, Board[]>();
GetCount(brs: (Board | IHardwareType)[], options: GetCountOption = null)
GetCount(brs: (Board | IHardwareType)[], options: GetCountOption = null, IsBbsCountChaidan?: boolean)
{
let drillCount: ICountType[] = [];
let sealCount: ICountType[] = [];
@ -43,7 +44,7 @@ class LookOverBoardInfosTool
this.drillTypeMap.clear();
this.sealMap.clear();
this.Update(brs, options);
this.Update(brs, options, IsBbsCountChaidan);
if (this.drillTypeMap.size > 0)
for (let [k, v] of this.drillTypeMap)
{
@ -68,7 +69,7 @@ class LookOverBoardInfosTool
for (let [k, bs] of this.boardMap)
{
const chaiDan = bs.filter(b => b.IsChaiDan);
const chaiDan = IsBbsCountChaidan ? bs : bs.filter(b => b.IsChaiDan);
areaCount.push({
entity: bs[0],
count: chaiDan.length,
@ -78,7 +79,7 @@ class LookOverBoardInfosTool
return { drillCount, hardwareCount, sealCount, areaCount };
};
private Update(ens: (Board | IHardwareType)[], options: GetCountOption = null)
private Update(ens: (Board | IHardwareType)[], options: GetCountOption = null, IsBbsCountChaidan?: boolean)
{
//计算排钻个数
const addDrillToMap = (spiteName: string, d: Hole | IHardwareType) =>
@ -115,7 +116,7 @@ class LookOverBoardInfosTool
//统计 排钻 封边 关联的五金(排钻?)
for (let br of brsProps)
{
if (!br.IsChaiDan)//非拆单板我们不统计
if (!IsBbsCountChaidan && !br.IsChaiDan)//非拆单板我们不统计
continue;
//排钻 层板钉

@ -235,7 +235,7 @@ export class PartsTable extends React.Component<IPartsTableProps, {}>
return <tr>
<td>{"[ 无 ]"}</td>
<td>{0}</td>
<td>{``}</td>
{this.props.type === PartsType.Hole ? <td>{``}</td> : null}
</tr>;
switch (this.props.type)

@ -1,4 +1,4 @@
import { Button, Card, Classes, Divider, InputGroup, Intent } from "@blueprintjs/core";
import { Button, Card, Checkbox, Classes, Divider, InputGroup, Intent } from "@blueprintjs/core";
import hotkeys from "hotkeys-js-ext";
import { action, observable } from "mobx";
import { observer } from "mobx-react";
@ -12,11 +12,11 @@ import { app } from "../../../ApplicationServices/Application";
import { arrayRemove } from "../../../Common/ArrayExt";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { CheckObjectType, CheckoutValid } from "../../../Common/CheckoutVaildValue";
import { safeEval } from "../../../Common/eval";
import { FS } from "../../../Common/FileSystem";
import { KeyBoard } from "../../../Common/KeyEnum";
import { Log, LogType } from "../../../Common/Log";
import { FixedNotZero } from "../../../Common/Utils";
import { safeEval } from "../../../Common/eval";
import { CylinderHole } from "../../../DatabaseServices/3DSolid/CylinderHole";
import { CommandHistoryRecord } from "../../../DatabaseServices/CommandHistoryRecord";
import { CreateObjectData } from "../../../DatabaseServices/CreateObjectData";
@ -34,7 +34,7 @@ import { SelectSetBase } from "../../../Editor/SelectBase";
import { userConfig } from "../../../Editor/UserConfig";
import { equaln } from "../../../Geometry/GeUtils";
import { IHardwareType } from "../../../Production/Product";
import { TotalTabbarTitlesInfos, bbsEditorStore } from "../../Store/BBSEditorStore";
import { bbsEditorStore, TotalTabbarTitlesInfos } from "../../Store/BBSEditorStore";
import { EFindType } from "../../Store/BoardFindInterface";
import { ComposingType, FaceDirection, LinesType } from "../../Store/BoardInterface";
import { userConfigStore } from "../../Store/UserConfigStore";
@ -111,6 +111,9 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
@observable findSameTypeBrDataKey: string;
//是否多选/单选
@observable isCtrlDown: boolean = false;
@observable IsBbsCountChaidan: boolean = false;//是否统计非拆单板
processGroupMap: Map<string, ObjectId[]> = new Map();//板件加工组 按名分类 便于区分
rootElRef = React.createRef<HTMLDivElement>();
@ -138,12 +141,12 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
@action
UpdateDrillCount(brs?: (Board | IHardwareType)[])
{
const { drillCount, hardwareCount, sealCount, areaCount } = lookOverBoardInfosTool.GetCount(brs ?? this.props.boardList);
const { drillCount, hardwareCount, sealCount, areaCount } = lookOverBoardInfosTool.GetCount(brs ?? this.props.boardList, null, this.IsBbsCountChaidan);
this.drillCount = drillCount;
this.sealCount = sealCount;
this.hardwareCount = hardwareCount;
this.areaCount = areaCount;
this.areaCount = areaCount.filter((v) => v.count || v.count2 !== "0.00");
}
get BoardList(): Board[]
{
@ -304,16 +307,6 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
UpdateByRedoUndo(historyRec);
})
);
if (this.props.boardList.some((v) => v instanceof Board && !v.IsChaiDan))
{
AppToaster.show({
message: "批量查看统计板不统计非拆单板的信息",
timeout: 3000,
intent: Intent.PRIMARY,
});
}
}
componentWillUnmount()
{
@ -928,9 +921,10 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
str += `\t${thickness},${process[EBoardKeyList.Mat] || "[ 无 ]"},${process[EBoardKeyList.Color] || "[ 无 ]"},${process[EBoardKeyList.BrMat] || "[ 无 ]"},${d.count},${d.count2}\n`;
}
const dataBr = this.IsBbsCountChaidan ? this.searchRes.dataBr : this.searchRes.dataBr.filter(v => v.IsChaiDan);
//总数统计
str += "\n总板数,总平方数\n";
str += `\t${this.searchRes.dataBr.filter(v => v.IsChaiDan).length},${FixedNotZero(this.CalcArea(), 2)}\n`;
str += `\t${dataBr.length},${FixedNotZero(this.CalcArea(), 2)}\n`;
FS.WriteFile(`${fileServer.currentFileInfo.name}批量查看板件属性.csv`, "\ufeff" + str);
};
@ -939,6 +933,7 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
render()
{
const dataBr = this.IsBbsCountChaidan ? this.searchRes.dataBr : this.searchRes.dataBr.filter(v => v.IsChaiDan);
return (
<div
className={Classes.DIALOG_CONTAINER}
@ -1009,9 +1004,19 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
</div>
<ModalFooter hasConfig={false}>
<label className={Classes.LABEL + " " + Classes.INLINE}>
<label>{`总计 ${this.searchRes.dataBr.filter(v => v.IsChaiDan).length} 块板, `}</label>
<label>{`总计 ${dataBr.length} 块板, `}</label>
<label>{`总计 ${this.CalcArea()}平方 `}</label>
</label>
{this.searchRes.dataBr.length > this.searchRes.dataBr.filter(v => v.IsChaiDan).length ?
<Checkbox
className={Classes.LABEL + " " + Classes.INLINE}
checked={this.IsBbsCountChaidan}
onChange={() => { this.IsBbsCountChaidan = !this.IsBbsCountChaidan; this.UpdateDrillCount(); }}
>
</Checkbox>
: null
}
<InputGroup className={"search"} type="search" placeholder="关键字查找..." dir="auto"
onChange={(e) =>
{

Loading…
Cancel
Save