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

📄 countlist.java

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

package src.wuyang;

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

public class CountList extends ShangObject
{
   
    /**
唛单序号
   */
   private int  markNo;
   
   /**
唛单编号
   */
   private int  markId;
   
   /**
唛头
   */
   private String  mark;
   
   /**
数量
   */
   private float quantity;
   
   public CountList() 
   {
   		this.primarykey1Name = "markId";
   		this.primarykey1Type = 0;   
   		this.primarykey2Name = "markNo";
   		this.primarykey2Type = 0;   		
   		this.tableName = "CountList";
   		this.viewName = "CountList";
   		this.numInOnePager = 10;
   }
   
   public int loadAttr(){
   	   try{	
	   	   markId = rs.getInt("markId");
	   	   mark = getRsString(rs,"mark");
	   	   quantity = rs.getFloat("quantity");
	   	   markNo = rs.getInt("markNo");
	   	   return 1;
	   }catch(SQLException e){
	   		e.printStackTrace();
	   		System.out.println("querry failed !");
	   		return -1;
	   	}
   }
   
   public int getMaxMarkId() {
	try
	{	
		Statement countStmt = conn.createStatement();
   		String sqlStmt;
   		sqlStmt = "select max(markId) as maxMarkId from " + viewName ;		
		ResultSet lRs=countStmt.executeQuery(sqlStmt);
        	lRs.next() ;
	        int maxId = lRs.getInt("maxMarkId");
	    	lRs.close();
	    	return maxId;
	}
	catch(SQLException e)
	{
		e.printStackTrace();
   		return -1;
   	}
}
   
   /*  新增
 
 	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@markNo int
	,@mark varchar(10)
	,@quantity float	
 */ 	
 
   public int insert() {
	
     String sql= "{?=call sp_InsertCountList(?,?,?,?,?,?)}";
     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);
		updStmt.setInt(5,markId);    	
		setStmtString(updStmt,6,mark);	
		updStmt.setFloat(7,quantity);    	
   	 	updStmt.executeUpdate();
   	 	int rtcode = updStmt.getInt(1);
	updStmt.close();
	return rtcode; 
      }catch(SQLException E){
      	System.out.println(E.getMessage());
      	return -102;
      }
}

 /*  修改1
 
 	@loginName varchar(30) 
	,@ip varchar(20) 
	,@machineName varchar(30) 
	,@markId int
	,@quantity float
 */ 	
 
   public int update() {
	
     String sql= "{?=call sp_UpdateCountList(?,?,?,?,?,?)}";
     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);
		updStmt.setInt(5,markNo); 
		setStmtString(updStmt,6,mark);			   			
		updStmt.setFloat(7,quantity);    			
   	 	updStmt.executeUpdate();
   	 	int rtcode = updStmt.getInt(1);
	updStmt.close();
	return rtcode; 
      }catch(SQLException E){
      	System.out.println(E.getMessage());
      	return -102;
      }
}

/*  修改2
*/
	public int update(String strMarkNo,String quantity) {
		String	sql ="update CountList set quantity="+quantity+"where markNo = "+strMarkNo;
		System.out.println("update sql "+sql);
		try	{
			Statement stmt=conn.createStatement();
			stmt.execute(sql);
			return 1;
			}
		catch(SQLException E)
			{
		      	System.out.println(E.getMessage());
		      	return -102;
      	    }		
	}


/*  删除
*/
	public int delete() {
		String	sql ="delete from CountList where markNo = "+getMarkNo();
		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;
      	    }		
	}

/**
* Access method for the markNo property.
*
* @return   the current value of the markNo property
   */
   public int  getMarkNo() 
   {
      return markNo;
   }
   
   /**
* Sets the value of the markNo property.
*
* @param aMarkId the new value of the markNo property
   */
   public void setMarkNo(int  aMarkNo) 
   {
      markNo = aMarkNo;
   }
   
   /**
* Access method for the markId property.
*
* @return   the current value of the markId property
   */
   public int  getMarkId() 
   {
      return markId;
   }
   
   /**
* Sets the value of the markId property.
*
* @param aMarkId the new value of the markId property
   */
   public void setMarkId(int  aMarkId) 
   {
      markId = aMarkId;
   }
   
   /**
* Access method for the mark property.
*
* @return   the current value of the mark property
   */
   public String  getMark() 
   {
      return mark;
   }
   
   /**
* Sets the value of the mark property.
*
* @param aMark the new value of the mark property
   */
   public void setMark(String  aMark) 
   {
      mark = setChnString(aMark);
   }
   
   /**
* Access method for the quantity property.
*
* @return   the current value of the quantity property
   */
   public float getQuantity() 
   {
      return quantity;
   }
   
   /**
* Sets the value of the quantity property.
*
* @param aQuantity the new value of the quantity property
   */
   public void setQuantity(float aQuantity) 
   {
      quantity = aQuantity;
   }
}

⌨️ 快捷键说明

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