@Override
  protected void onBoEdit() throws Exception {
    if (getBufferData().isVOBufferEmpty()) {
      return;
    }
    if (getBufferData().getCurrentRow() < 0) {
      getBillUI().showWarningMessage("请选择要修改的单据");
      return;
    }

    String corp =
        PuPubVO.getString_TrimZeroLenAsNull(
            getBufferData().getCurrentVO().getParentVO().getAttributeValue("ccorpid"));
    if (!_getCorp().getPrimaryKey().equalsIgnoreCase(corp))
      throw new BusinessException("矿上新增的物资编码,不可修改");

    String invcode = null;
    BillCardPanel card = getBillCardPanelWrapper().getBillCardPanel();
    BillListPanel list = getBillListPanelWrapper().getBillListPanel();
    if (getBillManageUI().isListPanelSelected()) { // 列表状态
      int selectRow = list.getHeadTable().getSelectedRow();
      invcode =
          PuPubVO.getString_TrimZeroLenAsNull(
              list.getHeadBillModel().getValueAt(selectRow, "invcode"));
    } else {
      invcode = PuPubVO.getString_TrimZeroLenAsNull(card.getHeadItem("invcode").getValueObject());
    }
    if (invcode != null) throw new BusinessException("已经编码,不可修改");
    super.onBoEdit();
    setHeadEditEnableWhenCoding(false);
    setButtonEnable(true, IBillButton.Save);
    setButtonEnable(false, HgPuBtnConst.OK);
  }
Example #2
0
 public void validateOnSave() throws BusinessException {
   if (getNquotationlower() == null) throw new BusinessException("合理报价偏差率不能为空");
   if (PuPubVO.getUFDouble_NullAsZero(getNquotationlower()).compareTo(UFDouble.ZERO_DBL) < 0)
     throw new BusinessException("合理报价偏差率不能小于零");
   if (PuPubVO.getUFDouble_NullAsZero(getNquotationlower()).compareTo(UFDouble.ONE_DBL) > 0)
     throw new BusinessException("合理报价偏差率不能大于壹");
 }
