获取单据的分录下拉列表的标题和值原创
金蝶云社区-张璋张
张璋张
0人赞赏了该文章 149次浏览 未经作者许可,禁止转载编辑于2024年07月12日 08:58:12
public static Map<String, Object> getDownList(String fromMark(单据标识), String entry(单据体标识),String fieldMark(下拉列表字段标识)) {
        DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject(fromMark);
//单据所有标识
        DataEntityPropertyCollection properties = dynamicObject.getDataEntityType().getProperties();
        HashMap<String, Object> mapSetResult = new HashMap<>();
        for (IDataEntityProperty property : properties) {
            if (property instanceof EntryProp){
                String entryName = property.getName();
                if (entry.equals(entryName) ){
                    DataEntityPropertyCollection entryProperties = ((EntryProp) property).getDynamicCollectionItemPropertyType().getProperties();
                    for (IDataEntityProperty entryProperty : entryProperties) {
                        String fileName = entryProperty.getName();
                        if(fileName.equals(fieldMark)){
                            ComboProp iDataEntityProperty = (ComboProp) entryProperty;
                            for (ValueMapItem comboItem : iDataEntityProperty.getComboItems()) {
                                String key = comboItem.getValue();
                                String value = String.valueOf(comboItem.getName());
                                if (!StringUtils.isEmpty(value)) {
                                    mapSetResult.put(key, value);
                                }
                            }
                        }
                    }
                }
            }
        }


赞 0