NC65功能跳转并初始化赋值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NC65功能跳转并初始化赋值相关的知识,希望对你有一定的参考价值。

参考技术A 从a功能跳转到b功能,并且把a功能的部分数据带到b功能初始化界面,包括常规txt文本内容,和参照内容,以及下来框内容的初始化。

1.a功能跳转到b功能并传值(inspectReportVO ),如下图:

public void doAction(ActionEvent e) throws Exception

if (getModel().getSelectedData() != null)

//获取当前表单数据

AggEarmPerpReportVO inspectReportVO = (AggEarmPerpReportVO) getModel().getSelectedData();

//跳转到付款结算录入功能

FuncRegisterVO funcRegisterVO = WorkbenchEnvironment.getInstance().getFuncRegisterVO("36070PBR");

FuncNodeLauncher.openFuncNode(funcRegisterVO.getFuncode(), String.valueOf(5), new AggEarmPerpReportVO[]inspectReportVO);

   



2.给b功能增加配置文件,并且修改初始化监听配置

增加配置文件

3.监听类实现,其中包括参照设值,下拉框设值,文本框设值赋初值

package nc.ui.cmp.bill;

import java.util.HashMap;

import java.util.Map;

import java.util.Vector;

import javax.swing.event.ChangeEvent;

import javax.swing.table.TableColumnModel;

import nc.bs.dao.DAOException;

import nc.bs.framework.common.NCLocator;

import nc.funcnode.ui.FuncletInitData;

import nc.ui.cmp.bill.actions.CmpBillBodyAddLineAction;

import nc.ui.cmp.pub.itf.IPaymentStatementService;

import nc.ui.pub.beans.MessageDialog;

import nc.ui.pub.beans.UIComboBox;

import nc.ui.pub.beans.UIRefPane;

import nc.ui.pub.bill.BillCellEditor;

import nc.ui.pub.bill.BillItem;

import nc.ui.pub.bill.BillScrollPane.BillTable;

import nc.ui.uif2.UIState;

import nc.ui.uif2.model.AbstractAppModel;

import nc.vo.hrwa.earmperpreport.AggEarmPerpReportVO;

import nc.vo.hrwa.earmperpreport.EarmPerpReportBVO;

public class AggEarmPerpReportInitListener extends CmpPayRelationQueryDataListener

private AbstractAppModel model;

private CmpBillBodyAddLineAction addLineAction;

@Override

public void initData(FuncletInitData data)

if (data != null && data.getInitData() instanceof AggEarmPerpReportVO[])

super.initData(null);

// 如果一个节点已经打开并且正在编辑数据, 默认不再打开其他的数据

if (UIState.EDIT.equals(this.getModel().getUiState()) || UIState.ADD.equals(this.getModel().getUiState()))

MessageDialog.showErrorDlg(getModel().getContext().getEntranceUI(),"错误","有未保存的数据,请先保存或取消!");

return;



this.getModel().setUiState(UIState.ADD);

handleChange(data);

else

super.initData(data);





private void handleChange(FuncletInitData data)

if (data.getInitData() instanceof AggEarmPerpReportVO[])

AggEarmPerpReportVO[] aggEarmPerpReportVO = (AggEarmPerpReportVO[])data.getInitData();

//模拟触发组织改变后事件

orgChangeEvent(aggEarmPerpReportVO[0]);

//处理表头字段

headSetValue();

EarmPerpReportBVO[] bvos = (EarmPerpReportBVO[])aggEarmPerpReportVO[0].getChildrenVO();

//模拟触发卡片编码改变后事件

cardCodeChangeEvent(bvos, aggEarmPerpReportVO[0].getParentVO().getPk_org());





private void headSetValue()

BillItem[] billItem = getBillFormEditor().getBillCardPanel().getHeadShowItems();

for(BillItem i : billItem)//设置交易对象类型为人员【文本框设值】

if("LBL_objecttype".equals(i.getLabelName()))

i.setValue(3);//0客户,1供应商,2部门,3人员,4散客







@SuppressWarnings("all")

private void cardCodeChangeEvent(EarmPerpReportBVO[] bvos,String pk_org)

for(int y = 0; y < bvos.length; y++)【表体,多行的情况下进行循环增行和设值】

if(y+1 < bvos.length)

//子表表格增加一行

getAddLineAction().doAction();



//获取当前表格

BillTable table = (BillTable)getBillFormEditor().getBillCardPanel().getBillTable();

//获取列model

TableColumnModel tableColumnModel = table.getColumnModel();

Map queryMap = new HashMap();

Map resutlPsndocMap = new HashMap();

IPaymentStatementService service = NCLocator.getInstance().lookup(IPaymentStatementService.class);

try

//查询薪资项目名称并初始化到单元格

queryMap.put("sql", "select name from wa_classitem where pk_wa_classitem='" + bvos[y].getPk_item() + "'");

Map resutlMap = service.queryMap(queryMap);

//设置普通单元格的值,薪资项目名称

table.setValueAt(resutlMap.get("name"), y, tableColumnModel.getColumnIndex("薪资项目"));

//查询用户卡3信息,后续将卡3信息初始化到银行卡信息列

queryMap.put("sql", "select distinct accnum, accname,t3.name as bankname,t3.code pk_bankdoc from bd_psnbankacc t1, bd_bankaccbas t2,bd_bankdoc t3 where t1.pk_bankaccbas = t2.pk_bankaccbas and t2.pk_bankdoc = t3.pk_bankdoc and t1.pk_psndoc = '" + bvos[y].getPk_psndoc() + "'");

resutlPsndocMap = service.queryMap(queryMap);

catch (DAOException e)

e.printStackTrace();



//薪资项目编码【文本框设值】

table.setValueAt(bvos[y].getPk_item(), y, tableColumnModel.getColumnIndex("薪资项目编码"));

//付款原币金额

table.setValueAt(bvos[y].getItemvalue(), y, tableColumnModel.getColumnIndex("付款原币金额"));

//付款组织本币金额

table.setValueAt(bvos[y].getItemvalue(), y, tableColumnModel.getColumnIndex("付款组织本币金额"));

//设置组织本币汇率

int curr = tableColumnModel.getColumnIndex("组织本币汇率");

if(y == 0)

table.setValueAt(1.00, y, curr);



//参照人员所属的列【参照设值】

int staffColumn = tableColumnModel.getColumnIndex("人员");

BillCellEditor staffCellEditor = ((BillCellEditor) table.getCellEditor(y, staffColumn));

UIRefPane staffCardRef = ((UIRefPane) ((BillCellEditor) table.getCellEditor(y, staffColumn)).getComponent());

//设置参照引用单元格的值,人员

Vector<Vector<Object>> staffRefValue = new Vector<>();

Vector staffvt = staffCardRef.getRefModel().getData();

for(int i = 0; i < staffvt.size(); i++)

Vector staffVector = (Vector) staffvt.get(i);

//比较主键,相同则设置默认的参照值

if(bvos[y].getPk_psndoc().equals(staffVector.get(10)))

staffRefValue.add(staffVector);

break;





table.setEditingRow(y);

//需要两层vector,否则后续会报错

staffCardRef.getRefModel().setSelectedData(staffRefValue);

ChangeEvent staffChangeEvent = new ChangeEvent(staffCellEditor);

table.setCellEditor(table.getCellEditor(y, staffColumn));

table.setEditingColumn(staffColumn);

table.editingStopped(staffChangeEvent);

//交易对象类型

int transTypeColumn = tableColumnModel.getColumnIndex("交易对象类型");

BillCellEditor transTypeCellEditor = ((BillCellEditor) table.getCellEditor(y, transTypeColumn));

UIComboBox transTypeCardRef = ((UIComboBox) ((BillCellEditor) table.getCellEditor(y, transTypeColumn)).getComponent());

if(transTypeCardRef.getSelectdItemValue() == null || "".equals(transTypeCardRef.getSelectdItemValue()))

transTypeCardRef.setSelectedIndex(4);//设置默认值为"人员"



//设置参照引用单元格的值,交易对象类型

table.setEditingRow(y);

ChangeEvent transTypeChangeEvent = new ChangeEvent(transTypeCellEditor);

table.setCellEditor(table.getCellEditor(y, transTypeColumn));

table.setEditingColumn(transTypeColumn);

table.editingStopped(transTypeChangeEvent);

//账号信息参照设置

int accountColumn = tableColumnModel.getColumnIndex("收款银行账号");

BillCellEditor accountCellEditor = ((BillCellEditor) table.getCellEditor(y, accountColumn));

UIRefPane accountCardRef = ((UIRefPane) ((BillCellEditor) table.getCellEditor(y, accountColumn)).getComponent());

//设置参照引用单元格的值,账号信息

Vector<Vector<Object>> accountRefValue = new Vector<>();

String psnBankaccName = "个人银行账户";

accountCardRef.setRefNodeName(psnBankaccName);

accountCardRef.getRefModel().setPk_org(pk_org);

Vector accountVt = accountCardRef.getRefModel().getData();

for(int i = 0; i < accountVt.size(); i++)

Vector accountVector = (Vector) accountVt.get(i);

//比较主键,相同则设置默认的参照值

if(resutlPsndocMap.get("accnum") != null && resutlPsndocMap.get("accnum").equals(accountVector.get(0)))

accountRefValue.add(accountVector);

break;





table.setEditingRow(y);

accountCardRef.getRefModel().setSelectedData(accountRefValue);

ChangeEvent accountChangeEvent = new ChangeEvent(accountCellEditor);

table.setCellEditor(table.getCellEditor(y, accountColumn));

table.setEditingColumn(accountColumn);

table.editingStopped(accountChangeEvent);





private void orgChangeEvent(AggEarmPerpReportVO aggEarmPerpReportVO)

//设置组织默认值

UIRefPane orgRefPane= (UIRefPane)getBillFormEditor().getBillOrgPanel().getComponents()[1];

orgRefPane.setPk_org(aggEarmPerpReportVO.getParentVO().getPk_org());



public AbstractAppModel getModel()

return model;



public void setModel(AbstractAppModel model)

this.model = model;



public CmpBillBodyAddLineAction getAddLineAction()

return addLineAction;



public void setAddLineAction(CmpBillBodyAddLineAction addLineAction)

this.addLineAction = addLineAction;





4.开发功能完成后,测试过程中发现,增加模板分配给用户,使用新用户使用跳转功能时,无法正常跳转

经过排查原因是配置新模板后,没有重启导致的。注意:配置新的模板,新增加的功能也需要一并配置上。

以上是关于NC65功能跳转并初始化赋值的主要内容,如果未能解决你的问题,请参考以下文章

nc65期初建账重分类

跳转页面与传值(Swift4)

WPF怎么跳转页面和传值

怎么给一个二维数组赋不同的值

uniapp 页面跳转传值和接收

js实现页面跳转并传值