private void refreshList() { if (isBLInited()) { defaultTableModel.getDataVector().clear(); try { ArrayList<PayReceiptVO> payReceiptVOs = payReceiptBLService.getListByState(ReceiptState.SUBMITTED); ArrayList<TransferReceiptVO> transferReceiptVOs = transferReceiptBLService.getListByState(ReceiptState.SUBMITTED); Vector<Vector> data = new Vector<Vector>(); for (PayReceiptVO vo : payReceiptVOs) { Vector<Object> item = new Vector<Object>(); item.add(vo.getId()); item.add("付款单"); item.add(vo.print()); data.add(item); } for (TransferReceiptVO vo : transferReceiptVOs) { Vector<Object> item = new Vector<Object>(); item.add(vo.getTransferID()); item.add("中转单"); item.add(vo.print()); data.add(item); } defaultTableModel.setDataVector(data, names); table.revalidate(); table.updateUI(); } catch (RemoteException e) { new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE); } catch (SQLException e) { System.out.println(e.getMessage()); } } else { initBL(); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == approvebt) { int[] rows = table.getSelectedRows(); if (rows.length <= 0) { new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED); } else { // 选择了行 if (isBLInited()) { for (int i : rows) { String id = (String) table.getValueAt(i, 0); String receiptType = (String) table.getValueAt(i, 1); try { if (receiptType.equals("付款单")) { payReceiptBLService.updateState(id, ReceiptState.APPROVED); } else if (receiptType.equals("中转单")) { transferReceiptBLService.updateState(id, ReceiptState.APPROVED); } } catch (RemoteException e1) { new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE); } catch (SQLException e1) { System.out.println(e1.getMessage()); } } refreshList(); new TranslucentFrame(this, "审批成功", Color.GREEN); } else { initBL(); } } } else if (e.getSource() == disappbt) { int[] rows = table.getSelectedRows(); if (rows.length <= 0) { new TranslucentFrame(this, "请选择要审批的单据(按住ctrl可多选)", Color.RED); } else { // 选择了行 if (isBLInited()) { for (int i : rows) { String id = (String) table.getValueAt(i, 0); String receiptType = (String) table.getValueAt(i, 1); try { if (receiptType.equals("付款单")) { payReceiptBLService.updateState(id, ReceiptState.UNAPPROVED); } else if (receiptType.equals("中转单")) { transferReceiptBLService.updateState(id, ReceiptState.UNAPPROVED); } } catch (RemoteException e1) { new TranslucentFrame(this, MessageType.RMI_LAG, Color.ORANGE); } catch (SQLException e1) { System.out.println(e1.getMessage()); } } refreshList(); new TranslucentFrame(this, "审批成功", Color.GREEN); } else { initBL(); } } } else if (e.getSource() == refreshbt) { refreshList(); new TranslucentFrame(this, "刷新成功", Color.GREEN); } }