コード例 #1
0
ファイル: PoSetStatus.java プロジェクト: zach-hu/srr_java8
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    try {
      String newStatus = (String) incomingRequest.get("newStatus");
      if (Utility.isEmpty(newStatus)) {
        newStatus = DocumentStatus.PO_AWARDED;
      }

      PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
      List poLineList = (List) incomingRequest.get("poLineList");

      poHeader.setStatus(newStatus);
      Log.debug(this, poHeader.getDisplayPoNumber().toString() + " newStatus is: " + newStatus);

      for (int i = 0; i < poLineList.size(); i++) {
        PoLine poLine = (PoLine) poLineList.get(i);
        if (!poLine.getStatus().equals(DocumentStatus.CLOSED)
            || !poLine.getStatus().equals(DocumentStatus.CANCELLED)) {
          poLine.setStatus(newStatus);
        }
      }

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException("An Error ocurred closing order ", e);
    }
    return null;
  }
コード例 #2
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
      if (poHeader != null) {

        String queryString =
            "from InvoiceHeader as InvoiceHeader where InvoiceHeader.icPoHeader = ? and InvoiceHeader.invoiceNumber<>'N/A' order by InvoiceHeader.invoiceDate";
        List resultList =
            dbs.query(
                queryString,
                new Object[] {poHeader.getIcPoHeader()},
                new Type[] {Hibernate.BIG_DECIMAL});
        result = resultList;
      } else {
        Log.error(
            this, "IcPoHeader was empty.  InvoiceHeaderRetrieveByOrder could not be executed.");
      }

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
コード例 #3
0
ファイル: PoDeleteSetup.java プロジェクト: zach-hu/srr_java8
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    try {
      PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");

      if (poHeader == null) {
        this.setStatus(Status.FAILED);
        throw new TsaException("Po entity was not found!");
      } else {
        String icPoHeader = poHeader.getIcPoHeader().toString();
        incomingRequest.put("Schedule_icHeader", icPoHeader);
        incomingRequest.put("BillTo_icHeader", icPoHeader);
        incomingRequest.put("ShipTo_icHeader", icPoHeader);
        incomingRequest.put("Account_icHeader", icPoHeader);
        incomingRequest.put("DocComment_icHeader", icPoHeader);
        incomingRequest.put("DocAttachment_icHeader", icPoHeader);
        incomingRequest.put("PoLine_icPoHeader", icPoHeader);
        incomingRequest.put("ChecklistResponse_icHeader", icPoHeader);

        this.setStatus(Status.SUCCEEDED);
      }
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException(this.getName(), e);
    }
    return null;
  }
コード例 #4
0
  public Object executeTask(Object object) throws Exception {
    Object result = null;
    Map incomingRequest = (Map) object;

    PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    BigDecimal icPoHeader = poHeader.getIcPoHeader();
    String queryString =
        "select sum(invoiceLine.quantity) from InvoiceLine as invoiceLine where invoiceLine.icPoHeader= ? group by invoiceLine.lineNumber order by invoiceLine.lineNumber";
    result = dbs.query(queryString, icPoHeader, Hibernate.BIG_DECIMAL);

    this.setStatus(dbs.getStatus());
    return result;
  }
コード例 #5
0
  public Object executeTask(Object object) throws Exception {
    Log.debug(this, "execute Task");
    Object ret = null;
    try {
      Map incomingRequest = (Map) object;

      PoHeader blanket = (PoHeader) incomingRequest.get("blanket");
      if (blanket == null) {
        this.setStatus(Status.FAILED);
        throw new TsaException("Blanket Order was not Found.");
      }

      PoHeader newPoHeader = (PoHeader) incomingRequest.get("poHeader");
      if (newPoHeader == null) {
        this.setStatus(Status.FAILED);
        throw new TsaException("Release Order was not Found.");
      }

      RequisitionHeader requisitionHeader =
          (RequisitionHeader) incomingRequest.get("requisitionHeader");
      if (requisitionHeader == null) {
        this.setStatus(Status.FAILED);
        throw new TsaException("Requisition was not Found!.");
      }

      if (blanket.getTaxCode().equals("SHIPTO")) {
        newPoHeader.setTaxCode(requisitionHeader.getShipToAddress().getAddrFld10());
      }

      incomingRequest.put("poHeader", newPoHeader);

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException("No currency Code found!");
    }

    return ret;
  }
コード例 #6
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
      PoLine poLine = (PoLine) incomingRequest.get("poLine");

      if (poHeader == null) {
        throw new Exception("Recent Order Item cannot be setup.  PoHeader was not found.");
      }
      if (poLine == null) {
        throw new Exception("Recent Order Item cannot be setup.  PoLine was not found.");
      }

      String source = poLine.getItemSource();
      String location = poLine.getItemLocation();
      String buyer = poHeader.getBuyerCode();
      if (source.equals("CAT") || source.equals("XML")) {
        location = poLine.getCatalogId();
      }
      if (Utility.isEmpty(buyer)) {
        buyer = poHeader.getOwner();
      }

      incomingRequest.put("RecentOrderItem_buyerCode", buyer);
      incomingRequest.put("RecentOrderItem_itemNumber", poLine.getItemNumber());
      incomingRequest.put("RecentOrderItem_itemSource", source);
      incomingRequest.put("RecentOrderItem_itemLocation", location);
      incomingRequest.put("RecentOrderItem_description", poLine.getDescription());
      incomingRequest.put("RecentOrderItem_dateEntered", Dates.today("", ""));

      this.status = Status.SUCCEEDED;
    } catch (Exception e) {
      this.status = Status.FAILED;
      throw e;
    }
    return result;
  }
