接口开发知识点整理三

导读:本篇文章讲解 接口开发知识点整理三,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

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;
/**
* <H3>作用:</H3>执行 按钮的处理方法<BR>
* @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<Object[]> list = (List<Object[]>) 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<List<String>> pr_value = new ArrayList<List<String>>();
for (int i = 0; i < sInvProducePKs.length; i++) {
    ArrayList<String> pr_row = new ArrayList<String>();
    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<list.size();i++){
            Object[] obj = (Object[]) list.get(i);
            String invpk, virtualFlag, createFlag;
            invpk = BFPubTool.getString_TrimAsNull(obj[0]);
            virtualFlag = BFPubTool.getString_TrimAsNull(obj[1]);
            createFlag = BFPubTool.getString_TrimAsNull(obj[2]);
            map.put(invpk, new UFBoolean(createFlag != null && new UFBoolean(createFlag).booleanValue()));
          }
    }
} catch (DAOException e) {
    throw new SQLException("查询bd_produce 错误");
}
//zhangjing end
UFBoolean[] retFlags = new UFBoolean[sInvProducePKs.length];
    for (int i = 0; i < sInvProducePKs.length; i++) {
        retFlags[i] = map.containsKey(sInvProducePKs[i]) ? (UFBoolean) map.get(sInvProducePKs[i]) : new UFBoolean(false);
    }
    return retFlags;
}

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)

<!-- 打开节点监听 -->
<bean id="InitDataListener" class="nc.ui.czyplan.pub.listener.FuncNodeInitDataListener">
<property name="model" ref="manageAppModel" />
<property name="context" ref="context"></property>
<property name="cardForm" ref="billFormEditor" />
<property name="listView" ref="listView" />
<property name="container" ref="actionsOfList"></property>
<!-- VO的类名 -->
<property name="voClassName" value="nc.vo.czyplan.czyplan_bpickm.AggCzy_pickm" />
<!-- 打开节点节点后要显示的界面 -->
<property name="autoShowUpComponent" ref="billFormEditor" />
</bean>

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复制出没有权限的节点

原节点:委外订单维护

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

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/111709.html

(0)
Java光头强的头像Java光头强

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!