列表界面增加自定义面板过滤条件

发布时间:2017-3-26 9:30:31 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"列表界面增加自定义面板过滤条件",主要涉及到列表界面增加自定义面板过滤条件方面的内容,对于列表界面增加自定义面板过滤条件感兴趣的同学可以参考一下。

/** * output package name */ package com.kingdee.eas.jc.trading.invoice.client; import java.awt.event.*; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import org.apache.log4j.Logger; import com.kingdee.bos.BOSException; import com.kingdee.bos.metadata.IMetaDataPK; import com.kingdee.bos.metadata.entity.EntityViewInfo; import com.kingdee.bos.metadata.entity.FilterInfo; import com.kingdee.bos.metadata.entity.SelectorItemCollection; import com.kingdee.bos.metadata.entity.SelectorItemInfo; import com.kingdee.bos.ui.face.CoreUIObject; import com.kingdee.bos.ui.face.IUIWindow; import com.kingdee.bos.ui.face.UIFactory; import com.kingdee.bos.dao.IObjectPK; import com.kingdee.bos.dao.IObjectValue; import com.kingdee.bos.dao.ormapping.ObjectUuidPK; import com.kingdee.bos.dao.query.IQueryExecutor; import com.kingdee.eas.base.commonquery.client.CommonQueryDialog; import com.kingdee.eas.common.client.OprtState; import com.kingdee.eas.common.client.SysContext; import com.kingdee.eas.common.client.UIContext; import com.kingdee.eas.common.client.UIFactoryName; import com.kingdee.eas.fi.cas.IReceivingBill; import com.kingdee.eas.fi.cas.ReceivingBillFactory; import com.kingdee.eas.fi.gl.client.VoucherEditUI; import com.kingdee.eas.framework.*; import com.kingdee.eas.jc.performance.prediction.IPrediction; import com.kingdee.eas.jc.performance.prediction.PredictionFactory; import com.kingdee.eas.jc.performance.prediction.PredictionInfo; import com.kingdee.eas.jc.trading.deposit.DepositManFactory; import com.kingdee.eas.jc.trading.deposit.DepositManInfo; import com.kingdee.eas.jc.trading.deposit.IDepositMan; import com.kingdee.eas.jc.trading.invoice.BizTypeEnum; import com.kingdee.eas.jc.trading.invoice.IInvoiceBill; import com.kingdee.eas.jc.trading.invoice.InvoiceBillFactory; import com.kingdee.eas.jc.trading.invoice.InvoiceBillInfo; import com.kingdee.eas.jc.util.BizControlHelper; import com.kingdee.eas.util.SysUtil; import com.kingdee.eas.util.client.MsgBox; /** * output class name */ public class InvoiceBillListUI extends AbstractInvoiceBillListUI { private static final Logger logger = CoreUIObject.getLogger(InvoiceBillListUI.class); private InvoiceBillFilterUI filterUI = null; /** * output class constructor */ public InvoiceBillListUI() throws Exception { super(); } // @Override public void onLoad() throws Exception { super.onLoad(); initUI(); } // @Override public void onShow() throws Exception { super.onShow(); initUI(); } public void actionQuery_actionPerformed(ActionEvent arg0) throws Exception { // TODO Auto-generated method stub super.actionQuery_actionPerformed(arg0); this.actionVoucher.setVisible(true); this.actionVoucher.setEnabled(true); this.actionDelVoucher.setVisible(true); this.actionDelVoucher.setEnabled(true); this.actionViewVoucher.setVisible(true); this.actionViewVoucher.setEnabled(true); this.btnVoucher.setVisible(true); this.btnVoucher.setEnabled(true); this.btnDelVoucher.setVisible(true); this.btnDelVoucher.setEnabled(true); this.btnViewVoucher.setVisible(true); this.btnViewVoucher.setEnabled(true); } /** * 审核 */ // @Override public void actionAudit_actionPerformed(ActionEvent e) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); String id = getSelectedKeyValue(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); InvoiceBillInfo invoiceBillInfo = iInvoiceBill.getInvoiceBillInfo("select * where id='" + id + "'"); if (invoiceBillInfo.isHasEffected()) { MsgBox.showWarning("单据已审核!"); SysUtil.abort(); } invoiceBillInfo.setHasEffected(true); invoiceBillInfo.setAuditor(SysContext.getSysContext().getCurrentUserInfo()); SelectorItemCollection sic = new SelectorItemCollection(); sic.add(new SelectorItemInfo("hasEffected")); sic.add(new SelectorItemInfo("auditor")); iInvoiceBill.updatePartial(invoiceBillInfo, sic); actionRefresh_actionPerformed(null); } /** * 反审核 */ @Override public void actionUnAudit_actionPerformed(ActionEvent e) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); String id = getSelectedKeyValue(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); InvoiceBillInfo invoiceBillInfo = iInvoiceBill.getInvoiceBillInfo("select * where id='" + id + "'"); if (!invoiceBillInfo.isHasEffected()) { MsgBox.showWarning("单据未审核!"); SysUtil.abort(); } if (invoiceBillInfo.isFivouchered()) { MsgBox.showWarning("单据已生成凭证,不能反审核!"); SysUtil.abort(); } invoiceBillInfo.setHasEffected(false); invoiceBillInfo.setAuditor(null); SelectorItemCollection sic = new SelectorItemCollection(); sic.add(new SelectorItemInfo("hasEffected")); sic.add(new SelectorItemInfo("auditor")); iInvoiceBill.updatePartial(invoiceBillInfo, sic); actionRefresh_actionPerformed(null); } /** * 生成凭证 */ // @Override public void actionVoucher_actionPerformed(ActionEvent arg0) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance();// 发票接口 ArrayList idList = getSelectedIdValues(); Set idSet = new HashSet(); for (int i = 0; i < idList.size(); i++) { String id = idList.get(i).toString(); InvoiceBillInfo info = iInvoiceBill.getInvoiceBillInfo(new ObjectUuidPK(id)); if (!info.isHasEffected()) { MsgBox.showWarning("单据未审核!"); SysUtil.abort(); } if (info.isFivouchered()) { MsgBox.showWarning("单据已生成凭证,不能再次生成!"); SysUtil.abort(); } if (!(BizTypeEnum.MAKE_OUT_INVOICE.equals(info.getBizType()) || BizTypeEnum.BACK_INVOICE.equals(info.getBizType())))// 非开具发票,非退票 { MsgBox.showWarning("开具发票或退票的才能生成凭证!"); SysUtil.abort(); } if (!idSet.contains(id)) { idSet.add(id); } } try { iInvoiceBill.createVoucher(idSet); MsgBox.showInfo("操作成功!"); } catch (Exception ex) { ex.printStackTrace(); MsgBox.showInfo("操作失败:" + ex.getMessage()); } actionRefresh_actionPerformed(null); } /** * 删除凭证 */ // @Override public void actionDelVoucher_actionPerformed(ActionEvent arg0) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); ArrayList idList = getSelectedIdValues(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); try { for (int i = 0; i < idList.size(); i++) { boolean success = iInvoiceBill.deleteVoucher(new ObjectUuidPK(idList.get(i).toString())); if (!success) { MsgBox.showInfo("凭证删除失败!"); return; } MsgBox.showInfo("凭证删除成功!"); } } catch (Exception ex) { ex.printStackTrace(); MsgBox.showInfo("凭证删除失败: " + ex.getMessage()); } actionRefresh_actionPerformed(null); } /** * 查看凭证 */ // @Override public void actionViewVoucher_actionPerformed(ActionEvent e) throws Exception { checkSelected(); String id = getSelectedKeyValue(); IObjectPK pk = new ObjectUuidPK(id); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); InvoiceBillInfo info = iInvoiceBill.getInvoiceBillInfo(pk); if (info.getVoucherID() != null) { UIContext uiContext = new UIContext(this); uiContext.put("ID", info.getVoucherID()); String UIClassName = VoucherEditUI.class.getName(); IUIWindow uiWindow = null; uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(UIClassName, uiContext, null, OprtState.VIEW); uiWindow.show(); } else { MsgBox.showWarning("凭证号为空!"); } actionRefresh_actionPerformed(null); } // @Override protected CommonQueryDialog initCommonQueryDialog() { CommonQueryDialog commonDialog = super.initCommonQueryDialog(); commonDialog.setHeight(400); commonDialog.setWidth(450); commonDialog.setShowFilter(true); commonDialog.setShowSorter(true); commonDialog.setShowToolbar(true); try { if (filterUI == null) { filterUI = new InvoiceBillFilterUI(); } commonDialog.addUserPanel(filterUI); } catch (Exception e) { e.printStackTrace(); } return commonDialog; } // @Override protected FilterInfo getDefaultFilterForQuery() { return null; } // @Override protected boolean initDefaultFilter() { return true; } /** * output actionView_actionPerformed */ public void actionView_actionPerformed(ActionEvent e) throws Exception { super.actionView_actionPerformed(e); } /** * output actionEdit_actionPerformed */ public void actionEdit_actionPerformed(ActionEvent e) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); String id = getSelectedKeyValue(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); InvoiceBillInfo invoiceBillInfo = iInvoiceBill.getInvoiceBillInfo("select * where id='" + id + "'"); if (invoiceBillInfo.isHasEffected()) { MsgBox.showWarning("单据已审核,不能修改!"); SysUtil.abort(); } super.actionEdit_actionPerformed(e); } /** * output actionRemove_actionPerformed */ public void actionRemove_actionPerformed(ActionEvent e) throws Exception { BizControlHelper.currentFIUnitCheck(); checkSelected(); String id = getSelectedKeyValue(); IInvoiceBill iInvoiceBill = InvoiceBillFactory.getRemoteInstance(); InvoiceBillInfo invoiceBillInfo = iInvoiceBill.getInvoiceBillInfo("select * where id='" + id + "'"); if (invoiceBillInfo.isHasEffected()) { MsgBox.showWarning("单据已审核,不能删除!"); SysUtil.abort(); } super.actionRemove_actionPerformed(e); } /** * output actionRefresh_actionPerformed */ public void actionRefresh_actionPerformed(ActionEvent e) throws Exception { super.actionRefresh_actionPerformed(e); this.actionVoucher.setVisible(true); this.actionVoucher.setEnabled(true); this.actionDelVoucher.setVisible(true); this.actionDelVoucher.setEnabled(true); this.actionViewVoucher.setVisible(true); this.actionViewVoucher.setEnabled(true); this.btnVoucher.setVisible(true); this.btnVoucher.setEnabled(true); this.btnDelVoucher.setVisible(true); this.btnDelVoucher.setEnabled(true); this.btnViewVoucher.setVisible(true); this.btnViewVoucher.setEnabled(true); } @Override public void refreshList() throws Exception { super.refreshList(); } private void initUI() { this.actionAttachment.setVisible(false); this.actionAttachment.setEnabled(false); this.actionPrint.setVisible(false); this.actionPrint.setEnabled(false); this.actionPrintPreview.setVisible(false); this.actionPrintPreview.setEnabled(false); this.actionWorkFlowG.setVisible(false); this.actionWorkFlowG.setEnabled(false); this.actionCreateTo.setVisible(false); this.actionCreateTo.setEnabled(false); this.actionAuditResult.setVisible(false); this.actionAuditResult.setEnabled(false); this.actionMultiapprove.setVisible(false); this.actionMultiapprove.setEnabled(false); this.actionNextPerson.setVisible(false); this.actionNextPerson.setEnabled(false); this.actionLocate.setVisible(false); this.actionLocate.setEnabled(false); this.actionTraceDown.setVisible(false); this.actionTraceDown.setEnabled(false); this.actionTraceUp.setVisible(false); this.actionTraceUp.setEnabled(false); this.actionAddNew.setVisible(false); this.actionAddNew.setEnabled(false); this.actionAudit.setEnabled(true); this.actionUnAudit.setEnabled(true); this.actionVoucher.setVisible(true); this.actionVoucher.setEnabled(true); this.actionDelVoucher.setVisible(true); this.actionDelVoucher.setEnabled(true); this.actionViewVoucher.setVisible(true); this.actionViewVoucher.setEnabled(true); this.btnVoucher.setVisible(true); this.btnVoucher.setEnabled(true); this.btnDelVoucher.setVisible(true); this.btnDelVoucher.setEnabled(true); this.btnViewVoucher.setVisible(true); this.btnViewVoucher.setEnabled(true); } // @Override protected IQueryExecutor getQueryExecutor(IMetaDataPK arg0, EntityViewInfo arg1) { IQueryExecutor executor = super.getQueryExecutor(arg0, arg1); try { String sql = executor.getSQL(); System.out.println(sql); } catch (BOSException e) { e.printStackTrace(); } return executor; } /** * output getBizInterface method */ protected com.kingdee.eas.framework.ICoreBase getBizInterface() throws Exception { return com.kingdee.eas.jc.trading.invoice.InvoiceBillFactory.getRemoteInstance(); } /** * output createNewData method */ protected com.kingdee.bos.dao.IObjectValue createNewData() { com.kingdee.eas.jc.trading.invoice.InvoiceBillInfo objectValue = new com.kingdee.eas.jc.trading.invoice.InvoiceBillInfo(); return objectValue; } } /** * output package name */ package com.kingdee.eas.jc.trading.invoice.client; import java.awt.event.*; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.apache.log4j.Logger; import com.kingdee.bos.metadata.entity.FilterInfo; import com.kingdee.bos.metadata.entity.FilterItemInfo; import com.kingdee.bos.metadata.query.util.CompareType; import com.kingdee.bos.ui.face.CoreUIObject; import com.kingdee.bos.dao.IObjectValue; import com.kingdee.eas.base.permission.UserInfo; import com.kingdee.eas.basedata.org.CompanyOrgUnitInfo; import com.kingdee.eas.common.client.SysContext; import com.kingdee.eas.framework.*; import com.kingdee.eas.jc.basedata.CustomerInfo; import com.kingdee.eas.jc.trading.invoice.BizTypeEnum; import com.kingdee.eas.jc.trading.transaction.SaleContractInfo; import com.kingdee.eas.jc.util.BizControlHelper; import com.kingdee.util.enums.EnumUtils; /** * output class name */ public class InvoiceBillFilterUI extends AbstractInvoiceBillFilterUI { private static final Logger logger = CoreUIObject.getLogger(InvoiceBillFilterUI.class); /** * output class constructor */ public InvoiceBillFilterUI() throws Exception { super(); } // @Override public void onLoad() throws Exception { super.onLoad(); initUI(); } /** * 过滤条件 */ // @Override public FilterInfo getFilterInfo() { FilterInfo filter = new FilterInfo(); //组织 CompanyOrgUnitInfo orgInfo = (CompanyOrgUnitInfo)this.prmtFICompany.getValue(); if(orgInfo!=null) { if (orgInfo.getLevel() == 1) { UserInfo userInfo = SysContext.getSysContext().getCurrentUserInfo(); if (BizControlHelper.isUserRoleAllLook(userInfo)) { filter.getFilterItems().add(new FilterItemInfo("FICompany.longNumber", orgInfo.getLongNumber() + "%", CompareType.LIKE)); } else { filter.getFilterItems().add(new FilterItemInfo("FICompany.longNumber", "", CompareType.EQUALS)); } } else { filter.getFilterItems().add(new FilterItemInfo("FICompany.longNumber", orgInfo.getLongNumber() + "%", CompareType.LIKE)); } } //客户 CustomerInfo cusInfo = (CustomerInfo)this.prmtcustomer.getValue(); if(cusInfo!=null) { filter.getFilterItems().add(new FilterItemInfo("customer.id",cusInfo.getId().toString())); } //业务日期 DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date datefrom = (Date)this.pkBizDateFrom.getValue(); if(datefrom!=null) { try { datefrom = df.parse(df.format(datefrom)); } catch (ParseException e) { e.printStackTrace(); } filter.getFilterItems().add(new FilterItemInfo("bizDate",datefrom,CompareType.GREATER_EQUALS)); } Date dateto = (Date)this.pkBizDateTo.getValue(); if(dateto!=null) { try { dateto = df.parse(df.format(dateto)); } catch (ParseException e) { e.printStackTrace(); } filter.getFilterItems().add(new FilterItemInfo("bizDate",dateto,CompareType.LESS_EQUALS)); } //单据类型 Object bizType = this.bizType.getSelectedItem(); if(bizType!=null && bizType instanceof BizTypeEnum) { filter.getFilterItems().add(new FilterItemInfo("bizType",((BizTypeEnum)bizType).getValue(),CompareType.EQUALS)); } return filter; } /** * 界面初始化 */ private void initUI() { this.prmtFICompany.setValue(SysContext.getSysContext().getCurrentFIUnit()); this.prmtFICompany.setEnabled(false); this.pkBizDateFrom.setValue(null); this.pkBizDateTo.setValue(null); this.bizType.removeAllItems(); this.bizType.addItem(""); this.bizType.addItems(EnumUtils.getEnumList("com.kingdee.eas.jc.trading.invoice.BizTypeEnum").toArray()); } }

上一篇:hibernate一个用户访问多个表空间
下一篇:C++ string.find()

相关文章

相关评论

本站评论功能暂时取消,后续此功能例行通知。

一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!

二、互相尊重,对自己的言论和行为负责。

好贷网好贷款