kingdee bos常用方法(自己用)

下面的记录只对自己有用(以作备用)。

/*********查询*******************************************************/

  EntityViewInfo evi = new EntityViewInfo();
  FilterInfo filterInfo = new FilterInfo(); // 建立过滤条件
  filterInfo.getFilterItems().add(
    new FilterItemInfo("id", linkStr, CompareType.INNER));

  evi.setFilter(filterInfo);
  if (mainQuery == null) {
   mainQuery = new EntityViewInfo();
  }
  mainQuery.getSorter().add(new SorterItemInfo("createTime"));
  SorterItemInfo sortItem = mainQuery.getSorter().get(0);
  sortItem.setSortType(SortType.DESCEND);
  mainQuery.setFilter(filterInfo); // 添加过滤条件
  this.execQuery();

/*********************************************************************************/
//新增      
IObjectPK pk = ChargeInformFactory.getRemoteInstance().addnew(ci);
//更新 
ChargeInformFactory.getRemoteInstance().update(new ObjectUuidPK(BOSUuid.read(vslID)),ci);
      ChargeInformChargeItemInfo cici = new

ChargeInformChargeItemInfo();
      //ChargeInformChargeItemFactory.getRemoteInstance

().getChargeInformChargeItemInfo(new ObjectUuidPK(pk.toString()));
      
//打开收费通知单
//      getUIContext().put("ID",pk);
//            IUIWindow win = UIFactory.createUIFactory

(UIFactoryName.EDITWIN.intern()).create(
//        

"com.kingdee.eas.coscsc.business.frt_rec.client.ChargeInformEditUI",getUIContext(), null, OprtState.VIEW);
//            win.show();
     }
     updateCNTT("5",null);
/* 设置客户F7按钮图片 */
  URL url = ClassUtil.getResource(
    "com/kingdee/eas/coscsc/image/search.gif", CargoPerformStatUI.class);
  ImageIcon icon = new ImageIcon(url);
  this.kDWorkButton1.setIcon(icon);
  kDWorkButton1.setIgnoreRepaint(true);
  kDWorkButton1.setOpaque(true);

//设置COMBOBOX
  txtVOY_NO.setComboDisplayFormat("$VOY_STATUS$");  //VOY_STATUS为枚举
  txtVOY_NO.setComboPopupWidth(250);
  txtVOY_NO.setNeedReQuery(false);
  txtVOY_NO.setRequired(false);


KDBizPromptBox portProxy = new KDBizPromptBox();
FilterInfo filter = new FilterInfo();
String portID = "";
if (UIRuleUtil.isNotNull(this.kdtE2.getCell(rowIndex, "PORT").getValue())) {
 portID = ((PortInfo) (this.kdtE2.getCell(rowIndex, "PORT").getValue())).getId().toString();
}
filter.getFilterItems().add(new FilterItemInfo("PORT_NM.id", portID,CompareType.EQUALS));
EntityViewInfo evi = new EntityViewInfo();
evi.setFilter(filter);
portProxy.setEntityViewInfo(evi);
portProxy.setQueryInfo("com.kingdee.eas.coscsc.basedata.app.PORT_SURRQuery");
KDTDefaultCellEditor cellEditor = new KDTDefaultCellEditor(portProxy);
this.kdtE2.getCell(rowIndex, "VOY_PRT_AGCYSRV").setEditor(cellEditor);
///--------------initUIMenu------------
 private void initUIMenu(){
          //this.menuBar.setVisible(false);
  this.separatorFW1.setVisible(false);//
  this.btnPrint.setVisible(false);// 打印
  this.btnPrintPreview.setVisible(false);// 打印预览
  this.separatorFW2.setVisible(false);
  this.btnFirst.setVisible(false);// 第一
  this.btnPre.setVisible(false);// 前一
  this.btnPageSetup.setVisible(false);// 页面设置
  this.btnCreateTo.setVisible(false);
  this.separatorFW3.setVisible(false);
  this.btnTraceUp.setVisible(false);
  this.btnTraceDown.setVisible(false);
  this.separatorFW4.setVisible(false);
  this.separatorFW7.setVisible(false);
  this.separatorFW5.setVisible(false);
  this.separatorFW8.setVisible(false);
  this.btnCopyFrom.setVisible(false);
  this.btnCreateFrom.setVisible(false);
  this.btnCreateTo.setVisible(false);
  this.btnCopy.setVisible(false);
  this.btnVoucher.setVisible(false); // 生成凭证
  this.btnDelVoucher.setVisible(false);// 删除凭证
  this.btnMultiapprove.setVisible(false);
     this.btnNextPerson.setVisible(false);
  this.btnAuditResult.setVisible(false);
  this.btnWFViewdoProccess.setVisible(false);
  this.btnNext.setVisible(false);// 后一
  this.btnLast.setVisible(false);// 最后
  this.btnAddLine.setVisible(false);
  this.btnInsertLine.setVisible(false);
  this.btnRemoveLine.setVisible(false);
  this.btnAddLine.setVisible(false);
  this.btnCancelCancel.setVisible(false);// 启用
  this.btnCancel.setVisible(false);// 禁用
    }
