Пример #1
0
  public Filter cookFilter(Map map) throws InvalidDataException {
    Filter filter = new Filter();
    String[] ss = null;

    ss = (String[]) map.get("venderid");
    if (ss != null && ss.length > 0 && ss[0] != null && ss[0].length() > 0) {
      Values val_vender = new Values(ss);
      filter.add("p.venderid IN (" + val_vender.toString4String() + ") ");
    }

    ss = (String[]) map.get("month");
    if (ss != null && ss.length > 0) {
      Calendar cal = Calendar.getInstance();
      SimpleDateFormat oSdf = new SimpleDateFormat("", Locale.ENGLISH);
      oSdf.applyPattern("yyyy-MM");
      try {
        cal.setTime(oSdf.parse(ss[0]));
      } catch (ParseException e) {
        throw new InvalidDataException(e);
      }
      int num2 = cal.getActualMaximum(Calendar.DAY_OF_MONTH);

      filter.add(" (p.sdate) >= " + ValueAdapter.std2mdy(ss[0] + "-01"));
      filter.add(" (p.sdate) <= " + ValueAdapter.std2mdy(ss[0] + "-" + num2));
    }

    ss = (String[]) map.get("shopid");
    if (ss != null && ss.length > 0) {
      Values val_shopid = new Values(ss);
      filter.add("p.shopid IN (" + val_shopid.toString4String() + ") ");
    }
    return filter;
  }
Пример #2
0
  public Filter cookFilter(Map parms) {
    Filter filter = new Filter();
    String[] ss = null;

    ss = (String[]) parms.get("venderid");
    if (ss != null && ss.length > 0 && ss[0] != null && ss[0].length() > 0) {
      Values val_vender = new Values(ss);
      filter.add("c.venderid IN (" + val_vender.toString4String() + ") ");
    }

    ss = (String[]) parms.get("sheetid");
    if (ss != null && ss.length > 0 && ss[0] != null && ss[0].length() > 0) {
      Values val_sheetid = new Values(ss);
      filter.add("c.sheetid IN (" + val_sheetid.toString4String() + ") ");
      return filter;
    }

    ss = (String[]) parms.get("sheetid_purchase");
    if (ss != null && ss.length > 0 && ss[0] != null && ss[0].length() > 0) {
      Values val_sheetid = new Values(ss);
      filter.add("p.sheetid IN (" + val_sheetid.toString4String() + ") ");
      return filter;
    }

    /** 根据订货地过滤 */
    ss = (String[]) parms.get("shopid");
    if (ss != null && ss.length > 0) {
      Values val_shopid = new Values(ss);
      filter.add("p.shopid IN (" + val_shopid.toString4String() + ") ");
    }

    /** 根据收货地过滤 */
    ss = (String[]) parms.get("destshopid");
    if (ss != null && ss.length > 0) {
      Values val_shopid = new Values(ss);
      filter.add("p.destshopid IN (" + val_shopid.toString4String() + ") ");
    }

    ss = (String[]) parms.get("status");
    if (ss != null && ss.length > 0) {
      Values val_status = new Values(ss);
      filter.add("c.status IN (" + val_status.toString4String() + ") ");
    }

    ss = (String[]) parms.get("logistics");
    if (ss != null && ss.length > 0) {
      Values val_logistics = new Values(ss);
      filter.add("p0.logistics IN (" + val_logistics.toString4String() + ") ");
    }

    ss = (String[]) parms.get("editdate_min");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.editdate) >= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("editdate_max");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.editdate) <= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("checkdate_min");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.checkdate) >= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("checkdate_max");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.checkdate) <= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("deadline_min");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.deadline) >= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("deadline_max");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.deadline) <= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("orderdate_min");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.orderdate) >= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("orderdate_max");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(p0.orderdate) <= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("releasedate_min");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(c.releasedate) >= " + ValueAdapter.std2mdy(date));
    }

    ss = (String[]) parms.get("releasedate_max");
    if (ss != null && ss.length > 0) {
      String date = ss[0];
      filter.add("trunc(c.releasedate) <= " + ValueAdapter.std2mdy(date));
    }
    return filter;
  }