From a8050622add1f47398bbe1d54601963760ddcd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=AF=97=E6=B4=A5?= <2723065175@qq.com> Date: Fri, 8 Mar 2024 02:49:22 +0000 Subject: [PATCH] =?UTF-8?q?!2334=20=E5=8A=9F=E8=83=BD:=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9D=BF=E8=BE=B9=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Board/__snapshots__/Mirror.test.ts.snap | 10 + src/Add-on/Batch/BatchModifySealOrDrill.ts | 21 +- src/Add-on/BoardEditor/UpdateBoardInfos.ts | 4 + src/Add-on/BoardFindModify.ts | 10 + src/Common/CommandNames.ts | 1 + src/DatabaseServices/Entity/Board.ts | 29 +- src/Editor/DefaultConfig.ts | 24 +- src/GraphicsSystem/CalcEdgeSealing.ts | 96 +++++- src/UI/Components/BBS/BBSCommon.tsx | 146 +++++---- src/UI/Components/BBS/BoardInfosList.tsx | 33 +- src/UI/Components/BBS/LookOverBoardInfos.tsx | 37 ++- src/UI/Components/Board/BoardCommon.tsx | 81 ++++- src/UI/Components/Board/BoardFindCommon.tsx | 290 ++++++++---------- src/UI/Components/Board/BoardFindModify.tsx | 3 +- src/UI/Components/Board/BoardModalType.ts | 1 + src/UI/Components/Board/BoardOptionModal.tsx | 1 + src/UI/Components/Board/BoardProcessModal.tsx | 113 +++++-- .../Board/UpdateBoardInfointerface.ts | 8 + .../Modal/ModalStyle/BoardFind.less | 41 ++- .../Modal/ModalStyle/BoardModal.less | 10 +- .../RightPanel/BoardEdgeRemarksComponent.tsx | 85 +++++ src/UI/Components/RightPanel/BoardProps.less | 10 +- .../RightPanel/BoardPropsComponent.tsx | 1 + src/UI/Components/RightPanel/RightPanel.tsx | 3 + src/UI/Store/BBSEditorStore.ts | 7 +- src/UI/Store/BoardFindInterface.ts | 15 +- src/UI/Store/BoardFindModifyStore.ts | 20 +- .../OptionInterface/BoardProcessOption.ts | 8 +- .../Store/OptionInterface/IHighSealedItem.ts | 5 + .../RightPanelStore/BoardEdgeRemarksStore.ts | 173 +++++++++++ .../Store/RightPanelStore/RightPanelStore.ts | 2 + src/UI/Store/UpdateBoardInfoStore.ts | 22 +- 32 files changed, 974 insertions(+), 336 deletions(-) create mode 100644 src/UI/Components/RightPanel/BoardEdgeRemarksComponent.tsx create mode 100644 src/UI/Store/RightPanelStore/BoardEdgeRemarksStore.ts diff --git a/__test__/Board/__snapshots__/Mirror.test.ts.snap b/__test__/Board/__snapshots__/Mirror.test.ts.snap index 3c4e1fc5b..2c21432b9 100644 --- a/__test__/Board/__snapshots__/Mirror.test.ts.snap +++ b/__test__/Board/__snapshots__/Mirror.test.ts.snap @@ -169,6 +169,11 @@ Array [ true, true, 0, + "", + "", + "", + "", + 0, 0, 0, 0, @@ -382,6 +387,11 @@ Array [ true, false, 0, + "", + "", + "", + "", + 0, 0, 0, 0, diff --git a/src/Add-on/Batch/BatchModifySealOrDrill.ts b/src/Add-on/Batch/BatchModifySealOrDrill.ts index 529d238e9..4f7c0b7f5 100644 --- a/src/Add-on/Batch/BatchModifySealOrDrill.ts +++ b/src/Add-on/Batch/BatchModifySealOrDrill.ts @@ -41,8 +41,8 @@ export class BatchModify implements Command if (!brs) return; let keyRes = await app.Editor.GetKeyWords({ - Msg: "编辑封边还是排钻?", - KeyWordList: [{ msg: "封边", key: "S" }, { msg: "排钻", key: "D" }] + Msg: "编辑项目", + KeyWordList: [{ msg: "封边", key: "S" }, { msg: "排钻", key: "D" }, { msg: "板边备注", key: "R" }] }); if (keyRes.Status !== PromptStatus.Keyword) return; @@ -62,7 +62,7 @@ export class BatchModify implements Command store.sealingStore.isNotUpdateStore = false; }, 0); } - else + else if (keyRes.StringResult === "D") { store.m_TabId = RightTabId.Drill; setTimeout(() => //当前命令结束后在进入编辑 @@ -70,6 +70,21 @@ export class BatchModify implements Command store.drillingStore.StartEditor(brs); }, 0); } + else if (keyRes.StringResult === "R") + { + const boardEdgeRemarksStore = store.boardEdgeRemarksStore; + + boardEdgeRemarksStore.isNotUpdateStore = true; + let config = new DialogUserConfig(boardEdgeRemarksStore, BoardModalType.BoardEdgeRemarks); + await config.LoadAndInitConfig(); + + store.m_TabId = RightTabId.BoardEgdeRemark; + setTimeout(async () =>//当前命令结束后在进入编辑 + { + await boardEdgeRemarksStore.StartEditor(brs); + boardEdgeRemarksStore.isNotUpdateStore = false; + }, 0); + } } } diff --git a/src/Add-on/BoardEditor/UpdateBoardInfos.ts b/src/Add-on/BoardEditor/UpdateBoardInfos.ts index 87348ca66..a2fa97159 100644 --- a/src/Add-on/BoardEditor/UpdateBoardInfos.ts +++ b/src/Add-on/BoardEditor/UpdateBoardInfos.ts @@ -136,6 +136,10 @@ export class UpdateBoardInfos implements Command case EBoardKeyList.DownSealed: case EBoardKeyList.LeftSealed: case EBoardKeyList.RightSealed: + case "edgeRemarkUp": + case "edgeRemarkDown": + case "edgeRemarkLeft": + case "edgeRemarkRight": if (option[i]) br.BoardProcessOption[i] = option[i]; break; diff --git a/src/Add-on/BoardFindModify.ts b/src/Add-on/BoardFindModify.ts index 6a2bcee12..669f2f041 100644 --- a/src/Add-on/BoardFindModify.ts +++ b/src/Add-on/BoardFindModify.ts @@ -247,6 +247,10 @@ export class BoardFindModify implements Command case EBoardKeyList.DownSealed: case EBoardKeyList.LeftSealed: case EBoardKeyList.RightSealed: + case "edgeRemarkUp": + case "edgeRemarkDown": + case "edgeRemarkLeft": + case "edgeRemarkRight": brValue = br.BoardProcessOption[i]; value = option[i]; isVail = CompareIsEqual(brValue, value, ECompareType.Equal); @@ -394,6 +398,12 @@ export class BoardFindModify implements Command break; case EBoardKeyList.OpenDir: br.OpenDir = option[i]; + case "edgeRemarkUp": + case "edgeRemarkDown": + case "edgeRemarkLeft": + case "edgeRemarkRight": + if (option[i]) + br.BoardProcessOption[i] = option[i]; break; case EBoardKeyList.UpSealed: case EBoardKeyList.DownSealed: diff --git a/src/Common/CommandNames.ts b/src/Common/CommandNames.ts index 69f565d4d..f99d0019f 100644 --- a/src/Common/CommandNames.ts +++ b/src/Common/CommandNames.ts @@ -331,6 +331,7 @@ export enum CommandNames PackageGroupMove0 = "PACKAGEGROUPMOVE0", ApplyMtl = "APPLYMTL",//应用材质 封边属性编辑 = "封边属性编辑", + 板边备注编辑 = "板边备注编辑", 排钻属性编辑 = "排钻属性编辑", SwitchServers = "SWITCHSERVERS", diff --git a/src/DatabaseServices/Entity/Board.ts b/src/DatabaseServices/Entity/Board.ts index 8dc6ced3e..bba5953ad 100644 --- a/src/DatabaseServices/Entity/Board.ts +++ b/src/DatabaseServices/Entity/Board.ts @@ -174,6 +174,11 @@ export class Board extends ExtrudeSolid backDrill: true, drillType: "", remarks: this.CreateArray(), + edgeRemarkUp: "", + edgeRemarkDown: "", + edgeRemarkLeft: "", + edgeRemarkRight: "", + highBoardEdgeRemark: this.CreateArray(), }; this._BoardProcessOption = new Proxy(defaultData, { @@ -2046,12 +2051,23 @@ export class Board extends ExtrudeSolid this.RelativeHandle.push(objId); } } + + const processData = this._BoardProcessOption; + if (ver > 13) + { + processData.edgeRemarkUp = file.Read(); + processData.edgeRemarkDown = file.Read(); + processData.edgeRemarkLeft = file.Read(); + processData.edgeRemarkRight = file.Read(); + let count = file.Read(); + processData.highBoardEdgeRemark = file.ReadArray(count); + } } WriteFile(file: CADFiler) { super.WriteFile(file); - file.Write(13); + file.Write(14); // file.Write(this._SpaceOCS.toArray()); ver < 6 file.Write(this._BoardType); file.Write(this._Name); @@ -2100,6 +2116,17 @@ export class Board extends ExtrudeSolid file.Write(this.RelativeHandle.length); for (let id of this.RelativeHandle) file.WriteObjectId(id); + + const processData = this._BoardProcessOption; + file.Write(processData.edgeRemarkUp); + file.Write(processData.edgeRemarkDown); + file.Write(processData.edgeRemarkLeft); + file.Write(processData.edgeRemarkRight); + file.Write(processData.highBoardEdgeRemark.length); + for (let r of processData.highBoardEdgeRemark) + { + file.Write(r); + } } } diff --git a/src/Editor/DefaultConfig.ts b/src/Editor/DefaultConfig.ts index 35e527534..a8955b3a2 100644 --- a/src/Editor/DefaultConfig.ts +++ b/src/Editor/DefaultConfig.ts @@ -309,7 +309,7 @@ export const DefaultClosingStripOption: ClosingStripOption = { Object.freeze(DefaultClosingStripOption); export const DefaultBoardFindOption: IBoardFindOption = { - version: 8, + version: 9, condition: { // layer: false, //这个KEY看起来没用了 height: false, @@ -345,6 +345,10 @@ export const DefaultBoardFindOption: IBoardFindOption = { useZhengFanDrill: false, useChaidan: false, [EBoardKeyList.KnifeRad]: false, + edgeRemarkUp: false, + edgeRemarkDown: false, + edgeRemarkLeft: false, + edgeRemarkRight: false, }, compareType: { height: ECompareType.Equal, @@ -399,6 +403,10 @@ export const DefaultBoardFindOption: IBoardFindOption = { extraRemarks: Array.from({ length: 10 }, () => ["", ""]), isChaidan: false, [EBoardKeyList.KnifeRad]: "", + edgeRemarkUp: "", + edgeRemarkDown: "", + edgeRemarkLeft: "", + edgeRemarkRight: "", }; Object.freeze(DefaultBoardFindOption); @@ -721,7 +729,7 @@ export const DefaultCurve2RecOption: Curve2RecOption = { Object.freeze(DefaultCurve2RecOption); export const DefaultUpdateInfoOption: IUpdateBoardInfosOption = { - version: 2, + version: 3, [EBoardKeyList.BrName]: "", [EBoardKeyList.RoomName]: "", [EBoardKeyList.CabinetName]: "", @@ -744,6 +752,10 @@ export const DefaultUpdateInfoOption: IUpdateBoardInfosOption = { grooveAddWidth: "0", highDrill: [], isChaiDan: true, + edgeRemarkUp: "", + edgeRemarkDown: "", + edgeRemarkLeft: "", + edgeRemarkRight: "", condition: { [EBoardKeyList.BrName]: false, [EBoardKeyList.RoomName]: false, @@ -768,7 +780,11 @@ export const DefaultUpdateInfoOption: IUpdateBoardInfosOption = { leftDrill: true, rightDrill: true, isChaiDan: true, - autoCutOption: { isAutoCut: false, isRelevance: false } + autoCutOption: { isAutoCut: false, isRelevance: false }, + edgeRemarkUp: true, + edgeRemarkDown: true, + edgeRemarkLeft: true, + edgeRemarkRight: true, } }; @@ -909,7 +925,7 @@ export const DefaultHSOption: IHSOption = { hwComposity: false, lattice: false, dim: false, - visual:false, + visual: false, curve: false, line: false, polyline: false, diff --git a/src/GraphicsSystem/CalcEdgeSealing.ts b/src/GraphicsSystem/CalcEdgeSealing.ts index 810086807..ea6b2e777 100644 --- a/src/GraphicsSystem/CalcEdgeSealing.ts +++ b/src/GraphicsSystem/CalcEdgeSealing.ts @@ -16,7 +16,7 @@ import { CreateContour2 } from "../Geometry/CreateContour2"; import { IdentityMtx4, XAxis, equaln, equalv3, isParallelTo } from "../Geometry/GeUtils"; import { Max } from "../Nest/Common/Util"; import { Production } from "../Production/Product"; -import { IHighSealedItem } from "../UI/Store/OptionInterface/IHighSealedItem"; +import { IHighEdgeRemarkItem, IHighSealedItem } from "../UI/Store/OptionInterface/IHighSealedItem"; import { OffsetPolyline } from "./OffsetPolyline"; import { ParseEdgeSealDir } from "./ParseEdgeSealDir"; @@ -200,6 +200,63 @@ export function GetBoardHighSeal(br: Board, sealcus: Curve[]): IHighSealedItem[] return highSeals; } +export function GetHighBoardEdgeRemark(br: Board, sealcus: Curve[]): IHighEdgeRemarkItem[] +{ + const opt = br.BoardProcessOption; + + //顺序和封边一样 + if (opt[EBoardKeyList.SpliteHeight] + && opt[EBoardKeyList.SpliteWidth] + && opt[EBoardKeyList.SpliteThickness] + ) + { + return [ + { description: opt.edgeRemarkDown }, + { description: opt.edgeRemarkRight }, + { description: opt.edgeRemarkUp }, + { description: opt.edgeRemarkLeft }, + ]; + } + + const highBoardEdgeRemark: IHighEdgeRemarkItem[] = []; + for (const d of opt.highBoardEdgeRemark) + if (d.description != null) + highBoardEdgeRemark.push({ ...d }); + + //若未设置高级板边备注,把上下左右板边备注存入高级板边备注 + if (sealcus.length !== highBoardEdgeRemark.length || !br.IsSpecialShape) + { + const edgeRemarkDown = opt.edgeRemarkDown; + const edgeRemarkRight = opt.edgeRemarkRight; + const edgeRemarkUp = opt.edgeRemarkUp; + const edgeRemarkLeft = opt.edgeRemarkLeft; + + highBoardEdgeRemark.length = 0; + const dir = Math.sign(br.ContourCurve.Area2); + for (const c of sealcus) + { + const derv = c.GetFirstDeriv(0).multiplyScalar(dir); + + if (Math.abs(derv.x) > Math.abs(derv.y)) + { + if (derv.x > 0) + highBoardEdgeRemark.push({ description: edgeRemarkDown }); + else + highBoardEdgeRemark.push({ description: edgeRemarkUp }); + } + else + { + if (derv.y > 0) + highBoardEdgeRemark.push({ description: edgeRemarkRight }); + else + highBoardEdgeRemark.push({ description: edgeRemarkLeft }); + } + } + } + + return highBoardEdgeRemark; +} + /**偏移前后曲线起点没改变 */ export function OffsetOutlineSpNotChange(oldcu: Curve, newCu: Curve) { @@ -548,3 +605,40 @@ export function SetBoardTopDownLeftRightSealData(br: Board, sealDatas: IHighSeal br.BoardProcessOption[EBoardKeyList.DownSealed] = sealDatas[bottom].size.toString(); } } + +export function SetBoardEdgeRemarkData(br: Board, remarkDatas: IHighEdgeRemarkItem[], sealCurves?: Curve[], brContourCurve?: ExtrudeContourCurve) +{ + let dir = Math.sign((brContourCurve ?? br.ContourCurve).Area2); + sealCurves = sealCurves ?? GetBoardSealingCurves(br); + + const opt = br.BoardProcessOption; + if (br.IsRect && sealCurves.length === 4) + { + for (let i = 0; i < 4; i++) + { + let derv = sealCurves[i].GetFirstDeriv(0).normalize(); + if (isParallelTo(derv, XAxis, 1e-4)) + { + if (derv.x * dir > 0) + opt.edgeRemarkDown = remarkDatas[i].description; + else + opt.edgeRemarkUp = remarkDatas[i].description; + } + else + { + if (derv.y * dir > 0) + opt.edgeRemarkRight = remarkDatas[i].description; + else + opt.edgeRemarkLeft = remarkDatas[i].description; + } + } + } + else + { + let [left, right, top, bottom] = ParseEdgeSealDir(sealCurves); + opt.edgeRemarkLeft = remarkDatas[left].description; + opt.edgeRemarkRight = remarkDatas[right].description; + opt.edgeRemarkUp = remarkDatas[top].description; + opt.edgeRemarkDown = remarkDatas[bottom].description; + } +} diff --git a/src/UI/Components/BBS/BBSCommon.tsx b/src/UI/Components/BBS/BBSCommon.tsx index 6a3431a7d..260875463 100644 --- a/src/UI/Components/BBS/BBSCommon.tsx +++ b/src/UI/Components/BBS/BBSCommon.tsx @@ -113,6 +113,35 @@ export class TitleBanner extends React.Component }; render() { + const boardEdgeEditor = (index: number, arr: string[], key: string) => + { + const minWidth = { + "sealing": 62, + "highDrill": 73, + "boardEdgeRemark": 82 + }; + const style: React.CSSProperties = { + minWidth: minWidth[key] + }; + return ( +
+ { + arr.map(text => +
+
+ {text} +
+
+
+ ) + } +
+ ); + }; return (
序号
@@ -120,47 +149,15 @@ export class TitleBanner extends React.Component bbsEditorStore.tabbarIndexs.map((index) => { let key = TotalTabbarTitlesInfos[index][1]; - if (key === "sealing") - { - return ( -
- { - ["上封边", "下封边", "左封边", "右封边"].map(text => -
-
- {text} -
-
-
- ) - } -
- ); - } - else if (key === "highDrill") + const boardEdgeMap = { + sealing: ["上封边", "下封边", "左封边", "右封边"], + highDrill: ["上排钻", "下排钻", "左排钻", "右排钻"], + boardEdgeRemark: ["上边备注信息", "下边备注信息", "左边备注信息", "右边备注信息"], + }; + + if (["sealing", "highDrill", "boardEdgeRemark"].includes(key)) { - return ( -
- { - ["上排钻", "下排钻", "左排钻", "右排钻"].map(text => -
-
- {text} -
-
-
- ) - } -
- ); + return boardEdgeEditor(index, boardEdgeMap[key], key); } else return ( @@ -326,7 +323,7 @@ export class PartsTable extends React.Component } -interface IBBSSealingComponentProps +interface IBBSComponentProps { click: (v: string) => void; board: Board; @@ -335,59 +332,80 @@ interface IBBSSealingComponentProps index: number; } - +interface IBBSSealingComponentProps extends IBBSComponentProps +{ + keyName: string; +} @observer export class BBSSealingComponent extends React.Component { render() { - const { board, option, index } = this.props; + const { board, option, index, keyName } = this.props; + const boardEdgeInfoMap = { + sealing: { + title: "异形板件请查看高级封边", + up: EBoardKeyList.UpSealed, + down: EBoardKeyList.DownSealed, + left: EBoardKeyList.LeftSealed, + right: EBoardKeyList.RightSealed + }, + boardEdgeRemark: { + title: "异形板件请查看板边编辑", + up: "edgeRemarkUp", + down: "edgeRemarkDown", + left: "edgeRemarkLeft", + right: "edgeRemarkRight", + }, + }; + const boardInfo: { title: string, up: string, down: string, left: string, right: string; } = boardEdgeInfoMap[keyName]; + const minWidth = keyName === "boardEdgeRemark" ? 82 : 62; return ( <> { board.IsSpecialShape ? -
- { this.props.click(EBoardKeyList.UpSealed); }} +
+ { this.props.click(boardInfo.up); }} />
: <> -
+
{ this.props.click(EBoardKeyList.UpSealed); }} - onBlur={(e) => this.props.ModifyDataRecord(index, board, EBoardKeyList.UpSealed, e.target.value)} + onClick={() => { this.props.click(boardInfo.up); }} + onBlur={(e) => this.props.ModifyDataRecord(index, board, boardInfo.up, e.target.value)} />
-
+
{ this.props.click(EBoardKeyList.DownSealed); }} - onBlur={(e) => this.props.ModifyDataRecord(index, board, EBoardKeyList.DownSealed, e.target.value)} + onClick={() => { this.props.click(boardInfo.down); }} + onBlur={(e) => this.props.ModifyDataRecord(index, board, boardInfo.down, e.target.value)} />
-
+
{ this.props.click(EBoardKeyList.LeftSealed); }} - onBlur={(e) => this.props.ModifyDataRecord(index, board, EBoardKeyList.LeftSealed, e.target.value)} + onClick={() => { this.props.click(boardInfo.left); }} + onBlur={(e) => this.props.ModifyDataRecord(index, board, boardInfo.left, e.target.value)} />
-
+
{ this.props.click(EBoardKeyList.RightSealed); }} - onBlur={(e) => this.props.ModifyDataRecord(index, board, EBoardKeyList.RightSealed, e.target.value)} + onClick={() => { this.props.click(boardInfo.right); }} + onBlur={(e) => this.props.ModifyDataRecord(index, board, boardInfo.right, e.target.value)} />
@@ -397,7 +415,7 @@ export class BBSSealingComponent extends React.Component void; @@ -675,7 +693,7 @@ export class BBSProcessGroupItem extends React.Component +export class BBSRemarksComponent extends React.Component { render() { diff --git a/src/UI/Components/BBS/BoardInfosList.tsx b/src/UI/Components/BBS/BoardInfosList.tsx index 61bdff73d..ce73958c7 100644 --- a/src/UI/Components/BBS/BoardInfosList.tsx +++ b/src/UI/Components/BBS/BoardInfosList.tsx @@ -115,6 +115,11 @@ export class BoardInfoList extends React.Component return this.option.hasOwnProperty(EBoardKeyList.UpSealed); } + if (key === "boardEdgeRemark") + { + return this.option.hasOwnProperty("edgeRemarkUp"); + } + return this.option.hasOwnProperty(key); } public render() @@ -144,13 +149,15 @@ export class BoardInfoList extends React.Component case "frontDrill": case "backDrill": return ( -
+
); case "sealing": + case "boardEdgeRemark": return />; case "highDrill": return case EBoardKeyList.ProcessGroup: return ( ); case EBoardKeyList.ComposingFace: return />; case EBoardKeyList.Lines: return case EBoardKeyList.DrillType: return />; case EBoardKeyList.BigHole: return />; case "remarks": return return (
opt[key] = FixedNotZero(safeEval(br.BoardProcessOption[key], Params, "H"), 3); } break; + case "boardEdgeRemark": + opt.edgeRemarkUp = br.BoardProcessOption.edgeRemarkUp; + opt.edgeRemarkDown = br.BoardProcessOption.edgeRemarkDown; + opt.edgeRemarkLeft = br.BoardProcessOption.edgeRemarkLeft; + opt.edgeRemarkRight = br.BoardProcessOption.edgeRemarkRight; + break; default: opt[key] = br.BoardProcessOption[key]; } diff --git a/src/UI/Components/BBS/LookOverBoardInfos.tsx b/src/UI/Components/BBS/LookOverBoardInfos.tsx index 9752e6365..6ad18f7ef 100644 --- a/src/UI/Components/BBS/LookOverBoardInfos.tsx +++ b/src/UI/Components/BBS/LookOverBoardInfos.tsx @@ -446,23 +446,28 @@ export class LookOverBoardInfosModal extends React.Component s += ` ${r[0]}:${r[1]} `, "")}"`); break; case "spliteHeight": - if (b.BoardProcessOption[key]) - { - arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "L"), 3)); - break; - } + arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "L"), 3)); + break; case "spliteWidth": - if (b.BoardProcessOption[key]) - { - arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "W"), 3)); - break; - } + arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "W"), 3)); + break; case "spliteThickness": - if (b.BoardProcessOption[key]) - { - arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "H"), 3)); - break; - } + arr.push(FixedNotZero(safeEval(b.BoardProcessOption[key], Params, "H"), 3)); + break; + case "boardEdgeRemark": + if (b.IsSpecialShape) + for (let i = 0; i < 4; i++) + { + arr.push("异形板件请查看板边编辑"); + } + else + arr.push( + b.BoardProcessOption.edgeRemarkUp, + b.BoardProcessOption.edgeRemarkDown, + b.BoardProcessOption.edgeRemarkLeft, + b.BoardProcessOption.edgeRemarkRight, + ); + break; default: arr.push(`"${b.BoardProcessOption[key]}"`); } @@ -476,6 +481,8 @@ export class LookOverBoardInfosModal extends React.Component @@ -493,7 +495,7 @@ export class Input5Or4Component extends React.Component render() { const options = [...userConfig.DrillConfigs.keys(), "不排"]; - const { highDrillOption, isShowEditor, type, + const { isRemarks, highDrillOption, isShowEditor, type, upKey, leftKey, downKey, rightKey, centerKey, option, uiOption, showDirectionIcon, hasCenter, onChange } = this.props; @@ -513,19 +515,36 @@ export class Input5Or4Component extends React.Component isShow && { highDrillOption.up = e.currentTarget.value; }} /> } + { + isRemarks && + + + + }
}} /> } + { + isRemarks && + + + + }
{ showDirectionIcon && @@ -580,6 +615,22 @@ export class Input5Or4Component extends React.Component }} /> } + { + isRemarks && + + + + }
@@ -594,14 +645,30 @@ export class Input5Or4Component extends React.Component isShow && { highDrillOption.down = e.currentTarget.value; }} /> } + { + isRemarks && + + + + }
diff --git a/src/UI/Components/Board/BoardFindCommon.tsx b/src/UI/Components/Board/BoardFindCommon.tsx index db7e4bda9..793e9e56c 100644 --- a/src/UI/Components/Board/BoardFindCommon.tsx +++ b/src/UI/Components/Board/BoardFindCommon.tsx @@ -1,4 +1,4 @@ -import { Button, Checkbox, Classes, HTMLSelect, Intent } from '@blueprintjs/core'; +import { Button, Checkbox, Classes, HTMLSelect, Intent, Tooltip } from '@blueprintjs/core'; import { observable } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; @@ -7,7 +7,7 @@ import { CheckObjectType } from '../../../Common/CheckoutVaildValue'; import { safeEval } from '../../../Common/eval'; import { IGoodInfo } from '../../MaterialEditor/GoodsList'; import { GoodsListDiv } from '../../MaterialEditor/GoodsListDiv'; -import { DRILL_KEYS, ECompareType, IBoardFindOption } from '../../Store/BoardFindInterface'; +import { DRILL_KEYS, ECompareType, EDGEREMARK_KEYS, IBoardFindOption, SEAL_KEYS } from '../../Store/BoardFindInterface'; import { BoardFindStore } from '../../Store/BoardFindModifyStore'; import { AnyObject, IUiOption } from "../../Store/OptionInterface/IOptionInterface"; import { UpdateBoardInfosStore } from '../../Store/UpdateBoardInfoStore'; @@ -266,155 +266,124 @@ export class SealDrillCom extends React.Component { render() { + const SealAndDrillComponent = (opt) => + { + const { sealKey, drillCheck, highDrillIndex, edgeRemarkKey } = opt; + return ( +
+
+
+ + { + option.condition[sealKey] = !option.condition[sealKey]; + if (this.props.onChange) + this.props.onChange(); + }} + /> + +
+
+ option.highDrill[highDrillIndex] = e.currentTarget.value} + /> + + { + option.condition[drillCheck] = !option.condition[drillCheck]; + if (this.props.onChange) + this.props.onChange(); + }} + /> +
+
+
+
+ + { + option.condition[edgeRemarkKey] = !option.condition[edgeRemarkKey]; + if (this.props.onChange) + this.props.onChange(); + }} + /> + + + +
+
+
+ ); + }; + const { store, selectOptions } = this.props; const option = store.m_Option; if (option.highDrill.length !== 4) option.highDrill.push(...Array(4).fill(selectOptions[0])); + + const sealAndDrillOpts = { + up: { + sealKey: EBoardKeyList.UpSealed, + drillCheck: "upDrill", + highDrillIndex: 2, + edgeRemarkKey: "edgeRemarkUp", + }, + left: { + sealKey: EBoardKeyList.LeftSealed, + drillCheck: "leftDrill", + highDrillIndex: 3, + edgeRemarkKey: "edgeRemarkLeft", + }, + right: { + sealKey: EBoardKeyList.RightSealed, + drillCheck: "rightDrill", + highDrillIndex: 1, + edgeRemarkKey: "edgeRemarkRight", + }, + down: { + sealKey: EBoardKeyList.DownSealed, + drillCheck: "downDrill", + highDrillIndex: 0, + edgeRemarkKey: "edgeRemarkDown", + }, + }; return (
-
- - { - option.condition.sealedUp = !option.condition.sealedUp; - if (this.props.onChange) - this.props.onChange(); - }} - /> - - option.highDrill[2] = e.currentTarget.value} - /> - - { - option.condition.upDrill = !option.condition.upDrill; - if (this.props.onChange) - this.props.onChange(); - }} - /> +
+ {SealAndDrillComponent(sealAndDrillOpts.up)}
-
-
- - { - option.condition.sealedLeft = !option.condition.sealedLeft; - if (this.props.onChange) - this.props.onChange(); - }} - /> - - option.highDrill[3] = e.currentTarget.value} - /> - - { - option.condition.leftDrill = !option.condition.leftDrill; - if (this.props.onChange) - this.props.onChange(); - }} - /> -
+
+ {SealAndDrillComponent(sealAndDrillOpts.left)} -
- - { - option.condition.sealedRight = !option.condition.sealedRight; - if (this.props.onChange) - this.props.onChange(); - }} - /> - - option.highDrill[1] = e.currentTarget.value} - /> - - { - option.condition.rightDrill = !option.condition.rightDrill; - if (this.props.onChange) - this.props.onChange(); - }} - /> -
+ {SealAndDrillComponent(sealAndDrillOpts.right)}
-
- - { - option.condition.sealedDown = !option.condition.sealedDown; - if (this.props.onChange) - this.props.onChange(); - }} - /> - - option.highDrill[0] = e.currentTarget.value} - /> - - { - option.condition.downDrill = !option.condition.downDrill; - if (this.props.onChange) - this.props.onChange(); - }} - /> - +
+ {SealAndDrillComponent(sealAndDrillOpts.down)}
(this.handleSelectAllDrillOrSeal(e, SEAL_KEYS, !store.isSelectAllSealed))} /> (this.handleSelectAllDrillOrSeal(e, DRILL_KEYS, !store.isSelectAllDrill))} + /> + (this.handleSelectAllDrillOrSeal(e, EDGEREMARK_KEYS, !store.isSelectAllEgdeRemark))} />
); } - private handleSelectAllDrillOrSeal = (e: React.FormEvent) => + private handleSelectAllDrillOrSeal = (e: React.FormEvent, keys: string[], isSelectAll: boolean) => { - const store = this.props.store; + const { store } = this.props; const option = this.props.store.m_Option; - let isDrill = e.currentTarget.getAttribute("datatype") === "drill"; - let keys = isDrill ? DRILL_KEYS : - [EBoardKeyList.UpSealed, EBoardKeyList.DownSealed, EBoardKeyList.RightSealed, EBoardKeyList.LeftSealed]; - for (let i in option.condition) { if (keys.includes(i)) - option.condition[i] = isDrill ? !store.isSelectAllDrill : !store.isSelectAllSealed; - } - if (this.props.onChange) - this.props.onChange(); - else - { - if (isDrill) - { - store.isSelectAllDrill = !store.isSelectAllDrill; - } - else - { - store.isSelectAllSealed = !store.isSelectAllSealed; - } + option.condition[i] = isSelectAll; } + //检查并更新store的全选状态 + store.CheckIsSelectAll(); }; private handleChange = (e: React.ChangeEvent, key: string) => { diff --git a/src/UI/Components/Board/BoardFindModify.tsx b/src/UI/Components/Board/BoardFindModify.tsx index d6e51f68b..0568b4922 100644 --- a/src/UI/Components/Board/BoardFindModify.tsx +++ b/src/UI/Components/Board/BoardFindModify.tsx @@ -77,8 +77,7 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar { option.condition[i] = !store.isSelectAll; } - store.isSelectAllSealed = !store.isSelectAll; - store.isSelectAll = !store.isSelectAll; + store.CheckIsSelectAll(); }; private handleReverseSelect = () => { diff --git a/src/UI/Components/Board/BoardModalType.ts b/src/UI/Components/Board/BoardModalType.ts index 017a72a3e..77106a0df 100644 --- a/src/UI/Components/Board/BoardModalType.ts +++ b/src/UI/Components/Board/BoardModalType.ts @@ -52,6 +52,7 @@ export enum BoardModalType BatchCurtail = "curtail", //批量内缩 BatchModifyPanel = "BatchModifyPanel", //批量修改板件 Sealing = "Sealing", //封边 + BoardEdgeRemarks = "boardEdgeRemarks", //板边备注 DimStyleConfig = "DimStyleConfig",//标注配置 BulkheadCeiling = "BulkheadCeiling",//吊顶轮廓 BulkheadCeilingContour = "BulkheadCeilingContour",//吊顶轮廓 diff --git a/src/UI/Components/Board/BoardOptionModal.tsx b/src/UI/Components/Board/BoardOptionModal.tsx index 7141eec71..173c7c341 100644 --- a/src/UI/Components/Board/BoardOptionModal.tsx +++ b/src/UI/Components/Board/BoardOptionModal.tsx @@ -134,6 +134,7 @@ class BoardOptionCom extends React.Component isSpecial={this.props._IsSpecialBoard} drillOption={this.props.drillsOption} otherBoardData={this.props.otherBoardData} + isEdgeRemarks={true} />
diff --git a/src/UI/Components/Board/BoardProcessModal.tsx b/src/UI/Components/Board/BoardProcessModal.tsx index f7e88d5aa..11f520bdc 100644 --- a/src/UI/Components/Board/BoardProcessModal.tsx +++ b/src/UI/Components/Board/BoardProcessModal.tsx @@ -39,6 +39,7 @@ interface BoardProcessProps br?: Board; drillOption?: IHightDrillOption; otherBoardData?: { [key: string]: any; }; + isEdgeRemarks?: boolean; } @observer export class BoardProcessModal extends React.Component{ @@ -75,6 +76,31 @@ export class BoardProcessModal extends React.Component{ store.sealingStore.isNotUpdateStore = false; }, 0); } + private async editorEdgeRemarks(br: Board) + { + if (TempEditor.EditorIng) + { + AppToaster.show({ + message: "当前正处于编辑模式下", + timeout: 3000, + intent: Intent.WARNING, + }); + return; + } + app.Editor.ModalManage.Destory(); + let store = RightPanelStore.GetInstance(); + store.boardEdgeRemarksStore.isNotUpdateStore = true;//禁止UI再次更新配置 + let config = new DialogUserConfig(store.boardEdgeRemarksStore, BoardModalType.BoardEdgeRemarks); + await config.LoadAndInitConfig();//载入或者初始化 + + store.m_IsShow = true; + store.m_TabId = RightTabId.BoardEgdeRemark; + setTimeout(() => + { + store.boardEdgeRemarksStore.StartEditor([br]); + store.boardEdgeRemarksStore.isNotUpdateStore = false; + }, 0); + } private renderEl = () => { const el = @@ -274,6 +300,7 @@ export class BoardProcessModal extends React.Component{ } render() { + const { isEdgeRemarks = false } = this.props; let isShowHighEditor = Boolean(this.props.br); const CheckBoxStyle: React.CSSProperties = { marginBottom: 0 }; @@ -435,39 +462,61 @@ export class BoardProcessModal extends React.Component{ /> }
-
- 封边 - { - isShowHighEditor && this.props.isSpecial.get() && !this.isSplit() && -
{ - (!this.props.br || (!this.props.isSpecial.get() || this.isSplit())) && + isShowHighEditor && this.props.isSpecial.get() && !this.isSplit() && + <> +
+ 封边 +
+
+ 板边备注 +
+ + } + { + (!this.props.br || (!this.props.isSpecial.get() || this.isSplit())) && + <> +
封边
+ + }
); diff --git a/src/UI/Components/Board/UpdateBoardInfointerface.ts b/src/UI/Components/Board/UpdateBoardInfointerface.ts index b49d2bb45..93b25b14d 100644 --- a/src/UI/Components/Board/UpdateBoardInfointerface.ts +++ b/src/UI/Components/Board/UpdateBoardInfointerface.ts @@ -28,6 +28,10 @@ export interface IUpdateBoardInfosOption extends IBaseOption grooveAddDepth: string; highDrill: string[]; isChaiDan: boolean; + edgeRemarkUp: string; //板边备注上下左右 + edgeRemarkDown: string; + edgeRemarkLeft: string; + edgeRemarkRight: string; } export interface IUpdateInfoCondition @@ -56,4 +60,8 @@ export interface IUpdateInfoCondition rightDrill: boolean; isChaiDan: boolean; autoCutOption: IDrawBoardAutoCutOption; + edgeRemarkUp: boolean; + edgeRemarkDown: boolean; + edgeRemarkLeft: boolean; + edgeRemarkRight: boolean; } diff --git a/src/UI/Components/Modal/ModalStyle/BoardFind.less b/src/UI/Components/Modal/ModalStyle/BoardFind.less index 26be2fc8b..760d0539b 100644 --- a/src/UI/Components/Modal/ModalStyle/BoardFind.less +++ b/src/UI/Components/Modal/ModalStyle/BoardFind.less @@ -203,26 +203,43 @@ #modal .find-sealed { text-align: center; - &>div label { - margin-right: 0; - margin-left : 10px; - position : relative; + .bp3-checkbox { + margin: 0; + margin-left: 7px; + top: 1px; } - &>div:first-child, - &>div:nth-child(2), - &>div:nth-child(3) { - label { - top: 1px; + .remark-box { + height: 30px; + border: 1px solid #ccc; + display: flex; + align-items: center; + + .remarkInput { + width: 125px; } + }; + + .center-box{ + height: 30px; + border: 1px solid #ccc; + display: flex; + justify-content: center; + align-items: center; } - input { + .sealInput { width : 30px; padding : 0 2px; margin-right: 5px; } + .seal-center { + display: flex; + justify-content: center; + align-items: center; + } + .all-sealed { position: absolute; } @@ -230,8 +247,4 @@ .select-drillType { vertical-align: baseline; } - - &>.flex-center { - align-items: center; - } } diff --git a/src/UI/Components/Modal/ModalStyle/BoardModal.less b/src/UI/Components/Modal/ModalStyle/BoardModal.less index 21bff41d8..d8157ea86 100644 --- a/src/UI/Components/Modal/ModalStyle/BoardModal.less +++ b/src/UI/Components/Modal/ModalStyle/BoardModal.less @@ -95,8 +95,14 @@ } } -#commonModal .board-info .boardSize .bp3-input { - width: 30px; +#commonModal .board-info .boardSize { + .bp3-input { + width: 30px; + } + + .remark-input { + width: 40px; + } } #commonModal .boardSize .bp3-inline { diff --git a/src/UI/Components/RightPanel/BoardEdgeRemarksComponent.tsx b/src/UI/Components/RightPanel/BoardEdgeRemarksComponent.tsx new file mode 100644 index 000000000..7957b8854 --- /dev/null +++ b/src/UI/Components/RightPanel/BoardEdgeRemarksComponent.tsx @@ -0,0 +1,85 @@ +import { Button, Classes, Intent, Label } from '@blueprintjs/core'; +import { inject, observer } from 'mobx-react'; +import * as React from 'react'; +import { ColorMaterial } from '../../../Common/ColorPalette'; +import { BoardEdgeRemarksStore } from '../../Store/RightPanelStore/BoardEdgeRemarksStore'; +import { Board_Editor_Key } from '../../Store/RightPanelStore/BoardEdgesEditor'; +import { RightPanelStore } from '../../Store/RightPanelStore/RightPanelStore'; +import { BoardModalType } from '../Board/BoardModalType'; +import { UserConfigComponent } from '../Board/UserConfigComponent'; +import { AppToaster } from '../Toaster'; + +@inject("store") +@observer +export class BoardEdgeRemarksComponent extends React.Component<{ store?: RightPanelStore; }> +{ + render() + { + const boardEdgeRemarksStore = BoardEdgeRemarksStore.GetInstance(); + + return ( +
+
+
    +
  • + + +
  • + { + boardEdgeRemarksStore.option.boardEdgeRemarks.map((v, i) => + { + return ( +
  • + = 10 ? "white" : "black" + }} + >{i + 1} + + { + e.target.setSelectionRange(0, e.target.value.length); + }} + className={Classes.INPUT} + onChange={(e) => + { + boardEdgeRemarksStore.option.boardEdgeRemarks[i] = e.target.value; + }} + /> +
  • + ); + }) + } +
+
+
+
+ +
+ ); + } + private ok = () => + { + this.props.store.boardEdgeRemarksStore.IsApplyData = true; + this.exit(); + }; + private exit() + { + AppToaster.dismiss(Board_Editor_Key); + } +} diff --git a/src/UI/Components/RightPanel/BoardProps.less b/src/UI/Components/RightPanel/BoardProps.less index 00c8c136a..ab04082ca 100644 --- a/src/UI/Components/RightPanel/BoardProps.less +++ b/src/UI/Components/RightPanel/BoardProps.less @@ -89,8 +89,14 @@ } } -#boardPropsCom .board-info .boardSize .bp3-input { - width: 30px; +#boardPropsCom .board-info .boardSize { + .bp3-input { + width: 30px; + } + + .remark-input { + width: 40px; + } } #boardPropsCom .boardSize .bp3-inline { diff --git a/src/UI/Components/RightPanel/BoardPropsComponent.tsx b/src/UI/Components/RightPanel/BoardPropsComponent.tsx index d13ce1b9b..97a22862d 100644 --- a/src/UI/Components/RightPanel/BoardPropsComponent.tsx +++ b/src/UI/Components/RightPanel/BoardPropsComponent.tsx @@ -95,6 +95,7 @@ class BoardPropsCom extends React.Component br={this.props._CurrentBoard.get()} isSpecial={this.props._IsSpecialBoard} otherBoardData={this.props.otherBoardData} + isEdgeRemarks={true} />
diff --git a/src/UI/Components/RightPanel/RightPanel.tsx b/src/UI/Components/RightPanel/RightPanel.tsx index b7bd4c276..18c65ab44 100644 --- a/src/UI/Components/RightPanel/RightPanel.tsx +++ b/src/UI/Components/RightPanel/RightPanel.tsx @@ -6,6 +6,7 @@ import { app } from '../../../ApplicationServices/Application'; import { RightPanelStore } from '../../Store/RightPanelStore/RightPanelStore'; import { MaterialExplorer } from '../MaterialExplorer'; import ModifyModelPanel from '../ToolBar/ModifyModel/ModifyModelPanel'; +import { BoardEdgeRemarksComponent } from './BoardEdgeRemarksComponent'; import './BoardProps.less'; import { BoardPropsComponent } from './BoardPropsComponent'; import { DrillingComponent } from './DrillComponent'; @@ -32,6 +33,7 @@ export enum RightTabId Model2 = "modeing2", Model3 = "modeing3", ModuelParams = 'moduleparams', + BoardEgdeRemark = 'boardedgeremark', } @inject('store') @@ -89,6 +91,7 @@ export class RightPanel extends React.Component<{ store?: RightPanelStore; }> } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/UI/Store/BBSEditorStore.ts b/src/UI/Store/BBSEditorStore.ts index f18a3b310..f10b59773 100644 --- a/src/UI/Store/BBSEditorStore.ts +++ b/src/UI/Store/BBSEditorStore.ts @@ -18,6 +18,7 @@ export const TotalTabbarTitlesInfos: [string, string][] = [ ["排钻", EBoardKeyList.DrillType], ["正面排钻", "frontDrill"], ["反面排钻", "backDrill"], ["高级排钻", "highDrill"], //23,24,25,26 ["大孔面", EBoardKeyList.BigHole],//27 ["是否拆单", "IsChaiDan"],//28 + ['板边备注信息', "boardEdgeRemark"],//29 ]; export class BBSEditorStore implements IConfigStore @@ -25,15 +26,15 @@ export class BBSEditorStore implements IConfigStore private readonly _version = 3; @observable configName = "默认"; @observable configsNames = []; - noResize = [6, 7, 8, 19, 20, 22, 23, 24, 25, 26, 27, 28]; //用于字段列宽度调整,但是有一些特殊框就不做调整了 - @observable tabbarIndexs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 19, 20]; + noResize = [6, 7, 8, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29]; //用于字段列宽度调整,但是有一些特殊框就不做调整了 + @observable tabbarIndexs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 19, 20, 29]; @observable IsBbsCountChaidan = true; //是否统计非拆单板 InitOption() { this.tabbarIndexs.length = 0; - this.tabbarIndexs.push(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 19, 20); + this.tabbarIndexs.push(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 19, 20, 29); this.IsBbsCountChaidan = true; } SaveConfig() diff --git a/src/UI/Store/BoardFindInterface.ts b/src/UI/Store/BoardFindInterface.ts index 4f55a7d74..af439740f 100644 --- a/src/UI/Store/BoardFindInterface.ts +++ b/src/UI/Store/BoardFindInterface.ts @@ -3,7 +3,10 @@ import { EBoardKeyList } from "../../Common/BoardKeyList"; import { BoardOpenDir, ComposingType, LinesType } from "../../DatabaseServices/Entity/BoardInterface"; import { IBaseOption } from "./OptionInterface/IOptionInterface"; -export const DRILL_KEYS = ["downDrill", "rightDrill", "upDrill", "leftDrill"]; +export const DRILL_KEYS = ["downDrill", "rightDrill", "upDrill", "leftDrill"]; //这个顺序不能变 +export const SEAL_KEYS = [EBoardKeyList.UpSealed, EBoardKeyList.DownSealed, EBoardKeyList.RightSealed, EBoardKeyList.LeftSealed]; +export const EDGEREMARK_KEYS = ["edgeRemarkUp", "edgeRemarkDown", "edgeRemarkLeft", "edgeRemarkRight"]; + export interface IBoardFindOption extends IBaseOption { @@ -38,6 +41,11 @@ export interface IBoardFindOption extends IBaseOption extraRemarks: [string, string][]; isChaidan: boolean; [EBoardKeyList.KnifeRad]: string; + + edgeRemarkUp: string; //板边备注上下左右 + edgeRemarkDown: string; + edgeRemarkLeft: string; + edgeRemarkRight: string; } export interface IFindCondition { @@ -75,6 +83,11 @@ export interface IFindCondition useZhengFanDrill: boolean; useChaidan: boolean; [EBoardKeyList.KnifeRad]: boolean; + + edgeRemarkUp: boolean; + edgeRemarkDown: boolean; + edgeRemarkLeft: boolean; + edgeRemarkRight: boolean; } export interface ICompareType diff --git a/src/UI/Store/BoardFindModifyStore.ts b/src/UI/Store/BoardFindModifyStore.ts index 9ff5466bc..7f78105e5 100644 --- a/src/UI/Store/BoardFindModifyStore.ts +++ b/src/UI/Store/BoardFindModifyStore.ts @@ -9,7 +9,7 @@ import { userConfig } from "../../Editor/UserConfig"; import { IConfigOption } from "../Components/Board/UserConfigComponent"; import { ModalState } from "../Components/Modal/ModalInterface"; import { ToasterValueError } from "../Components/Toaster"; -import { DRILL_KEYS, ECompareType, IBoardFindOption } from "./BoardFindInterface"; +import { DRILL_KEYS, ECompareType, EDGEREMARK_KEYS, IBoardFindOption, SEAL_KEYS } from "./BoardFindInterface"; import { BoardStore } from "./BoardStore"; export class BoardFindStore extends BoardStore @@ -17,6 +17,7 @@ export class BoardFindStore extends BoardStore @observable m_Option: IBoardFindOption = JSON.parse(JSON.stringify(DefaultBoardFindOption)); @observable isSelectAllSealed = false; @observable isSelectAllDrill = false; + @observable isSelectAllEgdeRemark = false; @observable isSelectAll = false; @observable isRevSelect = false; @@ -71,6 +72,7 @@ export class BoardFindStore extends BoardStore this.isSelectAllDrill = false; this.isRevSelect = false; this.isSelectAllSealed = false; + this.isSelectAllEgdeRemark = false; } SaveConfig() { @@ -123,7 +125,19 @@ export class BoardFindStore extends BoardStore cof.option.compareType[EBoardKeyList.OpenDir] = ECompareType.Equal; cof.option.condition[EBoardKeyList.OpenDir] = false; cof.option[EBoardKeyList.OpenDir] = BoardOpenDir.None; + } + if (cof.option.version < 9) + { + cof.option.version = 9; cof.option.hardwareDoorName = ""; + cof.option.edgeRemarkUp = ""; + cof.option.edgeRemarkDown = ""; + cof.option.edgeRemarkLeft = ""; + cof.option.edgeRemarkRight = ""; + cof.option.condition.edgeRemarkUp = false; + cof.option.condition.edgeRemarkDown = false; + cof.option.condition.edgeRemarkLeft = false; + cof.option.condition.edgeRemarkRight = false; } Object.assign(this.m_Option, cof.option); @@ -136,9 +150,9 @@ export class BoardFindStore extends BoardStore CheckIsSelectAll() { this.isSelectAll = Object.values(this.m_Option.condition).every(v => v); - this.isSelectAllSealed = [EBoardKeyList.UpSealed, EBoardKeyList.DownSealed, - EBoardKeyList.RightSealed, EBoardKeyList.LeftSealed].every(k => this.m_Option.condition[k]); + this.isSelectAllSealed = SEAL_KEYS.every(k => this.m_Option.condition[k]); this.isSelectAllDrill = DRILL_KEYS.every(k => this.m_Option.condition[k]); + this.isSelectAllEgdeRemark = EDGEREMARK_KEYS.every(k => this.m_Option.condition[k]); } HasInvailValue() { diff --git a/src/UI/Store/OptionInterface/BoardProcessOption.ts b/src/UI/Store/OptionInterface/BoardProcessOption.ts index fd9eeed38..d2a1bc3a9 100644 --- a/src/UI/Store/OptionInterface/BoardProcessOption.ts +++ b/src/UI/Store/OptionInterface/BoardProcessOption.ts @@ -2,7 +2,7 @@ import { FaceDirection } from "../../../Add-on/DrawDrilling/DrillType"; import { EBoardKeyList } from "../../../Common/BoardKeyList"; import { ComposingType, LinesType } from "../../../DatabaseServices/Entity/BoardInterface"; import { ObjectId } from "../../../DatabaseServices/ObjectId"; -import { IHighSealedItem } from "./IHighSealedItem"; +import { IHighEdgeRemarkItem, IHighSealedItem } from "./IHighSealedItem"; import { IBaseOption } from "./IOptionInterface"; export interface BoardProcessOption extends IBaseOption @@ -31,4 +31,10 @@ export interface BoardProcessOption extends IBaseOption backDrill: boolean; remarks: [string, string][]; useBoardProcessOption?: boolean; //使用周围板 + + edgeRemarkUp?: string; //板边备注上下左右 + edgeRemarkDown?: string; + edgeRemarkLeft?: string; + edgeRemarkRight?: string; + highBoardEdgeRemark?: IHighEdgeRemarkItem[]; //高级板边备注 } diff --git a/src/UI/Store/OptionInterface/IHighSealedItem.ts b/src/UI/Store/OptionInterface/IHighSealedItem.ts index b1ed85b57..90340869c 100644 --- a/src/UI/Store/OptionInterface/IHighSealedItem.ts +++ b/src/UI/Store/OptionInterface/IHighSealedItem.ts @@ -9,3 +9,8 @@ export interface ISealingData extends IHighSealedItem type?: string; shop?: string; } + +export interface IHighEdgeRemarkItem +{ + description: string; +} diff --git a/src/UI/Store/RightPanelStore/BoardEdgeRemarksStore.ts b/src/UI/Store/RightPanelStore/BoardEdgeRemarksStore.ts new file mode 100644 index 000000000..3b665e70a --- /dev/null +++ b/src/UI/Store/RightPanelStore/BoardEdgeRemarksStore.ts @@ -0,0 +1,173 @@ +import { observable, toJS } from "mobx"; +import { CommandNames } from "../../../Common/CommandNames"; +import { Log, LogType } from "../../../Common/Log"; +import { Intent } from "../../../Common/Toaster"; +import { Board } from "../../../DatabaseServices/Entity/Board"; +import { CommandWrap } from "../../../Editor/CommandMachine"; +import { GetBoardSealingCurves, GetHighBoardEdgeRemark, SetBoardEdgeRemarkData } from "../../../GraphicsSystem/CalcEdgeSealing"; +import { IConfigOption } from "../../Components/Board/UserConfigComponent"; +import { ShowLinesToaster } from "../../Components/Toaster"; +import { IConfigStore } from "../BoardStore"; +import { IHighEdgeRemarkItem } from "../OptionInterface/IHighSealedItem"; +import { BoardEdgesEditor, Board_Editor_Key } from "./BoardEdgesEditor"; + +export class BoardEdgeRemarksStore extends BoardEdgesEditor implements IConfigStore +{ + isNotUpdateStore = false; + + @observable boardEdgeRemarks: string[] = Array(20).fill(""); + private static _SingleInstance: BoardEdgeRemarksStore; + static GetInstance(): BoardEdgeRemarksStore + { + if (this._SingleInstance) return this._SingleInstance; + this._SingleInstance = new BoardEdgeRemarksStore; + return this._SingleInstance; + } + + @observable option = { boardEdgeRemarks: this.boardEdgeRemarks }; + async InitData() + { + } + + @observable configName: string = "默认"; + @observable configsNames: string[] = []; + InitOption() + { + const initBoardEdgeRemarks = Array(20).fill(""); + //禁止再次初始化,避免用户没有配置的时候,使用板边备注编辑,导致面板属性被还原 + Object.assign(this.option, { boardEdgeRemarks: initBoardEdgeRemarks }); + } + SaveConfig() + { + return { option: toJS(this.option) }; + } + + UpdateOption(cof: IConfigOption) + { + Object.assign(this.option, cof.option); + } + protected InitCurve() + { + const dataColorMap = new Map();//data->color + const canUseColor: number[] = [];//可使用的颜色 + + const boardEdgeRemarks = this.option.boardEdgeRemarks; + + for (let i = 0; i < boardEdgeRemarks.length; i++) + { + if (dataColorMap.has(boardEdgeRemarks[i]) || boardEdgeRemarks[i] === "") + canUseColor.push(i);//可以被覆盖 + else + dataColorMap.set(boardEdgeRemarks[i], i);//记录颜色 + } + + for (const br of this._boardList) + { + const curves = GetBoardSealingCurves(br, true); + const highBoardEdgeRemark = GetHighBoardEdgeRemark(br, curves); + + if (highBoardEdgeRemark.length === curves.length) + { + for (let i = 0; i < highBoardEdgeRemark.length; i++) + { + const remark = highBoardEdgeRemark[i]; + if (!dataColorMap.has(remark.description)) + { + if (canUseColor.length) + { + dataColorMap.set(remark.description, canUseColor[0]); + boardEdgeRemarks[canUseColor[0]] = remark.description; + canUseColor.shift(); + } + else + { + boardEdgeRemarks.push(remark.description); + dataColorMap.set(remark.description, boardEdgeRemarks.length - 1); + } + } + const color = dataColorMap.get(remark.description) + 1; + curves[i].ColorIndex = color; + } + } + else + { + if (!dataColorMap.has("")) + { + if (canUseColor.length) + { + dataColorMap.set("", canUseColor[0]); + boardEdgeRemarks[canUseColor[0]] = ""; + canUseColor.shift(); + } + else + { + boardEdgeRemarks.push(""); + dataColorMap.set("", boardEdgeRemarks.length - 1); + } + } + const color = dataColorMap.get("") + 1; + curves.forEach(cu => cu.ColorIndex = color); + } + this._brMap.set(br, curves); + } + } + protected ShowToaster() + { + ShowLinesToaster( + ["正在编辑板边备注...", "点击<写入>写入板边备注数据到板件,", "点击<退出>或者关闭退出编辑状态"], + { + intent: Intent.PRIMARY, + timeout: 0, + onDismiss: () => + { + this.EndEditor(); + } + }, Board_Editor_Key); + } + #dataMap: Map = new Map(); + protected ParseData() + { + const boardEdgeRemarks = this.option.boardEdgeRemarks; + + for (const [br, cus] of this._brMap) + { + const data: IHighEdgeRemarkItem[] = []; + for (const cu of cus) + { + //检查不存在配置的colorIndex + const color = cu.ColorIndex; + if (color > boardEdgeRemarks.length) + { + Log(color + "号色未设置数据,默认为空", LogType.Warning); + data.push({ description: "" }); + } + else + { + let remark = boardEdgeRemarks[color - 1]; + if (color === 0) + { + remark = ""; + Log(color + "不支持号色为 0 ,默认为空", LogType.Warning); + } + data.push({ description: remark }); + } + } + this.#dataMap.set(br, data); + } + } + + protected async WriteData() + { + await CommandWrap(() => + { + for (let [b, cus] of this._brMap) + { + let data = this.#dataMap.get(b); + let ocsInv = b.OCSInv; + SetBoardEdgeRemarkData(b, data, cus.map(c => c.ApplyMatrix(ocsInv))); + b.BoardProcessOption.highBoardEdgeRemark = data; + } + this.#dataMap.clear(); + }, CommandNames.板边备注编辑); + } +} diff --git a/src/UI/Store/RightPanelStore/RightPanelStore.ts b/src/UI/Store/RightPanelStore/RightPanelStore.ts index 3caf568df..e33114b96 100644 --- a/src/UI/Store/RightPanelStore/RightPanelStore.ts +++ b/src/UI/Store/RightPanelStore/RightPanelStore.ts @@ -6,6 +6,7 @@ import { Board } from "../../../DatabaseServices/Entity/Board"; import { SelectSetBase } from "../../../Editor/SelectBase"; import { RightTabId } from "../../Components/RightPanel/RightPanel"; import { IKnifeProps } from "../OptionInterface/IOptionInterface"; +import { BoardEdgeRemarksStore } from "./BoardEdgeRemarksStore"; import { DrillingStore } from "./DrillingStore"; import { LightStore } from "./LightStore"; import { Modeling2Store } from "./Modeling2Store"; @@ -23,6 +24,7 @@ export class RightPanelStore modelingStore = new ModelingStore(); lightStore = LightStore.GetInstance(); sealingStore = SealingStore.GetInstance(); + boardEdgeRemarksStore = BoardEdgeRemarksStore.GetInstance(); drillingStore = new DrillingStore(); modeling2Store = new Modeling2Store(); modeling3Store = new Modeling2Store(); diff --git a/src/UI/Store/UpdateBoardInfoStore.ts b/src/UI/Store/UpdateBoardInfoStore.ts index 1079c6c9b..6886521d0 100644 --- a/src/UI/Store/UpdateBoardInfoStore.ts +++ b/src/UI/Store/UpdateBoardInfoStore.ts @@ -1,13 +1,12 @@ import { action, observable, toJS } from "mobx"; import { DrillType, FaceDirection } from "../../Add-on/DrawDrilling/DrillType"; -import { EBoardKeyList } from "../../Common/BoardKeyList"; import { CheckObjectType, CheckoutValid } from "../../Common/CheckoutVaildValue"; import { LinesType } from "../../DatabaseServices/Entity/BoardInterface"; import { DefaultUpdateInfoOption } from "../../Editor/DefaultConfig"; import { userConfig } from "../../Editor/UserConfig"; import { IUpdateBoardInfosOption } from "../Components/Board/UpdateBoardInfointerface"; import { IConfigOption } from "../Components/Board/UserConfigComponent"; -import { DRILL_KEYS } from "./BoardFindInterface"; +import { DRILL_KEYS, EDGEREMARK_KEYS, SEAL_KEYS } from "./BoardFindInterface"; import { BoardStore } from "./BoardStore"; export class UpdateBoardInfosStore extends BoardStore @@ -17,6 +16,7 @@ export class UpdateBoardInfosStore extends BoardStore @observable currentBoardName = ""; @observable isSelectAllDrill = true; @observable isSelectAllSealed = true; + @observable isSelectAllEgdeRemark = false; constructor() { @@ -124,6 +124,7 @@ export class UpdateBoardInfosStore extends BoardStore } if (option[name].version < 2 || !option[name].condition.autoCutOption)//fuck { + option[name].version = 2; option[name].condition.autoCutOption = { isAutoCut: false, isRelevance: false }; } if (!option[name].brName) @@ -131,7 +132,18 @@ export class UpdateBoardInfosStore extends BoardStore if (!option[name].highDrill || option[name].highDrill.length === 0) option[name].highDrill = Array(4).fill(option[name].drillType); - option[name].version = 2; + if (option[name].version < 3) + { + option[name].version = 3; + option[name].edgeRemarkUp = ""; + option[name].edgeRemarkDown = ""; + option[name].edgeRemarkLeft = ""; + option[name].edgeRemarkRight = ""; + option[name].condition.edgeRemarkUp = true; + option[name].condition.edgeRemarkDown = true; + option[name].condition.edgeRemarkLeft = true; + option[name].condition.edgeRemarkRight = true; + } this.nameOptionMap.set(name, option[name]); } } @@ -143,9 +155,9 @@ export class UpdateBoardInfosStore extends BoardStore } CheckIsSelectAll() { - this.isSelectAllSealed = [EBoardKeyList.UpSealed, EBoardKeyList.DownSealed, - EBoardKeyList.RightSealed, EBoardKeyList.LeftSealed].every(k => this.m_Option.condition[k]); + this.isSelectAllSealed = SEAL_KEYS.every(k => this.m_Option.condition[k]); this.isSelectAllDrill = DRILL_KEYS.every(k => this.m_Option.condition[k]); + this.isSelectAllEgdeRemark = EDGEREMARK_KEYS.every(k => this.m_Option.condition[k]); } }