昏喽喽

vuePress-theme-reco Lio    2020 - 2025
昏喽喽

Choose mode

  • dark
  • auto
  • light
Home
Category
  • CentOS
  • Csharp
  • DataBase
  • DesignMode
  • Vue
  • FrontEnd
  • GLD
  • Kingdee
  • NetWork
Tags
TimeLine
Tools
  • Http请求
  • 日志配置
  • 加密解密
  • 验证码
  • Git命令
About
author-avatar

Lio

103

Articles

15

Tags

Home
Category
  • CentOS
  • Csharp
  • DataBase
  • DesignMode
  • Vue
  • FrontEnd
  • GLD
  • Kingdee
  • NetWork
Tags
TimeLine
Tools
  • Http请求
  • 日志配置
  • 加密解密
  • 验证码
  • Git命令
About
  • 2023年提单复盘
  • 2022年提单复盘
  • 2021年提单复盘
  • BOS常用方法类库记录
  • 单据状态
  • 常用表名
  • 插件常用方法
  • 客户端常用方法
  • 服务端常用方法
  • 生产用料清单数量计算

插件常用方法

vuePress-theme-reco Lio    2020 - 2025

插件常用方法

Lio 2021-02-23 学习笔记

# 表单插件

  • 获取某字段的值

    this.View.Model.GetValue(string key);

    this.Model.GetValue(string Key);

  • 获取单据主键

    this.View.Model.GetPKValue();

  • 单据体当前索引

    this.Model.GetEntryCurrentRowIndex(key); //key:单据体标识

  • 单据体分录数量

    this.Model.GetEntryRowCount(key); //key:单据体标识

  • 汇总字段并且填充到指定字段

    var = field = this.View.BusinessInfo.GetField("FNUMERATOR") this.Model.SummaryDataAndFill(field, "FQty1")

# 列表插件

  • 获取当前选中行的主键

    this.ListView.SelectedRowsInfo.GetPrimaryKeyValues().Distinct().ToList();

# 打开单据

# 1、打开单据

BillShowParameter showParameter = new BillShowParameter();
this.View.ShowForm(ShowPara);
1
2

# 2、打开列表

ListShowParameter listpara = new ListShowParameter();
this.View.ShowForm(ShowPara);
1
2

# 3、打开动态表单

DynamicFormShowParameter ShowPara = new DynamicFormShowParameter();
this.View.ShowForm(ShowPara);
1
2

# 公共方法

# 1、根据单据ID获取单据的信息

//方式一
 FormMetadata bomFormMetadata = (FormMetadata)AppServiceContext.MetadataService.Load(this.Context, "ENG_BOM");
 DynamicObjectType type = bomFormMetadata.BusinessInfo.GetDynamicObjectType();
 DynamicObject bomData = AppServiceContext.ViewService.LoadSingle(this.Context, bomId, type);

 ******************************************************

 //方式二   插件中采用这种方式
 FormMetadata bomFormMetadata = MetaDataServiceHelper.GetFormMetaData(this.Context, "ENG_BOM");
 DynamicObject bomData = BusinessDataServiceHelper.LoadSingle(this.Context, bomId, bomFormMetadata.BusinessInfo.GetDynamicObjectType());
1
2
3
4
5
6
7
8
9
10

# 2、加载引用属性

FormMetadata simBomEntityMetaData = (FormMetadata)AppServiceContext.MetadataService.Load(ctx, "ENG_SIMBOMENTRYLIST");
List<DynamicObject> simBomEntityDatas = new List<DynamicObject>();
AppServiceContext.DBService.LoadReferenceObject(ctx, simBomEntityDatas.ToArray(), simBomEntityMetaData.BusinessInfo.GetDynamicObjectType());
1
2
3

# 3、创建单据体分录数据实例

protected const string EntityKey_FBomChildEntity = "FBottomEntity";    //单据体标识
//方式一
{
    Entity entity = (Entity)this.Model.BillBusinessInfo.GetEntryEntity(EntityKey_FBomChildEntity); 
    //单据体数据集合对象
    DynamicObjectCollection detailDataEntities = this.Model.GetEntityDataObject(entity);
    //一行数据对象
    DynamicObject addRow = new DynamicObject(detailDataEntities.DynamicCollectionItemPropertyType);
}
************************************************************************************
//方式二
{
    DynamicObjectCollection refMdls = newCfgBillObject[EntityKey_FBomChildEntity] as DynamicObjectCollection;
    DynamicObject addRow = new DynamicObject(refMdls.DynamicCollectionItemPropertyType);
}
************************************************************************************
//方式三  单据体一行数据对象
{
    Entity entity=this.View.Business.GetEntryEntity("FTreeEntity");
    DynamicObject data=new DynamicObject(entity.DynamicObjectType);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# 4、单据体逐行赋值

protected const string EntityKey_FBomChildEntity = "FBottomEntity";
  
Entity entity = (Entity)this.Model.BillBusinessInfo.GetEntryEntity(EntityKey_FBomChildEntity);
DynamicObjectCollection detailDataEntities = this.Model.GetEntityDataObject(entity);
foreach(var item in dataObject)
{
    DynamicObject addRow = new DynamicObject(detailDataEntities.DynamicCollectionItemPropertyType);
    addRow["RowType"] = BOS.Core.Enums.ENUM_ROWTYPE.ExpandWaiting;
    addRow["EntryId"] = SequentialGuid.NewNativeGuid().ToString("N");
    addRow["ParentEntryId"] = item["EntryId"];
    addRow["Seq"] = 2;
    detailDataEntities.Add(addRow);
}

this.View.UpdateView(EntityKey_FBomChildEntity);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# 5、数据包填充单据

FormMetadata formMetadata = (FormMetadata)MetaDataServiceHelper.GetFormMetaData(this.Context, "ENG_SIMBOMENTRYLIST");
//EntryEntity entity = formMetadata.BusinessInfo.GetEntryEntity("FTreeEntity");
//DynamicObjectCollection simBomEntrys = new DynamicObjectCollection(entity.DynamicObjectType);
DynamicObjectCollection simBomEntrys = this.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity("FTreeEntity"));
OperateOption operateOption = OperateOption.Create();
operateOption.SetVariableValue("FormMetadata", formMetadata);
simBomEntrys.FromDataSource(bomEntityData, true, null, null, operateOption);
1
2
3
4
5
6
7