package com.cctv.nsp.console.action.tape; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.actl.msp.manager.java.TLManagerServiceLocator; import com.actl.msp.manager.java.TLManagerSoapBindingStub; import com.actl.msp.manager.java.TL_LibraryRequestInformation; import com.actl.msp.manager.java.TapeLibraryServiceLocator; import com.actl.msp.manager.java.TapeLibrarySoapBindingStub; import com.cctv.nsp.console.action.BaseAction; import com.cctv.nsp.console.bean.TapeinstockBean; import com.cctv.nsp.console.form.TapeinfoForm; import com.cctv.nsp.console.page.PageHelper; import com.cctv.nsp.console.page.Pagenation; import com.cctv.nsp.console.thread.TapeInLibraryThread; import com.cctv.nsp.console.util.DateUtil; import com.cctv.nsp.console.util.Log; import com.cctv.nsp.console.util.PublicData; import com.cctv.nsp.console.util.TapeInstockpars; import com.cctv.nsp.console.util.Util; import com.cctv.nsp.console.web.service.ServiceFactory; import com.cctv.nsp.console.web.service.TapeManageDao; import com.cctv.nsp.manager.NspManagerServiceLocator; import com.cctv.nsp.manager.NspManagerSoapBindingStub; import com.cctv.nsp.manager.TaskOption; import com.cctv.nsp.manager.TaskResponseInfo; /** * @songzh * 2008 **/ @SuppressWarnings("unchecked") public class TapeAction extends BaseAction { public static final int NTMS_LM_INJECT=12; public ActionForward showMain(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ return mapping.findForward("rightMain"); } public ActionForward showLeft(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ List lTls=null; List tapeStock=null; List RequestInfo=null; try{ lTls=ServiceFactory.getTapeManager().getTapeLibraries(); tapeStock=ServiceFactory.getTapeManager().getTapestocks(); RequestInfo=ServiceFactory.getTapeManager().getRequestTapeInfo(); request.setAttribute("tapeLibrary",lTls); request.setAttribute("tapeStock", tapeStock); request.setAttribute("RequestInfo", RequestInfo); }catch(Exception ex){ Log.writeMessage("",this.getClass(), "showLeft()", Log.getExceptionMsg(ex)); //Log.writeEventLogs(0, PublicData.logLevel, PublicData.logType, "登录系统"); } return mapping.findForward("left"); } public ActionForward selTape(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ Pagenation pagenation; long tapeLibraryID=-1; String tlHostName=""; String selFlag=""; String strTapepools=""; String strUsergroups=""; TapeinfoForm tiForm=null; try{ tlHostName=getRequest1(request)[1]; tapeLibraryID=Long.parseLong(getRequest1(request)[0]); tiForm=(TapeinfoForm)form; strTapepools=getRequest1(request)[3]; strUsergroups=getRequest1(request)[4]; pagenation = ServiceFactory.getTapeManager().getTapelist(getPagenation(request,"tiForm"),tiForm,tapeLibraryID); //获取分页工具条 String pageToolBar = new PageHelper().getPageString(pagenation, this.servlet.getServletContext(), "tapeManage.do?method=getTapeList", request.getContextPath()); setRequest(request, pagenation,tapeLibraryID,tlHostName,selFlag,strTapepools,strUsergroups,pageToolBar); request.getSession().setAttribute("tiForm0", tiForm); }catch(Exception ex){ Log.writeMessage("",this.getClass(), "selTape()", Log.getExceptionMsg(ex)); } return mapping.findForward("tapeList"); } public ActionForward getTapeList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ Pagenation pagenation = null; long tapeLibraryID=-1; String tlHostName=""; String strTapepools=""; String strUsergroups=""; try{ tapeLibraryID=Long.parseLong(getRequest1(request)[0]); strTapepools=ServiceFactory.getTapeManager().getTapepoolStr(tapeLibraryID); strUsergroups=ServiceFactory.getTapeManager().getUsergroupStr(tapeLibraryID); pagenation=ServiceFactory.getTapeManager().getTapelist(getPagenation(request,"tiForm0"), tapeLibraryID); //获取分页工具条 String pageToolBar = new PageHelper().getPageString(pagenation, this.servlet.getServletContext(), "tapeManage.do?method=getTapeList", request.getContextPath()); tlHostName=getRequest1(request)[1]; Timestamp stime=new Timestamp(1900,0,1,0,0,0,0); request.getSession().setAttribute("stime", stime); setRequest(request, pagenation,tapeLibraryID,tlHostName,"all",strTapepools,strUsergroups,pageToolBar); saveToken(request); }catch(Exception ex){ ex.printStackTrace(); Log.writeMessage("",this.getClass(), "getTapeList()", Log.getExceptionMsg(ex)); } return mapping.findForward("tapeList"); } public ActionForward requestTapeList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ Pagenation pagenation = null; long tapeLibraryID=-1; String tlHostName=""; try{ tapeLibraryID=Long.parseLong(getRequest3(request)[0]); pagenation=ServiceFactory.getTapeManager().getRequestTapeList(getPagenation(request,"tiForm"), tapeLibraryID); //获取分页工具条 String pageToolBar = new PageHelper().getPageString(pagenation, this.servlet.getServletContext(), "tapeManage.do?method=requestTapeList", request.getContextPath()); tlHostName=getRequest3(request)[1]; setRequest(request, pagenation,tapeLibraryID,tlHostName,pageToolBar); saveToken(request); }catch(Exception ex){ ex.printStackTrace(); Log.writeMessage("",this.getClass(), "getTapeList()", Log.getExceptionMsg(ex)); } return mapping.findForward("requesttapelist"); } public ActionForward showCopyTapePage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ String ugNames=""; long lTlID=-1; Timestamp currentTime=null; Timestamp afterTime=null; try { String srcBarcode=request.getParameter("barcode1"); lTlID=(Long)request.getSession().getAttribute("tapeLibraryID"); ugNames=ServiceFactory.getTapeManager().getUserGroups(lTlID); Date lDate=new Date(System.currentTimeMillis()); currentTime=Util.getSqlTimeStamp(lDate); Date aDate=new Date(System.currentTimeMillis()+24*60*60*1000*3); afterTime=Util.getSqlTimeStamp(aDate); request.setAttribute("currentTime", currentTime); request.setAttribute("afterTime", afterTime); request.setAttribute("srcBarcode",srcBarcode); request.setAttribute("ugNames", ugNames); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.writeMessage("",this.getClass(), "showCopyTapePage()", Log.getExceptionMsg(e)); } return mapping.findForward("copytapelib"); } public ActionForward showRepackTapePage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ String ugNames=""; long lTlID=-1; Timestamp currentTime=null; Timestamp afterTime=null; try { String srcBarcode=request.getParameter("barcode1"); lTlID=(Long)request.getSession().getAttribute("tapeLibraryID"); ugNames=ServiceFactory.getTapeManager().getUserGroups(lTlID); Date lDate=new Date(System.currentTimeMillis()); currentTime=Util.getSqlTimeStamp(lDate); Date aDate=new Date(System.currentTimeMillis()+24*60*60*1000*3); afterTime=Util.getSqlTimeStamp(aDate); request.setAttribute("currentTime", currentTime); request.setAttribute("afterTime", afterTime); request.setAttribute("srcBarcode",srcBarcode); request.setAttribute("ugNames", ugNames); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.writeMessage("",this.getClass(), "showRepackTapePage()", Log.getExceptionMsg(e)); } return mapping.findForward("repacktapelib"); } public ActionForward copyTape(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ int isCopy=1; String srcBarcode=""; String desBarcode=""; String desGroupName=""; String logMsg=""; try { srcBarcode=((TapeinfoForm)form).getSrcBarcode(); desBarcode=((TapeinfoForm)form).getDesBarcode(); desGroupName=((TapeinfoForm)form).getDesGroupName(); Timestamp staTime=((TapeinfoForm)form).getStaTime(); Timestamp baseTime=((TapeinfoForm)form).getBaseTime(); int priority=((TapeinfoForm)form).getPriority(); TaskOption to = new TaskOption(DateUtil.timestamp2Calendar(staTime),DateUtil.timestamp2Calendar(baseTime),priority); NspManagerSoapBindingStub nmb = (NspManagerSoapBindingStub)new NspManagerServiceLocator(). getNspManager(PublicData.nspUrl); TaskResponseInfo tri=nmb.copyTape("", srcBarcode, desBarcode, desGroupName, to); Log.println("", "copyTape:status="+tri.getStatus()+","+tri.getDescription()); if(tri.getStatus()==0){ isCopy=0; logMsg="发送磁带复制任务成功!"; }else{ isCopy=1; logMsg="发送磁带复制任务失败!"; } Log.writeEventLogs(0, PublicData.logLevel, PublicData.logType, logMsg); request.setAttribute("isCopy", isCopy); } catch (Exception e) { e.printStackTrace(); Log.writeMessage("",this.getClass(), "copyTape()", Log.getExceptionMsg(e)); isCopy = 1; } // request.setAttribute("isCopy", new Boolean(isCopy)); return mapping.findForward("copytape"); } public ActionForward repackTape(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ int isRepack=1; String srcBarcode=""; String desBarcode=""; String desGroupName=""; int iFormatSrcTape=-1; boolean formatSrcTape=false; String logMsg=""; try { TapeinfoForm tiForm=(TapeinfoForm)form; srcBarcode=((TapeinfoForm)form).getSrcBarcode(); desBarcode=((TapeinfoForm)form).getDesBarcode(); desGroupName=((TapeinfoForm)form).getDesGroupName(); iFormatSrcTape=((TapeinfoForm)form).getIformatsrctape(); if(iFormatSrcTape==0){ formatSrcTape=false; }else if(iFormatSrcTape==1){ formatSrcTape=true; } Timestamp staTime=((TapeinfoForm)form).getStaTime(); Timestamp baseTime=((TapeinfoForm)form).getBaseTime(); int priority=((TapeinfoForm)form).getPriority(); TaskOption to = new TaskOption(DateUtil.timestamp2Calendar(staTime),DateUtil.timestamp2Calendar(baseTime),priority); NspManagerSoapBindingStub nmb = (NspManagerSoapBindingStub)new NspManagerServiceLocator(). getNspManager(PublicData.nspUrl); TaskResponseInfo tri=nmb.repackTape("", srcBarcode, desBarcode, desGroupName, formatSrcTape, to); Log.println("", "repackTape:status="+tri.getStatus()+","+tri.getDescription()); if(tri.getStatus()==0){ isRepack=0; logMsg="发送磁带整理任务成功!"; }else{ isRepack=1; logMsg="发送磁带整理任务失败!"; } Log.writeEventLogs(0, PublicData.logLevel, PublicData.logType, logMsg); request.setAttribute("isRepack", isRepack); } catch (Exception e) { e.printStackTrace(); Log.writeMessage("",this.getClass(), "repackTape()", Log.getExceptionMsg(e)); isRepack = 1; } // request.setAttribute("isCopy", new Boolean(isCopy)); return mapping.findForward("repacktape"); } public ActionForward getDesBarcodes(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String desUserGroup=""; String desBars=""; try { desUserGroup=request.getParameter("desGroupName"); desBars=ServiceFactory.getTapeManager().getDesBarcode(desUserGroup); response.getWriter().write(desBars); } catch (Exception ex) { ex.printStackTrace(); Log.writeMessage("",this.getClass(), "getDesBarcodes()", Log.getExceptionMsg(ex)); } return null; } public ActionForward getTapeInstock(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ Pagenation pagenation=null; long rackNum=0; String strTlHosts=""; String strTapepools=""; try{ rackNum=Long.parseLong(getTapeinStockRequest(request)[0]); strTlHosts=ServiceFactory.getTapeManager().getTlHosts(rackNum); strTapepools=ServiceFactory.getTapeManager().getTapepoolStrInstock(rackNum); pagenation = ServiceFactory.getTapeManager().getTapeinstock(getPagenation(request,"tiForm0"),rackNum); //获取分页工具条 String pageToolBar = new PageHelper().getPageString(pagenation, this.servlet.getServletContext(), "tapeManage.do?method=getTapeInstock", request.getContextPath()); setTapeInstockRequest(request, pagenation,rackNum,strTlHosts,strTapepools,pageToolBar); saveToken(request); }catch(Exception ex){ ex.printStackTrace(); Log.writeMessage("",this.getClass(), "getTapeInstock()", Log.getExceptionMsg(ex)); } return mapping.findForward("tapestock"); } public ActionForward selTapeInstock(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ Pagenation pagenation; long rackNum=0; String strTlHosts=""; String strTapepools=""; TapeinfoForm tiForm=null; try{ rackNum=Long.parseLong(getTapeinStockRequest(request)[0]); tiForm=(TapeinfoForm)form; strTlHosts=this.getTapeinStockRequest(request)[1]; strTapepools=this.getTapeinStockRequest(request)[2]; pagenation = ServiceFactory.getTapeManager().getTapestocks(getPagenation(request,"tiForm"),tiForm,rackNum); //获取分页工具条 String pageToolBar = new PageHelper().getPageString(pagenation, this.servlet.getServletContext(), "tapeManage.do?method=getTapeInstock", request.getContextPath()); this.setTapeInstockRequest(request, pagenation, rackNum, strTlHosts,strTapepools, pageToolBar); request.getSession().setAttribute("tiForm0", tiForm); strTlHosts=(String)request.getSession().getAttribute("strTlHosts"); }catch(Exception ex){ Log.writeMessage("",this.getClass(), "selTapeInstock()", Log.getExceptionMsg(ex)); } return mapping.findForward("tapestock"); } public ActionForward getPortCount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String tlHostName = ""; int portCount=0; try { tlHostName = request.getParameter("tlHostName"); request.getSession().setAttribute("tlHostName", tlHostName); portCount = this.getPortCount(tlHostName); response.getWriter().write(portCount+""); } catch (Exception ex) { ex.printStackTrace(); Log.writeMessage("",this.getClass(), "getPortCount()", Log.getExceptionMsg(ex)); } return null; } public ActionForward tapeIntoLib(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ int intcount=1; TapeLibrarySoapBindingStub tlsW=null; List StrLib=new ArrayList(); String ActionType=""; boolean bReturn=false; while(true){ String barcode="barcode"+intcount; if( request.getParameter(barcode)==null || request.getParameter(barcode).equals("")) { break; } String tt=(String)request.getParameter(barcode); System.out.println("barcode="+tt); StrLib.add(tt); intcount++; } request.getSession().setAttribute("TapeInBarcode",StrLib); try{ TLManagerSoapBindingStub tls = (TLManagerSoapBindingStub) new TLManagerServiceLocator().getTLManager(PublicData.urlServer); String hostname=(String)request.getSession().getAttribute("tlHostName"); String strUrl=tls.getTapeLibraryByName(hostname).getURL(); java.net.URL url= new java.net.URL(strUrl) ; tlsW=(TapeLibrarySoapBindingStub)new TapeLibraryServiceLocator().getTapeLibrary(url); bReturn = tlsW.injectMedia(true); Log.println("","TapeInLibAction tlsW.injectMedia(true):"+bReturn); ActionType = "DoneOK"; }catch(Exception ex) { ex.printStackTrace(); Log.writeMessage("",this.getClass(), "tapeIntoLib()", Log.getExceptionMsg(ex)); } request.setAttribute("TapeInLib",ActionType); return mapping.findForward("tapeintolib"); } public ActionForward tapeInLibProc(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ ArrayList aList = null; boolean bRoot = false; TapeManageDao tape = null; String ActionType = ""; LinkedList list=new LinkedList(); TapeInLibraryThread tapeinThread=null; TL_LibraryRequestInformation queuebean=null; HttpSession lSession = request.getSession(false); if (lSession.getAttribute("userName") == null) { return mapping.findForward("relogin"); } try { TapeLibrarySoapBindingStub tlsW = null; TLManagerSoapBindingStub tls = (TLManagerSoapBindingStub) new TLManagerServiceLocator().getTLManager(PublicData.urlServer); String hostname = (String) request.getSession().getAttribute( "tlHostName"); String strUrl = tls.getTapeLibraryByName(hostname).getURL(); java.net.URL url = new java.net.URL(strUrl); tlsW = (TapeLibrarySoapBindingStub)new TapeLibraryServiceLocator(). getTapeLibrary(url); bRoot=tlsW.injectMedia(false); Log.println("","TapeInLibProcAction tlsW.injectMedia(false):" + bRoot); Log.writeEventLogs(0, PublicData.logLevel, PublicData.logType, "入库"); tape = new TapeManageDao(); tlsW.refresh(); int reqCount= tlsW.getLibraryRequestCount(); for(int i=reqCount-1;i>=0;i--) { queuebean=new TL_LibraryRequestInformation(); queuebean=tlsW.getLibraryRequest(i); if(queuebean.getOperationState()==NTMS_LM_INJECT)//injectMedia request { bRoot=true; int intState=tlsW.getLibraryRequest(i).getState(); Log.println("","TapeInLibProcAction LibraryRequestState="+intState); if(intState == 1 || intState== 0 || intState==5){ String strGUID=tlsW.getLibraryRequest(i).getInfo().getSzObjectGuid(); list.add(strGUID); Log.println("","TapeInLibProcAction list size="+list.size()); tapeinThread=new TapeInLibraryThread(list,url); if(PublicData.intTapeInCount==0){ PublicData.intTapeInCount=1; tapeinThread.start(); Log.println("","TapeInLibProcAction The thread Start..."); } } else { int mediaCount= tlsW.getMediaCount(); String [] arrLibrBarcode=new String[mediaCount]; Log.println("","TapeInLibProcAction Library Media:" ); for(int j=0;j<mediaCount;j++) { arrLibrBarcode[j]=tlsW.getMedia(j).getSzBarCode(); Log.println("",arrLibrBarcode[j]); } aList=tape.getAllTape(); String[] arrDataBarcode=new String[aList.size()]; arrDataBarcode=(String [])aList.toArray(arrDataBarcode); String [] newBarcode=tape.compareArray(arrLibrBarcode,arrDataBarcode); for(int k=0;k<newBarcode.length;k++) { String strBarcode=(String)newBarcode[k]; long nTapeID = tape.GetTapeID(strBarcode); tape.AddTapeInLib(nTapeID); } } } if(bRoot) break; } ActionType = "DoneOK"; // if (bRoot) { // aList = (ArrayList) request.getSession().getAttribute( // "TapeInBarcode"); // for (int i = 0; i < aList.size(); i++) { // String strBarcode = (String) aList.get(i); // int nTapeID = tape.GetTapeID(strBarcode); // tape.AddTapeInLib(nTapeID); // ActionType = "DoneOK"; // } // } // else { // ActionType = "DoneFail"; // } } catch (Exception ex) { ActionType = "DoneFail"; Log.println("","TapeInLibProcAction " + ex.toString()); } request.setAttribute("TapeInLib", ActionType); return mapping.findForward("tapeinlibend"); } public ActionForward showTapeOutLibPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ return mapping.findForward("tapeoutlib"); } public ActionForward tapeOutLib(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ int BarcodeCount=0; int intPortCount=0; String Strbarcode=""; String ActionType=""; boolean bRoot=false; TapeinstockBean tapestock=null; TapeLibrarySoapBindingStub tlsW=null; HttpSession lSession=request.getSession(false); try{ TLManagerSoapBindingStub tls = (TLManagerSoapBindingStub) new TLManagerServiceLocator().getTLManager(PublicData.urlServer); String hostname=(String)request.getSession().getAttribute("tlHostName"); String strUrl=tls.getTapeLibraryByName(hostname).getURL(); java.net.URL url= new java.net.URL(strUrl) ; tlsW=(TapeLibrarySoapBindingStub)new TapeLibraryServiceLocator().getTapeLibrary(url); intPortCount=tlsW.getPortCount(); String[] Soutbarcode=(String[])request.getParameterValues("barcodelist"); request.getSession().setAttribute("ArryBarcode",Soutbarcode); BarcodeCount=Soutbarcode.length; String instockDes=request.getParameter("description"); request.getSession().setAttribute("instockDes", instockDes); if(BarcodeCount>intPortCount) { // String strMsg="所选择出库的磁带数大于磁带库的IO槽数,请重新选择!"; ActionType="BigSlot"; request.setAttribute("tapestate",ActionType); return mapping.findForward("tapeoutlib"); } Log.println("","TapeOutLibAction BarcodeCount="+BarcodeCount); for (int i = 0; i <BarcodeCount; i++) { Strbarcode = (String) Soutbarcode[i]; Log.println("","TapeOutLibAction Soutbarcode :"+Strbarcode+"/r/n" ); int intMediaState=tlsW.getMediaByBarcode(Strbarcode).getMediaState();//已经装载的状态 if(intMediaState==3){ ActionType="MediaState"; request.setAttribute("strMedia",Strbarcode); break; } long tapeID = ServiceFactory.getTapeManager().getTapeByBarcode(Strbarcode).getTapeid(); tapestock=ServiceFactory.getTapeManager().getTapeinstockById(tapeID); if(tapestock!=null){ if (ServiceFactory.getTapeManager().isPositionUsed(tapestock)) { ActionType = "PosUsed"; break; } } if (!ServiceFactory.getTapeManager().isTapeFree(Strbarcode)) { ActionType = "NoFree"; break; } if (ServiceFactory.getTapeManager().isFileLocked(Strbarcode)) { ActionType = "FileLock"; break; } boolean flage=tlsW.queueEjectMediaByBarcode(Strbarcode); Log.println("",Strbarcode+"tapeout queueEjectMediaByBarcode("+Strbarcode+")="+flage); if(!flage) { ActionType = "DoneFail"; break; } } if(ActionType.equals("")){ return mapping.findForward("tapeoutnext"); } request.setAttribute("tapestate", ActionType); Log.println("","TapeState--->tapeoutlib.jsp"+request.getAttribute("tapestate")); }catch(Exception ex){ ActionType="DoneFail"; request.setAttribute("tapestate", ActionType); Log.writeMessage("", this.getClass(), "tapeOutLib()", Log .getExceptionMsg(ex)); } return mapping.findForward("tapeoutlib"); } public ActionForward tapeOutLibNext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ TapeLibrarySoapBindingStub tlsW = null; String ActionType = ""; HttpSession lSession = request.getSession(false); if (lSession.getAttribute("userName") == null) { return mapping.findForward("relogin"); } try { TLManagerSoapBindingStub tls = (TLManagerSoapBindingStub) new TLManagerServiceLocator().getTLManager(PublicData.urlServer); String hostname = (String) request.getSession().getAttribute( "tlHostName"); String strUrl = tls.getTapeLibraryByName(hostname).getURL(); java.net.URL url = new java.net.URL(strUrl); tlsW = (TapeLibrarySoapBindingStub)new TapeLibraryServiceLocator(). getTapeLibrary(url); boolean bRoot = tlsW.ejectMediaByBarCode(null, true); Log.println("","tapeout ejectMediaByBarCode(null,true)=" + bRoot); // bRoot=true;????????? if (bRoot) { return mapping.findForward("tapeoutlibproc"); } else { ActionType = "DoneFail"; } request.setAttribute("tapestate", ActionType); Log.println("","TapeState--->tapeoutlib.jsp" + request.getAttribute("tapestate")); } catch (Exception ex) { ex.printStackTrace(); ActionType = "DoneFail"; request.setAttribute("tapestate", ActionType); Log.writeMessage("", this.getClass(), "tapeOutLibNext()", Log .getExceptionMsg(ex)); } return mapping.findForward("tapeoutlib"); } public ActionForward tapeOutLibProc(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ long InStoreyNum = 0; long InRackNum = 0; long InRoomNum = 0; long InRowNum = 0; long InColNum = 0; int BarcodeCount = 0; String ActionType = ""; TapeinstockBean[] Soutbarcode = null; try { /* String StrStoreyNum=(String)request.getSession().getAttribute("StoreyNum"); InStoreyNum= Integer.parseInt(StrStoreyNum); String StrRackNum=(String)request.getSession().getAttribute("StrRackNum"); InRackNum=Integer.parseInt(StrRackNum); String StrRoomNum=(String)request.getSession().getAttribute("StrRoomNum"); InRoomNum=Integer.parseInt(StrRoomNum); String StrRowNum=(String)request.getSession().getAttribute("StrRowNum"); InRowNum=Integer.parseInt(StrRowNum); String StrColNum=(String)request.getSession().getAttribute("StrColNum"); InColNum=Integer.parseInt(StrColNum);*/ String[] Libarcode = (String[]) request.getSession().getAttribute( "ArryBarcode"); BarcodeCount = Libarcode.length; TLManagerSoapBindingStub tls = (TLManagerSoapBindingStub) new TLManagerServiceLocator().getTLManager(PublicData.urlServer); String hostname = (String) request.getSession().getAttribute( "tlHostName"); String strUrl = tls.getTapeLibraryByName(hostname).getURL(); java.net.URL url = new java.net.URL(strUrl); TapeLibrarySoapBindingStub tlsW = (TapeLibrarySoapBindingStub) new TapeLibraryServiceLocator().getTapeLibrary(url); boolean bRoot = tlsW.ejectMediaByBarCode(null, false); Log.println("","TapeOutLibProcAction tlsW.ejectMediaByBarCode:" + bRoot); // if(bRoot){ TapeInstockpars ts = new TapeInstockpars(); long MaxStoreynum = Integer.parseInt(ts.storeynum); long MaxRoomnum = Integer.parseInt(ts.roomnum); long MaxRacknum = Integer.parseInt(ts.racknum); long MaxRownum = Integer.parseInt(ts.rownum); long MaxColnum = Integer.parseInt(ts.colnum); Soutbarcode = new TapeinstockBean[BarcodeCount]; for (int i = 0; i < BarcodeCount; i++) { String strBarcode = (String) Libarcode[i]; long nTapeID = ServiceFactory.getTapeManager().getTapeByBarcode(strBarcode).getTapeid(); TapeinstockBean tapeStock = ServiceFactory.getTapeManager().getMaxTapeInStock(nTapeID); InColNum = tapeStock.getColnum(); InRowNum = tapeStock.getRownum(); InRackNum = tapeStock.getRacknum(); InRoomNum = tapeStock.getRoomnum(); InStoreyNum = tapeStock.getStoreynum(); if (InColNum > MaxColnum) { InRowNum++; InColNum = 0; if (InRowNum > MaxRownum) { InRackNum++; InRowNum = 0; if (InRackNum > MaxRacknum) { InRoomNum++; InRackNum = 0; if (InRoomNum > MaxRoomnum) { InStoreyNum++; InRoomNum = 0; } } } } // int nTapeID = tape.GetTapeID(StrBarcode); String strLastStoringtime = Util.getTimeStamp(); String instockDes=(String)request.getSession().getAttribute("instockDes"); ServiceFactory.getTapeManager().addTapeInStock(nTapeID, InStoreyNum, InRackNum, InRoomNum, InRowNum, InColNum, strLastStoringtime,instockDes); Log.writeEventLogs(0, PublicData.logLevel, PublicData.logType, "出库"); TapeinstockBean tsb = new TapeinstockBean(); tsb.setBarcode(strBarcode); tsb.setStoreynum(InStoreyNum); tsb.setRoomnum(InRoomNum); tsb.setRacknum(InRackNum); tsb.setRownum(InRowNum); tsb.setColnum(InColNum); Soutbarcode[i] = tsb; // InColNum++; } request.setAttribute("SoutBarcode", Soutbarcode); } catch (Exception ex) { ex.printStackTrace(); Log.writeMessage("", this.getClass(), "tapeOutLibProc()", Log .getExceptionMsg(ex)); } return mapping.findForward("tapeoutlibend"); } } test 2010-09-01 09:07:21