NC二开常见问题

1. 表头字段不可见

getHeadItem("").setShow(false);

2. 在单据或报表中,设置表体中的0.00显示或显示为空
在单据中,如下设置:

//表体行可以显示0.00
getBillCardPanel().getBodyPanel().getRendererVO().setShowZeroLikeNull(false);
在报表中,如下设置:
//设置不显示零
getReportBase().getBodyPanel().getRendererVO().setShowZeroLikeNull(true);

3. 在程序查询过程中,加入"请等待 …"的提示框

//线程
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 Thread(checkRun).start();

4. 发送邮件

MailTool.sendHtmlEmail(smtpHost, fromAddr, senderName, userName, password, receivers, subject, sb, fileName);

案例如下:

Logger.info("==================");
Logger.info(">> 发送HTML邮件PfMailAndSMSUtil.sendHtmlEmail() called");
Logger.info("==================");

String smtpHost = "smtp.ym.163.com";//
String fromAddr = "xxxx@163.com";//发件人邮箱地址
String userName = "xxxx@163.com";//邮箱账号
String password ="";//邮箱密码
String senderName ="xxxx@163.com";//发件人名称

// XXX::接收地址必须以","分隔
//  StringBuffer receivers = new StringBuffer();
//  for (int i = 0; i < recEmails.length; i++) {
//   receivers.append(recEmails[i]);
//   receivers.append(",");
//  }

try {
 StringBuffer sb = new StringBuffer();
 sb.append("测试1");
//   Logger.info("邮件接收者receivers=" + receivers);

//下面代码是最核心的代码
 MailTool.sendHtmlEmail(smtpHost, fromAddr, senderName, userName,password, "收件人邮箱(可以直接维护qq,163等邮箱)", "主题", sb, fileName); 

//filename是附件地址,维护本地文件的绝对路径,不维护为“”
} catch (Exception e) {
 Logger.error(e.getMessage(), e);
 System.out.println(e.getMessage());
 throw new PFBusinessException(
   NCLangRes4VoTransl.getNCLangRes().getStrByID("pfworkflow",
     "PfMailAndSMSUtil-000005", null,
     new String[] { e.getMessage() })/* 错误:发送Email失败:{0} */,
   e);
}
System.out.println();

如果执行的时候报错连接不上,是因为端口号25,这个问题我也不知道如何在NC解决

5. 列表表体加afterEdit监听方法

getBillListPanel().getBodyScrollPane(“页签表名”).addEditListener(this);

触发afterEdit(BillEditEvent e)方法

6. 表体按照recordnum倒序排列,类似定调资表体

getBillListPanel().getBodyBillModel().setSortColumn(“recordnum”);
getBillListPanel().getBodyBillModel().getSortColumns().get(0).setAscending(false);

7. 表头最大化设置方法

getBillListPanel().getUISplitPane().getRightComponent().setVisible(false);

8. 登陆界面的日期设置不可修改
有个配置文件可以直接修改的。

nchome\ierp\bin\clientui.xml

在这里插入图片描述

9. 在UI中得到的变化VO方法

getBillCardPanel().getBillValueChangeVO

是从页面得到的VO,如果修改查询出来的数据,当查询出来的数据如果没有主键的话,那得到得VO主键就是null的。

10. 在修改的方法中,如果是根据主键为条件进行修改,主键不能通过

key = getOID(storeadmin.getPk_corp());//得到主键,因为这是新生成的,要使用以前的主键,key= storeadmin.getPrimarykey();

11. 生成单据号的方法:

String billcode= HYPubBO_Client.getBillNo(getUIControl().getBillType(),
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, null); // 设置单据号

//取得单据号(从NC取,客户端)
return HYPubBO_Client.getBillNo(getUIControl().getBillType(), _getCorp().getPrimaryKey(), null, null);

12. 验证非空

@Override
protected void onBoSave() throws Exception {
	this.getBillCardPanelWrapper().getBillCardPanel().getBillData().dataNotNullValidate();
	super.onBoSave();
}

13. 实现多选

getBillListPanel().getHeadTable().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

遇到几次列表界面可多选,但取值难的问题,现总结如下:

//设置列表多选框
getBillListPanel().setMultiSelect(true);
//设置列表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. 实现选择框全选全消小按钮

import nc.ui.hr.frame.util.table.TableMultiSelHelper;
headTableMultiSelector headTableMultiSelector = new TableMultiSelHelper();
headTableMultiSelector.addMultiSeletor(getBillListPanel().getHeadTable());

15. 分别从卡片、列表中取得表头、表体VO数组的方法

