|
@@ -0,0 +1,306 @@
|
|
|
+package u8c.ui.mmpac.action;
|
|
|
+
|
|
|
+import nc.ui.hr.frame.action.AbstractAction;
|
|
|
+import java.awt.Component;
|
|
|
+import nc.ui.hr.frame.FrameUI;
|
|
|
+import nc.ui.hr.frame.HrQueryDialog;
|
|
|
+import nc.ui.hr.frame.LeftPanel;
|
|
|
+import nc.ui.hr.frame.MainPanel;
|
|
|
+import nc.ui.hr.frame.impl.MainBillCardPanel;
|
|
|
+import nc.ui.hr.frame.impl.MainBillListPanel;
|
|
|
+import nc.ui.hr.frame.impl.MainBillMgrPanel;
|
|
|
+import nc.ui.hr.frame.impl.MainSwitchPanel;
|
|
|
+import nc.ui.hr.frame.model.BillDataModel;
|
|
|
+import nc.ui.hr.frame.model.DataModel;
|
|
|
+import nc.ui.hr.frame.util.BillBufferUtils;
|
|
|
+import nc.ui.pub.beans.constenum.DefaultConstEnum;
|
|
|
+import nc.ui.pub.beans.constenum.IConstEnum;
|
|
|
+import nc.vo.hr.tools.pub.HRAggVO;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.SuperVO;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+
|
|
|
+public class MmpacQueryAction extends AbstractAction
|
|
|
+{
|
|
|
+ private boolean blIsRefresh = false;
|
|
|
+
|
|
|
+ private int iAfterQryState = 0;
|
|
|
+
|
|
|
+ private SuperVO[] queryResultVOs = null;
|
|
|
+
|
|
|
+ public MmpacQueryAction(FrameUI frameUI)
|
|
|
+ {
|
|
|
+ super(frameUI);
|
|
|
+ }
|
|
|
+
|
|
|
+ public MmpacQueryAction(FrameUI frameUI, boolean blIsRefresh2)
|
|
|
+ {
|
|
|
+ super(frameUI);
|
|
|
+
|
|
|
+ this.blIsRefresh = blIsRefresh2;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void bufferData()
|
|
|
+ {
|
|
|
+ if ((this.queryResultVOs == null) || (this.queryResultVOs.length == 0))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ HRAggVO[] hrAggVOs = HRAggVO.createHRAggVOs(this.queryResultVOs);
|
|
|
+
|
|
|
+ getDataModel().getBillBufferUtils().setBufferData(hrAggVOs, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void displayData(SuperVO[] resultVOs)
|
|
|
+ {
|
|
|
+ if (getFrameUI().needLeftPanel())
|
|
|
+ {
|
|
|
+ getLeftPanel().removeAllItems();
|
|
|
+
|
|
|
+ if ((resultVOs == null) || (resultVOs.length == 0))
|
|
|
+ {
|
|
|
+ getMainPanel().clearView();
|
|
|
+ getMainPanel().setMainPanelEnabled(false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ getLeftPanel().addItem(resultVOs);
|
|
|
+ }
|
|
|
+
|
|
|
+ getBillDataModel().setCurrentState(5);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ HRAggVO hrAggVO = null;
|
|
|
+ MainBillListPanel mainBillListPanel = null;
|
|
|
+ MainBillCardPanel mainBillCardPanel=null;
|
|
|
+
|
|
|
+ if ((getMainPanel() instanceof MainSwitchPanel))
|
|
|
+ {
|
|
|
+ if ((getMainPanel() instanceof MainBillMgrPanel))
|
|
|
+ {
|
|
|
+ ((MainBillMgrPanel)getMainPanel()).show("LIST_PANEL");
|
|
|
+ }
|
|
|
+
|
|
|
+ Component com = ((MainSwitchPanel)getMainPanel()).getCurrentShowComp();
|
|
|
+ if ((com instanceof MainBillCardPanel))
|
|
|
+ {
|
|
|
+ hrAggVO = getBillDataModel().queryDataByHeadVO(resultVOs[0], null);
|
|
|
+ ((MainBillCardPanel)com).setData(hrAggVO);
|
|
|
+ }
|
|
|
+ else if ((com instanceof MainBillListPanel))
|
|
|
+ {
|
|
|
+ HRAggVO[] aggVOs = HRAggVO.createHRAggVOs(resultVOs);
|
|
|
+
|
|
|
+ mainBillListPanel = (MainBillListPanel)com;
|
|
|
+ mainBillListPanel.setData(aggVOs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((getMainPanel() instanceof MainBillCardPanel))
|
|
|
+ {
|
|
|
+ hrAggVO = getBillDataModel().queryDataByHeadVO(resultVOs[0], null);
|
|
|
+ ((MainBillCardPanel)getMainPanel()).setData(hrAggVO);
|
|
|
+ }
|
|
|
+ else if ((getMainPanel() instanceof MainBillListPanel))
|
|
|
+ {
|
|
|
+ HRAggVO[] aggVOs = HRAggVO.createHRAggVOs(resultVOs);
|
|
|
+
|
|
|
+ mainBillListPanel = (MainBillListPanel)getMainPanel();
|
|
|
+ mainBillListPanel.setData(aggVOs);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mainBillListPanel != null)
|
|
|
+ {
|
|
|
+ if ((resultVOs != null) && (resultVOs.length > 0))
|
|
|
+ {
|
|
|
+ if (mainBillListPanel.getHeadSelectedRow() == -1)
|
|
|
+ {
|
|
|
+ mainBillListPanel.setHeadSelectedRow(0, 0);
|
|
|
+ mainBillListPanel.loadBodyData();
|
|
|
+
|
|
|
+ getDataModel().setCurrentSelectIndex(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ getDataModel().setCurrentState(8);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ getDataModel().setCurrentState(this.iAfterQryState, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ getDataModel().setCurrentState(this.iAfterQryState, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ getMainPanel().afterSetData();
|
|
|
+
|
|
|
+ getMainPanel().setMainPanelEditable(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void execute()
|
|
|
+ throws Exception
|
|
|
+ {
|
|
|
+ queryData();
|
|
|
+
|
|
|
+ if ((!isRefresh()) && (1 != getQueryDialog().getResult()))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ displayData(this.queryResultVOs);
|
|
|
+
|
|
|
+ showResultHintMessage();
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getAfterQryState()
|
|
|
+ {
|
|
|
+ return this.iAfterQryState;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected BillDataModel getBillDataModel()
|
|
|
+ {
|
|
|
+ return (BillDataModel)getDataModel();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected String getCondition()
|
|
|
+ {
|
|
|
+ return getQueryDialog().getWhereSQL();
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getOrderSQL()
|
|
|
+ {
|
|
|
+ String strOrderSQL = "";
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(getQueryDialog().getOrderSQL()))
|
|
|
+ {
|
|
|
+ strOrderSQL = getQueryDialog().getOrderSQL();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(getDataModel().getSQLOrderBy()))
|
|
|
+ {
|
|
|
+ if (StringUtils.isNotBlank(strOrderSQL))
|
|
|
+ {
|
|
|
+ strOrderSQL = strOrderSQL + "," + getDataModel().getSQLOrderBy();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strOrderSQL = strOrderSQL + " order by " + getDataModel().getSQLOrderBy();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return strOrderSQL;
|
|
|
+ }
|
|
|
+
|
|
|
+ public HrQueryDialog getQueryDialog()
|
|
|
+ {
|
|
|
+ return getFrameUI().getQueryDialog();
|
|
|
+ }
|
|
|
+
|
|
|
+ public SuperVO[] getQueryResultVOs()
|
|
|
+ {
|
|
|
+ return this.queryResultVOs;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isRefresh()
|
|
|
+ {
|
|
|
+ return this.blIsRefresh;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void queryData()
|
|
|
+ throws BusinessException
|
|
|
+ {
|
|
|
+ String strQueryCondition = null;
|
|
|
+
|
|
|
+ if (isRefresh())
|
|
|
+ {
|
|
|
+ strQueryCondition = getDataModel().getCondition();
|
|
|
+
|
|
|
+ if ((strQueryCondition == null) || (strQueryCondition.length() == 0))
|
|
|
+ {
|
|
|
+ strQueryCondition = "1<>1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (getQueryDialog().showModal() != 1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ strQueryCondition = getCondition();
|
|
|
+
|
|
|
+ if (strQueryCondition == null)
|
|
|
+ {
|
|
|
+ strQueryCondition = " 1=1 ";
|
|
|
+ }
|
|
|
+
|
|
|
+ strQueryCondition = strQueryCondition + getDataModel().getExtraCondition();
|
|
|
+
|
|
|
+ strQueryCondition = strQueryCondition + getOrderSQL();
|
|
|
+
|
|
|
+ if(strQueryCondition.contains("billstatus")) {
|
|
|
+ strQueryCondition= strQueryCondition.replaceAll("编写中", "8");
|
|
|
+ strQueryCondition= strQueryCondition.replaceAll("已批准", "1");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ getDataModel().setCondition(strQueryCondition);
|
|
|
+ }
|
|
|
+
|
|
|
+ queryData2(strQueryCondition);
|
|
|
+
|
|
|
+ bufferData();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void queryData2(String strQueryCondition)
|
|
|
+ throws BusinessException
|
|
|
+ {
|
|
|
+ Class clazz = getFrameUI().needLeftPanel() ? getBillDataModel().getLeftVOClass() : getBillDataModel().getHeadVOClass();
|
|
|
+
|
|
|
+ setQueryResultVOs(getBillDataModel().onQuery(clazz, strQueryCondition));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setAfterQryState(int afterQryState1)
|
|
|
+ {
|
|
|
+ this.iAfterQryState = afterQryState1;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setFieldDefaultValue(String strFieldCode, String strDefaultValue)
|
|
|
+ {
|
|
|
+ getQueryDialog().setFieldDefaultValue(strFieldCode, strDefaultValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setFieldValueElementEnum(String strFieldCode, IConstEnum[] items)
|
|
|
+ {
|
|
|
+ getQueryDialog().setFieldValueElementEnum(strFieldCode, items);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setQueryResultVOs(SuperVO[] queryResultVO2s)
|
|
|
+ {
|
|
|
+ this.queryResultVOs = queryResultVO2s;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void showResultHintMessage()
|
|
|
+ {
|
|
|
+ String strMsg = "";
|
|
|
+
|
|
|
+ if (this.blIsRefresh)
|
|
|
+ {
|
|
|
+ strMsg = getResource("nc_hr_ui_frame", "UPPnc_hr_ui_frame-000123");
|
|
|
+ }
|
|
|
+ else if ((this.queryResultVOs == null) || (this.queryResultVOs.length == 0))
|
|
|
+ {
|
|
|
+ strMsg = getResource("nc_hr_ui_frame", "UPPnc_hr_ui_frame-000124");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strMsg = getResource("nc_hr_ui_frame", "UPPnc_hr_ui_frame-000206", new String[] { String.valueOf(this.queryResultVOs.length) });
|
|
|
+ }
|
|
|
+
|
|
|
+ getFrameUI().showHintMessage(strMsg);
|
|
|
+ }
|
|
|
+}
|