eas bos 常用代码

来源:互联网 发布:温饱而知廉耻 编辑:程序博客网 时间:2024/06/05 13:29
  1. .replace("[""'").replace("]""'").replace(", ""', '")  
  2. EAS系统菜单表    T_BAS_SysMenuItem  
  3.   
  4. //java次方算法i的n次方  
  5. Math.pow(i, n);  
  6.   
  7.   
  8.   
  9.   
  10. //校验菜单存在与校验表存在  
  11. if not exists (select * from T_BAS_ParamValueRange where fid ='yh9pCZ0xTNGP8dxwAJDrWxsoUZM=')  
  12. if not exists (select * from KSQL_USERTABLES where KSQL_TABNAME='CT_INV_InviteApplyNotice')  
  13.   
  14.   
  15.   
  16.   
  17. //HR与组织范围的交集过滤  
  18. String userID = ((UserInfo) (SysContext.getSysContext().getCurrentUser())).getId().toString();  
  19. String hrOrgUnitId = SysContext.getSysContext().getCurrentHRUnit().getId().toString();  
  20. StringBuffer sql = new StringBuffer();  
  21.   
  22. sql.append("SELECT FFromUnitID FROM T_ORG_UnitRelation WHERE FToUnitID = ");  
  23. sql.append("'");  
  24. sql.append(hrOrgUnitId);  
  25. sql.append("'");  
  26.   
  27. sql.append(" AND ");  
  28. sql.append(" FTypeRelationID = ");  
  29. sql.append("'00000000-0000-0000-0000-0000000000100FE9F8B5'");  
  30.   
  31. sql.append(" AND ");  
  32. sql.append("FFromUnitID IN (");  
  33.   
  34. sql.append("SELECT FOrgID FROM T_PM_OrgRange WHERE FUserID = ");  
  35. sql.append("'");  
  36. sql.append(userID);  
  37. sql.append("'");  
  38. sql.append(" AND ");  
  39. sql.append("FType = ");  
  40. sql.append(OrgRangeType.ADMIN_ORG_TYPE_VALUE);  
  41.   
  42. sql.append(")");  
  43.   
  44. EntityViewInfo filter = new EntityViewInfo();  
  45. FilterInfo filterInfo = new FilterInfo();  
  46. filterInfo.getFilterItems().add(new FilterItemInfo("usedStatus""1", CompareType.EQUALS));  
  47. filterInfo.getFilterItems().add(new FilterItemInfo("internalCompany.id in ("+sql.toString()+")"));  
  48.   
  49. filter.setFilter(filterInfo);  
  50.   
  51.   
  52.   
  53.   
  54. // 查看是否有相关操作权限  
  55. boolean hasAllotPermission = true;  
  56. try {  
  57.     hasAllotPermission = PermissionFactory.getRemoteInstance()  
  58.         .hasFunctionPermission(new ObjectUuidPK(userId),  
  59.                 new ObjectUuidPK(orgId),  
  60.                 "jc_persale_contract_Allot");  
  61. catch (EASBizException e1) {  
  62.     e1.printStackTrace();  
  63. catch (BOSException e1) {  
  64.     e1.printStackTrace();  
  65. }  
  66.   
  67.   
  68.   
  69.   
  70. //客户端sql查询代码  
  71. IRowSet set = SQLExecutorFactory.getRemoteInstance("select FIP from CT_SM_Config").executeSQL();  
  72.   
  73.   
  74.   
  75.   
  76. //去掉关闭eas页面时校验是否修改的提示  
  77. 页面重写checkBeforeWindowClosing()方法返回true值。  
  78.   
  79.   
  80.   
  81.   
  82. //eas代码中数据绑定  
  83. dataBinder.registerBinding("entry.alterDate", java.util.Date.classthis.kdtEntry, "alterDate.text");  
  84. dataBinder.registerBinding("comChangeRecord", String.classthis.txtcomChangeRecord, "text");  
  85.   
  86.   
  87.   
  88.   
  89. //eas中Action的创建  
  90. protected KDWorkButton btnFileManage;  
  91. protected ActionFileManage actionFileManage = null;  
  92.   
  93. public void onLoad() throws Exception {  
  94.     super.onLoad();  
  95.   
  96.     this.actionFileManage = new ActionFileManage(this);  
  97.     getActionManager().registerAction("actionFileManage", actionFileManage);  
  98.     this.actionFileManage.addService(new com.kingdee.eas.framework.client.service.PermissionService());  
  99.   
  100.     this.btnFileManage = new KDWorkButton();  
  101.     this.btnFileManage.setEnabled(true);  
  102.     this.btnFileManage.setName("btnFileManage");  
  103.     this.btnFileManage.setAction((IItemAction)ActionProxyFactory.getProxy(actionFileManage, new Class[] { IItemAction.class }, getServiceContext()));         
  104.     this.btnFileManage.setText("档案管理");       
  105.     this.btnFileManage.setIcon(com.kingdee.eas.util.client.EASResource.getIcon("imgTree_layoutproject"));  
  106.   
  107.     this.toolBar.add(btnFileManage);  
  108.           
  109.     this.btnFileManage.setEnabled(true);  
  110. }  
  111.   
  112. protected class ActionFileManage extends ItemAction {  
  113.     public ActionFileManage() {  
  114.         this(null);  
  115.     }  
  116.   
  117.     public ActionFileManage(IUIObject uiObject) {  
  118.         super(uiObject);  
  119.         String _tempStr = null;  
  120.         this.setEnabled(false);  
  121.         _tempStr = "档案管理";  
  122.         this.putValue(ItemAction.SHORT_DESCRIPTION, _tempStr);  
  123.         _tempStr = "档案管理";  
  124.         this.putValue(ItemAction.LONG_DESCRIPTION, _tempStr);  
  125.         _tempStr = "档案管理";  
  126.         this.putValue(ItemAction.NAME, _tempStr);  
  127.     }  
  128.   
  129.     public void actionPerformed(ActionEvent e) {  
  130.         getUIContext().put("ORG.PK", getOrgPK(this));  
  131.         innerActionPerformed("eas", ComFileAssoUI.this"ActionFileManage""actionFileManage_actionPerformed", e);  
  132.     }  
  133. }  
  134.   
  135. public void actionFileManage_actionPerformed(ActionEvent e) throws Exception {  
  136.     ComUnitInfo comUnitInfo = this.getComUnit();  
  137.     Map params = new UIContext(this);  
  138.     params.put("comUnit", comUnitInfo);  
  139.     params.put("operate""manage");  
  140.     if(comUnitInfo != null)  
  141.         params.put("mainId", comUnitInfo.getMainId());  
  142.     uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(  
  143.                 "com.kingdee.eas.zsj.propertymanagementend.client.ComFileManageUI", params, null, OprtState.ADDNEW);  
  144.     uiWindow.show();  
  145. }  
  146.   
  147.   
  148.   
  149.   
  150. //设置kDContainer显示模式默认为0,可向下展开收缩;1,固定;2?  
  151. kDContainer1.setContainerType(1);  
  152.   
  153.   
  154.   
  155.   
  156. //在EAS查询分析器中查看对应的服务器端脚本  
  157. geninsert +sql语句  再选中点击‘运行服务器端脚本’  
  158.   
  159.   
  160.   
  161. //在EAS里Confirm2为2按钮提示框(确定、取消),确定返回0,取消返回2  
  162. if (MsgBox.showConfirm2("您选中的第"+(i+1)+"条数据是未归档数据,如果继续,该数据的附件将不会下载,是否继续?") == 0) {  
  163.     continue;  
  164. else {  
  165.     SysUtil.abort();  
  166. }  
  167.   
  168.   
  169.   
  170. //在EAS里Confirm3为3按钮提示框(是、否、取消),是返回0,否返回1,取消返回2  
  171. if (MsgBox.showConfirm3("您选中的第"+(i+1)+"条数据是未归档数据,如果继续,该数据的附件将不会下载,是否继续?") == 0) {  
  172.     continue;  
  173. else {  
  174.     SysUtil.abort();  
  175. }  
  176.   
  177.   
  178.   
  179. //EAS单据转换转换之前方法接口,用于实现单据转换自定义控制  
  180. public void beforeTransform(IObjectCollection srcObjCols,  
  181.         String destBillBosType) {  
  182.     super.beforeTransform(srcObjCols, destBillBosType);  
  183. }  
  184.   
  185.   
  186.   
  187. //EAS单据转换目标单据后台事务方法,用于实现单据转换自定义控制  
  188. public void handleAfterTransform(Context ctx, String action,  
  189.             IObjectCollection collection) throws BOSException, EASBizException {  
  190.     super.handleAfterTransform(ctx, action, collection);  
  191. }  
  192.   
  193.   
  194.   
  195. //EAS通过单据ID获得单据实体BOSTYPE  
  196. BOSUuid.getBOSObjectType(billID, true);  
  197.   
  198.   
  199.   
  200. //修改EAS编辑界面中分录默认携带的标题栏  
  201. this.kdtEntrys_detailPanel.setTitle("物件内容");  
  202. KDContainer kdtEntrys_Container = (KDContainer) ((KDPanel) this.kdtEntrys_detailPanel.getComponent(0)).getComponent(0);  
  203. ((KDPanel) this.kdtEntrys_detailPanel.getComponent(0)).remove(0);  
  204. ((KDPanel) this.kdtEntrys_detailPanel.getComponent(0)).add(kdtEntrys_Container, new KDLayout.Constraints(0598319, KDLayout.Constraints.ANCHOR_TOP | KDLayout.Constraints.ANCHOR_LEFT | KDLayout.Constraints.ANCHOR_RIGHT));  
  205. age:  
  206.         this.kdtEntry_detailPanel.setTitle("分支机构");  
  207.         this.kdtEntry.getStyleAttributes().setLocked(true);  
  208.         this.kdtEntry.getSelectManager().setSelectMode(2);  
  209.         if (((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(0instanceof KDContainer) {  
  210.             KDContainer kdtEntrys_Container = (KDContainer) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(0);  
  211.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).remove(0);  
  212.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).add(kdtEntrys_Container, new KDLayout.Constraints(0574919, KDLayout.Constraints.ANCHOR_TOP | KDLayout.Constraints.ANCHOR_LEFT | KDLayout.Constraints.ANCHOR_RIGHT));  
  213.         }  
  214.         if (((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(0instanceof KDWorkButton && ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(0)).getName().equals("btnAddnewLine")) {  
  215.             KDWorkButton btnAddnewLine = ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(0));  
  216.             btnAddnewLine.setIcon(null);  
  217.             btnAddnewLine.setText("新增分支机构");  
  218.             btnAddnewLine.setToolTipText("新增分支机构");  
  219.             btnAddnewLine.removeActionListener(btnAddnewLine.getActionListeners() [0]);  
  220.             btnAddnewLine.addActionListener(new ActionListener() {  
  221.                 public void actionPerformed(ActionEvent e) {  
  222.                     try {  
  223.                         BranchAddNew(e);  
  224.                     } catch (Exception e1) {  
  225.                         e1.printStackTrace();  
  226.                     }  
  227.                 }  
  228.             });  
  229.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).remove(0);  
  230.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).add(btnAddnewLine, new KDLayout.Constraints(399511019, KDLayout.Constraints.ANCHOR_TOP | KDLayout.Constraints.ANCHOR_RIGHT), 0);  
  231.         }  
  232.         if (((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(1instanceof KDWorkButton && ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(1)).getName().equals("btnInsertLine")) {  
  233.             KDWorkButton btnInsertLine = ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(1));  
  234.             btnInsertLine.setIcon(null);  
  235.             btnInsertLine.setText("修改分支机构");  
  236.             btnInsertLine.setToolTipText("修改分支机构");  
  237.             btnInsertLine.removeActionListener(btnInsertLine.getActionListeners() [0]);  
  238.             btnInsertLine.addActionListener(new ActionListener() {  
  239.                 public void actionPerformed(ActionEvent e) {  
  240.                     try {  
  241.                         BranchEdit(e);  
  242.                     } catch (Exception e1) {  
  243.                         e1.printStackTrace();  
  244.                     }  
  245.                 }  
  246.             });  
  247.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).remove(1);  
  248.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).add(btnInsertLine, new KDLayout.Constraints(514511019, KDLayout.Constraints.ANCHOR_TOP | KDLayout.Constraints.ANCHOR_RIGHT), 1);  
  249.         }  
  250.         if (((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(2instanceof KDWorkButton && ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(2)).getName().equals("btnRemoveLines")) {  
  251.             KDWorkButton btnRemoveLines = ((KDWorkButton) ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).getComponent(2));  
  252.             btnRemoveLines.setIcon(null);  
  253.             btnRemoveLines.setText("删除分支机构");  
  254.             btnRemoveLines.setToolTipText("删除分支机构");  
  255.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).remove(2);  
  256.             ((KDPanel) this.kdtEntry_detailPanel.getComponent(0)).add(btnRemoveLines, new KDLayout.Constraints(629511019, KDLayout.Constraints.ANCHOR_TOP | KDLayout.Constraints.ANCHOR_RIGHT), 2);  
  257.         }  
  258.   
  259.   
  260.   
  261. //EAS检查单据是否在流程中  
  262. import com.kingdee.bos.ui.face.CoreUIObject;  
  263. import com.kingdee.bos.workflow.ProcessInstInfo;  
  264. import com.kingdee.bos.workflow.service.ormrpc.EnactmentServiceFactory;  
  265. import com.kingdee.bos.workflow.service.ormrpc.IEnactmentService;  
  266.   
  267.     public static boolean checkBillInWorkflow(CoreUIObject ui, String id) {  
  268.         ProcessInstInfo instInfo = null;  
  269.         ProcessInstInfo procInsts[] = null;  
  270.         try {  
  271.             IEnactmentService service2 = EnactmentServiceFactory.createRemoteEnactService();  
  272.             procInsts = service2.getProcessInstanceByHoldedObjectId(id);  
  273.         } catch(BOSException e) {  
  274.             ExceptionHandler.handle(e);  
  275.             return false;  
  276.         }  
  277.         int i = 0;  
  278.         for (int n = procInsts.length; i < n; i++)  
  279.             if("open.running".equals(procInsts[i].getState()) || "open.not_running.suspended".equals(procInsts[i].getState()))  
  280.                 instInfo = procInsts[i];  
  281.         if (instInfo != null) {  
  282.             return true;  
  283.         }  
  284.         return false;  
  285.     }  
  286.   
  287.   
  288.   
  289. //EASList界面设置打开的Edit界面模式  
  290. import com.kingdee.eas.common.client.UIFactoryName;  
  291. import com.kingdee.eas.framework.util.UIConfigUtility;  
  292.     protected String getEditUIModal() {  
  293.         String openModel = UIConfigUtility.getOpenModel();  
  294.         if (openModel != null) {  
  295.             return openModel;  
  296.         }  
  297.         return UIFactoryName.MODEL;  
  298.     }  
  299.   
  300.   
  301.   
  302. //EASEdit界面关闭提交以后继续新增(提交并新增、提交并打印)  
  303.     protected boolean isSubmitLoad() {  
  304.         return false;  
  305.     }  
  306.     protected boolean isContinueAddNew() {  
  307.         return false;  
  308.     }  
  309.         chkMenuItemSubmitAndAddNew.setSelected(false);  
  310.         chkMenuItemSubmitAndPrint.setSelected(false);  
  311.   
  312.   
  313.   
  314. //EAS创建一个UI界面并对其操作  
  315. age:  
  316.     private void BranchAddNew(ActionEvent e) {  
  317.     UIContext uiContext = new UIContext(this);  
  318.     uiContext.put(UIContext.ID, null);  
  319.     uiContext.put(UIContext.OWNER, this);  
  320.     uiContext.put("parent", editData);  
  321.     IUIWindow uiWindow = null;  
  322.     try {  
  323.         uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWWIN).create(BranchShowUI.class.getName(), uiContext, null, OprtState.ADDNEW);  
  324.         uiWindow.show();  
  325.     } catch (UIException e1) {  
  326.         e1.printStackTrace();  
  327.     }  
  328.     }  
  329.   
  330.   
  331.   
  332. //EAS中获得任何一个KDTable的选中行  
  333. import com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil;  
  334. int[] selectRows = KDTableUtil.getSelectedRows(this.kdtEntry);  
  335. age:  
  336.         int[] selectRows = KDTableUtil.getSelectedRows(this.kdtEntry);  
  337.         if (selectRows.length <= 0) {  
  338.             MsgBox.showInfo("请选择要修改的数据");  
  339.             SysUtil.abort();  
  340.         }  
  341.   
  342.   
  343.   
  344.   
  345. //去掉EAS单据新增时单据组织与当前组织不一致的校验  
  346.     protected void checkIsOUSealUp() throws Exception {  
  347. //      super.checkIsOUSealUp();  
  348.     }  
  349.   
  350.   
  351.   
  352.   
  353. //把EAS左树右表基础资料界面引用为左树右表F7的简单方法  
  354. age:  
  355. /** 
  356.  * 加载配件F7(左树右表) 
  357.  * @param F7Filed           要加载的F7控件 
  358.  * @param ctx               界面上下文 
  359.  * @单据中用法示例 
  360.  *      final KDBizPromptBox kdtEntrys_accessories_PromptBox = new KDBizPromptBox(); 
  361.  *      CommonUtil.loadAccessoriesF7PromptBox(kdtEntrys_accessories_PromptBox, this.getUIContext()); 
  362.  * @throws Exception  
  363.  */  
  364. public static void loadAccessoriesF7PromptBox(final KDBizPromptBox F7Filed, Map ctx) throws Exception {  
  365.     F7Filed.setQueryInfo("com.kingdee.eas.mydep.assetmanage.database.app.AccessoriesQuery");  
  366.     F7Filed.setEntityViewInfo(new EntityViewInfo("where state=1"));  
  367.     F7Filed.setDisplayFormat("$name$");  
  368.     F7Filed.setEditFormat("$number$");  
  369.     F7Filed.setCommitFormat("$number$");  
  370.         F7Filed.addSelectorListener(new SelectorListener() {  
  371.             AccessoriesListUI accessoriesF7UI = null;  
  372.             public void willShow(SelectorEvent e) {  
  373.                 if (accessoriesF7UI == null) {  
  374.                     try {  
  375.                         accessoriesF7UI = new AccessoriesListUI();  
  376.                         HashMap ctx = new HashMap();  
  377.                         ctx.put("bizUIOwner", javax.swing.SwingUtilities.getWindowAncestor(accessoriesF7UI));  
  378.                         accessoriesF7UI.setF7Use(true, ctx);  
  379.                     accessoriesF7UI.setFilterForQuery(new FilterInfo("state=1"));  
  380.                 } catch (ParserException e1) {  
  381.                     e1.printStackTrace();  
  382.                 } catch (Exception e2) {  
  383.                     e2.printStackTrace();  
  384.                 }  
  385.                     F7Filed.setSelector(accessoriesF7UI);  
  386.                 }  
  387.             }  
  388.     });  
  389. }  
  390.   
  391.   
  392.   
  393.   
  394. //获取EAS中的指定系统参数  
  395.     IParamControl ipc = ParamControlFactory.getLocalInstance(ctx);  
  396.     String level = ipc.getParamValue(new ObjectUuidPK(ContextUtil.getCurrentHRUnit(ctx).getId().toString()), "IS_CONTRAL_SHOW_DEPT_LEVEL");  
  397.   
  398.   
  399.   
  400.   
  401. //EAS序事薄界面过滤示例  
  402.     protected FilterInfo getDefaultFilterForQuery() {  
  403.     FilterInfo filter = super.getDefaultFilterForQuery();  
  404.         try {  
  405.         boolean haspermission = PermissionFactory.getRemoteInstance().hasFunctionPermission(getUserPk(), getOrgPK(),"SSSCC_HR_Workovertime_showall");  
  406.         if (!haspermission) {  
  407.             UserInfo userInfo = SysContext.getSysContext().getCurrentUserInfo();  
  408.         if (filter == null) {  
  409.             filter = new FilterInfo();  
  410.             filter.getFilterItems().add(new FilterItemInfo("creator.id", userInfo==null?" ":userInfo.getId().toString()));  
  411.             filter.getFilterItems().add(new FilterItemInfo("auditor.id", userInfo==null?" ":userInfo.getId().toString()));  
  412.             filter.getFilterItems().add(new FilterItemInfo("applier.id", userInfo==null?" ":(userInfo.getPerson()==null?" ":userInfo.getPerson().getId().toString())));  
  413.             filter.setMaskString(" #0 or #1 or #2 ");  
  414.         } else {  
  415.             FilterInfo _filter = new FilterInfo();  
  416.             _filter.getFilterItems().add(new FilterItemInfo("creator.id", userInfo==null?" ":userInfo.getId().toString()));  
  417.             _filter.getFilterItems().add(new FilterItemInfo("auditor.id", userInfo==null?" ":userInfo.getId().toString()));  
  418.             _filter.getFilterItems().add(new FilterItemInfo("applier.id", userInfo==null?" ":(userInfo.getPerson()==null?" ":userInfo.getPerson().getId().toString())));  
  419.             _filter.setMaskString(" #0 or #1 or #2 ");  
  420.                 filter.mergeFilter(_filter, "and");  
  421.         }  
  422.         List billIDList = ZQHRUtils.getAuditorInBillID("加班申请单");  
  423.         if (billIDList != null) {  
  424.             FilterInfo _filter = new FilterInfo();  
  425.             _filter.getFilterItems().add(new FilterItemInfo("id", billIDList.toString().replace("[""'").replace("]""'").replace(", ""', '"), CompareType.INNER));  
  426.                 filter.mergeFilter(_filter, "or");  
  427.         }  
  428.         }  
  429.     } catch (EASBizException e) {  
  430.         e.printStackTrace();  
  431.     } catch (BOSException e) {  
  432.         e.printStackTrace();  
  433.     } catch (Exception e) {  
  434.         e.printStackTrace();  
  435.     }  
  436.     SorterItemInfo sii = new SorterItemInfo("createTime");  
  437.     sii.setSortType(SortType.DESCEND);  
  438.     mainQuery.getSorter().add(sii);  
  439.         return filter;  
  440.     }  
  441.       
  442.     protected IQueryExecutor getQueryExecutor(IMetaDataPK pk, EntityViewInfo viewInfo) {  
  443.     FilterInfo filter = null;  
  444.         if (viewInfo == null) {  
  445.             viewInfo = new EntityViewInfo();  
  446.             filter = new FilterInfo();  
  447.         } else {  
  448.             filter = viewInfo.getFilter();  
  449.             FilterItemCollection filterColl = filter.getFilterItems();  
  450.             for (int i=0; i<filterColl.size(); i++) {  
  451.                 filter.getMaskString();  
  452.                 FilterItemInfo itemInfo = filterColl.get(i);  
  453.                 if (itemInfo.toString().indexOf("id IN") != -1) {  
  454.                 try {  
  455.                     List billIDList = ZQHRUtils.getAuditorInBillID("加班申请单");  
  456.                     if (billIDList != null) {  
  457.                         filter.getFilterItems().removeObject(itemInfo);  
  458.                         filter.getFilterItems().addObject(i, new FilterItemInfo("id", billIDList.toString().replace("[""'").replace("]""'").replace(", ""', '"), CompareType.INNER));  
  459.                     }  
  460.                 } catch (Exception e) {  
  461.                     e.printStackTrace();  
  462.                 }  
  463.                 }  
  464.             }  
  465.         }  
  466.         return super.getQueryExecutor(pk, viewInfo);  
  467.     }  
  468.   
  469.   
  470.   
  471.   
  472. //EAS编辑界面重新加载数据  
  473.     this.loadData();  
  474.   
  475.   
  476.   
  477.   
  478. //EAS中设定table选择模式  
  479.         tblMain.getSelectManager().setSelectMode(0);--不能选择  
  480.         tblMain.getSelectManager().setSelectMode(1);--选择单元格  
  481.         tblMain.getSelectManager().setSelectMode(2);--单选行  
  482.         tblMain.getSelectManager().setSelectMode(3);--选择单元格  
  483.         tblMain.getSelectManager().setSelectMode(4);--单选列  
  484.   
  485.   
  486.   
  487.   
  488. //EAS中删除原来的监听事件添加新的监听事件  
  489.     kdtEntrys.removeKDTEditListener(kdtEntrys.getListeners(KDTEditListener.class)[0]);  
  490.         kdtEntrys.addKDTEditListener(new KDTEditAdapter() {  
  491.             public void editStopped(KDTEditEvent e) {  
  492.                 try {  
  493.                     kdtEntrys_Changed(e);  
  494.                 }  
  495.                 catch (Exception exc) {  
  496.                     handUIException(exc);  
  497.                 }  
  498.             }  
  499.         });  
  500.   
  501.   
  502.   
  503.   
  504. //EAS序事薄界面更改显示过滤条件和排序  
  505.     protected FilterInfo getDefaultFilterForQuery() {  
  506.         FilterInfo filter = super.getDefaultFilterForQuery();  
  507.         try {  
  508.             boolean haspermission = PermissionFactory.getRemoteInstance().hasFunctionPermission(getUserPk(), getOrgPK(),"SSSCC_HR_Workovertime_showall");  
  509.             if (!haspermission) {  
  510.                 UserInfo userInfo = SysContext.getSysContext().getCurrentUserInfo();  
  511.                 if (filter == null) {  
  512.                     filter = new FilterInfo();  
  513.                     filter.getFilterItems().add(new FilterItemInfo("creator.id", userInfo==null?" ":userInfo.getId().toString()));  
  514.                     filter.getFilterItems().add(new FilterItemInfo("auditor.id", userInfo==null?" ":userInfo.getId().toString()));  
  515.                     filter.getFilterItems().add(new FilterItemInfo("applier.id", userInfo==null?" ":(userInfo.getPerson()==null?" ":userInfo.getPerson().getId().toString())));  
  516.                     filter.setMaskString(" #0 or #1 or #2 ");  
  517.                 } else {  
  518.                     FilterInfo _filter = new FilterInfo();  
  519.                     _filter.getFilterItems().add(new FilterItemInfo("creator.id", userInfo==null?" ":userInfo.getId().toString()));  
  520.                     _filter.getFilterItems().add(new FilterItemInfo("auditor.id", userInfo==null?" ":userInfo.getId().toString()));  
  521.                     _filter.getFilterItems().add(new FilterItemInfo("applier.id", userInfo==null?" ":(userInfo.getPerson()==null?" ":userInfo.getPerson().getId().toString())));  
  522.                     _filter.setMaskString(" #0 or #1 or #2 ");  
  523.                     filter.mergeFilter(_filter, "and");  
  524.                 }  
  525.                 List billIDList = ZQHRUtils.getAuditorInBillID("加班申请单");  
  526.                 if (billIDList != null) {  
  527.                     FilterInfo _filter = new FilterInfo();  
  528.                     _filter.getFilterItems().add(new FilterItemInfo("id", billIDList.toString().replace("[""'").replace("]""'").replace(", ""', '"), CompareType.INNER));  
  529.                     filter.mergeFilter(_filter, "or");  
  530.                 }  
  531.             }  
  532.         } catch (EASBizException e) {  
  533.             e.printStackTrace();  
  534.         } catch (BOSException e) {  
  535.             e.printStackTrace();  
  536.         } catch (Exception e) {  
  537.             e.printStackTrace();  
  538.         }  
  539.         SorterItemInfo sii = new SorterItemInfo("createTime");  
  540.         sii.setSortType(SortType.DESCEND);  
  541.         mainQuery.getSorter().add(sii);  
  542.         return filter;  
  543.     }  
  544.   
  545.   
  546.   
  547.   
  548. //获取单据编码规则  
  549.             /** 
  550.          * @Title: getNumber 
  551.          * @Description: TODO(获取单据编码规则) 
  552.          *               <p> 
  553.          * @date 2010-11-12 
  554.          * @param dataBaseInfo model.put("number", JCBillUtil.getNumber(model, null)); 
  555.          * @return 
  556.          */  
  557.         public static String getNumber(IObjectValue objectValue, String companyId)  
  558.         {  
  559.             // 设置编码规则  
  560.             if(null == companyId)  
  561.             {  
  562.                 companyId = getCurCompanyOrgUnit().getId().toString();  
  563.             }  
  564.             try  
  565.             {  
  566.                 ICodingRuleManager rule = CodingRuleManagerFactory.getRemoteInstance();  
  567.                 if(rule.isExist(objectValue, companyId))  
  568.                 {  
  569.                     return rule.getNumber(objectValue, companyId);  
  570.                 }  
  571.             }catch(Exception e)  
  572.             {  
  573.                 e.printStackTrace();  
  574.                 return null;  
  575.             }  
  576.             return null;  
  577.         }  
  578.   
  579.   
  580.   
  581.   
  582.   
  583. //java创建文件  
  584. import java.io.RandomAccessFile;  
  585.   
  586.                 RandomAccessFile inOut = new RandomAccessFile("C:\\Documents and Settings\\Administrator\\桌面\\天健\\patch\\edit\\"+contentColl.get(i).getFileName(), "rw");   
  587.                 inOut.write(contentColl.get(i).getContentFile());  
  588.                 inOut.close();  
  589.   
  590.   
  591.   
  592.   
  593.   
  594. //流程审批界面保存按钮Action绑定改为当前单据saveAction  
  595.         if(this.getUIContext().get("Owner"instanceof MultiApproveUI) {   
  596.             MultiApproveUI wfUI = (MultiApproveUI)this.getUIContext().get("Owner");  
  597.             KDToolBar wfToolBar = wfUI.getUIToolBar();  
  598.             Component[] components = wfToolBar.getComponents();  
  599.             KDWorkButton wfBtnSave = null;  
  600.             for (int i=0; i<(components.length-1); i++) {  
  601.                 if (components[i] instanceof KDWorkButton && components[i].getName().equals("btnSave")) {  
  602.                     wfBtnSave = (KDWorkButton) components[i];  
  603.                     wfBtnSave.removeActionListener(wfBtnSave.getAction());  
  604.                     wfBtnSave.setAction(actionSave);  
  605.                     break;  
  606.                 }  
  607.             }  
  608.         }  
  609.   
  610.   
  611.   
  612.   
  613. //清除分录删除事件  
  614.         int n = kdtEntrys_detailPanel.getRemoveLinesButton().getActionListeners().length;  
  615.         if (n > 0) {  
  616.             for (int i=0; i<n; i++) {  
  617.                 kdtEntrys_detailPanel.getRemoveLinesButton().removeActionListener(kdtEntrys_detailPanel.getRemoveLinesButton().getActionListeners() [i]);  
  618.             }  
  619.         }  
  620.         kdtEntrys_detailPanel.getRemoveLinesButton().addActionListener(actionRemoveLine);  
  621.           
  622. //清除分录插入事件  
  623.         n = kdtEntrys_detailPanel.getInsertLineButton().getActionListeners().length;  
  624.         if (n > 0) {  
  625.             for (int i=0; i<n; i++) {  
  626.                 kdtEntrys_detailPanel.getInsertLineButton().removeActionListener(kdtEntrys_detailPanel.getInsertLineButton().getActionListeners() [i]);  
  627.             }  
  628.         }  
  629.         kdtEntrys_detailPanel.getInsertLineButton().addActionListener(actionInsertLine);  
  630.           
  631. //清除分录新增事件  
  632.         n = kdtEntrys_detailPanel.getAddNewLineButton().getActionListeners().length;  
  633.         if (n > 0) {  
  634.             for (int i=0; i<n; i++) {  
  635.                 kdtEntrys_detailPanel.getAddNewLineButton().removeActionListener(kdtEntrys_detailPanel.getAddNewLineButton().getActionListeners() [i]);  
  636.             }  
  637.         }  
  638.         kdtEntrys_detailPanel.getAddNewLineButton().addActionListener(actionAddLine);  
原创粉丝点击