bug-939 钢构包标签格式及取值修改-齐套标签和零件标签
This commit is contained in:
parent
6eefd25e40
commit
99ce826d1c
|
|
@ -550,7 +550,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
|
||||
/**
|
||||
* 导出零件标签图片ZIP
|
||||
*
|
||||
* @param id 托盘id
|
||||
*/
|
||||
@GetMapping(value = "exportItemImageZip", produces = "application/zip")
|
||||
|
|
@ -560,35 +559,24 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
List<DeliverStructuralPackageOrderTrayItemVO> list = structuralPackageOrderTrayItemService.getListVOByTrayId(id);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (ZipOutputStream zos = new ZipOutputStream(baos)) {
|
||||
List<DeliverStructuralPackageOrderTrayItemVO> datas = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (DeliverStructuralPackageOrderTrayItemVO it : list) {
|
||||
datas.clear();
|
||||
index++;
|
||||
String code = Base62Util.encode(it.getId());
|
||||
for (int i = 0, count = it.getShipmentNum().intValue(); i < count; i++) {
|
||||
DeliverStructuralPackageOrderTrayItemVO vo = BeanUtil.copy(it, DeliverStructuralPackageOrderTrayItemVO.class);
|
||||
vo.setQrCodeId(it.getId() + "-" + (i + 1));
|
||||
vo.setQrCode(it.getId() + "-" + (i + 1) + "^" + it.getMaterialNo() + "_" + it.getTrayNo() + "_1");
|
||||
vo.setQrCodeId(code + "-" + (i + 1));
|
||||
vo.setQrCode(code + "-" + (i + 1) + "^" + it.getMaterialNo() + "_" + it.getTrayNo() + "_1");
|
||||
vo.setQrCodeImage(QRCodeUtil.generateQRCodeBase64(vo.getQrCode(), 200, 200));
|
||||
datas.add(vo);
|
||||
addEntry(zos, index, vo, trayVO);
|
||||
}
|
||||
if (it.getShipmentNum().remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) > 0) {
|
||||
DeliverStructuralPackageOrderTrayItemVO vo = BeanUtil.copy(it, DeliverStructuralPackageOrderTrayItemVO.class);
|
||||
vo.setQrCodeId(it.getId() + "-" + (it.getShipmentNum().intValue() + 1));
|
||||
vo.setQrCode(it.getId() + "-" + (it.getShipmentNum().intValue() + 1) + "^" + it.getMaterialNo() + "_" + it.getTrayNo() + "_" + it.getShipmentNum().remainder(BigDecimal.ONE));
|
||||
vo.setQrCodeId(code + "-" + (it.getShipmentNum().intValue() + 1));
|
||||
vo.setQrCode(code + "-" + (it.getShipmentNum().intValue() + 1) + "^" + it.getMaterialNo() + "_" + it.getTrayNo() + "_" + it.getShipmentNum().remainder(BigDecimal.ONE));
|
||||
vo.setQrCodeImage(QRCodeUtil.generateQRCodeBase64(vo.getQrCode(), 200, 200));
|
||||
datas.add(vo);
|
||||
addEntry(zos, index, vo, trayVO);
|
||||
}
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("list", datas);
|
||||
variables.put("info", trayVO);
|
||||
variables.put("index", index);
|
||||
String html = ThymeleafUtil.generator("/template/qrcode/", "spitem-label", ".html", variables);
|
||||
ZipEntry entry = new ZipEntry(it.getId() + ".png");
|
||||
zos.putNextEntry(entry);
|
||||
byte[] imageBytes = HtmlToImageUtil.convertToPng(html, 600);
|
||||
zos.write(imageBytes, 0, imageBytes.length);
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
byte[] zipBytes = baos.toByteArray();
|
||||
|
|
@ -598,6 +586,19 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
return new ResponseEntity<>(zipBytes, headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
private void addEntry(ZipOutputStream zos, int index, DeliverStructuralPackageOrderTrayItemVO vo, DeliverStructuralPackageOrderExtendVO trayVO) throws Exception {
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("item", vo);
|
||||
variables.put("info", trayVO);
|
||||
variables.put("index", index);
|
||||
String html = ThymeleafUtil.generator("/template/qrcode/", "spitem-label", ".html", variables);
|
||||
ZipEntry entry = new ZipEntry(vo.getQrCodeId() + ".png");
|
||||
zos.putNextEntry(entry);
|
||||
byte[] imageBytes = HtmlToImageUtil.convertToPng(html, 600);
|
||||
zos.write(imageBytes, 0, imageBytes.length);
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出托盘标签PDF
|
||||
*
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
}
|
||||
|
||||
.img {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
max-width: 350px;
|
||||
max-height: 160px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
|
@ -61,13 +61,12 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div th:each="item , iterStat: ${list}"
|
||||
th:style="${iterStat.index == 0} ? 'page-break-before: auto;' : 'page-break-before: always;'">
|
||||
<div>
|
||||
<div th:text="${index}">1</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div th:text="|${item.materialDesc}(${info.supplierCode})|" class="title">
|
||||
<div th:text="|${item.packageDesc}(${info.supplierCode})|" class="title">
|
||||
833-33-07-NF左踏板连接架(00001016NF左踏板连接架NF左踏板连接架
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div th:text="|${item.materialDesc}(${info.supplierCode})|" class="name">
|
||||
<div th:text="|${item.packageDesc}(${info.supplierCode})|" class="name">
|
||||
833-33-07-NF左踏板连接架(0000101627)833-33-07-NF左踏板连接架NF左踏板连接架NF左踏板连接架(0000101627)
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue