/** * 保存一个盘点数 * * @return * @throws Exception */ public String addChecking() throws Exception { this.setReturnurl( request.getContextPath() + FILESEPARATOR + "checking" + FILESEPARATOR + "toCheckingPage.action"); if (warehouse != null && warehouse.getId() != null) { warehouse = this.warehouseService.get(Warehouse.class, warehouse.getId()); if (barcode != null) { productInfo = this.productinfoService.findByBaecode(barcode); if (productInfo == null) { this.setMessage("产品编码有错误"); return INPUT; } if (quantity == null) { this.setMessage("请输入盘点数量"); return INPUT; } User user = (User) request.getSession().getAttribute("user"); pstock = this.pstockService.findbyBarcodeAndWarehouse(barcode, warehouse.getWname()); stockChecking = new StockChecking(pstock, productInfo, quantity, warehouse); if (user != null) { stockChecking.setOperator(user.getUsername()); } this.stockCheckingService.add(stockChecking); pstock.setQuantity(quantity); // 更新数量 this.pstockService.update(pstock); return SUCCESS; } else { this.setMessage("产品编码不能为空!"); return INPUT; } } else { this.setMessage("产品编码不能为空!"); return INPUT; } }