NC开发笔记指导

Posted 消失的那两年

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NC开发笔记指导相关的知识,希望对你有一定的参考价值。

修改端口

InvocationInfoProxy.getInstance().get().getUserCode();

前台

 

Nchome F:\JAVA\Projects\ERPEHROA\ufida\ufsoft\nchome\domain\server\conf

F:\JAVA\Projects\ERPEHROA\ufida\ufsoft\nchome\conf

Truncate Table [表名]menhe

ftp命令

service vsftpd  start

1.导入oracle数据库需要先建立用户然后在cdm下输入命令;

2.1档案

2.3单据

F5往下走会进入里面的方法里面;

F6就在本方法里面走;

F7跳出进入的方法;hang

F8 直接倒地

 

公司设置公司目录(集团)就可以在集团下插入数据时集团就自动进来;

 

public void afterEdit(BillEditEvent e) {

              // TODOAuto-generated method stub

              Object pkvalue =this.getBillCardPanel().getHeadItem("pk_message").getValueObject();

              String temKey =e.getKey();

              if(temKey.equalsIgnoreCase("")){

                     Object obj =e.getValue();

                     IUAPQueryBSiuap =(IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());

                     try {

                            //Objectobjvo = iuap.retrieveByPK(ProMessageVO.class, "");

                           

                            MyBillVOmvo = (MyBillVO)this.getChangedVOFromUI();

                            ProMessageVOhvo = (ProMessageVO)mvo.getParentVO();

                           

                            mvo.getChildrenVO();

                           

                            ProMessageVOvo = (ProMessageVO)HYPubBO_Client.queryByPrimaryKey(ProMessageVO.class,pkvalue.toString());

                            vo.getI_number();

                           

                     } catch(Exception e1) {

                            //TODO Auto-generated catch block

                            e1.printStackTrace();

                     }

              }

             

              super.afterEdit(e);

       }

 

1.修改时

//通过主键查询所有的vo 放到object里;

              Object pkvaluemap =this.getBillCardPanel().getHeadItem("pk_message").getValueObject();

//从页面通过一个字段 获取那个值

String a =getBillCardPanelWrapper().getBillCardPanel().getHeadItem("state").getValue();

 

2.从页面取值;

3.MyBillVO vo= (MyBillVO) getBufferData().getCurrentVO();

//通过下面的方法类的聚合VO;

                            MyBillVOmvo = (MyBillVO)this.getChangedVOFromUI();

                            //获得表头

                            ProMessageVOhvo = (ProMessageVO)mvo.getParentVO();

                            //获得标体

                            mvo.getChildrenVO();

 

//得到表体VO

CbGatheringBVO[]  bodyBVO =(CbGatheringBVO[])this.getBillCardPanelWrapper().getBillCardPanel().getBillModel("ps_cb_gathering_b").getBodyValueVOs(CbGatheringBVO.class.getName());

 

//用聚合VO得主键;只能在卡片管理下 才能获得主键

super.onBoCard();//卡片状态下

this.getBillUI().getChangedVOFromUI().getParentVO().getPrimaryKey();

 

3.从数据库里根据一个字段取值;

//声明一个接口

IUAPQueryBS iuap = (IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());

 

//根据那个字段查询有没有这条数据

                            Objectobjvo = iuap.retrieveByPK(ProMessageVO.class, "");

 

4,保存按钮时提示,验证在MyEventHandler

//方法重写

importnc.ui.pub.beans.MessageDialog;

protected void onBoSave() throws Exception {

              // TODOAuto-generated method stub

              this.getBillCardPanelWrapper().getBillCardPanel();

              MessageDialog.showWarningDlg(null,"提示", "项目编号已存在!");

              super.onBoSave();

       }

 

 

 

