/** * @param req HttpServletRequest * @param res HttpServletResponse * @throws ServletException * @throws IOException */ public void performTask(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String forwardURL = ""; Message message = SessionUtil.getMessage(req); Connection conn = null; try { SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req); Request2DTO req2DTO = new Request2DTO(); req2DTO.setDTOClassName(EamDhCheckLineDTO.class.getName()); EamDhCheckLineDTO dto = (EamDhCheckLineDTO) req2DTO.getDTO(req); String action = dto.getAct(); conn = getDBConnection(req); if (action.equals("")) { req.setAttribute(QueryConstant.QUERY_DTO, dto); forwardURL = LvecURLs.INS_CONFIRM_PAGE; } else if (action.equals(DzyhActionConstant.QUERY_ACTION)) { BaseSQLProducer sqlProducer = new OrderLineConfirmModel(user, dto); PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer); pageDAO.setDTOClassName(EamDhCheckLineDTO.class.getName()); pageDAO.setCalPattern(LINE_PATTERN); CheckBoxProp checkProp = new CheckBoxProp("subCheck"); checkProp.addDbField("HEADER_ID"); checkProp.addDbField("BARCODE"); checkProp.addDbField("CATALOG_VALUE_ID"); checkProp.addDbField("RESPONSIBILITY_USER"); checkProp.addDbField("RESPONSIBILITY_DEPT"); checkProp.addDbField("ORDER_NO"); pageDAO.setWebCheckProp(checkProp); pageDAO.produceWebData(); req.setAttribute(QueryConstant.QUERY_DTO, dto); forwardURL = LvecURLs.INS_CONFIRM_PAGE; } else if (action.equals(DzyhActionConstant.CONFIRM_ACTION)) { // 确认 if (user.getEmployeeNumber().equals("")) { message = getMessage(LvecMessageKeys.NO_EMPLOYEE_NUMBER); message.setIsError(true); message.setNeedBack(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } else { RequestParser parser = new RequestParser(); CheckBoxProp checkProp = new CheckBoxProp("subCheck"); checkProp.setIgnoreOtherField(true); parser.setCheckBoxProp(checkProp); parser.transData(req); req2DTO.setIgnoreFields(EamCheckTaskDTO.class); req2DTO.addIgnoreField("itemName"); // req2DTO.addIgnoreField("orderNo"); DTOSet orderLines = req2DTO.getDTOSet(parser); InstruConfirmDAO confirmDAO = new InstruConfirmDAO(user, dto, conn); confirmDAO.ConfirmInstrument(orderLines); message = confirmDAO.getMessage(); forwardURL = LvecURLs.INS_CONFIRM_SERVLET; forwardURL += "?act=" + DzyhActionConstant.QUERY_ACTION; } } else { message = getMessage(MsgKeyConstant.INVALID_REQ); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } } catch (PoolPassivateException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (DTOException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.DTO_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (QueryException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.QUERY_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (UploadException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.COMMON_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (StrException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.COMMON_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (DataHandleException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.SQL_ERROR); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } finally { DBManager.closeDBConnection(conn); setHandleMessage(req, message); if (!forwardURL.equals("")) { ServletForwarder forwarder = new ServletForwarder(req, res); forwarder.forwardView(forwardURL); } } }
public void performTask(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String forwardURL = ""; Message message = SessionUtil.getMessage(req); String action = StrUtil.nullToString(req.getParameter("act")); Connection conn = null; try { SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req); AmsItemAllocateHDTO dtoParameter = null; Request2DTO req2DTO = new Request2DTO(); req2DTO.setDTOClassName(AmsItemAllocateHDTO.class.getName()); dtoParameter = (AmsItemAllocateHDTO) req2DTO.getDTO(req); conn = getDBConnection(req); OptionProducer optProducer = new OptionProducer(user, conn); if (action.equals("")) { String orderStatus = optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus()); req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus); String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo()); req.setAttribute(WebAttrConstant.INV_OPTION, invOption); forwardURL = "/nm/spare2/bjdbdy.jsp"; } else if (action.equals(WebActionConstant.QUERY_ACTION)) { BaseSQLProducer sqlProducer = new BjdbdyModel(user, dtoParameter); PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer); pageDAO.setCalPattern(CalendarConstant.LINE_PATTERN); pageDAO.produceWebData(); String orderStatus = optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus()); req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus); String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo()); req.setAttribute(WebAttrConstant.INV_OPTION, invOption); forwardURL = "/nm/spare2/bjdbdy.jsp"; } else if (action.equals(WebActionConstant.DETAIL_ACTION)) { BjswjyckDAO itemTransHDAO = new BjswjyckDAO(user, dtoParameter, conn); itemTransHDAO.setDTOClassName(AmsItemAllocateHDTO.class.getName()); AmsItemAllocateHDTO amsItemTransH = (AmsItemAllocateHDTO) itemTransHDAO.getDataByPrimaryKey(); if (amsItemTransH == null) { amsItemTransH = new AmsItemAllocateHDTO(); message = getMessage(MsgKeyConstant.DATA_NOT_EXIST); message.setIsError(true); } req.setAttribute("AIT_HEADER", amsItemTransH); String freightDate = req.getParameter("freightDate"); WebPageView wpv = new WebPageView(req, conn); wpv.setPrintProp(true); BaseSQLProducer sqlProducer = new BjswjyckModel(user, dtoParameter); wpv.produceWebData(sqlProducer.getDataByForeignKeyModel(dtoParameter.getTransId())); forwardURL = "/nm/spare2/bjdbdyDetail.jsp"; } else { message = getMessage(MsgKeyConstant.INVALID_REQ); message.setIsError(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } } catch (PoolPassivateException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR); message.setIsError(true); message.setNeedBack(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (DTOException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.DTO_ERROR); message.setIsError(true); message.setNeedBack(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (QueryException ex) { ex.printLog(); message = getMessage(MsgKeyConstant.QUERY_ERROR); message.setIsError(true); message.setNeedBack(true); forwardURL = MessageConstant.MSG_PRC_SERVLET; } catch (SQLModelException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } finally { DBManager.closeDBConnection(conn); setHandleMessage(req, message); ServletForwarder forwarder = new ServletForwarder(req, res); forwarder.forwardView(forwardURL); } }