|
|
|
|
@ -411,7 +411,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 搜索
|
|
|
|
|
*
|
|
|
|
|
* @param request 请求参数
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("search")
|
|
|
|
|
@ -421,7 +420,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据单据号获取列表
|
|
|
|
|
*
|
|
|
|
|
* @param orderNo 单据号
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getList")
|
|
|
|
|
@ -431,7 +429,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取订单托盘详情
|
|
|
|
|
*
|
|
|
|
|
* @param id 订单id
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getTrayInfo")
|
|
|
|
|
@ -455,9 +452,9 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
// 获取托盘号:如果物料项有关联的托盘,则使用托盘号;否则为空
|
|
|
|
|
if (item.getTrayId() != null) {
|
|
|
|
|
WmsStructuralPackageOrderTray tray = trays.stream()
|
|
|
|
|
.filter(t -> t.getId().equals(item.getTrayId()))
|
|
|
|
|
.findFirst()
|
|
|
|
|
.orElse(null);
|
|
|
|
|
.filter(t -> t.getId().equals(item.getTrayId()))
|
|
|
|
|
.findFirst()
|
|
|
|
|
.orElse(null);
|
|
|
|
|
if (tray != null) {
|
|
|
|
|
ivo.setNo(tray.getNo());
|
|
|
|
|
} else {
|
|
|
|
|
@ -480,7 +477,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
*
|
|
|
|
|
* @param ids 要删除的id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("delete")
|
|
|
|
|
@ -491,7 +487,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据订单状态搜索
|
|
|
|
|
*
|
|
|
|
|
* @param request 请求参数
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("searchByState")
|
|
|
|
|
@ -501,7 +496,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出选中的id列表
|
|
|
|
|
*
|
|
|
|
|
* @param ids id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("exportByIds")
|
|
|
|
|
@ -512,7 +506,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出搜索结果
|
|
|
|
|
*
|
|
|
|
|
* @param request 搜索参数
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("exportSearchByState")
|
|
|
|
|
@ -526,7 +519,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取托盘零件列表
|
|
|
|
|
*
|
|
|
|
|
* @param id 订单id
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("getItems")
|
|
|
|
|
@ -549,7 +541,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出老鼠图PDF
|
|
|
|
|
*
|
|
|
|
|
* @param id 订单id
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("exportPdf")
|
|
|
|
|
@ -629,7 +620,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
variables.put("list", datas);
|
|
|
|
|
String html = ThymeleafUtil.generator("/template/qrcode/", "spitem", ".html", variables);
|
|
|
|
|
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
|
|
|
|
|
PdfGeneratorUtil.generatePdf("零件标签"+DateTimeUtil.format(LocalDateTime.now(),"yyyyMMddHHmmss"), html, baseUrl.toString(), response);
|
|
|
|
|
PdfGeneratorUtil.generatePdf("零件标签" + DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmmss"), html, baseUrl.toString(), response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -1542,7 +1533,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加备注
|
|
|
|
|
*
|
|
|
|
|
* @param request 请求参数
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("itemRemark")
|
|
|
|
|
@ -1560,7 +1550,6 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据指定托盘数量重新生成订单托盘信息
|
|
|
|
|
*
|
|
|
|
|
* @param request 请求参数
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@ -2038,4 +2027,116 @@ public class StructuralPackageOrderController extends BaseController {
|
|
|
|
|
|
|
|
|
|
return ApiResult.success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据托盘id列表导出托盘标签PDF
|
|
|
|
|
* @param ids 托盘id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("exportTrayPdfByTrayIds")
|
|
|
|
|
public void exportTrayPdfByTrayIds(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
|
|
|
|
List<WmsStructuralPackageOrderTray> trays = structuralPackageOrderTrayService.listByIds(ids);
|
|
|
|
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(trays)).throwMessage("数据不存在");
|
|
|
|
|
|
|
|
|
|
// 收集所有托盘的HTML内容
|
|
|
|
|
List<String> htmlList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// 遍历所有托盘,生成每个托盘的HTML内容
|
|
|
|
|
for (WmsStructuralPackageOrderTray tray : trays) {
|
|
|
|
|
DeliverStructuralPackageOrderExtendVO trayVO = structuralPackageOrderTrayService.getInfo(tray.getId());
|
|
|
|
|
VUtil.trueThrowBusinessError(Objects.isNull(trayVO)).throwMessage("数据不存在");
|
|
|
|
|
trayVO.setQrCode(QRCodeUtil.generateQRCodeBase64(trayVO.getTrayNo(), 100, 100));
|
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
|
variables.put("info", trayVO);
|
|
|
|
|
String html = ThymeleafUtil.generator("/template/qrcode/", "tray", ".html", variables);
|
|
|
|
|
htmlList.add(html);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 将所有托盘标签合并成一个PDF文件,每页一个标签
|
|
|
|
|
PdfGeneratorUtil.generatePdf("托盘标签", htmlList, response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据托盘id列表导出托盘标签图片ZIP
|
|
|
|
|
* @param ids 托盘id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping(value = "exportTrayImageZipByTrayIds", produces = MediaType.IMAGE_PNG_VALUE)
|
|
|
|
|
public ResponseEntity<byte[]> exportTrayImageZipByTrayIds(@RequestBody @NotEmpty List<Long> ids) throws Exception {
|
|
|
|
|
List<WmsStructuralPackageOrderTray> trays = structuralPackageOrderTrayService.listByIds(ids);
|
|
|
|
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(trays)).throwMessage("数据不存在");
|
|
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
|
|
try (ZipOutputStream zos = new ZipOutputStream(baos)) {
|
|
|
|
|
for (WmsStructuralPackageOrderTray tray : trays) {
|
|
|
|
|
DeliverStructuralPackageOrderExtendVO trayVO = structuralPackageOrderTrayService.getInfo(tray.getId());
|
|
|
|
|
VUtil.trueThrowBusinessError(Objects.isNull(trayVO)).throwMessage("数据不存在");
|
|
|
|
|
trayVO.setQrCode(QRCodeUtil.generateQRCodeBase64(trayVO.getTrayNo(), 200, 200));
|
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
|
variables.put("info", trayVO);
|
|
|
|
|
String html = ThymeleafUtil.generator("/template/qrcode/", "tray-label", ".html", variables);
|
|
|
|
|
ZipEntry entry = new ZipEntry(trayVO.getTrayNo() + ".png");
|
|
|
|
|
zos.putNextEntry(entry);
|
|
|
|
|
byte[] imageBytes = HtmlToImageUtil.convertToPng(html, 600);
|
|
|
|
|
zos.write(imageBytes, 0, imageBytes.length);
|
|
|
|
|
zos.closeEntry();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
byte[] zipBytes = baos.toByteArray();
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
headers.setContentType(MediaType.valueOf("application/zip"));
|
|
|
|
|
headers.setContentLength(zipBytes.length);
|
|
|
|
|
return new ResponseEntity<>(zipBytes, headers, HttpStatus.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据托盘id列表导出托盘零件列表
|
|
|
|
|
* @param ids 托盘id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("exportItemsByTrayIds")
|
|
|
|
|
public void exportItemsByTrayIds(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws IOException {
|
|
|
|
|
List<DeliverStructuralPackageOrderTrayItemVO> list = structuralPackageOrderTrayItemService.getListVOByTrayIds(ids);
|
|
|
|
|
EecExcelUtil.export("零件信息", "sheet1", list, response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据托盘id列表导出老鼠图PDF
|
|
|
|
|
* @param ids 托盘id列表
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("exportPdfByTrayIds")
|
|
|
|
|
public ApiResult<String> exportPdfByTrayIds(@RequestBody @NotEmpty List<Long> ids) throws Exception {
|
|
|
|
|
List<DeliverStructuralPackageOrderTrayItemVO> list = structuralPackageOrderTrayItemService.getListVOByTrayIds(ids);
|
|
|
|
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(list)).throwMessage("数据不存在");
|
|
|
|
|
DeliverStructuralPackageOrderExtendVO trayVO = structuralPackageOrderTrayService.getInfo(list.get(0).getTrayId());
|
|
|
|
|
|
|
|
|
|
PackageVO vo = new PackageVO()
|
|
|
|
|
.setNo(trayVO.getPackageNo())
|
|
|
|
|
.setExternalOrderNo(trayVO.getExternalOrderNo())
|
|
|
|
|
.setRowNo(trayVO.getRowNo())
|
|
|
|
|
.setSupplierName(trayVO.getSupplierName())
|
|
|
|
|
.setModelNos(trayVO.getModelNo())
|
|
|
|
|
.setVersion(trayVO.getPackageVersion())
|
|
|
|
|
.setWorkbenchCode(trayVO.getWorkbenchCode())
|
|
|
|
|
.setCate(trayVO.getPackageCate())
|
|
|
|
|
.setWeight(trayVO.getWeight())
|
|
|
|
|
.setDrawingNo(trayVO.getPackageDrawingNo())
|
|
|
|
|
.setName(trayVO.getPackageDesc())
|
|
|
|
|
.setQrCode(QRCodeUtil.generateQRCodeBase64(trayVO.getPackageNo(), 100, 100));
|
|
|
|
|
|
|
|
|
|
List<PackageMaterialDTO> items = list.stream()
|
|
|
|
|
.map(item -> new PackageMaterialDTO()
|
|
|
|
|
.setImage(item.getImage())
|
|
|
|
|
.setNo(item.getMaterialNo())
|
|
|
|
|
.setDrawingNo(item.getDrawingNo())
|
|
|
|
|
.setName(item.getMaterialDesc())
|
|
|
|
|
.setNum(item.getShipmentNum())
|
|
|
|
|
.setWeight(item.getWeight())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
|
variables.put("info", vo);
|
|
|
|
|
variables.put("pages", PdfPageDTO.create(items, 9, new PackageMaterialDTO()));
|
|
|
|
|
String html = ThymeleafUtil.generator("/template/", "钢构件老鼠图", ".html", variables);
|
|
|
|
|
// PdfGeneratorUtil.generatePdf(vo.getExternalOrderNo() + "-" + vo.getWorkbenchCode() + "老鼠图", html, response);
|
|
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
|
|
PdfGeneratorUtil.generatePdf(vo.getExternalOrderNo() + "-" + vo.getWorkbenchCode() + "老鼠图", html, outputStream);
|
|
|
|
|
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
|
|
|
|
return ApiResult.success(fileUploadService.upload("tmp/sp/" + RandomUtil.randomString(10) + "/" + "老鼠图.pdf", inputStream, MediaType.APPLICATION_PDF_VALUE));
|
|
|
|
|
}
|
|
|
|
|
}
|