fix:修复凭证打印机bug
This commit is contained in:
parent
f029719a42
commit
d3e775b720
|
@ -1,7 +1,6 @@
|
|||
package com.dpkj.modules.print.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.constant.ErrorCodeConstants;
|
||||
import com.dpkj.common.dto.LexMarkDTO;
|
||||
import com.dpkj.common.dto.LexMarkResultDTO;
|
||||
import com.dpkj.common.exception.RRException;
|
||||
|
@ -33,8 +32,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
|
|||
@Override
|
||||
public LexMarkResultDTO<?> printImage(MS439Request request) {
|
||||
LexMarkResultDTO<PrinterStatus> status = this.getStatus(request.getPagesource());
|
||||
thirdService.open("HtmPrinter", 0);
|
||||
|
||||
PrinterStatus ms439 = status.getData();
|
||||
|
||||
// 如果是要盖章,校验盖章机器是否正常
|
||||
|
@ -55,7 +52,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
LexMarkDTO lexMarkDTO = new LexMarkDTO();
|
||||
lexMarkDTO.setActionName("PrintText");
|
||||
lexMarkDTO.setCallID(19283);
|
||||
|
@ -88,8 +84,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
|
|||
|
||||
@Override
|
||||
public LexMarkResultDTO<PrinterStatus> getStatus(String papersource) {
|
||||
thirdService.open("HtmPrinter", 0);
|
||||
|
||||
LexMarkDTO lexMarkDTO = new LexMarkDTO();
|
||||
lexMarkDTO.setActionName("GetStatus");
|
||||
lexMarkDTO.setCallID(19283);
|
||||
|
@ -98,7 +92,8 @@ public class MS439PrintServiceImpl implements MS439PrintService {
|
|||
|
||||
LexMarkResultDTO<PrinterStatus> status = thirdService.callDevice(lexMarkDTO, PrinterStatus.class);
|
||||
if ( status.getResult() != 0){
|
||||
throw new RRException(ErrorCodeConstants.MS439_PRINT_ERROR_CODE.get(status.getResult()));
|
||||
thirdService.open("HtmPrinter", 0);
|
||||
status = thirdService.callDevice(lexMarkDTO, PrinterStatus.class);
|
||||
}
|
||||
|
||||
String stPaperEx = status.getData().getStPaperEx();
|
||||
|
@ -144,7 +139,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
|
|||
throw new RRException(500, ms439.getStInk());
|
||||
}
|
||||
|
||||
thirdService.close("HtmPrinter");
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.dpkj.modules.print.service.impl;
|
|||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.constant.ErrorCodeConstants;
|
||||
import com.dpkj.common.dto.LexMarkDTO;
|
||||
import com.dpkj.common.dto.LexMarkResultDTO;
|
||||
import com.dpkj.common.exception.RRException;
|
||||
|
@ -34,8 +33,7 @@ public class RegisterServiceImpl implements PrintService {
|
|||
|
||||
@Override
|
||||
public LexMarkResultDTO<LexMarkResultDTO.Param> printImage(JSONObject data, String template, int width, int height, String saveDir) {
|
||||
thirdService.open("ReceiptPrinter", 1);
|
||||
|
||||
this.getStatus();
|
||||
StringBuilder filePath = new StringBuilder(saveDir);
|
||||
// 校验是否选中了模板,如果没选中模板的话则不需要另外生成了
|
||||
if ( !StringUtils.isEmpty(template) && !StringUtils.isEmpty(saveDir)){
|
||||
|
@ -61,7 +59,7 @@ public class RegisterServiceImpl implements PrintService {
|
|||
lexMarkDTO.setParam(param.toJSONString());
|
||||
LexMarkResultDTO<LexMarkResultDTO.Param> paramLexMarkResultDTO = thirdService.callDevice(lexMarkDTO, LexMarkResultDTO.Param.class);
|
||||
// 切纸
|
||||
this.thirdService.cutPaper("ReceiptPrinter", "ControlMedia", 4);
|
||||
// this.thirdService.cutPaper("ReceiptPrinter", "ControlMedia", 4);
|
||||
|
||||
File file = new File(filePath.toString());
|
||||
// 检查文件是否存在
|
||||
|
@ -82,8 +80,6 @@ public class RegisterServiceImpl implements PrintService {
|
|||
|
||||
@Override
|
||||
public LexMarkResultDTO<PrinterStatus> getStatus() {
|
||||
thirdService.open("ReceiptPrinter", 1);
|
||||
|
||||
LexMarkDTO lexMarkDTO = new LexMarkDTO();
|
||||
lexMarkDTO.setActionName("GetStatus");
|
||||
lexMarkDTO.setCallID(11225);
|
||||
|
@ -92,7 +88,8 @@ public class RegisterServiceImpl implements PrintService {
|
|||
// lexMarkDTO.setMethodType(0);
|
||||
LexMarkResultDTO<PrinterStatus> status = thirdService.callDevice(lexMarkDTO, PrinterStatus.class);
|
||||
if ( status.getResult() != 0){
|
||||
throw new RRException(ErrorCodeConstants.MS439_PRINT_ERROR_CODE.get(status.getResult()));
|
||||
thirdService.open("ReceiptPrinter", 1);
|
||||
status = thirdService.callDevice(lexMarkDTO, PrinterStatus.class);
|
||||
}
|
||||
|
||||
PrinterStatus ms439 = status.getData();
|
||||
|
@ -131,7 +128,6 @@ public class RegisterServiceImpl implements PrintService {
|
|||
throw new RRException(500, ms439.getStInk());
|
||||
}
|
||||
|
||||
this.thirdService.close("ReceiptPrinter");
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue