Beispiel #1
0
  public void processTransaction() throws Exception {
    InboundTranslate translator = getTranslator();
    TradingProfileData profile = translator.getProfile();
    int[] busEntIds =
        translator.getTradingPartnerBusEntityIds(
            profile.getTradingPartnerId(), RefCodeNames.TRADING_PARTNER_ASSOC_CD.DISTRIBUTOR);
    String busEntId;
    if (busEntIds.length > 0) {
      busEntId = Integer.toString(busEntIds[0]);
    } else {
      busEntId = "UNKNOWN";
    }
    OrderData orderD = null;
    boolean matchByVendorOrderNum =
        ediInp856Vw.getMatchPoNumType().equals(RefCodeNames.MATCH_PO_NUM_TYPE_CD.VENDOR_ORDER_NUM);
    String poNum =
        matchByVendorOrderNum ? ediInp856Vw.getDistOrderNum() : ediInp856Vw.getPurchOrderNum();
    orderD =
        getTranslator().getOrderDataByPoNum(poNum, null, null, ediInp856Vw.getMatchPoNumType());

    if (orderD == null) {
      // String errorMess = "No purchase order found with po num: " + purchOrderNum;
      // errorMsgs.add(errorMess);
      // setValid(false);
    } else {
      getTransactionD().setOrderId(orderD.getOrderId());
      ediInp856Vw.setOrderId(orderD.getOrderId());
    }
    getTransactionD()
        .setKeyString(
            "ErpPoNum: "
                + ediInp856Vw.getPurchOrderNum()
                + " DistPoNum: "
                + ediInp856Vw.getDistOrderNum()
                + ", Distr Id: "
                + busEntId);

    // Pulling out ICN and GCN: Begin
    int ICN = ediHandler.getProfile().getInterchangeControlNum();
    int GCN = ediHandler.getProfile().getGroupControlNum();
    ediInp856Vw.setInterchangeControlNum(ICN);
    ediInp856Vw.setGroupControlNum(GCN);
    log.info("ICN = " + ICN);
    log.info("GCN = " + GCN);
    // Pulling out ICN and GCN: End

    ediHandler.appendIntegrationRequest(ediInp856Vw);
  }