📄 discardapplyaddpro.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GBK" import="imis.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.util.*,java.text.*"%><% request.setCharacterEncoding("GBK"); session=request.getSession(); userStruct user=(userStruct)session.getAttribute("user"); // Integer sortid = new Integer(request.getParameter("sortid")); if(user==null){ response.sendRedirect("../../login.html"); } else if(user.userAccess.intValue()==12||user.userAccess.intValue()==11){ try{ Context ctx = new InitialContext(); Object ref = ctx.lookup("EquipmentControllerEJB"); EquipmentControllerEJBHome equipmentControllerEJBHome = (EquipmentControllerEJBHome) PortableRemoteObject.narrow(ref, EquipmentControllerEJBHome.class); EquipmentControllerEJB equipmentControllerEJB = equipmentControllerEJBHome.create(); EquipmentDetailsStruct equipdetail = new EquipmentDetailsStruct(); EquipmentJBean equipment = new EquipmentJBean(); equipment=(EquipmentJBean)session.getAttribute("equipment"); equipdetail=(EquipmentDetailsStruct)session.getAttribute("equipdetails"); String manufacturer = request.getParameter("manufacturer"); String discardreason = request.getParameter("discardreason"); Integer year = new Integer(request.getParameter("year")) ; Integer month = new Integer(request.getParameter("month")) ; Integer day = new Integer(request.getParameter("day")) ; discardapplyStruct discardappstr = new discardapplyStruct(); java.util.Date today = new java.util.Date(); discardappstr.applyid = today.toString()+"/"+user.unitid.toString(); discardappstr.deviceid = equipment.getDeviceid(); discardappstr.name = equipdetail.getName(); Integer kind = equipdetail.getType(); String kinds = ""; if (kind.intValue()==1) kinds="VTS备件"; if (kind.intValue()==2) kinds="航标设备及备件"; if (kind.intValue()==3) kinds="AIS系统及备件"; if (kind.intValue()==4) kinds="测绘设备及备件"; if (kind.intValue()==5) kinds="其它设备"; discardappstr.kinds = kinds; discardappstr.manufacturer = manufacturer; discardappstr.discardreason = discardreason; discardappstr.uptime = new java.sql.Date (year.intValue()-1900,month.intValue()-1,day.intValue()); if(user.userAccess.intValue() == 12) discardappstr.replied = new Integer(1); else discardappstr.replied = new Integer(0); discardappstr.unitid = user.unitid;//获取申报单位 Context psctx=new InitialContext(); Object psref=psctx.lookup("OfficeUnitController"); OfficeUnitControllerHome officeUnitControllerHome=(OfficeUnitControllerHome) PortableRemoteObject.narrow(psref,OfficeUnitControllerHome.class); OfficeUnitController officeUnitController=officeUnitControllerHome.create(); Collection coll =officeUnitController.getUnitid(user.unitid); Iterator qq = coll.iterator(); officeUnitStruct officestr = new officeUnitStruct(); if(qq.hasNext()){ officestr = (officeUnitStruct)qq.next(); } discardappstr.unit =officestr.processname;//获取设备价值 /* Context htctx=new InitialContext(); Object htref=htctx.lookup("HandtakeController"); HandtakeControllerHome handtakeControllerHome=(HandtakeControllerHome) PortableRemoteObject.narrow(htref,HandtakeControllerHome.class); HandtakeController handtakeController=handtakeControllerHome.create(); HandtakeJBean handtake = handtakeController.getHandByHandid(equipment.getHandtakeid()); Double mode = handtake.price_usd;*/ discardappstr.mode = equipdetail.price.toString();//mode.toString();//往discardapply表写记录 Context disctx=new InitialContext(); Object disref=disctx.lookup("DiscardController"); DiscardControllerHome discardControllerHome=(DiscardControllerHome) PortableRemoteObject.narrow(disref,DiscardControllerHome.class); DiscardController discardController=discardControllerHome.create(); boolean ok=false; ok = discardController.addDiscardApply(discardappstr);//修改equipment表的status值 if(ok){ EquipmentJBean str = new EquipmentJBean(); str = equipmentControllerEJB.getEquipmentByDeviceid(equipment.getDeviceid()); String deid = str.getDeviceid(); str.setStatus(new Integer(4)); ok = equipmentControllerEJB.editEquipment(deid,str); } response.sendRedirect("discardapplylist.jsp");%><% } catch(Exception e){ e.printStackTrace(); response.sendRedirect("../../error/adderror.html"); } }else{ response.sendRedirect("../../error/access.html"); }%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -