表单插件 AbstractBillPlugIn!!!

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

表单插件 AbstractBillPlugIn!!!

一、表单插件里面调用单据界面按钮操作


            DynamicWebFormView引用组件 Kingdee.BOS.Core
            DynamicObject llddat = biview.Model.DataObject;
             //代码调用单据界面按钮操作  tbSaveTemp(单据按钮标识)
            ((IDynamicFormViewService)biview).MainBarItemClick("tbSaveTemp");
             //代码调用单据体界面按钮操作  tbQueryPrice(单据体按钮标识),FPOOrderEntry(单据体标识)
            ((DynamicWebFormView)this.View).EntryBarItemClick("FPOOrderEntry", "tbQueryPrice");


二、表单插件多语言字段取值和赋值

        1、多语言字段取值

                //LocaleValue 引用组件Kingdee.BOS
                DynamicObject data = this.View.Model.DataObject;
                LocaleValue names = data["name"] as LocaleValue;
                string str1 = names[2052];
                string str2 = names[1033];
                this.View.ShowMessage("中文:"+ str1+"\n英文:"+ str2);

    

        2、多语言字段赋值

                LocaleValue localValue = new LocaleValue();
                localValue[2052] = "我是简体中文";
                localValue[1033] = "我是英文";
                this.Model.SetValue("Fname", localValue);


三、表单插件获取枚举下拉的值和名称


                var fieldKey = "字段标识";
                var field = this.View.BusinessInfo.GetField(fieldKey) as ComboField;
                string enumName = string.Join(",", items.Select(o => o["Caption"]));
                string enumValue = string.Join(",", items.Select(o => o["Value"]));
                //如果只知道枚举的值sql 查询也可以查询到名称
                --规格一 (枚举名称)  TZ(枚举值)
                SELECT b.FCAPTION FROM T_META_FORMENUMITEM a 
		INNER JOIN T_META_FORMENUM_L c on a.FID = c.FID 
		INNER JOIN T_META_FORMENUMITEM_L b ON a.FENUMID=b.FENUMID
		AND b.FLOCALEID=2052 
		WHERE  c.FNAME='规格一' and a.FVALUE='TZ'

四、AppDomain.CurrentDomain.BaseDirectory 获取根目录路径,如:E:\Program Files (x86)\Kingdee\K3Cloud\WebSite


五,表单插件保存前事件构建关联关系

        1、销售出库单手动新增,保存的时候关联上游销售订单

        

            using Kingdee.BOS.Core.Bill.PlugIn;            
            using Kingdee.BOS.Core.Bill.PlugIn.Args;
            using Kingdee.BOS.Orm.DataEntity;
            using System;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.Linq;
            using System.Text;
            namespace Demo.BusinessPlugIn
            {
                [Kingdee.BOS.Util.HotUpdate]
                [Description("销售出库单关联销售订单")]
                public class XSCKDBill: AbstractBillPlugIn
                {
                    public override void BeforeSave(BeforeSaveEventArgs e)
                    {
                        base.BeforeSave(e);
                        DynamicObject data = this.View.Model.DataObject;
                        DynamicObjectCollection ents = data["SAL_OUTSTOCKENTRY"] as DynamicObjectCollection;
                        foreach (var ent in ents) {
                            DynamicObjectCollection linkObjColl = ent["FEntity_Link"] as DynamicObjectCollection;
                            if (linkObjColl.Count > 0) continue;
                            DynamicObject linkObj = new DynamicObject(linkObjColl.DynamicCollectionItemPropertyType);
                            linkObjColl.Add(linkObj);
                            linkObj["SBillId"] = "100002";
                            linkObj["Sid"] = "100002";
                            linkObj["RuleId"] = "SaleOrder-OutStock";//转换规则id
                            //linkObj["BaseUnitQtyOld"] = 4;
                            //linkObj["BaseUnitQty"] = 1;
                            //linkObj["SALBASEQTYOld"] = 4;
                            //linkObj["SALBASEQTY"] = 1;
                            //linkObj["PRICEBASEQTYOld"] = 4;
                            //linkObj["PRICEBASEQTY"] = 1;
                            linkObj["STableName"] = "T_SAL_ORDERENTRY";
                            //分录源单类型
                            ent["SrcType"] = "SAL_SaleOrder";
                            //分录源编号
                            ent["SrcBillNo"] = "XSDD000002";
                            //分录源销售订单号
                            ent["SoorDerno"] = "XSDD000002";
                            //分录源单分录ID
                            ent["SOEntryId"] = "100002";
                            
                         // 获取单据体当前行的子单据体的要汇总的字段的合计值 
                        DynamicObjectCollection subObjs = data["QLKJ_t_xmzmxEntry"] as DynamicObjectCollection;
                        //已分配金额
                        var subyfpje = Convert.ToDecimal(Convert.ToDecimal(subObjs.Where(o =>
                        o["F_QLKJ_Amount"] != null).Sum(o => Convert.ToDecimal(o["F_QLKJ_Amount"]))));
                        }
                    }
                
                 //获取单据体所有行基础资料id字段拼接为list
                //protected string GetChildMaterialIdFilter(DynamicObjectCollection treeEntity)
                //{
                //	List<string> childMtrlIds = (from x in treeEntity
                //	select x["F_TAIC_zxwlbm_ID"].ConvertTo<string>(null)).ToList<string>();
                //	if (!childMtrlIds.Any<string>())
                //	{
                //	return string.Empty;
                //	}
                //	return string.Format(" FMaterialId NOT IN ({0})", string.Join(",", childMtrlIds));
                //}
                    
                }
            }


六、辅助属性字段赋值取值

    

    1、引用


        using Kingdee.BOS.Core.Bill.PlugIn;        
        using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
        using Kingdee.BOS.Core.Metadata.FieldElement;
        using Kingdee.BOS.Model.DynamicForm;
        using Kingdee.BOS.Orm.DataEntity;
        using System.ComponentModel;
        using Kingdee.BOS.Web.DynamicForm;


    2、取值

        DynamicObject fx = this.Model.GetValue("FAUXPROPID", e.Row) as DynamicObject;

    3、赋值

        //文本赋值        
         var flexField = (RelatedFlexGroupField)this.View.BillBusinessInfo.GetField("FAuxPropId");
          ((DynamicFormModel)this.Model).SetFlexValue(flexField, "$$FAUXPROPID__FF100001", "cscs" + e.Row, e.Row);
        //内码赋值
         ((DynamicWebFormView)this.View).SetItemValueByIDFromClient("$$FAUXPROPID__FF100001", "内码ID", 1);
        //Model包赋值
         DynamicObject fx = this.Model.GetValue("FAUXPROPID", e.Row) as DynamicObject;
                        if (fx != null)
                        {
                            fx["F100001"] = "cacaaaa" + e.Row;
                            this.View.UpdateView("$$FAUXPROPID__FF100001", e.Row);
                        }


    4、相关表,T_BD_FLEXSITEMDETAILV-辅助属性维度数据存储表,T_BD_FLEXAUXPROPERTY-辅助属性表,存储FFLEXNUMBER等信息


七、控件设置颜色,字体大小

  public override void OnBillInitialize(BillInitializeEventArgs e)
        {
            base.OnBillInitialize(e);
            //View.GetControl("F_TAIC_IMPORT").SetCustomPropertyValue("forecolor", "#ff0000");//前景色
            View.GetControl("F_TAIC_IMPORT").SetCustomPropertyValue("BackColor", "#ff0000");//背景色
            View.GetControl("F_TAIC_IMPORT").SetCustomPropertyValue("FontSize", 16);//字体大小
            this.View.GetControl("F_TAIC_xncsbz").SetCustomPropertyValue("title", "ssa");//修改字段标题
        }


    1、可见性设置
        this.View.GetControl("FButton").SetCustomPropertyValue("visible", true);
    2、锁定性设置
        this.View.GetControl("FDate").SetCustomPropertyValue("disabled", true);
    3、按钮、标签背景色设置
        this.View.GetControl("FButton").SetCustomPropertyValue("backcolor", "115,208,241");
    4、按钮、标签字体颜色设置
        this.View.GetControl("FButton").SetCustomPropertyValue("forecolor", "255,255,255");
    5、按钮、标签文本值设置
        this.View.GetControl("FLable").SetCustomPropertyValue("value", "我是标签");
    6、高度、宽度设置
        this.View.GetControl("FDocEntity").SetCustomPropertyValue("height", 100);
        this.View.GetControl("FDocEntity").SetCustomPropertyValue("width", 320); 
    7、设置页签控件的当前选中页签
        this.View.GetControl<TabControl>("FTab").SetCustomPropertyValue("selectedIndex", 2);
    8、设置控件背景图片
        this.View.GetControl("FButton").SetCustomPropertyValue("backgroundurl", "img.webp");


您好,请问可以在操作插件中调用表单插件吗?或者在操作插件中触发表单插件中的BarItemClick()方法

表单插件 AbstractBillPlugIn!!!

一、表单插件里面调用单据界面按钮操作 DynamicWebFormView引用组件 Kingdee.BOS.Core DynamicObject llddat = bivi...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息