コード例 #7
0
  public Object executeTask(Object object) throws Exception {
    Object result = null;

    try {
      PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
      PuridiomProcess process = null;
      Map incomingRequest = (Map) object;

      String organizationId = (String) incomingRequest.get("organizationId");
      List poHeaderList = (List) incomingRequest.get("poHeaderList");

      if (poHeaderList != null && poHeaderList.size() > 0) {
        for (Iterator iterator = poHeaderList.iterator(); iterator.hasNext(); ) {
          PoHeader poHeader = (PoHeader) iterator.next();

          incomingRequest.put("userId", incomingRequest.get("userId"));
          incomingRequest.put("organizationId", organizationId);
          incomingRequest.put("dbsession", incomingRequest.get("dbsession"));

          incomingRequest.put("PoHeader_icPoHeader", poHeader.getIcPoHeader().toString());
          incomingRequest.put("PoLine_icPoHeader", poHeader.getIcPoHeader().toString());
          incomingRequest.put("ApprovalLog_icHeader", poHeader.getIcPoHeader().toString());
          incomingRequest.put("PoHeader_status", poHeader.getStatus());
          incomingRequest.put("PoHeader_poType", poHeader.getPoType());
          incomingRequest.put("poaction", "FORWARD");
          incomingRequest.put("formtype", "PO");
          incomingRequest.put("newStatus", DocumentStatus.PO_AWARDED);

          process = processLoader.loadProcess("po-autoaward-revision.xml");
          process.executeProcess(incomingRequest);
        }
      }
      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      Log.error(this, "PoHeaderAutoAwardRevision failed: " + e.getMessage());
      this.setStatus(Status.FAILED);
      throw new TsaException(
          "PoHeaderAutoAwardRevision failed to retrieve POs: " + e.getMessage(), e);
    }
    return result;
  }
コード例 #8
0
  public Object executeTask(Object object) throws Exception {
    Object ret = null;
    try {
      Map incomingRequest = (Map) object;
      boolean createReleaseFromReq =
          ((String) incomingRequest.get("createReleaseFromReq")).equals(String.valueOf(true));

      List requisitionLineList = (List) incomingRequest.get("requisitionLineList");
      List msgList = new ArrayList();

      if (requisitionLineList.size() > 0) { // items to create release for
        String recalculate = (String) incomingRequest.get("recalculate");
        if (recalculate == null) {
          recalculate = "N";
        }
        List newReleases = new ArrayList();
        RequisitionHeader rqh = (RequisitionHeader) incomingRequest.get("requisitionHeader");
        PoHeader blanket = (PoHeader) incomingRequest.get("blanket");
        Log.debug(this, "Release Request AutoRelease for req: " + rqh.getRequisitionNumber());
        Log.debug(this, "Release Request AutoRelease for blanket: " + blanket.getPoNumber());
        Log.debug(this, "AutoRelease recalculate: " + recalculate);

        Map newIncomingRequest = new HashMap();
        newIncomingRequest.put("blanket", blanket);
        newIncomingRequest.put("requisitionHeader", rqh);
        newIncomingRequest.put("RequisitionHeader_icReqHeader", rqh.getIcReqHeader().toString());

        newIncomingRequest.put("PoHeader_icPoHeader", blanket.getIcPoHeader().toString());

        newIncomingRequest.put("requisitionLineList", requisitionLineList);
        newIncomingRequest.put("createReleaseFromReq", "true");
        newIncomingRequest.put("Vendor_vendorId", blanket.getVendorId());
        newIncomingRequest.put("recalculate", recalculate);
        newIncomingRequest.put("createdfrom", this.createdFrom());

        newIncomingRequest.put("organizationId", incomingRequest.get("organizationId"));
        newIncomingRequest.put("userId", incomingRequest.get("userId"));
        newIncomingRequest.put("userTimeZone", incomingRequest.get("userTimeZone"));
        newIncomingRequest.put("dbsession", incomingRequest.get("dbsession"));
        newIncomingRequest.put("createReleaseFromReq", new Boolean(createReleaseFromReq));
        newIncomingRequest.put("forwardallowed", new Boolean(createReleaseFromReq));

        PuridiomProcessLoader processLoader = new PuridiomProcessLoader();

        PuridiomProcess process = processLoader.loadProcess("po-create-release-partial.xml");
        process.executeProcess(newIncomingRequest);
        if (process.getStatus() != Status.SUCCEEDED) {
          msgList.add("Items " + requisitionLineList + " could not be placed on Order! ");
        } else {
          PoHeader poHeader = (PoHeader) newIncomingRequest.get("poHeader");
          // msgList.add("Items " + requisitionLineList + " where Released on " +
          // OrderType.RELEASE_ORDER +
          //                 "# " + poHeader.getPoNumber() + "-" +
          // poHeader.getReleaseNumber().toString());
          newReleases.add(poHeader);
          AutoReleasedItemsSummary autoReleasedItems =
              new AutoReleasedItemsSummary(rqh, requisitionLineList, poHeader);
          autoReleasedItems.setPoNumber(poHeader.getPoNumber());
          autoReleasedItems.setReleaseNumber(poHeader.getReleaseNumber());
          // autoReleasedItems.setRqSubType(rqh.getRqSubType());
          autoReleasedItems.setRequisitionNumber(rqh.getRequisitionNumber());
          autoReleasedItems.setReleaseOrder(poHeader);
          msgList.add(autoReleasedItems);
          incomingRequest.put("PoHeader_icPoHeader", poHeader.getIcPoHeader().toString());
        }

        incomingRequest.put("releaseMessages", msgList);
        incomingRequest.put("poFromRelease", "Y");
        incomingRequest.put("releases", newReleases);

      } else {
        // rest of items should go through normal process.?????????
      }
      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
    }
    return super.executeTask(object);
  }