接口开发知识点整理三

41.表体编辑后,编辑物料多选,自动带出多行表体

AceBodyAfterEditHandler类

String key = e.getKey();
if (key.equals("pk_material")) {
nc.ui.czyplan.randomdata.handler.MaterialHandler handler = new nc.ui.czyplan.randomdata.handler.MaterialHandler();
handler.afterEdit(e);
}

MaterialHandler 类

/**
* 物料的编辑事件处理类
*/
public class MaterialHandler {
/**
* 物料的编辑后事件处理
* @param e 编辑后事件
*/
public void afterEdit(CardBodyAfterEditEvent event) {
// 物料的多选处理
RefMoreSelectedUtils utils = new RefMoreSelectedUtils(event.getBillCardPanel());
int[] rows = utils.refMoreSelected(event.getRow(), OrderItemVO.PK_MATERIAL, true);
}
/**
* 物料的编辑前事件处理
* @param e 编辑前事件处理
*/
public void beforeEdit(CardBodyBeforeEditEvent e) {
BillCardPanel panel = e.getBillCardPanel();
// 设置物料的参照允许多选
UIRefPane refPane = (UIRefPane) panel.getBodyItem(e.getKey()).getComponent();
refPane.setMultiSelectedEnabled(true);
e.setReturnValue(Boolean.TRUE);
}
}

43.显示错误信息

private void showErrorMessage(String title, String content) {
String newTitle = title;
String newContent = content;
MessageDialog.showErrorDlg(getBillUI(), newTitle, newContent);
}

44.NC57 页面底下报错信息

import nc.ui.pub.beans.MessageDialog;
/**
* 

作用:

执行 按钮的处理方法
* @throws BusinessException */ private void execute() throws BusinessException { UFDateTime beginTs = new UFDateTime(System.currentTimeMillis()); UFDateTime endTs = null; StringBuffer sb = new StringBuffer(); int type = 0; ITaskMaintain taskbtn = NCLocator.getInstance().lookup(ITaskMaintain.class); int[] rows = getBillCardPanelWrapper().getBillCardPanel().getBillTable().getSelectedRows(); if(rows.length > 1){//选中行大于一行时,报错 ExceptionUtils.wrappBusinessException("只能选中一行数据!"); return; }else{ TaskVO selectVo = (TaskVO)getBillCardPanelWrapper().getBillCardPanel().getBodyPanel().getTableModel().getBodyValueRowVO(rows[0],TaskVO.class.getName()); StringBuffer result2 = this.checkTaskVO(selectVo); if(result2 !=null && result2.length()>0){ MessageDialog.showHintDlg(null, "提示", result2.toString()); return; }else{ taskbtn.ExecuteTaskorNotExecuteTask(selectVo,type,_getOperator(),sb); if(sb !=null && sb.length()>0){ // throw new BusinessException(sb.toString()); this.showErrorMessage("执行失败",sb.toString()); return; }else{ endTs = new UFDateTime(System.currentTimeMillis()); StringBuilder newMsg = new StringBuilder(); newMsg.append("开始时间:"); newMsg.append(beginTs.toString()); newMsg.append("结束时间:"); newMsg.append(endTs.toString()); getBillUI().showHintMessage("执行成功!" + newMsg.toString()); MessageDialog.showHintDlg(this.getBillUI(),"提示","【执行】操作成功!"); } } } }

45.获取程序运行了多长时间

long starttime = System.currentTimeMillis();
long endtime = System.currentTimeMillis();
System.out.println("新增【物料消耗其他厂消耗汇总】完成,耗时:"+ (endtime - starttime) / 1000 + "秒,操作结束时间 :"+new UFDateTime() );

46.NC57获取当前时间

new UFDateTime(System.currentTimeMillis());

47.查询方法

IUAPQueryBS iq = NCLocator.getInstance().lookup(IUAPQueryBS.class);// 查
String sql = "select user_name,cuserid from sm_user where "
RefPubUtil.getInSubSql("user_name", creatorList.toArray(new String[0]));
List list = (List) iq.executeQuery(sql,new ArrayListProcessor());
for(Object[] s : list){
creatorMap.put(ValueUtils.getInstance().getString(s[0]), ValueUtils.getInstance().getString(s[1]));
}

48.调用转换规则

PurchaseInaggvo 上游aggvo 上游单据类型 45
MaterialOutVO 下游aggvo 下游单据类型 4D
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
MaterialOutVO[] MaterialOutVOaggvo = PfServiceScmUtil.executeVOChange("45", "4D",new AggregatedValueObject[]{PurchaseInaggvo});

49.设置单据类型的SQL(不懂)

为了配置【单据转换规则】

UPDATE bd_billtype SET bd_billtype.forwardbilltype='4K,5X,55AC,4D,55A2,4455,55C2,55B4,422X' WHERE pk_billtypecode='55A3';

-- 下游单据类型表

insert into bd_fwdbilltype (DR, ISBIZFLOWBILL, ISCROSSGRP, PK_BACKBILLTYPE, PK_BILLTYPE, PK_BILLTYPEID, PK_FWDBILLTYPE, TS) values (0, 'N', 'Y', '55A3', '422X', '55A3', '1001ZA1000000001P664', '2020-03-24 19:36:13');

--查询执行结果

SELECT * FROM bd_billtype WHERE pk_billtypecode='55A3';
SELECT * FROM bd_fwdbilltype WHERE pk_billtypeid='55A3' ;

50.调动作脚本

//流程平台动作处理 服务接口

IPFBusiAction ifbaction = null;
private IPFBusiAction getIPFBsiAction(){
    if(ifbaction == null){
        ifbaction = NCLocator.getInstance().lookup(IPFBusiAction.class);
    }
    return ifbaction;
}
SapplyBillVO[] obj= (SapplyBillVO[]) getIPFBsiAction().processAction("WRITE", "4455", null, destBill, null, null);
//55A3 上游 422X 下游
StoreReqAppVO[] reqAppaggvo = PfServiceScmUtil.executeVOChange("55A3", "422X",new AggregatedValueObject[]{aggvo});

51.创建临时表

public UFBoolean[] isCreateSubOrder(String[] sInvProducePKs) throws SQLException {
//zhangjing 2012-10-08 注销下面内容 ,重新编写。
//原因:由于数据有可能会很多,故要分批执行。
//创建临时表
ArrayList> pr_value = new ArrayList>();
for (int i = 0; i < sInvProducePKs.length; i++) {
    ArrayList pr_row = new ArrayList();
    pr_row.add(sInvProducePKs[i]);
    pr_value.add(pr_row);
}
String[] columns = new String[] { "pk_produce" };
String[] types = new String[] { "char(20)" };
String sTableName = null;
try {
    nc.bs.scm.pub.TempTableDMO tmpTable = new nc.bs.scm.pub.TempTableDMO();
    sTableName = tmpTable.getTempStringTable("pc_bfriend_produce", columns, types, null, pr_value);
} catch (Exception e) {
    throw new SQLException("创建临时表失败!");
}
if (sTableName == null) {
    throw new SQLException("创建临时表失败!");
}
Map map = new HashMap();
BaseDAO dao = new BaseDAO();
String sql = "select a.pk_produce, a.virtualflag, a.iscreatesonprodorder from bd_produce a ,"+ sTableName +" b where a.pk_produce = b.pk_produce and isnull(a.dr,0)=0 ";
try {
    ArrayList list = (ArrayList) dao.executeQuery(sql, new ArrayListProcessor());
    if(list !=null && list.size()>0){
        for(int i=0;i

52.表体集合塞aggvo

PickmItemVO[] bvos = bvoList.toArray(new PickmItemVO[bvoList.size()]);
aggvo.setChildrenVO(bvos);
SapplyBillVO destBill = new SapplyBillVO();
SapplyBillBodyVO destBody = returnBVO(bill);
SapplyBillHeadVO destHead = returnHVO(bill);
destBill.setParentVO(destHead);
destBill.setChildren(SapplyBillBodyVO.class, new SapplyBillBodyVO[]{destBody});

53.NC65中的MessageDialog弹框

//返回 确认=1 ,取消=2
int yn=MessageDialog.showOkCancelDlg(null, "提示", "");
//返回 是=4 ,否=8
int yesNo=MessageDialog.showYesNoDlg(null, "提示", "");
//输入框
Object value=MessageDialog.showInputDlg(null, "提示", "请输入人员编码","默认值");

54.插入有pk的数据

new BaseDAO().insertVOWithPK(PickmItemVO);

55.单据联查追溯的类

nc.impl.pubapp.linkquery.MultiSrcBillFinder.getSourceBill

56.单据界面选中数据,点击按钮,跳转到别的节点

按钮doAction里面调这个方法

TD02From55A3Bill handler = new TD02From55A3Bill();
handler.process(aggvo, bvos[0]);

这个类继承GeneralToBill

这个是基类

还需要改xml的监听(打开节点的监听,下游的xml)












Czy_pickmBillForm 继承 ShowUpableBillForm 这个类

nc.ui.pubapp.uif2app.view.ShowUpableBillForm

57.参照编辑后时间中设置多选后自动增行

if(tableCode.equals("id")){
    String key = e.getKey();
        if("pk".equals IgnoreCase(key)){
            RefMoreSelectedUtils utils = new RefMoreSelectedUtils(e.getBillCardPanel());
            utils.refMoreSelected(e.getRow(),key,true)
        }
}

58.nc中限制只能输入数字

if (e.getKey().equals("ifloor")){
    String ifloor = (String) e.getBillCardPanel().getHeadItem("ifloor").getValueObject();
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher isNum = pattern.matcher(ifloor);
    if(!isNum.matches()){
        MessageDialog.showErrorDlg(e.getBillCardPanel(), "提示", "楼层只能输入数字!");
        e.getBillCardPanel().setHeadItem("ifloor", null);
    }
}

59.NC65复制出没有权限的节点

原节点:委外订单维护

复制节点: 委外订单之维护

自己注册功能注册,挂在摸个节点下面,除了功能编码 和 功能名称 不一样,其他完全一样

60.持久化API

JDBC级增删改查实现类:nc.bs.dao.BaseDAO

JDBC级增删改工具接口:nc.itf.uap.IVOPersistence

JDBC级查询工具接口:nc.itf.uap.IUAPQueryBS

聚合VO查询实现类:nc.impl.pubapp.pattern.data.bill.BillQuery

单据VO级增删改查实现类:nc.impl.uif.pub.UifServiceImp

单据VO级增删改查接口:nc.itf.uif.pub.IUifService

单据VO级增删改查接口:nc.itf.uap.pf.IPFBusiAction

单据VO级增删改查工具类:nc.bs.trade.business.HYPubBO

单据VO级增删改查工具类:nc.ui.trade.business.HYPubBO_Client

附件管理接口:nc.bs.pub.filesystem.IFileSystemService

你可能感兴趣的:(用友,java,后端)