基础功能扩展原创
金蝶云社区-白开水
白开水
17人赞赏了该文章 958次浏览 未经作者许可,禁止转载编辑于2022年07月17日 14:03:05
  1. 领域模型(DomainModel):

     领域模型属性(ElementProperty)

     领域模型元素管理(ElementType)

     元素-属性映射关系(ElementPropertyMap)

-------------------------------------------------SQL查询-------------------------------------

select t5.FNAME 模型,e1_l.FNAME 元素,e1.FID, t3_l.FNAME 属性,t2.FDEFAULTVALUE 默认值,t3.FVALUETYPE,pe.fcaption from t_MDL_domainmodelelementmap t1

inner join t_MDL_domainmodelElPropmap t2 on t1.FENTRYID=t2.FENTRYID

inner join t_MDL_elementtype e1 on t1.FELEMENTTYPEID=e1.FID

inner join T_MDL_ELEMENTTYPE_L e1_l on e1.FID=e1_l.FID and e1_l.FLOCALEID=2052

inner join t_mdl_elementproperty t3 on t2.FElementPropertyId=t3.FID

inner join T_MDL_ELEMENTPROPERTY_L t3_l on t3.FID=t3_l.FID and t3_l.FLOCALEID=2052

inner JOIN T_MDL_DOMAINMODETYPE t4 on t1.FID=t4.FID

inner join T_MDL_DOMAINMODETYPE_L t5 on t4.FID=t5.FID and t5.FLOCALEID=2052

left join (select en1.fname,en2.fvalue,en2_l.fcaption from T_META_FORMENUM_L en1

inner join T_META_FORMENUMITEM en2 on en1.FID=en2.fid

inner join T_META_FORMENUMITEM_L en2_l on en2.fenumid=en2_l.fenumid and en2_l.flocaleid=2052

where en1.flocaleid=2052 and en1.fname like '领域模型属性值类型%') pe on t3.FVALUETYPE=pe.fvalue

where e1_l.FNAME like '整数%' and t5.FNAME='单据'

select * from T_MDL_FORMOPERATIONTYPE where FOPERATION like 'PUSH'----------------------------------------例如,修改单据体快粘贴默认值
update t_MDL_domainmodelElPropmap set FDEFAULTVALUE=1 where FDETAILID=7907

=============================分割线============================

=========查询模型和元素类型

select t5.FNAME 模型,e1.FID 元素ID,e1_l.FNAME 元素,e1.FTYPEID 元素类型ID,etype.fcaption 元素类型--, t2.FDEFAULTVALUE 默认值

from t_MDL_domainmodelelementmap t1

--inner join t_MDL_domainmodelElPropmap t2 on t1.FENTRYID=t2.FENTRYID

inner join t_MDL_elementtype e1 on t1.FELEMENTTYPEID=e1.FID

inner join T_MDL_ELEMENTTYPE_L e1_l on e1.FID=e1_l.FID and e1_l.FLOCALEID=2052

inner JOIN T_MDL_DOMAINMODETYPE t4 on t1.FID=t4.FID

inner join T_MDL_DOMAINMODETYPE_L t5 on t4.FID=t5.FID and t5.FLOCALEID=2052

left join (select en1.fname,en2.fvalue,en2_l.fcaption from T_META_FORMENUM_L en1

inner join T_META_FORMENUMITEM en2 on en1.FID=en2.fid

inner join T_META_FORMENUMITEM_L en2_l on en2.fenumid=en2_l.fenumid and en2_l.flocaleid=2052

where en1.flocaleid=2052

and en1.fname like '领域模型元素类型%'

) etype on e1.FTYPEID=etype.fvalue

where t5.FNAME='基础资料'

============================

1.1操作类型(BOS_FormOperationType)


SELECT e1_l.FNAME '元素类型',a.FNAME '操作名称',a.FID,b.T
FROM(
    SELECT t1.FID,t2.FNAME,CONVERT(XML,'<n>'+REPLACE(t1.FOPERELEIDS,',','</n><n>')+'</n>') AS xmlval
    from T_MDL_FORMOPERATIONTYPE t1
    inner join T_MDL_FORMOPERATIONTYPE_L t2 on t1.FID=t2.FID and t2.FLOCALEID=2052
) a
CROSS APPLY(
    SELECT k.n.value('.','nvarchar(80)') T
    FROM a.xmlval.nodes('n') k(n)
) b
inner join t_MDL_elementtype e1 on b.T=e1.FID
inner join T_MDL_ELEMENTTYPE_L e1_l on e1.FID=e1_l.FID and e1_l.FLOCALEID=2052
where a.FNAME in ( '批量修改','审核')

=========================例如:给单据增加批量修改功能======================

insert into T_MDL_FORMOPERATIONTYPE (FID, FOPERATION, FISCONFIRM, FRESOURCE, FENABLEDSTATE, FOPERELEIDS, FSERVICECLASS, FDESIGNERCLASS, FTOPCLASSIDS, FISSUPPORTWF, FSERVICEINVOKECLASS, FSERVICECLASSEXT, FWEBSERVICECLASS, FWEBDESIGNERCLASS, FAPPSCENARIOTYPE)
values (58, 'BulkEdit', 0, null, 'VIEW', '34', 'Kingdee.BOS.Business.Bill.Operation.BatchModify,Kingdee.BOS.Business.Bill', 'Kingdee.BOS.DomainModelDesigner.OperationDesigner.FormOperationDesigner', '-1', '0', ' ', null, null, null, 1);

insert into T_MDL_FORMOPERATIONTYPE_L (FPKID, FID, FLOCALEID, FNAME)
values (58, 58, 2052, '批量修改(单据)');

=============================分割线============================


2、计算公式函数:

取数函数管理:FormId:"BD_FormulaDefinition";
BOS中,默认过滤条件为:"FID= 1200 and FELEMENTGROUPID= 24 ";FID为领域模型ID,FELEMENTGROUPID为领域模型分组ID;

公式名称:取BD_FormulaDefinition的 ELEMENTTYPEID(基础资料:BD_FormulaSet) 的 APPEARANCECLASS属性,ElementClass为函数的实现类。

-------------------------------------------SQL查询------------------------------------------

SELECT t5.FNAME,t4.FID,t3.FNAME,t3.FDESCRIPTION,t2.FAPPEARANCECLASS FROM T_MDL_DOMAINMODELELEMENTMAP T1
INNER JOIN T_MDL_ELEMENTTYPE T2 ON T1.FELEMENTTYPEID=T2.FID
INNER JOIN T_MDL_ELEMENTTYPE_L T3 ON T2.FID=T3.FID and t3.FLOCALEID=2052
LEFT JOIN T_MDL_DOMAINMODETYPE t4 on t1.FID=t4.FID
left join T_MDL_DOMAINMODETYPE_L t5 on t4.FID=t5.FID and t5.FLOCALEID=2052


=============================分割线========================

3、动态构造类型

程序集 Kingdee.BOS.DataEntity,

引用Kingdee.BOS.Orm.Metadata.DataEntity

Kingdee.BOS.Orm.Metadata.DataEntity.DynamicObjectType

通过DynamicObjectType构建

示例如下:

图片.png

public sealed class DynamicICStockBill//库存表
    {
        public static readonly DynamicProperty FBrNoProperty;
        public static readonly DynamicProperty FInterIDProperty;
        public static readonly DynamicProperty FTranTypeProperty;
        public static readonly DynamicProperty DetailsProperty;
        public static readonly DynamicObjectType ICStockBillType;
        static DynamicICStockBill()
        {
            DynamicObjectType dt = new DynamicObjectType("ICStockBi11");
            FBrNoProperty = dt.RegisterSimpleProperty("FBrNo", typeof(System.String));
            FInterIDProperty = dt.RegisterSimpleProperty("FInterID", typeof(System.Int32), 0, false, new SimplePropertyAttribute(true));
            FTranTypeProperty = dt.RegisterSimpleProperty("FTranType", typeof(System.Int16));
            CollectionPropertyAttribute colAtt = new CollectionPropertyAttribute();
            colAtt.Alias = "ICStockBillEntry";
            DetailsProperty = dt.RegisterCollectionProperty("Details", DynamicICStockBi1lEntry.ICStockBillEntryType, null, colAtt);
            ICStockBillType = dt;
        }
        public sealed class DynamicICStockBi1lEntry //库 存明 细表
        {
            public static readonly DynamicProperty FBrNoProperty;
            public static readonly DynamicProperty FEntryIDProperty;
            public static readonly DynamicProperty FItemIDProperty;
            public static readonly DynamicProperty FQtyMustProperty;
            public static readonly DynamicObjectType ICStockBillEntryType;
            static DynamicICStockBi1lEntry()
            {
                DynamicObjectType dt = new DynamicObjectType("ICStockBillEntry");
                FBrNoProperty = dt.RegisterSimpleProperty("FBrNo", typeof(System.String));
                FEntryIDProperty = dt.RegisterSimpleProperty("FEntryID", typeof(System.Int32), 0, false, new SimplePropertyAttribute(true));
                FItemIDProperty = dt.RegisterSimpleProperty("FItemID", typeof(System.Int32));
                ICStockBillEntryType = dt;
            }
            IDataEntityType dataEntityType = DynamicICStockBi1lEntry.ICStockBillEntryType;
        }
    }


==================================================================

4、元数据插件

https://vip.kingdee.com/article/249854457134025472?productLineId=1

可以参考表[T_META_FORMMETASERVICEPLUGIN]的插件学习

客户端插件 Kingdee.BOS.ServiceFacade.KDServiceClient.dll,用于在客户端插件执行相关获取数据信息操作;

比较关系:SELECT A.FID, A.FCONDITIONTYPEID, A.FOPERATE, B.FNAME FROM T_MDL_FILTERCONDITION A INNER JOIN T_MDL_FILTERCONDITION_L B ON (A.FID = B.FID AND B.FLOCALEID = @FLOCALEID) ORDER BY A.FCONDITIONTYPEID ASC, A.FID ASC

------单据过滤条件实现类:Kingdee.BOS.DomainModelDesigner.PropertyDesc.ConditionTypePropertyDescriptor,
Kingdee.BOS.DomainModelDesigner

==================================================================

5、插件查询方法

a、客户端插件查询

using using Kingdee.BOS.ServiceFacade.KDServiceClient.BusinessData;

QueryBuilderParemeter queryBuilderParemeter = new QueryBuilderParemeter();

queryBuilderParemeter.FormId="ElementType";

queryBuilderParemeter.SelectItems.Add(new SelectorItemInfo("FDESCRIPTION"));

queryBuilderParemeter.FilterClauseWihtKey=string.Format("FName='{0}'", arg);

QueryServiceProxy queryServiceProxy = new QueryServiceProxy();

DynamicObjectCollection dynamicObjectCollection = queryServiceProxy.GetDynamicObjectCollection(queryBuilderParemeter, null);

b、服务端


OQLFilter oQLFilter = new OQLFilter();

oQLFilter.Add(new OQLFilterHeadEntityItem

{FilterString = key + "='" + number + "'"});


b1:              

using Kingdee.BOS.Contracts;

IViewService service = ServiceFactory.GetService<IViewService>(ctx);

DynamicObject[] array = service.Load(ctx, formId, null, oQLFilter);


b2: (实际同b1)

using Kingdee.BOS.ServiceHelper;

DynamicObject[] array =BusinessDataServiceHelper.Load(this.Context, "BOS_ExpressSample", queryBuilderParemeter.SelectItems, oQLFilters);


b3:  

using Kingdee.BOS.ServiceHelper;

QueryServiceHelper.GetDynamicObjectCollection(this.Context, queryBuilder);


=============================分割线======================
6、查询接口实现方法

IViewService service = ServiceFactory.GetService<IViewService>(this.Context);

通过ServiceFactory.GetService获取在Kingdee.BOS.Contracts.ServiceFactory.RegisterService()注册的接口服务

例如IViewService 接口的实现为:Kingdee.BOS.App.Core.ViewService,Kingdee.BOS.App.Core

Kingdee.BOS.App.Core.BusinessDataReader.Load()

----

object[] LoadPkValues(BusinessInfo businessInfo, OQLFilter oFilter)查出id;

 通过 

//Kingdee.BOS.App.Core.BusinessDataReader引用程序集

DynamicSqlBuilder dynamicSqlBuilder = new DynamicSqlBuilder(base.Context, businessInfo.GetQueryInfo(), filterCondition, orderByCondition, list);
    string strSQL = dynamicSqlBuilder.BuildSqlForQuery();组装SQL
    List<object> list2 = new List<object>();

using (IDataReader dataReader = DBUtils.ExecuteReader(base.Context, strSQL))
    {
        while (dataReader.Read())
        {
            list2.Add(dataReader.GetValue(0));
        }
        dataReader.Close();
    }

然后通过

//Kingdee.BOS.Orm.Drivers引用程序集

 DynamicObjectType dynamicObjectTypeUseSelector= this.GetDynamicObjectTypeUseSelector(businessInfo, selector);
        return this.Load(array, dynamicObjectTypeUseSelector, true);

//一下为this.Load的实现方法Kingdee.BOS.App.Core.BusinessDataReader

public DynamicObject[] Load(object[] pkArray, DynamicObjectType type, bool loadReferenceData = false)
{
    IDbDriver driver = new OLEDbDriver(base.Context);
    IDataManager dataManager = type.GetDataManager(driver, null);
    object[] oids = pkArray.Distinct<object>().ToArray<object>();
    DynamicObject[] array = dataManager.Read(oids, null).ToArray<DynamicObject>();
    if (loadReferenceData)
    {
        LoadReferenceObjectManager loadReferenceObjectManager = new CachedLoadReferenceObjectManager(base.Context, type, driver, false);
        loadReferenceObjectManager.Load(array);
    }
    return array;
}

组装成DynamicObject[];

7、保存数据包

var service = ServiceHelper.GetService<ISaveService>();

service.Save()

BusinessDataServiceHelper.Save();




图标赞 17
17人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!

您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!

请选择打赏金币数 *

10金币20金币30金币40金币50金币60金币
可用金币: 0