eas表单分录带出自定义核算项目

问题背景

例如手头有个功能,需要维护一波自定义核算项目,然后再单据的分录中带出这个自定义核算项目。

解决方案

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

接下来就是代码show time了

	protected void storeFieldsBefore() throws Exception {
		 super.storeFieldsBefore();
		 //表格工具,辅助输出row的所有cell字段,你才知道怎么去row.getCell("xxxx")
		 TableUtils.listTableKeys(kdtEntry);
		 //遍历所有行row
		 for(int i=0;i<this.kdtEntry.getRowCount();i++)
		{
			IRow row=kdtEntry.getRow(i);
			//获取并转化对应的列cell
			MaterialInfo matInfo=(MaterialInfo)row.getCell("materialNumber").getValue();
			if(matInfo!=null){
				FilterInfo filter = new FilterInfo();
				filter.getFilterItems().add(new FilterItemInfo("material.id", matInfo.getId().toString(), CompareType.EQUALS));
				SelectorItemCollection sic = super.getSelectors();
				sic.remove(new SelectorItemInfo("id"));
				sic.add(new SelectorItemInfo("helpSpecifications.id"));
				sic.add(new SelectorItemInfo("helpSpecifications.name"));
				sic.add(new SelectorItemInfo("helpSpecifications.number"));
				EntityViewInfo view = new EntityViewInfo();
				view.setFilter(filter);
				view.setSelector(sic);
				//查询物料的采购信息tab下面的详情
				MaterialPurchasingCollection mpList=MaterialPurchasingFactory.getRemoteInstance().getMaterialPurchasingCollection(view);
				if(mpList.size()>0){
					MaterialPurchasingInfo mpInfo=mpList.get(0);
					//找到对应的值,直接赋值给F7/自定义核算项目,前提是dep加了这个字段并且设置为"自定义核算项目"
					row.getCell("helpSpecifications").setValue(mpInfo.get("helpSpecifications"));
				}
			}
		}
	}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值