@SuppressWarnings("unchecked") private void listArtStoc(String stocResponse) { textCantArt.setText(""); if (!stocResponse.equals("-1")) { nf2.setMinimumFractionDigits(3); nf2.setMaximumFractionDigits(3); String[] tokenStoc = stocResponse.split("#"); textNumeArticol.setVisibility(View.VISIBLE); textCodArticol.setVisibility(View.VISIBLE); layoutGreutate.setVisibility(View.VISIBLE); textUm.setVisibility(View.VISIBLE); textStoc.setVisibility(View.VISIBLE); labelStoc.setVisibility(View.VISIBLE); textUm.setText(tokenStoc[1]); selectedUnitMas = tokenStoc[1]; String strGreutateArt = ""; if (Double.valueOf(tokenStoc[0]) > 0) { greutateArticol = opArticol.deserializeGreutateArticol((String) tokenStoc[3]); strGreutateArt = String.valueOf(greutateArticol.getGreutate()) + " " + greutateArticol.getUnitMas() + "/" + greutateArticol.getUnitMasCantiate(); } textValoareGreutate.setText(strGreutateArt); artMap = (HashMap<String, String>) spinnerUMClp.getSelectedItem(); String stocUM = artMap.get("rowText"); if (!stocUM.equals(tokenStoc[1]) && !tokenStoc[1].trim().equals("")) // um // vanz // si // um // vanz // difera { HashMap<String, String> tempUmVanz; tempUmVanz = new HashMap<String, String>(); tempUmVanz.put("rowText", tokenStoc[1]); listUmVanz.add(tempUmVanz); spinnerUMClp.setAdapter(adapterUmVanz); spinnerUMClp.setVisibility(View.VISIBLE); selectedUnitMas = stocUM; } textStoc.setText(nf2.format(Double.valueOf(tokenStoc[0]))); labelCantArt.setVisibility(View.VISIBLE); textCantArt.setVisibility(View.VISIBLE); this.saveArtBtnClp.setVisibility(View.VISIBLE); } else { Toast.makeText(getActivity(), "Nu exista informatii.", Toast.LENGTH_SHORT).show(); textUm.setText(""); textStoc.setText(""); } }
@SuppressWarnings("unchecked") private void performSaveSelectedArt() { try { if (codArticol.length() == 18) codArticol = codArticol.substring(10, 18); int nrArt = listArtSelClp.size(), ii = 0, selectedArtPos = -1; for (ii = 0; ii < nrArt; ii++) { artMap = (HashMap<String, String>) CLPFragment2.adapterListArtClp.getItem(ii); if (codArticol.equals(artMap.get("codArt"))) { selectedArtPos = ii; listArtSelClp.remove(ii); break; } } HashMap<String, String> temp; temp = new HashMap<String, String>(20, 0.75f); nf2.setMinimumFractionDigits(3); nf2.setMaximumFractionDigits(3); double greutateCantitate = greutateArticol.getGreutate() * Double.valueOf(textCantArt.getText().toString().trim()) * factorConversie; Integer tokNrCrt = -1; if (selectedArtPos == -1) { selectedArtPos = listArtSelClp.size(); tokNrCrt = listArtSelClp.size() + 1; } else { tokNrCrt = selectedArtPos + 1; } temp.put("nrCrt", String.valueOf(tokNrCrt) + "."); temp.put("numeArt", numeArticol); temp.put("codArt", codArticol); temp.put("cantArt", nf2.format(Double.valueOf(textCantArt.getText().toString().trim()))); temp.put("Umb", selectedUnitMas); temp.put("depozit", globalDepozSel); temp.put("sintetic", sintetic); temp.put("greutate", nf2.format(greutateCantitate)); temp.put("umgreutate", greutateArticol.getUnitMas().toString()); temp.put("depart", depArtSel); listArtSelClp.add(selectedArtPos, temp); listArtCmdClp.setAdapter(adapterListArtClp); adapterListArtClp.notifyDataSetChanged(); ScreenUtils.hideSoftKeyboard(getActivity(), txtNumeArticol); getTotalGreutate(); clearVars(); } catch (Exception ex) { Toast.makeText(getActivity(), ex.getMessage(), Toast.LENGTH_SHORT).show(); } }