/** 删除对象 */
 public String delete() {
   for (int i = 0; i < items.length; i++) {
     Hashtable params = HttpUtils.parseQueryString(items[i]);
     zgTorderPlanbomExBo.removeById((java.lang.String) params.get("id"));
   }
   return LIST_ACTION;
 }
 public void prepare() throws Exception {
   if (isNullOrEmptyString(id)) {
     zgTorderPlanbom = new ZgTorderPlanbom();
   } else {
     zgTorderPlanbom = (ZgTorderPlanbom) zgTorderPlanbomExBo.getById(id);
   }
 }
  @SuppressWarnings("unchecked")
  public void saveOrderPlan() throws IOException {
    boolean isUpdated = false;
    for (ZgTorderPlanbom obj : orderPlanboms) {
      if (null != obj) {
        ZgTorderPlanbom entity = new ZgTorderPlanbom();
        entity.setCuid(obj.getCuid());
        entity.setDepartmentId(StringUtils.trimToNull(obj.getDepartmentId()));
        entity.setUserId(StringUtils.trimToNull(obj.getUserId()));
        entity.setPlanDate(obj.getPlanDate());
        entity.setPlanStartTime(StringUtils.trimToNull(obj.getPlanStartTime()));
        entity.setPlanEndTime(StringUtils.trimToNull(obj.getPlanEndTime()));
        entity.setState("4");
        zgTorderPlanbomExBo.updateOrderPlan(entity);
        isUpdated = true;
      }
    }

    String orderPlanIds[] = orderPlanId.split(",");
    for (int i = 0; i < orderPlanIds.length; i++) {
      if (isUpdated) {
        zgTorderPlanExBo.updateOrderPlanState(orderPlanIds[i], "4");
      }

      // 更新该领料计划的领料组 领料人
      zgTorderPlanExBo.updateOrderDeptId(orderPlanIds[i]);
    }

    forwardQuery("操作成功");
  }
 public String findViewBomList() throws ServletException, IOException {
   List<ZgTorderPlanbomEx> list = zgTorderPlanbomExBo.findBomList(orderPlanId);
   getRequest().setAttribute("state", getRequest().getParameter("state"));
   this.getRequest().setAttribute("bomList", list);
   this.getRequest().setAttribute("orderPlanId", orderPlanId);
   this.getRequest().setAttribute("count", list.size());
   return VIEW_BOM_LIST;
 }
 /** 执行搜索 */
 public String list() {
   PageRequest<Map> pageRequest = newPageRequest(DEFAULT_SORT_COLUMNS);
   // pageRequest.getFilters().put("key",value);     //add custom filter
   // getRequest().setAttribute("attrMap",vmModelBo.getAttrsByUser(zgTorderPlanbom.BM_CLASS_ID,super.getSessionUserId()));
   Page page = zgTorderPlanbomExBo.findByPageRequest(pageRequest);
   savePage(page, pageRequest);
   return LIST_JSP;
 }
  /**
   * 对已提交后的领料计划进行保存,不修改领料计划的状态,只保存领料组,领料人等信息
   *
   * @return
   * @throws IOException
   */
  @SuppressWarnings("unchecked")
  public void saveViewOrderPlan() throws IOException {
    for (ZgTorderPlanbom obj : orderPlanboms) {
      ZgTorderPlanbom entity = new ZgTorderPlanbom();
      entity.setCuid(obj.getCuid());
      entity.setDepartmentId(StringUtils.trimToNull(obj.getDepartmentId()));
      entity.setUserId(StringUtils.trimToNull(obj.getUserId()));
      entity.setPlanDate(obj.getPlanDate());
      entity.setPlanStartTime(StringUtils.trimToNull(obj.getPlanStartTime()));
      entity.setPlanEndTime(StringUtils.trimToNull(obj.getPlanEndTime()));
      // entity.setState("8");
      zgTorderPlanbomExBo.updateOrderPlan1(entity);
    }
    // 更新该领料计划的领料组 领料人
    zgTorderPlanExBo.updateOrderDeptId(orderPlanId);

    forwardQuery("操作成功");
  }
 public String findBomList() throws ServletException, IOException {
   List<ZgTorderPlanbomEx> list = zgTorderPlanbomExBo.findBomList(orderPlanId);
   this.getRequest().setAttribute("bomList", list);
   this.getRequest().setAttribute("orderPlanId", orderPlanId);
   ZgTorderPlan entity = this.zgTorderPlanBo.getById(orderPlanId);
   this.getRequest().setAttribute("zgTorderPlan", entity);
   this.getRequest().setAttribute("count", list.size());
   String sortColumn = this.getRequest().getParameter("sortColumn");
   String isAsc = this.getRequest().getParameter("isAsc");
   this.getRequest().setAttribute("sortColumn", sortColumn);
   this.getRequest().setAttribute("isAsc", isAsc);
   if (!StringUtils.isBlank(sortColumn)) {
     SortBomList comparator =
         new SortBomList(sortColumn, StringUtils.isBlank(isAsc) ? true : Boolean.valueOf(isAsc));
     Collections.sort(list, comparator);
   }
   return BOM_LIST;
 }
  /**
   * 为入库冲单生成入生成半成品
   *
   * @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("操作成功");
  }
 /** 保存更新对象 */
 public String update() {
   zgTorderPlanbomExBo.update(this.zgTorderPlanbom);
   return LIST_ACTION;
 }
 /** 保存新增对象 */
 public String save() {
   zgTorderPlanbomExBo.save(zgTorderPlanbom);
   return LIST_ACTION;
 }