[K/3Cloud] 动态表单打开时传递一个自定义参数并在插件中获取

插件中在调用动态表单时,通过DynamicFormShowParameter的CustomParams,增加自定义的参数。

        /// <summary>
        /// 库存查询
        /// </summary>
        private void ShowMaterialStock()
        {
            object useOrgId = (this.View.Model.GetValue("FUseOrgId") as DynamicObject)["Id"];
            object materialId = this.View.Model.GetPKValue();
            List<long> orgIds = PermissionServiceHelper.GetPermissionOrg(this.Context, new BusinessObject() { Id = K3.Core.SCM.SCMFormIdConst.STK_Inventory }, PermissionConst.View);

            DynamicFormShowParameter ShowPara = new DynamicFormShowParameter();
            ShowPara.ParentPageId = this.View.PageId;
            ShowPara.MultiSelect = false;
            ShowPara.FormId = K3.Core.SCM.SCMFormIdConst.STK_InventoryQuery;
            ShowPara.Height = 600;
            ShowPara.Width = 1000;
            string filter = string.Format(" FStockOrgId = {0} And FMaterialId = {1} And FOwnerTypeId='BD_OwnerOrg' And FOwnerId={2} ", useOrgId, materialId, useOrgId);
            ShowPara.CustomParams.Add("QueryFilter", filter);
            ShowPara.CustomParams.Add("QueryOrgId", (this.View.Model.GetValue("FUseOrgId") as DynamicObject)["Id"].ToString());
            this.View.ShowForm(ShowPara);
        }



目标单据的插件中,通过View.OpenParameter.GetCustomParameter("xxx")获取传递的自定义参数:

    /// <summary>
    /// 即时库存查询界面插件
    /// </summary>
    public class InventoryQuery : AbstractDynamicFormPlugIn
    {
        public override void OnInitialize(InitializeEventArgs e)
        {
            base.OnInitialize(e);
            object paraQueryFilter = this.View.OpenParameter.GetCustomParameter("QueryFilter");
            object paraOrgId = this.View.OpenParameter.GetCustomParameter("QueryOrgId");
            
        }
    }


posted @ 2013-09-12 16:36  范永强  阅读(385)  评论(0编辑  收藏  举报