/**
   * 删除入库单中的半成品
   *
   * @throws IOException
   */
  public String deleteBom() throws IOException {
    List<ZgTstorageCanclebomEx> bomECancleList =
        (List<ZgTstorageCanclebomEx>) this.getSession().getAttribute("bomECancleList");

    for (int i = 0; i < items.length; i++) {
      Hashtable params = HttpUtils.parseQueryString(items[i]);
      String cuid = (String) params.get("cuid");
      for (ZgTstorageCanclebomEx obj : bomECancleList) {
        if (cuid.equals(obj.getCuid())) {
          obj.setIsDel(true);
          obj.setIsModity(true);
          break;
        }
      }
    }

    this.getSession().setAttribute("bomECancleList", bomECancleList);

    // 保存bomIds到session中,用于页面展示可选bom的时候过滤
    String bomECancleIds = "";
    for (ZgTstorageCanclebomEx obj : bomECancleList) {
      if (!obj.getIsDel()) {
        bomECancleIds = bomECancleIds + obj.getStorageId() + obj.getOrderBomId() + ",";
      }
    }
    this.getSession().setAttribute("bomECancleIds", bomECancleIds);

    return SUCCESS;
  }
  /** 查询可以冲单的半成品 */
  public String listByCancleId() {
    PageRequest<Map> pageRequest = newPageRequest(DEFAULT_SORT_COLUMNS);

    List<ZgTstorageCanclebomEx> list =
        zgTstorageCanclebomExBo.listByCancleId(pageRequest.getFilters());

    // 过滤当前库存单已经存在的半成品
    String bomECancleIds =
        this.getSession().getAttribute("bomECancleIds") == null
            ? ""
            : this.getSession().getAttribute("bomECancleIds").toString();
    List<ZgTstorageCanclebomEx> bomListNew = new ArrayList<ZgTstorageCanclebomEx>();
    for (ZgTstorageCanclebomEx obj : list) {
      if (bomECancleIds.indexOf(obj.getStorageId() + obj.getOrderBomId()) < 0) {
        bomListNew.add(obj);
      }
    }

    getRequest().setAttribute("resultList", bomListNew);

    return LIST_JSP;
  }
 /**
  * 保存入库冲单表的半成品,保存在session
  *
  * @return
  */
 public String saveBom() {
   List<ZgTstorageCanclebomEx> bomECancleList =
       (List<ZgTstorageCanclebomEx>) this.getSession().getAttribute("bomECancleList");
   if (null != cancleBomList) {
     for (ZgTstorageCanclebomEx obj : cancleBomList) {
       if (obj != null) {
         for (ZgTstorageCanclebomEx temp : bomECancleList) {
           if (obj.getCuid().equals(temp.getCuid())) {
             temp.setNum(obj.getNum());
             temp.setZbz(obj.getZbz());
             temp.setStorageCancleId(obj.getStorageCancleId());
             temp.setIsModity(true);
           }
         }
       }
     }
   }
   return SUCCESS;
 }
  /**
   * 为入库冲单生成入生成半成品
   *
   * @throws IOException
   */
  public void generateBom() throws IOException {
    List<ZgTstorageCanclebomEx> bomECancleList =
        (List<ZgTstorageCanclebomEx>) this.getSession().getAttribute("bomECancleList");

    for (int i = 0; i < items.length; i++) {
      Hashtable params = HttpUtils.parseQueryString(items[i]);
      ZgTstorageCanclebomEx obj = new ZgTstorageCanclebomEx();
      String cuid = zgTorderPlanbomExBo.getCUID();
      obj.setCuid(cuid);
      obj.setAufnr((java.lang.String) params.get("aufnr"));

      obj.setArbpl((java.lang.String) params.get("arbpl"));
      obj.setStorageId((java.lang.String) params.get("storageId"));
      obj.setMatnr((java.lang.String) params.get("matnr"));
      obj.setIdnrk((java.lang.String) params.get("idnrk"));
      obj.setMsehl1((java.lang.String) params.get("msehl1"));
      obj.setAllNum(Double.parseDouble((java.lang.String) params.get("allNum")));
      obj.setNum(Double.parseDouble((java.lang.String) params.get("allNum")));
      obj.setOrderBomId((java.lang.String) params.get("orderBomId"));
      obj.setStorageCancleId((java.lang.String) params.get("storageCancleId"));
      obj.setLgort((String) params.get("lgort"));
      obj.setIsModity(true);
      bomECancleList.add(obj);
    }
    this.getSession().setAttribute("bomECancleList", bomECancleList);

    // 保存bomIds到session中,用于页面展示可选bom的时候过滤
    String bomECancleIds = "";
    for (ZgTstorageCanclebomEx obj : bomECancleList) {
      if (!obj.getIsDel()) {
        bomECancleIds = bomECancleIds + obj.getStorageId() + obj.getOrderBomId() + ",";
      }
    }
    this.getSession().setAttribute("bomECancleIds", bomECancleIds);

    returnMsgAndCloseWindow("操作成功");
  }