This commit is contained in:
linfso 2024-07-28 14:28:30 +08:00
parent 888f8317dc
commit f18d6b698a
2 changed files with 82 additions and 78 deletions

View File

@ -193,6 +193,6 @@ public interface IEmisWaybillService
public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill); public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill);
public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError, IOException ; public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError ;
} }

View File

@ -2212,7 +2212,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
} }
@Override @Override
public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError, IOException { public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError {
if(StringUtils.isEmpty(orderSn)){ if(StringUtils.isEmpty(orderSn)){
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单号为空"); throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单号为空");
@ -2260,6 +2260,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
tplName="tpl/ws_ls_in_tpl.docx"; tplName="tpl/ws_ls_in_tpl.docx";
} }
try {
OutputStream outputStream = response.getOutputStream(); OutputStream outputStream = response.getOutputStream();
InputStream fis = new ClassPathResource(tplName).getInputStream(); InputStream fis = new ClassPathResource(tplName).getInputStream();
/*1.根据模板生成文档*/ /*1.根据模板生成文档*/
@ -2340,9 +2341,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
DocUtils.wordToPdf(bis, outputStream); DocUtils.wordToPdf(bis, outputStream);
response.flushBuffer(); response.flushBuffer();
IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fis);
IOUtils.closeQuietly(outputStream); IOUtils.closeQuietly(outputStream);
}
catch (Exception ex){
throw new EmisBizError(EmisBizErrorType.FAIL,"生成进仓单出错:"+ ex.getMessage());
}
} }