!2720 优化:加工组允许添加已存在的酒格、格子抽实体

pull/2674/MERGE
林三 3 months ago committed by ChenX
parent 9dc1cf4982
commit 603e4e4eb0

@ -104,25 +104,27 @@ export class Command_BoardInfoDimTool implements Command
textString = `${info[0]} : 上封边 - ${board.BoardProcessOption[EBoardKeyList.UpSealed]} 下封边 - ${board.BoardProcessOption[EBoardKeyList.DownSealed]} 左封边 - ${board.BoardProcessOption[EBoardKeyList.LeftSealed]} 右封边 - ${board.BoardProcessOption[EBoardKeyList.RightSealed]}`;
break;
case EBoardKeyList.ProcessGroup:
let temp = board.Template?.Object;
if (temp instanceof TemplateWineRackRecord)
{
if (!(board.Name === "层板" || board.Name === "立板"))
textString = "加工组 : 酒格 ";
}
else if (temp instanceof TemplateLatticeRecord)
{
textString = "加工组 : 格子抽 ";
}
let processingList = board.ProcessingGroupList;
if (processingList.length)
{
textString = "加工组 : ";
if (!textString)
textString = "加工组 : ";
for (let processing of processingList)
textString += `${((processing as ObjectId).Object as ProcessingGroupRecord).Name} `;
}
else
{
if (board.Template?.Object instanceof TemplateWineRackRecord)
{
if (!(board.Name === "层板" || board.Name === "立板"))
textString = "加工组 : 酒格";
}
else if (board.Template?.Object instanceof TemplateLatticeRecord)
{
textString = "加工组 : 格子抽";
}
}
break;
case EBoardKeyList.Remarks:
let remarks = board.BoardProcessOption.remarks;

@ -85,25 +85,22 @@ export class ErpParseData
{
AddTempToMapFunc(temp instanceof TemplateWineRackRecord ? "酒格" : "格子抽", temp);
}
else
let groupList = entity.ProcessingGroupList ?? [];
for (let pg of groupList)
{
let groupList = entity.ProcessingGroupList;
for (let pg of groupList)
let g = pg?.Object as ProcessingGroupRecord;
if (!g) continue;
if (pgMap_pg.has(g.Name))
{
let g = pg?.Object as ProcessingGroupRecord;
if (!g) continue;
if (pgMap_pg.has(g.Name))
let gs = pgMap_pg.get(g.Name);
if (gs.findIndex(gss => gss.Id.Index === g.Id.Index) === -1)
{
let gs = pgMap_pg.get(g.Name);
if (gs.findIndex(gss => gss.Id.Index === g.Id.Index) === -1)
{
gs.push(g);
pgMap_pg.set(g.Name, gs);
}
gs.push(g);
pgMap_pg.set(g.Name, gs);
}
else
pgMap_pg.set(g.Name, [g]);
}
else
pgMap_pg.set(g.Name, [g]);
}
};
//生成加工组信息processGroupObjectList的方法

