eas 行业常用代码

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

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值