四、EAS代码代码示例
4.EAS代码代码示例
4.1单据新增代码
//如:新增一行付款单
//构造一条付款单信息(构造值对象)
PaymentBillInfo payInfo = new PaymentBillInfo();
payInfo.setNumber("1001"):
//关联用户
UserInfo userInfo = new UserInfo();
userInfo.setId(BOSUuid.read("867d5df6-00f8-1000-e000-0009c0a81089sysu"))://BOSUuid建立实体对象
userInfo.setName("John");
userInfo.setNumber("2000");
BigDecimal ex=new BigDecimal("343434.445")://建立属性
BigDecimal ex2 new BigDecimal(12345678901234567.8)//错误
payInfo.setExchangeRate(ex);
payInfo.setCreator(userInfo);
payInfo.setAuditDate(new Date(System.currentTimeMillis());//时间属性
Timestamp createdate = new Timestamp(System.currentTimeMillis());
payInfo.setCreateDate(createdate);
payInfo.setBizState(BillBizState.create)://枚据属性
payInfo.setSave(true);//Boolean属性
PaymentBillltemInfo itemInfo=new PaymentBillItemInfo():/建立分录
itemInfo.setLineNo(34);
itemInfo.setAmounts(ex2);
payInfo..getEntries().add(itemInfo);//添加分录
payInfo.getEntries().add(new ErrandTaskItemInfo());//添加分录
//调用新增方法进行保存
IPaymentBill iPayBill=PaymentBillFactory.getRemoteInstance();//获取实体
lObjectPK pk=iPayBill.addnew(payInfo)://保存值对象,返回逻辑键,可以通过逻辑键获取值对象
4.2单据修改代码
//修改一条付款单信息
IPaymentBill iPayBill = PaymentBillFactory.getRemoteInstance();
String id="8b35b903-00f8-1000-c000-0008c0a81089crrt",
ObjectUuidPK pk=new ObjectUuidPK(BOSUuid.read(id)://建立逻辑键
PaymentBilllnfo payInfo=iPayBill.getValue(pk)://获取值对象:
System.out.println("this:"+payInfo.getExchangeRate())://获取属性
payInfo.setExchangeRate(ex)//修改属性属性
iPayBill.update(pk,payInfo);//更新数据
4.3单据删除代码
ObjectUuidPK pk=new ObjectUuidPK(BOSUuid.read(id)://建立逻辑键
iPayBill.remove(pk)://通过逻辑键别除单据内容获取集合
4.4获取集合
CurrencyInfo cur=new CurrencyInfo();
ICurrency c=CurrencyFactory.getRemoteInstance();//建立实体对象
EntityViewInfo evi=new EntityViewInfo()://建立视图信息
FilterInfo filter=new FilterInfoo();//建立过滤条件
filter.getFilterItems().add(new FilterltemInfo("number","ddff",CompareType.EQUELS));
filter.getFilterltems().add(new FilterltemInfo("id","ddff",CompareType.EQUELS));
filter.setMaskString("(#0 and #1)");
cvi.setFilter(filter);//添加过滤条件
evi.getSelector().add(new SelectorltemInfo"id")//添加获取属性
evi.getSelector().add(new SelectorItemInfo(""));
evi.getSelector().add(new SelectorltemInfo("company.id"));
evi.getSelector().add(new SelectorltemInfo("company.name"));
三种获取集合方法
//1.获取所有数据:
CurrencyCollection co = c.getCurrencyCollection();//获取集合
//2.获取满足上述条件的所有数据
CurrencyCollection co=c.getCurrencyCollection(cvi);//获取集合
//3.获取满足oql所写的条件的所有数据
CurrencyCollection co=c.getCurrencyCollection(oql);//获取集合
4.5 获取值对象
CurrencyInfo cur=new CurrencyInfo();
ICurrency c=CurrencyFactory.getRemoteInstance();//建立实体对象
String id="8b35b903-00f8-l000-e000-0008c0a81089errt",
ObjectUuidPK pk=new ObjectUuidPK(BOSUuid..read(id)://建立逻辑键
c.getValue(pk);或:c.getCurrencyInfo(pk)
4.6 界面之间传递参数
4.6.1 .收集父界面要传递给子界面的参数集
HashMap map = new HashMap();
map.put("Owner'”,this)/必须。被启动UI的父UI对象
map.put("EASMode",new Integer(this.EASMode));
map.put("table",this.accountTablePrompBox.getData());
map.put("cu",currentCtrlUnit);
map.put("auxAccount",this.asstAccountPromptBox.getData());
UIFactory uiFactory = null;
//以模态对话框方式启动
uiFactory = UIFactory.createUIFactory("com.kingdee.eas.base.uiframe.client.UIModelDialogFactory");
//体被启动对象的类名称
IUIWindow uiWindow=uiFactorycreate("com.kingdee.cas.basedata.master..auxacct..client.AccountSelectUI",map);
uiWindow.show();
4.6.2.在子界面获取传递下来的数据
private void loadContext(){
int mode = ((Integer)this.getUIContext().get("EASMode")).intValue();
AccountTablelnfo accountTablelnfo =(AccountTablelnfo)this.getUIContexto.get("table");
CtrlUnitInfo culnfo=(CtrlUnitInfo)this.getUIContext().get("cu");
AsstAccountInfo asstAccountInfo =(AsstAccountInfo)this.getUIContext().get("auxAccount");
AuxAccountEditUI ui =(AuxAccountEditUl)this.getUIContext().get("Owner");
}
4.7 使用xxxFactory.getlocalInstance(ctx).getXXXinfo("")只获取部分字段属性
有多种方式,第一种如下,重在方便
AccountViewInfo avInfo = AccountViewFactory.getLocalInstance(ctx).getAccountViewInfo("select id,companyid where id='" + info.getPayeeAccount().getId().toString() + "'");
第二种如下,可以查询多个,包括查集合getcollection也可以使用,这里的oppAccount虽然只去了number,但实际默认也会取出id来
SelectorItemCollection selector = new SelectorItemCollection();
selector.add("*");
selector.add("oppAccount.number");
PaymentBillInfo info = PaymentBillFactory.getRemoteInstance().getPaymentBillInfo(new ObjectUuidPK(billId),selector);
ReceivingBillInfo billInfo = new ReceivingBillInfo();
String customerId = (String)info.get("payeeId");
CustomerInfo customerInfo = CustomerFactory.getRemoteInstance().getCustomerInfo("where id='"+customerId+"'");
CompanyOrgUnitInfo companyOrgUnitInfo= CompanyOrgUnitFactory.getRemoteInstance().getCompanyOrgUnitInfo("where number='"+customerInfo.getNumber()+"'");
billInfo.setCompany(companyOrgUnitInfo); //公司
billInfo.setCurrency(info.getCurrency()); //币别
Date bizDate = new Date();
billInfo.setBizDate(bizDate); //业务日期
ReceivingBillTypeInfo recBillType = ReceivingBillTypeFactory.getRemoteInstance().getReceivingBillTypeInfo("where number='999'");
billInfo.setRecBillType(recBillType); //收款类型
billInfo.setActRecAmt(info.getActPayAmt()); //收款金额
billInfo.setExchangeRate(info.getExchangeRate()); //汇率
billInfo.setActRecLocAmt(info.getActPayLocAmt()); //收款金额折本位币
billInfo.setBgCtrlAmt(info.getActPayAmt()); //预算控制金额
AccountBankCollection bankAccountCollection = AccountBankFactory.getRemoteInstance().getAccountBankCollection("where bankAccountNumber ='"+info.getPayeeAccountBank()+"'");
if (!EmptyUtil.isEmpty(bankAccountCollection)) {
AccountBankInfo accountBankInfo = bankAccountCollection.get(0);
billInfo.setPayeeAccountBank(accountBankInfo); //收款账号
billInfo.setPayeeBank(accountBankInfo.getBank());//收款银行
}
AccountViewInfo oppAccount = info.getOppAccount();
linux下的docker操作命令及异常