Index: ssts-web/src/main/java/com/forgon/disinfectsystem/printbarcode/action/PrintBarcodeAction.java =================================================================== diff -u -r12331 -r24204 --- ssts-web/src/main/java/com/forgon/disinfectsystem/printbarcode/action/PrintBarcodeAction.java (.../PrintBarcodeAction.java) (revision 12331) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/printbarcode/action/PrintBarcodeAction.java (.../PrintBarcodeAction.java) (revision 24204) @@ -27,29 +27,44 @@ public void printBarcodeImage() { String barcode = StrutsParamUtils.getPraramValue("barcode", ""); + String codeType = StrutsParamUtils.getPraramValue("codeType", ""); + int width = 150; + int height = 26; + int codeWidth = 3 + // start guard + (7 * 6) + // left bars + 5 + // middle guard + (7 * 6) + // right bars + 3; // end guard + width = Math.max(codeWidth, width); + BarcodeFormat format = BarcodeFormat.CODE_128; + if(StringUtils.isNotBlank(codeType)){ + switch (codeType){ + case "QRCode": + format = BarcodeFormat.QR_CODE; + width = 64; + height = 64; + break; + default: + break; + } + } if(StringUtils.isNotBlank(barcode)){ HttpServletResponse response = StrutsParamUtils.getResponse(); response.setContentType("image/jpeg"); try { OutputStream outputStream = response.getOutputStream(); - wirteToStream(barcode, 150, 26, outputStream); + wirteToStream(barcode,format, width, height, outputStream); } catch (IOException e) { e.printStackTrace(); } } } - public void wirteToStream(String contents, int width, int height, + public void wirteToStream(String contents, BarcodeFormat format,int width, int height, OutputStream outputStream) { - int codeWidth = 3 + // start guard - (7 * 6) + // left bars - 5 + // middle guard - (7 * 6) + // right bars - 3; // end guard - codeWidth = Math.max(codeWidth, width); try { BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, - BarcodeFormat.CODE_128, codeWidth, height); + format, width, height); MatrixToImageWriter.writeToStream(bitMatrix, "png", outputStream); } catch (Exception e) { e.printStackTrace(); Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/sterilizer/sterilizerView.jsp =================================================================== diff -u -r19893 -r24204 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/sterilizer/sterilizerView.jsp (.../sterilizerView.jsp) (revision 19893) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/sterilizer/sterilizerView.jsp (.../sterilizerView.jsp) (revision 24204) @@ -27,7 +27,7 @@ <%@ include file="/common/includeExtJsAndCss.jsp"%> - +