Example #3
0
  public UFDouble getThreeParameters(String ccustmanid, String corp) throws DAOException {
    String sql1 =
        " select sum(f.dfybje) from arap_djzb z join arap_djfb f on z.vouchid = f.vouchid "
            + " where z.djlxbm in ('D1','2348') and isnull(z.dr, 0) = 0 and isnull(f.dr, 0) = 0 "
            + " and f.jsfsbm ='25'  and z.dwbm='"
            + corp
            + "' and z.zgyf=0 and f.hbbm= '"
            + ccustmanid
            + "' ";
    UFDouble d1 =
        PuPubVO.getUFDouble_NullAsZero(
            getBaseDao().executeQuery(sql1, HgBsPubTool.COLUMNPROCESSOR));

    String sql2 =
        " select sum(z.bbje) from arap_djzb z join arap_djfb f on z.vouchid = f.vouchid "
            + " where z.djlxbm in ('D3','2346') and isnull(z.dr, 0) = 0 and isnull(f.dr, 0) = 0 "
            + " and z.dwbm='"
            + corp
            + "' and z.prepay = 'Y' and f.hbbm= '"
            + ccustmanid
            + "' ";
    UFDouble d2 =
        PuPubVO.getUFDouble_NullAsZero(
            getBaseDao().executeQuery(sql2, HgBsPubTool.COLUMNPROCESSOR));

    UFDouble d3 = UFDouble.ZERO_DBL;

    if (d2.sub(d1).compareTo(d3) > 0) {
      d3 = d2.sub(d1);
    }
    return d3;
  }
 public void onBoCommit() throws Exception {
   String invcode = null;
   BillCardPanel card = getBillCardPanelWrapper().getBillCardPanel();
   BillListPanel list = getBillListPanelWrapper().getBillListPanel();
   if (getBillManageUI().isListPanelSelected()) { // 列表状态
     int selectRow = list.getHeadTable().getSelectedRow();
     invcode =
         PuPubVO.getString_TrimZeroLenAsNull(
             list.getHeadBillModel().getValueAt(selectRow, "invcode"));
   } else {
     invcode = PuPubVO.getString_TrimZeroLenAsNull(card.getHeadItem("invcode").getValueObject());
   }
   if (invcode == null) throw new BusinessException("请先编码后再提交");
   super.onBoCommit();
 }
 /**
  * @author zhf @说明 获取vo转换类实例 @时间 2010-9-26上午10:47:52
  * @param classname
  * @return
  */
 private static nc.vo.pf.change.IchangeVO getChangeClass(String classname) throws Exception {
   if (PuPubVO.getString_TrimZeroLenAsNull(classname) == null) return null;
   try {
     Class c = Class.forName(classname);
     Object o = c.newInstance();
     return (nc.vo.pf.change.IchangeVO) o;
   } catch (Exception ex) {
     Logger.error(ex.getMessage(), ex);
     throw ex;
   }
 }
  protected void onBOOK() throws Exception {
    BillCardPanel card = getBillCardPanelWrapper().getBillCardPanel();
    String invcode =
        PuPubVO.getString_TrimZeroLenAsNull(card.getHeadItem("invcode").getValueObject());
    if (invcode == null) throw new BusinessException("请先编码后再确定");

    Object ijjway =
        getBillCardPanelWrapper().getBillCardPanel().getHeadItem("ijjway").getValueObject();
    Object pk_taxitems =
        getBillCardPanelWrapper().getBillCardPanel().getHeadItem("pk_taxitems").getValueObject();
    Object nplanprice =
        getBillCardPanelWrapper().getBillCardPanel().getHeadItem("nplanprice").getValueObject();
    if (PuPubVO.getString_TrimZeroLenAsNull(ijjway) == null)
      throw new BusinessException("结算方式不能为空");
    if (PuPubVO.getString_TrimZeroLenAsNull(pk_taxitems) == null)
      throw new BusinessException("税目不能为空");
    if (PuPubVO.getString_TrimZeroLenAsNull(nplanprice) == null)
      throw new BusinessException("计划价不能为空");
    super.onBoSave();
    card.getHeadItem("invcode").setEdit(false);
  }
Example #7
0
  public void checkVdef20(AggregatedValueObject vo) throws BusinessException {
    BzhVO hvo = (BzhVO) vo.getParentVO();
    String query =
        " select count(*) from po_invoice where vdef20 = '"
            + hvo.getVbillno()
            + "' and ibillstatus = 3 and isnull(dr,0)=0 ";
    String len =
        PuPubVO.getString_TrimZeroLenAsNull(
            getBaseDao().executeQuery(query, HgBsPubTool.COLUMNPROCESSOR));

    if (Integer.parseInt(len) > 0) {
      throw new BusinessException("该发票已经存在审批");
    }
    BzbVO[] bvos = (BzbVO[]) vo.getChildrenVO();
    for (BzbVO bvo : bvos) {
      String sql =
          " update po_invoice set vdef20 = '' where cinvoiceid = '" + bvo.getCsourcebillhid() + "'";
      getBaseDao().executeUpdate(sql);
    }
  }
Example #8
0
 public void validation() throws ValidationException {
   if (PuPubVO.getString_TrimZeroLenAsNull(getCoutcorpid()) == null)
     throw new ValidationException("调出公司不能为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCincorpid()) == null)
     throw new ValidationException("调入公司不能为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCoutcalbodyid()) == null)
     throw new ValidationException("调出组织不能为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCincalbodyid()) == null)
     throw new ValidationException("调入组织不能为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCinvbasid()) == null)
     throw new ValidationException("存货为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCoutinvid()) == null)
     throw new ValidationException("调出存货不能为空");
   if (PuPubVO.getString_TrimZeroLenAsNull(getCininvid()) == null)
     throw new ValidationException("调入存货标示为空");
   //		if(PuPubVO.getString_TrimZeroLenAsNull(getCoutcorpid())==null)
   //			throw new ValidationException("");
   //		if(PuPubVO.getString_TrimZeroLenAsNull(getCoutcorpid())==null)
   //			throw new ValidationException("");
 }
Example #9
0
  /**
   * 存货与仓库属性匹配约束检查:非固定资产存货一定不能入资产仓(应税劳务和价格折扣属性的存货不检查)
   *
   * <p><b>examples:</b>
   *
   * <p>使用示例
   *
   * <p><b>参数说明</b>
   *
   * @param billVO:单据聚合VO
   * @param strBillType:单据类型
   * @throws BusinessException
   *     <p>
   * @author lixiaodong
   * @time 2007-5-30 下午01:54:12
   */
  public void checkStorAndInvIsCapital(AggregatedValueObject billVO, String strBillType)
      throws BusinessException {
    try {
      if (billVO == null || PuPubVO.getString_TrimZeroLenAsNull(strBillType) == null) {
        SCMEnv.out("传入参数不正确,直接返回");
        return;
      }

      Vector<String> vctBaseID = new Vector<String>(); // 存货基本档案ID
      Vector<String> vctWarehouseID = new Vector<String>(); // 收货仓库ID
      Object objInvBaseID = null;
      Object objWarehouseID = null;
      if (strBillType == nc.vo.scm.pu.BillTypeConst.PO_ORDER // 采购订单
          || strBillType == nc.vo.scm.pu.BillTypeConst.PO_PRAY // 采购请购单
          || strBillType == nc.vo.scm.pu.BillTypeConst.PO_ARRIVE) { // 采购到货单
        for (int i = 0; i < billVO.getChildrenVO().length; i++) {
          if (billVO.getChildrenVO()[i] != null) {
            objInvBaseID = billVO.getChildrenVO()[i].getAttributeValue("cbaseid");
            objWarehouseID = billVO.getChildrenVO()[i].getAttributeValue("cwarehouseid");
            if (PuPubVO.getString_TrimZeroLenAsNull(objInvBaseID) != null
                && PuPubVO.getString_TrimZeroLenAsNull(objWarehouseID) != null) {
              vctBaseID.add(objInvBaseID.toString());
              vctWarehouseID.add(objWarehouseID.toString());
            }
          }
        }
      } else if (strBillType == nc.vo.scm.pu.BillTypeConst.STORE_PO) { // 采购入库单
        for (int i = 0; i < billVO.getChildrenVO().length; i++) {
          if (billVO.getChildrenVO()[i] != null && billVO.getParentVO() != null) {
            objInvBaseID = billVO.getParentVO().getAttributeValue("cinvbasid");
            objWarehouseID = billVO.getChildrenVO()[i].getAttributeValue("cwarehouseid");
            if (PuPubVO.getString_TrimZeroLenAsNull(objInvBaseID) != null
                && PuPubVO.getString_TrimZeroLenAsNull(objWarehouseID) != null) {
              vctBaseID.add(objInvBaseID.toString());
              vctWarehouseID.add(objWarehouseID.toString());
            }
          }
        }
      }

      if (vctBaseID == null
          || vctWarehouseID == null
          || vctBaseID.size() < 1
          || vctWarehouseID.size() < 1
          || vctBaseID.size() != vctWarehouseID.size()) {
        return;
      }
      String[] arrInvBaseID = new String[vctBaseID.size()];
      String[] arrWarehouseID = new String[vctWarehouseID.size()];
      vctBaseID.copyInto(arrInvBaseID);
      vctWarehouseID.copyInto(arrWarehouseID);

      Object[][] oaRetWarehouseID = null; // 是否资产仓
      Object[][] oaRetInvBaseID = null; // 是否固定资产类存货

      oaRetWarehouseID =
          queryArrayValue(
              "bd_stordoc", "pk_stordoc", new String[] {"iscapitalstor"}, arrWarehouseID, null);
      oaRetInvBaseID =
          queryArrayValue(
              "bd_invbasdoc",
              "pk_invbasdoc",
              new String[] {"pk_assetscategory", "laborflag", "discountflag"},
              arrInvBaseID,
              null); // pk_assetscategory:固定资产类别ID
      // discountflag:价格折扣
      // laborflag:应税劳务

      if (oaRetWarehouseID == null
          || oaRetInvBaseID == null
          || oaRetWarehouseID.length < 1
          || oaRetInvBaseID.length < 1) {
        return;
      } else {
        for (int i = 0; i < oaRetWarehouseID.length; i++) {
          UFBoolean bRet = new UFBoolean((String) oaRetWarehouseID[i][0]);
          UFBoolean bRet2 = new UFBoolean((String) oaRetInvBaseID[i][0]);
          if ("Y".equalsIgnoreCase(oaRetInvBaseID[i][1].toString())
              && "n".equalsIgnoreCase(oaRetInvBaseID[i][2].toString())) // 应税劳务和价格折扣属性的存货不检查
          if (PuPubVO.getString_TrimZeroLenAsNull(bRet2) != null
                && !bRet.booleanValue()) { // 非固定资产存货(pk_assetscategory不为空)一定不能入资产仓
              throw new BusinessException("固定资产类存货只能对应固定资产仓");
            }
        }
      }
    } catch (Exception e) {
      // 日志异常
      nc.vo.scm.pub.SCMEnv.out(e);
      // 按规范抛出异常
      throw new BusinessException(e);
    }
  }
Example #10
0
  /**
   * 作者:王印芬 功能:根据表、查询字段、查询条件得到符合条件的结果。 返回的结果不重复 参数: String sTable 表,SQL中FROM后的字符 String[] saFields
   * 需查询的域,SQL中SELECT后的字符 String sWhere 条件,SQL中WHERE后的字符,可加ORDER BY等 返回:Object[][] 结构如下: 长度=结果集长度
   * 每个[]中的元素为按参数fieldk中顺序排列的字段的值 如fields[] = {"d1","d2","d3"},查询共有两行记录,则返回Object[2][3] [0]
   * 第一行value(d1,d2,d3) [1] 第二行value(d1,d2,d3) 例外:SQLException SQL异常 日期:(2001-08-04 11:39:21)
   * 修改日期,修改人,修改原因,注释标志: 2003-03-04 wyf 对字段加入DISTINCT限制
   */
  public Object[][] queryResultsFromAnyTable(String sTable, String[] saFields, String sWhere)
      throws SQLException {

    // 检查参数正确性
    if (sTable == null || sTable.trim().length() < 1 || saFields == null || saFields.length < 1) {
      System.out.println(
          "nc.bs.pu.pub.PubBO.queryResultsFromAnyTable(String, String [], String)传入参数错误!");
      return null;
    }
    // 元素正确性
    int iLen = saFields.length;
    for (int i = 0; i < iLen; i++) {
      if (saFields[i] == null || saFields[i].trim().length() < 1) {
        System.out.println(
            "nc.bs.pu.pub.PubBO.queryResultsFromAnyTable(String, String [], String)传入参数错误!");
        return null;
      }
    }
    // 构造SQL语句
    StringBuffer sbufSql = new StringBuffer("SELECT DISTINCT ");
    sbufSql.append(saFields[0]); // +
    for (int i = 1; i < saFields.length; i++) {
      sbufSql.append(",");
      sbufSql.append(saFields[i]);
    }
    sbufSql.append(" FROM ");
    sbufSql.append(sTable);
    if (PuPubVO.getString_TrimZeroLenAsNull(sWhere) != null) {
      sbufSql.append(" WHERE ");
      sbufSql.append(sWhere);
    }

    Object[][] rets = null;
    Vector vec = new Vector();
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
      con = getConnection();
      stmt = con.createStatement();
      rs = stmt.executeQuery(sbufSql.toString());
      //
      boolean flag = false;
      Object o = null;
      while (rs.next()) {
        Object[] ob = new Object[saFields.length];
        for (int i = 0; i < saFields.length; i++) {
          o = rs.getObject(i + 1);
          if (o != null && o.toString().trim().length() > 0) {
            ob[i] = o;
            flag = true;
          }
        }
        if (flag) {
          vec.addElement(ob);
        }
        flag = false;
      }
    } finally {
      // 关闭结果集,即时释放资源
      try {
        if (rs != null) rs.close();
      } catch (Exception e) {
      }
      try {
        if (stmt != null) stmt.close();
      } catch (Exception e) {
      }
      try {
        if (con != null) con.close();
      } catch (Exception e) {
      }
    }

    if (vec.size() > 0) {
      rets = new Object[vec.size()][];
      for (int i = 0; i < vec.size(); i++) {
        rets[i] = (Object[]) vec.elementAt(i);
      }
    }

    return rets;
  }
Example #11
0
  /**
   * 作者:汪维敏 功能:批量加载 存货基本ID+辅计量单位 的换算信息 如果是第一次,进行查询,否则从Hashtable中获取。 信息存于哈希表中,哈希表结构: KEY:
   * 存货基本ID+辅计量单位主键 VALUE: Object[] [0] 换算率 UFDouble [1] 是否固定换算率 UFBoolean 主计量单位的换算率为1.00,为固定换算率
   * 参数:String[] saBaseId 基本ID[] String]] saAssistUnit 计量单位ID[] 返回:无 例外:无 日期:(2003-11-13 11:39:21)
   * 修改日期,修改人,修改原因,注释标志:
   */
  public HashMap loadBatchInvConvRateInfo(String[] saBaseId, String[] saAssistUnit)
      throws Exception {

    HashMap hInvConvRate = new HashMap();
    // 检验参数正确性
    if (saBaseId == null || saAssistUnit == null || saBaseId.length == 0) {
      return hInvConvRate;
    }

    int iLen = saBaseId.length;
    // 创建临时表
    ArrayList listTempTableValue = new ArrayList();
    for (int i = 0; i < iLen; i++) {
      if (PuPubVO.getString_TrimZeroLenAsNull(saBaseId[i]) == null
          || PuPubVO.getString_TrimZeroLenAsNull(saAssistUnit[i]) == null) {
        continue;
      }
      ArrayList listElement = new ArrayList();
      listElement.add(saBaseId[i]);
      listElement.add(saAssistUnit[i]);

      listTempTableValue.add(listElement);
    }

    try {
      // 创建临时表
      String sTempTableName =
          new nc.bs.scm.pub.TempTableDMO()
              .getTempStringTable(
                  nc.vo.scm.pub.TempTableVO.PU_CLMS_PUB01,
                  new String[] {"cbaseid", "cassistunit"},
                  new String[] {"char(20) not null ", "char(20) not null "},
                  null,
                  listTempTableValue);

      // 查询
      Object[][] ob = null;
      ob =
          queryResultsFromAnyTable(
              sTempTableName
                  + " JOIN bd_convert ON "
                  + sTempTableName
                  + ".cbaseid=bd_convert.pk_invbasdoc"
                  + " AND pk_measdoc="
                  + sTempTableName
                  + ".cassistunit",
              new String[] {"pk_invbasdoc", "pk_measdoc", "mainmeasrate", "fixedflag"},
              null);
      if (ob != null) {
        // 是否包含该KEY
        iLen = ob.length;
        for (int i = 0; i < iLen; i++) {
          String sTempKey = (String) ob[i][0] + (String) ob[i][1];
          hInvConvRate.put(
              sTempKey,
              new Object[] {
                ob[i][2] == null ? null : new UFDouble(ob[i][2].toString()),
                new UFBoolean(ob[i][3] == null ? "N" : ob[i][3].toString())
              });
        }
      }
    } catch (Exception e) {
      reportException(e);
      throw e;
    }
    return hInvConvRate;
  }