feat: 添加功能
This commit is contained in:
parent
e404326626
commit
2d963c0ffd
|
|
@ -2,6 +2,7 @@ package com.nflg.wms.admin.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
@ -16,11 +17,16 @@ import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO;
|
||||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveItemQO;
|
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveItemQO;
|
||||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveQO;
|
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveQO;
|
||||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSearchQO;
|
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSearchQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.SearchDeliverOrderQO;
|
||||||
import com.nflg.wms.common.pojo.vo.DeliverNormalOrderVO;
|
import com.nflg.wms.common.pojo.vo.DeliverNormalOrderVO;
|
||||||
import com.nflg.wms.common.util.UserUtil;
|
import com.nflg.wms.common.util.UserUtil;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
import com.nflg.wms.repository.entity.WmsNormalPrintOrder;
|
import com.nflg.wms.repository.entity.WmsNormalPrintOrder;
|
||||||
|
import com.nflg.wms.repository.entity.WmsSrmOrder;
|
||||||
|
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
|
||||||
import com.nflg.wms.repository.entity.WmsWorkbench;
|
import com.nflg.wms.repository.entity.WmsWorkbench;
|
||||||
|
import com.nflg.wms.repository.service.IWmsSrmOrderItemService;
|
||||||
|
import com.nflg.wms.repository.service.IWmsSrmOrderService;
|
||||||
import com.nflg.wms.repository.service.IWmsWorkbenchService;
|
import com.nflg.wms.repository.service.IWmsWorkbenchService;
|
||||||
import com.nflg.wms.repository.service.WmsNormalPrintOrderService;
|
import com.nflg.wms.repository.service.WmsNormalPrintOrderService;
|
||||||
import com.nflg.wms.starter.BaseController;
|
import com.nflg.wms.starter.BaseController;
|
||||||
|
|
@ -28,15 +34,14 @@ import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -44,6 +49,7 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* 普通物料订单管理
|
* 普通物料订单管理
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/deliver/order/normal")
|
@RequestMapping("/deliver/order/normal")
|
||||||
public class NormalOrderController extends BaseController {
|
public class NormalOrderController extends BaseController {
|
||||||
|
|
@ -54,6 +60,12 @@ public class NormalOrderController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsWorkbenchService workbenchService;
|
private IWmsWorkbenchService workbenchService;
|
||||||
|
|
||||||
|
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||||
|
@Resource
|
||||||
|
private IWmsSrmOrderService srmOrderService;
|
||||||
|
@Resource
|
||||||
|
private IWmsSrmOrderItemService srmOrderItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
|
|
@ -113,6 +125,7 @@ public class NormalOrderController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索
|
* 搜索
|
||||||
|
* @param request 请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("search")
|
@PostMapping("search")
|
||||||
public ApiResult<PageData<DeliverNormalOrderVO>> search(@Valid @RequestBody @NotNull DeliverNormalOrderSearchQO request){
|
public ApiResult<PageData<DeliverNormalOrderVO>> search(@Valid @RequestBody @NotNull DeliverNormalOrderSearchQO request){
|
||||||
|
|
@ -124,6 +137,7 @@ public class NormalOrderController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
|
* @param id 要删除的id
|
||||||
*/
|
*/
|
||||||
@PostMapping("delete")
|
@PostMapping("delete")
|
||||||
public ApiResult<Void> delete(@Valid @RequestBody @NotNull Long id){
|
public ApiResult<Void> delete(@Valid @RequestBody @NotNull Long id){
|
||||||
|
|
@ -132,22 +146,66 @@ public class NormalOrderController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 逐个打印采购单
|
||||||
|
* @param ids 要打印的id列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("exportPdf")
|
@PostMapping("exportPdfPerPage")
|
||||||
public void exportPdf(HttpServletResponse response, @Valid @RequestBody @NotNull List<Long> ids) throws Exception {
|
public void exportPdfPerPage(HttpServletResponse response, @Valid @RequestBody @NotNull List<Long> ids) throws Exception {
|
||||||
List<DeliverNormalOrderVO> orders = deliverNormalOrderService.getList(ids);
|
List<DeliverNormalOrderVO> orders=new ArrayList<>();
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要导出的数据");
|
for (int i = 0,count=RandomUtil.randomInt(1,50); i < count; i++) {
|
||||||
// List<WmsDeliverNormalOrderItem> orders=new ArrayList<>();
|
BigDecimal batchNum = RandomUtil.randomBigDecimal(new BigDecimal("10"));
|
||||||
// orders.add(new WmsDeliverNormalOrderItem()
|
BigDecimal minPackageNum = RandomUtil.randomBigDecimal(new BigDecimal("1"),new BigDecimal("3"));
|
||||||
// .setMaterialNo("TEST00001")
|
BigDecimal[] result = batchNum.divideAndRemainder(minPackageNum);
|
||||||
// .setMaterialDesc("测试物料")
|
orders.add(new DeliverNormalOrderVO()
|
||||||
// .setBatchNum(new BigDecimal("36"))
|
.setId(IdUtil.getSnowflakeNextId())
|
||||||
// .setLableNum(4)
|
.setMaterialNo(RandomUtil.randomNumbers(10))
|
||||||
// .setMinPackageNum(new BigDecimal("10"))
|
.setMaterialDesc(RandomUtil.randomString(10))
|
||||||
// .setUniqNo(DateTimeUtil.getForDeliverOrderItemNo())
|
.setBatchNum(batchNum)
|
||||||
// .setBatchNo("TEST00001")
|
.setMinPackageNum(minPackageNum)
|
||||||
// );
|
.setSupplierCode(RandomUtil.randomString(10))
|
||||||
|
.setSupplierName(RandomUtil.randomString(10))
|
||||||
|
.setExternalOrderNo(RandomUtil.randomNumbers(10))
|
||||||
|
.setRowNo(RandomUtil.randomString(10))
|
||||||
|
.setIndexNo(RandomUtil.randomString(10))
|
||||||
|
.setLableNum(result[1].compareTo(BigDecimal.ZERO)==0?result[0].intValue():result[0].intValue()+1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// List<DeliverNormalOrderVO> orders = deliverNormalOrderService.getList(ids);
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
|
||||||
|
exportPdfPerPage(convert(orders),response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整张打印采购单
|
||||||
|
* @param ids 要打印的id列表
|
||||||
|
*/
|
||||||
|
@PostMapping("exportPdfOnePage")
|
||||||
|
public void exportPdfOnePage(HttpServletResponse response, @Valid @RequestBody @NotNull List<Long> ids) throws Exception {
|
||||||
|
List<DeliverNormalOrderVO> orders=new ArrayList<>();
|
||||||
|
for (int i = 0,count=RandomUtil.randomInt(1,50); i < count; i++) {
|
||||||
|
BigDecimal batchNum = RandomUtil.randomBigDecimal(new BigDecimal("10"));
|
||||||
|
BigDecimal minPackageNum = RandomUtil.randomBigDecimal(new BigDecimal("1"),new BigDecimal("3"));
|
||||||
|
BigDecimal[] result = batchNum.divideAndRemainder(minPackageNum);
|
||||||
|
orders.add(new DeliverNormalOrderVO()
|
||||||
|
.setId(IdUtil.getSnowflakeNextId())
|
||||||
|
.setMaterialNo(RandomUtil.randomNumbers(10))
|
||||||
|
.setMaterialDesc(RandomUtil.randomString(10))
|
||||||
|
.setBatchNum(batchNum)
|
||||||
|
.setMinPackageNum(minPackageNum)
|
||||||
|
.setSupplierCode(RandomUtil.randomString(10))
|
||||||
|
.setSupplierName(RandomUtil.randomString(10))
|
||||||
|
.setExternalOrderNo(RandomUtil.randomNumbers(10))
|
||||||
|
.setRowNo(RandomUtil.randomString(10))
|
||||||
|
.setIndexNo(RandomUtil.randomString(10))
|
||||||
|
.setLableNum(result[1].compareTo(BigDecimal.ZERO)==0?result[0].intValue():result[0].intValue()+1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// List<DeliverNormalOrderVO> orders = deliverNormalOrderService.getList(ids);
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
|
||||||
|
exportPdfInAll(convert(orders),response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DeliverNormalOrderItemDTO> convert(List<DeliverNormalOrderVO> orders) throws Exception {
|
||||||
List<DeliverNormalOrderItemDTO> datas = new ArrayList<>();
|
List<DeliverNormalOrderItemDTO> datas = new ArrayList<>();
|
||||||
for (DeliverNormalOrderVO order : orders) {
|
for (DeliverNormalOrderVO order : orders) {
|
||||||
for (int i = 0; i < order.getLableNum(); i++) {
|
for (int i = 0; i < order.getLableNum(); i++) {
|
||||||
|
|
@ -155,23 +213,110 @@ public class NormalOrderController extends BaseController {
|
||||||
dto.setIndex(i);
|
dto.setIndex(i);
|
||||||
dto.setPrintNo(order.getId() + "-" + i);
|
dto.setPrintNo(order.getId() + "-" + i);
|
||||||
if (i == order.getLableNum() - 1) {
|
if (i == order.getLableNum() - 1) {
|
||||||
dto.setPrintNum(order.getBatchNum().divideAndRemainder(order.getMinPackageNum())[1]);
|
dto.setPrintNum(DF.format(order.getBatchNum().divideAndRemainder(order.getMinPackageNum())[1]));
|
||||||
} else {
|
} else {
|
||||||
dto.setPrintNum(order.getMinPackageNum());
|
dto.setPrintNum(DF.format(order.getMinPackageNum()));
|
||||||
}
|
}
|
||||||
dto.setQrCode("data:image/png;base64,"+Base64.getEncoder().encodeToString(QRCodeUtil.generateQRCode(generateQRContent(order,dto.getPrintNo(),dto.getPrintNum()), 100, 100)));
|
dto.setQrCode("data:image/png;base64,"+Base64.getEncoder().encodeToString(QRCodeUtil.generateQRCode(generateQRContent(dto), 100, 100)));
|
||||||
datas.add(dto);
|
datas.add(dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Object> variables = new HashMap<>();
|
return datas;
|
||||||
variables.put("list", datas);
|
|
||||||
String html = ThymeleafUtil.generator("/template/qrcode/", "dp", ".html", variables);
|
|
||||||
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
|
|
||||||
PdfGeneratorUtil.generatePdf("普通物料条码", html,baseUrl.toString(), response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateQRContent(DeliverNormalOrderVO order, String printNo, BigDecimal num){
|
private String generateQRContent(DeliverNormalOrderItemDTO order){
|
||||||
return StrUtil.format("{}${}${}${}${}${}${}${}"
|
String content=StrUtil.format("{}${}${}${}${}${}${}${}"
|
||||||
, printNo, order.getExternalOrderNo(),order.getRowNo(),order.getMaterialNo(),num,order.getMaterialDesc(),order.getSupplierCode(),order.getIndexNo());
|
, order.getPrintNo(), order.getExternalOrderNo(),order.getRowNo(),order.getMaterialNo(),order.getPrintNum(),order.getMaterialDesc(),order.getSupplierCode(),order.getIndexNo());
|
||||||
|
log.debug("二维码内容:"+ content);
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索送货单
|
||||||
|
* @param request 请求参数
|
||||||
|
*/
|
||||||
|
@PostMapping("searchDeliverOrder")
|
||||||
|
public ApiResult<PageData<WmsSrmOrder>> searchDeliverOrder(@Valid @RequestBody @NotNull SearchDeliverOrderQO request){
|
||||||
|
return ApiResult.success(srmOrderService.search(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取送货单详情
|
||||||
|
* @param id 送货单id
|
||||||
|
*/
|
||||||
|
@GetMapping("getDeliverOrderItems")
|
||||||
|
public ApiResult<List<WmsSrmOrderItem>> getDeliverOrderItems(@Valid @RequestParam @NotNull Long id){
|
||||||
|
return ApiResult.success(srmOrderItemService.getByDeliverOrderId(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逐个打印送货单
|
||||||
|
* @param id 要打印的送货单id
|
||||||
|
*/
|
||||||
|
@GetMapping("deliver/exportPdfPerPage")
|
||||||
|
public void exportDeliverOrderPdfPerPage(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||||
|
// List<WmsSrmOrderItem> orders=new ArrayList<>();
|
||||||
|
// for (int i = 0,count=RandomUtil.randomInt(1,50); i < count; i++) {
|
||||||
|
// orders.add(new WmsSrmOrderItem()
|
||||||
|
// .setId(IdUtil.getSnowflakeNextId())
|
||||||
|
// .setItemCode(RandomUtil.randomNumbers(10))
|
||||||
|
// .setItemName(RandomUtil.randomString(10))
|
||||||
|
// .setOrderQty(RandomUtil.randomBigDecimal(new BigDecimal("1"),new BigDecimal("100")))
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
List<WmsSrmOrderItem> orders = srmOrderItemService.getByDeliverOrderId(id);
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
|
||||||
|
exportPdfPerPage(convert1(orders),response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整张打印送货单
|
||||||
|
* @param id 要打印的送货单id
|
||||||
|
*/
|
||||||
|
@GetMapping("deliver/exportPdfOnePage")
|
||||||
|
public void exportDeliverOrderPdfOnePage(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||||
|
// List<WmsSrmOrderItem> orders=new ArrayList<>();
|
||||||
|
// for (int i = 0,count=RandomUtil.randomInt(1,50); i < count; i++) {
|
||||||
|
// orders.add(new WmsSrmOrderItem()
|
||||||
|
// .setId(IdUtil.getSnowflakeNextId())
|
||||||
|
// .setItemCode(RandomUtil.randomNumbers(10))
|
||||||
|
// .setItemName(RandomUtil.randomString(10))
|
||||||
|
// .setOrderQty(RandomUtil.randomBigDecimal(new BigDecimal("1"),new BigDecimal("100")))
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
List<WmsSrmOrderItem> orders = srmOrderItemService.getByDeliverOrderId(id);
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
|
||||||
|
exportPdfInAll(convert1(orders),response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DeliverNormalOrderItemDTO> convert1(List<WmsSrmOrderItem> orders) throws Exception {
|
||||||
|
List<DeliverNormalOrderItemDTO> datas = new ArrayList<>();
|
||||||
|
for (WmsSrmOrderItem order : orders) {
|
||||||
|
DeliverNormalOrderItemDTO dto = new DeliverNormalOrderItemDTO();
|
||||||
|
dto.setMaterialNo(order.getItemCode());
|
||||||
|
dto.setMaterialDesc(order.getItemName());
|
||||||
|
dto.setIndex(0);
|
||||||
|
dto.setPrintNo(order.getId() + "-" + 0);
|
||||||
|
dto.setPrintNum(DF.format(order.getOrderQty()));
|
||||||
|
dto.setQrCode("data:image/png;base64,"+Base64.getEncoder().encodeToString(QRCodeUtil.generateQRCode(generateQRContent(dto), 100, 100)));
|
||||||
|
datas.add(dto);
|
||||||
|
}
|
||||||
|
return datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exportPdfPerPage(List<DeliverNormalOrderItemDTO> datas, HttpServletResponse response) throws Exception {
|
||||||
|
Map<String, Object> variables = new HashMap<>();
|
||||||
|
variables.put("list", datas);
|
||||||
|
String html = ThymeleafUtil.generator("/template/qrcode/", "dp-1", ".html", variables);
|
||||||
|
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
|
||||||
|
PdfGeneratorUtil.generatePdf("普通物料条码(逐个)", html, baseUrl.toString(), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exportPdfInAll(List<DeliverNormalOrderItemDTO> datas, HttpServletResponse response) throws Exception {
|
||||||
|
Map<String, Object> variables = new HashMap<>();
|
||||||
|
variables.put("list", datas);
|
||||||
|
String html = ThymeleafUtil.generator("/template/qrcode/", "dp-2", ".html", variables);
|
||||||
|
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
|
||||||
|
PdfGeneratorUtil.generatePdf("普通物料条码(整张)", html, baseUrl.toString(), response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@ public class QRCodeUtil {
|
||||||
// 配置二维码参数
|
// 配置二维码参数
|
||||||
Hashtable<EncodeHintType, Object> hints = new Hashtable<>();
|
Hashtable<EncodeHintType, Object> hints = new Hashtable<>();
|
||||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||||
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
|
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
|
||||||
hints.put(EncodeHintType.MARGIN, 0);
|
hints.put(EncodeHintType.MARGIN, 0);
|
||||||
|
|
||||||
// 生成二维码矩阵
|
// 生成二维码矩阵
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 194 KiB |
|
|
@ -20,7 +20,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="package-diagram">
|
<div class="package-diagram">
|
||||||
<div class="package-logo">
|
<div class="package-logo">
|
||||||
<img src="../img/homeLogo1.png" />
|
<img src="../img/logo1.png" />
|
||||||
</div>
|
</div>
|
||||||
<table class="el-table el-table--small">
|
<table class="el-table el-table--small">
|
||||||
<td class="el-table__cell">
|
<td class="el-table__cell">
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,12 @@
|
||||||
<style>
|
<style>
|
||||||
@media print {
|
@media print {
|
||||||
body {
|
body {
|
||||||
font-size: 12pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
font-family: SimSun, Arial, sans-serif;
|
font-family: SimSun, Arial, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
@ -19,29 +20,36 @@
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid #333;
|
||||||
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2em;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
.div-with-border {
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
padding: 5px;
|
||||||
|
width: 200px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table th:each="item, iterStat : ${list}" th:style="${iterStat.index == 0} ? 'page-break-before: auto;' : 'page-break-before: always;'">
|
<table th:each="item, iterStat : ${list}" th:style="${iterStat.index == 0} ? 'page-break-before: auto;' : 'page-break-before: always;'">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 150px;text-align: center">
|
<td style="width: 150px;text-align: center;padding: 5px;">
|
||||||
<img height="120" th:src="${item.qrCode}" width="120"/>
|
<img height="120" th:src="${item.qrCode}" width="120"/>
|
||||||
<div th:text="${item.printNo}">20250227100950-0</div>
|
<div th:text="${item.printNo}">20250227100950-0</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 10px;width: 200px;text-align: left;vertical-align: top">
|
<td style="width: 200px;text-align: left;vertical-align: top">
|
||||||
<div class="title"><img alt="二维码" height="20" src="../../img/ico.png" style="margin-right: 5px;" width="20"/>NFLG</div>
|
<div class="title div-with-border"><img alt="logo" height="20" src="../../img/logo2.png" style="margin-right: 5px;" /></div>
|
||||||
<div>SAP编码: <span th:text="${item.materialNo}"></span></div>
|
<div class="div-with-border">SAP编码: <span th:text="${item.materialNo}"></span></div>
|
||||||
<div>名称: <span th:text="${item.materialDesc}"></span></div>
|
<div class="div-with-border">名称: <span th:text="${item.materialDesc}"></span></div>
|
||||||
<div>数量: <span th:text="${item.printNum}"></span></div>
|
<div class="div-with-border">数量: <span th:text="${item.printNum}"></span></div>
|
||||||
<div>批次号: <span th:text="${item.batchNo}"></span></div>
|
<div style="padding: 5px;">批次号: <span th:text="${item.batchNo}"></span></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<title>普通物料标签</title>
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-size: 9px;
|
||||||
|
font-family: SimSun, Arial, sans-serif;
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden; /* 清除浮动 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
float: left;
|
||||||
|
width: 23%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 5px;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 清除浮动 */
|
||||||
|
.container::after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: 5px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="width: 100%">
|
||||||
|
<div style="text-align: center">
|
||||||
|
<img alt="" src="../../img/logo1.png" style="width: 300px;" />
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="item" th:each="item : ${list}">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center"><img alt="" style="height: 100px;margin: 5px;" th:src="${item.qrCode}"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span>SAP编码: <span style="display: inline;" th:text="${item.materialNo}"></span></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span>名称: <span style="display: inline;" th:text="${item.materialDesc}"></span></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span>数量: <span style="display: inline;" th:text="${item.printNum}"></span></span></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -7,7 +7,6 @@ public interface ThrowBusinessExceptionFunction {
|
||||||
* 抛出异常信息
|
* 抛出异常信息
|
||||||
*
|
*
|
||||||
* @param message 异常信息
|
* @param message 异常信息
|
||||||
* @return void
|
|
||||||
**/
|
**/
|
||||||
void throwMessage(String message);
|
void throwMessage(String message);
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package com.nflg.wms.common.pojo.dto;
|
package com.nflg.wms.common.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class DeliverNormalOrderItemDTO {
|
public class DeliverNormalOrderItemDTO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,6 +29,11 @@ public class DeliverNormalOrderItemDTO {
|
||||||
*/
|
*/
|
||||||
private Long workbenchId;
|
private Long workbenchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商代码
|
||||||
|
*/
|
||||||
|
private String supplierCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料编号
|
* 物料编号
|
||||||
*/
|
*/
|
||||||
|
|
@ -90,7 +97,7 @@ public class DeliverNormalOrderItemDTO {
|
||||||
/**
|
/**
|
||||||
* 打印数量
|
* 打印数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal printNum;
|
private String printNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印编号
|
* 打印编号
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,9 @@ public class DeliverNormalOrderSearchQO extends SearchBaseQO {
|
||||||
* 订单号
|
* 订单号
|
||||||
*/
|
*/
|
||||||
private String externalOrderNo;
|
private String externalOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料编号
|
||||||
|
*/
|
||||||
|
private String materialNo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SearchDeliverOrderQO extends SearchBaseQO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 送货单号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
package com.nflg.wms.common.pojo.vo;
|
package com.nflg.wms.common.pojo.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
public class DeliverNormalOrderVO {
|
public class DeliverNormalOrderVO {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
@ -23,7 +25,7 @@ public class DeliverNormalOrderVO {
|
||||||
/**
|
/**
|
||||||
* 供应商代码
|
* 供应商代码
|
||||||
*/
|
*/
|
||||||
private Long supplierCode;
|
private String supplierCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 供应商名称
|
* 供应商名称
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
package com.nflg.wms.repository.service;
|
package com.nflg.wms.repository.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.nflg.wms.common.pojo.vo.SRMOrderItemVO;
|
|
||||||
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
|
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
* @since 2025
|
* @since 2025
|
||||||
*/
|
*/
|
||||||
public interface IWmsSrmOrderItemService extends IService<WmsSrmOrderItem> {
|
public interface IWmsSrmOrderItemService extends IService<WmsSrmOrderItem> {
|
||||||
SRMOrderItemVO getOrderItem(Long orderId);
|
|
||||||
|
List<WmsSrmOrderItem> getByDeliverOrderId(@Valid @NotNull Long id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@ package com.nflg.wms.repository.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.qo.SearchDeliverOrderQO;
|
||||||
import com.nflg.wms.common.pojo.qo.SRMOrderSearchQO;
|
|
||||||
import com.nflg.wms.common.pojo.vo.SrmOrderVO;
|
|
||||||
import com.nflg.wms.repository.entity.WmsSrmOrder;
|
import com.nflg.wms.repository.entity.WmsSrmOrder;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -18,5 +17,5 @@ import jakarta.validation.Valid;
|
||||||
*/
|
*/
|
||||||
public interface IWmsSrmOrderService extends IService<WmsSrmOrder> {
|
public interface IWmsSrmOrderService extends IService<WmsSrmOrder> {
|
||||||
|
|
||||||
IPage<SrmOrderVO> search(@Valid SRMOrderSearchQO request);
|
IPage<WmsSrmOrder> search(@Valid @NotNull SearchDeliverOrderQO request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
package com.nflg.wms.repository.service.impl;
|
package com.nflg.wms.repository.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.wms.common.pojo.vo.SRMOrderItemVO;
|
|
||||||
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
|
import com.nflg.wms.repository.entity.WmsSrmOrderItem;
|
||||||
import com.nflg.wms.repository.mapper.WmsSrmOrderItemMapper;
|
import com.nflg.wms.repository.mapper.WmsSrmOrderItemMapper;
|
||||||
import com.nflg.wms.repository.service.IWmsSrmOrderItemService;
|
import com.nflg.wms.repository.service.IWmsSrmOrderItemService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
|
|
@ -19,7 +20,7 @@ import org.springframework.stereotype.Service;
|
||||||
public class WmsSrmOrderItemServiceImpl extends ServiceImpl<WmsSrmOrderItemMapper, WmsSrmOrderItem> implements IWmsSrmOrderItemService {
|
public class WmsSrmOrderItemServiceImpl extends ServiceImpl<WmsSrmOrderItemMapper, WmsSrmOrderItem> implements IWmsSrmOrderItemService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SRMOrderItemVO getOrderItem(Long orderId) {
|
public List<WmsSrmOrderItem> getByDeliverOrderId(Long id) {
|
||||||
return baseMapper.getOrderItem(orderId);
|
return lambdaQuery().eq(WmsSrmOrderItem::getOrderId, id).list();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,20 @@
|
||||||
package com.nflg.wms.repository.service.impl;
|
package com.nflg.wms.repository.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.wms.common.pojo.qo.SRMOrderSearchQO;
|
import com.nflg.wms.common.pojo.qo.SearchDeliverOrderQO;
|
||||||
import com.nflg.wms.common.pojo.vo.SrmOrderVO;
|
|
||||||
import com.nflg.wms.repository.entity.WmsSrmOrder;
|
import com.nflg.wms.repository.entity.WmsSrmOrder;
|
||||||
import com.nflg.wms.repository.mapper.WmsSrmOrderMapper;
|
import com.nflg.wms.repository.mapper.WmsSrmOrderMapper;
|
||||||
import com.nflg.wms.repository.service.IWmsSrmOrderService;
|
import com.nflg.wms.repository.service.IWmsSrmOrderService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
|
|
@ -22,7 +24,11 @@ import org.springframework.stereotype.Service;
|
||||||
public class WmsSrmOrderServiceImpl extends ServiceImpl<WmsSrmOrderMapper, WmsSrmOrder> implements IWmsSrmOrderService {
|
public class WmsSrmOrderServiceImpl extends ServiceImpl<WmsSrmOrderMapper, WmsSrmOrder> implements IWmsSrmOrderService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<SrmOrderVO> search(SRMOrderSearchQO request) {
|
public IPage<WmsSrmOrder> search(SearchDeliverOrderQO request) {
|
||||||
return baseMapper.search(request, new Page<>(request.getPage(), request.getPageSize()));
|
return lambdaQuery()
|
||||||
|
.eq(StrUtil.isNotBlank(request.getOrderNo()),WmsSrmOrder::getNoteNum, request.getOrderNo())
|
||||||
|
.ge(Objects.nonNull(request.getStartDate()), WmsSrmOrder::getCreateTime, request.getStartDate())
|
||||||
|
.le(Objects.nonNull(request.getEndDate()), WmsSrmOrder::getCreateTime, request.getEndDate())
|
||||||
|
.page(new Page<>(request.getPage(),request.getPageSize()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
<if test="request.endDate!=null">
|
<if test="request.endDate!=null">
|
||||||
and o.create_time <= #{request.endDate}
|
and o.create_time <= #{request.endDate}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.materialNo!=null and request.materialNo!=''">
|
||||||
|
and o.material_no like concat('%', #{request.materialNo}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue