⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warehousemonth.java

📁 我的系在线考试系统我的系在线考试系统我的系在线考试系统我的系在线考试系统我的系在线考试系统我的系在线考试系统我的系在线考试系统我的系在线考试系统
💻 JAVA
字号:
package net.intuitsoft.xeon.table.warehouse.month;/** * <p>Title: 零售连锁管理系统</p> * <p>Description: 零售业最佳应用</p> * <p>Copyright: Copyright (c) 1999 - 2004</p> * <p>Company: 直觉软件科技 </p> * @author: not attributable * @version 1.0 Since 2004-07-07 */import intuitsoft.eclipse.table.common.DatabaseConnection;import intuitsoft.eclipse.table.common.DocPrefix;import intuitsoft.eclipse.table.common.FormatBillCode;import intuitsoft.eclipse.table.common.WriteLog;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;public class WarehouseMonth extends WarehouseMonthBean {	public WarehouseMonth(String jndi) {		super(jndi);	}	public boolean isPass() {		Connection conn = null;		PreparedStatement pstmt = null;		ResultSet rs = null;		try {			DatabaseConnection dc = new DatabaseConnection(getJndiName());			conn = dc.getConnection();			String sql = "select * from warehouseMonth where datediff(d,getDate(),sMonth) >= 0";			pstmt = conn.prepareStatement(sql);			rs = pstmt.executeQuery();			while (rs.next()) {				return false;			}			return true;		} catch (Exception ex) {			ex.printStackTrace();			new WriteLog(getJndiName(), 0, 10000, "core", "kernel", "database",					this.getClass().getName() + ": " + ex.getMessage(), true, 0);			return false;		} finally {			try {				if (rs != null) {					rs.close();				}				if (pstmt != null) {					pstmt.close();				}				if (conn != null) {					conn.close();				}			} catch (Exception ex) {				ex.printStackTrace();			}		}	}	private String getMaxCode() {		Connection conn = null;		PreparedStatement stmt = null;		ResultSet rs = null;		try {			try {				DatabaseConnection dc = new DatabaseConnection(getJndiName());				conn = dc.getConnection();				String sql = "select max(warehouseMonthCode) as code from warehouseMonth where warehouseMonthCode like '"						+ FormatBillCode								.dateConversionToCodeStyle(DocPrefix.WAREHOUSE_MONTH)						+ "%'";				stmt = conn.prepareStatement(sql);				rs = stmt.executeQuery();				if (rs.next()) {					String s1 = rs.getString("code");					return s1;				}				String s2 = null;				return s2;			} catch (Exception ex) {				ex.printStackTrace();			}			String s = null;			return s;		} finally {			try {				if (rs != null) {					rs.close();				}				if (stmt != null) {					stmt.close();				}				if (conn != null) {					conn.close();				}			} catch (Exception ex) {				ex.printStackTrace();			}		}	}	public String newWarehouseMonthCode() {		int step = 1;		String code = getMaxCode();		String prefix = FormatBillCode				.dateConversionToCodeStyle(DocPrefix.WAREHOUSE_MONTH);		if (code == null || "".equals(code)) {			return String.valueOf(String.valueOf(prefix)).concat("001");		}		if (code.startsWith(prefix)) {			return String.valueOf(prefix)					+ String.valueOf(FormatBillCode.fill(3, Integer							.parseInt(code.substring(prefix.length()))							+ step));		} else {			return String.valueOf(String.valueOf(prefix)).concat("001");		}	}	public String getMinDate() {		Connection conn = null;		PreparedStatement pstmt = null;		ResultSet rs = null;		try {			DatabaseConnection dc = new DatabaseConnection(getJndiName());			conn = dc.getConnection();			String sql = "select isNull(min(sMonth),'1988-05-08') as month from warehouseMonth";			pstmt = conn.prepareStatement(sql);			rs = pstmt.executeQuery();			while (rs.next()) {				return rs.getString("month");			}			return "1901-1-1";		} catch (Exception ex) {			ex.printStackTrace();			new WriteLog(getJndiName(), 0, 10000, "core", "kernel", "database",					this.getClass().getName() + ": " + ex.getMessage(), true, 0);			return "1901-1-1";		} finally {			try {				if (rs != null) {					rs.close();				}				if (pstmt != null) {					pstmt.close();				}				if (conn != null) {					conn.close();				}			} catch (Exception ex) {				ex.printStackTrace();			}		}	}	public String getMaxDate() {		Connection conn = null;		PreparedStatement pstmt = null;		ResultSet rs = null;		try {			DatabaseConnection dc = new DatabaseConnection(getJndiName());			conn = dc.getConnection();			String sql = "select isNull(max(sMonth),'2100-12-30') as m from warehouseMonth ";			pstmt = conn.prepareStatement(sql);			rs = pstmt.executeQuery();			while (rs.next()) {				return rs.getString("m");			}			return "2100-12-30";		} catch (Exception ex) {			ex.printStackTrace();			new WriteLog(getJndiName(), 0, 10000, "core", "kernel", "database",					this.getClass().getName() + ": " + ex.getMessage(), true, 0);			return "2100-12-30";		} finally {			try {				if (rs != null) {					rs.close();				}				if (pstmt != null) {					pstmt.close();				}				if (conn != null) {					conn.close();				}			} catch (Exception ex) {				ex.printStackTrace();			}		}	}	public static boolean isExistsByCode(String jndi, String day) {		Connection conn = null;		PreparedStatement pstmt = null;		ResultSet rs = null;		try {			DatabaseConnection dc = new DatabaseConnection(jndi);			conn = dc.getConnection();			String sql = "select * from warehouseMonth  where sMonth=?";			pstmt = conn.prepareStatement(sql);			pstmt.setString(1, day);			rs = pstmt.executeQuery();			while (rs.next()) {				return true;			}			return false;		} catch (Exception ex) {			ex.printStackTrace();			new WriteLog(jndi, 0, 10000, "core", "kernel", "database",					"isExistsByCode" + ": " + ex.getMessage(), true, 0);			return false;		} finally {			try {				if (rs != null) {					rs.close();				}				if (pstmt != null) {					pstmt.close();				}				if (conn != null) {					conn.close();				}			} catch (Exception ex) {				ex.printStackTrace();			}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -