3、金蝶 EAS/BOS 项目示例代码

1、付款成功后,设置付款时间-zhou (dep加的字段)

  Date paydate = new Date();
  _info.setString("paydatewf", paydate.toString());

2、SQL语句工具类

String updateSql = " SELECT fid FROM T_BTT_ReceiptsInvoice  where FINVOICENUMBER = '"+invoiceNM.trim()+"' ";
IRowSet rowSet = DbUtil.executeQuery(ctx,updateSql);
if(rowSet.size()>0){
    while(rowSet.next()){
                String id = rowSet.getString("fid");
                if(id == null || id.trim().length() <= 0){
                    return invoiceNM + ",2," + "更新失败--进项发票单据id为空!";
                }
    }       
}

3、字符串id获取IObjectPK

IObjectPK pk = new ObjectUuidPK(id);//获取id
//在ControllerBean 中使用-LocalInstance 
receInfo = ReceiptsInvoiceFactory.getLocalInstance(ctx).getReceiptsInvoiceInfo(pk);//获取值对象

4. xxxInfo //保存此笔单据信息

SelectorItemCollection item = new SelectorItemCollection();
item.add("billingDate");
item.add("taxType");
item.add("taxMethod");
BizAccountBillEntryFactory.getLocalInstance(ctx).updatePartial(entryInfo, item);
//保存部分信息
BizAccBillEntryFactory.getLocalInstance(ctx).update(new ObjectUuidPK(bizAccBillEntryInfo.getId()), bizAccBillEntryInfo);
ReceiptsInvoiceFactory.getLocalInstance(ctx).save(receInfo);//保存此笔单据信息

5. BigDecimal //格式化

System.out.print("+++++++++++++++++++++++++++++++++++++++++");
BigDecimal am = new BigDecimal(entryInfo.getAmountOri().toString());
DecimalFormat df = new DecimalFormat("#.00");//保留两位小数
String amNew = df.format(am);
System.out.print(amNew);                        
System.out.print("+++++++++++++++++++++++++++++++++++++++++");

6. 获取值对象xxxInfo

  1. 在自己的远程控制类内部时:如(PaymentBillControlBeanEx.java)
    PaymentBillInfo jInfo = (PaymentBillInfo) getValue(ctx, pk);//Context ctx, IObjectPK pk
  2. 在其他远程控制类内部时:如(UserInfo)
    UserInfo userInfo = UserFactory.getLocalInstance(ctx).getUserInfoByNumber("user");

7. 获业务对象的数据集合

示例如下:

 CompanyOrgUnitCollection couCols = (CompanyOrgUnitCollection) CompanyOrgUnitFactory.getLocalInstance(ctx).getCompanyOrgUnitCollection(" select * where name = '"+cffr+"'");

8. 添加进度条

LongTimeDialog dialog = UITools.getDialog(this);
dialog.setLongTimeTask(new ILongTimeTask() {
public Object exec() throws Exception {
Thread.sleep(500); //5秒
LogisticDeliveryBillFactory.getRemoteInstance().setHistoryData();
return null;
        }
        public void afterExec(Object result) throws Exception {}
    });
    dialog.show();
    MsgBox.showInfo("处理完毕!");

8. EditUI中重载数据

refreshCurPage();
MsgBox.showInfo("单据审核状态不能修改!");
SysUtil.abort();

9. 给二次开发字段设值

BillEntryInfo.setString("localNotTaxAmt", mulAmount.toString());//不含税金额本位币 

10. 通过管理员配置文件动态修改接口地址ip

  1、#通过administrator账号登录,在系统平台-系统工具-系统配置-参数设置,按F12进行设置;
protected void _personStateSync(Context ctx) throws BOSException { 
    String url = null;
    try {
        ParamInfo paraminfo = ParamManager.getParamByNumber(ctx, "aisino");
        url = paraminfo.getDefaultValue();
    } catch (EASBizException e1) {//e1.printStackTrace();
        throw new BOSException("职员同步接口地址错误或不存在,请使用管理员进行参数配置!");
    }
    System.out.println(url);
    IZzsFpServiceProxy service = new IZzsFpServiceProxy(url);       
    try {
     String interfaceXML = interfaceXML(personStateChange(ctx));
     System.out.println(interfaceXML);
     String result = service.aisinoZZSFPZHGLPTWS(interfaceXML);
     System.out.println("------------------------------");
     System.out.println("结果为:" + result);
     System.out.println("-------------------------------");
    } catch (Exception e) {         
        e.printStackTrace();
    }       
}

11. 添加Button按钮

// TODO 添加“送行”按钮
    KDWorkButton btnSendBank = new KDWorkButton("送行");  
    btnSendBank.setIcon(EASResource.getIcon("imgTbtn_send"));
    this.toolBar.add(btnSendBank);
    btnSendBank.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e) {
            try {
                btnSendBank_actionPerformed(e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }           
        }       
    });

**12. **


未完待续

推荐阅读更多精彩内容