?? operationinfotra.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 + -