Пример #1
0
  /**
   * @param fullId
   * @param productIdSet
   * @return
   */
  private double sumOutForceBackValue(String fullId, Set<String> productIdSet) {
    ConditionParse con = new ConditionParse();

    con.addWhereStr();

    con.addCondition("OutBean.refOutFullId", "=", fullId);

    con.addIntCondition("OutBean.type", "=", OutConstant.OUT_TYPE_INBILL);

    con.addCondition("and OutBean.status in (3, 4)");

    con.addIntCondition("OutBean.outType", "=", OutConstant.OUTTYPE_IN_OTHER);

    //        con.addCondition("OutBean.reserve8", "<>", "1");

    List<OutBean> refList = outDAO.queryEntityBeansByCondition(con);

    double backTotal = 0.0d;

    for (OutBean outBean : refList) {
      backTotal += outBean.getTotal();
    }

    double excepTotal = getExceptProductValue(productIdSet, refList);

    return backTotal - excepTotal;
  }
Пример #2
0
  private List<BlackRuleBean> getBlackRuleForBlack() {
    ConditionParse con = new ConditionParse();

    con.addWhereStr();

    con.addIntCondition("BlackRuleBean.type", "=", BlackConstant.TYPE_BLACK);

    return blackRuleDAO.queryEntityBeansByCondition(con);
  }
Пример #3
0
  /*
   * (non-Javadoc)
   *
   * @see com.china.center.oa.product.listener.DepotListener#onDeleteDepot(com.center.china.osgi.publics.User,
   *      com.china.center.oa.product.bean.DepotBean)
   */
  public void onDeleteDepot(User user, DepotBean bean) throws MYException {
    ConditionParse con = new ConditionParse();

    con.addWhereStr();

    con.addCondition("OutBean.location", "=", bean.getId());

    if (outDAO.countByCondition(con.toString()) > 0) {
      throw new MYException("仓库已经被使用不能删除");
    }
  }
Пример #4
0
  public FlowLogBean findLastLog(String refId) {
    ConditionParse con = new ConditionParse();

    con.addWhereStr();

    con.addCondition("fullId", "=", refId);

    con.addCondition("order by id desc");

    List<FlowLogBean> list = this.queryEntityBeansByCondition(con);

    if (list.size() > 0) {
      return list.get(0);
    }

    return null;
  }
Пример #5
0
  private void setStatsBlackCondition(
      String statsDate, String stafferId, ConditionParse condition) {
    condition.clear();

    condition.addWhereStr();

    condition.addIntCondition("OutBean.type", "=", OutConstant.OUT_TYPE_OUTBILL);

    condition.addIntCondition("OutBean.pay", "=", OutConstant.PAY_NOT);

    condition.addCondition("and OutBean.status in (3, 4)");

    condition.addCondition("OutBean.stafferId", "=", stafferId);

    condition.addCondition("OutBean.outTime", ">=", "2011-03-01");

    condition.addCondition("OutBean.outTime", "<=", statsDate);

    //        condition.addCondition("OutBean.redate", "<", statsDate);

  }
Пример #6
0
  /** 区别销售与委托代销模式 */
  private void processStatsBlackOutDetail() {
    blackOutDetailDAO.deleteAllEntityBean();

    List<BlackOutBean> outList = blackOutDAO.queryEntityBeansByCondition("where type = 2");

    for (BlackOutBean each : outList) {
      String outId = each.getOutId();

      OutBean out = outDAO.find(outId);

      if (out.getPay() == OutConstant.PAY_YES) {
        continue;
      }

      List<BaseBean> baseList = baseDAO.queryEntityBeansByFK(outId);

      if (out.getOutType() == OutConstant.OUTTYPE_OUT_CONSIGN) {
        // 1.未结算部分
        List<OutBalanceBean> obList1 =
            outBalanceDAO.queryEntityBeansByCondition(
                "where outid = ? and type = 0 and status = 1", outId);

        List<OutBalanceBean> obList2 =
            outBalanceDAO.queryEntityBeansByCondition(
                "where outid = ? and type = 1 and status = 99", outId);

        obList2.addAll(obList1);

        for (BaseBean base : baseList) {
          for (OutBalanceBean balance : obList2) {
            List<BaseBalanceBean> bList = baseBalanceDAO.queryEntityBeansByFK(balance.getId());

            for (BaseBalanceBean bb : bList) {
              if (base.getId().equals(bb.getBaseId())) {
                base.setAmount(base.getAmount() - bb.getAmount());
              }
            }
          }

          // 将结果写入明细表
          saveOutDetail(base);
        }

        // 2.结算未回款部分
        for (OutBalanceBean balance : obList1) {
          if (balance.getPayMoney() > 0) continue;

          List<BaseBalanceBean> bbList = baseBalanceDAO.queryEntityBeansByFK(balance.getId());

          for (BaseBalanceBean eachbb : bbList) {
            List<OutBalanceBean> refBalanceList =
                outBalanceDAO.queryEntityBeansByCondition(
                    "where refOutBalanceId = ? and status = 99", balance.getId());

            for (OutBalanceBean refb : refBalanceList) {
              List<BaseBalanceBean> refbbList = baseBalanceDAO.queryEntityBeansByFK(refb.getId());

              for (BaseBalanceBean refbb : refbbList) {
                if (eachbb.getBaseId().equals(refbb.getBaseId())) {
                  eachbb.setAmount(eachbb.getAmount() - refbb.getAmount());
                }
              }
            }

            if (eachbb.getAmount() > 0) {
              BaseBean base = baseDAO.find(eachbb.getBaseId());

              BlackOutDetailBean bod = new BlackOutDetailBean();

              bod.setProductId(base.getProductId());
              bod.setPrice(eachbb.getSailPrice());
              bod.setAmount(eachbb.getAmount());
              bod.setOutId(base.getOutId());
              bod.setOutBalanceId(eachbb.getParentId());
              bod.setCostPrice(base.getCostPrice());

              blackOutDetailDAO.saveEntityBean(bod);
            }
          }
        }

      } else {
        // 减去退货部分
        List<BaseBean> refBaseList = new ArrayList<BaseBean>();

        ConditionParse con = new ConditionParse();

        con.addWhereStr();

        con.addCondition("OutBean.refOutFullId", "=", outId);

        con.addIntCondition("OutBean.type", "=", OutConstant.OUT_TYPE_INBILL);

        con.addCondition("and OutBean.status in (3, 4)");

        // 销售退库 & 领样退库
        con.addCondition("and OutBean.outType in (4, 5)");

        List<OutBean> refList = outDAO.queryEntityBeansByCondition(con);

        // 领样对冲单
        con.clear();

        con.addWhereStr();

        con.addCondition("OutBean.refOutFullId", "=", outId);

        con.addIntCondition("OutBean.type", "=", OutConstant.OUT_TYPE_INBILL);

        con.addCondition("and OutBean.status in (3, 4)");

        con.addIntCondition("OutBean.outType", "=", OutConstant.OUTTYPE_IN_OTHER);

        refList.addAll(outDAO.queryEntityBeansByCondition(con));

        for (OutBean eachOut : refList) {
          refBaseList.addAll(baseDAO.queryEntityBeansByFK(eachOut.getFullId()));
        }

        for (BaseBean base : baseList) {
          for (BaseBean refBase : refBaseList) {
            if (base.equals(refBase)) {
              base.setAmount(base.getAmount() - refBase.getAmount());
            }
          }

          saveOutDetail(base);
        }
      }
    }
  }