/** * . * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse * @return ActionForward */ public ActionForward list( final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) { String forward = "success"; String callback = request.getParameter("callback"); String pkgType = request.getParameter("pkgType") != null ? request.getParameter("pkgType") : ""; String prodCode = request.getParameter("prodCode"); String projCode = request.getParameter("projCode"); List<Map<String, Object>> selectList = new ArrayList<Map<String, Object>>(); if (pkgType.equalsIgnoreCase("303")) { CogDao cogDao = new CogDao(); selectList = cogDao.findBy(prodCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("304")) { TradPkgDao tradPkgDao = new TradPkgDao(); selectList = tradPkgDao.findByProjCode(projCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("305")) { // add new packType CspDao cspDao = new CspDao(); selectList = cspDao.findByProjCode(projCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("306")) { RwDao rwDao = new RwDao(); selectList = rwDao.findBy(prodCode); // System.out.println(selectList); } else if (pkgType.equalsIgnoreCase("314")) { TsvDao tsvDao = new TsvDao(); selectList = tsvDao.findPkgCode(prodCode); // System.out.println(selectList); } else { IcTapeDao icTapeDao = new IcTapeDao(); selectList = icTapeDao.findByProdCode(prodCode); // System.out.println(selectList); } request.setAttribute("selectList", selectList); request.setAttribute("callback", callback); return mapping.findForward(forward); }
@Override public ActionForward execute( ActionMapping arg0, ActionForm arg1, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception { PrintWriter out = arg3.getWriter(); IcTapeDao icTapeDao = new IcTapeDao(); String prodName = arg2.getParameter("prodName"); String pkgCode = arg2.getParameter("pkgCode"); String pkgVersion = arg2.getParameter("pkgVersion"); String tapeName = arg2.getParameter("tapeName"); String tapeVariant = arg2.getParameter("tapeVariant") != null && !arg2.getParameter("tapeVariant").equals("") ? arg2.getParameter("tapeVariant") : ""; if (tapeVariant.equals("")) { // Create a new variant String maxVar = (String) icTapeDao.findMaxVar(prodName, pkgCode, pkgVersion); if (maxVar != null) { String preVar = maxVar.toString(); if (preVar != null && !preVar.equals("")) { char c = (char) ((int) preVar.charAt(0) + 1); String realVar = ""; if (c > 57 && c < 65) { realVar = new String(new char[] {65}); } else if (c > 90) { // realVar = new String(new char[]{48}); out.print("varianterror"); return null; } else { realVar = new String(new char[] {c}); } tapeVariant = realVar; } } else { tapeVariant = "0"; } } if (prodName.length() >= 8) { prodName = prodName.substring(2, 6) + prodName.charAt(7); } else if (prodName.length() >= 6) { prodName = prodName.substring(2, 6) + "0"; } else { out.print("prodnameerror"); return null; } int pkgLen = pkgVersion.length(); for (int i = 0; i < 2 - pkgLen; i++) { pkgVersion = pkgVersion + "0"; } if (pkgVersion == null || pkgVersion.equals("")) { out.print("pkgversionerror"); return null; } if (pkgCode == null || pkgCode.equals("")) { out.print("pkgcodeerror"); return null; } String materialNum = "P" + prodName + pkgCode + pkgVersion + tapeVariant; IcTapeTo icTapeTo = icTapeDao.findByPrimaryKey(materialNum, tapeName); if (icTapeTo == null) { out.print("false"); } else { out.print("true"); } return null; }
/** * Do action performance. * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse * @return ActionForward * @throws Exception exception */ public ActionForward execute( final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception { String prodCode = request.getParameter("prodCode"); IcTapeDao icTapeDao = new IcTapeDao(); CogDao cogDao = new CogDao(); SapMasterCustomerDao sapMasterCustomerDao = new SapMasterCustomerDao(); List<String> custList = new ArrayList<String>(); List<String> extCustList = new ArrayList<String>(); String custs = ""; custList.addAll(icTapeDao.findCustByProdCode(prodCode)); // custList.addAll(cogDao.findCustByProdCode(prodCode)); for (String s : custList) { if (!extCustList.contains(s) && StringUtils.isNotEmpty(s)) { extCustList.add(s); } } for (String s : extCustList) { if (s != null && !s.equals("") && !s.equals("null")) { SapMasterCustomerTo sapMasterCustomerTo = sapMasterCustomerDao.findByVendorCode(s); if (sapMasterCustomerTo != null && StringUtils.isNotEmpty(sapMasterCustomerTo.getShortName())) { custs += "/" + sapMasterCustomerTo.getShortName(); } } } if (custs.length() > 0) { custs = custs.substring(1); } List<String> cogCust = cogDao.findCustByProdCode(prodCode); extCustList = new ArrayList<String>(); if (cogCust != null && cogCust.size() > 0) { for (String s : cogCust) { if (!extCustList.contains(s) && StringUtils.isNotEmpty(s)) { extCustList.add(s); } } } for (String s : extCustList) { custs += "/" + s; } if (custs.endsWith("/")) { custs = custs.substring(0, custs.length()); } PrintWriter out = response.getWriter(); out.print(Escape.escape(custs)); return null; }