@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; }
@RequestMapping(value = "/inspOperationSearch", method = RequestMethod.GET) public String searchinspOperation( @ModelAttribute("inspOperationCmd") InspOperationBean inspOperationBeanSearch, Model model, HttpServletRequest request, HttpServletResponse response) { response.setCharacterEncoding("UTF-8"); List<InspOperationBean> IOSList = new ArrayList<InspOperationBean>(); try { String dbField = inspOperationBeanSearch.getXmlLabel(); String operation = inspOperationBeanSearch.getOperations(); String basicSearchId = inspOperationBeanSearch.getBasicSearchId(); if (operation.equals("_%")) { operation = " like "; basicSearchId = basicSearchId + "%"; } else if (operation.equals("%_")) { operation = " like "; basicSearchId = "%" + basicSearchId; } else if (operation.equals("%_%")) { operation = " like "; basicSearchId = "%" + basicSearchId + "%"; } if (basicSearchId == "") { list = inspOperService.searchInspOperation(); } else { list = inspOperService.basicSearchInspOperation(dbField, operation, basicSearchId); } itr = list.iterator(); while (itr.hasNext()) { objects = (Object[]) itr.next(); InspOperationBean dnb = new InspOperationBean(); dnb.setInspOperationId((Integer) objects[0]); dnb.setOperationNo((String) objects[1]); InspectionType type = ((InspectionType) objects[2]); dnb.setInspTypeId(type.getInspectionType()); Material mt = ((Material) objects[3]); dnb.setMaterialId(mt.getMaterialName()); IOSList.add(dnb); } request.setAttribute("IOSList", IOSList); } catch (Exception e) { e.printStackTrace(); } return "inspOperationHome"; }
/* * =====================================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"; }