JBOSS 点滴

丰丰的博客

仓库多选

最近虽然很忙,但做的东东如果不留点底,肯定又会忘记这些东东了.

最近做了个日库存仓库多选,现把步骤写下:
1:;先在JSP页面写:
<script language = "javascript"
src="../../findall/find_dayware/js/find_ware.js"></script>
2:在JSP页面调用函数:
  <input  style="width:220" name = "ware_name" type = "input" class = "input2" value=""     onkeydown="keyenter(myform,this)"  nullable="y" datatype='' cname="仓库名称" readonly><img style="cursor:hand" src="../../images/jt002b.gif" onclick =  "find_ware(myform.ware_code,myform.ware_name,myform.addr,myform.waretype)"readonly>
3:进入find_dayware页面
4:JS页面:
function find_ware(code,name,addr,ware_type){
    var url,getfields;
    url="../../findall/find_dayware/find_ware_operation.jsp";
    getfields=openwindow_find(url);
 if(typeof(getfields)!="undefined"){
  if(getfields.length != 0){ 
         code.value = getString(getfields,1);
   name.value = getString(getfields,2);
   addr.value = getString(getfields,3);
   ware_type.value = getString(getfields,4);
  }
 }
}
//这就是选定调用函数以"|"区分开.
function sele_all(){
 var is_checked = false;
 var strurl="";
 var strware="";

 obj_chk=window.parent.record_list_f.document.all("chk");
 if(obj_chk){
    if(typeof(obj_chk.length)!="undefined"){
      for(inti=0;inti<obj_chk.length;inti++){
        if(obj_chk[inti].checked){
    strurl+=getString(obj_chk[inti].value,1);
    strware+=";"+getString(obj_chk[inti].value,2);

    is_checked = true;
        }
      }      
    }else{
   if(obj_chk.checked){
    strurl+=getString(obj_chk.value,1);
    strware+=getString(obj_chk.value,2);
    is_checked = true;
   }
    }  
    if(is_checked){
     str=strurl+"|"+strware+"|||";
     window.parent.returnValue =str;
              window.parent.close();
              return;
    }
 }
}

这样选定后仓库编码和仓库名称带出来了但需要区分开来,我们仓库编码是二位组成,那么我们需要区分:
if(ware_code.length()>0){
if(ware_code.length()==2){
 sqlwhere+=" and ware_code in('"+ware_code+"')";
}else{
 for(int i=0;i<=ware_code.length();i++){
  if(i+2<ware_code.length()){
     strwarecode =strwarecode+ "'"+ware_code.substring(i,i+2)+"',";
  }else if(i+4>ware_code.length()){
   strwarecode =strwarecode+ "'"+ware_code.substring(i,i+2)+"'";
   i=ware_code.length();
  }
  i=i+1;


 }
    sqlwhere+=" and ware_code in("+strwarecode+")";
}
}
这样问题就解决了...

posted on 2006-11-29 10:39 半导体 阅读(189) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: