Compare commits
2 Commits
a693a94d58
...
4b228fa369
| Author | SHA1 | Date |
|---|---|---|
|
|
4b228fa369 | |
|
|
578151527a |
|
|
@ -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 请求参数
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class SapService {
|
|||
|
||||
JCoStructure result = function.getExportParameterList().getStructure("OUTPUT1");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals("S", result.getString("TYPE")))
|
||||
.throwMessage("SAP错误:" + result.getString("MSG"));
|
||||
.throwMessage("SAP:" + result.getString("MSG"));
|
||||
|
||||
return Pair.of(result.getString("MAT_DOC"), result.getString("DOC_YEAR"));
|
||||
}
|
||||
|
|
@ -70,7 +70,13 @@ public class SapService {
|
|||
*/
|
||||
public List<ZWM3A23VO> zwm3a23(ZWM3A23QO request) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("i_werks", request.getWerks());
|
||||
parameters.put("I_WERKS", request.getWerks());
|
||||
if (Objects.nonNull(request.getStartDate())) {
|
||||
parameters.put("S_DATE", DateTimeUtil.format(request.getStartDate(), "yyyyMMdd"));
|
||||
}
|
||||
if (Objects.nonNull(request.getEndDate())) {
|
||||
parameters.put("E_DATE", DateTimeUtil.format(request.getEndDate(), "yyyyMMdd"));
|
||||
}
|
||||
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(request.getArbpls())) {
|
||||
|
|
@ -98,7 +104,7 @@ public class SapService {
|
|||
JCoFunction function = exec("ZWM3A23", parameters, tables);
|
||||
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals("S", function.getExportParameterList().getString("E_TYPE")))
|
||||
.throwMessage("SAP错误:" + function.getExportParameterList().getString("E_MSG"));
|
||||
.throwMessage("SAP:" + function.getExportParameterList().getString("E_MSG"));
|
||||
|
||||
JCoTable table = function.getTableParameterList().getTable("OUTPUT1");
|
||||
return JCoUtil.toBeanList(table, ZWM3A23VO.class);
|
||||
|
|
@ -124,7 +130,7 @@ public class SapService {
|
|||
List<String> errors = lrs.stream().filter(lr -> !StrUtil.equals(lr.getType(), "S"))
|
||||
.map(ZWM00_MB116ReturnVO::getMessage)
|
||||
.toList();
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errors)).throwMessage("SAP错误:" + StrUtil.join(",", errors));
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errors)).throwMessage("SAP:" + StrUtil.join(",", errors));
|
||||
|
||||
return new ZWM00_MB116VO()
|
||||
.setMblnr(function.getExportParameterList().getString("E_MBLNR"))
|
||||
|
|
@ -150,7 +156,7 @@ public class SapService {
|
|||
ZWM00MB007DTO dto = JCoUtil.toBean(eOutput, ZWM00MB007DTO.class);
|
||||
if (StrUtil.isBlank(dto.getAufnr())) {
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(eReturn.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + eReturn.getString("MESSAGE"));
|
||||
.throwMessage("SAP:" + eReturn.getString("MESSAGE"));
|
||||
return null;
|
||||
} else {
|
||||
return dto;
|
||||
|
|
@ -188,7 +194,7 @@ public class SapService {
|
|||
JCoParameterList pl = function.getExportParameterList();
|
||||
log.info("E_MBLNR:{}", pl.getString("E_MBLNR"));
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(pl.getString("E_MBLNR")))
|
||||
.throwMessage("SAP错误");
|
||||
.throwMessage("SAP");
|
||||
VUtil.trueHandle(StrUtil.isBlank(pl.getString("E_MBLNR"))).trueHandle(() -> {
|
||||
JCoTable table = function.getTableParameterList().getTable("T_RETURN");
|
||||
log.error("SAP错误信息:{}", table);
|
||||
|
|
@ -210,7 +216,7 @@ public class SapService {
|
|||
|
||||
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("MSG"));
|
||||
|
||||
JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1");
|
||||
VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据");
|
||||
|
|
@ -252,7 +258,7 @@ public class SapService {
|
|||
JCoParameterList jparameters = execReturnParameter("ZWM3A06", parameters, tables);
|
||||
JCoStructure structure = jparameters.getStructure("OUTPUT");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("MSG"));
|
||||
|
||||
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
|
||||
}
|
||||
|
|
@ -279,7 +285,7 @@ public class SapService {
|
|||
JCoFunction function = exec("ZWM3A18", parameters, tables);
|
||||
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT1");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("MSG"));
|
||||
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +310,7 @@ public class SapService {
|
|||
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT1");
|
||||
print("OUTPUT1", structure);
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("MSG"));
|
||||
|
||||
return Pair.of(Pair.of(structure.getString("MAT_DOC_101"), structure.getString("DOC_YEAR_101"))
|
||||
, Pair.of(structure.getString("MAT_DOC_103"), structure.getString("DOC_YEAR_103")));
|
||||
|
|
@ -332,7 +338,7 @@ public class SapService {
|
|||
List<Map<String, Object>> tOut = JCoUtil.toMapList(table);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(tOut)).throwMessage("SAP未返回结果");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(tOut.get(0).get("E_TYPE").toString(), "S"))
|
||||
.throwMessage("SAP错误:" + tOut.get(0).get("E_MSG"));
|
||||
.throwMessage("SAP:" + tOut.get(0).get("E_MSG"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -401,7 +407,7 @@ public class SapService {
|
|||
|
||||
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
|
||||
VUtil.trueThrow(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage(STATE.SAPErr, "SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage(STATE.SAPErr, "SAP:" + structure.getString("MSG"));
|
||||
|
||||
JCoTable table = function.getTableParameterList().getTable("T_OUT");
|
||||
log.info("SAP返回: {}", table);
|
||||
|
|
@ -1289,7 +1295,7 @@ public class SapService {
|
|||
JCoFunction function = exec("ZWM3A19", parameters, null);
|
||||
JCoParameterList structure = function.getExportParameterList();
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("E_TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("E_MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("E_MSG"));
|
||||
|
||||
JCoTable ot1 = function.getTableParameterList().getTable("HEAD");
|
||||
|
||||
|
|
@ -1339,7 +1345,7 @@ public class SapService {
|
|||
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT");
|
||||
print("输出参数OUTPUT", structure);
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
.throwMessage("SAP:" + structure.getString("MSG"));
|
||||
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.nflg.wms.common.pojo.qo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
public class ZWM3A23QO {
|
||||
|
|
@ -26,4 +28,24 @@ public class ZWM3A23QO {
|
|||
* 工作中心列表
|
||||
*/
|
||||
private List<String> arbpls;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDate startDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDate endDate;
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
if (Objects.nonNull(endDate)) {
|
||||
return endDate;
|
||||
}
|
||||
if (Objects.nonNull(startDate)) {
|
||||
return LocalDate.now();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.wms.common.pojo.vo;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
|
|
@ -28,6 +29,10 @@ public class ZWM3A23VO {
|
|||
*/
|
||||
private String rsnum;
|
||||
|
||||
public String getRsnum() {
|
||||
return StrUtil.removeAllPrefix(rsnum, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
*/
|
||||
|
|
@ -48,6 +53,10 @@ public class ZWM3A23VO {
|
|||
*/
|
||||
private String vornr;
|
||||
|
||||
public String getVornr() {
|
||||
return StrUtil.removeAllPrefix(vornr, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
|
|
@ -109,11 +118,19 @@ public class ZWM3A23VO {
|
|||
*/
|
||||
private String rsnum2;
|
||||
|
||||
public String getRsnum2() {
|
||||
return StrUtil.removeAllPrefix(rsnum2, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 预留/相关需求的项目编号
|
||||
*/
|
||||
private String rspos;
|
||||
|
||||
public String getRspos() {
|
||||
return StrUtil.removeAllPrefix(rspos, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存地点
|
||||
*/
|
||||
|
|
@ -138,6 +155,10 @@ public class ZWM3A23VO {
|
|||
*/
|
||||
private String bdter;
|
||||
|
||||
public String getBdter() {
|
||||
return DateTimeUtil.formatFromMillis(bdter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请数量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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