public boolean approvalStockLoss(String id, int approval) {
    ArrayList<LogisticsLossPO> stocklosslist = new ArrayList<LogisticsLossPO>();
    stocklosslist = slds.getStockLoss();
    LogisticsLossVO sofv = new LogisticsLossVO();
    for (LogisticsLossPO slp : stocklosslist) {
      if (slp.getId().equals(id)) {
        slp.setApproval(approval);
        slds.update(slp);
        sofv = stockLossPoToVo(slp);
        break;
      }
    }

    if (sofv.approval == 1) {
      for (CommodityVO cv : cb.getCommodity()) {
        if (sofv.name.equals(cv.commodityname) && sofv.model.equals(cv.model)) {
          CommodityVO newCv = (CommodityVO) cv.clone();
          newCv.number = cv.number - sofv.lossNumber;
          if (cb.updateCommodity(cv, newCv, cb.getFather(cv))) {
            if (newCv.number < newCv.dangerNumber) {
              mb.add(new MessageVO("物流报警", cv.commodityname, cv.model, newCv.number, "空", false));
            }
            return true;
          } else {
            return false;
          }
        }
      }
    }
    return true;
  }
 public ArrayList<LogisticsLossVO> getStockLoss() {
   ArrayList<LogisticsLossVO> stocklossList = new ArrayList<LogisticsLossVO>();
   for (LogisticsLossPO slp : slds.getStockLoss()) {
     stocklossList.add(stockLossPoToVo(slp));
   }
   return stocklossList;
 }
 public ArrayList<LogisticsLossVO> getUncheckedStockLoss() {
   ArrayList<LogisticsLossVO> stocklossList = new ArrayList<LogisticsLossVO>();
   for (LogisticsLossPO slp : slds.getStockLoss()) {
     if (slp.getApproval() == 3) {
       stocklossList.add(stockLossPoToVo(slp));
     }
   }
   return stocklossList;
 }
 public LogisticsLossPO getStockLossPO(String id) {
   if (id == null) {
     return null;
   }
   for (LogisticsLossPO slp : slds.getStockLoss()) {
     if (slp.getId().equals(id)) {
       return slp;
     }
   }
   return null;
 }
 @Override
 public boolean setApproval(LogisticsLossVO slv, int approval) {
   // TODO Auto-generated method stub
   if (slv == null) {
     return false;
   }
   LogisticsLossPO slp = getStockLossPO(slv.id);
   if (slp == null) {
     return false;
   }
   if (slds.setApproval(slp, approval)) {
     return true;
   }
   return false;
 }
  @Override
  public boolean add(LogisticsLossVO slv) {
    // TODO Auto-generated method stub
    if (slv == null) {
      return false;
    }

    for (CommodityVO cv : cb.getCommodity()) {
      if (cv.commodityname.equals(slv.name) && cv.model.equals(slv.model)) {
        if (cv.number - slv.lossNumber < 0) {
          return false;
        }
      }
    }

    if (slds.add(stockLossVoToPo(slv))) {
      return true;
    }
    return false;
  }