6.怎么获取一个VO

 

              SuperVO[] allProc =this.getBusiDelegator().queryByCondition(ZxProjectsetVO.class,"isnull(dr,0)=0");

                            HashMapprojectMapp = new HashMap();

                            if(allProc!= null) {

                                   intiLen = allProc.length;

                                   for(inti = 0; i < iLen; i++) {

                                          projectMapp.put((String)allProc[i].getAttributeValue("pk_corp"),(SuperVO)allProc[i]);

                                   }

                            }

                            for(int i = 0; i < queryVos.length; i++) {

                                   AggregatedValueObjectaVo = (AggregatedValueObject) Class

                                                 .forName(getUIControl().getBillVoName()[0])

                                                 .newInstance();

                                  

                                   ZxProjectsetVOresult = (ZxProjectsetVO)projectMapp.get(queryVos[i].getPrimaryKey());

 

 

在前台能获得任何VO的主键方法getPrimaryKey();

c:\\t.xml";

 

其中\\里面的第一个\为转义符号;因为\这个符号在java里面有特订的意思;要表示路径的话就要在加个转义符号;

IX,公司间调拨

7.

//通过一个sql语句(根据一个字段)查询一个VO;

IUAPQueryBS queryBS = (IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());  系统接口----可以查询时使用

CbGatheringVO cbGatheringVO = (CbGatheringVO)queryBS.executeQuery(sql,new BeanProcessor(CbGatheringVO.class));//可以根据sql语句来查询一个vo

 

queryBS.executeQuery(sql, new BeanListProcessor(UserVO.class));//得到UserVO的list

~~~~~~~~~~~~~~更新数据

nc.itf.uif.pub.IUifServicesrv=(nc.itf.uif.pub.IUifService)NCLocator.getInstance().lookup("nc.itf.uif.pub.IUifService");

 

 

//获取增加时的当前VO;

//    AggregatedValueObjectVOS = this.getBillUI().getVOFromUI();

//    DispatchsBillVO VO =(DispatchsBillVO) VOS.getParentVO();

//    VO.setRelatekey(relatekey);

 

HYPubBO_Client.insert(VO);//把VO插到数据库里面

//给表头页面set赋值

this.getBillCardPanelWrapper().getBillCardPanel().setHeadItem("relatekey", relatekey);

 

给表体赋值

getBillCardPanel().setBodyValueAt(值,行号,列名);

  //更新数据

      getBillUI().getBufferData().refresh();

8.光标移开时有验证不为空时;把当前文本清空

this.getBillCardPanel().getHeadItem("i_number").setValue(null);

 

 

 

9.命名规范,字符型以V开头

时间以D

数字以n

自定义项:

字符:10个 20位  ;5个 200位 ;3个500位 ;2 个2000位;

浮点:10个

整型:10个

 

 

10.快速查找页面节点所在的那个类

11.下拉菜单;S第一个,第二个,的三个

SX,自由态=8,审核态=1  1, 2

12.在oracle中 isnot不适用; 使用navl

 

13.Public里面的类都是自动生成的

Private里面的可以写一些动作脚本

Client里面主要是我们写的业务类

 

Public目录存放接口和公共代码(比如VO和公共算法)
l
Private目录存放实现和其它实现细节
l
Client目录存放客户端代码
l
gen 目录存放工具生成的ejb代码
l
META-INF目录存放模块配置文件目录,包括module.xml文件和xxx.module接口配置文件。

14.流程的版本谁的高走谁的;用户比角色优先级高;

15.公式

<nc.ui.dxty.pubui.PropertyStatusRefModel>

有的时候公式不执行就要

强制执行公式

 

可以放在重写方法里面;如:点击添加按钮时执行添加的重写方法;

//加载表头的编辑公式

getBillCardPanel().execHeadLoadFormulas();

//加载表体的公式

getBillCardPanelWrapper().getBillCardPanel().getBillModel().execLoadFormula();

 

//执行模板上的编辑公式

                         this.getBillCardPanel().getBillModel().execEditFormulasByKey(row,"invnum");

1.

2.

3.

4.

5.

6.

 

 

 

16.系统中的“耗时操作”进度条是如何实现的?

/**
         * 启用系统运行提示框避免造成假死现象
         */
        private void onButton_import()
        {
                // 该操作是耗时操作,所以启用系统运行提示框
                Runnable runImpDoc = new Runnable()
                {
                        public void run()
                        {
                                BannerDialog dialog = new BannerDialog(getCurrUI());
                                dialog.start();
                                try
                                {
                                        importData();
                                }
                                catch (Exception e)
                                {
                                        dialog.end();
                                        e.printStackTrace();
                                        return;
                                }
                                dialog.end();// 销毁系统运行提示框
                        }
                };
                new Thread(runImpDoc).start();
        }
        /**
         * 系统运行提示框
         */
        private Container getCurrUI()
        {
                return this.getSelfUI();
        }

 

 

 

 

 

17. 自定义按钮

 

接口

Public

packagenc.ui.testkh.mybotton;

publicinterface IButDef {

   publicstaticfinalintboExcel = 300;

}

2.定义按钮

clientlis

package nc.ui.pub.buttonImp;

 

import nc.ui.pub.button.IButton;

import nc.ui.trade.base.IBillOperate;

import nc.vo.trade.button.ButtonVO;

 

publicclassPorjectButtonDeft {

 

   public ButtonVO getButtonVO(){

      ButtonVO btnVo=new ButtonVO();

      btnVo.setBtnNo(IButton.POJECTBUTTON);

      btnVo.setBtnCode("boProjectBtn");

      btnVo.setBtnName("项目调整");

      btnVo.setOperateStatus(

            newint[]{IBillOperate.OP_INIT,IBillOperate.OP_NOTEDIT}//IBillOperate.OP_NOTEDIT 设置按钮在编辑状态下可用

            );// 设置那个状态可用

      return btnVo;

   }

}

3.注册按钮

.....ClientUICtrl

IButton.POJECTBUTTON

4.注册按钮

....ClientUI

重写方法

@Override

   protectedvoidinitPrivateButton() {

      // TODOAuto-generated method stub

      super.initPrivateButton();

      PorjectButtonDeft pbd =newPorjectButtonDeft();

      addPrivateButton(pbd.getButtonVO());

   }

5写按钮的方法

MyEventHandler类

 

@Override

   protectedvoid onBoElse(int intBtn) throws Exception {

      // TODOAuto-generated method stub

      super.onBoElse(intBtn);

      if(intBtn == IButton.POJECTBUTTON){

         //业务方法

         System.out.println("业务方法");

      }

   }

 

 

第二种:

@Override

   protectedvoid onBoElse(int intBtn) throws Exception {

      // TODOAuto-generated method stub

      super.onBoElse(intBtn);

      switch(intBtn){

      case  CreateEntryBill.CREATEBUTTON:

         creatEntryBill(intBtn);

         break;

      }

   }

   publicvoidcreatEntryBill(int intBtn){

     

   }

业务方法在下面写;上面直接调用方法就行‘;

 

18.建立项目不要在集团下建立;

19.

 

字段类型不匹配; PDM里面看看是否能不为空;

 

 

20,权限分配的时候没有你想要的那个节点;就要建立公司帐分配那个节点;

21.获取服务器时间;

 

getBillCardPanelWrapper().getBillCardPanel().setHeadItem("",ClientEnvironment.getServerTime().toString());

22.获取当前时间

getBillCardPanel().getHeadItem("dmakedate").setValue(new UFDate(new Date()));

 

23.下拉菜单存索引;用IX,集收,分收

24.如果导包出错误;试试把包放在NC/ufjdk/lib下然后在导入;

25、怎样编写代码在待办事务中发送一条消息?

答:可以参考下, 后台代码,就是往数据库插入一条记录

//////////////////////////////

        PFMessageBO pfm = new PFMessageBO();

        CommonMessageVO comvo = newCommonMessageVO();

        UserNameObject usvo = newUserNameObject("a");

       usvo.setUserPK("0001ZZ100000000000VJ");

        usvo.setUserCode("a");

        usvo.setUserName("a");

       

        comvo.setSender("a");

        comvo.setReceiver(newUserNameObject[]{usvo});

        comvo.setMessageContent("导入数据演示");

        comvo.setTitle("外部平台导入数据");

       comvo.setType(MessageTypes.MSG_TYPE_INFO);

        pfm.insertCommonMessage(comvo);

 

 

25.不能修改的参照(时间)就写日期就行;不用设置参照;

26.如果PDM和单据建立好了;发现PDM字段不行或类型不行;可以解决;

答:首先把PDM改好;在导入数据字典表里面同时在数据库里面在生成一下表;然后在

找到那个字段把它删掉;然后从右边的字段里面找到在拖过去;就ok;

然后在代码里面改改VO;

 

 

27.一个节点;从一个系统导入到另一个系统;

答选择命令窗口;点击绿色执行;红色回滚;

有可能出现错误;就是语句里面两个单引号之间要有个空格例如:‘’

2 把自己创建的节点(文件夹)例如9100  放的nchome下的modules里面;

3.建立公司帐

4.审批流重新配;权限重新配;

 

28.建立用户;然后分配角色;在分配权限;如果没有这个节点;就建立公司帐;

29.PDM画表小工具的然后选择palette

30. 在private里面怎么获得主键????????

可以通过方法把这个主键传过去;

 

 

 

31.在后台得到VO?

//后台得到VO

BaseDAO bo = new BaseDAO();

bo.executeQuery("select * fromty_bz where pk_tybz = ‘"+pk_tybz+"‘ ", newBeanProcessor(nc.vo.ty.TyBzVO.class));

 

 

32.调用接口;

Order od =(Order)NCLocator.getInstance().lookup(Order.class.getName());

 

 

public List queryFieldSingleSql(Stringsql) throws BusinessException, SQLException, DbException {

      if(sql == null || sql.equals("")) {

         returnnull;

      }

      Listvalues = new ArrayList();

 

      Connectioncon = null;

      PreparedStatementstmt = null;

      ResultSetrs = null;

      ResultSetMetaDatarsmd = null;

 

      try{

         con= getConnection();

         stmt= con.prepareStatement(sql);

         rs= stmt.executeQuery();

         rsmd= rs.getMetaData();

 

         while(rs.next()){

            Listvalue = new ArrayList();

            for(inti=1;i<=rsmd.getColumnCount();i++){

               StringcolumnValue = rs.getString(i)==null?"":rs.getString(i);

               value.add(columnValue);

            }

            values.add(value);

         }

        

      }finally {

         try{

            if(rs != null)

               rs.close();

         }catch (Exception e) {

         }

         try{

            if(stmt != null)

               stmt.close();

         }catch (Exception e) {

         }

         try{

            if(con != null)

               con.close();

         }catch (Exception e) {

         }

      }

 

      returnvalues;

   }

 

33.自定义接口时要部署EJB;报错:

 

加个文件dxty.module;然后生成EJB中间件;

34.按钮的动作脚本;要导入到项目的private里面新建包

Nc.bs.pub.action下面

35.要在接口里面写好注释;;;;;;

36.编写参照类时

//这段代码是UI类初始化参照类的,不写 参照就出不来了

      BillItemitem = (BillItem )getBillCardPanelWrapper().getBillCardPanel().getHeadItem("relatekey");

            BillStatusRefModeldefModel = newBillStatusRefModel( );

                  UIRefPanerefPane = (UIRefPane) item

                  .getComponent();

                  refPane.setEditable(true);

                  item.setDataType(BillItem.UFREF);

                  refPane.setRefModel(defModel);

                  item.setComponent(refPane);

35.表体增行方法getBillCardPanel().getBillModel().addLine()

 

36.清空缓存: UIRefPane ref = getRefSubject();       ref.getRefModel().clearCacheData();

37.查询方法的重写:

交谈中请勿轻信汇款、中奖信息,勿轻易拨打陌生电话。

 
//重写查询按钮
@Override
 protected void onBoQuery() throwsException {
 // TODO Auto-generated method stub
// b-------------2009-11-04  荆茂英 修改
 String strWherePart = "";
 UIDialog querydialog = getQueryUI();
 if (querydialog.showModal() != UIDialog.ID_OK)return; //用户取消查询
 
 INormalQuery query = (INormalQuery)getQueryUI();
 if(query.getWhereSql()!= null &&!query.getWhereSql().equals("")){
 strWherePart = query.getWhereSql()+" and ";
 }else{
 strWherePart += "";
 }
 

 String isNegotiations = "";//是否洽商
 if(getMCode() != null &&getMCode().equals("工程洽商")){
 isNegotiations = "Y";
 }else{
 isNegotiations = "N";
 }
 strWherePart = strWherePart + "pm_lm_designchange.vdef1=‘"+isNegotiations+"‘";
 
 SuperVO[] queryVos =getBusiDelegator().queryHeadAllData(
 Class.forName(getUIController().getBillVoName()[1]),
 getUIController().getBillType(),strWherePart.toString());
 
 getBufferData().clear();
 addDataToBuffer(queryVos);
 updateBuffer();


 
// super.onBoQuery();
 //end-------------------------------------------------
 } dfa
设置按钮状态getButtonManager().getButton(nc.ui.trade.button.IBillButton.Add).setEnabled(false);

this.getBillUI().updateButtonUI();

38.怎么得到下拉菜单的值

intindex =getJComboBoxBillType().getSelectedIndex();//得到调拨类型

         String typecode = "";

         if(index == 0){

            typecode = "5C";

         }elseif(index == 1){

            typecode = "5D";

         }elseif(index == 2){

            typecode = "5E";

         }elseif(index == 3){

            typecode = "5I";

         }

39.随机生成主键:selectsubstr((sys_guid()),1,20)

40. 

Not in  not exists 在oracle中用法;如果not in查询上百条的时候会崩溃。

andnotexists (selectdistinct  ladings_bill.pk_purchaseordercode

          from ladings_bill        wherenvl(dr, 0) = 0and po_order.corderid=ladings_bill.pk_purchaseordercode )

 

 

41.

 

//根据系统先有的规则来生成单据号

nc.vo.pub.billcodemanage.BillCodeObjValueVOvvo =new nc.vo.pub.billcodemanage.BillCodeObjValueVO();

String billcode=(newBillcodeGenerater()).getBillCode(headVO.getPk_billtype(),headVO.getPk_corp(),null,vvo);//第一个参数:单据类型,第二个参数:公司主键,第三个参数传null,第四个参数:vvo

 

42

newSequenceGenerator().generate(pk_corp);

生成主键的

 

43.类型转换异常--------------------------------解决;在ts那个用String类型;模板和VO要一致。

 

 

44.List和hashmap一起连用;

String sql = selectcinvbasid, cgeneralbid from ic_general_b where cfirstbillhid =‘"+pk_relaterkey+"

setEnabled

List list = (List)iuap.executeQuery(sql,  newMapListProcessor());}

