@Action( value = "doOutputArticle", results = { @Result(name = "error", type = "tiles", location = "/licence.tiles"), @Result(name = "success", type = "redirectAction", location = "articleListSession"), @Result(name = "input", type = "tiles", location = "/output-article.tiles") }) public String save() throws Exception { if (outputArticle != null && outputArticle.hashCode() != outputArticleHash) { boolean hasError = false; if (fromString.equals("")) { addFieldError("fromString", Messages.getString("fromSB")); hasError = true; } if (customerString.equals("")) { addFieldError("outputCustomer", Messages.getString("customer")); hasError = true; } if (hasError) return INPUT; outputArticle.setOutDate(new Date()); if (!articleString.equals("")) outArticle = articleService.get(Long.parseLong(articleString.trim())); if (!fromString.equals("")) outputArticle.setFrom(employeeService.get(Long.parseLong(fromString.trim()))); outputArticle.setCustomer(customerService.get(Long.parseLong(customerString))); outputArticle.setNumber( outputArticleService.getOutputArticleNumber(OutputArticleActivity.finish)); if (outArticle.getCount() < outputArticle.getOutCount()) { addFieldError("outCount", Messages.getString("notEnoughArticleResourse")); return INPUT; } outArticle.setCount(outArticle.getCount() - outputArticle.getOutCount()); outputArticle.setStatus(OutputArticleActivity.finish); outputArticle.setArticle(outArticle); articleService.saveOrUpdate(outArticle); outputArticleService.saveOrUpdate(outputArticle); return SUCCESS; } return INPUT; }
public List<Employee> getEmployeeList() { return employeeService.getAvailableEmployee(); }