feat: bug-884 添加【副产品(拆解)入库】业务
This commit is contained in:
parent
578151527a
commit
4b228fa369
|
|
@ -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(整张或者一张一个)
|
||||
* @param request 请求参数
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
|
@ -54,8 +53,6 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/in/produce")
|
||||
public class InProduceOrderController extends BaseController {
|
||||
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
@Resource
|
||||
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(单个)
|
||||
* @param id 订单id
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.nflg.wms.admin.util.QRCodeUtil;
|
|||
import com.nflg.wms.admin.util.ThymeleafUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
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.MaterialQRCodeContentDTO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
|
|
@ -35,10 +36,12 @@ import jakarta.validation.Valid;
|
|||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
|
@ -319,6 +322,52 @@ public class InProduceOrderSurplusController extends BaseController {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出拆解单
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -60,8 +59,6 @@ public class NormalOrderController extends BaseController {
|
|||
@Resource
|
||||
private IUserSupplierService userSupplierService;
|
||||
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
@Resource
|
||||
private IWmsSrmOrderService srmOrderService;
|
||||
|
||||
|
|
@ -202,14 +199,6 @@ public class NormalOrderController extends BaseController {
|
|||
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 请求参数
|
||||
|
|
|
|||
|
|
@ -1,9 +1,26 @@
|
|||
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.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue