/** * 新增样品 * * @return */ public String addSampleAction() { try { this.clearMessages(); // 数据验证 if (!checkData(addSampleDto)) { return "checkerror"; } // 当前操作用户ID String username = (String) ActionContext.getContext().getSession().get(Constants.SESSION_USER_ID); addSampleDto.setUpdateuid(username); addSampleDto.setCreateuid(username); addSampleDto.setRank(Constants.ROLE_RANK_OPERATOR); addSampleDto.setWarehousename( PropertiesConfig.getPropertiesValueByKey(Constants.SYSTEM_WAREHOUSE_NAME)); addSampleDto.setBelongto(PropertiesConfig.getPropertiesValueByKey(Constants.SYSTEM_BELONG)); // 默认状态=有效 addSampleDto.setStatus(Constants.STATUS_NORMAL); sampleService.insertSample(addSampleDto); this.addActionMessage("添加成功!"); addSampleDto = new SampleDto(); } catch (Exception e) { log.error("addSampleAction error:" + e); return ERROR; } return SUCCESS; }
/** * 显示修改样品页面 * * @return */ public String showUpdSampleAction() { try { this.clearMessages(); updSampleDto = sampleService.querySampleId(updSampleId); } catch (Exception e) { log.error("showUpdSampleAction error:" + e); return ERROR; } return SUCCESS; }
/** 数据查询 */ @SuppressWarnings("unchecked") private void queryData() { if (page == null) { page = new Page(intPageSize); } // 初期化字典数据 initDictList(); // 翻页查询所有入库汇总记录 this.page.setStartIndex(startIndex); page = sampleService.querySampleByPage("", "", "", strTradename, page); sampleList = (List<SampleDto>) page.getItems(); this.setStartIndex(page.getStartIndex()); }
/** * 修改样品 * * @return */ public String updSampleAction() { try { this.clearMessages(); // 数据验证 if (!checkData(updSampleDto)) { return "checkerror"; } // 当前操作用户ID String username = (String) ActionContext.getContext().getSession().get(Constants.SESSION_USER_ID); updSampleDto.setUpdateuid(username); sampleService.updateSample(updSampleDto); this.addActionMessage("修改成功!"); } catch (Exception e) { log.error("updSampleAction error:" + e); return ERROR; } return SUCCESS; }