用友nc65 uap開發參照節點資料拉單之一
阿新 • • 發佈:2019-02-02
彈窗面板類package nc.ui.fdc_pr.h303113517.actions; import java.awt.Container; import java.awt.event.ActionEvent; import nc.bs.framework.common.NCLocator; import nc.itf.fdc.pub.DefaultUIF2RefEditor; import nc.itf.fdc_pr.IH303113510Maintain; import nc.itf.fdc_pr.IH303201525Maintain; import nc.ui.pub.beans.UIDialog; import nc.ui.pub.pf.BillSourceVar; import nc.ui.pubapp.uif2app.actions.AbstractReferenceAction; import nc.ui.pubapp.uif2app.actions.AddAction; import nc.ui.pubapp.uif2app.view.ShowUpableBillForm; import nc.ui.querytemplate.IBillReferQuery; import nc.ui.querytemplate.QueryConditionDLG; import nc.ui.uif2.model.AbstractAppModel; import nc.vo.fdc_pr.h303113510.AggRentPact; import nc.vo.fdc_pr.h303113510.BailPact; import nc.vo.fdc_pr.h303113510.HousePact; import nc.vo.fdc_pr.h303113510.LesseePact; import nc.vo.fdc_pr.h303113510.StandardPact; import nc.vo.pub.lang.UFBoolean; import nc.vo.pubapp.AppContext; import nc.vo.querytemplate.TemplateInfo; /** * * @author: zenglong * @ClassName: RefAction * @Description: 參照類 * @date: 2017年1月16日 */ public class RefAction extends AbstractReferenceAction { private static final long serialVersionUID = -3387516993124229948L; private AbstractAppModel model; private AddAction addAction; private ShowUpableBillForm editor; private DefaultUIF2RefEditor defaultUIF2RefEditor = null; IH303201525Maintain query = NCLocator.getInstance().lookup( IH303201525Maintain.class); public AbstractAppModel getModel() { return model; } public void setModel(AbstractAppModel model) { this.model = model; } private IBillReferQuery dlg = null; private String funNode = "H303113510"; public RefAction() { // TODO 自動生成的建構函式存根 this.setBtnName("參照"); this.setCode("refAction"); } @Override public void doAction(ActionEvent arg0) throws Exception { //=====================查詢模版顯示============================ if (dlg == null) { dlg = setConditionClient(null, model.getContext().getEntranceUI(), model.getContext().getPk_loginUser(), funNode, model .getContext().getPk_group()); } if (dlg.showModal() != UIDialog.ID_OK) { return; } //======================單據模版顯示=========================== RefDlg bsDlg = createBillsourceDLG(); // 載入模版 bsDlg.addBillUI(); // 載入資料 bsDlg.loadHeadData(); if (bsDlg.showModal() != UIDialog.ID_OK) { return; } //======================確定按鈕後操作=========================== AggRentPact[] m_tmpRetVos = (AggRentPact[]) bsDlg.getRetVos();// 獲得單據面板資料 if (null == m_tmpRetVos) { return; } bsDlg.setQueyDlg(dlg); // 放入查詢模板對話方塊 getDefaultUIF2RefEditor().addNew(); getDefaultUIF2RefEditor().setValue(getAggVo(m_tmpRetVos[0])); } /** * 因為只能達到當前顯示面板的aggvo 所以還要通過主鍵查詢 * @param vo * @return */ public AggRentPact getAggVo(AggRentPact vo){ IH303113510Maintain service =NCLocator.getInstance().lookup(IH303113510Maintain.class); AggRentPact[] aggVo=service.query(" and nvl(dr,0)=0 and pk_head='"+vo.getParentVO().getPk_head()+"'"); aggVo[0].getParentVO().setBexcgprom(UFBoolean.TRUE);//合同變更區別 aggVo[0].getParentVO().setFversion(-2);//版本號設定為-2(便於後面修改) aggVo[0].getParentVO().setVdef20(aggVo[0].getParentVO().getPk_head()); aggVo[0].getParentVO().setPk_pact(aggVo[0].getParentVO().getPk_head()); aggVo[0].getParentVO().setPk_head(""); aggVo[0].getParentVO().setApprovestatus(-1);//狀態重新改變 aggVo[0].getParentVO().setBillno("");//單據號 StandardPact[] stanPact=(StandardPact[]) aggVo[0].getChildren(StandardPact.class); if (stanPact!=null) { for (StandardPact st : stanPact) { st.setReserve5(UFBoolean.TRUE); st.setPk_body(""); } } //保證金,租戶,房產主鍵清空 BailPact[] bailPact= (BailPact[]) aggVo[0].getChildren(BailPact.class); if (bailPact!=null) { for (BailPact bail : bailPact) { bail.setPk_body(""); } } LesseePact[] lesseePact = (LesseePact[]) aggVo[0].getChildren(LesseePact.class); if (lesseePact!=null) { for (LesseePact lessee : lesseePact) { lessee.setPk_body(""); } } HousePact[] houseVos = (HousePact[]) aggVo[0].getChildren(HousePact.class); if (houseVos!=null) { for (HousePact house : houseVos) { house.setPk_body(""); } } return aggVo[0]; } private RefDlg createBillsourceDLG() { // 載入來源單據展現對話方塊,並顯示 BillSourceVar bsVar = new BillSourceVar(); bsVar.setBillType("H318"); bsVar.setCurrBillOrTranstype("H318"); bsVar.setFunNode("H303113511"); //查詢模板標識 bsVar.setNodeKey("ref"); bsVar.setPk_group(AppContext.getInstance().getPkGroup()); bsVar.setPkField("pk_head"); bsVar.setUserId(AppContext.getInstance().getPkUser()); bsVar.setWhereStr(dlg.getWhereSQL()); return new RefDlg(getModel().getContext().getEntranceUI(), bsVar); } /** * 查詢模板構建 * */ private IBillReferQuery setConditionClient(String templateId, Container parent, final String pkOperator, final String funNode, String pkCorp) { TemplateInfo ti = new TemplateInfo(); ti.setTemplateId(templateId); ti.setPk_Org(pkCorp); ti.setUserid(pkOperator); ti.setCurrentCorpPk(pkCorp); ti.setFunNode(funNode); ti.setNodekey("qt"); QueryConditionDLG qcDlg = new QueryConditionDLG(parent, ti); qcDlg.setVisibleNormalPanel(true); return qcDlg; } public AddAction getAdd() { return addAction; } public void setAdd(AddAction addAction) { this.addAction = addAction; } public ShowUpableBillForm getEditor() { return editor; } public void setEditor(ShowUpableBillForm editor) { this.editor = editor; } public DefaultUIF2RefEditor getDefaultUIF2RefEditor() { return defaultUIF2RefEditor; } public void setDefaultUIF2RefEditor( DefaultUIF2RefEditor defaultUIF2RefEditor) { this.defaultUIF2RefEditor = defaultUIF2RefEditor; } }