【插件开发】获取WebApi保存Json数据原创
4人赞赏了该文章
2,332次浏览
编辑于2020年09月29日 15:28:49
private string GetNewSaveJson() { // SaveDesigner为保存操作的设计组件,其他操作请查询T_MDL_FormOperationType 表格 var designerClass = "Kingdee.BOS.Business.Bill.OperationService.SaveDesigner,Kingdee.BOS.Business.Bill"; var designType = TypesContainer.GetOrRegister(designerClass); var designer = Activator.CreateInstance(designType) as OperationWebServiceDesigner; designer.OperationId = "Save"; designer.IsWebApi = true; var meta = FormMetaDataCache.GetCachedFormMetaData(Context, "BD_MATERIAL"); var model = designer.CreateServiceModel(Context, meta, null) as FormServiceModel; // WebApiParamHelper 为内部封装WebApi帮助类,没有对外发布,需要用发射调用获取JSON var webApiHelperClass = "Kingdee.BOS.Business.PlugIn.DynamicService.WebApiParamHelper,Kingdee.BOS.Business.PlugIn"; var webApiHelperType = TypesContainer.GetOrRegister(webApiHelperClass); var webApiHelper = Activator.CreateInstance(webApiHelperType); var getJsonData = webApiHelperType.GetMethod("GetJSONData", new Type[] {typeof(DTOType), typeof(bool)}); var jsonStr = getJsonData?.Invoke(webApiHelper, new object[] {model?.RequestDTOType, true}) .GetString(); return jsonStr; }
赞 4
4人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读