金蝶BOS 插件数据填充
一、填充单据体行
//单据 单据体菜单按钮事件public override void BarItemClick(BarItemClickEventArgs e){private string sql = "";base.BarItemClick(e);if (e.BarItemKey.EqualsIgnoreCase("btn_tongbu")) {sql = @"/*dialect*/select t.F_ORA_BASE as cbMoney,t.F_ORA_TEXT as xmCode,t.F_ORA_COMBO as kjkmCode from ORA_t_Cust_Entry100013 t ";//and F_ORA_Base={0} sql = string.Format(sql, fang["ID"].ToString());//参数占位符sql = string.Format(sql);DynamicObjectCollection listData = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);if (listData.Count() > 0){//插入行 明细foreach (DynamicObject item in listData){this.View.Model.CreateNewEntryRow("FEntity");//创建行 标识符this.View.Model.SetValue("F_ORA_Base", item["kjkmCode"], Convert.ToInt32(item["seq"].ToString()) - 1);//会计科目this.View.Model.SetValue("F_ORA_Assistant", item["xmCode"], Convert.ToInt32(item["seq"].ToString()) - 1);//项目this.View.Model.SetValue("F_ORA_Decimal", item["cbMoney"], Convert.ToInt32(item["seq"].ToString()) - 1);//成本金额}}else {this.View.ShowWarnningMessage("没有查询到项目数据", "");} }}
二、填充单据头数据
//表头 FREALRECAMOUNTFOR为字段的标识符,value为值
this.View.Model.SetValue("FREALRECAMOUNTFOR", value);