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

📄 operationinfotra.java

📁 (Java+SQL)-大型企业JAVA的ERP系统
💻 JAVA
字号:
//Source file: D:\work\五洋\javaBean\src\OperationInfoTra.java

package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;


public class OperationInfoTra extends ShangObject
{
   
   /**
凭证编号
   */
   private String receiptId;
   
   /**
凭证类型
0 开票申请
1 调拨申请
2 采购申请
3 易耗品采购申请
4 销售合同
5 采购合同
6 进出口合同
   */
   private int receiptType;
   
   /**
申请人
   */
   private String proposer;
   
   /**
部门编号
   */
   private String deptId;
   
   /**
审核状态
1  部门经理审核
2  销售部审核
3  总经理审核
4  审核完成
   */
   private int state;
   
  
   
   /**
* Access method for the receiptId property.
*
* @return   the current value of the receiptId property
   */
   public String getReceiptId() {
      return receiptId;}
   
   /**
* Sets the value of the receiptId property.
*
* @param aReceiptId the new value of the receiptId property
   */
   public void setReceiptId(String aReceiptId) {
      receiptId = aReceiptId;}
   
   /**
* Access method for the receiptType property.
*
* @return   the current value of the receiptType property
   */
   public int getReceiptType() {
      return receiptType;}
   
   /**
* Sets the value of the receiptType property.
*
* @param aReceiptType the new value of the receiptType property
   */
   public void setReceiptType(int aReceiptType) {
      receiptType = aReceiptType;}
   
   /**
* Access method for the proposer property.
*
* @return   the current value of the proposer property
   */
   public String getProposer() {
      return proposer;}
   
   /**
* Sets the value of the proposer property.
*
* @param aProposer the new value of the proposer property
   */
   public void setProposer(String aProposer) {
      proposer = setChnString(aProposer);}
   
   /**
* Access method for the deptId property.
*
* @return   the current value of the deptId property
   */
   public String getDeptId() {
      return deptId;}
   
   /**
* Sets the value of the deptId property.
*
* @param aDeptId the new value of the deptId property
   */
   public void setDeptId(String aDeptId) {
      deptId = aDeptId;}

   /**
* Access method for the state property.
*
* @return   the current value of the state property
   */
   public int getState() {
      return state;}
   
   /**
* Sets the value of the state property.
*
* @param aDeptId the new value of the state property
   */
   public void setState(int aState) {
      state = aState;}
      
	public  OperationInfoTra()
		{
		primarykey1Name="receiptId" ;
		primarykey1Type=1;
		primarykey1Name="receiptType" ;
		primarykey1Type=0;
		tableName ="OperationInfoTra";
		viewName="OperationInfoTra";
		numInOnePager=10;
		}

	public String getWhereClause(javax.servlet.ServletRequest request) 
		{
		String whereClause = "";
		whereClause = addWhereClause(whereClause, "receiptId", "=", "'",request.getParameter("receiptId"));
		whereClause = addWhereClause(whereClause, "receiptType", "=", "",request.getParameter("receiptType"));
		whereClause = addWhereClause(whereClause, "proposer", "like", "'",request.getParameter("proposer"));
		whereClause = addWhereClause(whereClause, "deptId", "=", "'",request.getParameter("deptId"));
		return whereClause;
		}
	
	public int loadAttr() 
		{
		try 	{ 
			receiptId= getRsString(rs,"receiptId");
			receiptType= rs.getInt("receiptType");
			proposer= getRsString(rs,"proposer");
			deptId= getRsString(rs,"deptId");
			} 
		catch(SQLException e) 
			{
			e.printStackTrace();
			System.out.println("query failed!");
			return -1;
			}
		return 1;
		}
	
	public int update() 
		{
		String sql= "{?=call sp_UpdateOperationInfoTra(?,?,?,?)}";
		try	{
			CallableStatement updStmt=conn.prepareCall(sql);
			updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
			setStmtString(updStmt,2,receiptId);
			updStmt.setInt(3,receiptType);
			setStmtString(updStmt,4,proposer);
			setStmtString(updStmt,5,deptId);
			updStmt.executeUpdate();
			int rtcode = updStmt.getInt(1);
			updStmt.close();
			return rtcode; 
			}
		catch(SQLException E)
			{
			System.out.println(E.getMessage());
			return -102;
		  	}
		}
		
		
public int updateState() 
		{
		String sql= "{?=call sp_UpdateOperationInfoTraState(?,?,?,?,?,?)}";
	    try{
			CallableStatement updStmt=conn.prepareCall(sql);
			updStmt.registerOutParameter(1, java.sql.Types.INTEGER);/** 注册OUT参数 */
			setStmtString(updStmt, 2, theGlobal.loginName);
			setStmtString(updStmt, 3, theGlobal.ip);
			setStmtString(updStmt, 4, theGlobal.machineName);					
			setStmtString(updStmt,5,receiptId);
			updStmt.setInt(6,receiptType);
			updStmt.setInt(7,state);	
			updStmt.executeUpdate();
			int rtcode = updStmt.getInt(1);
			updStmt.close();
			return rtcode; 
			}
		catch(SQLException E)
			{
			System.out.println(E.getMessage());
			return -102;
		  	}
		}
	 
	public int insert() 
		{
		String sql= "{?=call sp_InsertOperationInfoTra(?,?,?,?)}";
		try	{
			CallableStatement updStmt=conn.prepareCall(sql);
			updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
			setStmtString(updStmt,2,receiptId);
			updStmt.setInt(3,receiptType);
			setStmtString(updStmt,4,proposer);
			setStmtString(updStmt,5,deptId);
			updStmt.executeUpdate();
			int rtcode = updStmt.getInt(1);
			updStmt.close();
			return rtcode; 
			}
		catch(SQLException E)
			{
			System.out.println(E.getMessage());
			return -102;
		  	}
		}

	public int changeState(String receiptId,int receiptType,int state)
		{
		String sql= "UPDATE OperationInfoTra SET state=" + state + " "+
			    "WHERE receiptId='" + receiptId + "' and receiptType=" + receiptType ;
		System.out.println(sql);
		try	{
			Statement stmt=conn.createStatement();
			stmt.execute(sql);
			return 0;
			}
		catch(SQLException E)
			{
		      	System.out.println(E.getMessage());
		      	return -102;
      			}
		}
		
	/*  删除
	*/
	public int delete(int receiptType,String receiptId) {
		String	sql ="delete from OperationInfoTra where receiptId = "+receiptId +"and receiptType = "+receiptType;
		System.out.println("delete sql "+sql);
		try	{
			Statement stmt=conn.createStatement();
			stmt.execute(sql);
			return 1;
			}
		catch(SQLException E)
			{
		      	System.out.println(E.getMessage());
		      	return -102;
      	    }		
	}	
		
}

⌨️ 快捷键说明

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