一些优化
This commit is contained in:
parent
20684c7acd
commit
1dac30c1d5
|
|
@ -4,6 +4,7 @@ import com.nflg.wms.admin.service.MaterialControllerService;
|
|||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
|
||||
import com.nflg.wms.common.pojo.dto.MaterialCategoryVO;
|
||||
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialSearchQO;
|
||||
|
|
@ -124,6 +125,15 @@ public class MaterialController extends BaseController {
|
|||
return materialControllerService.uploadZip(response,file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物料分类
|
||||
* @param name 分类名称
|
||||
*/
|
||||
@GetMapping("getCategory")
|
||||
public ApiResult<List<MaterialCategoryVO>> getCategory(@RequestParam(required = false) String name) {
|
||||
return ApiResult.success(materialControllerService.getCategory(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索主物料系统物料信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.nflg.wms.admin.controller;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
|
||||
import com.nflg.wms.admin.service.BasdeSerialNumberControllerService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.admin.util.NoUtil;
|
||||
import com.nflg.wms.admin.util.PdfGeneratorUtil;
|
||||
import com.nflg.wms.admin.util.QRCodeUtil;
|
||||
|
|
@ -11,6 +13,7 @@ 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.SAPOrderDTO;
|
||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSaveQO;
|
||||
import com.nflg.wms.common.pojo.qo.DeliverNormalOrderSearchQO;
|
||||
|
|
@ -21,7 +24,6 @@ import com.nflg.wms.common.util.VUtil;
|
|||
import com.nflg.wms.repository.entity.UserSupplier;
|
||||
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.service.IUserSupplierService;
|
||||
import com.nflg.wms.repository.service.IWmsSrmOrderItemService;
|
||||
import com.nflg.wms.repository.service.IWmsSrmOrderService;
|
||||
|
|
@ -30,6 +32,7 @@ import com.nflg.wms.starter.BaseController;
|
|||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
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;
|
||||
|
|
@ -68,6 +71,9 @@ public class NormalOrderController extends BaseController {
|
|||
@Resource
|
||||
private BasdeSerialNumberControllerService serialNumberControllerService;
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
|
|
@ -208,7 +214,7 @@ public class NormalOrderController extends BaseController {
|
|||
exportPdfInAll(convert(orders), response);
|
||||
}
|
||||
|
||||
private List<DeliverNormalOrderItemDTO> convert(List<DeliverNormalOrderVO> orders) throws Exception {
|
||||
private List<DeliverNormalOrderItemDTO> convert(List<DeliverNormalOrderVO> orders) {
|
||||
List<DeliverNormalOrderItemDTO> datas = new ArrayList<>();
|
||||
for (DeliverNormalOrderVO order : orders) {
|
||||
List<String> indexNos = StrUtil.split(order.getIndexNo(), ",");
|
||||
|
|
@ -255,68 +261,76 @@ public class NormalOrderController extends BaseController {
|
|||
* @param id 送货单id
|
||||
*/
|
||||
@GetMapping("getDeliverOrderItems")
|
||||
public ApiResult<List<WmsSrmOrderItem>> getDeliverOrderItems(@Valid @RequestParam @NotNull Long id) {
|
||||
return ApiResult.success(srmOrderItemService.getByDeliverOrderId(id));
|
||||
public ApiResult<List<SAPOrderDTO>> getDeliverOrderItems(@Valid @RequestParam @NotNull Long id) {
|
||||
WmsSrmOrder order = srmOrderService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("送货单不存在");
|
||||
return ApiResult.success(srmOrderItemService.getByDeliverOrderId(id).stream().map(it -> {
|
||||
SAPMaterialInfoInOrderDTO sapOrder = CollectionUtil.get(sapService.zim004(it.getPoNum(), order.getSupplierNum(), it.getItemCode()), 0);
|
||||
SAPOrderDTO vo = new SAPOrderDTO()
|
||||
.setOrderNo(it.getPoNum())
|
||||
.setOrderRowNo(it.getPoLineNumber())
|
||||
.setNoteNum(it.getNoteNum())
|
||||
.setLineNumber(it.getLineNumber())
|
||||
.setMaterialNo(it.getItemCode())
|
||||
.setMaterialDesc(it.getItemName())
|
||||
.setPlanNum(it.getOrderQty())
|
||||
.setTransportNum(it.getDeliveryQty())
|
||||
.setBatchNo(NoUtil.getBatchNo(order.getSupplierNum()));
|
||||
if (Objects.nonNull(sapOrder)) {
|
||||
vo.setLbprt(sapOrder.getLbprt())
|
||||
.setUnit(sapOrder.getMeins())
|
||||
.setKzkri(sapOrder.getKzkri());
|
||||
}
|
||||
return vo;
|
||||
}).toList()
|
||||
);
|
||||
// return ApiResult.success(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逐个打印送货单
|
||||
* @param id 要打印的送货单id
|
||||
* @param datas 要打印的数据
|
||||
*/
|
||||
@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")))
|
||||
// );
|
||||
// }
|
||||
WmsSrmOrder order = srmOrderService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("送货单不存在");
|
||||
List<WmsSrmOrderItem> orders = srmOrderItemService.getByDeliverOrderId(id);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("没有需要打印的数据");
|
||||
exportPdfPerPage(convert1(order.getSupplierNum(), orders), response);
|
||||
@PostMapping("deliver/exportPdfPerPage")
|
||||
public void exportDeliverOrderPdfPerPage(HttpServletResponse response, @Valid @RequestBody @NotEmpty List<DeliverNormalOrderSaveItemQO> datas) throws Exception {
|
||||
exportPdfPerPage(convert1(datas.get(0).getSupplierNo(), datas), response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整张打印送货单
|
||||
* @param id 要打印的送货单id
|
||||
* @param datas 要打印的数据
|
||||
*/
|
||||
@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")))
|
||||
// );
|
||||
// }
|
||||
WmsSrmOrder order = srmOrderService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("送货单不存在");
|
||||
List<WmsSrmOrderItem> items = srmOrderItemService.getByDeliverOrderId(id);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(items)).throwMessage("没有需要打印的数据");
|
||||
exportPdfInAll(convert1(order.getSupplierNum(), items), response);
|
||||
@PostMapping("deliver/exportPdfOnePage")
|
||||
public void exportDeliverOrderPdfOnePage(HttpServletResponse response, @Valid @RequestBody @NotEmpty List<DeliverNormalOrderSaveItemQO> datas) throws Exception {
|
||||
exportPdfInAll(convert1(datas.get(0).getSupplierNo(), datas), response);
|
||||
}
|
||||
|
||||
private List<DeliverNormalOrderItemDTO> convert1(String supplierNo, List<WmsSrmOrderItem> orders) throws Exception {
|
||||
private List<DeliverNormalOrderItemDTO> convert1(String supplierNo, List<DeliverNormalOrderSaveItemQO> 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.setExternalOrderNo(order.getPoNum());
|
||||
dto.setRowNo(order.getPoLineNumber());
|
||||
dto.setIndex(0);
|
||||
dto.setPrintNo(order.getId() + "-" + 0);
|
||||
dto.setPrintNum(DF.format(order.getOrderQty()));
|
||||
dto.setBatchNo(NoUtil.getBatchNo(supplierNo));
|
||||
dto.setQrCode(QRCodeUtil.generateQRCodeBase64(generateQRContent(dto, ""), 100, 100));
|
||||
datas.add(dto);
|
||||
for (DeliverNormalOrderSaveItemQO order : orders) {
|
||||
List<String> indexNos = StrUtil.split(order.getIndexNo(), ",");
|
||||
for (int i = 0; i < order.getLableNum(); i++) {
|
||||
DeliverNormalOrderItemDTO dto = new DeliverNormalOrderItemDTO();
|
||||
dto.setMaterialNo(order.getMaterialNo());
|
||||
dto.setMaterialDesc(order.getMaterialDesc());
|
||||
dto.setExternalOrderNo(order.getExternalOrderNo());
|
||||
dto.setRowNo(order.getRowNo());
|
||||
dto.setBatchNo(NoUtil.getBatchNo(supplierNo));
|
||||
dto.setIndex(i);
|
||||
dto.setPrintNo(order.getId() + "-" + i);
|
||||
if (i == order.getLableNum() - 1) {
|
||||
BigDecimal n = order.getBatchNum().divideAndRemainder(order.getMinPackageNum())[1];
|
||||
if (n.compareTo(BigDecimal.ZERO) == 0) {
|
||||
dto.setPrintNum(DF.format(order.getMinPackageNum()));
|
||||
} else {
|
||||
dto.setPrintNum(DF.format(n));
|
||||
}
|
||||
} else {
|
||||
dto.setPrintNum(DF.format(order.getMinPackageNum()));
|
||||
}
|
||||
dto.setQrCode(QRCodeUtil.generateQRCodeBase64(generateQRContent(dto, CollectionUtil.get(indexNos, i)), 100, 100));
|
||||
datas.add(dto);
|
||||
}
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,4 +327,8 @@ public class MaterialControllerService {
|
|||
.addSheet(new ListSheet<>(datas).setRowHeight(100))
|
||||
.writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
public List<MaterialCategoryVO> getCategory(String name) {
|
||||
return bomMaterialService.getCategory(name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MaterialCategoryVO {
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String categoryCode;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
private List<MaterialCategoryVO> children;
|
||||
}
|
||||
|
|
@ -91,4 +91,14 @@ public class SAPOrderDTO {
|
|||
* 标志:关键部件
|
||||
*/
|
||||
private String kzkri;
|
||||
|
||||
/**
|
||||
* 收货单号
|
||||
*/
|
||||
private String noteNum;
|
||||
|
||||
/**
|
||||
* 送货单行号
|
||||
*/
|
||||
private String lineNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,9 @@ public class BomMaterialListQO extends PageQO{
|
|||
* 物料分类,不需要设置
|
||||
*/
|
||||
private int materialClass=0;
|
||||
|
||||
/**
|
||||
* 物料一级分类编码
|
||||
*/
|
||||
private String firstMaterialCategoryCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MaterialCategoryQO {
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 状态 0:不启用1:启用
|
||||
*/
|
||||
private Integer enableState;
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@ public class PackageAddQO {
|
|||
/**
|
||||
* 总重
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +44,6 @@ public class PackageAddQO {
|
|||
/**
|
||||
* 种类
|
||||
*/
|
||||
@NotBlank
|
||||
private String cate;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ public class DeliverNormalOrderVO {
|
|||
*/
|
||||
private String externalDeliverNo;
|
||||
|
||||
/**
|
||||
* 送货单行号
|
||||
*/
|
||||
private String externalDeliverRowNo;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||
|
||||
@Override
|
||||
public User getByCode(String code) {
|
||||
return lambdaQuery().eq(User::getUserCode, code).one();
|
||||
return lambdaQuery().apply("LOWER({0}) = LOWER({1})", "user_code", code).one();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.DeliverNormalOrderVO">
|
||||
select o.*,us.supplier_name,us.supplier_code as "supplier_no", wb.no as workbench_no
|
||||
from wms_normal_print_order o
|
||||
left join user_supplier us on o.supplier_id=us.user_id
|
||||
left join user_supplier us on o.supplier_id=us.id
|
||||
left join wms_workbench wb on o.workbench_id=wb.id
|
||||
where o.id in
|
||||
<foreach item="item" collection="ids" separator="," open="(" close=")">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<select id="search" resultType="com.nflg.wms.common.pojo.vo.StructuralPackageDeliverOrderVO">
|
||||
select pdo.*, us.supplier_code, us.supplier_name,di."name" AS "factory_no"
|
||||
from wms_structural_package_deliver_order pdo
|
||||
inner join user_supplier us on pdo.supplier_id=us.user_id
|
||||
inner join user_supplier us on pdo.supplier_id=us.id
|
||||
LEFT JOIN dictionary_item di ON pdo.factory_id=di."id"
|
||||
<where>
|
||||
<if test="externalOrderIds!=null">
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
FROM wms_structural_package_order o
|
||||
inner join wms_structural_package_deliver_order_map om on o.id = om.order_id
|
||||
LEFT JOIN wms_workbench wb ON o.workbench_id = wb."id"
|
||||
LEFT JOIN user_supplier us ON o.supplier_id = us.user_id
|
||||
LEFT JOIN user_supplier us ON o.supplier_id = us.id
|
||||
LEFT JOIN wms_structural_package sp ON o.package_id = sp."id"
|
||||
LEFT JOIN wms_model m on o.model_id = m."id"
|
||||
where om.deliver_id = #{id}
|
||||
|
|
|
|||
|
|
@ -3,26 +3,31 @@
|
|||
<mapper namespace="com.nflg.wms.repository.mapper.WmsStructuralPackageMapper">
|
||||
|
||||
<select id="search" resultType="com.nflg.wms.common.pojo.vo.PackageVO">
|
||||
SELECT DISTINCT ON ("no") id,"no","order_no","name",drawing_no,weight,cate,eco,version,remark,enable,create_by,create_time,update_by,update_time,get_modelnos(model_ids) as "modelNos"
|
||||
FROM wms_structural_package
|
||||
<where>
|
||||
<if test="request.no!=null and request.no!=''">
|
||||
and ("no" ilike concat('%', #{request.no}, '%') or "name" ilike concat('%', #{request.no}, '%'))
|
||||
</if>
|
||||
<if test="request.eco!=null and request.eco!=''">
|
||||
and eco ilike concat('%', #{request.eco}, '%')
|
||||
</if>
|
||||
<if test="request.drawingNo!=null and request.drawingNo!=''">
|
||||
and drawing_no like concat('%', #{request.drawingNo}, '%')
|
||||
</if>
|
||||
<if test="request.modelId!=null">
|
||||
and find_in_set(#{request.modelId},model_ids)>0
|
||||
</if>
|
||||
<if test="request.type==0">
|
||||
and latest=true
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY "no",id DESC
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT DISTINCT ON ("no") id,"no","order_no","name",drawing_no,weight,cate,eco,version,remark,enable,create_by
|
||||
,create_time,update_by,update_time,get_modelnos(model_ids) as "modelNos"
|
||||
FROM wms_structural_package
|
||||
<where>
|
||||
<if test="request.no!=null and request.no!=''">
|
||||
and ("no" ilike concat('%', #{request.no}, '%') or "name" ilike concat('%', #{request.no}, '%'))
|
||||
</if>
|
||||
<if test="request.eco!=null and request.eco!=''">
|
||||
and eco ilike concat('%', #{request.eco}, '%')
|
||||
</if>
|
||||
<if test="request.drawingNo!=null and request.drawingNo!=''">
|
||||
and drawing_no like concat('%', #{request.drawingNo}, '%')
|
||||
</if>
|
||||
<if test="request.modelId!=null">
|
||||
and find_in_set(#{request.modelId},model_ids)>0
|
||||
</if>
|
||||
<if test="request.type==0">
|
||||
and latest=true
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY "no",id DESC
|
||||
) t
|
||||
ORDER BY id DESC;
|
||||
</select>
|
||||
|
||||
<select id="getHistory" resultType="com.nflg.wms.common.pojo.vo.PackageVO">
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
,ot.id as "tray_id"
|
||||
FROM wms_structural_package_order o
|
||||
LEFT JOIN wms_workbench wb ON o.workbench_id=wb."id"
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.user_id
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.id
|
||||
LEFT JOIN wms_structural_package sp ON o.package_id=sp."id"
|
||||
LEFT JOIN wms_model m on o.model_id=m."id"
|
||||
inner join wms_structural_package_order_tray ot on o.id=ot.order_id
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
,ot.no as "tray_no",ot.tray,ot.station,ot.state,sp.version as "package_version",sp.drawing_no as "package_drawing_no"
|
||||
FROM wms_structural_package_order o
|
||||
LEFT JOIN wms_workbench wb ON o.workbench_id=wb."id"
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.user_id
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.id
|
||||
LEFT JOIN wms_structural_package sp ON o.package_id=sp."id"
|
||||
LEFT JOIN wms_model m on o.model_id=m."id"
|
||||
inner join wms_structural_package_order_tray ot on o.id=ot.order_id
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
,us.supplier_code,ot.state
|
||||
FROM wms_structural_package_order o
|
||||
LEFT JOIN wms_workbench wb ON o.workbench_id=wb."id"
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.user_id
|
||||
LEFT JOIN user_supplier us ON o.supplier_id=us.id
|
||||
LEFT JOIN wms_structural_package sp ON o.package_id=sp."id"
|
||||
LEFT JOIN wms_model m on o.model_id=m."id"
|
||||
inner join wms_structural_package_order_tray ot on o.id=ot.order_id
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialCategoryQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -50,6 +51,28 @@ public class BomMaterialService {
|
|||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public List<MaterialCategoryVO> getCategory(String name) {
|
||||
MaterialCategoryQO qo = new MaterialCategoryQO()
|
||||
.setCategoryName(name);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.add("authorization", getToken());
|
||||
HttpEntity<MaterialCategoryQO> requestEntity = new HttpEntity<>(qo, headers);
|
||||
ResponseEntity<BomResultDTO<List<MaterialCategoryVO>>> response = restTemplate.exchange(
|
||||
baseUrl + "/api/material/category/getAlllist",
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<>() {
|
||||
}
|
||||
);
|
||||
log.info("查询主物料系统返回状态码:" + response.getStatusCode().value());
|
||||
VUtil.trueThrowBusinessError(!response.getStatusCode().is2xxSuccessful())
|
||||
.throwMessage("查询主物料系统失败");
|
||||
BomResultDTO<List<MaterialCategoryVO>> resultDTO = response.getBody();
|
||||
log.info("查询主物料系统返回数据:" + JSONUtil.toJsonStr(resultDTO));
|
||||
return resultDTO.getData();
|
||||
}
|
||||
|
||||
public List<BomMaterialDTO> getList(Collection<String> nos) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
|
|
|||
Loading…
Reference in New Issue