------------end initMenu--------------//
/*********************消息发送**********************/
  Map map = new UIContext();
  map.put("UI",this);
  map.put("type","1");//提交经营,查询出所有经营角色
  String url = "com.kingdee.eas.coscsc.custom.client.F7UserReceiver";
  IUIWindow uiWindow = UIFactory.createUIFactory(
    UIFactoryName.NEWWIN.intern()).create(url, map, null,
    OprtState.ADDNEW);
  uiWindow.show();
回调函数-----------------------------------------------------------------------------
  String str="";
  try {
   int returncnttRows = arg0.size();
   for (int j = 0; j < returncnttRows; j++) {// 循环返回数

    str=str+arg0.get(j).getId().toString()+";";
   }
   sendNoticeToJY(str);//发送消息
   comitjy();//提交经营审核----------状态改变函数

  } catch (Exception e) {
   // TODO 自动生成 catch 块
   e.printStackTrace();
  }
  return arg0;
消息------------------------------------------------------------------------------------
private void sendNoticeToJY(String receiver) throws EASBizException{
     String title ="您有租金信息需要审核,请到租金审核管理模块查看详细";
     String sender = SysContext.getSysContext().getCurrentUserInfo().getName();
     String body = "";
     //String receiver = info.getCreator().getId().toString();
     try {
      if(!CheckUtil.empty(receiver)&&!CheckUtil.empty(title))
      receiver = receiver.substring(0, receiver.length() - 1);
   FRT_COUNTFactory.getRemoteInstance().sendNotice(title,sender,body,receiver);
  } catch (BOSException e) {
   // TODO 自动生成 catch 块
   e.printStackTrace();
  }
    }
/***************************************************************************************************/
排序----------------------------------
mainQuery.getSorter().clear();
mainQuery.getSorter().add(new SorterItemInfo("createTime"));
SorterItemInfo sortItem = mainQuery.getSorter().get(0);
sortItem.setSortType(SortType.DESCEND);
this.getMainQuery().setFilter(filter);
------------------------------------

/在分录中添加F7过滤弹出框///
KDBizPromptBox portProxy = new KDBizPromptBox();
FilterInfo filter = new FilterInfo();
String portID = "";
if (UIRuleUtil.isNotNull(this.kdtE2.getCell(rowIndex, "PORT")
     .getValue())) {
portID = ((PortInfo) (this.kdtE2.getCell(rowIndex, "PORT")
      .getValue())).getId().toString();
}

filter.getFilterItems().add(new FilterItemInfo("PORT_NM.id", portID,CompareType.EQUALS));
EntityViewInfo evi = new EntityViewInfo();
evi.setFilter(filter);
portProxy.setEntityViewInfo(evi);
portProxy
.setQueryInfo("com.kingdee.eas.coscsc.basedata.app.PORT_SURRQuery");
KDTDefaultCellEditor cellEditor = new KDTDefaultCellEditor(portProxy);
this.kdtE2.getCell(rowIndex, "VOY_PRT_AGCYSRV").setEditor(cellEditor);
///
/-------------------------排序------------------------------/
mainQuery.getSorter().clear();
mainQuery.getSorter().add(new SorterItemInfo("createTime"));
   SorterItemInfo sortItem = mainQuery.getSorter().get(0);
   sortItem.setSortType(SortType.DESCEND);
   this.getMainQuery().setFilter(filter);
/-------------------------------------------------------------/

/**
  * 初始化视图状态栏
  *
  */
 private void initUIMenu(){
        // CoreUI
        this.menuBar.setVisible(false);
        this.btnPrint.setVisible(false);
        this.btnPrintPreview.setVisible(false);
        this.btnAttachment.setVisible(false);
        this.separatorFW1.setVisible(false);
        this.separatorFW2.setVisible(false);
        this.separatorFW3.setVisible(false);
        this.btnTraceUp.setVisible(false);
        this.btnTraceDown.setVisible(false);
        this.btnWorkFlowG.setVisible(false);
        this.btnAuditResult.setVisible(false);
        this.btnCopyTo.setVisible(false);
        this.btnCancelCancel.setVisible(false);
        this.btnCreateTo.setVisible(false);
        this.btnDelVoucher.setVisible(false);
        this.btnDelVoucher.setVisible(false);
        this.btnMultiapprove.setVisible(false);
        this.btnNextPerson.setVisible(false);
        this.btnPageSetup.setVisible(false);
        this.btnPrintPreview.setVisible(false);
        this.btnQuery.setVisible(false);
        this.btnTraceDown.setVisible(false);
        this.btnTraceUp.setVisible(false);
        this.btnVoucher.setVisible(false);
        this.btnWFViewdoProccess.setVisible(false);
        this.btnLocate.setVisible(false);
        this.btnAttachment.setVisible(false);
        this.btnAuditResult.setVisible(false);
    }
 /**
     * 初始化表单状态栏
     *
     */
 private void initUIMenu() {
  this.menuBar.setVisible(false);
  this.btnAttachment.setVisible(true);
  this.separatorFW1.setVisible(false);//
  this.btnPrint.setVisible(false);// 打印
  this.btnPrintPreview.setVisible(false);// 打印预览
  this.separatorFW2.setVisible(false);
  this.btnFirst.setVisible(false);// 第一
  this.btnPre.setVisible(false);// 前一
  this.btnPageSetup.setVisible(false);// 页面设置
  this.btnCreateTo.setVisible(false);
  this.separatorFW3.setVisible(false);
  this.btnTraceUp.setVisible(false);
  this.btnTraceDown.setVisible(false);
  this.separatorFW4.setVisible(false);
  this.separatorFW7.setVisible(false);
  this.separatorFW5.setVisible(false);
  this.separatorFW8.setVisible(false);
  this.btnCopyFrom.setVisible(false);
  this.btnCreateFrom.setVisible(false);
  this.btnCreateTo.setVisible(false);
  this.btnCopy.setVisible(false);
  this.btnVoucher.setVisible(false); // 生成凭证
  this.btnDelVoucher.setVisible(false);// 删除凭证
  this.btnMultiapprove.setVisible(false);
     this.btnNextPerson.setVisible(false);
  this.btnAuditResult.setVisible(false);
  this.btnWFViewdoProccess.setVisible(false);
  this.btnNext.setVisible(false);// 后一
  this.btnLast.setVisible(false);// 最后
  this.btnAddLine.setVisible(false);
  this.btnInsertLine.setVisible(false);
  this.btnRemoveLine.setVisible(false);
  this.btnCancelCancel.setVisible(false);// 启用
  this.btnCancel.setVisible(false);// 禁用
  this.btnWorkFlowG.setVisible(false);
  this.btnSubmit.setVisible(false);
 }
//
ICRG_TYPE instance = CRG_TYPEFactory.getRemoteInstance();
  CRG_TYPECollection Col = instance
    .getCRG_TYPECollection("where crg_type_nm_cn = '" + name.trim() + "'");
  CRG_TYPEInfo info = new CRG_TYPEInfo();
//

/**********************************分录中某个f7过滤***************************/
//根据拖轮过滤驳船
  class CRG_TableBeforeAction implements BeforeActionListener {

   public void beforeAction(BeforeActionEvent arg0) {
    try {
     if (arg0.getType() == BeforeActionEvent.ACTION_ADD_ROW) {
      
      int rowIndex = kdtCRG.getRowCount()-1;
      //对 计划驳船 或 驳船 进行过滤 ganjh 090418
   
      filterVessel(rowIndex,"PLAN_LIGHTER");
    
      filterVessel(rowIndex,"LIGHTER");
     }
    } catch (Exception e) {
     e.printStackTrace();
    }
   }

  }
  super.kdtCRG.setBeforeAction(new CRG_TableBeforeAction());

private void filterVessel(int rowIndex,String colNm){
  
  if(UIRuleUtil.isNull(this.prmtVSL_CD.getValue())){
   return;
  }
  KDBizPromptBox lighter = new KDBizPromptBox();
  FilterInfo filter = new FilterInfo();
  
  VesselInfo vslInfo = (VesselInfo)this.prmtVSL_CD.getValue();
  if("拖轮".equals(getVesselType(vslInfo))){
   filter.getFilterItems().add(new FilterItemInfo("VSL_TYPE", "驳

船",CompareType.EQUALS));
  }
  
  EntityViewInfo evi = new EntityViewInfo();
  evi.setFilter(filter);
  lighter.setEntityViewInfo(evi);
  lighter
  .setQueryInfo("com.kingdee.eas.coscsc.app.VesselQuery");
  KDTDefaultCellEditor cellEditor = new KDTDefaultCellEditor(lighter);
//  this.kdtCRG.getCell(rowIndex, colNm).setEditor(cellEditor);
  this.kdtCRG.getColumn(colNm).setEditor(cellEditor);

 }
???///
/???????????????//服务端更新字段///
  ObjectUuidPK cntt_pk = new ObjectUuidPK(BOSUuid.read(cnttId));
  ICARGO_CNTT cntt = CARGO_CNTTFactory.getLocalInstance(ctx);
  
  ObjectUuidPK charge_pk = new ObjectUuidPK(BOSUuid.read(informId));
  IChargeInform charge = ChargeInformFactory.getLocalInstance(ctx);
  
  try {
   CARGO_CNTTInfo cnttInfo = cntt.getCARGO_CNTTInfo(cntt_pk);
   cnttInfo.setBL_ALL(cnttStatus);
   cntt.update(cntt_pk,cnttInfo);
   
   ChargeInformInfo informInfo = charge.getChargeInformInfo(charge_pk);
   informInfo.setIsApprove(informStatus);
   charge.update(charge_pk,informInfo);
  } catch (EASBizException e) {
   this.setRollbackOnly();
   ret = false;
   e.printStackTrace();
  } catch (BOSException e) {
   this.setRollbackOnly();
   ret = false;
   e.printStackTrace();
  } catch (UuidException e) {
   this.setRollbackOnly();
   ret = false;
   e.printStackTrace();
  }

EAS创建临时表方法(SQL与ORACLE通用)   Post By:2009-6-19 0:52:03

//定义临时表表名称

private String KCDBD = new String("KCDBD");

//创建临时表的方法

private void createTempTable(Context ctx) throws BOSException {

             KCDBD = TableManagerFacadeFactory.getLocalInstance(ctx)

                                     .getTableName("TempTable");

                   StringBuffer sb = new StringBuffer("CREATE TABLE ");

                   sb.append(KCDBD);

                   sb.append(" (FITEM     varchar(200), "

                                                        + "FCK     varchar(200), "

                                                        + "FNUMBER     varchar(200),"

                                                        + "FKCDBSL DECIMAL(28, 10), " +

                                                                           "FWLMC varchar(200)," +

                                                                           "FDJH varchar(200)," +

                                                                           "FID varchar(200)");

                   sb.append(")");

                   System.out.print(sb);

                   logger.info(sb.toString());

                   TableManagerFacadeFactory.getLocalInstance(ctx).createTempTable(

                                     sb.toString());

         }

//调用(参数为连接数据库字串)

createTempTable(arg0);

 

说明:在EAS中创建临时表,SQL语法必须遵循KSQL的语法规则。语法验证可以在EAS主控台à数据中心选中其中一个实例,点

击数据库管理功能按钮,把SQL语句粘贴到执行窗口内执行验证。在创建临时表的时候EAS会自动为临时表随机分配一个表名

,表名称如“VT3E1DWP10DVNJROQUYSASX5XP58O8JA”,但在我们开发环境中只需使用所定义的表名称即可,如代码中的

“KCDBD”。每个客户端在调用此方法时,随机分配的表明是不重复的,这样就解决了多个客户端调用此方法的并发问题。 

通常F7关联为某Query,但有时会关联我们自定义的UI而实现某功能。

实现方法,首先在F7控件增加org_willShow方法,然后在UI的实现类实现完整这个方法即可

e.setCanceled(true);//屏弊掉原有的关联Query

             uiContext = new UIContext(this); //此处为向目标UI传递参数,为map集合

             uiContext.put("TYPE","2");

             IUIWindow ViewWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create("目标UI路径",

uiContext, null, OprtState.VIEW);

             ViewWindow.show();

///自定义按钮增加权限控制
方法一:
你的按钮如果是KDWorkButton类型,可直接建一个Action与之绑定,在配置权限文件时该UI的Action就可以绑定到一个权限

项里。
如果是KDButton,那你得自己建立一个对应的空权限项(不绑定Action),然后自己用代码去控制。
/**
* 检查当前用户所在的组织是否有itemStr的权限项
*
* @param itemStr
* @return
*/
public boolean exists(String itemStr) {
String userId = SysContext.getSysContext().getCurrentUserInfo().getId().toString();
String orgId = SysContext.getSysContext().getCurrentOrgUnit().getId().toString();
try {
return PermissionFactory.getRemoteInstance().hasFunctionPermission(new ObjectUuidPK(userId), new

ObjectUuidPK(orgId), itemStr);
} catch (EASBizException e) {
e.printStackTrace();
} catch (BOSException e) {
e.printStackTrace();
}

return false;
}

方法二:
我们EAS项目中二次开发的单据也很多,单据上大多都新增加了按钮。要控制按钮的点击权限可以按以下方法:1、在单据上

新增按钮;2、建立按钮的功能;3、把按钮和功能绑定起来;4、在业务建模工具中新增一个BOS单据的权限,在新建权限项

时就可以看到你新增的这个功能了。权限是对功能进行权限控制的。 
///冻结某些列,设置宽度,高度,及对齐方式,自动换行

table.getViewManager().setFreezeView(-1, 1);

tblMain.getColumn("Entry.Note").setWidth(250);
tblMain.getColumn("Entry.Note").getStyleAttributes().setWrapText(true);
tblMain.getColumn("Entry.Note").getStyleAttributes().setVerticalAlign(VerticalAlignment.TOP);
for(int i=0; i<tblMain.getRowCount(); i++){
 tblMain.getRow(i).setHeight(60);
}
打开文件
openFileName为文件所在的路径及文件名
String  commandStr="cmd.exe /c"+" " +openFileName.replaceAll(" ", "/" /"");
   if (!"".equals(openFileName) && new File(openFileName).exists()) {
    Runtime.getRuntime().exec(commandStr);
   }else{
    MsgBox.showInfo(this,"文件不存在或路径有问题,当前要打开的文件路径

为:"+openFileName);
    return;
   }
///去掉分录上默认的三个按钮///
KDPanel controlPanel = (KDPanel)this.kdtE1.getParent().getParent().getComponent(0);
  for(int i = 0; i < controlPanel.getComponentCount(); i++){
     controlPanel.getComponent(i).setVisible(false);
  }
///

 如何更改登录后某张单据显示的名称?

答:记事本打开工作空间F:/BOS/project/metadata/com/kingdee/eas/custom/tender/client下的对应单据的ListUI.ui,更改名称,然后发布,刷新src,从新登录。

        //去除分录Grid索引列中的值(即分录最左边一列显示的1,2,3,4序号)

答:     kdtEntrys.getIndexColumn().setTextVisible(false);
12.、、去除分录Grid中的每一行的水平线或者每一列的竖直线
答:    kdtEntrys.setVerticalGridLineVisible(false);
       kdtEntrys.setHorizonGridLineVisible(false);
          kdtEntrys.setVerticalGridLineVisible(false);
kdtEntrys.setHorizonGridLineVisible(false);
kdtEntrys.getRow(i).getCell("scord").getStyleAttributes().setBackground(kdtEntrys.getRequiredColor());//给单元格加背景色
kDTable1.getColumn("BidName").setWidth(180);//设置list单元格宽度

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值