private long getIno_id(GlAccvouchObj o) throws Exception { long ino_id = 1; Connection conn = null; try { conn = MySqlUtil.getConnection(U8_DB); ResultSet rst = conn.createStatement() .executeQuery( "select max(ino_id) from gl_Accvouch where iperiod='" + o.getIperiod() + "' and csign='" + o.getCsign() + "'"); if (rst.next()) { ino_id = rst.getLong(1) + 1; } o.setIno_id(ino_id); // 设置到输入条件对象中 } catch (SQLException e) { throw e; } finally { MySqlUtil.closeConnection(conn); } logger.info("获取最大凭证号:" + ino_id); return ino_id; }
private List getReverseGlavList(GlAccvouchObj glavInput) throws Exception { List pingZhangGlavList = new ArrayList(); Connection conn = null; try { conn = MySqlUtil.getConnection(SystemConstant.DEFAULT_DB); ResultSet rst = conn.createStatement() .executeQuery( "select zzAccSubReverse ccode,SUM(md) md,SUM(mc) mc from gl_accvouch group by zzAccSubReverse"); while (rst.next()) { GlAccvouchObj o = createGlAccvouchObj(glavInput); o.setCcode(rst.getString("ccode")); o.setMd(rst.getBigDecimal("mc")); // 注意这个地方mc,md要反过来,因为要平账 o.setMc(rst.getBigDecimal("md")); pingZhangGlavList.add(o); } } catch (Exception e) { throw e; } finally { MySqlUtil.closeConnection(conn); } return pingZhangGlavList; }