NC二次开发常用的方法

//这张表存放的是所有单据模板的信息表 如果不知道单据模板的信息后可在数据库中查询
PUB_BILLTEMPLET
//这张表是打印模板的表改模板可以再此表修改
pub_print_template
//获取表头某个字段的值
getBillCardPanel().getHeadItem("kitarea").getValueObject()
//获取当前登录人信息
ClientEnvironment.getInstance().getUser().getUserName()
//获取当前登录人PK
String userpk = getBillUI()._getOperator();
//获取当前系统时间
String RefundTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 
//获取登入时间
  String date = ClientEnvironment.getInstance().getBusinessDate().toString();
//一样获取登入时间
UFDate date = getUi()._getDate();

//系统登录时间
String query_actiondate = sf.format(new Date(new Long(InvocationInfoProxy.getInstance().getDate())));

用时间随机生成数
new SimpleDateFormat("yyyyMMddHHmmssSSS") .format(new Date() );

//给表体某个字段设值
getBillCardPanelWrapper().getBillCardPanel().getBillModel("pm_cm_material").setValueAt(matervos[i].getInvclass(), i, "invclass");

获取参照字段里面的值
 UIRefPane capplydeptref = (UIRefPane) getBillCardPanel().getHeadItem("capplydeptid").getComponent();
    capplydeptref.getRefPK();
     capplydeptref.getRefName();
     capplydeptref.getRefCode();

//给参照字段赋值
 UIRefPane capplyref = (UIRefPane) getBillCardPanel().getHeadItem("capplydeptname").getComponent();
capplyref.setPK(pk_deptdoc);
capplyref.setName(deptname);

//获取一个VO对象从VO中取出值
SoChangenameNewVO[] customerVO = (SoChangenameNewVO[]) getBillCardPanelWrapper()
.getBillCardPanel().getBillModel("ps_so_changename_new").getBodyValueVOs(SoChangenameNewVO.class.getName());


getBillUI().showHintMessage("") 界面底部出现提示

String strControl = ParamReader.getParamter(_getCorp().getPrimaryKey().toString(), IParamCode.PS_zhgwth).toString();
获取按钮参数
 IParamCode.PS_zhgwth  在IParamCode.PS_zhgwth  中定义


//UFDouble 类型的取值和通过UFDouble 类型的判断

UFDouble Num  = new UFDouble(String.valueOf(returnVOs[i].getAttributeValue("nsbigmny")));
Double doubleNum=Num.toDouble();
if(doubleNum==0){
ProjectUtil pu = new ProjectUtil();
String house = returnVOs[i].getAttributeValue("pk_house").toString();
// String project = returnVOs[i].getAttributeValue("project").toString();
ArrayList<Object[]> list = pu.getNbroddaccountreceiv(house);
if(list.size()>0){
UFDouble a=new UFDouble(0);
for(int f=0;f<list.size();f++){
String b =String.valueOf(list.get(f)[0]);
if(!b.equals("null")){
a=a.add(new UFDouble(b));
}
}
//让某个字段达到是否可编辑效果
getBillCardWrapper().getBillCardPanel().getBillModel("zh_dggcc_sckz_b1").setCellEditable(row, colName, false);     

//日期时间相加
String RefundTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 
Calendar ca = Calendar.getInstance();
int year = Integer.parseInt(RefundTime.substring(0,4));
ca.set(Calendar.YEAR,year);
int month = Integer.parseInt(RefundTime.substring(5,7));
ca.set(Calendar.MONTH, month-1);
int day = Integer.parseInt(RefundTime.substring(8,10));
ca.set(Calendar.DAY_OF_MONTH, day+91);

SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(sp.format(ca.getTime()));

//在界面弹出一个提示框
在ClientEventHandler中
 MessageDialog.showOkCancelDlg(getBillUI(),"提示","错误提示");
在ClientUI中
MessageDialog.showOkCancelDlg(this,"提示","错误提示");

//清空表体参照数据出来的当前行
 getBillCardPanel().getBillModel("hfgf_jhsdiscount").clearRowData(e.getRow(), new String[]{"vdbcode", "vdbname", "pk_currtype", "currtype", "ncurrrate", "fdbaccountmode", "fdiscountmode", "ndiscountrate", "bisrefmodify", "dbegindate", "dfinishdate"});

//在UI类中调用EventHandler类
((MyEventHandler)getManageEventHandler()).onBoLineDel();
//用SQL获取时间
select GETDATE() as '当前日期',
DateName(year,GetDate()) as '年',
DateName(month,GetDate()) as '月',
DateName(day,GetDate()) as '日',
DateName(dw,GetDate()) as '星期',
DateName(week,GetDate()) as '周数',
DateName(hour,GetDate()) as '时',
DateName(minute,GetDate()) as '分',
DateName(second,GetDate()) as '秒'

//查询数据库以VO的形式返回---在报表中使用放入表体中比较好
ArrayList<SuperVO> listSuperVO = (ArrayList<SuperVO>) query.executeQuery(sql, new BeanListProcessor(Class.forName(CrmDdHouseRptVo.class.getName())));

//编辑保存警告

this.billForm.getBillCardPanel().getBillModel().cellShowWarning(i, "goodsno");

1.//模拟触发刷新按钮   相当于在界面上点击刷新按钮
//new一个按钮
nc.ui.pubapp.uif2app.actions.RefreshSingleAction refreshaction=new RefreshSingleAction();
//传数据给这个按钮
refreshaction.setModel(this.getModel());
//新增一个事件。。。模拟这个按钮事件
ActionEvent e1=new ActionEvent(refreshaction, 1001, "刷新");
//执行这个按钮的doAction方法,把这个模拟事件传进去
refreshaction.doAction(e1);
// 其他按钮也应该类似

猜你喜欢

转载自www.cnblogs.com/wanglichaoya/p/8967092.html