@Override public ReceiptsPO findReceipt(String date, String courier) throws RemoteException { // TODO Auto-generated method stub String sql = "select*from receiptspo where data='" + date + "' and courier='" + courier + "';"; ReceiptsPO receiptsPO = null; ResultSet resultSet = null; try { resultSet = Helper.find(sql); while (resultSet.next()) { ArrayList<String> orderNumber = (ArrayList<String>) IOObject.getArray(resultSet.getBytes("orderNumber")); receiptsPO = new ReceiptsPO( resultSet.getString(1), resultSet.getDouble(2), resultSet.getString(3), orderNumber, resultSet.getString(5), DocumentCondition.valueOf(resultSet.getString(6))); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // TODO Auto-generated method stub return receiptsPO; }
@Override public ArrayList<ReceiptsPO> findReceipts(String date, String office) throws RemoteException { String sql = "select*from receiptspo where data='" + date + "' and office='" + office + "';"; ArrayList<ReceiptsPO> receiptsPOs = new ArrayList<ReceiptsPO>(); ResultSet resultSet = null; try { resultSet = Helper.find(sql); while (resultSet.next()) { ArrayList<String> orderNumber = (ArrayList<String>) IOObject.getArray(resultSet.getBytes("ordernumbers")); ReceiptsPO po = new ReceiptsPO( resultSet.getString(1), resultSet.getDouble(2), resultSet.getString(3), orderNumber, resultSet.getString(5), DocumentCondition.valueOf(resultSet.getString(6))); receiptsPOs.add(po); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // TODO Auto-generated method stub return receiptsPOs; }
@Override public ArrayList<OrderPO> findWithdCondition(String nameOfCourier, DocumentCondition dCondition) throws RemoteException { // TODO Auto-generated method stub String sql = "select* from orderpo where documentcondition='" + dCondition + "' and nameofcourier='" + nameOfCourier + "';"; ResultSet result = null; OrderPO po = null; ArrayList<OrderPO> pos = new ArrayList<OrderPO>(); ReceiverPO receiver = null; SenderPO sender = null; BillPO bill = null; GoodsPO goods = null; try { result = Helper.find(sql); while (result.next()) { try { // ObjectInputStream oips = new ObjectInputStream(result.getBinaryStream("receiver")); receiver = (ReceiverPO) IOObject.getArray(result.getBytes("receiver")); // oips = new ObjectInputStream(result.getBinaryStream("sender")); sender = (SenderPO) IOObject.getArray(result.getBytes("sender")); // oips = new ObjectInputStream(result.getBinaryStream("bill")); bill = (BillPO) IOObject.getArray(result.getBytes("bill")); // oips = new ObjectInputStream(result.getBinaryStream("goods")); goods = (GoodsPO) IOObject.getArray(result.getBytes("goods")); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } po = new OrderPO( receiver, sender, bill, goods, result.getString(5), result.getString(6), result.getString(7), result.getString(8), result.getString(9), DocumentCondition.valueOf(result.getString(10))); pos.add(po); } } catch (Exception e) { e.printStackTrace(); } return pos; }
@Override public ArrayList<OrderPO> findReceived() throws RemoteException { // TODO Auto-generated method stub String sql = "select*from orderpo where receivetime != 'null';"; ArrayList<OrderPO> orderPOs = new ArrayList<OrderPO>(); ResultSet result = null; ReceiverPO receiver = null; SenderPO sender = null; BillPO bill = null; GoodsPO goods = null; try { result = Helper.find(sql); while (result.next()) { receiver = (ReceiverPO) IOObject.getArray(result.getBytes("receiver")); // oips = new ObjectInputStream(result.getBinaryStream("sender")); sender = (SenderPO) IOObject.getArray(result.getBytes("sender")); // oips = new ObjectInputStream(result.getBinaryStream("bill")); bill = (BillPO) IOObject.getArray(result.getBytes("bill")); // oips = new ObjectInputStream(result.getBinaryStream("goods")); goods = (GoodsPO) IOObject.getArray(result.getBytes("goods")); OrderPO po = new OrderPO( receiver, sender, bill, goods, result.getString(5), result.getString(6), result.getString(7), result.getString(8), result.getString(9), DocumentCondition.valueOf(result.getString(10))); orderPOs.add(po); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return orderPOs; }
@Override public OrderPO findLatest() throws RemoteException { // TODO Auto-generated method stub String sql = "select * from orderpo order by ordernumber desc;"; OrderPO po = null; ResultSet result = null; ReceiverPO receiver = null; SenderPO sender = null; BillPO bill = null; GoodsPO goods = null; try { result = Helper.find(sql); if (result.next()) { receiver = (ReceiverPO) IOObject.getArray(result.getBytes("receiver")); // oips = new ObjectInputStream(result.getBinaryStream("sender")); sender = (SenderPO) IOObject.getArray(result.getBytes("sender")); // oips = new ObjectInputStream(result.getBinaryStream("bill")); bill = (BillPO) IOObject.getArray(result.getBytes("bill")); // oips = new ObjectInputStream(result.getBinaryStream("goods")); goods = (GoodsPO) IOObject.getArray(result.getBytes("goods")); po = new OrderPO( receiver, sender, bill, goods, result.getString(5), result.getString(6), result.getString(7), result.getString(8), result.getString(9), DocumentCondition.valueOf(result.getString(10))); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return po; }