//列表界面
if (getSelfUI().isListPanelSelected()) {
	int rowCount = getSelfUI().getBillListPanel().getHeadBillModel().getRowCount();
	
	if (rowCount == 0) {
		getSelfUI().showWarningMessage("没有可以确认的数据!");
		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("没有可以确认的数据!");
		return;       
	}
	
	try {
		//在卡片界面取得表头VO
		hvo = (Df1BmsqHVO)getBufferData().getCurrentVO().getParentVO();
		//在卡片界面取得表体VO
		bvos = (Df1BmsqBVO[])getBufferData().getCurrentVO().getChildrenVO();
	} catch (Exception e) {
		e.printStackTrace();
	}
}

16. 得到行号数组

Int []rows= ui.getBillListWrapper().getBillListPanel().getHeadTable().getSelectedRows();

17. 得到当前行的聚合VO

AggRequirepubVO aggRequirepubVO= (AggRequirepubVO)ui.getBillListWrapper().getBillListPanel().getBillValueVO(iCurRow,AggRequirepubVO.class.getName(),
HeadVO.class.getName(), BodyVO.class.getName());

18. 得到行号,得覆盖这个方法

@Override
public void bodyRowChange(BillEditEvent e) {
// TODO Auto-generated method stub
	iCurrRow = e.getRow();
}

19. 自定义按钮的使用
需要在ui中覆盖这个方法

@Override
protected void initPrivateButton() {
	// TODO Auto-generated method stub
	PublicVO publicVO = new PublicVO();
	addPrivateButton(publicVO.getPublicButtonVO());
	addPrivateButton(publicVO.getUnpublicButtonVO());
	}
	PublicVO 是自己创建的按钮VO
	
	package 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("发布");
	            btnVo.setHintStr("发布");
	            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("取消发布");
			btnVO.setHintStr("取消发布");
			btnVO.setOperateStatus(new int[] { IBillOperate.OP_EDIT,IBillOperate.OP_NOTEDIT });
	        btnVO.setBusinessStatus(new int[] {IBillStatus.FREE});
		}
		return btnVO;
	}
}

IMyButton是定义按钮的接口:

public interface IMyButton {
//发布按钮
public final static int publicBtn = 185;
//取消发布按钮
public final static int unpulicBtn = 186;
}

20. 下拉框的定义,在initSelfData()方法中

@Override
protected void initSelfData() {
	// TODO Auto-generated method stub
	// 发布状态
	IConstEnum[] require_status= new DefaultConstEnum[]{new DefaultConstEnum(0, “未发布”),
	new DefaultConstEnum(1, “已发布”)};
	
	BillPanelUtils.initComboBox(getBillListPanel(), IBillItem.HEAD, null,RequirepubVO.PUBLICSTATUS, require_status, false);
	BillPanelUtils.initComboBox(getBillCardPanel(), IBillItem.HEAD, null,RequirepubVO.PUBLICSTATUS, require_status, false);
}

21. 向页面回写数据

((MainBillMgrPanel)getMainPanel()).getMainBillCardPanel().setHeadData(m_emptyJobVO);
((MainBillMgrPanel)getMainPanel()).getMainBillListPanel().setHeadSelectedData(m_emptyJobVO);

22. 比较日期的先后方法

ValidityChecker.validateDate(date1,date2,1,“给出校验的警告语句”);

23. 初始化下拉列

getBillCardWrapper().initHeadComboBox(“vbillstatus”, ISYYSBillStatus.strStateRemark, true);
getBillListWrapper().initHeadComboBox(“vbillstatus”, ISYYSBillStatus.strStateRemark, true);

24. 执行表头公式

getBillCardPanel().execHeadFormula("");
getBillCardPanel().execHeadEditFormulas();

25. 执行表体公式

//列表状态
getBillListPanel().getBodyBillModel().execEditFormulaByKey(i, “vdef2”);
//卡片状态
getBillCardWrapper().getBillCardPanel().execBodyFormula(i, “vdef2”);

//为参照增加约束
AbstractRefModel arm = UIUtilTools.getRefPane(item).getRefModel();
arm.addWherePart(" and dr=0 ");
arm.reloadData();

26. 自定义按钮添加至界面

ButtonVO editedplan = ButtonFactory.createButtonVO(ISHSHButton.LINK_KY_DETAIL, “修订计划”,“修订计划”);
editedplan.setOperateStatus(new int[] { IBillOperate.OP_NOTEDIT});
addPrivateButton(editedplan);

27. 当前单据的操作状态
设置是否可以编辑 getBillUI().getBillOperate()

//表体所有行
int rowsNum=getBillCardPanel().getBillModel().getRowCount();
int rowcount = getBillCardPanel().getBillModel("").getRowCount();
getBillCardPanelWrapper().getBillCardPanel().getHeadItem(“high”).setEnabled(false);

//初始上下游得单据状态(在DLG的构造方法里面加入)

