public void cancelLoanTool( 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"); String partsId = request.getParameter("partsId"); // String partStatusCode = request.getParameter("partStatusCode"); String version = request.getParameter("version"); RepairHandleBo rhBo = RepairHandleBo.getInstance(); boolean flag = false; // 增加取消零件的版本校验 added by xt 2007-09-08 if (partsId != null && rhBo.checkPartVersion(new Long(partsId), version)) { RepairPartForm rpf = new RepairPartForm(); rpf.setPartsId(new Long(partsId)); rpf.setUpdateBy(userId); flag = rhBo.cancelLoanPart(rpf); } if (flag) { writer.println("<xml>"); writer.println("<flag>true</flag>"); writer.println("<partsId>" + partsId + "</partsId>"); writer.println("</xml>"); } else { writer.println("<xml>"); writer.println("<flag>false</flag>"); writer.println("</xml>"); } } catch (VersionException ve) { ve.printStackTrace(); writer.println("<xml>"); writer.println("<flag>versionErr</flag>"); writer.println("</xml>"); } catch (Exception e) { e.printStackTrace(); writer.println("<xml>"); writer.println("<flag>false</flag>"); writer.println("</xml>"); } finally { writer.flush(); writer.close(); } }
/** * 携带零件转销售 维修返还时可操作 * * @param mapping * @param form * @param request * @param response * @throws Exception */ public void transferLoanPart( 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"); String partsId = request.getParameter("partsId"); String version = request.getParameter("version"); RepairHandleBo rhBo = RepairHandleBo.getInstance(); String flag = "false"; if (partsId != null && rhBo.checkPartVersion(new Long(partsId), version)) { RepairPartForm rpf = new RepairPartForm(); rpf.setPartsId(new Long(partsId)); rpf.setUpdateBy(userId); rpf.setUpdateDate(new Date()); if (rhBo.transferLoanPart(rpf)) { flag = "true"; } } writer.println("<xml>"); writer.println("<flag>" + flag + "</flag>"); writer.println("<partsId>" + partsId + "</partsId>"); writer.println("</xml>"); } catch (VersionException ve) { ve.printStackTrace(); writer.println("<xml>"); writer.println("<flag>versionErr</flag>"); writer.println("</xml>"); } catch (Exception e) { e.printStackTrace(); writer.println("<xml>"); writer.println("<flag>false</flag>"); writer.println("</xml>"); } finally { writer.flush(); writer.close(); } }