NC開發(fā)常見問題記錄.doc_第1頁
NC開發(fā)常見問題記錄.doc_第2頁
NC開發(fā)常見問題記錄.doc_第3頁
NC開發(fā)常見問題記錄.doc_第4頁
NC開發(fā)常見問題記錄.doc_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

作者:麻杰 日期:2014-10-061. 表頭字段不可見getHeadItem().setShow(false);2. 在單據(jù)或報表中,設(shè)置表體中的0.00顯示或顯示為空在單據(jù)中,如下設(shè)置:/表體行可以顯示0.00getBillCardPanel().getBodyPanel().getRendererVO().setShowZeroLikeNull(false);在報表中,如下設(shè)置:/設(shè)置不顯示零getReportBase().getBodyPanel().getRendererVO().setShowZeroLikeNull(true);3. 在程序查詢過程中,加入請等待 .的提示框 /線程 Runnable checkRun = new Runnable() public void run() /線程對話框:系統(tǒng)運行提示框 BannerDialog dialog = new BannerDialog(ui); dialog.start(); try /* 將查詢方法寫在其中 */ catch(Exception e) e.printStackTrace(); ui.showErrorMessage(e.getMessage(); finally /銷毀系統(tǒng)運行提示框 dialog.end(); ; /啟用線程 new Thread(checkRun).start();4. 發(fā)送郵件MailTool.sendHtmlEmail(smtpHost, fromAddr, senderName, userName, password, receivers, subject, sb, fileName);5. 列表表體加afterEdit監(jiān)聽方法getBillListPanel().getBodyScrollPane(頁簽表名).addEditListener(this);觸發(fā)afterEdit(BillEditEvent e)方法6. 表體按照recordnum倒序排列,類似定調(diào)資表體getBillListPanel().getBodyBillModel().setSortColumn(recordnum);getBillListPanel().getBodyBillModel().getSortColumns().get(0).setAscending(false);7. 表頭最大化設(shè)置方法getBillListPanel().getUISplitPane().getRightComponent().setVisible(false);8. 登陸界面的日期設(shè)置不可修改有個配置文件可以直接修改的。nchomeierpbinclientui.xml 9. 在UI中得到的變化VO方法getBillCardPanel().getBillValueChangeVO是從頁面得到的VO,如果修改查詢出來的數(shù)據(jù),當查詢出來的數(shù)據(jù)如果沒有主鍵的話,那得到得VO主鍵就是null的。10. 在修改的方法中,如果是根據(jù)主鍵為條件進行修改,主鍵不能通過 key = getOID(storeadmin.getPk_corp();得到主鍵,因為這是新生成的,要使用以前的主鍵,key= storeadmin.getPrimarykey();11. 生成單據(jù)號的方法:Stringbillcode= HYPubBO_Client.getBillNo(getUIControl().getBillType(), getClientEnvironment().getCorporation().getPrimaryKey(),null, null);另一種是:得到某個定義的單據(jù)號:BillcodeRuleBO_Client.getBillCode(“biltype”, pk_corp,null, null);/取得單據(jù)號(從NC取,服務(wù)器端)String billNo = new nc.bs.trade.business.HYPubBO().getBillNo(ISYYSBilltype.CTRLDDEPT_BGT_BILL, parentVo.getPk_corp(), null, null); / 設(shè)置單據(jù)號/取得單據(jù)號(從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. 實現(xiàn)多選 getBillListPanel().getHeadTable().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);遇到幾次列表界面可多選,但取值難的問題,現(xiàn)總結(jié)如下:設(shè)置列表多選框getBillListPanel().setMultiSelect(true);/設(shè)置列表Ctrl、Shift多選getBillListWrapper().getBillListPanel().getHeadTable(). setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);獲取列表多條記錄的方法1、int selectRows = (BillManageUI) getBillUI().getBillListPanel().getHeadTable().getSelectedRows();2、 (BillManageUI) getBillUI().getBillListPanel().getHeadBillModel().getBodySelectedVOs(DemoYsHVO.class.getName();其中,方法1只在Ctrl、Shift多選時能取到多條記錄的行號。 方法2都能取到多選記錄的VO。14. 實現(xiàn)選擇框全選全消小按鈕importnc.ui.hr.frame.util.table.TableMultiSelHelper; headTableMultiSelector headTableMultiSelector=newTableMultiSelHelper(); headTableMultiSelector.addMultiSeletor(getBillListPanel().getHeadTable(); 15. 分別從卡片、列表中取得表頭、表體數(shù)組的方法 /列表界面 if (getSelfUI().isListPanelSelected() int rowCount = getSelfUI().getBillListPanel().getHeadBillModel().getRowCount(); if (rowCount = 0) getSelfUI().showWarningMessage(沒有可以確認的數(shù)據(jù)!); return; /取得選中的行 selectRow = getSelfUI().getBillListPanel().getHeadTable().getSelectedRow(); /在列表界面取得表頭VO hvo = (Df1BmsqHVO)getBufferData().getVOByRowNo(selectRow).getParentVO(); /在列表界面取得表體VO bvos = (Df1BmsqBVO)getBufferData().getVOByRowNo(selectRow).getChildrenVO(); /卡片界面 else int rowCount = getSelfUI().getBillCardPanel().getBillTable().getRowCount(); if (rowCount = 0) getSelfUI().showWarningMessage(沒有可以確認的數(shù)據(jù)!); return; try /在卡片界面取得表頭VO hvo = (Df1BmsqHVO)getBufferData().getCurrentVO().getParentVO(); /在卡片界面取得表體VO bvos = (Df1BmsqBVO)getBufferData().getCurrentVO().getChildrenVO(); catch (Exception e) e.printStackTrace(); 16. 得到行號數(shù)組 Int rows= ui.getBillListWrapper().getBillListPanel().getHeadTable().getSelectedRows();17. 得到當前行的聚合VOAggRequirepubVO aggRequirepubVO= (AggRequirepubVO)ui.getBillListWrapper().getBillListPanel().getBillValueVO(iCurRow,AggRequirepubVO.class.getName(),HeadVO.class.getName(), BodyVO.class.getName();18. 得到行號,得覆蓋這個方法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();addPrivateButton(publicVO.getUnpublicButtonVO();PublicVO 是自己創(chuàng)建的按鈕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 (btnVo = null) btnVo = new ButtonVO(); btnVo.setBtnNo(IMyButton.publicBtn); btnVo.setBtnName(發(fā)布); btnVo.setHintStr(發(fā)布); btnVo.setOperateStatus(new int IBillOperate.OP_EDIT,IBillOperate.OP_NOTEDIT); btnVo.setBusinessStatus(new int IBillStatus.FREE); return btnVo;public ButtonVO getUnpublicButtonVO()ButtonVO btnVO = null;if(btnVO = null)btnVO = new ButtonVO();btnVO.setBtnNo(IMyButton.unpulicBtn);btnVO.setBtnName(取消發(fā)布);btnVO.setHintStr(取消發(fā)布);btnVO.setOperateStatus(new int IBillOperate.OP_EDIT,IBillOperate.OP_NOTEDIT ); btnVO.setBusinessStatus(new int IBillStatus.FREE);return btnVO;IMyButton是定義按鈕的接口:public interface IMyButton /發(fā)布按鈕public final static int publicBtn = 185;/取消發(fā)布按鈕public final static int unpulicBtn = 186;下拉框的定義,在initSelfData()方法中Overrideprotected void initSelfData() / TODO Auto-generated method stub/ 發(fā)布狀態(tài)IConstEnum require_status= new DefaultConstEnumnew DefaultConstEnum(0, 未發(fā)布),new DefaultConstEnum(1, 已發(fā)布);BillPanelUtils.initComboBox(getBillListPanel(), IBillItem.HEAD, null,RequirepubVO.PUBLICSTATUS, require_status, false); BillPanelUtils.initComboBox(getBillCardPanel(), IBillItem.HEAD, null,RequirepubVO.PUBLICSTATUS, require_status, false);20. 向頁面回寫數(shù)據(jù) (MainBillMgrPanel)getMainPanel().getMainBillCardPanel().setHeadData(m_emptyJobVO); (MainBillMgrPanel)getMainPanel().getMainBillListPanel().setHeadSelectedData(m_emptyJobVO);21. 比較日期的先后方法ValidityChecker.validateDate(date1,date2,1,給出校驗的警告語句);22. 初始化下拉列 getBillCardWrapper().initHeadComboBox(vbillstatus, ISYYSBillStatus.strStateRemark, true); getBillListWrapper().initHeadComboBox(vbillstatus, ISYYSBillStatus.strStateRemark, true);23. 執(zhí)行表頭公式 getBillCardPanel().execHeadFormula(); getBillCardPanel().execHeadEditFormulas();執(zhí)行表體公式 /列表狀態(tài) getBillListPanel().getBodyBillModel().execEditFormulaByKey(i, vdef2); /卡片狀態(tài) getBillCardWrapper().getBillCardPanel().execBodyFormula(i, vdef2);24. 為參照增加約束 AbstractRefModel arm = UIUtilTools.getRefPane(item).getRefModel(); arm.addWherePart( and dr=0 ); arm.reloadData();25. 自定義按鈕添加至界面 ButtonVO editedplan = ButtonFactory.createButtonVO(ISHSHButton.LINK_KY_DETAIL, 修訂計劃,修訂計劃); editedplan.setOperateStatus(new int IBillOperate.OP_NOTEDIT); addPrivateButton(editedplan);26. 當前單據(jù)的操作狀態(tài) 設(shè)置是否可以編輯 getBillUI().getBillOperate() /表體所有行 int rowsNum=getBillCardPanel().getBillModel().getRowCount(); int rowcount = getBillCardPanel().getBillModel().getRowCount();getBillCardPanelWrapper().getBillCardPanel().getHeadItem(high).setEnabled(false); 8.初始上下游得單據(jù)狀態(tài)(在DLG的構(gòu)造方法里面加入)BillItem billItem = getbillListPanel().getBillListData().getHeadItem(vbillstatus);initComboBox(billItem, ISHSHBillStatus.strStateRemark,true);27. 設(shè)置是否合計和得到合計值設(shè)置是否合計: 在initSelfData()方法中加入getBillCardWrapper().getBillCardPanel().setTatolRowShow(true);得到合計值: 首先設(shè)置顯示合計行 getBillCardPanel().setTatolRowShow(true); 然后獲取獲取合計行的值 getBillCardPanel().getTotalTableModel().getValueAt(行號,列字段);28. 隱藏表體某列g(shù)etBillCardPanel().hideBodyTableCol(bodyitem);29. 表體帶出表頭 /* * 在表頭增加三個字段 * 通過vccode帶出 * 麻杰 2011-03-04 */String pk_customer = (String)getBillCardPanel().getBillModel(ps_so_sign_customer).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) / 修改的時候不能選中其他行,如果選擇,則自動跳回編輯行int currow = getBillCardPanel().getBillTable().getSelectedRow();int editRow = getBillCardPanel().getBillTable().getEditingRow();if (getBillOperate() = IBillOperate.OP_EDIT & editRow -1 & currow != editRow) getBillCardPanel().getBillTable().setRowSelectionInterval(editRow, editRow);return;31. 非空校驗方法:/* * 數(shù)據(jù)非空監(jiān)測 hashFilter (billitem,introwindex) 創(chuàng)建日期:(01-2-21 10:08:48) */public static void dataNotNullValidate(BillData billdata, Hashtable hashFilter) throws ValidationException StringBuffer message = null;BillItem headtailitems = billdata.getHeadTailItems();if (headtailitems != null) for (int i = 0; i 0) message.deleteCharAt(message.length() - 1);throw new NullFieldException(message.toString();/ 增加多子表的循環(huán)String tableCodes = billdata.getTableCodes(BillData.BODY);if (tableCodes != null) for (int t = 0; t tableCodes.length; t+) String tablecode = tableCodest;for (int i = 0; i 1) rowmessage.append(billdata.getTableName(BillData.BODY, tablecode);rowmessage.append();/ 頁簽rowmessage.append(nc.ui.ml.NCLangRes.getInstance().getStrByID(_Bill, 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 errormessage = 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) 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.append();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 != null) throw new NullFieldException(message.toString();32. 設(shè)置背景顏色/* * * 為當前BillItem數(shù)組設(shè)置label組件的背景顏色 參數(shù)說明 * * 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+) UILabel label = bisi.getCaptionLabel();label.setBackground(color);33. 設(shè)置表格表頭的顏色/* * 創(chuàng)建者:晁志平 功能:設(shè)置表格的Header顏色 * 蔣力,修改原因:加入?yún)?shù)為空判斷,改調(diào)用公共過程 */public static void setBillCardHeaderColor(BillCardPanel cardPanel, ArrayList colorString, Color color) BillItem bis = cardPanel.getBillData().getHeadItems();if (bis = null) return;/ 還原所有背景色setBackColor(bis, cardPanel.getBackground();/ 設(shè)置指定前景色setForegroundColor(bis, colorString, color);/* * * 為當前BillItem數(shù)組設(shè)置label組件的背景顏色 參數(shù)說明 */private static void setBackColor(BillItem bis, Color color) for (int i = 0; i bis.length; i+) UILabel label = bisi.getCaptionLabel();label.setBackground(color);/* * 根據(jù)cols集合中指定的名稱,來對BillItems數(shù)組元素中的label組件設(shè)置前景色 */private static void setForegroundColor(BillItem bis, ArrayList cols, Color color) for (int i = 0; i cols.size(); i+) if (cols.get(i) = null & .equals(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();/ 使該組件繪制其邊界內(nèi)的所有像素label.setOpaque(true);/ 設(shè)置前景色為用戶指定的顏色label.setForeground(color);34. 設(shè)置表格底顏色/* * 創(chuàng)建者:晁志平 功能:設(shè)置表格的Tailer顏色 參數(shù): 返回: 例外: 日期: */public static void setBillCardTailColor(BillCardPanel bcpBillCardPanel, ArrayList alColChangeColorString, Color color) BillItem biBillItems = bcpBillCardPanel.getBillData().getTailItems();if (biBillItems = null | biBillItems.length = 0) PubUtils.eatException(當前表體沒有任何元素,要為表體設(shè)置顏色,請確認是否為“主子表”、“單表頭”, new Exception(當前表體沒有任何元素,要為表體設(shè)置顏色,請確認是否為“主子表”、“單表頭”);return;/ 還原所有背景色setBackColor(biBillItems, bcpBillCardPanel.getBackground();/ 設(shè)置指定前景色setForegroundColor(biBillItems, alColChangeColorString, color); 上面這兩個方法的實現(xiàn)在設(shè)置表格表頭的方法中有35. 是否可以輸入數(shù)字 /* * * 設(shè)置是否可以輸入數(shù)字 (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 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) txtItem = (UITextField) item.getComponent();return txtItem;36. 設(shè)置是否可以輸入英文字母/* * * 設(shè)置是否可以輸入英文字母(大小寫)(az)(AZ) */public static void setAllowAlphabetic(BillItem item, Boolean isEnable) if (PubUtils.isNotNull(item) UITextField txtItem = getTextField(item);if (PubUtils.isNotNull(txtItem) txtItem.setAllowAlphabetic(isEnable);37. 從服務(wù)器上下載文件并且復制到指定目錄/* * * 方法功能描述:從服務(wù)器上下載文件并且復制到指定目錄。 */public static void downloadFileToDirectory(String packName, String dstPackName) String downloadpack = packName.replace(/, .);downloadFile(downloadpack);copyDirectory(new File(UiUtils.getCodeCachePath() + / + packName), new File(dstPackName);/* * * 方法功能描述:從服務(wù)器上下載文件。 */public static void downloadFile(String packName) Map vidMap;vidMap = VIDManager.getInstance().getClientVID();if (null = vidMap) / 讀取本地版本try vidMap = Util.readFromFile(UiUtils.getCodeCachePath() + /Version/ + 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 listvid = new ArrayList();for (VID fileVID : fileVIDs) listvid.add(fileVID);try String oriFilePath = ServiceConfig.getFileBase();String oriBaseHttpURL = ServiceConfig.getBaseHttpURL();ServiceConfig.setFileBase(getCodeCachePath();ServiceConfig.setBaseHttpUR

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論