用友nc65 uap开发如何将一个vo单据显示在一个弹窗面板上?
2017-01-17 22:21
357 查看
用友nc65 uap开发如何将一个vo单据显示在一个弹窗面板上?
在有的时候我们需要通过一个节点查看另外一个节点与之相关的信息,而如果需要再去打开另外一个节点这样会使得操作繁杂。此时我们利用他们之间的关系把数据显示在一个弹窗面板上,通过按钮查看会方便许多。如图所示:
通过房产查询按钮显示房产资料节点与之相关的vo单据数据。
代码如下:
按钮代码
==================================================================
有按钮功能的源代码
在有的时候我们需要通过一个节点查看另外一个节点与之相关的信息,而如果需要再去打开另外一个节点这样会使得操作繁杂。此时我们利用他们之间的关系把数据显示在一个弹窗面板上,通过按钮查看会方便许多。如图所示:
通过房产查询按钮显示房产资料节点与之相关的vo单据数据。
代码如下:
按钮代码
package nc.ui.fdc_crmbd.h3h080.ace.action; import java.awt.event.ActionEvent; import nc.funcnode.ui.AbstractFunclet; import nc.ui.fdc_crmbd.h3h080.ace.dlg.SplitLineDialog; import nc.ui.pub.beans.MessageDialog; import nc.ui.pub.bill.BillCardPanel; import nc.ui.pubapp.uif2app.model.BillManageModel; import nc.ui.pubapp.uif2app.view.BillForm; import nc.ui.uif2.NCAction; import nc.ui.uif2.model.AbstractAppModel; import nc.vo.fdc_crmbd.h3h080.AggCustomerinfo; /** * * @author: zenglong * @ClassName: HouQueryAction * @Description: 房产查询 * @date: 2016年12月7日 */ public class HouQueryAction extends NCAction { private BillManageModel billModel; public HouQueryAction(){ setBtnName("房产查询"); setCode("houQueryAction"); } @Override public void doAction(ActionEvent e) throws Exception { if (this.getBillModel().getSelectedRow()<0) { MessageDialog.showErrorDlg(getBillModel().getContext().getEntranceUI(),"错误","请选中行进行操作"); }else{ AggCustomerinfo custVo=(AggCustomerinfo) this.getBillModel().getSelectedData(); AbstractFunclet funclet = (AbstractFunclet) getBillModel().getContext() .getEntranceUI(); SplitLineDialog dlg=new SplitLineDialog(funclet); int res=dlg.initdata(custVo.getParentVO().getPk_head(),custVo.getParentVO().getPk_org()); if(res==1){ dlg.showModal(); } } } public Bi 4000 llManageModel getBillModel() { return billModel; } public void setBillModel(BillManageModel billModel) { this.billModel = billModel; } }弹窗面板代码: select pk_billtemplet from pub_billtemplet where bill_templetcaption='单据模版名称'
package nc.ui.fdc_crmbd.h3h080.ace.dlg; import java.awt.BorderLayout; import java.awt.Container; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; import nc.bs.dao.BaseDAO; import nc.bs.dao.DAOException; import nc.bs.framework.common.NCLocator; import nc.funcnode.ui.AbstractFunclet; import nc.itf.fdc_crmbd.IH3H080Maintain; import nc.itf.fdc_pr.IH303100210Maintain; import nc.itf.fdc_pr.IH3031015Maintain; import nc.jdbc.framework.processor.ColumnListProcessor; import nc.ui.pub.beans.MessageDialog; import nc.ui.pub.beans.UIDialog; import nc.ui.pub.bill.BillListPanel; import nc.vo.fdc_pr.h303100210.AggEnterpriseTenant; import nc.vo.fdc_pr.h3031015.House_customer_b; import nc.vo.pub.BusinessException; import nc.vo.pub.CircularlyAccessibleValueObject; import nc.vo.pubapp.pattern.exception.ExceptionUtils; /** * * @author: zenglong * @ClassName: SplitLineDialog * @Description: * @date: 2016年12月8日 */ public class SplitLineDialog extends UIDialog { private static final long serialVersionUID = 5064747027574608058L; private AbstractFunclet parent; /** UI JPanel */ private JPanel uiContentPane; private BillListPanel billPanel; // 生产计划编制选择的表体行 private int row = -1; // 生产计划编制选择 的表体行vo // private MpshbBVO curBody = null; public SplitLineDialog(AbstractFunclet funclet) { super(funclet); this.parent = funclet; this.initialize(); } private void initialize() { this.setName("mpsSplitDialog"); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.setTitle("房产显示"); int w = 1000; int h = 600; this.setBounds(500, 400, w, h); this.setResizable(true); // 设置模板 this.setContentPane(this.getUIContentPane()); } public int initdata(String pk,String org) { CircularlyAccessibleValueObject[] tmpHeadVo = getData(pk,org); int result=0; if (tmpHeadVo!=null && tmpHeadVo.length>0) { if (getBillPanel().getBillListData().isMeataDataTemplate()) getBillPanel().getBillListData().setHeaderValueObjectByMetaData( tmpHeadVo); else getBillPanel().setHeaderValueVO(tmpHeadVo); getBillPanel().getHeadBillModel().execLoadFormula(); result=1; } return result; } private Container getUIContentPane() { if (null == this.uiContentPane) { this.uiContentPane = new JPanel(); this.uiContentPane.setName("UIDialogContentPane"); this.uiContentPane.setLayout(new BorderLayout()); this.getUIContentPane().add(this.getBillPanel(), "Center"); } return this.uiContentPane; } private BillListPanel getBillPanel() { if (this.billPanel == null) { this.billPanel = new BillListPanel(); this.billPanel.setName("mpsSplitPanel"); this.billPanel.loadTemplet("1002A21000000000OJII"); } return this.billPanel; } public CircularlyAccessibleValueObject[] getData(String pk,String pk_org) { IH303100210Maintain personMain = NCLocator.getInstance().lookup( IH303100210Maintain.class); AggEnterpriseTenant[] aggEnter = null; House_customer_b[] vos = null; List<House_customer_b> hcutVos=new ArrayList<House_customer_b>(); try { //到租户表中把当前租户主键取出来 + "' and pk_org ='"+pk_org aggEnter = personMain .querybills(" and nvl(dr,0)=0 and reserve1 = '" + pk+"'");//reservel 集团客户唯一标识 } catch (BusinessException e) { ExceptionUtils.wrappBusinessException("错误:" + e.getMessage()); } if (aggEnter==null) { MessageDialog.showErrorDlg(parent,"提示:","该用户未传入租户!"); return null; }else{ IH3031015Maintain pactMain = NCLocator.getInstance().lookup( IH3031015Maintain.class); IH3H080Maintain custMain = NCLocator.getInstance().lookup( IH3H080Maintain.class); for (int i = 0; i < aggEnter.length; i++) { //因为一个租户存在多个不同的公司 vos = pactMain.query(" nvl(dr,0)=0 and pk_customerid = '"//pk_customerid客户主键 + aggEnter[i].getParentVO().getPk_head() + "'"); //将存在不同公司的租户查出来 for (House_customer_b hc : vos) { hcutVos.add(hc); } } if (hcutVos.size()<1) { MessageDialog.showErrorDlg(parent,"提示:","该客户未与房间建立关系!"); return null; } //通过楼栋主键查找房地产 预留字段3存房地产 for (int i = 0; i < hcutVos.size(); i++) { hcutVos.get(i).setReserve3(custMain.queryFdcxmd(hcutVos.get(i).getReserve1())); } } //list--数据 return (CircularlyAccessibleValueObject[]) hcutVos.toArray(new CircularlyAccessibleValueObject[] {}); } }
==================================================================
有按钮功能的源代码
package nc.ui.mm.mpshebing.action; import java.awt.BorderLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; import nc.ui.pub.beans.MessageDialog; import nc.ui.pub.beans.UIButton; import nc.ui.pub.beans.UIDialog; import nc.ui.pub.beans.UIPanel; import nc.ui.pub.bill.BillCardPanel; import nc.ui.pub.bill.BillEditEvent; import nc.ui.pub.bill.BillEditListener; import nc.ui.pub.bill.BillEditListener2; import nc.ui.pub.bill.BillItem; import nc.vo.mmmps.mpshebing.MpshbBSplictVO; import nc.vo.mmmps.mpshebing.MpshbBVO; import nc.vo.pub.lang.UFBoolean; import nc.vo.pub.lang.UFDouble; import nc.vo.pubapp.pattern.pub.MathTool; import org.apache.commons.lang.StringUtils; /** * * @ClassName: SplitLineDialog * @Description: TODO(拆行对话框) * @author Administrator * @version 1.0 */ public class SplitLineDialog extends UIDialog implements BillEditListener, BillEditListener2 { private static final long serialVersionUID = 5064747027574608058L; private BillCardPanel parent; /** UI JPanel */ private JPanel uiContentPane; /** 确定按钮 */ private UIButton btnOK; /** 增行按钮 */ private UIButton btnAddLine; /** 删行按钮 */ private UIButton btnDelLine; /** 按钮响应事件 */ private ActionHandler actionHandler = new ActionHandler(); /** 按钮模板 */ private UIPanel btnUIPanel; private BillCardPanel billPanel; // 生产计划编制选择的表体行 private int row = -1; // 生产计划编制选择 的表体行vo private MpshbBVO curBody = null; public SplitLineDialog(BillCardPanel parent) { super(parent); this.parent = parent; this.initialize(); } public void initData(int row, MpshbBVO body) { if (body == null) { return; } this.row = row; this.curBody = body; // 数据转换 MpshbBSplictVO splivo = new MpshbBSplictVO(); splivo.setCrowno(body.getCrowno()); splivo.setTnum(body.getTnum()); splivo.setTnastnum(body.getTnastnum()); splivo.setFnum(body.getFnum()); splivo.setFnastnum(body.getFnastnum()); splivo.setNum(body.getNum()); splivo.setNastnum(body.getNastnum()); if (!StringUtils.isEmpty(body.getVbdef4())) { splivo.setVbdef4(new UFDouble(body.getVbdef4())); } if (!StringUtils.isEmpty(body.getVbdef5())) { splivo.setVbdef5(new UFDouble(body.getVbdef5())); } if (!StringUtils.isEmpty(body.getVbdef6())) { splivo.setVbdef6(new UFDouble(body.getVbdef6())); } // 设置拆分界面表头数据 String[] names = splivo.getAttributeNames(); for (String name : names) { this.billPanel.setHeadItem(name, splivo.getAttributeValue(name)); } this.billPanel.setHeadItem("fis3", UFBoolean.TRUE); // 设置拆分界面表体数据 this.billPanel.getBillModel().addLine(); this.billPanel.getBillModel().setBodyRowVO(splivo, 0); } private void initialize() { this.setName("mpsSplitDialog"); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.setTitle("生成计划编制拆行"); int w = 1000; int h = 600; this.setBounds(500, 400, w, h); this.setResizable(true); // 设置模板 this.setContentPane(this.getUIContentPane()); // 添加监听 this.addActionListener(); } private void addActionListener() { // TODO Auto-generated method stub this.getBtnOK().addActionListener(this.actionHandler); this.getBtnAddLine().addActionListener(this.actionHandler); this.getBtnDelLine().addActionListener(this.actionHandler); } private Container getUIContentPane() { if (null == this.uiContentPane) { this.uiContentPane = new JPanel(); this.uiContentPane.setName("UIDialogContentPane"); this.uiContentPane.setLayout(new BorderLayout()); this.getUIContentPane().add(this.getBillPanel(), "Center"); this.getUIContentPane().add(this.getBtnUIPanel(), "South"); } return this.uiContentPane; } private BillCardPanel getBillPanel() { // TODO Auto-generated method stub if (this.billPanel == null) { this.billPanel = new BillCardPanel(); this.billPanel.setName("mpsSplitPanel"); this.billPanel.loadTemplet("1001ZZ100000009UHOJJ"); this.billPanel.addEditListener(this); this.billPanel.addBillEditListenerHeadTail(this); this.billPanel.getBillTable().setSelectionMode( javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.billPanel.setTatolRowShow(true); this.billPanel.setBodyMenuShow(false); } return this.billPanel; } /** * 按钮pannelgetter * * @return 按钮pannel */ public UIPanel getBtnUIPanel() { if (this.btnUIPanel == null) { this.btnUIPanel = new nc.ui.pub.beans.UIPanel(); this.btnUIPanel.setName("BtnUIPanel"); this.btnUIPanel.add(this.getBtnAddLine(), this.getBtnAddLine() .getName()); this.btnUIPanel.add(this.getBtnDelLine(), this.getBtnDelLine() .getName()); this.btnUIPanel.add(this.getBtnOK(), this.getBtnOK().getName()); } return this.btnUIPanel; } private UIButton getBtnOK() { if (null == this.btnOK) { this.btnOK = new UIButton(); this.btnOK.setName("btnOK"); this.btnOK.setText("确定"); } return this.btnOK; } private UIButton getBtnDelLine() { if (null == this.btnDelLine) { this.btnDelLine = new UIButton(); this.btnDelLine.setName("btnDelLine"); this.btnDelLine.setText("删行"); } return this.btnDelLine; } private UIButton getBtnAddLine() { if (null == this.btnAddLine) { this.btnAddLine = new UIButton(); this.btnAddLine.setName("btnAddLine"); this.btnAddLine.setText("增行"); } return this.btnAddLine; } @Override public boolean beforeEdit(BillEditEvent e) { // TODO Auto-generated method stub return true; } @Override public void afterEdit(BillEditEvent e) { // TODO Auto-generated method stub int row = e.getRow(); String key = e.getKey(); Object value = e.getValue(); if (e.getPos() == BillItem.HEAD) { } else if (e.getPos() == BillItem.BODY) { // 当前表头和表体的数量型的字段,完全一致 if (value instanceof UFDouble) { UFDouble u_value = (UFDouble) value; UFDouble hu_value = (UFDouble) this.billPanel.getHeadItem(key) .getValueObject(); if (hu_value == null || hu_value.doubleValue() == 0) { this.billPanel.setBodyValueAt(null, row, key); } UFDouble rate = u_value.div(hu_value); updateRowNum(rate, row); } } } private void updateRowNum(UFDouble rate, int row) { // TODO Auto-generated method stub Boolean fis3 = (Boolean) this.billPanel.getHeadItem("fis3") .getValueObject(); String[] update_keys = new String[] { "tnum", "tnastnum", "fnum", "fnastnum", "num", "nastnum" }; if (fis3 == null || !fis3) { // 如果不联动3类 update_keys = new String[] { "fnum", "fnastnum", "num", "nastnum" }; } for (String key : update_keys) { UFDouble hu_value = (UFDouble) this.billPanel.getHeadItem(key) .getValueObject(); if (hu_value == null || hu_value.doubleValue() == 0) { continue; } UFDouble bu_value = hu_value.multiply(rate); this.billPanel.setBodyValueAt(bu_value, row, key); } } @Override public void bodyRowChange(BillEditEvent e) { // TODO Auto-generated method stub } class ActionHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == SplitLineDialog.this.getBtnOK()) { // 确定按钮执行事件 SplitLineDialog.this.doOKAction(); } if (e.getSource() == SplitLineDialog.this.getBtnAddLine()) { // 增行 SplitLineDialog.this.doAddLineAction(); } if (e.getSource() == SplitLineDialog.this.getBtnDelLine()) { // 删除行 int[] selectRows = getBillPanel().getBillTable() .getSelectedRows(); List<Integer> rows = new ArrayList<Integer>(); for (int row : selectRows) { String crwono = (String) getBillPanel().getBodyValueAt(row, "crowno"); if (!StringUtils.isEmpty(crwono)) { // 原始的行,不能删除掉 continue; } rows.add(row); } if (rows.size() == 0) { return; } int[] delete_row = new int[rows.size()]; for (int i = 0; i < delete_row.length; i++) { delete_row[i] = rows.get(i); } getBillPanel().getBillModel().delLine(delete_row); } } } private void doAddLineAction() { // TODO Auto-generated method stub getBillPanel().getBillModel().addLine(); int rowCount = getBillPanel().getBillModel().getRowCount(); Object vbdef4 = getBillPanel().getHeadItem("vbdef4").getValueObject(); Object vbdef5 = getBillPanel().getHeadItem("vbdef5").getValueObject(); Object vbdef6 = getBillPanel().getHeadItem("vbdef6").getValueObject(); getBillPanel().setBodyValueAt(vbdef4, rowCount - 1, "vbdef4"); getBillPanel().setBodyValueAt(vbdef5, rowCount - 1, "vbdef5"); getBillPanel().setBodyValueAt(vbdef6, rowCount - 1, "vbdef6"); } private void doOKAction() { // TODO Auto-generated method stub MpshbBSplictVO[] bodys = (MpshbBSplictVO[]) getBillPanel() .getBillModel().getBodyValueVOs(MpshbBSplictVO.class.getName()); if (bodys == null || bodys.length <= 1) { return; } // 校验拆行的数量合计与原来是否相同 String[] update_keys = new String[] { "num", "nastnum", "fnum", "fnastnum", "tnum", "tnastnum" }; for (MpshbBSplictVO body : bodys) { UFBoolean isALLZero = UFBoolean.TRUE; UFBoolean isDouble = UFBoolean.FALSE; for (String key : update_keys) { UFDouble line_value = MathTool.nvl((UFDouble) body .getAttributeValue(key)); if (line_value != null && line_value.doubleValue() > 0) { isALLZero = UFBoolean.FALSE; } // 3、5类的辅数量,不允许为小数 if (key.equalsIgnoreCase("fnastnum") || key.equalsIgnoreCase("tnastnum")) { String value = line_value.toString(); String scale = value.substring(value.indexOf(".") + 1); if (!StringUtils.isEmpty(scale)) { UFDouble xiaoshu = new UFDouble(scale); if (xiaoshu.doubleValue() > 0) { isDouble = UFBoolean.TRUE; } } } } if (isALLZero.booleanValue()) { MessageDialog.showWarningDlg(this, "存在无效的行", "3、5、8类数量都为0"); return; } if (isDouble.booleanValue()) { MessageDialog.showWarningDlg(this, "存在无效的行", "3、5类辅数量必须为整数"); return; } } for (String key : update_keys) { UFDouble head_value = (UFDouble) this.billPanel.getHeadItem(key) .getValueObject(); UFDouble body_value = UFDouble.ZERO_DBL; for (MpshbBSplictVO body : bodys) { UFDouble line_value = (UFDouble) body.getAttributeValue(key); body_value = MathTool.add(body_value, line_value); } if (MathTool.sub(head_value, body_value).doubleValue() != 0) { String name = this.billPanel.getHeadItem(key).getName(); MessageDialog.showWarningDlg(this, "拆分的数量不等于合计", name + "拆分的数量不等于合计,请修改!"); return; } } // 转换成 c413 生产计划编制表体行vo,并将拆分后的数据更新到原来的界面上 int old_row = row;// 用来记录原来的行,因为插入行,是在原来的行之前插入,则原来的行位置在持续变化的 UFDouble new_crowno = new UFDouble(this.curBody.getCrowno()); UFDouble add_crowno = new UFDouble(0.1); BillItem[] items = this.parent.getBillData().getBodyItems(); for (int i = 0; i < bodys.length; i++) { // 赋值一条新的VO,并且赋值 MpshbBVO newBody = (MpshbBVO) this.curBody.clone(); for (String key : update_keys) { newBody.setAttributeValue(key, bodys[i].getAttributeValue(key)); } String vrowno = bodys[i].getCrowno(); // 如果行号不等于空,则将该行的数据,更新到原来的行上面去 if (!StringUtils.isEmpty(vrowno)) { this.parent.getBillModel().setBodyRowVO(newBody, old_row); // for(int column=0;column<items.length;column++){ // this.parent.getBillModel().setBackground(Color.CYAN, old_row, // column); // } } else { this.parent.getBillModel().insertRow(row); ++old_row; new_crowno = MathTool.add(new_crowno, add_crowno).setScale(2, UFDouble.ROUND_HALF_UP); newBody.setCrowno("" + new_crowno); // 将主键清楚 newBody.setPk_cfhb_b(null); // 将减仓信息清除 newBody.setVbdef11(null);// 3类减仓 newBody.setVbdef24(null);// 3类按单位减仓 newBody.setVbdef30(null);// 3类减仓批次号 newBody.setVbdef31(null);// 3类减仓仓库 newBody.setVbdef12(null);// 5类减仓 newBody.setVbdef25(null);// 5类按单位减仓 newBody.setVbdef29(null);// 5类减仓批次号 newBody.setVbdef13(null);// 8类余料 newBody.setVbdef28(null);// 8类减仓批次号 // 批次 newBody.setVbdef22(null);// 8类批次号 newBody.setVbdef21(null);// 5类批次号 newBody.setBatchcode(null);// 3类批次号 this.parent.getBillModel().setBodyRowVO(newBody, row); // for(int column=0;column<items.length;column++){ // this.parent.getBillModel().setBackground(Color.yellow, row, // column); // } } } this.parent.getBillModel().loadLoadRelationItemValue(); this.closeOK(); } }
相关文章推荐
- 用友nc65 uap开发参照多选三种显示情况总结
- 用友nc65 uap开发参照节点数据拉单之二----直接通过调用查询模版查询上游单据
- 用友nc65 uap开发主子表单据跳转编辑态时设置某几个值不可编辑
- 用友nc65 uap开发参照多选后显示问题解决
- 用友nc65 uap开发-公式开发后如何执行生效
- 用友nc65 uap开发对于小数显示百分号开发
- rcp(插件开发)如何在一个透视图中显示多个视图
- Android 开发中,如何将多个程序打包成一个apk文件,但是安装完成后显示多个程序?
- 用友nc65 uap开发刷新按钮二次开发
- windows客户端开发--如何测量一个字符串显示的物理长度
- iOS开发技巧之:如何在iOS平台上对一个视频进行解码和显示
- 用友nc65 uap开发中系统出现卡,慢等问题解决思路二(提交审批等按钮卡慢)
- 用友nc65 uap开发 nc.vo.bd.meta.BatchOperateVO(批量操作的包装VO)转aggvo
- windows客户端开发--如何测量一个字符串显示的物理长度
- 用友nc65 uap开发找产品功能源代码
- 用友nc65-uap开发将节点分配给当前登录用户可见
- 用友nc65 uap审批流按钮开发
- 用友nc65 uap开发表体编辑前事件和表体整行不可编辑功能
- 用友nc65 uap开发查询模版中对于特定条件添加查询条件
- 用友nc65 uap开发中系统出现卡,慢等问题解决思路一(临时合同节点处理)