@ -670,12 +670,24 @@ export class BBSProcessGroupItem extends React.Component<IBBSProcessGroupItemPro
[...this.tags].map((tag) =>
{
const onRemove = () => this.RemoveTag(tag);
let pgName = tag.pg.Name;
if (this.GetRemovable(tag))
{
if (tag.pg instanceof TemplateWineRackRecord)
pgName = "酒格";
if (tag.pg instanceof TemplateLatticeRecord)
pgName = "格子抽";
}
pgName += tag.index;
return <Tag
className={"br-process-modal-alert-tags"}
key={tag.pg === null ? this.GetTemplatePgName() + tag.index : (tag.pg.Name + tag.index)}
onRemove={this.GetRemovable(tag) && onRemove}
key={pgName}
onRemove={!this.GetRemovable(tag) && onRemove}
>
{tag.pg === null ? this.GetTemplatePgName() + tag.index : (tag.pg.Name + tag.index)}
{pgName}
</Tag>;
}) :
""
@ -688,7 +700,7 @@ export class BBSProcessGroupItem extends React.Component<IBBSProcessGroupItemPro
}
private GetRemovable = (tag: ITagData) =>
{
return tag.pg !== null;
return tag.pg instanceof TemplateWineRackRecord || tag.pg instanceof TemplateLatticeRecord;
};
private RemoveTag = (tag: ITagData) =>
{
@ -699,52 +711,65 @@ export class BBSProcessGroupItem extends React.Component<IBBSProcessGroupItemPro
{
const realBr = this.props.realBr;
let str = this.GetTemplatePgName();
//#http://pm.cf/zentao/story-view-1245-0--story.html
//要求能够对“酒格”、“格子抽”附加其他多重加工组
// return pgsName;
if (str !== "")//板件属于酒格/格子抽模块
{
this.tags.clear();
let mapget = this.props.processGroupData.get(str);
if (!mapget)
return;
let index = mapget.findIndex(objId => objId.Object instanceof TemplateRecord && objId.Index === realBr.Template.Index);
if (index !== -1)
this.tags.add({ index: index + 1, pg: null });
if (mapget)
{
let index = mapget.findIndex(objId => objId.Object instanceof TemplateRecord && objId.Index === realBr.Template.Index);
if (index !== -1)
this.tags.add({ index: index + 1, pg: mapget[index].Object as ProcessingGroupRecord });
}
}
else
for (let g of realBr.ProcessingGroupList)
for (let g of realBr.ProcessingGroupList)
{
let flag = 0;
let thisg = (g?.Object as ProcessingGroupRecord);
if (!thisg) continue;
for (let t of this.tags)
{
let flag = 0;
let thisg = (g?.Object as ProcessingGroupRecord);
if (!thisg) continue;
for (let t of this.tags)
if (t.pg === thisg)
{
if (t.pg === thisg)
{
flag = 1;
break;
}
flag = 1;
break;
}
if (flag)
continue;
let mapget = this.props.processGroupData.get(thisg.Name);
if (!mapget)
continue;
let index: number;//虚拟索引 区分同类型加工组
index = mapget.findIndex(objId => objId.Object instanceof ProcessingGroupRecord && objId.Index === g.Index);
if (index !== -1)
this.tags.add({ index: (index + 1), pg: thisg });
}
if (flag)
continue;
let mapget = this.props.processGroupData.get(thisg.Name);
if (!mapget)
continue;
let index: number;//虚拟索引 区分同类型加工组
index = mapget.findIndex(objId => objId.Object instanceof ProcessingGroupRecord && objId.Index === g.Index);
if (index !== -1)
this.tags.add({ index: (index + 1), pg: thisg });
}
};
private GetInputVal = () =>
{
if (this.tags.size === 1)
let vals = [...this.tags].map((tag) =>
{
for (let tag of this.tags)
let pgName = tag.pg.Name;
if (this.GetRemovable(tag))
{
if (tag.pg === null)
return this.GetTemplatePgName() + tag.index;
if (tag.pg instanceof TemplateWineRackRecord)
pgName = "酒格";
if (tag.pg instanceof TemplateLatticeRecord)
pgName = "格子抽";
}
}
return this.tags.size > 0 ? [...this.tags].map((t) => { return t.pg.Name + t.index; }).join(", ") : "";
pgName += tag.index;
return pgName;
});
return vals.join(", ") ?? "";
};
private HandleAlertOnComfirm = () =>
{

@ -508,7 +508,10 @@ export class LookOverBoardInfosModal extends React.Component<LookOverBoardInfosM
|| tempObj instanceof TemplateLatticeRecord)
{
TemplatePgNameUpdateFunc(tempObj instanceof TemplateWineRackRecord ? "酒格" : "格子抽");
return pgsName;
//#http://pm.cf/zentao/story-view-1245-0--story.html
//要求能够对“酒格”、“格子抽”附加其他多重加工组
// return pgsName;
}
for (let g of br.ProcessingGroupList)
{

@ -4,13 +4,12 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { FaceDirection } from "../../../Add-on/DrawDrilling/DrillType";
import { app } from '../../../ApplicationServices/Application';
import { arrayRemove } from '../../../Common/ArrayExt';
import { arrayRemove, arrayRemoveIf } from '../../../Common/ArrayExt';
import { EBoardKeyList } from '../../../Common/BoardKeyList';
import { CheckObjectType } from '../../../Common/CheckoutVaildValue';
import { CommandNames } from '../../../Common/CommandNames';
import { ComposingFaceSelectOption, LineTypeSelectOption } from '../../../Common/CommonSelectOption';
import { safeEval } from '../../../Common/eval';
import { CADObject } from '../../../DatabaseServices/CADObject';
import { Board } from '../../../DatabaseServices/Entity/Board';
import { ProcessingGroupRecord } from '../../../DatabaseServices/ProcessingGroup/ProcessingGroupRecord';
import { TemplateLatticeRecord } from '../../../DatabaseServices/Template/ProgramTempate/TemplateLatticeRecord';
@ -189,16 +188,31 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
{
this.showAlert.set(true);
};
private onAlertConfirm = () =>
private onAlertConfirm = async () =>
{
if (!(this.props.br) || this.props.br.ProcessingGroupList.length === this.tags.length || this.IsWineRackORLattice())
if (!this.props.br)
return;
let processingGroupLength = this.props.br.ProcessingGroupList.length;
//酒格 格子抽ProcessingGroupList实际少一个固定加工组
if (this.IsWineRackORLattice())
{
processingGroupLength += 1;
//减去酒格或格子抽一个固定加工组
this.tags.splice(0, 1);
}
if (processingGroupLength === this.tags.length)
return;
let needDelGroupID = [...this.props.br.ProcessingGroupList].filter((g) =>
{
return !(this.tags.includes((g?.Object as ProcessingGroupRecord)?.Name));
});
let pgs = app.Database.ProcessingGroupTable.Objects.filter((g) => { return needDelGroupID.includes(g.Id); });
CommandWrap(() =>
await CommandWrap(() =>
{
for (let pg of pgs)
{
@ -211,8 +225,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
{
let br = this.props?.br;
if (!br) return false;
let temp: CADObject;
temp = br.Template?.Object;
let temp = br.Template?.Object;
if (!temp) return false;
return ((temp instanceof TemplateWineRackRecord && !(br.Name === "层板" || br.Name === "立板")) || temp instanceof TemplateLatticeRecord);
};
@ -220,6 +233,7 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
{
const br = this.props.br;
if (!br) return;
this.tags = [];
if (br.Template)
{
if (br.Template.Object instanceof TemplateWineRackRecord)
@ -227,21 +241,19 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
if (!(br.Name === "层板" || br.Name === "立板"))
{
this.tags = ["酒格"];
return;
}
}
if (br.Template.Object instanceof TemplateLatticeRecord)
else if (br.Template.Object instanceof TemplateLatticeRecord)
{
this.tags = ["格子抽"];
return;
}
}
this.tags = [...br.ProcessingGroupList].map((g) =>
for (let process of br.ProcessingGroupList)
{
let obj = g?.Object;
let obj = process?.Object;
if (obj)
return (obj as ProcessingGroupRecord).Name;
});
this.tags.push((obj as ProcessingGroupRecord).Name);
}
};
private isSplit()
{
@ -287,7 +299,8 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
{
label: "反(两面朝下)",
value: FaceDirection.Back.toString()
}, {
},
{
label: "朝向柜内",
value: FaceDirection.Inside.toString()
}];
@ -369,24 +382,41 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
onClose={() => this.showAlert.set(false)}
canEscapeKeyCancel={true}
canOutsideClickCancel={true}
onCancel={() => { this.setState({ canAlertOpen1: false }); this.updateTags(); }}
onConfirm={() => { this.onAlertConfirm(); }}
onCancel={() =>
{
this.setState({ canAlertOpen1: false });
this.updateTags();
}}
onConfirm={async () =>
{
await this.onAlertConfirm();
this.updateTags();
}}
>
<div>
{
this.tags.length > 0 ?
this.tags.map((tag) =>
this.tags.map((tag, i) =>
{
const onRemove = () => this.tags = this.tags.filter((t) => t !== tag);
const onRemove = () =>
{
if (this.IsWineRackORLattice())
{
let firstTag = this.tags.shift();
arrayRemoveIf(this.tags, (t) => t === tag);
this.tags.unshift(firstTag);
}
else
arrayRemoveIf(this.tags, (t) => t === tag);
};
return <Tag
className={"br-process-modal-alert-tags"}
key={tag}
onRemove={!this.IsWineRackORLattice() && onRemove}
onRemove={!(this.IsWineRackORLattice() && i === 0) && onRemove}
>
{tag}
</Tag>;
}) :
""
}) : ""
}
</div>
{/* todo添加加工组 */}
@ -494,7 +524,8 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>
const islock = this.props.otherBoardData.isAssociationDrillLock;
this.props.otherBoardData.isAssociationDrillLock = !islock;
}}
/>}
/>
}
</div>
}
</div>

@ -540,65 +540,70 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro
let needSelectedCategory: string[] = [];
//只选中左边的项时 删除左边选中的
if (this.props.store.selectedRightNodeSet.size === 0 && this.props.store.selectedGroupSet.size === 0 && this.props.store.selectedObjectSet.size === 0 && this.props.store.selectedLeftNodeSet.size > 0)
if (this.state.alertType === 0)
{
for (let gname of this.props.store.selectedLeftNodeSet)
if (this.props.store.selectedLeftNodeSet.size > 0)
{
this.pgCategoryMap.delete(gname);
for (let gname of this.props.store.selectedLeftNodeSet)
{
this.pgCategoryMap.delete(gname);
}
this.props.store.processGroupCategory = this.props.store.processGroupCategory.filter((g) => !this.props.store.selectedLeftNodeSet.has(g));
this.props.store.selectedLeftNodeSet.clear();
}
this.props.store.processGroupCategory = this.props.store.processGroupCategory.filter((g) => !this.props.store.selectedLeftNodeSet.has(g));
this.setState({ nodes: this.parseNodes() });
this.props.store.selectedLeftNodeSet.clear();
}
//删除加工组
for (let g of this.props.store.selectedGroupSet)
{
this.DelGroup(g);
needSelectedCategory.push(g.Name);
}
this.props.store.selectedGroupSet.clear();
//删除组类别
for (let c of this.props.store.selectedRightNodeSet)
else
{
for (let g of app.Database.ProcessingGroupTable.Objects)
//删除加工组
for (let g of this.props.store.selectedGroupSet)
{
if (g.IsErase)
continue;
if (g.Name === c)
this.DelGroup(g);
this.DelGroup(g);
needSelectedCategory.push(g.Name);
}
}
//检查组类别下的模块加工组
for (let ndpg of this.props.store.tempPgs)
{
let title = ndpg.nodeName.match(/\>(.*)/g)[0].trim().slice(2); //">"后面还有一个空格
if (this.props.store.selectedRightNodeSet.has(title))
this.props.store.selectedGroupSet.clear();
//删除组类别
for (let c of this.props.store.selectedRightNodeSet)
{
AppToaster.show({
message: `加工组${ndpg.nodeName}跟随模块生成,无法删除!`,
intent: Intent.WARNING,
timeout: 1000,
});
for (let g of app.Database.ProcessingGroupTable.Objects)
{
if (g.IsErase)
continue;
if (g.Name === c)
this.DelGroup(g);
}
}
}
for (let nd of this.props.store.selectedTempPgs)
{
let title = nd.nodeName.match(/\>(.*)/g)[0].trim().slice(2);
if (!this.props.store.selectedRightNodeSet.has(title))
AppToaster.show({
message: `加工组${nd.nodeName}跟随模块生成,无法删除!`,
intent: Intent.WARNING,
timeout: 1000,
});
//检查组类别下的模块加工组
for (let ndpg of this.props.store.tempPgs)
{
let title = ndpg.nodeName.match(/\>(.*)/g)[0].trim().slice(2); //">"后面还有一个空格
if (this.props.store.selectedRightNodeSet.has(title))
{
AppToaster.show({
message: `加工组${ndpg.nodeName}跟随模块生成,无法删除!`,
intent: Intent.WARNING,
timeout: 1000,
});
}
}
for (let nd of this.props.store.selectedTempPgs)
{
let title = nd.nodeName.match(/\>(.*)/g)[0].trim().slice(2);
if (!this.props.store.selectedRightNodeSet.has(title))
AppToaster.show({
message: `加工组${nd.nodeName}跟随模块生成,无法删除!`,
intent: Intent.WARNING,
timeout: 1000,
});
}
this.props.store.selectedTempPgs = [];
this.props.store.selectedRightNodeSet.clear();
for (let c of needSelectedCategory)
this.props.store.selectedRightNodeSet.add(c);
}
this.props.store.selectedTempPgs = [];
this.props.store.selectedRightNodeSet.clear();
for (let c of needSelectedCategory)
this.props.store.selectedRightNodeSet.add(c);
this.setState({ nodes: this.parseNodes(), canAlertOpen1: false });
this.setState({ nodes: this.parseNodes(), canAlertOpen1: false });
}, CommandNames.);
};
@ -756,29 +761,33 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro
let ens = ssRes.SelectSet.SelectEntityList as SelectEntityTypes;
// ------------------
//#http://pm.cf/zentao/story-view-1245-0--story.html
//要求能够对“酒格”、“格子抽”附加其他多重加工组
//排除已经在格子抽和酒格模块中的板件
let len = ens.length;
ens = ens.filter(en =>
{
let template = en.Template?.Object;
if (template instanceof TemplateWineRackRecord)
{
if (en instanceof Board && (en?.Name === "层板" || en?.Name === "立板"))
return true;
else
return false;
}
if (template instanceof TemplateLatticeRecord)
return false;
return true;
});
if (ens.length !== len)
AppToaster.show({
message: "已过滤属于格子抽/酒格模块的板件",
intent: Intent.WARNING,
timeout: 5000
});
// let len = ens.length;
// ens = ens.filter(en =>
// {
// let template = en.Template?.Object;
// if (template instanceof TemplateWineRackRecord)
// {
// if (en instanceof Board && (en?.Name === "层板" || en?.Name === "立板"))
// return true;
// else
// return false;
// }
// if (template instanceof TemplateLatticeRecord)
// return false;
// return true;
// });
// if (ens.length !== len)
// AppToaster.show({
// message: "已过滤属于格子抽/酒格模块的板件",
// intent: Intent.WARNING,
// timeout: 5000
// });
// ------------------
let entityHasPG = ens.some(en =>
{

Loading…
Cancel
Save