feat: bug-884 添加【副产品(拆解)入库】业务

This commit is contained in:
曹鹏飞 2025-11-12 14:29:31 +08:00
parent 578151527a
commit 4b228fa369
5 changed files with 66 additions and 30 deletions

View File

@ -195,14 +195,6 @@ public class BarcodePrintingController extends BaseController {
} }
} }
private String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) {
String content = StrUtil.format("{}${}${}${}${}${}${}${}${}"
, order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum()
, order.getMaterialDesc(), "", order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
log.debug("二维码内容:" + content);
return content;
}
/** /**
* 导出物料条码pdf整张或者一张一个 * 导出物料条码pdf整张或者一张一个
* @param request 请求参数 * @param request 请求参数

View File

@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL; import java.net.URL;
import java.text.DecimalFormat;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
@ -54,8 +53,6 @@ import java.util.stream.Collectors;
@RequestMapping("/in/produce") @RequestMapping("/in/produce")
public class InProduceOrderController extends BaseController { public class InProduceOrderController extends BaseController {
private static final DecimalFormat DF = new DecimalFormat("0.00");
@Resource @Resource
private SapService sapService; private SapService sapService;
@ -255,14 +252,6 @@ public class InProduceOrderController extends BaseController {
} }
} }
private String generateQRContent(DeliverNormalOrderItemDTO order,String indexNo){
String content = StrUtil.format("{}${}${}${}${}${}${}${}${}"
, order.getPrintNo(), order.getExternalOrderNo(),order.getRowNo(),order.getMaterialNo(),order.getPrintNum()
, order.getMaterialDesc(), order.getSupplierCode(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
log.debug("二维码内容:"+ content);
return content;
}
/** /**
* 导出报工单PDF单个 * 导出报工单PDF单个
* @param id 订单id * @param id 订单id

View File

@ -17,6 +17,7 @@ import com.nflg.wms.admin.util.QRCodeUtil;
import com.nflg.wms.admin.util.ThymeleafUtil; import com.nflg.wms.admin.util.ThymeleafUtil;
import com.nflg.wms.common.pojo.ApiResult; import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData; import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO;
import com.nflg.wms.common.pojo.dto.InventoryDTO; import com.nflg.wms.common.pojo.dto.InventoryDTO;
import com.nflg.wms.common.pojo.dto.MaterialQRCodeContentDTO; import com.nflg.wms.common.pojo.dto.MaterialQRCodeContentDTO;
import com.nflg.wms.common.pojo.qo.*; import com.nflg.wms.common.pojo.qo.*;
@ -35,10 +36,12 @@ import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
@ -319,6 +322,52 @@ public class InProduceOrderSurplusController extends BaseController {
return ApiResult.success(vo); return ApiResult.success(vo);
} }
/**
* 导出物料条码pdf
* @param id 订单ID
* @param type 1逐个2一页
*/
@GetMapping("exportMaterialsPdf")
public void exportMaterials(HttpServletResponse response, @Valid @RequestParam @NotNull Long id
, @Valid @RequestParam @NotNull Integer type) throws Exception {
WmsInProduceOrderSurplus order = inProduceOrderSurplusService.getById(id);
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在");
List<WmsInProduceOrderSurplusItem> list = inProduceOrderSurplusItemService.getList(id);
List<DeliverNormalOrderItemDTO> datas = new ArrayList<>();
for (WmsInProduceOrderSurplusItem item : list) {
BigDecimal[] result = item.getNum().divideAndRemainder(BigDecimal.ONE);
for (int i = 0, count = result[0].intValue(); i < count; i++) {
DeliverNormalOrderItemDTO dto = new DeliverNormalOrderItemDTO();
dto.setMaterialNo(item.getMatnr());
dto.setMaterialDesc(item.getMaktx2());
dto.setExternalOrderNo(order.getAufnr());
dto.setRowNo("");
dto.setIndex(i);
dto.setPrintNo(IdUtil.getSnowflakeNextIdStr());
if (i == count - 1 && result[1].compareTo(BigDecimal.ZERO) > 0) {
dto.setPrintNum(DF.format(result[1]));
} else {
dto.setPrintNum(DF.format(BigDecimal.ONE));
}
dto.setSupplierCode("");
dto.setBatchNo("");
dto.setQrCode(QRCodeUtil.generateQRCodeBase64(generateQRContent(dto, ""), 100, 100));
datas.add(dto);
}
}
Map<String, Object> variables = new HashMap<>();
variables.put("list", datas);
if (Objects.equals(type, 1)) {
String html = ThymeleafUtil.generator("/template/qrcode/", "dp-1", ".html", variables);
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
PdfGeneratorUtil.generatePdf("普通物料条码(逐个)", html, baseUrl.toString(), response);
} else {
String html = ThymeleafUtil.generator("/template/qrcode/", "dp-2", ".html", variables);
URL baseUrl = new ClassPathResource("template/qrcode/").getURL();
PdfGeneratorUtil.generatePdf("普通物料条码(整张)", html, baseUrl.toString(), response);
}
}
/** /**
* 导出拆解单 * 导出拆解单
*/ */

View File

@ -41,7 +41,6 @@ import org.springframework.web.bind.annotation.*;
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;
@ -60,8 +59,6 @@ public class NormalOrderController extends BaseController {
@Resource @Resource
private IUserSupplierService userSupplierService; private IUserSupplierService userSupplierService;
private static final DecimalFormat DF = new DecimalFormat("0.00");
@Resource @Resource
private IWmsSrmOrderService srmOrderService; private IWmsSrmOrderService srmOrderService;
@ -202,14 +199,6 @@ public class NormalOrderController extends BaseController {
return datas; return datas;
} }
private String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) {
String content = StrUtil.format("{}${}${}${}${}${}${}${}${}"
, order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum()
, order.getMaterialDesc(), order.getSupplierCode(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
log.debug("二维码内容:" + content);
return content;
}
/** /**
* 搜索送货单 * 搜索送货单
* @param request 请求参数 * @param request 请求参数

View File

@ -1,9 +1,26 @@
package com.nflg.wms.starter; package com.nflg.wms.starter;
import cn.hutool.core.util.StrUtil;
import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.DecimalFormat;
import java.util.Optional;
@Slf4j
@Validated @Validated
@RestController @RestController
public class BaseController { public class BaseController {
protected final DecimalFormat DF = new DecimalFormat("0.00");
protected String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) {
String content = StrUtil.format("{}${}${}${}${}${}${}${}${}"
, order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum()
, order.getMaterialDesc(), order.getSupplierCode(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
log.debug("二维码内容:" + content);
return content;
}
} }