开发常用知识点汇总
金蝶云社区-勤劳的小蜜蜂
勤劳的小蜜蜂
9人赞赏了该文章 3,318次浏览 未经作者许可,禁止转载编辑于2019年04月27日 21:27:58

1:插件继承体系


[tr][td=26%] 领域类型[td=39%]基类[td=34%]命名参考
[tr][td=26%] 动态表单 – 维护[td=39%]AbstractDynamicFormPlugIn[td=34%]ExpressionEdit
[tr][td=26%] 业务单据 – 维护[td=39%]AbstractBillPlugIn[td=34%]PurchaseOrderEdit
[tr][td=26%] 业务单据 – 列表[td=39%]AbstractListPlugIn[td=34%]PurchaseOrderList
[tr][td=26%] 基础资料 – 维护[td=39%]AbstractBasePlugIn[td=34%]MaterialEdit
[tr][td=26%] 基础资料 – 列表[td=39%]AbstractListPlugIn[td=34%]MaterialList
2:获取单据相关信息
(1)获取当前行号
int rowIndex = this.Model.GetEntryCurrentRowIndex("FEntity"); FEntity为单据体标识(2)获取单据体集合 Entity entity = this.View.BillBusinessInfo.GetEntity("FSaleOrderEntry"); FSaleOrderEntry为单据体标识 DynamicObjectCollection entrys = this.Model.GetEntityDataObject(entity);(3)操作插件获取选中行 // 扩展方法,需要 using Kingdee.BOS.Core.DynamicForm var selectedRows = this.Option.GetBillOperationSelectedRows();
(4)获取选中行
int[] selectedIndexsR = this.View.GetControl("FSaleOrderEntry").GetSelectedRows();
(5)获取选中行数据
//当前选中行行号
int[] selectedIndexsR = this.View.GetControl("FSaleOrderEntry").GetSelectedRows();
//单据体数据
DynamicObjectCollection selectedRowsDy = this.Model.DataObject["SaleOrderEntry"] as DynamicObjectCollection;
//选中行数据
DynamicObject selectedRow = selectedRowsDy[selectedIndexsR[0]];

(6)获取单据内码
long billNo = Convert.ToInt64(this.View.Model.GetPKValue());//获取当前单据编号内码
(7)获取单据分录内码
int row = this.Model.GetEntryCurrentRowIndex("FSubEntity");
Entity entiry = this.View.Model.BillBusinessInfo.GetEntity("FSubEntity");
object pkValue = this.View.Model.GetEntryPKValue(entiry.Key, row);
(8)在单据列表界面,使用如下语句获取当前选择行的单据内码

this.ListView.CurrentSelectedRowInfo.PrimaryKeyValue
3:当前界面的数据保存,直接调用保存操作
Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.Save(this.Context, this.View.BusinessInfo, this.View.Model.DataObject);

4:检验字符串函数
ObjectUtils.IsNullOrEmptyOrWhiteSpace
IsNullOrWhiteSpace

5:利用代码弹出提示框
this.View.ShowMessage("详细信息", MessageBoxOptions.YesNo, ret =>
{

if (ret == MessageBoxResult.No)
{
e.Cancel = true;
return;
}
}, string.Format("物料编码为:{0}的物料存在不同的报关项号,是否继续?", string.Join(",", list)), MessageBoxType.Notice);

6:通过主键获取对象
FormMetadata formMetadata = MetaDataServiceHelper.Load(this.Context, "BD_MATERIAL") as FormMetadata;
DynamicObject dynamicObject = BusinessDataServiceHelper.LoadSingle(
this.Context,
id,
formMetadata .BusinessInfo.GetDynamicObjectType());

7:获取表单字段的值
DynamicObject FMaterial = (DynamicObject)this.View.Model.GetValue("FMaterialId");FMaterialId为字段标识,本字段是一个基础资料字段DynamicObject FMaterial = (DynamicObject)this.View.Model.GetValue("FMaterialId",e.Row);e.ROW为单据体行号

8:设置表单字段的值
1:给分录赋值 this.View.Model.SetValue("FEntryNote", FNOTE,rowIndex); 2:给单据头赋值 this.View.Model.SetValue("FEntryNote",FNOTE);9:数据库执行语句 DBUtils.Execute(this.Context, updateSql); var mas = DBUtils.ExecuteDynamicObject(this.Context, sql);10:新增、删除单据体行 this.View.Model.DeleteEntryRow("FSONEntity", i);
this.View.Model.CreateNewEntryRow("FSONEntity");11:刷新操作this.View.UpdateView("FieldKey")刷新某个字段this.View.InvokeFormOperation(Kingdee.BOS.Core.DynamicForm.FormOperationEnum.Refresh)//刷新整单12:代码锁定单元格this.View.GetFieldEditor("FBaseUnitId", 0).SetEnabled("", false);this.View.GetFieldEditor("FBarCodeAmount", 0).Enabled = false;13:常用服务端操作https://vip.kingdee.com/questions/49640