public void setTransaction() throws IOException {
    Query query = em.createNamedQuery("EOrderQc.findByMaxId");
    int eOrderId = (Integer) query.getResultList().get(0);
    long currentStock = 0;

    System.out.println("orderQcId++++++++ " + eOrderId);
    EOrderQc eOrderNew = eOrderQcFacade.find(eOrderId);
    transactionList = eTransactionFacade.findAll();
    for (int k = 0; k < transactionList.size(); k++) {
      if ((transactionList.get(k).getEProduct().getId() == requestorder.getProductId())
          && (transactionList.get(k).getESites().getId() == requestorder.getSiteId())) {
        currentStock = currentStock + transactionList.get(k).getStockDelta();
      }
    }
    long updateStock = currentStock + eOrderNew.getQcQuantityAccepted();
    long delta = updateStock - currentStock;

    ETransaction eTransaction = new ETransaction();
    eTransaction.setReasonOfUpdate(eOrderNew.getEOrder().getOrderType());
    eTransaction.setDateOfUpdate(eOrderNew.getDate());
    eTransaction.setESites(eSitesFacade.find(requestorder.getSiteId()));
    eTransaction.setEProduct(eProductFacade.find(requestorder.getProductId()));
    eTransaction.setStockDelta(delta);
    eTransaction.setEOrder(eOrderNew.getEOrder());
    eTransactionFacade.create(eTransaction);

    EOrder eOrder = new EOrder();
    eOrder = eOrderNew.getEOrder();
    eOrder.setStatus("QC_Respond");
    eOrderFacade.edit(eOrder);
    // populate();

  }
 public void addOrderQc() throws IOException {
   eOrderQc.setEEmployee(eEmployeeFacade.find(employeeId));
   eOrderQc.setEOrder(eOrderFacade.find(requestorder.getOrderId()));
   eOrderQcFacade.create(eOrderQc);
   eOrderQc = new EOrderQc();
   setTransaction();
 }