From c5ea156fc5ad4e6f18382c60b41cc7d204e2881d Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Sun, 9 Mar 2025 10:32:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E8=AE=A2=E9=A1=B9=E7=9B=AE=E5=8F=96=E5=80=BC=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java index bc2f5cd..246ec40 100644 --- a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java +++ b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java @@ -595,6 +595,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { String ybpk = hvo.getCorigcurrencyid(); SaleOrderBVO[] bvos = vo.getChildrenVO(); List bvoList = new ArrayList<>(Arrays.asList(bvos)); + SaleOrderBVO oneBvo = vo.getChildrenVO()[0]; List bodyArr = (List) objectMap.get("so_saleorder_b"); for (Object body : bodyArr) { @@ -608,7 +609,11 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { SaleOrderBVO newBvo = new SaleOrderBVO(); newBvo.setStatus(VOStatus.NEW); newBvo.setAttributeValue("pk_group", pk_group); - newBvo.setAttributeValue("cprojectid", bodydata.get("cprojectid")); + String cprojectid = bodydata.get("cprojectid") + ""; + if (oneBvo != null) { + cprojectid = oneBvo.getCprojectid(); + } + newBvo.setAttributeValue("cprojectid", cprojectid); // newBvo.setAttributeValue("ctrafficorgvid", pkOrg); // newBvo.setAttributeValue("csendstockorgvid", pkOrg); // newBvo.setAttributeValue("csendstordocid", pkOrg); 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 2/3] =?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 pk_bdinfoSet = new HashSet(); + if (assvos != null) { + VerifyObjItemVO[] items = (VerifyObjItemVO[]) m_verifyObj.getChildrenVO(); + if (items != null && items.length > 0) { + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) m_verifyObj.getParentVO(); + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + for (VerifyObjItemVO verifyObjItemVO : items) { + pk_bdinfoSet.add(verifyObjItemVO.getPk_subjass()); + } + List asslist = new ArrayList(); + for (AssVO assvo : assvos) { + if (pk_bdinfoSet.contains(assvo.getPk_Checktype())) + asslist.add(assvo); + } + + 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[] queryRefDetailData(nc.vo.glrp.verify.FilterCondVO voCond, boolean bDebit, + Hashtable hash01, DetailVO detail, VoucherVO voucher) + 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 (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 " + + ") "; + } + sCond = getConditions(voCond, sCond); + AssVO[] assvos = voCond.getAssvos(); + VerifyObjVO m_verifyObj = voCond.getM_verifyObj(); + Set pk_bdinfoSet = new HashSet(); + if (assvos != null && assvos.length > 0) { + VerifyObjItemVO[] items = (VerifyObjItemVO[]) m_verifyObj.getChildrenVO(); + if (items != null && items.length > 0) { + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) m_verifyObj.getParentVO(); + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + for (VerifyObjItemVO verifyObjItemVO : items) { + pk_bdinfoSet.add(verifyObjItemVO.getPk_subjass()); + } + List asslist = new ArrayList(); + for (AssVO assvo : assvos) { + if (pk_bdinfoSet.contains(assvo.getPk_Checktype())) + asslist.add(assvo); + } + + 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]; + } + } + + + } + if (voucher.getPk_voucher() != null) { + sCond += " and (" + getAlias("gl_VerifyDetail") + ".pk_voucher <> '" + voucher.getPk_voucher() + "' "; + sCond += " or " + getAlias("gl_VerifyDetail") + ".pk_voucher is null) "; + } + if (bDebit) { + sCond += " order by " + getAlias("gl_VerifyDetail") + ".prepareddate, " + + getAlias("gl_VerifyDetail") + ".businessdate, " + + getAlias("gl_VerifyDetail") + ".verifyno, " + + getAlias("gl_VerifyDetail") + ".balancedebitamount, " + + getAlias("gl_VerifyDetail") + ".balancelocaldebitamount, " + + getAlias("gl_VerifyDetail") + ".debitamount, " + + getAlias("gl_VerifyDetail") + ".localdebitamount " + + " "; + } else { + sCond += " order by " + getAlias("gl_VerifyDetail") + ".prepareddate, " + + getAlias("gl_VerifyDetail") + ".businessdate, " + + getAlias("gl_VerifyDetail") + ".verifyno, " + + getAlias("gl_VerifyDetail") + ".balancecreditamount, " + + getAlias("gl_VerifyDetail") + ".balancelocalcreditamount, " + + getAlias("gl_VerifyDetail") + ".creditamount, " + + getAlias("gl_VerifyDetail") + ".localcreditamount " + + " "; + } + voResult = querybyConds(sCond); + + /* + * 过滤掉已被其他凭证分录参照核销的核销分录数据 + */ +// if(voResult!=null&&voResult.length>0){ +// List verifyDetailList = new ArrayList(); +// Map map = new HashMap(); +// if(bDebit){ +// for (int i=0; i0){ +// for (VerifyDetailVO verifyDetailVO : verifyDetailVOs) { +// map.put(verifyDetailVO.getPk(),verifyDetailVO); +// } +// } +// } +// } +// } else{ +// for (int i=0; i0){ +// for (VerifyDetailVO verifyDetailVO : verifyDetailVOs) { +// map.put(verifyDetailVO.getPk(),verifyDetailVO); +// } +// } +// } +// } +// } +// for (VerifyDetailVO verifyDetailVO : voResult) { +// if(!map.containsKey(verifyDetailVO.getPk())) +// verifyDetailList.add(verifyDetailVO); +// } +// voResult = verifyDetailList.toArray(new VerifyDetailVO[0]); +// } + + // 与分录上挂的辅助核算相同的核销分录优先 + if (voResult != null && voResult.length > 0 && assvos != null) { + String pk_group = AccountBookUtil.getPkGruopByAccountingBookPK(voCond.getPk_glorgbook()); + String[] assIDs = NCLocator.getInstance().lookup(IFreevaluePub.class).getAssIDs(assvos, pk_group, Module.GL); + Set assIDSet = new HashSet(); + for (String assID : assIDs) { + assIDSet.add(assID); + } + List firstList = new ArrayList(); + List secondList = new ArrayList(); + for (VerifyDetailVO verDetailVO : voResult) { + if (assIDSet.contains(verDetailVO.getAssid())) + firstList.add(verDetailVO); + else + secondList.add(verDetailVO); + } + firstList.addAll(secondList); + voResult = firstList.toArray(new VerifyDetailVO[0]); + } + return voResult; + } catch (Exception e) { + Logger.error(e.getMessage(), e); + throw new SQLException(e.getMessage()); + } + } + + /** + * 用一个VO对象的属性更新数据库中的值。 + *

+ * 创建日期:(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 From 4be53545da60a81effcf95ea458fc1f3b97347b2 Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Sun, 9 Mar 2025 18:36:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E6=A0=B8=E9=94=80?= =?UTF-8?q?=E5=A4=84=E7=90=86-=E4=B8=BA=E5=80=9F=E6=96=B9=E5=92=8C?= =?UTF-8?q?=E8=B4=B7=E6=96=B9=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=B8=81?= =?UTF-8?q?=E7=A7=8D=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lightgl/verify/VerifyWebServiceImpl.java | 789 ++++++++++++++++++ 1 file changed, 789 insertions(+) create mode 100644 gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java diff --git a/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java new file mode 100644 index 0000000..f3c509d --- /dev/null +++ b/gl/src/private/nccloud/pubimpl/gl/lightgl/verify/VerifyWebServiceImpl.java @@ -0,0 +1,789 @@ +/*336L/tOhma6VzKP3mxHcEkAXkBRqJpb8XsF1elPHMJ2c/NcdtKK6mxZmzuL3bjcU*/ +package nccloud.pubimpl.gl.lightgl.verify; + +import nc.bs.dao.BaseDAO; +import nc.bs.framework.common.InvocationInfoProxy; +import nc.bs.framework.common.NCLocator; +import nc.bs.gl.voucher.DetailServiceBO; +import nc.gl.utils.GLMultiLangUtil; +import nc.itf.gl.pub.IFreevaluePub; +import nc.itf.gl.voucher.IVoucher; +import nc.jdbc.framework.processor.MapListProcessor; +import nc.md.MDBaseQueryFacade; +import nc.md.model.IBean; +import nc.md.model.MetaDataException; +import nc.vo.bd.accassitem.AccAssItemVO; +import nc.vo.bd.accessor.IBDData; +import nc.vo.fipub.freevalue.Module; +import nc.vo.fipub.freevalue.accountbook.proxy.AccountBookUtil; +import nc.vo.fipub.timecontrol.TimeUnit; +import nc.vo.fipub.utils.AccountCalendarUtils; +import nc.vo.fipub.utils.StrTools; +import nc.vo.gateway60.accountbook.GlOrgUtils; +import nc.vo.gateway60.itfs.AccountUtilGL; +import nc.vo.gateway60.itfs.Currency; +import nc.vo.gateway60.pub.GlBusinessException; +import nc.vo.gl.ageanalysis.AgeAnalysisVO; +import nc.vo.gl.pubvoucher.DetailVO; +import nc.vo.gl.pubvoucher.VoucherVO; +import nc.vo.gl.verbalance.BalanceFilterVO; +import nc.vo.gl.verbalance.VerBalanceVO; +import nc.vo.gl.verbalance.VerDetailFilterVO; +import nc.vo.glcom.ass.AssVO; +import nc.vo.glcom.tools.GLPubProxy; +import nc.vo.glrp.pub.ParaVO; +import nc.vo.glrp.pub.VerifyMsg; +import nc.vo.glrp.verify.FilterCondVO; +import nc.vo.glrp.verify.GlVerifyDisplogVO; +import nc.vo.glrp.verify.VerifyDetailVO; +import nc.vo.glrp.verifyobj.ObjQryVO; +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.ml.NCLangRes4VoTransl; +import nc.vo.pub.BusinessException; +import nc.vo.pub.CircularlyAccessibleValueObject; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nccloud.baseapp.core.log.NCCForUAPLogger; +import nccloud.dto.gl.verify.VerifyDetailWebVO; +import nccloud.dto.gl.verify.VerifyDisplogWebVO; +import nccloud.dto.gl.verify.VerifyInfoWebVO; +import nccloud.pub.gl.lightgl.IColumnInfo; +import nccloud.pubimpl.gl.account.AccountRepUtil; +import nccloud.pubitf.gl.lightgl.verify.IVerifyWebService; +import nccloud.pubitf.gl.lightgl.voucher.IVoucherWebQryService; + +import java.util.*; + +public class VerifyWebServiceImpl implements IVerifyWebService { + + public static int COLUMNNAME = 0; // 显示名称 + public static int COLUMNCODE = 1; // 显示编码 + public static int COLUMNALL = 2; // 显示编码+名称 + + public final static String PROPERTYID = "PROPERTYID"; + public final static String STARTUNIT = "STARTUNIT"; + public final static String ENDUNIT = "ENDUNIT"; + public final static String UNIT = "UNIT"; + public final static String DESCR = "DESCR"; + + @Override + public Map queryRtVerifyData(String pk_voucher, String pk_detail, String date) throws BusinessException { + Map resultMap = new HashMap(); + VoucherVO voucher = NCLocator.getInstance().lookup(IVoucher.class).findByPrimaryKey(pk_voucher); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook(voucher.getPk_accountingbook()); + + if (voucher != null) { + DetailVO rtdetail = null; + for (DetailVO detailvo : voucher.getDetails()) { + if (detailvo.getPrimaryKey().equals(pk_detail)) { + rtdetail = detailvo; + break; + } + } + if (rtdetail != null) { + Object[] bizzData = new DetailServiceBO().getRtVerifyData(rtdetail, verifyModel.getFilterVOEx(rtdetail, date)); + if (bizzData == null) + throw new BusinessException(nc.vo.glrp.pub.VerifyMsg.getMSG_CANNTVERIFY()); + else if (verifyModel.isDataLegal((VerifyDetailVO) bizzData[0], (VerifyObjVO) bizzData[1])) { + VerifyDetailVO verifyDetailVO = (VerifyDetailVO) bizzData[0]; + verifyModel.setVerifyDetailVO(verifyDetailVO); + resultMap = getReusltMap(rtdetail, verifyModel, bizzData, true); + } else { + throw new GlBusinessException(nc.vo.glrp.pub.VerifyMsg.getMSG_CANNTVERIFY()); + } + } else + throw new GlBusinessException(nc.vo.glrp.pub.VerifyMsg.getMSG_CANNTVERIFY()); + } + return resultMap; + } + + private Map getReusltMap(DetailVO detail, GlVerifyWebModel verifyModel, + Object[] bizzData, Boolean rtVerify) throws BusinessException, MetaDataException { + Map resultMap = new HashMap(); + nc.vo.glrp.com.verify.IVerifyVO[][] v = (nc.vo.glrp.com.verify.IVerifyVO[][]) bizzData[3]; + Map[][] webvo = new Map[][]{verifyModel.appendDetailInfo((VerifyDetailVO[]) v[0]), + verifyModel.appendDetailInfo((VerifyDetailVO[]) v[1])}; + VerifyObjVO verifyObjVO = (VerifyObjVO) bizzData[1]; + VerifyObjHeaderVO headvo = (VerifyObjHeaderVO) verifyObjVO.getParentVO(); + IBDData[] data = AccountUtilGL.getAccDocByPks(new String[]{headvo.getPk_accsubj()}, + (new UFDate(InvocationInfoProxy.getInstance().getBizDateTime())).toStdString()); + if (data != null && data.length > 0) { + headvo.setAccSubjCode(data[0].getCode()); + headvo.setAccSubjName(GLMultiLangUtil.getMultiName(AccountUtilGL.findByPrimaryKey(detail.getPk_accasoa()))); + } + FilterCondVO conVO = (FilterCondVO) bizzData[2]; + if (conVO.getAssvos() != null) { + AssVO[] assvos = conVO.getAssvos(); + for (AssVO assVO : assvos) { + IBean bean = MDBaseQueryFacade.getInstance().getBeanByID(assVO.getM_classid()); + String fullName = bean.getFullName(); + // 参照的refcode临时放入userdata + assVO.setUserData(fullName); + } + } + if (conVO.getCreditCond().getAssvos() != null) { + AssVO[] assvos = conVO.getCreditCond().getAssvos(); + for (AssVO assVO : assvos) { + IBean bean = MDBaseQueryFacade.getInstance().getBeanByID(assVO.getM_classid()); + String fullName = bean.getFullName(); + // 参照的refcode临时放入userdata + assVO.setUserData(fullName); + } + } + if (conVO.getDebitCond().getAssvos() != null) { + AssVO[] assvos = conVO.getDebitCond().getAssvos(); + for (AssVO assVO : assvos) { + IBean bean = MDBaseQueryFacade.getInstance().getBeanByID(assVO.getM_classid()); + String fullName = bean.getFullName(); + // 参照的refcode临时放入userdata + assVO.setUserData(fullName); + } + } + + if (rtVerify) { + Map condMap = new LinkedHashMap(); + condMap.put("pk_accountingbook", detail.getPk_accountingbook()); + condMap.put("accountingbookName", AccountBookUtil.getAccountingBookNameByPk(detail.getPk_accountingbook())); + condMap.put("pk_units", new String[]{detail.getPk_unit()}); + condMap.put("pk_unitName", GLMultiLangUtil.getMultiName(GlOrgUtils.getOrgByPk(detail.getPk_unit()))); + condMap.put("pk_accasoa", ((VerifyObjHeaderVO) verifyObjVO.getParentVO()).getPk_accsubj()); + condMap.put("accountName", ((VerifyObjHeaderVO) verifyObjVO.getParentVO()).getAccSubjName()); + + ParaVO paraVO = GLPubProxy.getRemoteVerifyobj().initEnvirment(detail.getPk_accountingbook()); + if (paraVO.getDateName().equalsIgnoreCase("VoucherDate")) { + condMap.put("dateType", "prepareddate"); + condMap.put("end_date", verifyModel.getVerifyDetailvo().getPrepareddate().toStdString()); + } else { + condMap.put("dateType", "Businessdate"); + condMap.put("end_date", verifyModel.getVerifyDetailvo().getBusinessdate().toStdString()); + } + condMap.put("cmbMnyType", VerifyMsg.getDISP_ORIGIN()); + String pk_currency = detail.getPk_currtype(); + condMap.put("pk_currency", pk_currency); + condMap.put("currName", GLMultiLangUtil.getMultiName(Currency.getCurrInfo(pk_currency))); + condMap.put("hasTally", "Y"); + condMap.put("pk_detail", detail.getPk_detail()); + + AccAssItemVO[] assItems = NCLocator.getInstance().lookup(IVoucherWebQryService.class).queryAssItemByAsoaPk( + ((VerifyObjHeaderVO) verifyObjVO.getParentVO()).getPk_accsubj(), + AccountCalendarUtils.getStdDate()); + Map accassMap = new HashMap(); + if (assItems != null && assItems.length > 0) { + for (AccAssItemVO accAssItemVO : assItems) { + accassMap.put(accAssItemVO.getPk_accassitem(), accAssItemVO); + } + } + AssVO[] assvos = detail.getAss(); + List> asslist = new ArrayList>(); + if (assvos != null && assvos.length > 0) { + for (AssVO vo : assvos) { + Map assMap = new HashMap(); + assMap.put("checktypecode", vo.getChecktypecode()); + assMap.put("checktypename", vo.getChecktypename()); + assMap.put("checkvaluecode", vo.getCheckvaluecode()); + assMap.put("checkvaluename", vo.getCheckvaluename()); + assMap.put("innerCode", vo.getInnerCode()); + assMap.put("note1", vo.getnote1()); + assMap.put("note2", vo.getnote2()); + assMap.put("pk_Checktype", vo.getPk_Checktype()); + assMap.put("pk_Checkvalue", vo.getPk_Checkvalue()); + assMap.put("m_metaClassid", vo.getM_metaClassid()); + assMap.put("userData", vo.getUserData()); + assMap.put("m_classid", vo.getM_classid()); + assMap.put("refnodename", accassMap.get(vo.getPk_Checktype()) == null ? null : accassMap.get(vo.getPk_Checktype()).getRefnodename()); + asslist.add(assMap); + } + } + condMap.put("ass", asslist.toArray()); + if (detail.getDirection()) { + condMap.put("cmbDirect", "1"); + } else { + condMap.put("cmbDirect", "0"); + } + condMap.put("type", nc.vo.glrp.pub.VerifyMsg.TYPE_TIMELY); + resultMap.put("conVO", condMap); + } + Map accountingbookMap = new HashMap(); + accountingbookMap.put("name", AccountBookUtil.getAccountingBookNameByPk(detail.getPk_accountingbook())); + accountingbookMap.put("pk_accountingbook", detail.getPk_accountingbook()); + resultMap.put("accountingBook", accountingbookMap); + resultMap.put("verifyObj", bizzData[1]); + resultMap.put("debit", webvo[0]); + resultMap.put("credit", webvo[1]); + return resultMap; + } + + @Override + public Map queryVerifyDatas(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) varMap.get("pk_accountingbook")); + verifyModel.checkQryCond(varMap); + verifyModel.onQuery(verifyModel.getFilterVO(varMap)); + Map>[] creditInfo = verifyModel.getCreditVerifyWebInfo(); + Map>[] debitInfo = verifyModel.getDebitVerifyWebInfo(); + setCurrTypeNameForVerify(creditInfo, debitInfo); + resultMap.put("credit", creditInfo); + resultMap.put("debit", debitInfo); + return resultMap; + } + + @Override + public Map onVerify(VerifyInfoWebVO verifyInfoWebVO) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + verifyModel.checkVerifyObj(verifyInfoWebVO.getCondition()); + VerifyDetailVO[] creditVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getCredit().toArray(new VerifyDetailWebVO[0])); + VerifyDetailVO[] debitVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getDebit().toArray(new VerifyDetailWebVO[0])); + verifyModel.setCreditVerify(creditVerifyVOs); + verifyModel.setDebitVerify(debitVerifyVOs); + verifyModel.onVerify(); + verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); + resultMap.put("credit", verifyModel.getCreditVerifyWebInfo()); + resultMap.put("debit", verifyModel.getDebitVerifyWebInfo()); + return resultMap; + } + + @Override + public Map onAutoVerify(VerifyInfoWebVO verifyInfoWebVO) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + verifyModel.checkVerifyObj(verifyInfoWebVO.getCondition()); + VerifyDetailVO[] creditVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getCredit().toArray(new VerifyDetailWebVO[0])); + VerifyDetailVO[] debitVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getDebit().toArray(new VerifyDetailWebVO[0])); + verifyModel.setCreditVerify(creditVerifyVOs); + verifyModel.setDebitVerify(debitVerifyVOs); + verifyModel.setVerifyStandardVO(verifyModel.getStandardVO(verifyInfoWebVO.getStandard())); + verifyModel.onAutoVerify(); + verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); + resultMap.put("credit", verifyModel.getCreditVerifyWebInfo()); + resultMap.put("debit", verifyModel.getDebitVerifyWebInfo()); + return resultMap; + } + + @Override + public Map queryHistoryDatas(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) varMap.get("pk_accountingbook")); + verifyModel.checkHistoryCondition(varMap); + verifyModel.onQueryHisRecord(verifyModel.getCondVO(varMap)); + verifyModel.setSumLogs(verifyModel.appendLogInfo(verifyModel.getHistroySumData())); + verifyModel.setDetailLogsWeb(verifyModel.appendLogInfo(verifyModel.getHistroyData())); + resultMap.put("historySumData", verifyModel.getSumLogs()); + resultMap.put("historyData", verifyModel.getDetailLogsWeb()); + return resultMap; + } + + @Override + public Map unVerify(VerifyInfoWebVO verifyInfoWebVO) throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + VerifyDisplogWebVO[] displogWebVOs = verifyInfoWebVO.getDisplogVO().toArray(new VerifyDisplogWebVO[0]); + GlVerifyDisplogVO[] verifyDisplogVOs = verifyModel.transferWebToDispLogVO(displogWebVOs); + verifyModel.setHistroyData(verifyDisplogVOs); + verifyModel.unVerify(); + verifyModel.onQueryHisRecord(verifyModel.getCondVO(verifyInfoWebVO.getCondition())); + verifyModel.setSumLogs(verifyModel.appendLogInfo(verifyModel.getHistroySumData())); + verifyModel.setDetailLogsWeb(verifyModel.appendLogInfo(verifyModel.getHistroyData())); + resultMap.put("historySumData", verifyModel.getSumLogs()); + resultMap.put("historyData", verifyModel.getDetailLogsWeb()); + return resultMap; + } + + @Override + public Map onRedBlue(VerifyInfoWebVO verifyInfoWebVO) + throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + VerifyDetailVO[] creditVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getCredit().toArray(new VerifyDetailWebVO[0])); + VerifyDetailVO[] debitVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getDebit().toArray(new VerifyDetailWebVO[0])); + verifyModel.setCreditVerify(creditVerifyVOs); + verifyModel.setDebitVerify(debitVerifyVOs); + verifyModel.onRedBlue(verifyInfoWebVO.getCondition()); + verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); + resultMap.put("credit", verifyModel.getCreditVerifyWebInfo()); + resultMap.put("debit", verifyModel.getDebitVerifyWebInfo()); + return resultMap; + } + + @Override + public Map onAutoRedBlue(VerifyInfoWebVO verifyInfoWebVO) + throws BusinessException { + Map resultMap = new HashMap(); + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook((String) verifyInfoWebVO.getCondition().get("pk_accountingbook")); + verifyModel.checkVerifyObj(verifyInfoWebVO.getCondition()); + VerifyDetailVO[] creditVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getCredit().toArray(new VerifyDetailWebVO[0])); + VerifyDetailVO[] debitVerifyVOs = verifyModel.transferWebToVO(verifyInfoWebVO.getDebit().toArray(new VerifyDetailWebVO[0])); + verifyModel.setCreditVerify(creditVerifyVOs); + verifyModel.setDebitVerify(debitVerifyVOs); + verifyModel.setVerifyStandardVO(verifyModel.getStandardVO(verifyInfoWebVO.getStandard())); + if (debitVerifyVOs != null && debitVerifyVOs.length > 0) + verifyModel.onAutoRedBlue(true); + if (creditVerifyVOs != null && creditVerifyVOs.length > 0) + verifyModel.onAutoRedBlue(false); + verifyModel.onQuery(verifyModel.getFilterVO(verifyInfoWebVO.getCondition())); + resultMap.put("credit", verifyModel.getCreditVerifyWebInfo()); + resultMap.put("debit", verifyModel.getDebitVerifyWebInfo()); + return resultMap; + } + + @SuppressWarnings("unchecked") + @Override + public Map verBalanceQuery(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + VerBalanceWebModel balanceModel = new VerBalanceWebModel(); + String pk_accountingbook = (String) varMap.get("pk_accountingbook"); + String pagecode = (String) varMap.get("pagecode"); + balanceModel.setPk_accountingbook(pk_accountingbook); + BalanceFilterVO balanceFilterVO = balanceModel.getFilterVO(varMap); + balanceModel.getHeadData(balanceFilterVO, resultMap); + Map[] balanceVOs = null; + if (balanceFilterVO.getDirect() == BalanceFilterVO.DIRECTION_BOTH) { + balanceVOs = balanceModel.onQueryTwo(balanceFilterVO); + } else { + balanceVOs = balanceModel.onQuery(balanceFilterVO); + } + resultMap.put("balanceVO", balanceVOs); + if (balanceVOs != null) { + for (Map verBalanceWebVO : balanceVOs) { + verBalanceWebVO.put("link", new HashMap()); + if (verBalanceWebVO.get("m_Pk_verifydetail") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Pk_verifydetail", verBalanceWebVO.get("m_Pk_verifydetail")); + verBalanceWebVO.remove("m_Pk_verifydetail"); + } + verBalanceWebVO.remove("m_Flag"); + verBalanceWebVO.remove("assid"); + verBalanceWebVO.remove("m_VouchTypepk"); + verBalanceWebVO.remove("m_Balancecreditamount"); + verBalanceWebVO.remove("m_Balancecreditquantity"); + verBalanceWebVO.remove("m_Balancelocalcreditamount"); + verBalanceWebVO.remove("m_Balancedebitamount"); + verBalanceWebVO.remove("m_Balancedebitquantity"); + verBalanceWebVO.remove("m_Balancelocaldebitamount"); + verBalanceWebVO.remove("m_Businessdate"); + if (verBalanceWebVO.get("m_Creditamount") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Creditamount", verBalanceWebVO.get("m_Creditamount")); + verBalanceWebVO.remove("m_Creditamount"); + } + if (verBalanceWebVO.get("m_Debitamount") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Debitamount", verBalanceWebVO.get("m_Debitamount")); + verBalanceWebVO.remove("m_Debitamount"); + } + if (verBalanceWebVO.get("m_Explanation") != null) + ((Map) verBalanceWebVO.get("link")).put("m_Explanation", verBalanceWebVO.get("m_Explanation")); + if (verBalanceWebVO.get("m_Localcreditamount") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Localcreditamount", verBalanceWebVO.get("m_Localcreditamount")); + verBalanceWebVO.remove("m_Localcreditamount"); + } + if (verBalanceWebVO.get("m_Localdebitamount") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Localdebitamount", verBalanceWebVO.get("m_Localdebitamount")); + verBalanceWebVO.remove("m_Localdebitamount"); + } + verBalanceWebVO.remove("groupcreditamount"); + verBalanceWebVO.remove("groupdebitamount"); + verBalanceWebVO.remove("globalcreditamount"); + verBalanceWebVO.remove("globaldebitamount"); + if (verBalanceWebVO.get("m_Pk_accsubj") != null) { + ((Map) verBalanceWebVO.get("link")).put("m_Pk_accsubj", verBalanceWebVO.get("m_Pk_accsubj")); + verBalanceWebVO.remove("m_Pk_accsubj"); + } + verBalanceWebVO.remove("m_Pk_corp"); + verBalanceWebVO.remove("m_Pk_currtype"); + verBalanceWebVO.remove("m_Pk_detail"); + verBalanceWebVO.remove("m_Pk_manager"); + verBalanceWebVO.remove("m_Pk_prepared"); + verBalanceWebVO.remove("m_Pk_sob"); + verBalanceWebVO.remove("m_Pk_voucher"); + verBalanceWebVO.remove("m_Pk_vouchertype"); + verBalanceWebVO.remove("m_Prepareddate"); + verBalanceWebVO.remove("m_userData"); + verBalanceWebVO.remove("m_Balanceamount"); + verBalanceWebVO.remove("m_Balancequantity"); + verBalanceWebVO.remove("m_Balancelocalamount"); + verBalanceWebVO.remove("m_Balancebalanceamount"); + verBalanceWebVO.remove("m_Balancebalancequantity"); + verBalanceWebVO.remove("m_Balancelocalbalanceamount"); + verBalanceWebVO.remove("pk_unit"); + verBalanceWebVO.remove("pk_unit_v"); + } + } + Map columnMap = balanceModel.getColumnName(balanceFilterVO, VerifyWebServiceImpl.COLUMNNAME); + Map column1Map = balanceModel.getColumnName(balanceFilterVO, VerifyWebServiceImpl.COLUMNCODE); + Map column2Map = balanceModel.getColumnName(balanceFilterVO, VerifyWebServiceImpl.COLUMNALL); + if (!StrTools.isEmptyStr(pagecode)) { + AccountRepUtil.resetColumnWidth(columnMap.values(), pagecode); + AccountRepUtil.resetColumnWidth(column1Map.values(), pagecode); + AccountRepUtil.resetColumnWidth(column2Map.values(), pagecode); + } + resultMap.put("columnInfo", columnMap.values()); + resultMap.put("columnInfo1", column1Map.values()); + resultMap.put("columnInfo2", column2Map.values()); + return resultMap; + } + + @Override + public Map verDetailQuery(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + VerDetailWebModel detailModel = new VerDetailWebModel(); + String pk_accountingbook = (String) varMap.get("pk_accountingbook"); + String pagecode = (String) varMap.get("pagecode"); + detailModel.setPk_accountingbook(pk_accountingbook); + VerDetailFilterVO detailFilterVO = detailModel.getFilterVO(varMap); + detailModel.getHeadData(detailFilterVO, resultMap); + Map[] detailVOs = null; + detailVOs = detailModel.onQuery(detailFilterVO); + resultMap.put("detailVO", detailVOs); + Map columnMap = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNNAME); + Map column1Map = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNCODE); + Map column2Map = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNALL); + if (!StrTools.isEmptyStr(pagecode)) { + AccountRepUtil.resetColumnWidth(columnMap.values(), pagecode); + AccountRepUtil.resetColumnWidth(column1Map.values(), pagecode); + AccountRepUtil.resetColumnWidth(column2Map.values(), pagecode); + } + resultMap.put("columnInfo", columnMap.values()); + resultMap.put("columnInfo1", column1Map.values()); + resultMap.put("columnInfo2", column2Map.values()); + return resultMap; + } + + @Override + public Map verDetailLinkQuery(VerifyInfoWebVO verifyInfoWebVO) throws BusinessException { + VerBalanceVO verBalanceVO = verifyInfoWebVO.getVerBalanceVO(); + if (verBalanceVO.getExplanation().indexOf( + NCLangRes4VoTransl.getNCLangRes().getStrByID("2002365804", "UPP2002365804-000046")/* + * @res "小计" + */) >= 0 + || verBalanceVO.getExplanation().equals( + NCLangRes4VoTransl.getNCLangRes().getStrByID("2002365804", "UPP2002365804-000047")/* + * @res "科目小计" + */) + || verBalanceVO.getExplanation().equals( + NCLangRes4VoTransl.getNCLangRes().getStrByID("2002365804", "UPP2002365804-000048")/* + * @res "总计" + */)) { + return null; + } + + Map resultMap = new HashMap(); + VerBalanceWebModel balanceModel = new VerBalanceWebModel(); + String pk_accountingbook = (String) verifyInfoWebVO.getCondition().get("pk_accountingbook"); + balanceModel.setPk_accountingbook(pk_accountingbook); + BalanceFilterVO balanceFilterVO = balanceModel.getFilterVO(verifyInfoWebVO.getCondition()); + VerDetailFilterVO detailFilterVO = balanceModel.transferVerDetailFilterVO(balanceFilterVO, verBalanceVO); + + VerDetailWebModel detailModel = new VerDetailWebModel(); + detailModel.setPk_accountingbook(pk_accountingbook); + detailModel.getHeadData(detailFilterVO, resultMap); + Map[] detailVOs = detailModel.onQueryDetail(detailFilterVO, verBalanceVO.getPk_verifydetail()); + resultMap.put("detailVO", detailVOs); + Map columnMap = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNNAME); + Map column1Map = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNCODE); + Map column2Map = detailModel.getColumnName(detailFilterVO, VerifyWebServiceImpl.COLUMNALL); + resultMap.put("columnInfo", columnMap.values()); + resultMap.put("columnInfo1", column1Map.values()); + resultMap.put("columnInfo2", column2Map.values()); + return resultMap; + } + + @SuppressWarnings("rawtypes") + @Override + public Map onQuery(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + AccountAgeAnalysisWebModel accountAgeModel = new AccountAgeAnalysisWebModel(); + String pagecode = (String) varMap.get("pagecode"); + Object[] objPk_accountbooks = ((List) varMap.get("pk_accountingbook")).toArray(); + String pk_accountingbook = (String) objPk_accountbooks[0]; + accountAgeModel.setPk_accountingbook(pk_accountingbook); + CircularlyAccessibleValueObject[] vo = accountAgeModel.onQuery(false, varMap); + accountAgeModel.getHeadData(resultMap); + resultMap.put("totalVO", accountAgeModel.transferDynamicData(vo)); + if (vo != null && vo.length > 0) { + Map columnMap = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNNAME); + Map column1Map = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNCODE); + Map column2Map = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNALL); + if (!StrTools.isEmptyStr(pagecode)) { + AccountRepUtil.resetColumnWidth(columnMap.values(), pagecode); + AccountRepUtil.resetColumnWidth(column1Map.values(), pagecode); + AccountRepUtil.resetColumnWidth(column2Map.values(), pagecode); + } + resultMap.put("columnInfo", columnMap.values()); + resultMap.put("columnInfo1", column1Map.values()); + resultMap.put("columnInfo2", column2Map.values()); + } + return resultMap; + } + + @Override + public Map onDetailed(Map varMap) throws BusinessException { + Map resultMap = new HashMap(); + AccountAgeAnalysisWebModel accountAgeModel = new AccountAgeAnalysisWebModel(); + Object[] objPk_accountbooks = ((List) varMap.get("pk_accountingbook")).toArray(); + String pk_accountingbook = (String) objPk_accountbooks[0]; + accountAgeModel.setPk_accountingbook(pk_accountingbook); + CircularlyAccessibleValueObject[] vo = accountAgeModel.onDetailed(varMap); + accountAgeModel.getHeadData(resultMap); + resultMap.put("detailVO", accountAgeModel.transferDynamicData(vo)); + if (vo != null && vo.length > 0) { + Map columnMap = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNNAME); + Map column1Map = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNCODE); + Map column2Map = accountAgeModel.getColumnName(((AgeAnalysisVO) vo[0]).getColumnCodes(), VerifyWebServiceImpl.COLUMNALL); + resultMap.put("columnInfo", columnMap.values()); + resultMap.put("columnInfo1", column1Map.values()); + resultMap.put("columnInfo2", column2Map.values()); + } + return resultMap; + } + + @Override + public Map refVerify(DetailVO selDetail, String busidate) throws BusinessException { + Map reusltMap = new HashMap(); +// DetailVO selDetail = voucher.getDetail(selectIndex); + if (selDetail.getPk_accasoa() == null) { + throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("20021005", + "UPT2002100573-900063")/* + * @ res "当前分录科目尚未选择,不能进行参照核销!" + */); + } + if (selDetail.getIsmatched() != null && selDetail.getIsmatched().equals(UFBoolean.TRUE)) { + throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("20021005", + "UPT2002100573-900070")/* + * @ res "当前分录已有后续业务,不能进行参照核销!" + */); + } + String pks[] = AccountUtilGL.findAccountPathToRootPks(selDetail.getPk_accountingbook(), selDetail.getPk_accasoa(), selDetail.getPrepareddate().toString()); + ArrayList l = new ArrayList(); + l.add(selDetail.getPk_accasoa()); + if (pks != null) + for (String pk : pks) + l.add(pk); + DetailVO detail = (DetailVO) selDetail.clone(); + ObjQryVO qryVO = new ObjQryVO(); + qryVO.setPk_glorgbook(selDetail.getPk_accountingbook()); + qryVO.setPk_accSubjs(l.toArray(new String[0])); + VerifyObjVO verifyObj = GLPubProxy.getRemoteVerifyobj().findObjbyCond(qryVO); + if (verifyObj == null || verifyObj.getParentVO() == null) { + throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("20021005", + "UPT2002100573-900064")/* @res"当前分录科目不是核销对象,不能进行参照核销!" */); + } + + if (!StringUtil.isEmptyWithTrim(detail.getAssid())) { + String assid = detail.getAssid(); + AssVO[] assvos = NCLocator.getInstance().lookup(IFreevaluePub.class).queryAssvosByid(assid, Module.GL); + detail.setAss(assvos); + } + + VerifyObjHeaderVO voHead = (VerifyObjHeaderVO) verifyObj.getParentVO(); + if (voHead.getBcontrol().booleanValue()) { /* 严格按照辅助核算控制 */ + VerifyObjItemVO[] items = (VerifyObjItemVO[]) verifyObj.getChildrenVO(); + if (items != null && items.length > 0) { + if (StringUtil.isEmptyWithTrim(detail.getAssid())) + throw new GlBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("20021005", + "UPT2002100573-900065")/* + * @res + * "当前分录科目的核销对象已设置辅助核算严格控制,请先录入辅助核算!" + */); + + for (AssVO assvo : detail.getAss()) { + if (assvo.getPk_Checkvalue() == null) + assvo.setPk_Checkvalue("~"); + } + // 下面代码处理多个辅助核算中的一部分严格控制时,查询数据。 + List assvolist = new ArrayList(); + for (int i = 0; i < items.length; i++) { + for (AssVO ass : detail.getAss()) { + if (ass.getPk_Checktype().equals(items[i].getPk_subjass())) { + assvolist.add(ass); + } + } + } + detail.setAss(assvolist.toArray(new AssVO[0])); + } + } + + FilterCondVO voCond = new FilterCondVO(); + FilterCondVO debitCond = new FilterCondVO(); + FilterCondVO creditCond = new FilterCondVO(); + + creditCond.setPkuser(InvocationInfoProxy.getInstance().getUserId()); + creditCond.setPk_glorgbook(detail.getPk_accountingbook()); + creditCond.setPkSob(null); + creditCond.setLogonDate(new UFDate(busidate).asEnd().toString()); + creditCond.setCurPk(detail.getPk_currtype()); + + AssVO[] assvos = detail.getAss(); + if (assvos != null && assvos.length > 0) { + creditCond.setAssvos(assvos); + } else { + creditCond.setAssvos(null); + } + + creditCond.setBeginDate(null); + creditCond.setEndDate(new UFDate(busidate).asEnd().toString()); + creditCond.setDateType("Businessdate"); + creditCond.setMnyType("原币");/* -=notranslate=- */ + creditCond.setDigest(null); + creditCond.setVerifyNo(null); + creditCond.sethasTally(true); + + debitCond.setPkuser(InvocationInfoProxy.getInstance().getUserId()); + debitCond.setPk_glorgbook(detail.getPk_accountingbook()); + debitCond.setPkSob(null); + debitCond.setLogonDate(new UFDate(busidate).asEnd().toString()); + debitCond.setCurPk(detail.getPk_currtype()); + + if (assvos != null && assvos.length > 0) { + debitCond.setAssvos(assvos); + } else { + debitCond.setAssvos(null); + } + + debitCond.setBeginDate(null); + debitCond.setEndDate(new UFDate(busidate).asEnd().toString()); + debitCond.setDateType("Businessdate"); + debitCond.setMnyType("原币");/* -=notranslate=- */ + debitCond.setDigest(null); + debitCond.setVerifyNo(null); + debitCond.sethasTally(true); + voCond.setCreditCond(creditCond); + voCond.setDebitCond(debitCond); + VoucherVO voucher = new VoucherVO(); + voucher.setPk_voucher(detail.getPk_voucher()); + voucher.setPk_accountingbook(detail.getPk_accountingbook()); + voucher.setPrepareddate(detail.getPrepareddate()); + Object[] refVerifyData = new DetailServiceBO().getRefVerifyData(detail, voCond, voucher); + if (refVerifyData != null && refVerifyData.length > 0) { + GlVerifyWebModel verifyModel = new GlVerifyWebModel(); + verifyModel.setPk_accountingbook(detail.getPk_accountingbook()); + verifyModel.setRslt((FilterCondVO) refVerifyData[2], + (nc.vo.glrp.verify.VerifyDetailVO[][]) refVerifyData[3]); + + reusltMap = getReusltMap(detail, verifyModel, refVerifyData, false); + } + return reusltMap; + } + + @Override + public List queryBadAccountRate(String pk_accountAgePeriod) throws BusinessException { + List rslist = new ArrayList(); + StringBuffer sbSQL = new StringBuffer(); + sbSQL.append(" select propertyid,startunit,endunit,b.unit,descr from fipub_timecontrol_b pub_timecontrol_a" + + " join fipub_timecontrol b on b.pk_timectrl =pub_timecontrol_a.pk_timectrl where pub_timecontrol_a .pk_timectrl = '"); + sbSQL.append(pk_accountAgePeriod); + sbSQL.append("' and pub_timecontrol_a.dr = 0 order by pub_timecontrol_a.propertyid "); + nc.vo.pub.rs.MemoryResultSet accountPeriod = null; + try { + accountPeriod = GLPubProxy.getRemoteAccountAgeAnalysis().queryPeriod(sbSQL.toString()); + while (accountPeriod.next()) { + // startvalue + Object objStart = accountPeriod.getInt(STARTUNIT); + // endvalue + Object objEnd = accountPeriod.getInt(ENDUNIT); + // 是年、月、日 + Object objUnit = accountPeriod.getInt(UNIT); + // 账龄区间描述 + Object objDescr = accountPeriod.getString(DESCR); + if (StrTools.isEmptyStr((String) objDescr)) { + if (objEnd == null || Integer.parseInt(objEnd.toString()) == 0) { + if (objDescr == null) { + if (objUnit != null && objUnit == TimeUnit.valueOfInt(TimeUnit.DAY)) { + objDescr = objStart.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("subjverify_0", "02002004-0001")/*@res "天以上"*/; + } else if (objUnit != null && objUnit == TimeUnit.valueOfInt(TimeUnit.MONTH)) { + objDescr = objStart.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("subjverify_0", "02002004-0002")/*@res "月以上"*/; + } else { + objDescr = objStart.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("subjverify_0", "02002004-0003")/*@res "年以上"*/; + } + } + } else { + if (objUnit != null && objUnit == TimeUnit.valueOfInt(TimeUnit.DAY)) { + objDescr = objStart.toString() + "-" + objEnd.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("subjverify_0", "02002004-0004")/*@res "天"*/; + } else if (objUnit != null && objUnit == TimeUnit.valueOfInt(TimeUnit.MONTH)) { + objDescr = objStart.toString() + "-" + objEnd.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002494")/*@res "月"*/; + } else { + objDescr = objStart.toString() + "-" + objEnd.toString() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001787")/*@res "年"*/; + } + } + } + rslist.add(objDescr); + } + } catch (Exception e) { + throw new BusinessException(e); + } + return rslist; + } + + /** + * 为借方和贷方列表增加币种字段 + * + * @param creditInfo + * @param creditInfo + */ + private void setCurrTypeNameForVerify(Map>[] creditInfo, Map>[] debitInfo) { + Map resMap = new HashMap<>(); + Set pk_currtypes = new HashSet<>(); + try { + // 提取币种主键 + processCurrencyTypes(creditInfo, pk_currtypes); + processCurrencyTypes(debitInfo, pk_currtypes); + + // 查询币种名称 + String pk_currtypeStr = String.join("','", pk_currtypes); + // NCCForUAPLogger.debug("pk_currtypeStr:" + pk_currtypeStr); + String sql = "select pk_currtype, name from bd_currtype where pk_currtype in ('" + pk_currtypeStr + "') and dr = 0"; + List results = (List) new BaseDAO().executeQuery(sql, new MapListProcessor()); + + for (Map result : results) { + String pk_currtype = result.getOrDefault("pk_currtype", "") + ""; + String name = result.getOrDefault("name", "") + ""; + if (pk_currtype.isEmpty() || name.isEmpty()) { + continue; + } + resMap.put(pk_currtype, name); + } + + // 设置币种名称 + setCurrencyNameInArr(creditInfo, resMap); + setCurrencyNameInArr(debitInfo, resMap); + } catch (Exception e) { + NCCForUAPLogger.debug("setCurrTypeNameForVerify-exp:" + e.getMessage()); + throw new RuntimeException(e); + } + } + + private void processCurrencyTypes(Map>[] infoArray, Set pk_currtypes) { + for (Map> map : infoArray) { + Map currtypeMap = map.get("m_pk_currtype"); + // NCCForUAPLogger.debug("infoArray-m_pk_currtype= " + currtypeMap); + if (!"".equals(currtypeMap.getOrDefault("value", ""))) { + String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; + pk_currtypes.add(pk_currtype); + } + } + } + + private void setCurrencyNameInArr(Map>[] infoArray, Map resMap) { + for (Map> map : infoArray) { + Map currtypeMap = map.get("m_pk_currtype"); + String pk_currtype = currtypeMap.getOrDefault("value", "") + ""; + String m_currtypeName = resMap.get(pk_currtype); + + Map currtypeNameMap = new HashMap<>(); + currtypeNameMap.put("value", m_currtypeName); + currtypeNameMap.put("display", m_currtypeName); + map.put("m_currtypeName", currtypeNameMap); + } + } + +} + +/*336L/tOhma6VzKP3mxHcEkAXkBRqJpb8XsF1elPHMJ2c/NcdtKK6mxZmzuL3bjcU*/ \ No newline at end of file