public void insertLoanToolInfo( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PrintWriter writer = response.getWriter(); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); try { Long userId = (Long) request.getSession().getAttribute("userId"); RepairHandleBo rhBo = RepairHandleBo.getInstance(); String repairNo = request.getParameter("repairNo"); String stuffNo = request.getParameter("stuffNo"); String warrantyType = request.getParameter("warrantyType"); String applyQty = request.getParameter("applyQty"); RepairPartForm rpf = new RepairPartForm(); rpf.setRepairNo(new Long(repairNo)); rpf.setStuffNo(stuffNo); rpf.setWarrantyType(warrantyType); rpf.setApplyQty(new Integer(applyQty)); rpf.setRepairPartStatus("L"); // 已分配待领取 rpf.setRepairPartType("T"); // 携带工具 rpf.setCreateBy(userId); rpf.setCreateDate(new java.util.Date()); RepairPartForm returnRpf = rhBo.submitLoanTool(rpf); if (returnRpf != null) { String skuCode = returnRpf.getSkuCode() == null ? "" : EscapeUnescape.escape(returnRpf.getSkuCode()); String standard = returnRpf.getStandard() == null ? "" : EscapeUnescape.escape(returnRpf.getStandard()); String owner = returnRpf.getOwner() == null ? "" : EscapeUnescape.escape(returnRpf.getOwner()); writer.println("<xml>"); writer.println("<flag>true</flag>"); // System.out.println("-=-=-=-=sunhj returnRpf.getPartsId():"+returnRpf.getPartsId()); writer.println("<partsId>" + returnRpf.getPartsId() + "</partsId>"); // System.out.println("-=-=-=-=sunhj returnRpf.getStuffNo():"+returnRpf.getStuffNo()); writer.println("<stuffNo>" + returnRpf.getStuffNo() + "</stuffNo>"); // System.out.println("-=-=-=-=sunhj returnRpf.getSkuCode():"+returnRpf.getSkuCode()); writer.println("<skuCode>" + (skuCode.equals("") ? ".." : skuCode) + "</skuCode>"); // System.out.println("-=-=-=-=sunhj returnRpf.getStandard():"+returnRpf.getStandard()); writer.println("<standard>" + (standard.equals("") ? ".." : standard) + "</standard>"); // System.out.println("-=-=-=-=sunhj returnRpf.getSkuUnit():"+returnRpf.getSkuUnit()); writer.println("<skuUnit>" + EscapeUnescape.escape(returnRpf.getSkuUnit()) + "</skuUnit>"); writer.println("<owner>" + (owner.equals("") ? ".." : standard) + "</owner>"); // System.out.println("-=-=-=-=sunhj // returnRpf.getRepairPartStatus():"+DicInit.getSystemName("LOAN_STATUS",returnRpf.getRepairPartStatus())); writer.println( "<repairPartStatus>" + EscapeUnescape.escape( DicInit.getSystemName("LOAN_STATUS", returnRpf.getRepairPartStatus())) + "</repairPartStatus>"); // System.out.println("-=-=-=-=sunhj returnRpf.getApplyQty():"+returnRpf.getApplyQty()); writer.println("<applyQty>" + returnRpf.getApplyQty() + "</applyQty>"); writer.println("<partVersion>" + returnRpf.getVersion() + "</partVersion>"); writer.println("</xml>"); } else { writer.println("<xml>"); writer.println("<flag>false</flag>"); writer.println("<result>part</result>"); writer.println("</xml>"); } } catch (Exception e) { e.printStackTrace(); writer.println("<xml>"); writer.println("<flag>false</flag>"); writer.println("<result>part</result>"); writer.println("</xml>"); } finally { writer.flush(); writer.close(); } }
/** * “维修”->“电话诊断”->“明细”->维修零件添加 * * @param mapping * @param form * @param request * @param response */ public void insertRepairPartInfo( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { Long userId = (Long) request.getSession().getAttribute("userId"); String repairNo = request.getParameter("repairNo"); String stuffNo = request.getParameter("stuffNo"); String warrantyType = request.getParameter("warrantyType"); String applyQty = request.getParameter("applyQty"); RepairHandleBo rhBo = RepairHandleBo.getInstance(); List<RepairPartForm> returnFormList = null; // 零件添加时增加零件是否可用 boolean chk = PartInfoBo.getInstance().chkStuffNo(stuffNo); if (!chk) { // wubin at 20110401 增加新的费用类别RR90,默认该类别是收费的 // if("R".equals(partFeeType)){ // partFeeType = "Y"; // isRR90PartType = "Y"; // } // add end List<RepairPartForm> rpfList = new ArrayList<RepairPartForm>(); RepairPartForm rpf = new RepairPartForm(); rpf.setRepairNo(new Long(repairNo)); rpf.setStuffNo(stuffNo); rpf.setWarrantyType(warrantyType); rpf.setApplyQty(new Integer(applyQty)); rpf.setRepairPartStatus("A"); // 申请中 rpf.setRepairPartType("W"); // 维修申请 rpf.setCreateBy(userId); rpf.setCreateDate(new java.util.Date()); rpfList.add(rpf); returnFormList = rhBo.insertPartInfo(rpfList); } PrintWriter writer = response.getWriter(); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); if (null != returnFormList && returnFormList.size() > 0) { writer.println("<xml>"); writer.println("<flag>true</flag>"); for (int i = 0; i < returnFormList.size(); i++) { RepairPartForm aPartForm = (RepairPartForm) returnFormList.get(i); writer.println("<partRow id=\"" + aPartForm.getPartsId() + "\">"); writer.println(" <partsId>" + aPartForm.getPartsId() + "</partsId>"); writer.println(" <stuffNo>" + aPartForm.getStuffNo() + "</stuffNo>"); writer.println( " <skuCode>" + EscapeUnescape.escape(aPartForm.getSkuCode()) + "</skuCode>"); String standard = aPartForm.getStandard() == null ? "" : EscapeUnescape.escape(aPartForm.getStandard()); writer.println(" <standard>" + (standard.equals("") ? ".." : standard) + "</standard>"); writer.println( " <skuUnit>" + EscapeUnescape.escape(aPartForm.getSkuUnit()) + "</skuUnit>"); writer.println( " <warrantyType>" + EscapeUnescape.escape( DicInit.getSystemName("WARRANTY_TYPE", aPartForm.getWarrantyType())) + "</warrantyType>"); writer.println(" <applyQty>" + aPartForm.getApplyQty() + "</applyQty>"); writer.println("</partRow>"); } writer.println("</xml>"); } else { writer.println("<xml>"); writer.println("<flag>false</flag>"); if (chk) { writer.println("<result>part</result>"); } else { writer.println("<result>error</result>"); } writer.println("</xml>"); } writer.flush(); writer.close(); } catch (Exception e) { e.printStackTrace(); } }