Exemple #1
0
  /**
   * 订购入库列表查询
   *
   * @param orderNo
   * @return List 查询结果
   */
  public List orderInList(String orderNo) {
    List<String[]> orderInfoList = new ArrayList<String[]>();
    try {
      // 查询订购中的某订单零件PO信息
      String strHql = "from PoForm as po where po.orderNo= :orderNo and po.orderStatus='B'";
      ArrayList<QueryParameter> paramList = new ArrayList<QueryParameter>();
      QueryParameter param = new QueryParameter();
      param.setName("orderNo");
      param.setValue(orderNo);
      param.setHbType(Hibernate.STRING);
      paramList.add(param);

      List<PoForm> orderList = this.getDao().parameterQuery(strHql, paramList);
      for (int i = 0; orderList != null && i < orderList.size(); i++) {
        PoForm pf = orderList.get(i);
        String[] temp = new String[13];
        temp[0] = pf.getPoNo().toString();
        temp[1] = pf.getStuffNo();
        temp[2] = pf.getModelCode();
        temp[3] = pf.getSaleNo();
        temp[4] = pf.getCustomerName();
        temp[5] = pf.getDeliveryTime();
        temp[6] = pf.getShippingAddress();
        temp[7] = pf.getOrderNum().toString();
        temp[8] = Operate.toFix(pf.getPerQuote(), 2);
        temp[9] = pf.getCreateDate().toLocaleString();
        temp[10] =
            Operate.toFix(
                pf.getPerQuote() * CommonSearch.getInstance().getExchangeRate(pf.getSaleNo()), 2);
        temp[11] = pf.getTransportMode();
        temp[12] = pf.getSkuCode();

        orderInfoList.add(temp);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return orderInfoList;
  }
  private ArrayList queryCondition(SaleDetailForm form) {
    ArrayList paramList = new ArrayList();
    where = " where pa.delFlag=0 and sif.stockStatus = 'A' and sif.stuffNo=pa.stuffNo";
    if (form != null) {

      if (form.getSaleNo() != null && !form.getSaleNo().equals("")) {
        where = where + " and pa.saleNo like :saleNo";
        QueryParameter param = new QueryParameter();
        param.setName("saleNo");
        param.setValue(form.getSaleNo());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getStuffNo() != null && !form.getStuffNo().equals("")) {
        where = where + " and pa.stuffNo like :stuffNo ";
        QueryParameter param = new QueryParameter();
        param.setName("stuffNo");
        param.setValue(form.getStuffNo());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getSkuCode() != null && !form.getSkuCode().equals("")) {
        where = where + " and pa.skuCode like :skuCode ";
        QueryParameter param = new QueryParameter();
        param.setName("skuCode");
        param.setValue(form.getSkuCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getModelCode() != null && !form.getModelCode().equals("")) {
        where = where + " and pa.modelCode like :modelCode ";
        QueryParameter param = new QueryParameter();
        param.setName("modelCode");
        param.setValue(form.getModelCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getModelSerialNo() != null && !form.getModelSerialNo().equals("")) {
        where = where + " and pa.modelSerialNo like :modelSerialNo ";
        QueryParameter param = new QueryParameter();
        param.setName("modelSerialNo");
        param.setValue(form.getModelSerialNo());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getCreateBy() != null && form.getCreateBy() != 0) {
        where = where + " and pa.createBy = :createBy";
        QueryParameter param = new QueryParameter();
        param.setName("createBy");
        param.setValue(form.getCreateBy());
        param.setHbType(Hibernate.LONG);
        paramList.add(param);
      }

      if (form.getPartStatus() != null && !form.getPartStatus().equals("")) {
        where = where + " and pa.partStatus = :partStatus";
        QueryParameter param = new QueryParameter();
        param.setName("partStatus");
        param.setValue(form.getPartStatus());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getInDate1() != null && !form.getInDate1().equals("")) {
        where += " and pa.createDate >= :inDate1";
        QueryParameter param = new QueryParameter();
        param.setName("inDate1");
        param.setValue(Operate.toDate(form.getInDate1()));
        param.setHbType(Hibernate.DATE);
        paramList.add(param);
      }
      if (form.getInDate2() != null && !form.getInDate2().equals("")) {
        where += " and pa.createDate < :inDate2";
        QueryParameter param = new QueryParameter();
        param.setName("inDate2");
        param.setValue(Operate.getNextDate(form.getInDate2()));
        param.setHbType(Hibernate.DATE);
        paramList.add(param);
      }
    }
    return paramList;
  }
  private ArrayList queryCondition(RepairPartForm form) {
    whereIn = " where 1=1 ";
    ArrayList paramList = new ArrayList();
    if (form != null) {

      if (form.getServiceSheetNo() != null && !"".equals(form.getServiceSheetNo())) {
        whereIn += " and rsf.serviceSheetNo like :serviceSheetNo";
        QueryParameter param = new QueryParameter();
        param.setName("serviceSheetNo");
        param.setValue(form.getServiceSheetNo());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getSkuCode() != null && !form.getSkuCode().equals("")) {
        whereIn += " and rsf.skuCode like :skuCode";
        QueryParameter param = new QueryParameter();
        param.setName("skuCode");
        param.setValue(form.getSkuCode());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getStandard() != null && !form.getStandard().equals("")) {
        whereIn += " and rsf.standard like :standard";
        QueryParameter param = new QueryParameter();
        param.setName("standard");
        param.setValue(form.getStandard());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getStuffNo() != null && !form.getStuffNo().equals("")) {
        whereIn += " and rsf.stuffNo like :stuffNo";
        QueryParameter param = new QueryParameter();
        param.setName("stuffNo");
        param.setValue(form.getStuffNo());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getSkuUnit() != null && !form.getSkuUnit().equals("")) {
        whereIn += " and rsf.skuUnit = :skuUnit";
        QueryParameter param = new QueryParameter();
        param.setName("skuUnit");
        param.setValue(form.getSkuUnit());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getRepairPartType() != null && !form.getRepairPartType().equals("")) {
        whereIn += " and rsf.repairPartType = :repairPartType";
        QueryParameter param = new QueryParameter();
        param.setName("repairPartType");
        param.setValue(form.getRepairPartType());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getRepairPartStatus() != null && !form.getRepairPartStatus().equals("")) {
        whereIn += " and rsf.repairPartStatus = :repairPartStatus";
        QueryParameter param = new QueryParameter();
        param.setName("repairPartStatus");
        param.setValue(form.getRepairPartStatus());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }
      if (form.getWarrantyType() != null && !form.getWarrantyType().equals("")) {
        whereIn += " and rsf.warrantyType = :warrantyType";
        QueryParameter param = new QueryParameter();
        param.setName("warrantyType");
        param.setValue(form.getWarrantyType());
        param.setHbType(Hibernate.STRING);
        paramList.add(param);
      }

      if (form.getCreateBy() != null && form.getCreateBy().longValue() != 0) {
        whereIn += " and rsf.createBy = :createBy";
        QueryParameter param = new QueryParameter();
        param.setName("createBy");
        param.setValue(form.getCreateBy());
        param.setHbType(Hibernate.LONG);
        paramList.add(param);
      }

      if (form.getUpdateBy() != null && form.getUpdateBy().longValue() != 0) {
        whereIn += " and rsf.updateBy = :updateBy";
        QueryParameter param = new QueryParameter();
        param.setName("updateBy");
        param.setValue(form.getUpdateBy());
        param.setHbType(Hibernate.LONG);
        paramList.add(param);
      }
    }
    return paramList;
  }