📄 allocatproduct.java
字号:
//Source file: D:\work\五洋\javaBean\src\AllocatProduct.java
package src.wuyang;
import src.com.*;
import java.sql.*;
import java.io.*;
public class AllocatProduct extends ShangObject
{
/**
对应调拨单编号
*/
private String allocatId;
/**
相应的产品编号
*/
private String productId;
/**
件数
*/
private float counting;
/**
总数
*/
private float quantity;
/**
包装
*/
private int pack;
/**
含税单价
*/
private float unitPrice;
/**
实际发货数量
*/
private float actQuantity;
/**
相应的产品产地
*/
private String productAdd;
/**
* Access method for the allocatId property.
*
* @return the current value of the allocatId property
*/
public String getAllocatId() {
return allocatId;}
/**
* Sets the value of the allocatId property.
*
* @param aAllocatId the new value of the allocatId property
*/
public void setAllocatId(String aAllocatId) {
allocatId = setChnString(aAllocatId);}
/**
* Access method for the productId property.
*
* @return the current value of the productId property
*/
public String getProductId() {
return productId;}
/**
* Sets the value of the productId property.
*
* @param aProductId the new value of the productId property
*/
public void setProductId(String aProductId) {
productId = setChnString(aProductId);}
/**
* Access method for the counting property.
*
* @return the current value of the counting property
*/
public float getCounting() {
return counting;}
/**
* Sets the value of the counting property.
*
* @param aCounting the new value of the counting property
*/
public void setCounting(float aCounting) {
counting = aCounting;}
/**
* 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;}
/**
* Access method for the pack property.
*
* @return the current value of the pack property
*/
public int getPack() {
return pack;}
/**
* Sets the value of the pack property.
*
* @param aPack the new value of the pack property
*/
public void setPack(int aPack) {
pack = aPack;}
/**
* Access method for the unitPrice property.
*
* @return the current value of the unitPrice property
*/
public float getUnitPrice() {
return unitPrice;}
/**
* Sets the value of the unitPrice property.
*
* @param aUnitPrice the new value of the unitPrice property
*/
public void setUnitPrice(float aUnitPrice) {
unitPrice = aUnitPrice;}
/**
* Access method for the actQuantity property.
*
* @return the current value of the actQuantity property
*/
public float getActQuantity() {
return actQuantity;}
/**
* Sets the value of the actQuantity property.
*
* @param aActQuantity the new value of the actQuantity property
*/
public void setActQuantity(float aActQuantity) {
actQuantity = aActQuantity;
}
/**
* Access method for the productAdd property.
*
* @return the current value of the productAdd property
*/
public String getProductAdd() {
return productAdd;}
/**
* Sets the value of the productAdd property.
*
* @param aproductAdd the new value of the productAdd property
*/
public void setProductAdd(String aProductAdd) {
productAdd = setChnString(aProductAdd);
}
public AllocatProduct(){
primarykey1Name="allocatId" ;
primarykey1Type=1;
primarykey2Name="productId" ;
primarykey2Type=1;
tableName ="AllocatProduct";
viewName="AllocatProduct";
numInOnePager=10;}
public String getWhereClause(javax.servlet.ServletRequest request) {
String whereClause = "";
whereClause = addWhereClause(whereClause, "allocatId", "=", "'",request.getParameter("allocatId"));
whereClause = addWhereClause(whereClause, "productId", "=", "'",request.getParameter("productId"));
whereClause = addWhereClause(whereClause, "counting", "like", "'",request.getParameter("counting"));
whereClause = addWhereClause(whereClause, "quantity", "like", "'",request.getParameter("quantity"));
whereClause = addWhereClause(whereClause, "pack", "like", "'",request.getParameter("pack"));
whereClause = addWhereClause(whereClause, "unitPrice", "like", "'",request.getParameter("unitPrice"));
whereClause = addWhereClause(whereClause, "actQuantity", "like", "'",request.getParameter("actQuantity"));
return whereClause;
}
public int loadAttr() {
try {
allocatId= getRsString(rs,"allocatId");
productId= getRsString(rs,"productId");
counting= rs.getFloat("counting");
quantity= rs.getFloat("quantity");
pack= rs.getInt("pack");
productAdd= getRsString(rs,"productAdd");
unitPrice= rs.getFloat("unitPrice");
actQuantity= rs.getFloat("actQuantity");
} catch(SQLException e) {
e.printStackTrace();
System.out.println("query failed!");
return -1;
}
return 1;
}
public int insert() {
String sql= "{?=call sp_InsertAllocatProduct(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt,2,allocatId);
setStmtString(updStmt,3,productId);
updStmt.setFloat(4,quantity);
updStmt.setInt(5,pack);
setStmtString(updStmt,6,productAdd);
updStmt.setFloat(7,unitPrice);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
/**修改1
**
**/
public int update() {
String sql= "{?=call sp_UpdateAllocatProduct(?,?,?,?,?,?)}";
try{
CallableStatement updStmt=conn.prepareCall(sql);
updStmt.registerOutParameter(1, java.sql.Types.INTEGER);
setStmtString(updStmt,2,allocatId);
setStmtString(updStmt,3,productId);
updStmt.setFloat(4,quantity);
updStmt.setInt(5,pack);
setStmtString(updStmt,6,productAdd);
updStmt.setFloat(7,unitPrice);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
/* 修改2
@loginName varchar(30)
,@ip varchar(20)
,@machineName varchar(30)
,@allocatId varchar(10)
,@productId varchar(10)
,@actQuantity float
*/
public int updateAct() {
String sql= "{?=call sp_UpdateAllocatProductAct(?,?,?,?,?,?)}";
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, allocatId);
setStmtString(updStmt, 6, productId);
updStmt.setFloat(7,actQuantity);
updStmt.executeUpdate();
int rtcode = updStmt.getInt(1);
updStmt.close();
return rtcode;
}catch(SQLException E){
System.out.println(E.getMessage());
return -102;
}
}
public int delete(String p1,String p2){
try
{
String sqlStmt;
Statement stmt = conn.createStatement();
sqlStmt = "delete from " + tableName + " where allocatId= '"
+ allocatId + "' and productId= '"+productId+"'" ;
System.out.print(sqlStmt);
stmt.executeUpdate(sqlStmt);
return 0;
} catch(SQLException e)
{
e.printStackTrace();
return -1;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -