二开:物料清单删除行,给出提示,可选择是否删除行
1、二开一个表单插件,继承BaseControlEdit,将插件注册在表单插件最后
2、重写EntryBarItemClick,判断当e.BarItemKey为tbDeleteEntry时,实现以下的代码
public override void EntryBarItemClick(BarItemClickEventArgs e)
{
base.EntryBarItemClick(e);
switch (e.BarItemKey)
{
case "tbDeleteEntry":
EntryEntity entity = this.View.BusinessInfo.GetEntryEntity(CONST_ENG_BOM.CONST_FTreeEntity.ENTITY_FTreeEntity);
DynamicObjectCollection allRows = this.View.Model.GetEntityDataObject(entity);
List<int> selRowsIndex = this.View.GetControl<EntryGrid>(entity.Key).GetSelectedRows().OrderByDescending(o => o).ToList();
if (selRowsIndex.Count <= 0 || selRowsIndex.FirstOrDefault() < 0) e.Cancel = true;
List<string> withRepNumber = new List<string>();
int rowCount = allRows.Count;
StringBuilder tips = new StringBuilder();
foreach (int i in selRowsIndex)
{
if (i >= rowCount) break;
long materialChildId = allRows[i].GetDynamicObjectItemValue<long>(CONST_ENG_BOM.CONST_FTreeEntity.ORM_MATERIALIDCHILD_Id);
if (materialChildId > 0)
{
string materialChildNumber = allRows[i].GetDynamicObjectItemValue<DynamicObject>("MATERIALIDCHILD").GetDynamicValue<string>("Number");
withRepNumber.Add(materialChildNumber);
}
}
if (!withRepNumber.IsEmpty())
{
e.Cancel = true;
tips.Append(string.Format("正在删除子项物料{0},是否继续删除?", string.Join(",", withRepNumber)));
this.View.ShowMessage(tips.ToString(), MessageBoxOptions.YesNo, ret =>
{
if (ret == MessageBoxResult.Yes)
{
foreach (int i in selRowsIndex)
{
if (i >= rowCount) break;
this.Model.DeleteEntryRow("FTreeEntity", i);
}
}
});
}
break;
}
}
3、具体效果:
二开:物料清单删除行,给出提示,可选择是否删除行
本文2024-09-23 03:11:44发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-157311.html