From 37c4642530eb12d9dad13d1e9a5f37640a0230ff Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期一, 03 七月 2023 16:25:18 +0800 Subject: [PATCH] 优化出入库信息-条形码打印 --- igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java | 2 igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java | 18 ++++++--- igds-web/src/main/resources/static/admin/inout/inout-print.js | 15 +++++-- igds-web/src/main/resources/static/admin/inout/in-sample.js | 31 +-------------- igds-inout/src/main/resources/mapper/InoutCheckMapper.xml | 2 - igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java | 1 6 files changed, 26 insertions(+), 43 deletions(-) diff --git a/igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java b/igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java index 19e5b41..71e8b05 100644 --- a/igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java +++ b/igds-inout/src/main/java/com/ld/igds/common/bar/BarCodeUtils.java @@ -33,19 +33,19 @@ public class BarCodeUtils { /** - * 榛樿鍥剧墖瀹藉害 + * 榛樿鍥剧墖瀹藉害妯� 70MM */ - private static final int DEFAULT_PICTURE_WIDTH = 300; + private static final int DEFAULT_PICTURE_WIDTH = 260; /** - * 榛樿鍥剧墖楂樺害 + * 榛樿鍥剧墖楂樺害 50MM */ - private static final int DEFAULT_PICTURE_HEIGHT = 200; + private static final int DEFAULT_PICTURE_HEIGHT = 185; /** * 榛樿鏉″舰鐮佸搴� */ - private static final int DEFAULT_BAR_CODE_WIDTH = 295; + private static final int DEFAULT_BAR_CODE_WIDTH = 250; /** * 榛樿鏉″舰鐮侀珮搴� @@ -264,6 +264,12 @@ public static String getBarCodeImageBase64(String codeValue, String bottomStr1, String bottomStr2, String bottomStr3) { BufferedImage image = getBarCodeWithWords(codeValue, bottomStr1, bottomStr2, bottomStr3); + + try{ + ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg")); + }catch(Exception e){ + + } return GetBase64FromImage(image); } @@ -285,7 +291,7 @@ public static void main(String[] args) throws IOException { - BufferedImage image = BarCodeUtils.getBarCodeWithWords("C_202306290005", "202306290005", "涓績绮簱", "2023-06-29 12:25"); + BufferedImage image = BarCodeUtils.getBarCodeWithWords("R_202306290005", "202306290005", "鏍峰搧璐ㄦ鐮�", "2023-06-29 12:25"); ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg")); } } \ No newline at end of file diff --git a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java index daf61e8..c7c1617 100644 --- a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java +++ b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java @@ -7,7 +7,6 @@ import com.ld.igds.inout.dto.InoutData; import com.ld.igds.inout.manager.InoutReportManager; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java index e8e762e..86003d3 100644 --- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java +++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java @@ -736,7 +736,7 @@ data.setCheckTime(new Date()); } - String imgBase64 = BarCodeUtils.getBarCodeImageBase64(data.getId(), data.getCheckId(), "绮簱鎵︽牱鍗曟潯鐮�", DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm")); + String imgBase64 = BarCodeUtils.getBarCodeImageBase64(data.getId(), data.getCheckId(), "绮鏍峰搧鍗曟潯鐮�", DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm")); return imgBase64; } diff --git a/igds-inout/src/main/resources/mapper/InoutCheckMapper.xml b/igds-inout/src/main/resources/mapper/InoutCheckMapper.xml index b43c21f..db77ee6 100644 --- a/igds-inout/src/main/resources/mapper/InoutCheckMapper.xml +++ b/igds-inout/src/main/resources/mapper/InoutCheckMapper.xml @@ -38,7 +38,6 @@ <if test="param.sampleStatus != null and param.sampleStatus != 'NONE' ">AND SAMPLE_TIME_ IS NOT NULL</if> </where> AND RECORD_STATUS_ != 'DEL' - AND RECORD_STATUS_ != 'ERROR' ORDER BY REGISTER_TIME_ </select> @@ -99,7 +98,6 @@ <if test="param.checkStatus != null and param.checkStatus == 'NONE' ">AND CHECK_STATUS_ = 'NONE'</if> </where> AND RECORD_STATUS_ != 'DEL' - AND RECORD_STATUS_ != 'ERROR' ORDER BY REGISTER_TIME_ </select> diff --git a/igds-web/src/main/resources/static/admin/inout/in-sample.js b/igds-web/src/main/resources/static/admin/inout/in-sample.js index 6824ee7..cfbf7aa 100644 --- a/igds-web/src/main/resources/static/admin/inout/in-sample.js +++ b/igds-web/src/main/resources/static/admin/inout/in-sample.js @@ -309,7 +309,8 @@ btnAlign: 'c', btn: ['鎵撳嵃骞朵繚瀛�', '浠呬繚瀛�', '鍏抽棴鍙栨秷'], yes: function () { - printSimpleStart(); + printBar(curSampleData); + submit(); }, btn2: function () { // 鏇存柊鍒伴〉闈� var data = form.val("form-detail"); @@ -321,32 +322,6 @@ layer.closeAll(); }, closeBtn: 0 - }); -} - - -//鎵ц鎵撳嵃 -function printSimpleStart() { - var index = layer.load(); - $.ajax({ - type: "POST", - url: "../../basic/inout/report/bill-simple", - dataType: "json", - contentType: "application/json;charset=UTF-8", - data: JSON.stringify(curSampleData), - success: function (result) { - layer.close(index); - if (result.code != "0000") { - alertError(result.msg); - } else { - printSimpleBill(result.data); - submit(); - } - }, - error: function () { - layer.close(index); - alertError("鎵撳嵃鍗曟嵁璋冪敤澶辫触"); - } }); } @@ -370,7 +345,7 @@ success: function (result) { if (result.code != "0000") { layer.close(index); - notify(result.msg, result.data); + alertError(result.msg); } else { layer.closeAll(); curSampleData = null; diff --git a/igds-web/src/main/resources/static/admin/inout/inout-print.js b/igds-web/src/main/resources/static/admin/inout/inout-print.js index 33f1965..1b2db0f 100644 --- a/igds-web/src/main/resources/static/admin/inout/inout-print.js +++ b/igds-web/src/main/resources/static/admin/inout/inout-print.js @@ -25,12 +25,17 @@ } }; -//鎵撳嵃鎵︽牱鍗� -printSimpleBill = function (imgBase64) { +//鎵撳嵃鎵︽牱鍗曟潯褰㈢爜 +printBar = function (data) { + var vcode = data.id; + var checkId = data.checkId; var LODOP = getLodop(); - LODOP.PRINT_INIT("鎵︽牱鍗�"); - LODOP.SET_PRINT_PAGESIZE(1, "40mm", "30mm", "CreateCustomPage"); - LODOP.ADD_PRINT_IMAGE(imgBase64); + LODOP.PRINT_INIT("娴嬭瘯"); + LODOP.SET_PRINT_PAGESIZE(1,'70mm','50mm' ,''); + LODOP.ADD_PRINT_BARCODE(20,20,'67mm',80,"128A",checkId); + LODOP.SET_PRINT_STYLEA(0,"FontSize",18); + + LODOP.SET_PRINTER_INDEX("鏉$爜鎵撳嵃鏈�");//鎸囧畾鏌愯櫄鎷熸墦鍗版満 LODOP.PREVIEW(); }; -- Gitblit v1.9.3