//构造一条付款单信息(构造值对象)
PaymentBillInfo payInfo = new PaymentBillInfo();
payInfo.setNumber(“1001”);
//关联用户
UserInfo userInfo = new UserInfo();
userInfo.setId(BOSUuid.read(\BOSUuid建立实体对象
userInfo.setName(“John”);
userInfo.setNumber(“2000”);
BigDecimal ex = new BigDecimal(\建立属性
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 属性
PaymentBillItemInfo itemInfo = new PaymentBillItemInfo();//建立分录
itemInfo.setLineNo(34);
itemInfo.setAmounts(ex2);
payInfo.getEntries().add(itemInfo);//添加分录
payInfo.getEntries().add(new ErrandTaskItemInfo());//添加分录 //通过
调用新增方法进行保存
IPaymentBill iPayBill = PaymentBillFactory.getRemoteInstance();//获取实体
IObjectPK pk = iPayBill.addnew(payInfo);//保存值对象,返回逻辑键,可以通过逻辑键获取值对象(如下)
4.2 单据修改代码
修改一条付款单信息
IPaymentBill iPayBill = PaymentBillFactory.getRemoteInstance();
String id=\
ObjectUuidPK pk = new ObjectUuidPK(BOSUuid.read(id));//建立逻辑键
PaymentBillInfo payInfo = iPayBill.getValue(pk);//获取值对象;
System.out.println(\获取属性
payInfo.setExchangeRate(ex);//修改属性属性
iPayBill.update(pk, payInfo);//更新数据
4.3 单据删除代码
iPayBill.remove(pk);//通过逻辑键删除单据内容获取集合
4.4 获取集合
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory.getRemoteInstance();//建立实体对象 EntityViewInfo evi = new EntityViewInfo();//建立视图信息
FilterInfo i = new FilterInfo();//建立过滤条件
i.getFilterItems().add(new FilterItemInfo(\
i.getFilterItems().add(new FilterItemInfo(\
i. setMaskString(\
evi.setFilter(i);//添加过滤条件
evi.getSelector().add(new SelectorItemInfo(\添加获取属性
evi.getSelector().add(new SelectorItemInfo(\
evi.getSelector().add(new SelectorItemInfo(\
evi.getSelector().add(new SelectorItemInfo(\
//三种获取集合方法
1. 获取所有数据:
CurrencyCollection co = c. getCurrencyCollection ();//获取集合
2. 获取满足上述条件的所有数据
CurrencyCollection co = c.getCurrencyCollection(evi);//获取集合
3. 获取满足oql所写的条件的所有数据
CurrencyCollection co = c. getCurrencyCollection (evi);//获取集合
4.5 获取值对象
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory.getRemoteInstance();//建立实体对象 String id=\
ObjectUuidPK pk = new ObjectUuidPK(BOSUuid.read(id));//建立逻辑键 c.getValue(pk); 或 : c.getCurrencyInfo(pk);
4.6 界面之间传递参数
1. 收集父界面要传递给子界面的参数集 HashMap map = new HashMap(); map.put(\必须。被启动UI的父UI对象
map.put(\ map.put(\ map.put(\ map.put(\ IUIFactory uiFactory = null; uiFactory = UIFactory
.createUIFactory(\以模态对话框方式启动
IUIWindow uiWindow = uiFactorycreate(\/* 被启动对象的类名称 */
map); uiWindow.show();
2. 在子界面获取传递下来的数据
private void loadContext() {
int mode = ((Integer)this.getUIContext().get(\
AccountTableInfo accountTableInfo = (AccountTableInfo) this.getUIContext().get(\CtrlUnitInfo cuInfo = (CtrlUnitInfo) this.getUIContext().get(\
AsstAccountInfo asstAccountInfo = (AsstAccountInfo) this.getUIContext().get(\
AuxAccountEditUI ui = (AuxAccountEditUI) this.getUIContext().get(\}
4.7 给Query传过滤条件
EntityViewInfo evi = new EntityViewInfo(); FilterInfo filterInfo = new FilterInfo(); //建立过滤条件 filterInfo.getFilterItems().add( new FilterItemInfo(\ CompareType.EQUALS)); filterInfo.getFilterItems().add( new FilterItemInfo(\ CompareType.EQUALS)); filterInfo.setMaskString(\ evi.setFilter(filterInfo); if (mainQuery == null) { mainQuery = new EntityViewInfo(); } mainQuery.setFilter(filterInfo); //添加过滤条件
this.execQuery();
4.8 接口方法的访问方式
3. 客户端访问
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory.getRemoteInstance();//建立实体对象 c. getCurrencyCollection(); 4. 服务端访问
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory. getLocalInstance (ctx);//建立实体对象 c. getCurrencyCollection();
4.9 传递上下文参数的接口访问方式
PurOrderInfo cur = new PurOrderInfo();
IPurOrder c = PurOrderFactory. getRemoteInstanceWithObjectContext(ctx);//建立实体对象
c. getPurOrderCollection();
另query也支持上下文参数:
IQueryExecutor exec = QueryExecutorFactory.getRemoteInstance(queryPK,ctx); …
4.10 控件的初始化
1.使用枚举给ComboBox控件赋值 public void setReceiveType() {
this.kDComboBox2.removeAllItems(); List list = new List();
Iterator it = ReceiveType.iterator(); while (it.hasNext()) {
list.add(ReceiveType.getEnum(it.toString()).toString()); }
}
2.使用值对象集合给ComboBox控件赋值 // 获取结算方式列表