📄 productsecbean.java~4~
字号:
list.add(prod.getP_type_name());
list.add(prod.getP_type_remark());
}
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_type_search(..)--2:"+e);
}
return list;
}
public java.util.Collection find_prod_basic_name(String name) {
/**@todo Complete this method*/
return null;
}
public LinkedList find_prod_search(int operation, String type, String content) {
/**@todo Complete this method*/
final int name=1,spec=2,id=3,model=4;
Collection col=null;
LinkedList list=new LinkedList();
content="%"+content+"%";
switch(operation){
case id:
try{
prod_view_searchRemoteHome home = lookupPbview();
col=home.find_id(type,content);
// prod_pb_infoEntRemoteHome home2=lookupPbInfo();
//home2.
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_prod_search(..):"+e);
}
break;
case name:
try{
prod_view_searchRemoteHome home = lookupPbview();
col=home.find_name(type,content);
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_prod_search(..):"+e);
}
break;
case spec:
try{
prod_view_searchRemoteHome home = lookupPbview();
col=home.find_spec(type,content);
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_prod_search(..):"+e);
}
break;
case model:
try{
prod_view_searchRemoteHome home = lookupPbview();
col=home.find_model(type,content);
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_prod_search(..):"+e);
}
break;
}
try{
Iterator i = col.iterator();
while (i.hasNext()) {
prod_view_searchRemote prod = (prod_view_searchRemote)
PortableRemoteObject.narrow(i.next(), prod_view_searchRemote.class);
//list.add(new type(prod.getP_type_id(), prod.getP_type_name(),prod.getP_type_remark()));
list.add(prod.getTid());
list.add(prod.getId());
list.add(prod.getName());
list.add(prod.getSpec());
list.add(prod.getModel());
list.add(prod.getUnit());
list.add(prod.getRemark());
//list.add((""+prod.getTax()).substring(0,(""+prod.getTax()).indexOf(".")+2));
list.add(prod.getTax()+"");
list.add(prod.getAmount()+"");
list.add(prod.getMaxlow()+"");
list.add(prod.getBprice()+"");
list.add(prod.getSprice()+"");
list.add(prod.getState()+"");
list.add(prod.getDepositary());
}
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_type_search(..)--2:"+e);
}
System.out.println("return prod_view list");
return list;
}
public boolean del_prod_pk(String pk) {
/**@todo Complete this method*/
boolean res=true;
try{
productBasicInfoEntPK ppk=new productBasicInfoEntPK(pk);
productBasicInfoEntRemoteHome home = lookupBasicHome();
productBasicInfoEntRemote prod=home.findByPrimaryKey(ppk);
prod.remove();
}
catch(Exception e){
System.out.println("err at product.productSecBean.del_prod(..):"+e);
res=false;
}
return res;
}
public boolean mod_prod_pk(String p_id, String p_type_id, String p_name, String p_spec, String p_model, String p_unit, Image p_image, String p_remark) {
/**@todo Complete this method*/
boolean res=true;
try{
productBasicInfoEntPK ppk=new productBasicInfoEntPK(p_id);
productBasicInfoEntRemoteHome home = lookupBasicHome();
productBasicInfoEntRemote prod=home.findByPrimaryKey(ppk);
prod.setP_type_id(p_type_id);
prod.setP_name(p_name);
prod.setP_spec(p_spec);
prod.setP_model(p_model);
prod.setP_unit(p_unit);
prod.setP_image(p_image);
prod.setP_remark(p_remark);
}
catch(Exception e){
System.out.println("err at product.productSecBean.mod_prod_pk(..):"+e);
res=false;
}
return res;
}
public void in_prod_pb(String p_id, float p_tax, int p_amount, int p_maxlow, float p_bprice, float p_sprice, String p_state, String p_depositary) {
/**@todo Complete this method*/
try{
prod_pb_infoEntRemoteHome homedd=lookupPbInfo();
homedd.create( p_id, p_tax, p_amount, p_maxlow, p_bprice, p_sprice, p_state, p_depositary);
}
catch(Exception e){
System.out.println("err at product.productSecBean.in_prod_pb(..):"+e);
}
}
public boolean mod_prod_pb(String pid, float tax, int amount, int maxlow, float bprice, float sprice, String state, String depositary) {
/**@todo Complete this method*/
boolean res=true;
try{
prod_pb_infoEntPK pk=new prod_pb_infoEntPK(pid);
prod_pb_infoEntRemoteHome homedd=lookupPbInfo();
prod_pb_infoEntRemote pb=homedd.findByPrimaryKey(pk);
pb.setP_tax(tax);
pb.setP_amount(amount);
pb.setP_maxlow(maxlow);
pb.setP_bprice(bprice);
pb.setP_sprice(sprice);
pb.setP_state(state);
pb.setP_depositary(depositary);
}
catch(Exception e){
System.out.println("err at product.productSecBean.mod_prod_pb(..):"+e);
res=false;
}
return res;
}
public boolean del_prod_pb(String pid) {
/**@todo Complete this method*/
boolean res=true;
try{
prod_pb_infoEntPK pk=new prod_pb_infoEntPK(pid);
prod_pb_infoEntRemoteHome homedd=lookupPbInfo();
prod_pb_infoEntRemote pb=homedd.findByPrimaryKey(pk);
pb.remove();
}
catch(Exception e){
System.out.println("err at product.productSecBean.del_prod_pb(..):"+e);
res=false;
}
return res;
}
public java.util.Collection find_prod_pb_search(String type, String condition, String content) {
/**@todo Complete this method*/
//产品编号 1 ,入货日期 2 ,有效日期 3 ,大于 1 ,等于 0 ,小于 -1
Collection col=null;
try{
prod_in_stockRemoteHome home= lookupPbInStock();
if (type.equals("1")) {
//if (condition.equals("1")) {col=home.find_bid(content);}
//else if (condition.equals("0")) {col=home.find_id(content);}
//else if (condition.equals("-1")) {col=home.find_sid(content);}
}
/* else if (type.equals("2")) {
if (condition.equals("1")) {col=home.find_bbdate(DateFormat.getInstance().parse(content));}
else if (condition.equals("0")) {col=home.find_bdate(DateFormat.getInstance().parse(content));}
else if (condition.equals("-1")) {col=home.find_sbdate(DateFormat.getInstance().parse(content));}
}
else if (type.equals("3")) {
// if (condition.equals("1")) {col=home.find_bvali(DateFormat.getInstance().parse(content));}
//else if (condition.equals("0")) {col=home.find_vali(DateFormat.getInstance().parse(content));}
//else if (condition.equals("-1")) {col=home.find_svali(DateFormat.getInstance().parse(content));}
}*/
}
catch(Exception e){
System.out.println("err at product.productSecBean.find_prod_pb_search(..):"+e);
}
return col;
}
public boolean in_prod_in_stock(String pid, int serno, int num, float buyprice, String buydate, String batchno, String validity, String area, String state) {
/**@todo Complete this method*/
boolean re=true;
try{
prod_in_stockRemoteHome home =lookupPbInStock();
home.create( pid, serno, num, buyprice, buydate, batchno, validity, area, state);
//修改库存记录
prod_pb_infoEntRemoteHome phome=lookupPbInfo();
prod_pb_infoEntPK pk=new prod_pb_infoEntPK(pid);
prod_pb_infoEntRemote prod=phome.findByPrimaryKey(pk);
prod.setP_amount(prod.getP_amount()+num);
}
catch(Exception e){
re=false;
System.out.println("err at product.productSecBean.in_prod_in_stock(..):"+e);
}
return re;
}
public boolean mod_prod_in_stock(String pid, int serno, int num, float buyprice, String buydate, String batchno, String validity, String area, String state) {
/**@todo Complete this method*/
boolean re=true;
try{
prod_in_stockRemoteHome home =lookupPbInStock();
prod_in_stockPK pk=new prod_in_stockPK(pid,serno);
prod_in_stockRemote pin=home.findByPrimaryKey(pk);
int temp=pin.getNum();
pin.setNum(num);
pin.setBuyprice(buyprice);
pin.setBuydate(buydate);
pin.setBatchno(batchno);
pin.setValidity(validity);
pin.setArea(area);
//修改库存记录
prod_pb_infoEntRemoteHome phome=lookupPbInfo();
prod_pb_infoEntPK pkk=new prod_pb_infoEntPK(pid);
prod_pb_infoEntRemote prod=phome.findByPrimaryKey(pkk);
prod.setP_amount(prod.getP_amount()+num-temp);
}
catch(Exception e){
re=false;
System.out.println("err at product.productSecBean.mod_prod_in_stock(..):"+e);
}
return re;
}
public boolean del_prod_in_stock(String pid, int serno) {
/**@todo Complete this method*/
boolean re=true;
try{
prod_in_stockRemoteHome home =lookupPbInStock();
prod_in_stockPK pk=new prod_in_stockPK(pid,serno);
prod_in_stockRemote pin=home.findByPrimaryKey(pk);
int temp=pin.getNum();
pin.remove();
//修改库存记录
prod_pb_infoEntRemoteHome phome=lookupPbInfo();
prod_pb_infoEntPK pkk=new prod_pb_infoEntPK(pid);
prod_pb_infoEntRemote prod=phome.findByPrimaryKey(pkk);
prod.setP_amount(prod.getP_amount()-temp);
}
catch(Exception e){
re=false;
System.out.println("err at product.productSecBean.del_prod_in_stock(..):"+e);
}
return re;
}
public LinkedList find_prod_in_stock(String type, String condition, String content) {
/**@todo Complete this method*/
return null;
}
public int find_prod_in_stock_maxpk(String id) {
/**@todo Complete this method*/
String re=null;
try{
prod_in_stockRemoteHome home =lookupPbInStock();
prod_in_stockRemote pstock=home.find_max_serno(id);
re=pstock.getSerno();
}
catch(Exception e){
}
return null;
}
public void ejbCreate() throws CreateException {
/**@todo Complete this method*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -