现在的位置: 首页 > 综合 > 正文

NC57 ClientUI类方法大全《不断更新中》

2014年04月27日 ⁄ 综合 ⁄ 共 5779字 ⁄ 字号 评论关闭

UI类中的方法--BillManageUI:
1.设置ctrl类:
@Override
protected AbstractManageController createController() {
return new RFOperatorCustoMapCtrl();
}

2.设置界面默认数据 :
@Override
public void setDefaultData() throws Exception {
getBillCardPanel().setHeadItem("pk_operator", _getOperator());
getBillCardPanel().setHeadItem("dbilldate", _getDate());
}

3.设置Handler类
protected ManageEventHandler createEventHandler() {
return new RFOperatorCustoMapHandler(this, getUIControl());
}

4.编辑后事件
/***
* 编辑后事件
*/
@Override
public void afterEdit(BillEditEvent e) {
if (e.getPos() == 0) {// 表头编辑后事件
if (e.getKey().equals("rfoperator")) {//发生编辑事件的字段名字
Integer rfoperator = new Integer(e.getValue().toString());//发生编辑事件的值
if (rfoperator <= 0) {
MessageDialog.showErrorDlg(this, "错误", "您不能输入负数和零");//弹出错误对话框
this.getBillCardPanel().getHeadItem("rfoperator").setValue(null);//对应字段置空
return;//返回
}
}
} else if (e.getPos() == 1) {

}
}

5.检查打开节点的前提条件:
protected String checkPrerequisite(){
String pk_corp = "";
try {
ChannelVO[] cvos = (ChannelVO[])HYPubBO_Client.queryByCondition(ChannelVO.class,"dr=0 and ileveltype=2 and iproducttype='3' ");
if (cvos == null || cvos.length == 0)
return "查询不到省店渠道";
pk_corp = cvos[0].getPk_correscorp();
} catch (UifException e) {
nc.bs.logging.Logger.error(e);
e.printStackTrace();
}
if (!pk_corp.equalsIgnoreCase(_getCorp().getPrimaryKey())) {
return "本节点只允许在省店操作";
}
        return null;
    }
   
6.获得用户对象
@Override
public Object getUserObject() {
return new nc.vo.hn.hnh550.RfBackCHK();//返回public包中的类
}

7.代码中执行公式:
ctx.getBillCardPanel().execHeadFormula("pk_calbody->getColValue(bd_stordoc,pk_calbody,pk_stordoc,cwarehouseid)");

8.自动执行公式
在initSelfData(){}方法中加入:
getBillCardPanel().setAutoExecHeadEditFormula(true);

9.设置单据暂存态
在setDefaultData(){}方法中加入:
getBillCardPanel().getHeadItem(getBillField().getField_BillStatus()).setValue(BillStatus.TEMP_SAVE);

10.执行表尾公式:
getBillCardPanel().execHeadTailEditFormulas(getBillCardPanel().getHeadItem("pk_channel"));

11.打开节点权限
protected String checkPrerequisite() {
if ("0001".equalsIgnoreCase(_getCorp().getPrimaryKey())) {
return "集团不能操作本节点";
}
if (userInfo == null) {
return "当前用户没有关联业务员和渠道档案,请先关联再操作";
}
if (!userInfo.substring(1).equals(_getCorp().getPrimaryKey()))
return "用户没有操作当前公司节点权限";

return null;
}

12.表体行编辑事件:
public void bodyRowChange(BillEditEvent e) {
String tablecode = getBillCardPanel().getBodyPanel().getTableCode();
if (tablecode.equals("hn_bkarrival_b")) {
getBillCardPanel().setTabEnabled(1, "hn_bkarrival_o", true);
getBillCardPanel().setTabEnabled(1, "hn_bkarrival_d", true);
bkbrow = e.getRow();
}
super.bodyRowChange(e);
}
13.错误警告圣诞框:
if (hidsBidsToSub == null) {
MessageDialog.showErrorDlg(this, "错误", "您输入的数量没有意义");
return;
}

14.记录日志:
catch (BusinessException e1) {
nc.bs.logging.Logger.error(e1);
e1.printStackTrace();
}

15.保存和提交是否一起完成。 如果一起完成返回true
@Override
public boolean isSaveAndCommitTogether() {
return true;
}

16.设置表体复杂数据。 需要进行界面转换的数据,如自定义参照的数据
@Override
public void setBodySpecialData(CircularlyAccessibleValueObject[] vos) throws Exception {
}

17.设置指定行表头复杂数据。 需要进行界面转换的数据,如自定义参照的数据 
@Override
protected void setHeadSpecialData(CircularlyAccessibleValueObject vo, int intRow) throws Exception {
}

18.设置整个表头复杂数据。 需要进行界面转换的数据,如自定义参照的数据 
@Override
protected void setTotalHeadSpecialData(CircularlyAccessibleValueObject[] vos) throws Exception {
}

19.检查打开该节点的前提条件。用于处理“只有满足某一条件时,才能打开该节点” 的情况。 需要判断“只有满足某一条件时,才能打开该节点”的节点,需要实现本方法。 在方法内进行条件判断。 基类根据返回值进行相应处理,如果返回值为一个非空字符串,那么基类不打开 该节点,只在一个对话框中显示返回的字符串;如果返回值为null,那么基类象对待 其他节点一样打开该节点。 
@Override
protected String checkPrerequisite() {
if (userInfo == null) {
return "当前用户没有关联业务员和渠道档案,请先关联再操作";
}
if (!userInfo.substring(1).equals(_getCorp().getPrimaryKey()))
return "用户没有操作当前公司节点权限";
// else if (userInfo.charAt(0) == '0')
// return "该节点不允许省店用户操作";
return null;
}

20.实例化前台界面的业务委托类 如果进行事件处理需要重载该方法 
@Override
protected BusinessDelegator createBusinessDelegator() {
return new MyDelegator();
}

21.单据合计监听.  (内部类)  在 initSelfData()方法中 
@Override
protected void initSelfData() {
getBillCardPanel().getBillModel().addTotalListener(new TotalListener());

}
public class TotalListener implements BillTotalListener {

public UFDouble calcurateTotal(String key) {
UFDouble total = new UFDouble(0.00); // 初始化合计值
UFDouble temp = null; // 临时存放每一列的值
String billtype = getBillCardPanel().getBillType();// 获取当前单据的数据类型
String tablecode = getBillCardPanel().getCurrentBodyTableCode();
if (billtype.equalsIgnoreCase("TN1K")) {
HashSet<String> pk_invmandocset = new HashSet<String>();
for (int i = 0; i < getBillCardPanel().getBillModel(tablecode).getRowCount(); i++) {
if (key.equals("ncount")) {
temp = (UFDouble) getBillCardPanel().getBillModel(tablecode).getValueAt(i, key);
total = total.add(temp == null ? new UFDouble(0.00) : temp);
}
if (key.equals("money")) {
temp = (UFDouble) getBillCardPanel().getBillModel(tablecode).getValueAt(i, key);
total = total.add(temp == null ? new UFDouble(0.00) : temp);
}
if ((String) getBillCardPanel().getBillModel(tablecode).getValueAt(i, "pk_invbasdoc") != null) {
pk_invmandocset.add((String) getBillCardPanel().getBillModel(tablecode).getValueAt(i, "pk_invbasdoc"));
}
}
if (key.equalsIgnoreCase("ncount")) {
getBillCardPanel().getHeadItem("npackcsnum").setValue(total);
// String sqlupdate ="update HN_PACKINGBILL set npackcsnum='"+total+"' where ";
}
if (key.equalsIgnoreCase("money")) {
getBillCardPanel().getHeadItem("npackingmoney").setValue(total);
}
getBillCardPanel().setHeadItem("npackkindsnum", pk_invmandocset.size());

}
return total;
}
}

22.设置按钮 状态:
private void afterinit() {
getBillCardWrapper().initHeadComboBox(getBillField().getField_BillStatus(), BillStatus.strStateRemark, true);
getBillListWrapper().initHeadComboBox(getBillField().getField_BillStatus(), BillStatus.strStateRemark, true);
if (getButtonManager().getButton(IBillButton.Edit) != null) {
((ButtonVO) getButtonManager().getButton(IBillButton.Edit).getData()).setBusinessStatus(new int[] { 8, 3, 0, 10 });
}
if (getButtonManager().getButton(IBillButton.Delete) != null) {
((ButtonVO) getButtonManager().getButton(IBillButton.Delete).getData()).setBusinessStatus(new int[] { 8, 3, 10 });
}
if (getButtonManager().getButton(IBillButton.Print) != null) {
((ButtonVO) getButtonManager().getButton(IBillButton.Print).getData()).setBusinessStatus(new int[] { 8, 3, 1, 2 });
}
}

抱歉!评论已关闭.