From 056f5780af7d941a56b9cb94470a46a1d648025a Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Sun, 9 Mar 2025 14:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B8=E9=94=80=E6=9F=A5=E8=AF=A2sql?= =?UTF-8?q?=E6=94=B9=E9=80=A0-=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B8=81?= =?UTF-8?q?=E7=A7=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nc/bs/glrp/verify/VerifyDetailDMO.java | 1425 +++++++++++++++++ 1 file changed, 1425 insertions(+) create mode 100644 gl/src/private/nc/bs/glrp/verify/VerifyDetailDMO.java diff --git a/gl/src/private/nc/bs/glrp/verify/VerifyDetailDMO.java b/gl/src/private/nc/bs/glrp/verify/VerifyDetailDMO.java new file mode 100644 index 0000000..8c3b29a --- /dev/null +++ b/gl/src/private/nc/bs/glrp/verify/VerifyDetailDMO.java @@ -0,0 +1,1425 @@ +/*FmYY54+/u5Lrc2y5OW0w64FpxHWxa+z4LvG8aedSP4g=*/ +package nc.bs.glrp.verify; + +/***************************************************************\ + * The skeleton of this class is generated by an automatic * + * code generator for NC product. * + \***************************************************************/ + +import nc.bs.framework.common.InvocationInfoProxy; +import nc.bs.framework.common.NCLocator; +import nc.bs.logging.Logger; +import nc.bs.pub.DataManageObject; +import nc.bs.pub.SystemException; +import nc.itf.fipub.freevalue.IFreevalueReportQry; +import nc.itf.gl.pub.IFreevaluePub; +import nc.jdbc.framework.JdbcSession; +import nc.jdbc.framework.PersistenceManager; +import nc.vo.bd.accessor.IBDData; +import nc.vo.bd.account.AccountVO; +import nc.vo.fi.pub.SqlUtils; +import nc.vo.fipub.freevalue.Module; +import nc.vo.gateway60.accountbook.AccountBookUtil; +import nc.vo.gateway60.pub.GlBusinessException; +import nc.vo.gl.pubvoucher.DetailVO; +import nc.vo.gl.pubvoucher.VoucherVO; +import nc.vo.gl.verifybegin.IVerifyConst; +import nc.vo.glcom.ass.AssVO; +import nc.vo.glrp.pub.VerifyMsg; +import nc.vo.glrp.verify.FilterCondVO; +import nc.vo.glrp.verify.VerifyDetailVO; +import nc.vo.glrp.verify.VerifyLogVO; +import nc.vo.glrp.verifyobj.VerifyObjHeaderVO; +import nc.vo.glrp.verifyobj.VerifyObjItemVO; +import nc.vo.glrp.verifyobj.VerifyObjVO; +import nc.vo.jcom.lang.StringUtil; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; + +import java.math.BigDecimal; +import java.sql.*; +import java.util.*; + +/** + * VerifyDetail的DMO类。 + *
+ * 创建日期:(2003-5-5) + * + * @author: + */ +public class VerifyDetailDMO extends DataManageObject { + /** + * VerifyDetailDMO 构造子注解。 + * + * @throws javax.naming.NamingException 父类构造子抛出的异常。 + * @throws nc.bs.pub.SystemException 父类构造子抛出的异常。 + */ + public VerifyDetailDMO() throws javax.naming.NamingException, SystemException { + super(); + } + + /** + * VerifyDetailDMO 构造子注解。 + * + * @param dbName java.lang.String 在EJB Server中配置的数据库DataSource名称。 + * @throws javax.naming.NamingException 父类构造子抛出的异常。 + * @throws nc.bs.pub.SystemException 父类构造子抛出的异常。 + */ + public VerifyDetailDMO(String dbName) throws javax.naming.NamingException, SystemException { + super(dbName); + } + + /** + * 功能:处理通配符 作者:宋涛 创建时间:(2003-5-6 9:42:56) 参数:<|> 返回值: 算法: + * + * @param strValue java.lang.String + * @return java.lang.String + */ + protected String dealWildCard(String strValue) { + String sResult = StringUtil.replaceAllString(strValue, "?", "_"); + sResult = StringUtil.replaceAllString(strValue, "*", "%"); + return sResult; + } + + public void dropTempTable(String tableName) throws Exception { + String dropIndexSql = "drop index i_" + tableName; + String dropTableSql = "drop table " + tableName; + + java.sql.Connection con = null; + java.sql.Statement stmt = null; + + try { + con = getConnection(); + if (((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == ((nc.jdbc.framework.crossdb.CrossDBConnection) con).SQLSERVER) + dropIndexSql = "drop index " + tableName + ".i_" + tableName; + else + dropIndexSql = "drop index i_" + tableName; + stmt = con.createStatement(); + stmt.execute(dropIndexSql); + stmt.execute(dropTableSql); + + } catch (Exception e) { + nc.bs.logging.Logger.debug("删除临时表出现错误:" + e.getMessage()); + // throw e; + } finally { + try { + if (stmt != null) + stmt.close(); + } catch (Exception e) { + Logger.error(e.getMessage(), e); + } + try { + if (con != null) { + con.close(); + } + } catch (Exception e) { + Logger.error(e.getMessage(), e); + } + } + } + + /** + * a功能: 作者:宋涛 创建时间:(2003-5-5 16:48:41) 参数:<|> 返回值: 算法: + * + * @param strTabName java.lang.String + * @return java.lang.String + */ + protected String getAlias(String strTabName) { + return strTabName; + } + + public String getds() { + return InvocationInfoProxy.getInstance().getUserDataSource(); + } + + public String createVerifyDetailBalanceTempTable(String verifyLogTmpTable) { + String tableName = null; + java.sql.Connection con = null; + PersistenceManager manager = null; + JdbcSession session = null; + String oid = getOID().substring(11, 20); + try { + con = getConnection(); + manager = PersistenceManager.getInstance(getds()); + session = manager.getJdbcSession(); + tableName = "glTMP_verdtlbal" + oid; + StringBuffer strCreateTableSql = new StringBuffer(); + strCreateTableSql.append("pk_verifydetail char(20),"); + strCreateTableSql.append("pk_detail char(20),"); + if (((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == nc.jdbc.framework.util.DBConsts.ORACLE) { + strCreateTableSql.append("balancecreditquantity number(30,4),"); + strCreateTableSql.append("balancecreditamount number(30,4),"); + strCreateTableSql.append("balancefraccreditamount number(30,4),"); + strCreateTableSql.append("balancelocalcreditamount number(30,4),"); + strCreateTableSql.append("balancedebitquantity number(30,4),"); + strCreateTableSql.append("balancedebitamount number(30,4),"); + strCreateTableSql.append("balancefracdebitamount number(30,4),"); + strCreateTableSql.append("balancelocaldebitamount number(30,4)"); + } else { + strCreateTableSql.append("balancecreditquantity decimal(30,4),"); + strCreateTableSql.append("balancecreditamount decimal(30,4),"); + strCreateTableSql.append("balancefraccreditamount decimal(30,4),"); + strCreateTableSql.append("balancelocalcreditamount decimal(30,4),"); + strCreateTableSql.append("balancedebitquantity decimal(30,4),"); + strCreateTableSql.append("balancedebitamount decimal(30,4),"); + strCreateTableSql.append("balancefracdebitamount decimal(30,4),"); + strCreateTableSql.append("balancelocaldebitamount decimal(30,4)"); + } + + tableName = SqlUtils.createTempTable(tableName, strCreateTableSql.toString(), con); + // 插入记录 + StringBuilder sbSQL = new StringBuilder(); + sbSQL.append(" insert into " + tableName + " ("); + sbSQL.append(" pk_verifydetail, "); + sbSQL.append(" pk_detail, "); + sbSQL.append(" balancecreditquantity, "); + sbSQL.append(" balancecreditamount, "); + sbSQL.append(" balancefraccreditamount, "); + sbSQL.append(" balancelocalcreditamount, "); + sbSQL.append(" balancedebitquantity, "); + sbSQL.append(" balancedebitamount, "); + sbSQL.append(" balancefracdebitamount, "); + sbSQL.append(" balancelocaldebitamount "); + sbSQL.append(" )"); + sbSQL.append(" select b.pk_verifydetail,"); + sbSQL.append(" a.pk_detail,"); + sbSQL.append(" Balancecreditquantity+sum(Verifycreditquantity),"); + sbSQL.append(" Balancecreditamount+sum(Verifycreditamount), "); + sbSQL.append(" Balancefraccreditamount+sum(Verifyfraccreditamount), "); + sbSQL.append(" Balancelocalcreditamount+sum(Verifylocalcreditamount), "); + sbSQL.append(" Balancedebitquantity+sum(Verifydebitquantity), "); + sbSQL.append(" Balancedebitamount+sum(Verifydebitamount), "); + sbSQL.append(" Balancefracdebitamount+sum(Verifyfracdebitamount), "); + sbSQL.append(" Balancelocaldebitamount+sum(Verifylocaldebitamount) "); + sbSQL.append(" FROM gl_verifydetail a,gl_verify_log b, "); + sbSQL.append(verifyLogTmpTable); + sbSQL.append(" WHERE a.pk_verifydetail = b.pk_verifydetail and "); + sbSQL.append(verifyLogTmpTable + ".pk = b.pk_verify_log "); + sbSQL.append(" group by b.pk_verifydetail,a.pk_detail, "); + sbSQL.append(" Balancecreditquantity,Balancecreditamount, "); + sbSQL.append(" Balancefraccreditamount,Balancelocalcreditamount, "); + sbSQL.append(" Balancedebitquantity,Balancedebitamount, "); + sbSQL.append(" Balancefracdebitamount,Balancelocaldebitamount "); + + session.setAddTimeStamp(false); + session.setSQLTranslator(false); + session.executeUpdate(sbSQL.toString()); + + } catch (Exception e) { + nc.bs.logging.Logger.debug("创建临时表出错" + tableName + e.getMessage()); + } finally { + try { + if (con != null) { + con.close(); + } + } catch (Exception e) { + } + try { + if (session != null) + session.closeAll(); + } catch (Exception e) { + } + + try { + if (manager != null) + manager.release(); + } catch (Exception e) { + } + } + return tableName; + } + + /** + * 功能:根据条件拼接查询语句中的条件 作者:宋涛 创建时间:(2003-5-6 8:53:41) 参数:<|> 返回值: 算法: + * + * @param voCond nc.vo.glrp.verify.FilterCondVO + * @param strCond java.lang.String + * @return java.lang.String + */ + private String getConditions(FilterCondVO voCond, String strCond) { + String[] subjArr = null; + // 查询末级节点 + if (voCond.getSubjPk() != null) { + // 查询末级节点 + IBDData[] bdData = nc.vo.gateway60.itfs.AccountUtilGL.getEndDocByPkVersion(voCond.getPk_glorgbook(), voCond.getSubjPk(), new UFDate(voCond.getEndDate()).toStdString()); + if (bdData != null) { + subjArr = new String[bdData.length]; + } + for (int i = 0; i < bdData.length; i++) { + subjArr[i] = bdData[i].getPk(); + } + } else if (voCond.getSubjCode() != null) { + AccountVO[] bdData = nc.vo.gateway60.itfs.AccountUtilGL.getEndSubjByCode(voCond.getPk_glorgbook(), + voCond.getSubjCode(), voCond.getEndDate()); + if (bdData != null) { + subjArr = new String[bdData.length]; + for (int i = 0; i < bdData.length; i++) { + subjArr[i] = bdData[i].getPk_accasoa(); + } + } + } + if (subjArr != null) { + if (subjArr.length > 1) { + try { + strCond += " and " + SqlUtils.getInStr(getAlias("gl_VerifyDetail") + ".pk_accasoa", subjArr, false); + } catch (BusinessException e) { + Logger.error(e.getMessage(), e); + } + } else { + strCond += " and " + getAlias("gl_VerifyDetail") + ".pk_accasoa='" + subjArr[0] + "'"; + } + } + /* 辅助核算 */ + if (voCond.getAssId() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".assid='" + voCond.getAssId() + "'"; + } + /* 日期范围 */ + if (voCond.getBeginDate() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + "." + voCond.getDateType() + ">='" + voCond.getBeginDate() + "'"; + } + if (voCond.getEndDate() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + "." + voCond.getDateType() + "<='" + voCond.getEndDate() + "'"; + } + /* 金额范围 */ + if (voCond.getMnyBegin() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + "." + getMnyField(voCond) + ">=" + voCond.getMnyBegin().toString() + + ""; + } + if (voCond.getMnyEnd() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + "." + getMnyField(voCond) + "<=" + voCond.getMnyEnd().toString() + + ""; + } + /* 币种 */ + if (voCond.getCurPk() != null) { + String curPk = voCond.getCurPk(); + if (curPk.contains(",")) { + String[] curPkArr = curPk.split(",", -1); + String result = String.join("','", curPkArr); + + strCond = strCond + " and " + this.getAlias("gl_VerifyDetail") + ".pk_currtype in ('" + result + "')"; + } else { + strCond = strCond + " and " + this.getAlias("gl_VerifyDetail") + ".pk_currtype='" + voCond.getCurPk() + "'"; + } + } + /* 包含未记账 */ + if (!voCond.hasTally()) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".Pk_manager<>'N/A' "; + } + if (voCond.getPk_glorgbook() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".pk_accountingbook='" + voCond.getPk_glorgbook() + "'"; + } + /* 账簿条件 */ + if (voCond.getPkSob() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".Pk_sob='" + voCond.getPkSob() + "'"; + } + /* 摘要 */ + if (voCond.getDigest() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".explanation like '" + dealWildCard(voCond.getDigest()) + "%'"; + } + /* 核销号 */ + if (voCond.getVerifyNo() != null) { + strCond += " and " + getAlias("gl_VerifyDetail") + ".VerifyNo like '" + dealWildCard(voCond.getVerifyNo()) + "%'"; + } + /* 业务单元 V636 */ + if (voCond.getPk_unit() != null) { + try { + strCond += " and " + SqlUtils.getInStr(getAlias("gl_VerifyDetail") + ".pk_unit", voCond.getPk_unit(), true); + } catch (BusinessException e) { + Logger.error(e.getMessage()); + throw new GlBusinessException(e.getMessage()); + } + } + /* 方向 */ + strCond += " and " + getAlias("gl_VerifyDetail") + ".Orientation = " + voCond.getDirect(); + return strCond; + } + + /** + * 功能:得到金额字段名称 作者:宋涛 创建时间:(2003-5-6 9:16:05) 参数:<|> 返回值: 算法: + * + * @param voCond nc.vo.arap.termendtransact.FilterCondVO + * @return java.lang.String + */ + private String getMnyField(FilterCondVO voCond) { + String sField = "Balance"; + if (voCond.getMnyType().equalsIgnoreCase( + nc.bs.ml.NCLangResOnserver.getInstance().getStrByID("20021201", "UPP20021201-000021")/* @res "本币" */)) { + sField += "local"; + } else if (voCond.getMnyType().equals(VerifyMsg.getDISP_GROUP_AMOUNT())) { + sField += "group"; + } else if (voCond.getMnyType().equals(VerifyMsg.getDISP_GLOBAL_AMOUNT())) { + sField += "global"; + } + if (voCond.getDirect() == IVerifyConst.ORIENT_DEBIT) { + // 借 + sField += "debitamount"; + } else { + sField += "creditamount"; + } + return sField; + } + + /** + * 通过单位编码返回指定公司所有记录VO数组。如果单位编码为空返回所有记录。 + *
+ * 已知问题:请注意生成的sql语句:where子句中假设公司编码字段为pk_corp。 如果你要针对公司进行查询,那么应采用你的实际字段名来手工修改 sql语句。 创建日期:(2003-5-5)
+ *
+ * @param unitCode int
+ * @return nc.vo.glrp.verify.VerifyDetailVO[]
+ * @throws java.sql.SQLException 异常说明。
+ */
+ public VerifyDetailVO[] querybyConds(String strCond) throws SQLException {
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ beforeCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "querybyCond", new Object[]{strCond});
+ /*************************************************************/
+ // FIMXE 应该改为StringBuffer
+ String sql = "";
+ sql = "select " + getAlias("gl_VerifyDetail") + ".Pk_VerifyDetail, " + getAlias("gl_VerifyDetail") + ".Pk_voucher, "
+ + getAlias("gl_VerifyDetail") + ".pk_detail, " + getAlias("gl_VerifyDetail") + ".pk_org, "
+ + getAlias("gl_VerifyDetail") + ".pk_setofbook, " + getAlias("gl_VerifyDetail") + ".InitFlag, "
+ + getAlias("gl_VerifyDetail") + ".pk_vouchertype, " + getAlias("gl_VerifyDetail") + ".VoucherNo, "
+ + getAlias("gl_VerifyDetail") + ".prepareddate, " + getAlias("gl_VerifyDetail") + ".Businessdate, "
+ + getAlias("gl_VerifyDetail") + ".explanation, " + getAlias("gl_VerifyDetail") + ".VerifyNo, "
+ + getAlias("gl_VerifyDetail") + ".pk_prepared, " + getAlias("gl_VerifyDetail") + ".pk_accasoa, "
+ + getAlias("gl_VerifyDetail") + ".pk_currtype, " + getAlias("gl_VerifyDetail") + ".detailindex, "
+ + getAlias("gl_VerifyDetail") + ".assid, " + getAlias("gl_VerifyDetail") + ".price, "
+ + getAlias("gl_VerifyDetail") + ".excrate1, " + getAlias("gl_VerifyDetail") + ".excrate2, "
+ + getAlias("gl_VerifyDetail") + ".orientation, " + getAlias("gl_VerifyDetail") + ".debitquantity, "
+ + getAlias("gl_VerifyDetail") + ".debitamount, " + getAlias("gl_VerifyDetail") + ".fracdebitamount, "
+ + getAlias("gl_VerifyDetail") + ".localdebitamount, " + getAlias("gl_VerifyDetail") + ".creditquantity, "
+ + getAlias("gl_VerifyDetail") + ".creditamount, " + getAlias("gl_VerifyDetail") + ".fraccreditamount, "
+ + getAlias("gl_VerifyDetail") + ".localcreditamount, " + getAlias("gl_VerifyDetail") + ".Balancedebitquantity, "
+ + getAlias("gl_VerifyDetail") + ".Balancedebitamount, " + getAlias("gl_VerifyDetail")
+ + ".Balancefracdebitamount, " + getAlias("gl_VerifyDetail") + ".Balancelocaldebitamount, "
+ + getAlias("gl_VerifyDetail") + ".Balancecreditquantity, " + getAlias("gl_VerifyDetail")
+ + ".Balancecreditamount, " + getAlias("gl_VerifyDetail") + ".Balancefraccreditamount, "
+ + getAlias("gl_VerifyDetail") + ".Balancelocalcreditamount, " + getAlias("gl_VerifyDetail") + ".pk_manager, "
+ + getAlias("gl_VerifyDetail") + ".isverifyflag, " + getAlias("gl_VerifyDetail") + ".freevalue1, "
+ + getAlias("gl_VerifyDetail") + ".freevalue2, " + getAlias("gl_VerifyDetail") + ".freevalue3, "
+ + getAlias("gl_VerifyDetail") + ".freevalue4, " + getAlias("gl_VerifyDetail") + ".freevalue5, "
+ + getAlias("gl_VerifyDetail") + ".freevalue6, " + getAlias("gl_VerifyDetail") + ".freevalue7, "
+ + getAlias("gl_VerifyDetail") + ".freevalue8, " + getAlias("gl_VerifyDetail") + ".freevalue9, "
+ + getAlias("gl_VerifyDetail") + ".freevalue10, " + getAlias("gl_VerifyDetail") + ".freevalue11, "
+ + getAlias("gl_VerifyDetail") + ".freevalue12, " + getAlias("gl_VerifyDetail") + ".freevalue13, "
+ + getAlias("gl_VerifyDetail") + ".freevalue14, " + getAlias("gl_VerifyDetail") + ".freevalue15, "
+ + getAlias("gl_VerifyDetail") + ".freevalue16, " + getAlias("gl_VerifyDetail") + ".freevalue17, "
+ + getAlias("gl_VerifyDetail") + ".freevalue18, " + getAlias("gl_VerifyDetail") + ".freevalue19, "
+ + getAlias("gl_VerifyDetail") + ".freevalue20, " + getAlias("gl_VerifyDetail") + ".ts, "
+ + getAlias("gl_VerifyDetail") + ".dr," + getAlias("gl_VerifyDetail") + ".pk_accountingbook, "
+ + getAlias("gl_VerifyDetail") + ".groupdebitamount, " + getAlias("gl_VerifyDetail") + ".globaldebitamount, "
+ + getAlias("gl_VerifyDetail") + ".groupcreditamount, " + getAlias("gl_VerifyDetail") + ".globalcreditamount, "
+ + getAlias("gl_VerifyDetail") + ".balancegroupdebitamount, " + getAlias("gl_VerifyDetail")
+ + ".balanceglobaldebitamount, " + getAlias("gl_VerifyDetail") + ".balancegroupcreditamount, "
+ + getAlias("gl_VerifyDetail") + ".balanceglobalcreditamount ,"
+ + getAlias("gl_VerifyDetail") + ".netbankflag ," + getAlias("gl_VerifyDetail") + ".pk_unit, "
+ + getAlias("gl_VerifyDetail") + ".pk_unit_v "
+ + " from gl_VerifyDetail "
+ + getAlias("gl_VerifyDetail") + " ";
+ if (strCond != null) {
+ sql += " " + strCond;
+ }
+ nc.bs.logging.Logger.debug(sql);
+ VerifyDetailVO verifyDetails[] = null;
+ Vector v = new Vector();
+ Connection con = null;
+ PreparedStatement stmt = null;
+ try {
+ con = getConnection();
+ stmt = con.prepareStatement(sql);
+ ResultSet rs = stmt.executeQuery();
+ //
+ while (rs.next()) {
+ int index = 0;
+ VerifyDetailVO verifyDetail = new VerifyDetailVO();
+ // Pk_VerifyDetail :
+ String Pk_VerifyDetail = rs.getString(++index);
+ verifyDetail.setPk_VerifyDetail(Pk_VerifyDetail == null ? null : Pk_VerifyDetail.trim());
+ // Pk_voucher :
+ String Pk_voucher = rs.getString(++index);
+ verifyDetail.setPk_voucher(Pk_voucher == null ? null : Pk_voucher.trim());
+ // pk_detail :
+ String pk_detail = rs.getString(++index);
+ verifyDetail.setPk_detail(pk_detail == null ? null : pk_detail.trim());
+ // Pk_corp :
+ String Pk_corp = rs.getString(++index);
+ verifyDetail.setPk_corp(Pk_corp == null ? null : Pk_corp.trim());
+ // pk_sob :
+ String pk_sob = rs.getString(++index);
+ verifyDetail.setPk_sob(pk_sob == null ? null : pk_sob.trim());
+ // InitFlag :
+ String InitFlag = rs.getString(++index);
+ verifyDetail.setInitFlag(InitFlag == null ? null : UFBoolean.valueOf(InitFlag.trim()));
+ // pk_vouchertype :
+ String pk_vouchertype = rs.getString(++index);
+ verifyDetail.setPk_vouchertype(pk_vouchertype == null ? null : pk_vouchertype.trim());
+ // VoucherNo :
+ Integer VoucherNo = (Integer) rs.getObject(++index);
+ verifyDetail.setVoucherNo(VoucherNo == null ? null : VoucherNo);
+ verifyDetail.setDispVouchNO(VoucherNo == null ? null : VoucherNo.toString());
+ // prepareddate :
+ String prepareddate = rs.getString(++index);
+ verifyDetail.setPrepareddate(prepareddate == null || prepareddate.trim().equals("") ? null : new UFDate(new UFDateTime(prepareddate.trim()).getMillis()));
+ // Businessdate :
+ String Businessdate = rs.getString(++index);
+ verifyDetail.setBusinessdate(Businessdate == null || Businessdate.trim().equals("") ? null : new UFDate(new UFDateTime(Businessdate.trim()).getMillis()));
+ // explanation :
+ String explanation = rs.getString(++index);
+ verifyDetail.setExplanation(explanation == null ? null : explanation.trim());
+ // VerifyNo :
+ String VerifyNo = rs.getString(++index);
+ verifyDetail.setVerifyNo(VerifyNo == null ? null : VerifyNo.trim());
+ // pk_prepared :
+ String pk_prepared = rs.getString(++index);
+ verifyDetail.setPk_prepared(pk_prepared == null ? null : pk_prepared.trim());
+ // pk_accsubj :
+ String pk_accsubj = rs.getString(++index);
+ verifyDetail.setPk_accsubj(pk_accsubj == null ? null : pk_accsubj.trim());
+ // pk_currtype :
+ String pk_currtype = rs.getString(++index);
+ verifyDetail.setPk_currtype(pk_currtype == null ? null : pk_currtype.trim());
+ // detailindex :
+ Integer detailindex = (Integer) rs.getObject(++index);
+ verifyDetail.setDetailindex(detailindex == null ? null : detailindex);
+ // assid :
+ String assid = rs.getString(++index);
+ verifyDetail.setAssid(assid == null ? null : assid.trim());
+ // price :
+ BigDecimal price = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setPrice(price == null ? null : new UFDouble(price));
+ // excrate1 :
+ BigDecimal excrate1 = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setExchangeRate_B(excrate1 == null ? null : new UFDouble(excrate1));
+ // excrate2 :
+ BigDecimal excrate2 = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setExchangeRate_F(excrate2 == null ? null : new UFDouble(excrate2));
+ // orientation :
+ Integer orientation = (Integer) rs.getObject(++index);
+ verifyDetail.setOrientation(orientation == null ? null : orientation);
+ // debitquantity :
+ BigDecimal debitquantity = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setDebitquantity(debitquantity == null ? null : new UFDouble(debitquantity));
+ // debitamount :
+ BigDecimal debitamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setDebitamount(debitamount == null ? null : new UFDouble(debitamount));
+ // fracdebitamount :
+ BigDecimal fracdebitamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setFracdebitamount(fracdebitamount == null ? null : new UFDouble(fracdebitamount));
+ // localdebitamount :
+ BigDecimal localdebitamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setLocaldebitamount(localdebitamount == null ? null : new UFDouble(localdebitamount));
+ // creditquantity :
+ BigDecimal creditquantity = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setCreditquantity(creditquantity == null ? null : new UFDouble(creditquantity));
+ // creditamount :
+ BigDecimal creditamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setCreditamount(creditamount == null ? null : new UFDouble(creditamount));
+ // fraccreditamount :
+ BigDecimal fraccreditamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setFraccreditamount(fraccreditamount == null ? null : new UFDouble(fraccreditamount));
+ // localcreditamount :
+ BigDecimal localcreditamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setLocalcreditamount(localcreditamount == null ? null : new UFDouble(localcreditamount));
+ // Balancedebitquantity :
+ BigDecimal Balancedebitquantity = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancedebitquantity(Balancedebitquantity == null ? null : new UFDouble(Balancedebitquantity));
+ // Balancedebitamount :
+ BigDecimal Balancedebitamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancedebitamount(Balancedebitamount == null ? null : new UFDouble(Balancedebitamount));
+ // Balancefracdebitamount :
+ BigDecimal Balancefracdebitamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancefracdebitamount(Balancefracdebitamount == null ? null : new UFDouble(
+ Balancefracdebitamount));
+ // Balancelocaldebitamount :
+ BigDecimal Balancelocaldebitamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancelocaldebitamount(Balancelocaldebitamount == null ? null : new UFDouble(
+ Balancelocaldebitamount));
+ // Balancecreditquantity :
+ BigDecimal Balancecreditquantity = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancecreditquantity(Balancecreditquantity == null ? null : new UFDouble(Balancecreditquantity));
+ // Balancecreditamount :
+ BigDecimal Balancecreditamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancecreditamount(Balancecreditamount == null ? null : new UFDouble(Balancecreditamount));
+ // Balancefraccreditamount :
+ BigDecimal Balancefraccreditamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancefraccreditamount(Balancefraccreditamount == null ? null : new UFDouble(
+ Balancefraccreditamount));
+ // Balancelocalcreditamount :
+ BigDecimal Balancelocalcreditamount = (BigDecimal) rs.getObject(++index);
+ verifyDetail.setBalancelocalcreditamount(Balancelocalcreditamount == null ? null : new UFDouble(
+ Balancelocalcreditamount));
+ // pk_manager :
+ String pk_manager = rs.getString(++index);
+ verifyDetail.setPk_manager(pk_manager == null || pk_manager.trim().equals("N/A") ? null : pk_manager.trim());
+ // isverifyflag :
+ String isverifyflag = rs.getString(++index);
+ verifyDetail.setIsverifyflag(isverifyflag == null ? null : UFBoolean.valueOf(isverifyflag.trim()));
+ // freevalue1 :
+ String freevalue1 = rs.getString(++index);
+ verifyDetail.setFreevalue1(freevalue1 == null ? null : freevalue1.trim());
+ // freevalue2 :
+ String freevalue2 = rs.getString(++index);
+ verifyDetail.setFreevalue2(freevalue2 == null ? null : freevalue2.trim());
+ // freevalue3 :
+ String freevalue3 = rs.getString(++index);
+ verifyDetail.setFreevalue3(freevalue3 == null ? null : freevalue3.trim());
+ // freevalue4 :
+ String freevalue4 = rs.getString(++index);
+ verifyDetail.setFreevalue4(freevalue4 == null ? null : freevalue4.trim());
+ // freevalue5 :
+ String freevalue5 = rs.getString(++index);
+ verifyDetail.setFreevalue5(freevalue5 == null ? null : freevalue5.trim());
+ // freevalue6 :
+ String freevalue6 = rs.getString(++index);
+ verifyDetail.setFreevalue6(freevalue6 == null ? null : freevalue6.trim());
+ // freevalue7 :
+ String freevalue7 = rs.getString(++index);
+ verifyDetail.setFreevalue7(freevalue7 == null ? null : freevalue7.trim());
+ // freevalue8 :
+ String freevalue8 = rs.getString(++index);
+ verifyDetail.setFreevalue8(freevalue8 == null ? null : freevalue8.trim());
+ // freevalue9 :
+ String freevalue9 = rs.getString(++index);
+ verifyDetail.setFreevalue9(freevalue9 == null ? null : freevalue9.trim());
+ // freevalue10 :
+ String freevalue10 = rs.getString(++index);
+ verifyDetail.setFreevalue10(freevalue10 == null ? null : freevalue10.trim());
+ // freevalue11 :
+ String freevalue11 = rs.getString(++index);
+ verifyDetail.setFreevalue11(freevalue11 == null ? null : freevalue11.trim());
+ // freevalue12 :
+ String freevalue12 = rs.getString(++index);
+ verifyDetail.setFreevalue12(freevalue12 == null ? null : freevalue12.trim());
+ // freevalue13 :
+ String freevalue13 = rs.getString(++index);
+ verifyDetail.setFreevalue13(freevalue13 == null ? null : freevalue13.trim());
+ // freevalue14 :
+ String freevalue14 = rs.getString(++index);
+ verifyDetail.setFreevalue14(freevalue14 == null ? null : freevalue14.trim());
+ // freevalue15 :
+ String freevalue15 = rs.getString(++index);
+ verifyDetail.setFreevalue15(freevalue15 == null ? null : freevalue15.trim());
+ // freevalue16 :
+ String freevalue16 = rs.getString(++index);
+ verifyDetail.setFreevalue16(freevalue16 == null ? null : freevalue16.trim());
+ // freevalue17 :
+ String freevalue17 = rs.getString(++index);
+ verifyDetail.setFreevalue17(freevalue17 == null ? null : freevalue17.trim());
+ // freevalue18 :
+ String freevalue18 = rs.getString(++index);
+ verifyDetail.setFreevalue18(freevalue18 == null ? null : freevalue18.trim());
+ // freevalue19 :
+ String freevalue19 = rs.getString(++index);
+ verifyDetail.setFreevalue19(freevalue19 == null ? null : freevalue19.trim());
+ // freevalue20 :
+ String freevalue20 = rs.getString(++index);
+ verifyDetail.setFreevalue20(freevalue20 == null ? null : freevalue20.trim());
+ // ts :
+ String ts = rs.getString(++index);
+ verifyDetail.setTs(ts == null ? null : new UFDateTime(ts.trim()));
+ // dr :
+ Integer dr = (Integer) rs.getObject(++index);
+ verifyDetail.setDr(dr == null ? null : dr);
+ // pk_glorgbook
+ String pk_glorgbook = rs.getString(++index);
+ verifyDetail.setPk_glorgbook(pk_glorgbook == null ? null : pk_glorgbook.trim());
+ // groupdebitamount :
+ BigDecimal groupdebitamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setGroupdebitamount(groupdebitamount == null ? null : new UFDouble(groupdebitamount));
+ // globaldebitamount :
+ BigDecimal globaldebitamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setGlobaldebitamount(globaldebitamount == null ? null : new UFDouble(globaldebitamount));
+ // groupcreditamount :
+ BigDecimal groupcreditamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setGroupcreditamount(groupcreditamount == null ? null : new UFDouble(groupcreditamount));
+ // globalcreditamount :
+ BigDecimal globalcreditamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setGlobalcreditamount(globalcreditamount == null ? null : new UFDouble(globalcreditamount));
+ // balancegroupdebitamount :
+ BigDecimal balancegroupdebitamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setBalancegroupdebitamount(balancegroupdebitamount == null ? null : new UFDouble(
+ // balancegroupdebitamount));
+ // balanceglobaldebitamount :
+ BigDecimal balanceglobaldebitamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setBalanceglobaldebitamount(balanceglobaldebitamount == null ? null : new UFDouble(
+ // balanceglobaldebitamount));
+ // balancegroupcreditamount :
+ BigDecimal balancegroupcreditamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setBalancegroupcreditamount(balancegroupcreditamount == null ? null : new UFDouble(
+ // balancegroupcreditamount));
+ // balanceglobalcreditamount :
+ BigDecimal balanceglobalcreditamount = (BigDecimal) rs.getObject(++index);
+ // verifyDetail.setBalanceglobalcreditamount(balanceglobalcreditamount == null ? null : new UFDouble(
+ // balanceglobalcreditamount));
+ String netbankflag = rs.getString(++index);
+ verifyDetail.setNetbankflag(netbankflag == null ? null : netbankflag.trim());
+ String pk_unit = rs.getString(++index);
+ verifyDetail.setPk_unit(pk_unit == null ? null : pk_unit.trim());
+ String pk_unit_v = rs.getString(++index);
+ verifyDetail.setPk_unit_v(pk_unit_v == null ? null : pk_unit_v.trim());
+ v.addElement(verifyDetail);
+ }
+ } finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (con != null) {
+ con.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+ verifyDetails = new VerifyDetailVO[v.size()];
+ if (v.size() > 0) {
+ v.copyInto(verifyDetails);
+ }
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ afterCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "querybyCond", new Object[]{strCond});
+ /*************************************************************/
+
+ return verifyDetails;
+ }
+
+ /**
+ * 功能:查询结果返回 作者:宋涛 创建时间:(2003-5-5 16:40:42) 参数:<|> 返回值: 算法:
+ *
+ * @param voCond nc.vo.glrp.com.verify.IConditionVO
+ * @return nc.vo.glrp.com.verify.IVerifyVO[]
+ * @throws java.sql.SQLException 异常说明。
+ */
+ public VerifyDetailVO[] queryDetailData(nc.vo.glrp.verify.FilterCondVO voCond, boolean bDebit, Hashtable hash01)
+ throws java.sql.SQLException {
+ if (voCond == null) {
+ return null;
+ }
+ try {
+ VerifyDetailVO[] voResult = null;
+ String[] sqls = null;
+ String sCond = " where " + getAlias("gl_VerifyDetail") + ".dr=0 ";
+ /* 区分期初未达和本期凭证 */
+ if (voCond.getObjBeginDate() != null && voCond.getObjBeginDate().length() > 0) {
+ sCond += "and (" + getAlias("gl_VerifyDetail") + ".initflag='Y' or (" + getAlias("gl_VerifyDetail")
+ + ".prepareddate>='" + voCond.getObjBeginDate() + "' and " + getAlias("gl_VerifyDetail")
+ + ".initflag='N'" + ")) ";
+ }
+ if (voCond.getLogonDate() != null) {
+ sCond += "and " + getAlias("gl_VerifyDetail") + ".prepareddate<='" + voCond.getLogonDate() + "' ";
+ }
+ if (bDebit) {
+ // 核销只按组织本币处理,过滤数据时,不考虑集团本币、全局本币 hurh 2011-04-25
+ sCond += "and (" + getAlias("gl_VerifyDetail") + ".Balancedebitamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancelocaldebitamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancedebitamount>0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancelocaldebitamount>0.0001 "
+ + ") ";
+ } else {
+ sCond += "and ("
+ + getAlias("gl_VerifyDetail")
+ + ".Balancecreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail")
+ + ".Balancefraccreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail")
+ + ".Balancelocalcreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancecreditamount>0.0001 or " + getAlias("gl_VerifyDetail")
+ + ".Balancefraccreditamount>0.0001 or " + getAlias("gl_VerifyDetail")
+ + ".Balancelocalcreditamount>0.0001 "
+ + ") ";
+ }
+ if (voCond.getVoucherDetailPk() != null) {
+ sCond += " and " + getAlias("gl_VerifyDetail") + ".pk_detail='" + voCond.getVoucherDetailPk() + "'";
+ voResult = querybyConds(sCond);
+ } else {
+ sCond = getConditions(voCond, sCond);
+ AssVO[] assvos = voCond.getAssvos();
+ if (assvos != null) {
+ nc.bs.glverifycom.GlVerifyDetailDMO dmo = new nc.bs.glverifycom.GlVerifyDetailDMO();
+
+ if (hash01.get("0001") == null) {
+ sqls = NCLocator.getInstance().lookup(IFreevalueReportQry.class).formSqlByAssvos(assvos, null, Module.GL);
+ hash01.put("0001", sqls);
+ } else {
+ sqls = (String[]) hash01.get("0001");
+ }
+
+ sCond = " inner join " + sqls[0] + " on " + sqls[2] + ".assid = " + getAlias("gl_VerifyDetail") + ".assid "
+ + sCond;
+ sCond += " and " + sqls[1];
+ }
+ voResult = querybyConds(sCond);
+ }
+ return voResult;
+ } catch (Exception e) {
+ Logger.error(e.getMessage(), e);
+ throw new SQLException(e.getMessage());
+ }
+ }
+
+ /**
+ * 功能:查询结果返回 作者:宋涛 创建时间:(2003-5-5 16:40:42) 参数:<|> 返回值: 算法:
+ *
+ * @param voCond nc.vo.glrp.com.verify.IConditionVO
+ * @return nc.vo.glrp.com.verify.IVerifyVO[]
+ * @throws java.sql.SQLException 异常说明。
+ */
+ public VerifyDetailVO[] queryRtDetailData(nc.vo.glrp.verify.FilterCondVO voCond, boolean bDebit, Hashtable hash01)
+ throws java.sql.SQLException {
+ if (voCond == null) {
+ return null;
+ }
+ try {
+ VerifyDetailVO[] voResult = null;
+ String[] sqls = null;
+ String sCond = " where " + getAlias("gl_VerifyDetail") + ".dr=0 ";
+ /* 区分期初未达和本期凭证 */
+ if (voCond.getObjBeginDate() != null && voCond.getObjBeginDate().length() > 0) {
+ sCond += "and (" + getAlias("gl_VerifyDetail") + ".initflag='Y' or (" + getAlias("gl_VerifyDetail")
+ + ".prepareddate>='" + voCond.getObjBeginDate() + "' and " + getAlias("gl_VerifyDetail")
+ + ".initflag='N'" + ")) ";
+ }
+ if (voCond.getLogonDate() != null) {
+ sCond += "and " + getAlias("gl_VerifyDetail") + ".prepareddate<='" + voCond.getLogonDate() + "' ";
+ }
+ if (bDebit) {
+ // 核销只按组织本币处理,过滤数据时,不考虑集团本币、全局本币 hurh 2011-04-25
+ sCond += "and (" + getAlias("gl_VerifyDetail") + ".Balancedebitamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancelocaldebitamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancedebitamount>0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancelocaldebitamount>0.0001 "
+ + ") ";
+ } else {
+ sCond += "and ("
+ + getAlias("gl_VerifyDetail")
+ + ".Balancecreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail")
+ + ".Balancefraccreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail")
+ + ".Balancelocalcreditamount<-0.0001 or "
+ + getAlias("gl_VerifyDetail") + ".Balancecreditamount>0.0001 or " + getAlias("gl_VerifyDetail")
+ + ".Balancefraccreditamount>0.0001 or " + getAlias("gl_VerifyDetail")
+ + ".Balancelocalcreditamount>0.0001 "
+ + ") ";
+ }
+ if (voCond.getVoucherDetailPk() != null) {
+ sCond += " and " + getAlias("gl_VerifyDetail") + ".pk_detail='" + voCond.getVoucherDetailPk() + "'";
+ voResult = querybyConds(sCond);
+ } else {
+ sCond = getConditions(voCond, sCond);
+ AssVO[] assvos = voCond.getAssvos();
+ VerifyObjVO m_verifyObj = voCond.getM_verifyObj();
+ Set
+ * 创建日期:(2003-5-5)
+ *
+ * @param verifyDetail nc.vo.glrp.verify.VerifyDetailVO
+ * @throws java.sql.SQLException 异常说明。
+ */
+ public int updateDetail(VerifyLogVO log, boolean bSub) throws java.sql.SQLException {
+ int iResult = 0;
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ beforeCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "updateDetail", new Object[]{log, UFBoolean.valueOf(bSub)});
+ /*************************************************************/
+ String sSign = bSub ? "-" : "+";
+ String strSql = "update gl_VerifyDetail set ";
+ String strSet = "";
+
+ String sWhere = " where Pk_VerifyDetail = ? and dr=0 ";
+ if (bSub && log.getData() != null) {
+ sWhere += "and ts ='" + ((VerifyDetailVO) log.getData()).getTs().toString() + "'";
+ }
+ if (log.getVerifycreditquantity() != null && !log.getVerifycreditquantity().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancecreditquantity =Balancecreditquantity " + sSign + "(" + log.getVerifycreditquantity() + "),";
+ }
+ if (log.getVerifycreditamount() != null && !log.getVerifycreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancecreditamount =Balancecreditamount " + sSign + "(" + log.getVerifycreditamount() + "),";
+ }
+ if (log.getVerifyfraccreditamount() != null && !log.getVerifyfraccreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancefraccreditamount =Balancefraccreditamount " + sSign + "(" + log.getVerifyfraccreditamount() + "),";
+ }
+ if (log.getVerifylocalcreditamount() != null && !log.getVerifylocalcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancelocalcreditamount =Balancelocalcreditamount " + sSign + "(" + log.getVerifylocalcreditamount()
+ + "),";
+ }
+ if (log.getVerifygroupcreditamount() != null && !log.getVerifygroupcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancegroupcreditamount =Balancegroupcreditamount " + sSign + "(" + log.getVerifygroupcreditamount()
+ + "),";
+ }
+ if (log.getVerifyglobalcreditamount() != null && !log.getVerifyglobalcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balanceglobalcreditamount =Balanceglobalcreditamount " + sSign + "(" + log.getVerifyglobalcreditamount()
+ + "),";
+ }
+ if (log.getVerifydebitquantity() != null && !log.getVerifydebitquantity().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancedebitquantity =Balancedebitquantity " + sSign + "(" + log.getVerifydebitquantity() + "),";
+ }
+ if (log.getVerifydebitamount() != null && !log.getVerifydebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancedebitamount =Balancedebitamount " + sSign + "(" + log.getVerifydebitamount() + "),";
+ }
+ if (log.getVerifyfracdebitamount() != null && !log.getVerifyfracdebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancefracdebitamount =Balancefracdebitamount " + sSign + "(" + log.getVerifyfracdebitamount() + "),";
+ }
+ if (log.getVerifylocaldebitamount() != null && !log.getVerifylocaldebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancelocaldebitamount =Balancelocaldebitamount " + sSign + "(" + log.getVerifylocaldebitamount() + "),";
+ }
+ if (log.getVerifygroupdebitamount() != null && !log.getVerifygroupdebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancegroupdebitamount =Balancegroupdebitamount " + sSign + "(" + log.getVerifygroupdebitamount() + "),";
+ }
+ if (log.getVerifyglobaldebitamount() != null && !log.getVerifyglobaldebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balanceglobaldebitamount =Balanceglobaldebitamount " + sSign + "(" + log.getVerifyglobaldebitamount()
+ + "),";
+ }
+ if (strSet.length() <= 0)
+ return 1;
+ strSql += strSet.substring(0, strSet.length() - 1) + sWhere;
+ Connection con = null;
+ PreparedStatement stmt = null;
+ try {
+ con = getConnection();
+ stmt = con.prepareStatement(strSql);
+ stmt.setString(1, log.getPk_VerifyDetail());
+ iResult = stmt.executeUpdate();
+ } finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (con != null) {
+ con.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ afterCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "updateDetail", new Object[]{log, UFBoolean.valueOf(bSub)});
+ /*************************************************************/
+ return iResult;
+ }
+
+ /**
+ * 用一个VO数组中元素的属性批量更新数据库中的值。
+ *
+ * 创建日期:(2003-5-5)
+ *
+ * @param verifyDetail nc.vo.glrp.verify.VerifyDetailVO
+ * @throws java.sql.SQLException 异常说明。
+ */
+ public int[] updateDetails(VerifyLogVO[] logs, boolean bSub) throws java.sql.SQLException {
+ int[] iResult = new int[logs.length];
+ ;
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ beforeCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "updateDetail", new Object[]{logs, UFBoolean.valueOf(bSub)});
+ /*************************************************************/
+ String[] sql = new String[logs.length];
+ Connection con = null;
+ Statement stmt = null;
+ try {
+ con = getConnection();
+ stmt = con.createStatement();
+ String sSign = bSub ? "-" : "+";
+ String strSql = "update gl_VerifyDetail set ";
+ for (int i = 0; i < logs.length; i++) {
+ String strSet = "";
+ String sWhere = " where Pk_VerifyDetail = '" + logs[i].getPk_VerifyDetail() + "' and dr=0 ";
+ if (bSub && logs[i].getData() != null) {
+ sWhere += "and ts ='" + ((VerifyDetailVO) logs[i].getData()).getTs().toString() + "'";
+ }
+ if (logs[i].getVerifycreditquantity() != null && !logs[i].getVerifycreditquantity().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancecreditquantity =Balancecreditquantity " + sSign + "(" + logs[i].getVerifycreditquantity() + "),";
+ }
+ if (logs[i].getVerifycreditamount() != null && !logs[i].getVerifycreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancecreditamount =Balancecreditamount " + sSign + "(" + logs[i].getVerifycreditamount() + "),";
+ }
+ if (logs[i].getVerifyfraccreditamount() != null && !logs[i].getVerifyfraccreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancefraccreditamount =Balancefraccreditamount " + sSign + "(" + logs[i].getVerifyfraccreditamount() + "),";
+ }
+ if (logs[i].getVerifylocalcreditamount() != null && !logs[i].getVerifylocalcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancelocalcreditamount =Balancelocalcreditamount " + sSign + "(" + logs[i].getVerifylocalcreditamount() + "),";
+ }
+ if (logs[i].getVerifygroupcreditamount() != null && !logs[i].getVerifygroupcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancegroupcreditamount =Balancegroupcreditamount " + sSign + "(" + logs[i].getVerifygroupcreditamount() + "),";
+ }
+ if (logs[i].getVerifyglobalcreditamount() != null && !logs[i].getVerifyglobalcreditamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balanceglobalcreditamount =Balanceglobalcreditamount " + sSign + "(" + logs[i].getVerifyglobalcreditamount() + "),";
+ }
+ if (logs[i].getVerifydebitquantity() != null && !logs[i].getVerifydebitquantity().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancedebitquantity =Balancedebitquantity " + sSign + "(" + logs[i].getVerifydebitquantity() + "),";
+ }
+ if (logs[i].getVerifydebitamount() != null && !logs[i].getVerifydebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancedebitamount =Balancedebitamount " + sSign + "(" + logs[i].getVerifydebitamount() + "),";
+ }
+ if (logs[i].getVerifyfracdebitamount() != null && !logs[i].getVerifyfracdebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancefracdebitamount =Balancefracdebitamount " + sSign + "(" + logs[i].getVerifyfracdebitamount() + "),";
+ }
+ if (logs[i].getVerifylocaldebitamount() != null && !logs[i].getVerifylocaldebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancelocaldebitamount =Balancelocaldebitamount " + sSign + "(" + logs[i].getVerifylocaldebitamount() + "),";
+ }
+ if (logs[i].getVerifygroupdebitamount() != null && !logs[i].getVerifygroupdebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balancegroupdebitamount =Balancegroupdebitamount " + sSign + "(" + logs[i].getVerifygroupdebitamount() + "),";
+ }
+ if (logs[i].getVerifyglobaldebitamount() != null && !logs[i].getVerifyglobaldebitamount().equals(VerifyMsg.ZERO)) {
+ strSet += "Balanceglobaldebitamount =Balanceglobaldebitamount " + sSign + "(" + logs[i].getVerifyglobaldebitamount() + "),";
+ }
+ if (strSet.length() <= 0)
+ continue;
+ sql[i] = strSql + strSet.substring(0, strSet.length() - 1) + sWhere;
+ stmt.addBatch(sql[i]);
+ }
+ iResult = stmt.executeBatch();
+ } finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (con != null) {
+ con.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ /*************************************************************/
+ // 保留的系统管理接口:
+ afterCallMethod("nc.bs.glrp.verify.VerifyDetailDMO", "updateDetail", new Object[]{logs, UFBoolean.valueOf(bSub)});
+ /*************************************************************/
+ return iResult;
+ }
+
+ public void deleteDetailVOs(String verifyDetailBalanceTmpTable) throws java.sql.SQLException {
+
+ String sql = "delete from gl_verifydetail where gl_verifydetail.pk_verifydetail in (select pk_verifydetail from "
+ + verifyDetailBalanceTmpTable + ") and initflag = 'N'";
+
+ Connection con = null;
+ PreparedStatement stmt = null;
+ try {
+ con = getConnection();
+ stmt = con.prepareStatement(sql);
+
+ stmt.executeUpdate();
+ } finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (con != null) {
+ con.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ }
+
+ public int updateBatch(String tmpTableVerifyDetailBalance, String pk_accountingbook) throws SQLException {
+ int iResult = 0;
+ Connection con = null;
+ PreparedStatement stmt = null;
+ con = getConnection();
+ // 处理期初核销记录,更新余额
+ StringBuilder sbUpdateSQL = new StringBuilder();
+ if (((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == nc.jdbc.framework.util.DBConsts.ORACLE) {
+ sbUpdateSQL.append(" update gl_verifydetail a ");
+ sbUpdateSQL.append(" SET (Balancecreditquantity,Balancecreditamount,");
+ sbUpdateSQL.append(" Balancefraccreditamount,Balancelocalcreditamount,");
+ sbUpdateSQL.append(" Balancedebitquantity,Balancedebitamount,");
+ sbUpdateSQL.append(" Balancefracdebitamount,Balancelocaldebitamount) = ");
+ sbUpdateSQL.append(" (select Balancecreditquantity,Balancecreditamount, ");
+ sbUpdateSQL.append(" Balancefraccreditamount, Balancelocalcreditamount, ");
+ sbUpdateSQL.append(" Balancedebitquantity, Balancedebitamount, ");
+ sbUpdateSQL.append(" Balancefracdebitamount, Balancelocaldebitamount ");
+ sbUpdateSQL.append(" FROM ");
+ sbUpdateSQL.append(tmpTableVerifyDetailBalance + " b ");
+ sbUpdateSQL.append(" WHERE a.pk_verifydetail = b.pk_verifydetail ");
+ sbUpdateSQL.append(" and a.initflag = 'Y' ");
+ sbUpdateSQL.append(" ) ");
+ sbUpdateSQL.append(" WHERE EXISTS ( ");
+ sbUpdateSQL.append(" SELECT 1 ");
+ sbUpdateSQL.append(" FROM ");
+ sbUpdateSQL.append(tmpTableVerifyDetailBalance + " b ");
+ sbUpdateSQL.append(" WHERE a.pk_verifydetail = b.pk_verifydetail ");
+ sbUpdateSQL.append(" ) and a.initflag = 'Y'");
+ } else {
+ sbUpdateSQL.append(" update a ");
+ sbUpdateSQL
+ .append(" SET a.Balancecreditquantity = b.Balancecreditquantity,a.Balancecreditamount = b.Balancecreditamount,");
+ sbUpdateSQL
+ .append(" a.Balancefraccreditamount = b.Balancefraccreditamount,a.Balancelocalcreditamount = b.Balancelocalcreditamount,");
+ sbUpdateSQL.append(" a.Balancedebitquantity = b.Balancedebitquantity,a.Balancedebitamount = b.Balancedebitamount,");
+ sbUpdateSQL
+ .append(" a.Balancefracdebitamount = b.Balancefracdebitamount,a.Balancelocaldebitamount = b.Balancelocaldebitamount ");
+ sbUpdateSQL.append(" FROM gl_verifydetail a,");
+ sbUpdateSQL.append(tmpTableVerifyDetailBalance + " b ");
+ sbUpdateSQL.append(" WHERE a.pk_verifydetail = b.pk_verifydetail ");
+ sbUpdateSQL.append(" and a.initflag = 'Y' ");
+
+ }
+// String businessdate = null;
+// try {
+// businessdate = GLParaAccessor.getVerifyDate(pk_accountingbook);
+// } catch (BusinessException e1) {
+// Logger.error(e1.getMessage(), e1);
+// }
+// if (businessdate.equalsIgnoreCase(GLParaValueConst.GL080_VOUCHERDATE)) {
+// businessdate = "prepareddate";
+// } else {
+// businessdate = "verifydate";
+// }
+ // 正常凭证直接从voucher,detail表中重新生成
+ StringBuilder sbSQL = new StringBuilder();
+ sbSQL.append(" insert into gl_verifydetail (ASSID, BUSINESSDATE, ");
+ sbSQL.append(" CREDITAMOUNT, CREDITQUANTITY, DEBITAMOUNT, DEBITQUANTITY, ");
+ sbSQL.append(" DETAILINDEX, DR, EXCRATE1, EXCRATE2, EXPLANATION, ");
+ sbSQL.append(" FRACCREDITAMOUNT, FRACDEBITAMOUNT, INITFLAG, ");
+ sbSQL.append(" LOCALCREDITAMOUNT, LOCALDEBITAMOUNT, ");
+ // , PK_SOB
+ sbSQL.append(" PK_ACCASOA, pk_org, PK_CURRTYPE, PK_DETAIL, PK_MANAGER, PK_PREPARED,");
+ sbSQL.append(" PK_VERIFYDETAIL, ");
+ sbSQL.append(" PK_VOUCHER, PK_VOUCHERTYPE, PREPAREDDATE, PRICE, VERIFYNO, VOUCHERNO, ");
+ sbSQL.append(" FREEVALUE20 ,");
+ sbSQL.append(" ORIENTATION,");
+ sbSQL.append(" BALANCECREDITAMOUNT, BALANCECREDITQUANTITY, ");
+ sbSQL.append(" BALANCEDEBITAMOUNT, BALANCEDEBITQUANTITY, ");
+ sbSQL.append(" BALANCEFRACCREDITAMOUNT,BALANCEFRACDEBITAMOUNT, ");
+ sbSQL.append(" BALANCELOCALCREDITAMOUNT, BALANCELOCALDEBITAMOUNT,pk_accountingbook,netbankflag,ts,pk_unit,pk_unit_v)");
+ sbSQL.append(" select ASSID,");
+// if(businessdate.equalsIgnoreCase(GLParaValueConst.GL080_VOUCHERDATE)){
+// sbSQL.append(" prepareddate ");
+// }else{
+// sbSQL.append(" (case when verifydate is null or verifydate='~' then prepareddate else verifydate end) businessdate");
+// }
+ sbSQL.append(" (case when verifydate is null or verifydate='~' then prepareddate else verifydate end) businessdate");
+ sbSQL.append(",");
+ sbSQL.append(" CREDITAMOUNT, CREDITQUANTITY, DEBITAMOUNT, DEBITQUANTITY, ");
+ sbSQL.append(" DETAILINDEX, gl_detail.DR, EXCRATE1, EXCRATE2, gl_detail.EXPLANATION, ");
+ sbSQL.append(" FRACCREDITAMOUNT, FRACDEBITAMOUNT, 'N',");
+ sbSQL.append(" LOCALCREDITAMOUNT, LOCALDEBITAMOUNT, ");
+ sbSQL.append(" PK_ACCASOA, gl_voucher.PK_org, PK_CURRTYPE, gl_detail.PK_DETAIL, PK_MANAGER, PK_PREPARED, ");
+ sbSQL.append(tmpTableVerifyDetailBalance + ".pk_verifydetail, ");
+ sbSQL.append(" gl_voucher.PK_VOUCHER,gl_voucher.PK_VOUCHERTYPE, PREPAREDDATE, PRICE ,gl_detail.verifyno,gl_voucher.num ,");
+ sbSQL.append(" case LOCALDEBITAMOUNT when 0 then 'importmxcredit' else 'importmxdebit' end, ");
+ sbSQL.append(" case LOCALDEBITAMOUNT when 0 then -1 else 1 end, ");
+ sbSQL.append(" balancecreditamount, balancecreditquantity, ");
+ sbSQL.append(" balancedebitamount, balancedebitquantity, ");
+ sbSQL.append(" balancefraccreditamount,balancefracdebitamount, ");
+ sbSQL.append(" balancelocalcreditamount, balancelocaldebitamount,");
+ sbSQL.append(" gl_voucher.pk_accountingbook,gl_detail.netbankflag,");
+ if (((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == nc.jdbc.framework.util.DBConsts.ORACLE
+ || ((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == nc.jdbc.framework.util.DBConsts.DB2
+ || ((nc.jdbc.framework.crossdb.CrossDBConnection) con).getDatabaseType() == nc.jdbc.framework.util.DBConsts.POSTGRESQL) {
+ sbSQL.append("to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'), ");
+ } else {
+ sbSQL.append("convert(char(19),getdate(),20), ");
+ }
+ sbSQL.append(" gl_detail.pk_unit, ");
+ sbSQL.append(" gl_detail.pk_unit_v ");
+ sbSQL.append(" from gl_voucher,gl_detail," + tmpTableVerifyDetailBalance);
+ sbSQL.append(" where gl_detail.pk_voucher = gl_voucher.pk_voucher ");
+ sbSQL.append(" and gl_voucher.voucherkind <> 2 ");
+ sbSQL
+ .append(" and (gl_voucher.errmessage is null or gl_voucher.errmessage<> '"
+ + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("private20111017_0", "02002001-0036")/* @res "暂存" */
+ + "')");
+ sbSQL.append(" and gl_voucher.discardflag='N' ");
+ sbSQL.append(" and " + tmpTableVerifyDetailBalance + ".pk_detail = gl_detail.pk_detail");
+
+ try {
+ con = getConnection();
+ stmt = con.prepareStatement(sbUpdateSQL.toString());
+ iResult = stmt.executeUpdate();
+ stmt.close();
+ stmt = con.prepareStatement(sbSQL.toString());
+ iResult = stmt.executeUpdate();
+ } finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ }
+ } catch (Exception e) {
+ }
+ try {
+ if (con != null) {
+ con.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ return iResult;
+ }
+
+
+ public boolean isHasBalance(String pk_glorgbook, String year) throws SQLException {
+ String sql = "";
+ if (pk_glorgbook != null) {
+ sql += "select count(*) from gl_verifydetail where substring(prepareddate,1,4)='" + year + "' and pk_glorgbook='"
+ + pk_glorgbook + "' and dr=0 and (balancelocaldebitamount<>0 or balancelocalcreditamount<>0)";
+ } else {
+ sql += "select count(*) from gl_verifydetail where substring(prepareddate,1,4)='" + year
+ + "' and dr=0 and (balancelocaldebitamount<>0 or balancelocalcreditamount<>0)";
+ }
+
+ Connection con = null;
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ con = getConnection();
+ stmt = con.prepareStatement(sql);
+ rs = stmt.executeQuery();
+ while (rs.next()) {
+ int count = rs.getInt(1);
+ if (count == 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ } 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) {
+ }
+ }
+ return true;
+ }
+}
+/*FmYY54+/u5Lrc2y5OW0w64FpxHWxa+z4LvG8aedSP4g=*/
\ No newline at end of file