公式相关
1.显示公式没执行
列表界面显示,卡片界面不显示:
Handler的onBoCard执行:
| getBillCardPanel().execHeadLoadFormulas(); |
Controller的isLoadCardFormula返回true
另外,字段录入长度不够时,列表显示,卡片不显示
2.带出数据执行公式
表头显示公式,执行
| getBillCardPanel().execHeadLoadFormulas(); |
表体显示公式,执行
| getBillCardPanel().getBillModel().execLoadFormula(); |
补充:上面是最简单的方法,其它自己测试。比如,指定表体行执行公式:
| |
| getBillCardPanel().execBodyFormula(i, "pk_supdoc"); |
UI
1.列表界面设置可多选
| public ClientUI(){ |
| super(); |
| getBillListPanel().setMultiSelect(true); |
| } |
2.查询条件
| UIDialog dlg = getQueryUI(); |
| if(dlg.showModal() != 1) return; |
| INormalQuery query = (INormalQuery)dlg; |
| String sql = query.getWhereSql(); |
3.隐藏表体字段
| BillData bs = getBillCardPanel().getBillData(); |
| BillItem[] items = bs.getBillModel().getBodyItems(); |
| for (int i = 0; i < items.length; i++) { |
| items[i].setShow(false); |
| } |
| getBillCardPanel().setBillData(bs); |
4.隐藏表头字段
| |
| billCardPanel.getHeadItem("hzdy42").getComponent().setVisible(false); |
| billCardPanel.getHeadItem("hzdy42").getCaptionLabel().setText(""); |
| |
| |
| billCardPanel.hideHeadItem(new String[] {"hzdy38","hzdy39","hzdy40","hzdy41","hzdy42"}); |
5.将AggVO显示到单据界面上
| billCardPanel.setBillValueVO(aggvo); |
系统变量相关
1.单据号
前置任务:配置单据号规则
创建单据号:
| new HYPubBO().getBillNo(单据类型, 组织, null, null); |
或者:
| getVbillCode(单据类型,组织); |
| new BillcodeGenerater ().getBillCode (单据类型, 组织,null,null); |
或者
| |
| IBillcodeManage iBillcodeManage = (IBillcodeManage) NCLocator.getInstance().lookup(IBillcodeManage.class.getName()); |
| String billNo = iBillcodeManage.getBillCode_RequiresNew("YX72", "集团主键", "组织主键", new BXHeaderVO()); |
2.主键
| KeyGenerator.getInstance().getKey(20); |
3.获取nchome路径
| RuntimeEnv.getInstance().getNCHome(); |
4.系统变量
| InvocationInfoProxy |
| WorkbenchEnvironment |
| ClientEnvironment |
5.设置客户端背景色
| F:\NC63\AceHome\ierp\sf\themeconf.xml |
模块相关
1.添加模块
| META-INF里面必须有module.xml,Sysconfig下才能找到该模块 |
2.单据类型没有定义所属模块
产生这个异常的原因是:单据类型没在添加在项目模块里,而是在自己的模块里,在单据类型表里:bd_billtype,把单据的systemcode改为项目模块即可
单据动作相关
1.动作注册
从pub_billaction表里复制其它单据的动作,修改单据类型、ID即可
2.动作代码路径
modules -> 单据类型所在模块 -> META-INF -> var -> source
3.按钮显示
只显示isEnabled()==true的按钮:
| int[] btnAry = ((LController) getUIManageController()).getCardButtonAry(); |
| |
| for (int i = 0 |
| getBillUI().getButtonManager().getButton(btnAry[i]).setVisible(getBillUI().getButtonManager().getButton(btnAry[i]).isEnabled()); |
| } |
单据模版相关
1.下拉字段
数据库里保存的是 0、1、2、3.。。。所以vo里对应Integer
| getBillCardWrapper().initHeadComboBox("vname", new String[]{"A","B","C"}, true); |
2.日期型字段
单据模板是日期型时,vo要为UFDate
3.日期型默认取值
4.查询所有的默认查询条件
5.调用模板
数据库操作相关
1. HYPubBO_Client
findColValue方法只能查询字符型字段(因为这个方法内嵌了String强转)
2.JdbcSession
| JdbcSession session = null; |
| session = PersistenceManager.getInstance().getJdbcSession(); |
| session = JdbcSessionUtil.createJdbcSession(); |
密码相关
1.root密码修改
补丁相关
1.如何打补丁
在modules里找到相应的模块,将public、private、client下的代码导出的jar包放到模块的lib文件夹下,开发工具重新加载下即可(怎么重新加载?--重启,再重启,直到开发工具能加载到刚导入的jar包里的类)
运行相关
1.启动中间件报错
2.startup.bat启动服务卡着不动
元数据相关
1.单据日期
配置文件相关
1.配置文件变量名写错
节点相关
1.打开其它节点
直接点开指定的节点,没有数据:SFClientUtil.openFrame("ZZ0102"); // 下面的还没测试
参照相关
1.表头参照多选取值
| ((UIRefPane) billCardPanel.getHeadItem("hzdy41").getComponent()).getRefModel().getPkValues(); |
2.动态指定参照类
| ((UIRefPane)(getBillCardPanelWrapper().getBillCardPanel().getHeadItem("段").getComponent())).setRefModel(参照类.class); |
3.设置参照是否支持多选
| ((UIRefPane)editor.getBillCardPanel().getHeadItem("vpsn").getComponent()).setMultiSelectedEnabled(true); |
4. 设置参照只显示一级
5.参照字段实现手输
6.如何知道一个字段的参照类型:
| Object obj = ((UIRefPane)getBillCardPanel().getHeadItem("").getComponent()).getRefModel(); |
| Syttem.out.println(obj); |
下拉相关
1. 下拉去掉空白选项
预警
1.配置
其它
1.命名规则
2.表空间的概念
3.获取用户有权限的组织
实用方法
1.获取表体所有页签名
| getBillCardPanel().getBillData().getBodyTableCodes(); |
2.获取表体指定行的vo
| getBillModel("页签名").getBodyValueRowVO(rownum, className); |
3.单据状态栏打印消息
| ShowStatusBarMsgUtil.showStatusBarMsg |
| |
4.获取ts
| CurTime.getCurrentTimeStampString(); |
5.创建主键
| |
| SequenceGenerator uidUtils = new SequenceGenerator(); |
| uidUtils.generate(); |
6. 保留小数点后2位,并“四舍五入”
| new UFDouble().setScale(2, UFDouble.ROUND_HALF_UP); |
7. 处理按钮控制是否可用
在新建按钮组中添加如下方法
| |
| |
| |
| |
| @Override |
| protected boolean isActionEnable() { |
| if ((getModel().getSelectedOperaDatas() == null) || (getModel().getSelectedOperaDatas().length == 0)) { |
| return false; |
| } |
| return true; |
| } |
重点在setModel中时一定要添加
| model.addAppEventListener(this); |
| |
| public void setModel(PsndocMdmModel model) { |
| this.model = model; |
| model.addAppEventListener(this); |
| } |
8. ComBox设置方式以及常用方法
| nc.ui.uif2.components.CommonConfirmDialogUtils --- 处理弹框显示 |
| showConfirmDeleteDialog() |
| |
| MessageDialog.showErrorDlg(this.getBillForm(), "警告", "请先选择发货仓库再进行替代品选择!!"); |
| |
| |
| |
| |
| String TITLE = ResHelper.getString("ht100101", "ht100101006"); |
| String QUESTION = ResHelper.getString("ht100101", "ht100101006"); |
| int msg = MessageDialog.showYesNoDlg(getParent(), TITLE, QUESTION, 8); |
| String stryear = comyear.getSelectedItem().toString(); |
| |
| comyear = new UIComboBox(); |
| |
| comyear.addItem("执行ComBox显示的内容 --- 可以参考上面方法写到配置文件中"); |
9.逻辑更新页面字段值
| |
| getEditor().getBillCardPanel().setHeadItem("state", state); |
| |
| |
| "不同的地方在于调用的方法" |
| this.model.directlyUpdate(this.getModel().getSelectedData()); |
| |
| this.model.directlyUpdate(this.getModel().getSelectedOperaDatas()); |
10.物理刷新页面字段值
| |
| <property name="dataManager"><ref bean="bmModelModelDataManager"/> </property> |
| |
| private (bmModelModelDataManager -- 对应的class类) dataManager |
| |
| |
| getDataManagers().refresh(); |
11.按钮方法重写
| afterDoActionFailed |
| afterDoActionSuccessed |
| beforeDoAction |
12.元数据升级操作
// 以本地账号为例
// 需要使用管理员账号lz登陆
// 登陆后搜索 -- 元数据管理
// 即可进行升级操作
13.NC65加减乘除计算函数
| ufDouble.add(1.0); |
| ufDouble.sub(1.0); |
| ufDouble.multiply(1.0); |
| ufDouble.div(1.0); |
13.NC65登录信息获取
| |
| InvocationInfoProxy.getInstance().getGroupId() |
| |
| InvocationInfoProxy.getInstance().getUserId() |
| |
| WorkbenchEnvironment.getInstance().getLoginUser() .getUser_code() |
| |
| new UFDateTime(System.currentTimeMillis()) |
| |
| UserVO user = WorkbenchEnvironment.getInstance().getLoginUser(); |
14.页面查询功能添加自定义查询条件
| package nc.ui.yxzy.yx.depositpool.action; |
| |
| import nc.ui.pubapp.uif2app.query2.action.DefaultQueryAction; |
| import nc.ui.querytemplate.querytree.IQueryScheme; |
| |
| public class NewQueryAction extends DefaultQueryAction { |
| |
| |
| |
| |
| private static final long serialVersionUID = 1L; |
| public static final String QUERY_CONDITION = "all_condition"; |
| |
| public static final String KEY_SQL_WHERE = "where"; |
| |
| public static final String KEY_SQL_TABLE_LIST = "tablelist"; |
| |
| public static final String KEY_SQL_TABLE_JOIN = "tablejoin"; |
| |
| @Override |
| protected void executeQuery(IQueryScheme queryScheme) { |
| |
| if (queryScheme != null) { |
| |
| String funnode = getFunNode(); |
| |
| if (funnode.equals("YX601010")) { |
| |
| Object sql = queryScheme.get(KEY_SQL_TABLE_JOIN); |
| |
| if (sql instanceof nc.ui.querytemplate.querytree.FromWhereSQLImpl) { |
| |
| nc.ui.querytemplate.querytree.FromWhereSQLImpl fsi = (nc.ui.querytemplate.querytree.FromWhereSQLImpl) sql; |
| |
| String fromsql = fsi.getWhere(); |
| |
| if (fromsql != null) { |
| |
| fromsql = fromsql + " and pk_id = '1001G11000000000222R' and YXZY_DEPOSITPOOL_B.vbdef1 = '1'"; |
| } |
| |
| fsi.setWhere(fromsql); |
| } |
| } |
| } |
| |
| super.executeQuery(queryScheme); |
| } |
| } |
15.前台查询使用方法
| IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class); |
| Object countMap = bs.executeQuery(sql, new MapProcessor()); |
16、读取以及修改数据源
| |
| String oldDataSourceName = InvocationInfoProxy.getInstance().getUserDataSource(); |
| |
| InvocationInfoProxy.getInstance().setUserDataSource("数据源"); |
17.按钮快捷键功能
| |
| import javax.swing.Action; |
| import javax.swing.KeyStroke; |
| import java.awt.event.InputEvent; |
| import java.awt.event.KeyEvent; |
| |
| |
| KeyStroke keyStore = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK); |
| |
| this.putValue(Action.ACCELERATOR_KEY, keyStore); |
18.导入导出按钮组
| <bean id="importExportMenu" class="nc.funcnode.ui.action.MenuAction"> |
| <property name="code" value="importExport" /> |
| <property name="name" value="导入/导出" /> |
| <property name="actions"> |
| <list> |
| <ref bean="ImportData" /> |
| <ref bean="ExportData" /> |
| <ref bean="ExportTemplate" /> |
| </list> |
| </property> |
| </bean> |
| |
| <bean id="ImportData" class="nc.ui.uif2.excelimport.ImportAction"> |
| <property name="model" ref="bmModel" /> |
| <property name="importableEditor" ref="ImportExportEditor" /> |
| <property name="btnName" value="导入Excel" /> |
| </bean> |
| |
| <bean id="ExportTemplate" class="nc.ui.uif2.excelimport.ExportExcelTemplateAction"> |
| <property name="model" ref="bmModel" /> |
| <property name="importableEditor" ref="ImportExportEditor" /> |
| <property name="btnName" value="导出模板" /> |
| </bean> |
| |
| <bean id="ExportData" class="nc.ui.uif2.excelimport.ExportAction"> |
| <property name="model" ref="bmModel" /> |
| <property name="importableEditor" ref="ImportExportEditor" /> |
| <property name="btnName" value="导出Excel" /> |
| </bean> |
| |
| <bean id="ImportExportEditor" class="nc.ui.ic.eneryconsumption.excel.EneryConsumeImportableEditor"> |
| <property name="billcardPanelEditor" ref="billForm" /> |
| <property name="addAction" ref="addAction" /> |
| <property name="cancelAction" ref="cancelAction" /> |
| <property name="saveAction" ref="saveScriptAction" /> |
| <property name="appModel" ref="bmModel" /> |
| </bean> |
EneryConsumeImportableEditor文件代码
| package nc.ui.ic.eneryconsumption.excel; |
| |
| import java.util.List; |
| import nc.ui.trade.excelimport.InputItem; |
| import nc.ui.pubapp.uif2app.view.util.BillPanelUtils; |
| import nc.ui.tmpub.field.affect.util.FieldValueUIUtil; |
| import nc.ui.trade.excelimport.Uif2ImportablePanel; |
| import nc.ui.uif2.excelimport.DefaultUIF2ImportableEditor; |
| import nc.vo.pub.ExtendedAggregatedValueObject; |
| |
| |
| |
| |
| |
| |
| |
| public class EneryConsumeImportableEditor extends DefaultUIF2ImportableEditor{ |
| @Override |
| protected void setProcessedVO(ExtendedAggregatedValueObject eavo) { |
| |
| getAppModel().getContext().setPk_org(FieldValueUIUtil.getPkOrg(eavo,getBillcardPanelEditor())); |
| BillPanelUtils.setOrgForAllRef(getBillcardPanelEditor().getBillCardPanel(), getAppModel().getContext()); |
| super.setProcessedVO(eavo); |
| } |
| |
| @Override |
| public List<InputItem> getInputItems() { |
| return super.getInputItems(); |
| } |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步