/**
  * 新增样品
  *
  * @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;
 }
 /**
  * 验证数据
  *
  * @param sample
  * @return
  */
 private boolean checkData(SampleDto sample) {
   if (sample == null) {
     this.addActionMessage("请选择产品!");
     return false;
   }
   if (StringUtil.isBlank(sample.getProductid())) {
     this.addActionMessage("请选择产品!");
     return false;
   }
   if (StringUtil.isBlank(sample.getRes01())) {
     this.addActionMessage("请选择客户!");
     return false;
   }
   if (StringUtil.isBlank(sample.getQuantity())) {
     this.addActionMessage("数量不能为空!");
     return false;
   }
   if (StringUtil.isBlank(sample.getNote())) {
     this.addActionMessage("备注不能为空!");
     return false;
   }
   return true;
 }
 /**
  * 修改样品
  *
  * @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;
 }