HashMap Mapp = new HashMap();

         Mapp =(HashMap)list.get(i);

如果想取得cinvbasid的值:Mapp.get("cinvbasid");

45.审核之后其他按钮才能执行;代码放到自定义按钮的类里面;注有按钮名称的那个btnVo.setBusinessStatus(new int[] {nc.vo.trade.pub.IBillStatus.CHECKPASS }

46.获得表体字段的值:(下面的是获得多个表体的值)如果只获得一个表体就把

NewHYBillVO().getTableCodes()[5]String 制空。pk_afterrecord=getBillCardPanelWrapper().getBillCardPanel().getBillModel(newHYBillVO().getTableCodes()[5]).getValueAt(0,"pk_afterrecord").toString();

47.如果前台报错可以放到后台输出获抛出;

try {

         super.onBoCommit();

      } catch (Exception e) {

         // TODO: handleexception

      }    

 

 

48.得到表头一共多少行

int rows =getBillCardPanelWrapper().getBillCardPanel().getBillTable().getRowCount();//得到表体一共多少行

49.      获取时间戳

      String dateline=new SimpleDateFormat("yyyy-MM-ddHH:mm:ss").format(Calendar.getInstance().getTime());

     

50.//选择对话框,点是继续,点否取消

if(MessageDialog.showOkCancelDlg(this.getBillUI(),"确认","点击筛选按钮后,会先把现在页面的值保存到数据库,确认执行吗?")==MessageDialog.ID_OK){

filterSellAndGroup();//点击确定要实现的方法;

} else{

return;

}

51.// 当前登录人

         UserVO coperator =ClientEnvironment.getInstance().getUser();

 

 

52.弹出一个UI;并设置页面为卡片形式

ToftPanel toft = SFClientUtil.showNode("H4H2H5",IFuncWindow.WINDOW_TYPE_DLG);

      WarningSetClientUI ui =(WarningSetClientUI) toft;

   ui.onButtonClicked(ui.getButtonManager().getButton(IBillButton.Card));

   ui.onButtonClicked(ui.getButtonManager().getButton(IBillButton.Add));

ui.setCardUIData(vo);

53.单据号释放

@Override

   protectedvoid onBoDelete()throws Exception {

      // TODOAuto-generated method stub

      super.onBoCard();// 卡片状态下

      IBillcodeRuleServicecodeservice = (IBillcodeRuleService) NCLocator.getInstance().lookup(

            IBillcodeRuleService.class.getName());

      BillCodeObjValueVOvoBill=newBillCodeObjValueVO();

      String vbillno =getBillCardPanelWrapper().getBillCardPanel()

      .getHeadItem("vbillno").getValueObject().toString();

   codeservice.returnBillCodeOnDelete(_getCorp().getPrimaryKey(), "9103", vbillno,

              voBill);

            try

            {

            //申请特定内存区域

         SFAppServiceUtil.getBillcodeRuleService().requireNewRegion(vbillno);

           

            //做独立事务业务操作

           

            //释放申请的内存区域

         SFAppServiceUtil.getBillcodeRuleService().releaseRegion(vbillno);

            }

            catch (Exception e)

            {

                //停止申请的内存区域

            SFAppServiceUtil.getBillcodeRuleService().stopRegion(vbillno);

               //异常处理代码

            }

      super.onBoDelete();

   }

54.让文本框表头不可编辑

getBillCardPanel().getHeadItem("vdef3").setEnabled(false);

表体不可编辑

this.getBillCardPanelWrapper().getBillCardPanel().getBillModel().setCellEditable(i,"totalmoneyzong", true);

55.     //审批未通过

   publicstatic final int NOPASS = 0;

   //审批通过

   publicstatic final int CHECKPASS = 1;

   //审批进行中

   publicstatic final int CHECKGOING = 2;

   //提交状态

   publicstatic final int COMMIT = 3;

   //作废状态

   publicstatic final int DELETE = 4;

   //冲销状态

   publicstatic final int CX = 5;

   //终止(结算)态

   publicstatic final int ENDED = 6;

   //冻结状态

   publicstatic final int FREEZE = 7;

   //自由态

   publicstatic final int FREE = 8;

 

 

56.更新update(sql)

IPubBillUpdate 

 BaseDAO baseDAO=new BaseDAO();

         baseDAO.executeUpdate(sql);

 

57.参照显示

那个类有三个字段设置方法分别表示主键编码名称的

   @Override

   public String getPkFieldCode() {

     

      return "billbid";

   }

 

   @Override

   public String getPkValue() {

     

      return (String) getValue("billbid");

   }

 

   @Override

   public String getRefCodeField() {

     

      return "def2";

   }

 

   @Override

   public String getRefNameField() {

     

      return "assetname";

   }

 

 

 

58.强制执行公式所有地方都执行

//表头公式默认不执行,初始化的时候把这两行加进去

getBillCardPanel().setAutoExecHeadEditFormula(true),getBillCardPanel().execHeadEditFormulas()

   /*

     *实现 切换到卡片模式 数据为0时 显示为 0 或者为 空 的问题

     */

    @Override

    protected void onBoCard() throws Exception {

       //设置显示零

      this.getBillCardPanelWrapper().getBillCardPanel().getBodyPanel()

              .getRendererVO().setShowZeroLikeNull(false);

       super.onBoCard();

    }

59.内存益处

-vmF:\JAVA\Projects\dxty\tyfwnchome\nchome\ufjdk\bin\javaw.exe

60.部门档案 nc.ui.bd.ref.busi.DeptdocDefaultRefModel

61.人员档案 nc.ui.bd.ref.busi.

getBillListPanel().hideHeadTableCol("headitem");

PsndocDefaulRefModel

列表隐藏字段

 

 

62.控制后台输出sql 语句

  在Eclipse中按shift+Ctrl+r 打开后台日志logger-config.properties

   把里面的这些代码注释掉,就可以在控制台看到相关信息,如不注释,就是写到日志中;zh

   anonymous.level=DEBUG  (把这里的ERROR改为DEBUG)

 

   #anonymous.file=./nclogs/${server}/anony-log.log

    #anonymous.size.maxSize=5MB

    #anonymous.size.maxIndex=20

    nclog.level=DEBUG (把这里的ERROR改为DEBUG)

    #nclog.file=./nclogs/${server}/nc-log.log

#nclog.size.maxSize=5MB

   #nclog.size.maxIndex=5

   # iufo logs

   # iufoRepCalc logs

   #iufoRepCalcResult logs

#SQL监控日志

63.重写增行方法

protectedvoid onAddLine() {

   super.onAddLine();

 

    **********

    在这里设置表体不可以编辑就可以了

   **********

 

}

63.修改数据库字段长度altertable bd_psnbasdoc modify bp varchar2(1000) ;

 

alter   table  your_table   add   (column1  col_,clumn2   col_type2...); 

  your_table  :表名 

  column1/column2   :字段名 

  col_type1/col_type2   :字段类型 

 

64.参照表IBusiType

public java.lang.String[] getFieldCode() {

       returnnew String[] {"(selectvname from jgpm_cm_contract where jgpm_cm_contract.pk_cont =jgpm_cm_measure.pk_cont)","vbillno","dmeapprodate","nmeaapprorigmny","pk_measure"};

65.}

66.获取表尾的值getBillCardPanel().getTailItem("dmakedate").setValue(newUFDate(new Date()));

67.刷新this.getBufferData().refresh();

68.实现类里面执行提交动作脚本

MyBillVO mbillvo = new MyBillVO();

      mbillvo.setM_billField(BillField.getInstance());

      mbillvo.setParentVO(ich);

      mbillvo.setChildrenVO(icb);

      commit(dmaked,mbillvo,userid);

      return xmlMessage;

   }

  

   publicvoid commit(String dmaked,MyBillVO mbillvo,String userid) throws Exception {

      UserVO user = (UserVO)getBaseDAO().retrieveByPK((UserVO.class), userid);

      IWorkflowMachine bsWorkflow = (IWorkflowMachine) NCLocator.getInstance().lookup(

             IWorkflowMachine.class.getName());

      PfUtilWorkFlowVO wfVo = bsWorkflow.checkWorkFlow("SAVE", "HHSQ", dmaked, mbillvo);

      if(wfVo != null){

      PfUtilBO pf = new PfUtilBO();

      pf.processAction("SAVE", "HHSQ", dmaked, wfVo, (HYBillVO)mbillvo, user);

      }

69.Plsql无法识别问题

 

 在orcl的安装目录下:

在oracle的安装路径下\product\10.2.0\client_1\NETWORK\ADMIN有一个tnsnames.ora编辑状态打开,里面有连接的数据库的信息;

 

天门溪水 10:54:19

然后呢

李鑫  10:56:04

\product\10.2.0\db_1\NETWORK\ADMIN在服务端也有这么个文件,你打开,看一下,应该是这两个文件里有一个文件没有你当前数据库的连接信息

李鑫  10:56:21

然后从那个里面复制过来

李鑫  10:56:34

这两个文件里的内容是一致的

 

修改自定义不能改名称的问题

this.getBillCardPanel().getHeadItem("ccustomerid").setName("客商名称");

   this.getBillListPanel().getHeadItem("ccustomerid").setName("客商名称");

this.getBillCardPanel().getHeadItem("ccustomerid").setName("客商名称");

   this.getBillListPanel().getHeadItem("ccustomerid").setName("客商名称");

this.getBillCardPanel().setBillData(getBillCardPanel().getBillData());

this.getBillListPanel().setListData(getBillListPanel().getBillListData());

69 抛异常

if (listbasdoc == null || listbasdoc.size() <= 0) {

             thrownew Exception("没有找到客商!");

          }

70判断是否卡片

if(this.getBillListPanel().isShowing())

查询模板公司默认

Sys_CurrCorp

71.命令

ls  是显示当前文件夹里面的文件;
cd 打开文件夹
cd ..  返回上一个目录

 

72.通过sql语句查询VO的具体几个字段;

String[] names = {"cfirstid","cfirstbid","cfirsttypecode","vfirstcode","vfirstrowno"};

        String  bodywhere = " dr = 0 and cbill_bid = ‘"+bvo.getVsourcebillrowid()+"‘";

        BillItemVO[] tobvo =ClientBillHelper.queryBodyBySQL(names, bodywhere);

        if(tobvo!=null&&tobvo.length >0){

           itemVO.setCfirstbillhid(tobvo[0].getCfirstid());

          itemVO.setCfirstbillbid(tobvo[0].getCfirstbid());

        itemVO.setCfirsttype(tobvo[0].getCfirsttypecode());

        itemVO.setVfirstbillcode(tobvo[0].getVfirstcode());

          itemVO.setVfirstrowno(tobvo[0].getVfirstrowno());

        }

73.获取配置文件的值;关闭流

74.private BaseDAO dao;

public  String getINFO(String flag) {
FileInputStream fis = null;
try {
Properties props = new Properties();
fis = new FileInputStream(new File(RuntimeEnv.getInstance().getNCHome() + System.getProperty("file.separator")
+ "resources" + System.getProperty("file.separator") + "db-config.properties"));
props.load(fis);
return props.get(flag).toString();
} catch (Exception e) {
e.printStackTrace();
return "ERROR";
} finally{
if(fis!=null){
try{
fis.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
}
}
private BaseDAO getBaseDAO() {
if (dao == null) {
dao = new BaseDAO(getINFO("defaultDataSource"));
}
return dao;
}

75. }

 

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01

 

获取查询框下拉值

// 获取合同类别对应的sql查询条件

       String sqlString =event.getFilter().getSqlString();

参照手动输入和参照

nc.ui.pub.beans.UIRefPane ry_ref =(nc.ui.pub.beans.UIRefPane) getBillCardPanel()

.getBodyItem(ExAggCpFinalinfoVO.TABLECODE_MATERIAL,"vcheckpsn")

.getComponent();

ry_ref.setRefNodeName("人员档案"); /* -=notranslate=- */

ry_ref.setButtonVisible(true);

 

List 转化成VO

ArrayList<BillTempletBodyVO> filterTempletBvosVos = newArrayList<BillTempletBodyVO>();

filterTempletBvosVos.toArray(newBillTempletBodyVO[0])

 

编辑前事件监听

implements BillCardBeforeEditListener

在构造方法里面添加

getBillCardPanel().setBillBeforeEditListenerHeadTail(this);

 

弹出卡片界面

privatevoid onBoLinkQry() throws UifException {

       if (getBufferData().getCurrentVO() == null)

           return;

       if (getBufferData().getCurrentVO().getParentVO() == null)

           return;

       String pk_singleplan =((SmClarifyVO)getBufferData().getCurrentVO().getParentVO()).getPk_singleplan();

       if (pk_singleplan == null || pk_singleplan.equals(""))

           return;

 

       BillLinkData billLinkData = new BillLinkData();

       billLinkData.setBillID(pk_singleplan);

       SFClientUtil.openLinkedMaintainDialog("H0K10302", ((ClientUI)getBillUI()).getBillCardPanel(),

              billLinkData);

    }

    privateclass BillLinkData implements ILinkMaintainData {

       private String real_pk_bill = null;

       public String getBillID() {

           returnreal_pk_bill;

       }

       publicvoid setBillID(String billId) {

           real_pk_bill = billId;

       }

       public Object getUserObject() {

           // TODO Auto-generatedmethod stub

           returnnull;

       }

    }

 

获取查询模板默认值条件

    String fixcondition  =getBillManageUI().getFixCondition();

       if(fixcondition!=null&&fixcondition.length()>0)

           sb.append(" and ").append(fixcondition).append("");

 

/**

    * 调用存储过程

    * @param HashMap

    * @throws Exception

    */

   public MessageVOCallsp(String LoginDate,String Partnaccounts,String Sp) throws Exception {

      MessageVO msgvo = newMessageVO();

      LoginDate =LoginDate.replace("-", "");

      msgvo.setMsgflag(-1);

      // 调用存储过程

      Connection con = null;

      CallableStatement stmt= null;

      try {

          con =getConnection();

         stmt = con.prepareCall("{ call "+Sp+"(?,?,?,?)}");

          stmt.setString(1,LoginDate);

          stmt.setString(2,Partnaccounts);

           stmt.registerOutParameter(3,Types.NUMERIC);

           stmt.registerOutParameter(4,Types.VARCHAR);

          stmt.execute();

         

         int RET_FLAG = stmt.getInt(3);

          String msg =stmt.getString(4);

          msgvo.setMsg(msg);

          msgvo.setMsgflag(RET_FLAG);

         

      } catch (Exception e) {

          e.getMessage();

          msgvo.setMsg("末找到 "+Sp+",或参数设置错误。");

     

      } finally {

          try {

             if (stmt != null){

                stmt.close();

             }

          } catch (Exceptione) {

          }

          try {

             if (con != null){

                con.close();

             }

          } catch (Exceptione) {

          }

      } 

      return msgvo;

   }

   鼠标监听

class MyMouseListener implements MouseListener {

//

//    public void mouseClicked(MouseEventarg0) {

//        // TODOAuto-generated method stub

//    }

//

//    public voidmouseEntered(MouseEvent arg0) {

//        // TODOAuto-generated method stub

//    }

//

//    public voidmouseExited(MouseEvent arg0) {

//        // TODOAuto-generated method stub

//       System.out.println("mouseExited========================");

//    }

//

//    /**

//    * 鼠标单击事件

//    */

//    public voidmousePressed(MouseEvent arg0) {

//        // TODOAuto-generated method stub

//        InvbasdocDefaultRefModelinbase = new InvbasdocDefaultRefModel("存货基本档案");

//        Object pk_invcl =getRefSubject().getRefPK();

//        if(pk_invcl !=null){

//        inbase.setWherePart("andbd_invbasdoc.pk_invcl = ‘"+pk_invcl+"‘");

//        }

//        refBas = newUIRefPane();

//        //new 一个主体账簿参照类

////          refMainAcc.setRefModel(arg0);

//        refBas.setRefNodeName("存货基本档案");//系统参照

//        refBas.setVisible(true);

//        refBas.setRefModel(inbase);

//        refBas.onButtonClicked();

//        System.out.println("参照pk:" +refSubject.getRefPK());

//        getRefBas().setPK(refBas.getRefPK());

//    }

//

//    public voidmouseReleased(MouseEvent arg0) {

//        // TODOAuto-generated method stub

//       System.out.println("mouseReleased========================");

//    }

//}

 

清除部署的文件

进入ufsoft下的dist、history、temp 夹下的东西都删除,这几个文件夹保留

-Xms500m

-Xmx1024m

  

   /**

     * @方法说明:下载Excel模板

     * @author :niuxd

     * @date  :2012-11-30 下午03:55:56

     */

   protected voiddownloadExcel() {

      String path =ClientEnvironment.getInstance().getServerURL()

             +"download/metercomptemplate.xls";

      URL url = null;

      try {

         url = new URL(path);

      } catch(MalformedURLException e) {

          Logger.error(e);

      }

      ClientAssistant.showDocument(url,"_blank");

   }

   校验非空

需要在单据类型管理里面配置ROLE规则那个类到自定义3里面

try {

           dataNotNullValidate();

       } catch (ValidationException e) {

           thrownew BusinessException(e.getMessage());

       }

      

       super.onBoSave();

 

protectedvoid dataNotNullValidate()throws ValidationException {

       StringBuffer message = null;

       BillItem[] headtailitems =getBillCardPanelWrapper().getBillCardPanel()

              .getBillData().getHeadTailItems();

       if (headtailitems != null) {

           for (int i = 0; i < headtailitems.length; i++) {

              if (headtailitems[i].isNull())

                  if (isNULL(headtailitems[i].getValueObject())

                         && headtailitems[i].isShow()) {

                     if (message == null)

                         message = new StringBuffer();

                     message.append("[");

                     message.append(headtailitems[i].getName());

                     message.append("]");

                     message.append(",");

                  }

           }

       }

       if (message != null) {

           message.deleteCharAt(message.length() - 1);

           thrownew NullFieldException(message.toString());

       }

 

       // 增加多子表的循环

       String[] tableCodes =getBillCardPanelWrapper().getBillCardPanel()

              .getBillData().getTableCodes(BillData.BODY);

       if (tableCodes != null) {

           for (int t = 0; t < tableCodes.length; t++) {

              String tablecode = tableCodes[t];

              for (int i = 0; i < getBillCardPanelWrapper()

                     .getBillCardPanel().getBillModel(tablecode)

                     .getRowCount(); i++) {

                  StringBuffer rowmessage = new StringBuffer();

 

                  rowmessage.append(" ");

                  if (tableCodes.length > 1) {

                     rowmessage.append(getBillCardPanelWrapper()

                             .getBillCardPanel().getBillData().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 = getBillCardPanelWrapper()

                         .getBillCardPanel().getBillData()

                         .getBodyItemsForTable(tablecode);

                  for (int j = 0; j < items.length; j++) {

                     BillItem item = items[j];

                     if (item.isShow() && item.isNull()) {// 如果卡片显示,并且为空,才非空校验

                         Object aValue = getBillCardPanelWrapper()

                                .getBillCardPanel().getBillModel(tablecode)

                                .getValueAt(i, item.getKey());

                         if (isNULL(aValue)) {

                            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) {

           thrownew NullFieldException(message.toString());

       }

 

    }

 

public void setCardPanelBodyColor() throws Exception {

      // 卡片状态下表体颜色控制

      String tabcode =....;//如果是多页签的.这里加上页签名称

      BillModel bm =getBillCardPanel().getBillModel(tabcode);

      int row =bm.getRowCount();

      for (int i = 0; i <row; i++) {

          BillItem[]items_body = getBillCardPanel().getBillModel(tabcode)

                .getBodyItems();

          if (items_body !=null && items_body.length > 0) {

             for (int j = 0,len = items_body.length; j < len; j++) {

                BillItem item= items_body[j];

                if (item ==null)

                   continue;

                if(!item.isBaseTableCodeShow())

                   continue;

                String name =item.getKey();

                if("2".equals(bm.getValueAt(i, "vb2def4"))) {//根据行中某个列的值进行判断,其它地方的也可以

                   getBillCardPanel().getBodyPanel(tabcode)

                         .setCellBackGround(i,name,

                                newColor(149, 161, 219));

                } else {

                   getBillCardPanel().getBodyPanel(tabcode)

                         .setCellBackGround(i,name, Color.WHITE);

                }

             }

          }

      }

 

 

   }

以上是关于NC开发笔记指导的主要内容,如果未能解决你的问题,请参考以下文章

NC学习笔记

《NodeJS开发指南》学习笔记

构建之法阅读笔记6--敏捷开发2

软件评测时笔记_软件开发模型学习20161021

Spark开发环境搭建——Spark开发学习笔记

Spark开发环境搭建——Spark开发学习笔记