@Override public List<MatStockBean> getMatStockDetails() { // TODO Auto-generated method stub List<MatStockBean> matStockBeans = null; try { listOfObjcts = boardDao.getMatStockDetails(); matStockBeans = new ArrayList<MatStockBean>(); Iterator<Object[]> iterator = listOfObjcts.iterator(); while (iterator.hasNext()) { Object[] objects = (Object[]) iterator.next(); MatStockBean stockBean = new MatStockBean(); stockBean.setMatStockId((Integer) objects[0]); stockBean.setBatchNo((String) objects[1]); stockBean.setQtyAval((Float) objects[2]); StorageLocation location = (StorageLocation) objects[3]; Material material = (Material) objects[4]; stockBean.setMaterialName(material.getMaterialName()); stockBean.setStorageLocName(location.getStorageLocation()); matStockBeans.add(stockBean); } } catch (Exception e) { logger.error(e.getMessage()); } return matStockBeans; }
/* * =====================================Edit * Method============================== */ @RequestMapping(value = "/vendorReturnIdEdit1", method = RequestMethod.GET) @Scope("request") public String vendorReturnEdit( @ModelAttribute VendorReturn vendorReturnIdEdit1, BindingResult result, HttpServletRequest request, HttpServletResponse response, Model model) { response.setCharacterEncoding("UTF-8"); List<Float> qtyList = new ArrayList<Float>(); List<Object> list = null; List<VendorReturn> vrEditList = new ArrayList<VendorReturn>(); List<VendorReturnLine> vrLineEditList = new ArrayList<VendorReturnLine>(); int vrid = vendorReturnIdEdit1.getVendorReturnId(); try { list = vrService.editVendorReturnWithId(vrid); Iterator<Object> iterator = list.iterator(); if (iterator.hasNext()) { Object vrObj = iterator.next(); VendorReturn vr = (VendorReturn) vrObj; vendorReturnIdEdit1.setVendorReturnIdEditt(vr.getVendorReturnId()); vendorReturnIdEdit1.setVendorReturnNoEditt(vr.getVendorReturnNo()); vendorReturnIdEdit1.setVendorReturnDateEditt( dateService.dateFormat(dateService.dateParse(vr.getVendorReturnDate(), "se"), "se")); vendorReturnIdEdit1.setReferenceEditt(vr.getReference()); vendorReturnIdEdit1.setDescriptionEditt(vr.getDescription()); vendorReturnIdEdit1.setPurchaseOrderIdEditt(vr.getPurchaseOrderId()); vendorReturnIdEdit1.setGoodsReceiptIdEdit(vr.getGoodsReceiptId()); List<VendorReturnLine> listEdit = vr.getVendorReturnLine(); Iterator<VendorReturnLine> iterator1 = listEdit.iterator(); while (iterator1.hasNext()) { Object vrLineObj = iterator1.next(); VendorReturnLine vrLine = (VendorReturnLine) vrLineObj; VendorReturnLine vrMultiple = new VendorReturnLine(); vrMultiple.setVendorReturnLineId(vrLine.getVendorReturnLineId()); int materialId = Integer.parseInt(vrLine.getMaterial_Id()); int previousUpdatedStock; previousUpdatedStock = materialService.materialStockGet(materialId); int materialQtyInEditField = (int) (vrLine.getQuantity()); int stockEdit = previousUpdatedStock + materialQtyInEditField; vrMultiple.setStockEdit(stockEdit); Material material = vrLine.getMaterialDetails(); Uom uom = vrLine.getUomDetails(); ReasonForRejection rfr = vrLine.getRfrDetails(); StorageLocation storage = vrLine.getStorageDetails(); vrMultiple.setMaterial_IdEditt((vrLine.getMaterial_Id())); vrMultiple.setMaterialName(material.getMaterialName()); vrMultiple.setQuantityEditt((vrLine.getQuantity())); vrMultiple.setBatchNoEdit(vrLine.getBatchNo()); vrMultiple.setUom_IdEditt(vrLine.getUom_Id()); vrMultiple.setUomName(uom.getUom()); vrMultiple.setPriceEditt(vrLine.getPrice()); vrMultiple.setReasonForRejectionIdEditt(vrLine.getReasonForRejectionId()); vrMultiple.setRfrName(rfr.getReasonForRejection()); vrMultiple.setStorageLocationIdEditt(vrLine.getStorageLocationId()); vrMultiple.setStorageName(storage.getStorageLocation()); vrLineEditList.add(vrMultiple); qtyList.add((float) vrLine.getQuantity()); } vrEditList.add(vendorReturnIdEdit1); } model.addAttribute("vendorReturnCommand", vendorReturnIdEdit1); session = request.getSession(false); session.setAttribute("qtyList", qtyList); request.setAttribute("vrEditList", vrEditList); request.setAttribute("vrLineEditList", vrLineEditList); } catch (Exception e) { e.printStackTrace(); } return "vendorReturnHome"; }