动态表单插件常用方法原创
金蝶云社区-碎
22人赞赏了该文章 3,940次浏览 未经作者许可,禁止转载编辑于2020年06月04日 11:55:21

DynamicFormShowParameter show = new DynamicFormShowParameter();

show.FormId = "k980c1b0c4d044ec4bfd01d24f16a91ae";---动态表单标识

show.CustomParams.Add("FBillNo", Convert.ToString(this.View.Model.GetValue("FBillNo")));--传递数值给动态表单

this.View.ShowForm(show);--打开动态表单



FBillNo = this.View.OpenParameter.GetCustomParameter("FBillNo").ToString();--接收传递过来的数值


Entity entity = this.View.Model.BusinessInfo.GetEntity("F_ybx_Entity");

DynamicObjectCollection rows = this.Model.GetEntityDataObject(entity);--动态表单集合

                for (int i = 0; i < dt.Rows.Count; i++)

                {

                    DynamicObject row = new DynamicObject(entity.DynamicObjectType);--其中的一行

                    entity.SeqDynamicProperty.SetValue(row, i + 1);

                    row["F_ybx_outstocknum"] = dt.Rows[i]["fbillno"].ToString();

                    row["F_ybx_materialnum"] = dt.Rows[i]["FNUMBER"].ToString();

                    row["F_ybx_fmaterialname"] = dt.Rows[i]["FNAME"].ToString();

                    row["F_ybx_outstockqty"] = dt.Rows[i]["FREALQTY"].ToString();

                    row["F_FID"] = dt.Rows[i]["FID"].ToString();

                    rows.Add(row);

                }


返回数据示例代码:

int count = 0;

                Entity entity = this.View.BillBusinessInfo.GetEntity("F_ybx_Entity");

                DynamicObjectCollection entityDataObject = this.View.Model.GetEntityDataObject(entity);

                DynamicObjectCollection dymat = new DynamicObjectCollection(entity.DynamicObjectType,null);

                foreach (DynamicObject Current in entityDataObject)

                {

                    if (Current["F_ybx_CheckBox"].ToString().ToUpper()=="TRUE")

                    {

                        dymat.Add(Current);

                        count++;

                    }

                }

                if (count == 0)

                {

                    this.View.ShowMessage("请选择一行数据");

                    return;

                }

                if(count>1)

                {

                    this.View.ShowMessage("只能选择一行数据");

                    return;

                }

                if(count==1)

                {

                    this.View.ReturnToParentWindow(dymat);

                    this.View.Close();

                }


 this.View.ShowForm(show, delegate(FormResult result)//接收数据

                {

                    DynamicObjectCollection returnData=(DynamicObjectCollection)result.ReturnData;

                    if (returnData != null)

                    {

                        DynamicObject entryRow = returnData[0];--可做for循环

                        this.View.Model.SetValue("F_WLBM", entryRow["F_ybx_materialnum"]);

                        this.View.Model.SetValue("F_WLMC", entryRow["F_ybx_fmaterialname"]);

                        this.View.Model.SetValue("F_CKSL", entryRow["F_ybx_outstockqty"]);

                        this.View.Model.SetValue("F_CKDBH", entryRow["F_ybx_outstocknum"]);

                        this.View.Model.SetValue("F_CKDID", entryRow["F_FID"]);

                    }

                }

                    )



赞 22