BillItem billItem = getbillListPanel().getBillListData().getHeadItem(“vbillstatus”);
initComboBox(billItem, ISHSHBillStatus.strStateRemark,true);

设置是否合计和得到合计值
设置是否合计:
在initSelfData()方法中加入

getBillCardWrapper().getBillCardPanel().setTatolRowShow(true);

得到合计值:
首先设置显示合计行

getBillCardPanel().setTatolRowShow(true);

然后获取获取合计行的值

getBillCardPanel().getTotalTableModel().getValueAt(“行号”,“列字段”);

28. 隐藏表体某列

getBillCardPanel().hideBodyTableCol(“bodyitem”);

29. 表体带出表头

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. 行不可编辑方法
只有选中行可编辑的解决方法,当行可编辑

@Override
public 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. 非空校验方法:

/**
* 数据非空监测 hashFilter (billitem,int[rowindex]) 创建日期:(01-2-21 10:08:48)
*/
public static void dataNotNullValidate(BillData billdata, Hashtable<BillItem, int[]> hashFilter) throws ValidationException {
	StringBuffer message = null;
	BillItem[] headtailitems = billdata.getHeadTailItems();
	if (headtailitems != null) {
		for (int i = 0; i < headtailitems.length; i++) {
			if (headtailitems[i].isNull()) {
				if (PubUtils.isNull(headtailitems[i].getValueObject())) {
					if (message == null) {
						message = new StringBuffer();
					}
					message.append("[");
					message.append(headtailitems[i].getName());
					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 != null) {
		for (int t = 0; t < tableCodes.length; t++) {
			String tablecode = tableCodes[t];
			for (int i = 0; i < billdata.getBillModel(tablecode).getRowCount(); i++) {
				StringBuffer rowmessage = new StringBuffer();
				// 判断行状态是否可以编辑
				int editrow = billdata.getBillModel(tablecode).getEditRow();
				if (editrow != -1) { // 说明启动行编辑状态, 才继续判断 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", "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 = items[j];
					int[] rows = hashFilter != null ? hashFilter.get(item) : null;
					if (item.isNull()) {
						if (rows != null) {
							for (int ii = 0; ii < rows.length; ii++) {
								if (rows[ii] == 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. 设置背景颜色

/**
*
* 为当前BillItem数组设置label组件的背景颜色 参数说明
*
* @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 = bis[i].getCaptionLabel();
		label.setBackground(color);
	}
}

33. 设置表格表头的颜色

/**
* 创建者:晁志平 功能:设置表格的Header颜色
* 蒋力,修改原因:加入参数为空判断,改调用公共过程
*/
public static void setBillCardHeaderColor(BillCardPanel cardPanel, ArrayList colorString, Color color) {
	BillItem[] bis = cardPanel.getBillData().getHeadItems();
	if (bis == null) {
		return;
	}
	// 还原所有背景色
	setBackColor(bis, cardPanel.getBackground());
	// 设置指定前景色
	setForegroundColor(bis, colorString, color);
}

/**
*
* 为当前BillItem数组设置label组件的背景颜色 参数说明
*/
private static void setBackColor(BillItem[] bis, Color color) {
	for (int i = 0; i < bis.length; i++) {
		UILabel label = bis[i].getCaptionLabel();
		label.setBackground(color);
	}
}

/**
* 根据cols集合中指定的名称,来对BillItems数组元素中的label组件设置前景色
*/
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 = bis[j].getKey().trim();
			if (item.equals(col)) {
				// 获得当前表头组件的Label组件
				UILabel label = bis[i].getCaptionLabel();
				// 使该组件绘制其边界内的所有像素
				label.setOpaque(true);
				// 设置前景色为用户指定的颜色
				label.setForeground(color);
			}
		}
	}
}

34. 设置表格底颜色

/**
* 创建者:晁志平 功能:设置表格的Tailer颜色 参数: 返回: 例外: 日期:
*/
public static void setBillCardTailColor(BillCardPanel bcpBillCardPanel, ArrayList alColChangeColorString, Color color) {
BillItem[] biBillItems = bcpBillCardPanel.getBillData().getTailItems();
if (biBillItems == null || biBillItems.length == 0) {
PubUtils.eatException(“当前表体没有任何元素,要为表体设置颜色,请确认是否为“主子表”、“单表头””, new Exception(“当前表体没有任何元素,要为表体设置颜色,请确认是否为“主子表”、“单表头””));
return;
}
// 还原所有背景色
setBackColor(biBillItems, bcpBillCardPanel.getBackground());
// 设置指定前景色
setForegroundColor(biBillItems, alColChangeColorString, color);
上面这两个方法的实现在设置表格表头的方法中有
}

35. 是否可以输入数字

/**
*
* 设置是否可以输入数字 (0~9)
*/
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. 设置是否可以输入英文字母

/**
*
* 设置是否可以输入英文字母(大小写)(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. 从服务器上下载文件并且复制到指定目录

/**
*
* 方法功能描述:从服务器上下载文件并且复制到指定目录。
*/
public static void downloadFileToDirectory(String packName, String dstPackName) {
String downloadpack = packName.replace(/,.);
downloadFile(downloadpack);
copyDirectory(new File(UiUtils.getCodeCachePath() +/+ 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() + "/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<VID> listvid = new ArrayList<VID>();

	for (VID fileVID : fileVIDs) {
		listvid.add(fileVID);
	}

	try {
		String oriFilePath = ServiceConfig.getFileBase();
		String oriBaseHttpURL = ServiceConfig.getBaseHttpURL();
		ServiceConfig.setFileBase(getCodeCachePath());
		ServiceConfig.setBaseHttpURL(getSysURLBaseString());
		DownloadService.downloadClassFIle(packName, listvid, fileVIDs[0].getLocation(), 0);
		ServiceConfig.setFileBase(oriFilePath);
		ServiceConfig.setBaseHttpURL(oriBaseHttpURL);
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}


/**
* 拷贝文件夹 将srcDir下的所有文件拷贝到dstDir下
*/
public static void copyDirectory(File srcDir, File dstDir) {
// boolean isSuccess = false;
if (srcDir.isDirectory()) {
if (!dstDir.exists()) {
dstDir.mkdir();
}
String[] children = srcDir.list();
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(srcDir, children[i]), new File(dstDir, children[i]));
}
} else {
// This method is implemented in e1071 Copying a File
copyFile(srcDir, dstDir);
}
}

38. 大文件拷贝的问题

/**
* 通过NIO的方式拷贝文件,可以解决大文件拷贝的问题
*
*/
public static void copyFile(File srcDir, File dstDir) {
FileChannel srcChannel = null;
FileChannel dstChannel = null;
try {
// Create channel on the source
srcChannel = new FileInputStream(srcDir).getChannel();

		// Create channel on the destination
		dstChannel = new FileOutputStream(dstDir).getChannel();

		// Copy file contents from source to destination
		dstChannel.transferFrom(srcChannel, 0, srcChannel.size());

		// Close the channels
		srcChannel.close();
		dstChannel.close();
	} catch (IOException e) {
		Logger.error("", e);
	} finally {
		try {
			if (srcChannel != null && srcChannel.isOpen()) {
				srcChannel.close();
			}
			if (dstChannel != null && dstChannel.isOpen()) {
				dstChannel.close();
			}
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
}

39. 单点登录,从NC中跳转到浏览器的方法
比如点上传按钮,跳转到浏览器的方法,在上传方法中加入

Runtime.getRuntime().exec(“explorer “”+address+"");

其中address为网址

40. 导凭证的时候,报以下错误是怎样解决的
异常信息: GlPeriodBO::getPeriod(pk_glorgbook,date) Exception!
原因:
客户有可能用的xml是旧模板
日期字段和新模板的不一致
你对比一下他的模板和你的模板字段是否一致

即:当使用用友NC的应用集成手动导入凭证,日志显示
GlPeriodBO::getPeriod(pk_glorgbook,date) Exception!
异常错误时

可将XML文件中的< date>< /date > 改为< prepareddate>< /prepareddate>

因为NC软件中识别的是< prepareddate>< /prepareddate>而非< date>< /date>

41. 获得当前登录的数据源

PfUtilUITools.getLoginDs()

42. 获得当前登录的账簿主键

String pk_loginGlorgbook = ((GlorgbookVO)nc.ui.pub.ClientEnvironment.getInstance().getValue(ClientEnvironment.GLORGBOOKPK)).getPrimaryKey();

43. 查询某模块是否启用,是否启用模块

ICreateCorpQueryService接口 有个 isEnabled(pk_corp, nc.vo.pub.ProductCode.PROD_IC))

44. 字段宽度

//表头
String date_name = getBillListPanel().getHeadItem(“doperatordate”).getName(); //首先取得该字段的汉字名称,因为汉字名称可能会因修改模板而发生变化
getBillListPanel().getHeadTable().getColumn(date_name).setPreferredWidth(100); //使用该方法,可以仅修改列表状态下的字段宽度

//表体
String wlbm_name = getBillListPanel().getBodyItem(“vwlbm”).getName();
getBillListPanel().getBodyTable().getColumn(wlbm_name).setPreferredWidth(300);

45. 汉化配置文件(中文配置文件)

在F:\nchome57\langlib中找到相应模块的jar包,然后解压可以找到。

46. 根据帐套编码查询数据源名称

dsName = AccountXMLUtil.findDsNameByAccountCode(accountCode);

原文链接:https://blog.csdn.net/qq_33639332/article/details/83789399

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值