Beispiel #1
0
  @SuppressWarnings("unchecked")
  private String prepareArtForDelivery() {

    List<ArticolCLP> listArticole = new ArrayList<ArticolCLP>();

    String retVal = "";
    try {

      cmdFasonate = true;
      int nrArt = listArtSelClp.size(), ii = 0;

      for (ii = 0; ii < nrArt; ii++) {
        artMap = (HashMap<String, String>) adapterListArtClp.getItem(ii);

        if (!isFasonat(artMap.get("sintetic"))) {
          cmdFasonate = false;
        }

        ArticolCLP articolCLP = new ArticolCLP();
        articolCLP.setCod(artMap.get("codArt"));
        articolCLP.setCantitate(artMap.get("cantArt"));
        articolCLP.setUmBaza(artMap.get("Umb"));
        articolCLP.setDepozit(artMap.get("depozit"));
        articolCLP.setDepart(artMap.get("depart"));
        listArticole.add(articolCLP);

        retVal +=
            artMap.get("codArt")
                + "#"
                + artMap.get("cantArt")
                + "#"
                + artMap.get("Umb")
                + "#"
                + artMap.get("depozit")
                + "@";
      }

      Collections.sort(listArticole, new ClpDepartComparator());
      comandaCLP.setListaArticoleComanda(listArticole);

    } catch (Exception ex) {
      Toast.makeText(getActivity(), ex.toString(), Toast.LENGTH_SHORT).show();
    }

    return retVal;
  }
Beispiel #2
0
  private void performSaveNewClp() {

    try {

      String articoleFinale = prepareArtForDelivery();

      String depozDest = "";
      String varSelectedDepoz =
          CLPFragment1.spinnerDepozClp_Dest.getSelectedItem().toString().trim();

      if (varSelectedDepoz.contains("-")) {
        String[] tokenDep_Dest = varSelectedDepoz.split("-");
        depozDest = UserInfo.getInstance().getCodDepart() + tokenDep_Dest[0].trim();
      } else {
        depozDest = varSelectedDepoz;
      }

      // agenti
      if (UserInfo.getInstance().getTipAcces().equals("9")
          || UserInfo.getInstance().getTipAcces().equals("27")) {
        CreareClp.selectedAgent = UserInfo.getInstance().getCod();
      }

      String numeClientCV = CLPFragment1.textSelClient.getText().toString().trim();

      String observatiiCLP =
          CLPFragment1.txtObservatiiCLP.getText().toString().isEmpty()
              ? " "
              : CLPFragment1.txtObservatiiCLP.getText().toString();

      String localCodClient = CreareClp.codClient;

      if (UserInfo.getInstance().getTipAcces().equals("17")
          || UserInfo.getInstance().getTipAcces().equals("18")) {
        if (CLPFragment1.radioClientPF.isChecked()) {
          localCodClient =
              InfoStrings.getClientGenericGed(UserInfo.getInstance().getUnitLog(), "PF");
        }

        if (CLPFragment1.radioClientPJ.isChecked()) {
          localCodClient =
              InfoStrings.getClientGenericGed(UserInfo.getInstance().getUnitLog(), "PJ");
        }
      }

      String strTonaj = "-1";

      if (isConditiiTonaj(CreareClp.tipTransport, CLPFragment1.spinnerTonaj)) {
        String[] tonaj = CLPFragment1.spinnerTonaj.getSelectedItem().toString().split(" ");
        strTonaj = tonaj[0];
      }

      AntetComandaCLP antetComandaCLP = new AntetComandaCLP();

      antetComandaCLP.setCodClient(localCodClient);
      antetComandaCLP.setCodJudet(CreareClp.codJudet);
      antetComandaCLP.setLocalitate(CreareClp.oras);
      antetComandaCLP.setStrada(CreareClp.strada.isEmpty() ? " " : CreareClp.strada);
      antetComandaCLP.setPersCont(CreareClp.persCont);
      antetComandaCLP.setTelefon(CreareClp.telefon);
      antetComandaCLP.setCodFilialaDest(CreareClp.codFilialaDest);
      antetComandaCLP.setDataLivrare(CreareClp.dataLivrare);
      antetComandaCLP.setTipPlata(CreareClp.tipPlata);
      antetComandaCLP.setTipTransport(CreareClp.tipTransport);
      antetComandaCLP.setDepozDest(depozDest);
      antetComandaCLP.setSelectedAgent(CreareClp.selectedAgent);
      antetComandaCLP.setCmdFasonate(cmdFasonate);
      antetComandaCLP.setNumeClientCV(numeClientCV);
      antetComandaCLP.setObservatiiCLP(observatiiCLP);
      antetComandaCLP.setTipMarfa(CreareClp.tipMarfa);
      antetComandaCLP.setMasaMarfa(CreareClp.masaMarfa);
      antetComandaCLP.setTipCamion(
          CLPFragment1.spinnerTipCamion
              .getSelectedItem()
              .toString()
              .toUpperCase(Locale.getDefault()));
      antetComandaCLP.setTipIncarcare(
          CLPFragment1.spinnerTipIncarcare
              .getSelectedItem()
              .toString()
              .toUpperCase(Locale.getDefault()));
      antetComandaCLP.setTonaj(strTonaj);

      comandaCLP.setAntetComandaCLP(antetComandaCLP);

      CreareClp.comandaFinala =
          localCodClient
              + "#"
              + CreareClp.codJudet
              + "#"
              + CreareClp.oras
              + "#"
              + CreareClp.strada
              + "#"
              + CreareClp.persCont
              + "#"
              + CreareClp.telefon
              + "#"
              + CreareClp.codFilialaDest
              + "#"
              + CreareClp.dataLivrare
              + "#"
              + CreareClp.tipPlata
              + "#"
              + CreareClp.tipTransport
              + "#"
              + depozDest
              + "#"
              + CreareClp.selectedAgent
              + "#"
              + cmdFasonate
              + "#"
              + numeClientCV
              + "#"
              + observatiiCLP
              + "#"
              + CreareClp.tipMarfa
              + "#"
              + CreareClp.masaMarfa
              + "#"
              + CLPFragment1.spinnerTipCamion
                  .getSelectedItem()
                  .toString()
                  .toUpperCase(Locale.getDefault())
              + "#"
              + CLPFragment1.spinnerTipIncarcare
                  .getSelectedItem()
                  .toString()
                  .toUpperCase(Locale.getDefault())
              + "#"
              + strTonaj
              + "@"
              + articoleFinale;

      performSaveClp();

    } catch (Exception ex) {
      Toast.makeText(getActivity(), ex.toString(), Toast.LENGTH_SHORT).show();
    }
  }