| | |
| | | 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; |
| | | |
| | | /** |
| | | * 默认条形码高度 |
| | |
| | | |
| | | 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); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | 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")); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | btnAlign: 'c', |
| | | btn: ['打印并保存', '仅保存', '关闭取消'], |
| | | yes: function () { |
| | | printSimpleStart(); |
| | | printBar(curSampleData); |
| | | submit(); |
| | | }, btn2: function () { |
| | | // 更新到页面 |
| | | var data = form.val("form-detail"); |
| | |
| | | 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("打印单据调用失败"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | success: function (result) { |
| | | if (result.code != "0000") { |
| | | layer.close(index); |
| | | notify(result.msg, result.data); |
| | | alertError(result.msg); |
| | | } else { |
| | | layer.closeAll(); |
| | | curSampleData = null; |
| | |
| | | } |
| | | }; |
| | | |
| | | //打印扦样单 |
| | | 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(); |
| | | }; |
| | | |