0
点赞
收藏
分享

微信扫一扫

金蝶BOS软件***ControllerBean.java中,类,属性,工厂类如何查找

迪莉娅1979 2022-04-14 阅读 57
eclipse

业务场景:将Json字符串数据,存储到金蝶BOS中对应的表中

收款单据接口为例

先启动项目

登录客户端

 

找到对应的单据

 名称加上Info就是这个表对应的实体类

 

说明:

ReceivingBill后面加Info=实体对象

ReceivingBillFactory.getLocalInstance(ctx).save(info);//保存单据

ReceivingBill后面加Factory=工厂类

根据接口文档查找对应属性

 这里paymentType就是ReceivingBill收款单实体的属性(支付方式)

根据传递的参数(json字符串),查询出来这个对象,再调用set方法将对象保存

		EntityViewInfo PaymentType = new EntityViewInfo("where number='"+jsonData.getString("settlementType")+"'");
		PaymentTypeCollection paymentTypeCollection = PaymentTypeFactory.getLocalInstance(ctx).getPaymentTypeCollection(PaymentType);
		if(paymentTypeCollection.size()!=0){
			info.setPaymentType(paymentTypeCollection.get(0));//付款方式
		}

 说明:

根据支付方式编码查询出支付方式对象,将支付方式对象保存到单据对象

PaymentTypeFactory.getLocalInstance(ctx).getPaymentTypeCollection(PaymentType); 

根据工厂类获取上下文,调用查询方法获取“支付方式”这个对象

EntityViewInfo:查询的对象,查询sql拼接封装到这个对象中

常用方法:

ReceivingBillInfo info = new ReceivingBillInfo();//创建单据
ReceivingBillEntryCollection entries = info.getEntries();//从单据获取分录集合
ReceivingBillEntryInfo entryInfo = new ReceivingBillEntryInfo();//创建分录对象  Entry表示分录
entries.add(entryInfo);//保存分录  
ReceivingBillFactory.getLocalInstance(ctx).save(info);//保存单据
JSONObject.parseObject(data);//JSON字符串转JSON对象
jsonData.getString("project");//从JSON对象中获取一个值
jsonData.getJSONArray("entry");//从JSON对象中获取分录
举报

相关推荐

0 条评论