NC开发常见问题记录_第1页
NC开发常见问题记录_第2页
NC开发常见问题记录_第3页
NC开发常见问题记录_第4页
NC开发常见问题记录_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、作者:麻杰 日期:2014-10-061. 表头字段不可见getHeadItem("").setShow(false);2. 在单据或报表中,设置表体中的0.00显示或显示为空在单据中,如下设置:/表体行可以显示0.00getBillCardPanel().getBodyPanel().getRendererVO().setShowZeroLikeNull(false);在报表中,如下设置:/设置不显示零getReportBase().getBodyPanel().getRendererVO().setShowZeroLikeNull(true);3. 在程序查询过程中,加

2、入"请等待 ."的提示框 /线程 Runnable checkRun = new Runnable() public void run() /线程对话框:系统运行提示框 BannerDialog dialog = new BannerDialog(ui); dialog.start(); try /* 将查询方法写在其中 */ catch(Exception e) e.printStackTrace(); ui.showErrorMessage(e.getMessage(); finally /销毁系统运行提示框 dialog.end(); ; /启用线程 new Thre

3、ad(checkRun).start();4. 发送邮件MailTool.sendHtmlEmail(smtpHost, fromAddr, senderName, userName, password, receivers, subject, sb, fileName);5. 列表表体加afterEdit监听方法getBillListPanel().getBodyScrollPane("页签表名").addEditListener(this);触发afterEdit(BillEditEvent e)方法6. 表体按照recordnum倒序排列,类似定调资表体getBill

4、ListPanel().getBodyBillModel().setSortColumn("recordnum");getBillListPanel().getBodyBillModel().getSortColumns().get(0).setAscending(false);7. 表头最大化设置方法getBillListPanel().getUISplitPane().getRightComponent().setVisible(false);8. 登陆界面的日期设置不可修改有个配置文件可以直接修改的。nchomeierpbinclientui.xml 9. 在UI中得

5、到的变化VO方法getBillCardPanel().getBillValueChangeVO是从页面得到的VO,如果修改查询出来的数据,当查询出来的数据如果没有主键的话,那得到得VO主键就是null的。10. 在修改的方法中,如果是根据主键为条件进行修改,主键不能通过 key = getOID(storeadmin.getPk_corp();得到主键,因为这是新生成的,要使用以前的主键,key= storeadmin.getPrimarykey();11. 生成单据号的方法:Stringbillcode= HYPubBO_Client.getBillNo(getUIControl().get

6、BillType(), getClientEnvironment().getCorporation().getPrimaryKey(),null, null);另一种是:得到某个定义的单据号:BillcodeRuleBO_Client.getBillCode(“biltype”, pk_corp,null, null);/取得单据号(从NC取,服务器端)String billNo = new nc.bs.trade.business.HYPubBO().getBillNo(ISYYSBilltype.CTRLDDEPT_BGT_BILL, parentVo.getPk_corp(), null

7、, null); / 设置单据号/取得单据号(从NC取,客户端)return HYPubBO_Client.getBillNo(getUIControl().getBillType(), _getCorp().getPrimaryKey(), null, null);12. 验证非空Overrideprotected void onBoSave() throws Exception this.getBillCardPanelWrapper().getBillCardPanel().getBillData().dataNotNullValidate();super.onBoSave();13.

8、实现多选 getBillListPanel().getHeadTable().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);遇到几次列表界面可多选,但取值难的问题,现总结如下:设置列表多选框  getBillListPanel().setMultiSelect(true);/设置列表Ctrl、Shift多选  getBillListWrapper().getBillListPanel().getHeadTable().   se

9、tSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);获取列表多条记录的方法1、int selectRows = (BillManageUI) getBillUI().getBillListPanel().getHeadTable().getSelectedRows();2、 (BillManageUI) getBillUI().getBillListPanel().getHeadBillModel().getBodySelectedVOs(DemoYsHVO.class.getName();其中,

10、方法1只在Ctrl、Shift多选时能取到多条记录的行号。         方法2都能取到多选记录的VO。14. 实现选择框全选全消小按钮import nc.ui.hr.frame.util.table.TableMultiSelHelper; headTableMultiSelector headTableMultiSelector = new TableMultiSelHelper(); headTableMultiSelector.addMultiSeletor(getBillListPa

11、nel().getHeadTable(); 15. 分别从卡片、列表中取得表头、表体数组的方法 /列表界面 if (getSelfUI().isListPanelSelected() int rowCount = getSelfUI().getBillListPanel().getHeadBillModel().getRowCount(); if (rowCount = 0) getSelfUI().showWarningMessage("没有可以确认的数据!"); return; /取得选中的行 selectRow = getSelfUI().getBillListPan

12、el().getHeadTable().getSelectedRow(); /在列表界面取得表头VO hvo = (Df1BmsqHVO)getBufferData().getVOByRowNo(selectRow).getParentVO(); /在列表界面取得表体VO bvos = (Df1BmsqBVO)getBufferData().getVOByRowNo(selectRow).getChildrenVO(); /卡片界面 else int rowCount = getSelfUI().getBillCardPanel().getBillTable().getRowCount();

13、if (rowCount = 0) getSelfUI().showWarningMessage("没有可以确认的数据!"); return; try /在卡片界面取得表头VO hvo = (Df1BmsqHVO)getBufferData().getCurrentVO().getParentVO(); /在卡片界面取得表体VO bvos = (Df1BmsqBVO)getBufferData().getCurrentVO().getChildrenVO(); catch (Exception e) e.printStackTrace(); 16. 得到行号数组 Int r

14、ows= ui.getBillListWrapper().getBillListPanel().getHeadTable().getSelectedRows();17. 得到当前行的聚合VOAggRequirepubVO aggRequirepubVO= (AggRequirepubVO)ui.getBillListWrapper().getBillListPanel().getBillValueVO(iCurRow,AggRequirepubVO.class.getName(),HeadVO.class.getName(), BodyVO.class.getName();18. 得到行号,得

15、覆盖这个方法Overridepublic void bodyRowChange(BillEditEvent e) / TODO Auto-generated method stubiCurrRow = e.getRow();19. 自定义按钮的使用需要在ui中覆盖这个方法Overrideprotected void initPrivateButton() / TODO Auto-generated method stubPublicVO publicVO = new PublicVO();addPrivateButton(publicVO.getPublicButtonVO();addPriv

16、ateButton(publicVO.getUnpublicButtonVO();PublicVO 是自己创建的按钮VOpackage nc.vo.zygb;import nc.itf.zygb.IMyButton;import nc.ui.trade.base.IBillOperate;import nc.vo.trade.button.ButtonVO;import nc.vo.trade.pub.IBillStatus;public class PublicVO public ButtonVO getPublicButtonVO()ButtonVO btnVo = null; if (b

17、tnVo = null) btnVo = new ButtonVO(); btnVo.setBtnNo(IMyButton.publicBtn); btnVo.setBtnName("发布"); btnVo.setHintStr("发布"); btnVo.setOperateStatus(new int IBillOperate.OP_EDIT,IBillOperate.OP_NOTEDIT); btnVo.setBusinessStatus(new int IBillStatus.FREE); return btnVo;public ButtonVO

18、getUnpublicButtonVO()ButtonVO btnVO = null;if(btnVO = null)btnVO = new ButtonVO();btnVO.setBtnNo(IMyButton.unpulicBtn);btnVO.setBtnName("取消发布");btnVO.setHintStr("取消发布");btnVO.setOperateStatus(new int IBillOperate.OP_EDIT,IBillOperate.OP_NOTEDIT ); btnVO.setBusinessStatus(new int

19、IBillStatus.FREE);return btnVO;IMyButton是定义按钮的接口:public interface IMyButton /发布按钮public final static int publicBtn = 185;/取消发布按钮public final static int unpulicBtn = 186;下拉框的定义,在initSelfData()方法中Overrideprotected void initSelfData() / TODO Auto-generated method stub/ 发布状态IConstEnum require_status= ne

20、w DefaultConstEnumnew DefaultConstEnum(0, "未发布"),new DefaultConstEnum(1, "已发布");BillPanelUtils.initComboBox(getBillListPanel(), IBillItem.HEAD, null,RequirepubVO.PUBLICSTATUS, require_status, false); BillPanelUtils.initComboBox(getBillCardPanel(), IBillItem.HEAD, null,RequirepubV

21、O.PUBLICSTATUS, require_status, false);20. 向页面回写数据 (MainBillMgrPanel)getMainPanel().getMainBillCardPanel().setHeadData(m_emptyJobVO); (MainBillMgrPanel)getMainPanel().getMainBillListPanel().setHeadSelectedData(m_emptyJobVO);21. 比较日期的先后方法ValidityChecker.validateDate(date1,date2,1,"给出校验的警告语句"

22、;);22. 初始化下拉列 getBillCardWrapper().initHeadComboBox("vbillstatus", ISYYSBillStatus.strStateRemark, true); getBillListWrapper().initHeadComboBox("vbillstatus", ISYYSBillStatus.strStateRemark, true);23. 执行表头公式 getBillCardPanel().execHeadFormula(""); getBillCardPanel().exe

23、cHeadEditFormulas();执行表体公式 /列表状态 getBillListPanel().getBodyBillModel().execEditFormulaByKey(i, "vdef2"); /卡片状态 getBillCardWrapper().getBillCardPanel().execBodyFormula(i, "vdef2");24. 为参照增加约束 AbstractRefModel arm = UIUtilTools.getRefPane(item).getRefModel(); arm.addWherePart("

24、; and dr=0 "); arm.reloadData();25. 自定义按钮添加至界面 ButtonVO editedplan = ButtonFactory.createButtonVO(ISHSHButton.LINK_KY_DETAIL, "修订计划","修订计划"); editedplan.setOperateStatus(new int IBillOperate.OP_NOTEDIT); addPrivateButton(editedplan);26. 当前单据的操作状态 设置是否可以编辑 getBillUI().getBill

25、Operate() /表体所有行 int rowsNum=getBillCardPanel().getBillModel().getRowCount(); int rowcount = getBillCardPanel().getBillModel("").getRowCount();getBillCardPanelWrapper().getBillCardPanel().getHeadItem("high").setEnabled(false); 8.初始上下游得单据状态(在DLG的构造方法里面加入)BillItem billItem = getbil

26、lListPanel().getBillListData().getHeadItem("vbillstatus");initComboBox(billItem, ISHSHBillStatus.strStateRemark,true);27. 设置是否合计和得到合计值设置是否合计: 在initSelfData()方法中加入getBillCardWrapper().getBillCardPanel().setTatolRowShow(true);得到合计值: 首先设置显示合计行 getBillCardPanel().setTatolRowShow(true); 然后获取获取合

27、计行的值 getBillCardPanel().getTotalTableModel().getValueAt("行号","列字段");28. 隐藏表体某列getBillCardPanel().hideBodyTableCol("bodyitem");29. 表体带出表头 /* * 在表头增加三个字段 * 通过vccode带出 * 麻杰 2011-03-04 */String pk_customer = (String)getBillCardPanel().getBillModel("ps_so_sign_customer&

28、quot;).getValueAt(0, "pk_customer");if(null!=pk_customer)String ccpostalcode = QueryUtil.queryByPk("ccpostalcode", pk_customer);getBillCardPanel().setHeadItem("ccpostalcode", ccpostalcode);30. 行不可编辑方法只有选中行可编辑的解决方法,当行可编辑Overridepublic void bodyRowChange(BillEditEvent e)

29、/ 修改的时候不能选中其他行,如果选择,则自动跳回编辑行int currow = getBillCardPanel().getBillTable().getSelectedRow();int editRow = getBillCardPanel().getBillTable().getEditingRow();if (getBillOperate() = IBillOperate.OP_EDIT && editRow >-1 && currow != editRow) getBillCardPanel().getBillTable().setRowSele

30、ctionInterval(editRow, editRow);return;31. 非空校验方法:/* * 数据非空监测 hashFilter (billitem,introwindex) 创建日期:(01-2-21 10:08:48) */public static void dataNotNullValidate(BillData billdata, Hashtable<BillItem, int> hashFilter) throws ValidationException StringBuffer message = null;BillItem headtailitems

31、 = billdata.getHeadTailItems();if (headtailitems != null) for (int i = 0; i < headtailitems.length; i+) if (headtailitemsi.isNull() if (PubUtils.isNull(headtailitemsi.getValueObject() if (message = null) message = new StringBuffer();message.append("");message.append(headtailitemsi.getNa

32、me();message.append("");message.append(",");if (message != null && message.length() > 0) message.deleteCharAt(message.length() - 1);throw new NullFieldException(message.toString();/ 增加多子表的循环String tableCodes = billdata.getTableCodes(BillData.BODY);if (tableCodes != nul

33、l) for (int t = 0; t < tableCodes.length; t+) String tablecode = tableCodest;for (int i = 0; i < billdata.getBillModel(tablecode).getRowCount(); i+) StringBuffer rowmessage = new StringBuffer();/ 判断行状态是否可以编辑int editrow = billdata.getBillModel(tablecode).getEditRow();if (editrow != -1) / 说明启动行编

34、辑状态, 才继续判断 by 王松涛if (editrow != i) continue;rowmessage.append(" ");if (tableCodes.length > 1) rowmessage.append(billdata.getTableName(BillData.BODY, tablecode);rowmessage.append("(");/ "页签"rowmessage.append(nc.ui.ml.NCLangRes.getInstance().getStrByID("_Bill"

35、;, "UPP_Bill-000003");rowmessage.append(") ");rowmessage.append(i + 1);rowmessage.append("(");/ "行"rowmessage.append(nc.ui.ml.NCLangRes.getInstance().getStrByID("_Bill", "UPP_Bill-000002");rowmessage.append(") ");StringBuffer erro

36、rmessage = null;BillItem items = billdata.getBodyItemsForTable(tablecode);OUTER: for (int j = 0; j < items.length; j+) BillItem item = itemsj;int rows = hashFilter != null ? hashFilter.get(item) : null;if (item.isNull() if (rows != null) for (int ii = 0; ii < rows.length; ii+) if (rowsii = i)

37、continue OUTER;Object aValue = billdata.getBillModel(tablecode).getValueAt(i, item.getKey();if (PubUtils.isNull(aValue) / if(message = null)/ message = new StringBuffer(rowmessage);errormessage = new StringBuffer();errormessage.append("");errormessage.append(item.getName();errormessage.app

38、end("");errormessage.append(",");if (errormessage != null) errormessage.deleteCharAt(errormessage.length() - 1);rowmessage.append(errormessage);if (message = null) message = new StringBuffer(rowmessage); else message.append(rowmessage);break;if (message != null) break;if (message

39、 != null) throw new NullFieldException(message.toString();32. 设置背景颜色/* * * 为当前BillItem数组设置label组件的背景颜色 <b>参数说明</b> * * param bis * param color * author 麻杰 * time 2010-9-25 下午03:13:11 */private static void setBackColor(BillItem bis, Color color) for (int i = 0; i < bis.length; i+) UILa

40、bel label = bisi.getCaptionLabel();label.setBackground(color);33. 设置表格表头的颜色/* * 创建者:晁志平 功能:设置表格的Header颜色 * 蒋力,修改原因:加入参数为空判断,改调用公共过程 */public static void setBillCardHeaderColor(BillCardPanel cardPanel, ArrayList<String> colorString, Color color) BillItem bis = cardPanel.getBillData().getHeadIte

41、ms();if (bis = null) return;/ 还原所有背景色setBackColor(bis, cardPanel.getBackground();/ 设置指定前景色setForegroundColor(bis, colorString, color);/* * * 为当前BillItem数组设置label组件的背景颜色 <b>参数说明</b> */private static void setBackColor(BillItem bis, Color color) for (int i = 0; i < bis.length; i+) UILabe

42、l label = bisi.getCaptionLabel();label.setBackground(color);/* * 根据cols集合中指定的名称,来对BillItems数组元素中的label组件设置前景色 */private static void setForegroundColor(BillItem bis, ArrayList<String> cols, Color color) for (int i = 0; i < cols.size(); i+) if (cols.get(i) = null && "".equal

43、s(cols.get(i) continue;String col = cols.get(i).trim();for (int j = 0; j < bis.length; j+) String item = bisj.getKey().trim();if (item.equals(col) / 获得当前表头组件的Label组件UILabel label = bisi.getCaptionLabel();/ 使该组件绘制其边界内的所有像素label.setOpaque(true);/ 设置前景色为用户指定的颜色label.setForeground(color);34. 设置表格底颜色/

44、* * 创建者:晁志平 功能:设置表格的Tailer颜色 参数: 返回: 例外: 日期: */public static void setBillCardTailColor(BillCardPanel bcpBillCardPanel, ArrayList<String> alColChangeColorString, Color color) BillItem biBillItems = bcpBillCardPanel.getBillData().getTailItems();if (biBillItems = null | biBillItems.length = 0) Pu

45、bUtils.eatException("当前表体没有任何元素,要为表体设置颜色,请确认是否为“主子表”、“单表头”", new Exception("当前表体没有任何元素,要为表体设置颜色,请确认是否为“主子表”、“单表头”");return;/ 还原所有背景色setBackColor(biBillItems, bcpBillCardPanel.getBackground();/ 设置指定前景色setForegroundColor(biBillItems, alColChangeColorString, color); 上面这两个方法的实现在设置表格表

46、头的方法中有35. 是否可以输入数字 /* * * 设置是否可以输入数字 (09) */public static void setAllowNumeric(BillItem item, Boolean isEnable) if (PubUtils.isNotNull(item) UITextField txtItem = getTextField(item);if (PubUtils.isNotNull(txtItem) txtItem.setAllowNumeric(isEnable);/* * * 从BillItem对象中获取UITextField的对象 */private static

47、 UITextField getTextField(BillItem item) UITextField txtItem = null;if (PubUtils.isNotNull(item) && item.getComponent() instanceof UIRefPane) txtItem = (UIRefPane) item.getComponent().getUITextField(); else if (PubUtils.isNotNull(item) && item.getComponent() instanceof UITextField) t

48、xtItem = (UITextField) item.getComponent();return txtItem;36. 设置是否可以输入英文字母/* * * 设置是否可以输入英文字母(大小写)(az)(AZ) */public static void setAllowAlphabetic(BillItem item, Boolean isEnable) if (PubUtils.isNotNull(item) UITextField txtItem = getTextField(item);if (PubUtils.isNotNull(txtItem) txtItem.setAllowAl

49、phabetic(isEnable);37. 从服务器上下载文件并且复制到指定目录/* * * 方法功能描述:从服务器上下载文件并且复制到指定目录。 */public static void downloadFileToDirectory(String packName, String dstPackName) String downloadpack = packName.replace('/', '.');downloadFile(downloadpack);copyDirectory(new File(UiUtils.getCodeCachePath() +

50、 "/" + packName), new File(dstPackName);/* * * 方法功能描述:从服务器上下载文件。 */public static void downloadFile(String packName) Map<String, VID> vidMap;vidMap = VIDManager.getInstance().getClientVID();if (null = vidMap) / 读取本地版本try vidMap = Util.readFromFile(UiUtils.getCodeCachePath() + "/V

51、ersion/" + Consts.VID_FILE_NAME); catch (Exception e) e.printStackTrace();System.out.println("DELET OLD PACKAGE CACHE FILE.");VID fileVIDs = vidMap.get(packName);if (null = fileVIDs | 0 = fileVIDs.length) return;List<VID> listvid = new ArrayList<VID>();for (VID fileVID : fileVIDs) listvid.add(fileVID);try String oriFilePath = ServiceConfig.getFileBase();String oriBaseHttpURL = ServiceC

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论