Compare commits

...

9 Commits

12 changed files with 349 additions and 52 deletions

View File

@ -5,17 +5,17 @@ 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.BomMaterialDTO; import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
import com.nflg.wms.common.pojo.dto.MaterialCategoryVO; import com.nflg.wms.common.pojo.dto.MaterialCategoryVO;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO; import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.qo.MaterialAddQO; import com.nflg.wms.common.pojo.vo.EbomParentVO;
import com.nflg.wms.common.pojo.qo.MaterialSearchQO;
import com.nflg.wms.common.pojo.qo.MaterialUpdateQO;
import com.nflg.wms.common.pojo.vo.MaterialVO; import com.nflg.wms.common.pojo.vo.MaterialVO;
import com.nflg.wms.common.pojo.vo.QueryMaterialsVO;
import com.nflg.wms.starter.BaseController; import com.nflg.wms.starter.BaseController;
import jakarta.annotation.Resource; 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.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
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 org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -144,10 +144,19 @@ public class MaterialController extends BaseController {
/** /**
* 批量获取物料信息 * 批量获取物料信息
* @param materialNos 物料编号列表 * @param request 物料信息列表
*/ */
@PostMapping("getBomMaterials") @PostMapping("queryMaterials")
public ApiResult<List<BomMaterialDTO>> getBomMaterials(@Valid @RequestBody @NotEmpty List<String> materialNos) { public ApiResult<List<QueryMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQO> request) {
return ApiResult.success(materialControllerService.getBomMaterials(materialNos)); return ApiResult.success(materialControllerService.queryMaterials(request));
}
/**
* 单个获取物料信息
* @param request 物料信息
*/
@PostMapping("queryMaterial")
public ApiResult<EbomParentVO> queryMaterial(@Valid @RequestBody @NotNull EbomMaterialQO request) {
return ApiResult.success(materialControllerService.queryMaterial(request));
} }
} }

View File

@ -58,16 +58,22 @@ public class BomControllerService {
@Transactional @Transactional
public void add(@Valid BomMaterialDTO dto) { public void add(@Valid BomMaterialDTO dto) {
VUtil.trueThrowBusinessError(StrUtil.isBlank(dto.getMaterialNo())).throwMessage("物料编号不能为空");
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(dto.getChildren())).throwMessage("子级物料不可以为空!");
BigDecimal totalWight = dto.getChildren().stream()
.map(child -> child.getMaterialWeight() != null ? child.getMaterialWeight() : new BigDecimal(0))
.reduce(BigDecimal.ZERO, BigDecimal::add);
WmsBom parent = new WmsBom() WmsBom parent = new WmsBom()
.setParentId(0L) .setParentId(0L)
.setNo(dto.getMaterialNo()) .setNo(dto.getMaterialNo())
.setDescribe(dto.getMaterialDesc()) .setDescribe(dto.getMaterialDesc())
.setDrawingNo(dto.getDrawingNo()) .setDrawingNo(dto.getDrawingNo())
.setWeight(dto.getMaterialWeight()) .setWeight(totalWight)
.setNum(dto.getNum()) .setNum(new BigDecimal(1))
.setCreateBy(UserUtil.getUserName()) .setCreateBy(UserUtil.getUserName())
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
bomService.add(parent, dto.getChildren().stream().map(it-> new WmsBom() bomService.add(parent, dto.getChildren().stream().map(it -> new WmsBom()
.setNo(it.getMaterialNo()) .setNo(it.getMaterialNo())
.setDescribe(it.getMaterialDesc()) .setDescribe(it.getMaterialDesc())
.setDrawingNo(it.getDrawingNo()) .setDrawingNo(it.getDrawingNo())
@ -86,7 +92,7 @@ public class BomControllerService {
.setDrawingNo(it.getDrawingNo()) .setDrawingNo(it.getDrawingNo())
.setWeight(it.getMaterialWeight()) .setWeight(it.getMaterialWeight())
.setNum(it.getNum()); .setNum(it.getNum());
if (Objects.isNull(wmsBom.getId())){ if (Objects.isNull(wmsBom.getId())) {
wmsBom.setParentId(request.getId()); wmsBom.setParentId(request.getId());
wmsBom.setCreateBy(UserUtil.getUserName()); wmsBom.setCreateBy(UserUtil.getUserName());
wmsBom.setCreateTime(LocalDateTime.now()); wmsBom.setCreateTime(LocalDateTime.now());
@ -108,14 +114,14 @@ public class BomControllerService {
} else { } else {
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(getResultName(file.getOriginalFilename()), StandardCharsets.UTF_8)); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(getResultName(file.getOriginalFilename()), StandardCharsets.UTF_8));
try(ByteArrayOutputStream osOut = new ByteArrayOutputStream()) { try (ByteArrayOutputStream osOut = new ByteArrayOutputStream()) {
new Workbook() new Workbook()
.addSheet(new ListSheet<>(data)) .addSheet(new ListSheet<>(data))
.writeTo(osOut); .writeTo(osOut);
try(ByteArrayInputStream isIn = new ByteArrayInputStream(osOut.toByteArray())) { try (ByteArrayInputStream isIn = new ByteArrayInputStream(osOut.toByteArray())) {
return ApiResult.error(STATE.DataNoCheckPass, "导入文件失败", fileUploadService.upload("temp/" + DateTimeUtil.format(LocalDate.now(), "yyyyMMdd") + "/" + IdUtil.fastUUID() + ".xlsx", isIn, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); return ApiResult.error(STATE.DataNoCheckPass, "导入文件失败", fileUploadService.upload("temp/" + DateTimeUtil.format(LocalDate.now(), "yyyyMMdd") + "/" + IdUtil.fastUUID() + ".xlsx", isIn, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
} }
}catch (Exception e){ } catch (Exception e) {
return ApiResult.error(STATE.BusinessError, "保存文件出错"); return ApiResult.error(STATE.BusinessError, "保存文件出错");
} }
} }
@ -135,7 +141,7 @@ public class BomControllerService {
if (Objects.isNull(pm)) { if (Objects.isNull(pm)) {
sb.append("父级物料编号无效"); sb.append("父级物料编号无效");
} else { } else {
WmsBom pb=bomService.lambdaQuery().eq(WmsBom::getParentId, 0L).eq(WmsBom::getNo, dto.getParentNo()).one(); WmsBom pb = bomService.lambdaQuery().eq(WmsBom::getParentId, 0L).eq(WmsBom::getNo, dto.getParentNo()).one();
if (Objects.isNull(pb)) { if (Objects.isNull(pb)) {
pb = new WmsBom() pb = new WmsBom()
.setId(IdUtil.getSnowflakeNextId()) .setId(IdUtil.getSnowflakeNextId())
@ -152,12 +158,12 @@ public class BomControllerService {
} }
if (StrUtil.isBlank(dto.getChildNo())) { if (StrUtil.isBlank(dto.getChildNo())) {
sb.append("子级物料编号不能为空;"); sb.append("子级物料编号不能为空;");
}else { } else {
BomMaterialDTO cm = bomMaterialService.getMaterialInfo(dto.getChildNo()); BomMaterialDTO cm = bomMaterialService.getMaterialInfo(dto.getChildNo());
if (Objects.isNull(cm)) { if (Objects.isNull(cm)) {
sb.append("子级物料编号无效;"); sb.append("子级物料编号无效;");
}else if (bom.getParentId()!=0L){ } else if (bom.getParentId() != 0L) {
WmsBom cb=bomService.lambdaQuery().eq(WmsBom::getParentId, bom.getParentId()).eq(WmsBom::getNo, dto.getChildNo()).one(); WmsBom cb = bomService.lambdaQuery().eq(WmsBom::getParentId, bom.getParentId()).eq(WmsBom::getNo, dto.getChildNo()).one();
if (Objects.isNull(cb)) { if (Objects.isNull(cb)) {
bom.setNo(dto.getChildNo()) bom.setNo(dto.getChildNo())
.setDrawingNo(cm.getDrawingNo()) .setDrawingNo(cm.getDrawingNo())
@ -175,18 +181,18 @@ public class BomControllerService {
} }
if (StrUtil.isBlank(dto.getNum())) { if (StrUtil.isBlank(dto.getNum())) {
sb.append("数量不能为空;"); sb.append("数量不能为空;");
} else if (!NumberUtils.isCreatable(dto.getNum())){ } else if (!NumberUtils.isCreatable(dto.getNum())) {
sb.append("数量格式错误;"); sb.append("数量格式错误;");
}else { } else {
bom.setNum(new BigDecimal(dto.getNum())); bom.setNum(new BigDecimal(dto.getNum()));
} }
dto.setError(sb.toString()); dto.setError(sb.toString());
} }
if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))) { if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))) {
if (CollectionUtil.isNotEmpty(bomForSave)){ if (CollectionUtil.isNotEmpty(bomForSave)) {
bomService.saveBatch(bomForSave); bomService.saveBatch(bomForSave);
} }
if (CollectionUtil.isNotEmpty(bomForUpdate)){ if (CollectionUtil.isNotEmpty(bomForUpdate)) {
bomService.updateBatchById(bomForUpdate); bomService.updateBatchById(bomForUpdate);
} }
return true; return true;
@ -194,25 +200,25 @@ public class BomControllerService {
return false; return false;
} }
private String getResultName(String name){ private String getResultName(String name) {
int index=name.lastIndexOf("."); int index = name.lastIndexOf(".");
return name.substring(0,index)+"_结果"+"."+name.substring(index+1); return name.substring(0, index) + "_结果" + "." + name.substring(index + 1);
} }
public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException { public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException {
if (CollectionUtil.isEmpty(ids)){ if (CollectionUtil.isEmpty(ids)) {
exportTemplate(response); exportTemplate(response);
}else { } else {
List<WmsBom> parents = bomService.lambdaQuery().eq(WmsBom::getParentId, 0L).in(WmsBom::getId, ids).list(); List<WmsBom> parents = bomService.lambdaQuery().eq(WmsBom::getParentId, 0L).in(WmsBom::getId, ids).list();
if (CollectionUtil.isEmpty(parents)){ if (CollectionUtil.isEmpty(parents)) {
exportTemplate(response); exportTemplate(response);
return; return;
} }
List<BomExportExcelDTO> datas=new ArrayList<>(); List<BomExportExcelDTO> datas = new ArrayList<>();
parents.forEach(p->{ parents.forEach(p -> {
List<WmsBom> children=bomService.lambdaQuery().eq(WmsBom::getParentId, p.getId()).list(); List<WmsBom> children = bomService.lambdaQuery().eq(WmsBom::getParentId, p.getId()).list();
if (CollectionUtil.isNotEmpty(children)){ if (CollectionUtil.isNotEmpty(children)) {
datas.addAll(children.stream().map(c->new BomExportExcelDTO() datas.addAll(children.stream().map(c -> new BomExportExcelDTO()
.setParentNo(p.getNo()) .setParentNo(p.getNo())
.setParentDrawingNo(p.getDrawingNo()) .setParentDrawingNo(p.getDrawingNo())
.setParentDesc(p.getDescribe()) .setParentDesc(p.getDescribe())
@ -222,7 +228,7 @@ public class BomControllerService {
.setNum(String.valueOf(c.getNum()))).toList()); .setNum(String.valueOf(c.getNum()))).toList());
} }
}); });
if (CollectionUtil.isEmpty(datas)){ if (CollectionUtil.isEmpty(datas)) {
exportTemplate(response); exportTemplate(response);
return; return;
} }
@ -237,7 +243,7 @@ public class BomControllerService {
private void exportTemplate(HttpServletResponse response) throws IOException { private void exportTemplate(HttpServletResponse response) throws IOException {
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("齐套导入模板.xlsx", StandardCharsets.UTF_8)); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("齐套导入模板.xlsx", StandardCharsets.UTF_8));
List<BomExportExcelDTO> datas=new ArrayList<>(); List<BomExportExcelDTO> datas = new ArrayList<>();
datas.add(new BomExportExcelDTO() datas.add(new BomExportExcelDTO()
.setParentNo("父级物料编号") .setParentNo("父级物料编号")
.setParentDrawingNo("父级物料图号") .setParentDrawingNo("父级物料图号")
@ -252,11 +258,11 @@ public class BomControllerService {
} }
public void exportSearch(HttpServletResponse response, @Valid BomSearchQO request) throws IOException { public void exportSearch(HttpServletResponse response, @Valid BomSearchQO request) throws IOException {
List<BomMaterialVO> list=bomService.searchNonPage(request); List<BomMaterialVO> list = bomService.searchNonPage(request);
List<BomExportExcelDTO> datas=new ArrayList<>(); List<BomExportExcelDTO> datas = new ArrayList<>();
list.forEach(p->{ list.forEach(p -> {
if (CollectionUtil.isNotEmpty(p.getChildren())){ if (CollectionUtil.isNotEmpty(p.getChildren())) {
datas.addAll(p.getChildren().stream().map(c->new BomExportExcelDTO() datas.addAll(p.getChildren().stream().map(c -> new BomExportExcelDTO()
.setParentNo(p.getMaterialNo()) .setParentNo(p.getMaterialNo())
.setParentDrawingNo(p.getDrawingNo()) .setParentDrawingNo(p.getDrawingNo())
.setParentDesc(p.getMaterialDesc()) .setParentDesc(p.getMaterialDesc())
@ -266,7 +272,7 @@ public class BomControllerService {
.setNum(String.valueOf(c.getNum()))).toList()); .setNum(String.valueOf(c.getNum()))).toList());
} }
}); });
if (CollectionUtil.isEmpty(datas)){ if (CollectionUtil.isEmpty(datas)) {
datas.add(new BomExportExcelDTO()); datas.add(new BomExportExcelDTO());
} }
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);

View File

@ -10,11 +10,10 @@ import com.nflg.wms.common.constant.STATE;
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.*; import com.nflg.wms.common.pojo.dto.*;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO; import com.nflg.wms.common.pojo.qo.*;
import com.nflg.wms.common.pojo.qo.MaterialAddQO; import com.nflg.wms.common.pojo.vo.EbomParentVO;
import com.nflg.wms.common.pojo.qo.MaterialSearchQO;
import com.nflg.wms.common.pojo.qo.MaterialUpdateQO;
import com.nflg.wms.common.pojo.vo.MaterialVO; import com.nflg.wms.common.pojo.vo.MaterialVO;
import com.nflg.wms.common.pojo.vo.QueryMaterialsVO;
import com.nflg.wms.common.util.DateTimeUtil; import com.nflg.wms.common.util.DateTimeUtil;
import com.nflg.wms.common.util.EecExcelUtil; import com.nflg.wms.common.util.EecExcelUtil;
import com.nflg.wms.common.util.UserUtil; import com.nflg.wms.common.util.UserUtil;
@ -332,7 +331,11 @@ public class MaterialControllerService {
return bomMaterialService.getCategory(name); return bomMaterialService.getCategory(name);
} }
public List<BomMaterialDTO> getBomMaterials(@Valid @NotEmpty List<String> materialNos) { public List<QueryMaterialsVO> queryMaterials(@Valid @NotEmpty List<QueryMaterialsQO> request) {
return bomMaterialService.getList(materialNos); return bomMaterialService.queryMaterials(request);
}
public EbomParentVO queryMaterial(@Valid @NotEmpty EbomMaterialQO request) {
return bomMaterialService.queryMaterial(request);
} }
} }

View File

@ -40,7 +40,7 @@ public class BomMaterialDTO {
/** /**
* 重量 * 重量
*/ */
@NotBlank @NotNull
private BigDecimal materialWeight; private BigDecimal materialWeight;
/** /**

View File

@ -0,0 +1,17 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
@Data
public class EbomMaterialQO {
/**
* 图号
*/
private String drawingNo;
/**
* 物料编码
*/
private String materialNo;
}

View File

@ -0,0 +1,44 @@
package com.nflg.wms.common.pojo.qo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class QueryMaterialsQO {
/**
* 前端行序号
*/
private String orderNumber;
/**
* 图号
*/
private String drawingNo;
/**
* 物料编码
*/
private String materialNo;
/**
* 单重
*/
private BigDecimal unitWeight;
/**
* 项目类别
*/
private String projectType;
/**
* 工厂
*/
private String factory;
/**
* 存储地点
*/
private String storage;
}

View File

@ -0,0 +1,62 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class EbomParentVO {
private Long materialRowId;
private String materialNo;
private String materialName;
private String materialDesc;
private String materialCategoryCode;
private Integer materialGetType;
private String projectType;
private String procureType;
private Integer materialState;
private Integer processState;
protected String drawingNo;
/**
* 材料
*/
private String material;
private String materialTexture;
private String relCategoryCode;
private String categoryName;
private String materialUnit;
private BigDecimal materialWeight;
/**
* 物料编码申请部门
*/
private String applyDeptName;
/**
* 单重
*/
private BigDecimal unitWeight;
/**
* 总重
*/
private BigDecimal totalWeight;
}

View File

@ -0,0 +1,106 @@
package com.nflg.wms.common.pojo.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Objects;
@Data
public class QueryMaterialsVO {
/**
* 物料主数据行ID
*/
private Long materialRowId;
/**
* 物料编码
*/
private String materialNo;
/**
* 物料名称
*/
private String materialName;
/**
* 物料描述
*/
private String materialDesc;
/**
* 物料分类编码
*/
private String materialCategoryCode;
/**
* 制作物料获取类型1=自制2=外协3=采购
*/
private Integer materialGetType;
/**
* 采购类型
*/
private String procureType;
/**
* 物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用
*/
private Integer materialState;
/**
* 图号
*/
protected String drawingNo;
/**
* 材料
*/
private String material;
/**
* 材质
*/
private String materialTexture;
/**
* 物料大类别
*/
private String relCategoryCode;
/**
* 物料分类编码名称
*/
private String categoryName;
/**
* 单位
*/
private String materialUnit;
/**
* 单重
*/
private BigDecimal materialWeight;
/**
* 前端行序号
*/
private String orderNumber;
/**
* 是否有BOM: 0- 1-
*/
private Integer bomExist = 0;
private BigDecimal unitWeight;
public BigDecimal getUnitWeight() {
if (Objects.nonNull(unitWeight)) {
return unitWeight;
}
return getMaterialWeight();
}
private BigDecimal totalWeight;
}

View File

@ -5,7 +5,7 @@
<select id="getTask" resultType="com.nflg.wms.repository.entity.WmsPoReceipt"> <select id="getTask" resultType="com.nflg.wms.repository.entity.WmsPoReceipt">
select * select *
from wms_po_receipt from wms_po_receipt
where is_completed=false and sourceType=0 where is_completed=false and source_type=0
<if test="orederNo !=null and orederNo !='' "> <if test="orederNo !=null and orederNo !='' ">
and ( order_no ilike #{orederNo} or in_num ilike #{orederNo} ) and ( order_no ilike #{orederNo} or in_num ilike #{orederNo} )
</if> </if>

View File

@ -9,7 +9,7 @@
create_time, create_time,
factory_code factory_code
from wms_qc_receive from wms_qc_receive
where is_completed !=2 and is_check = true and sourceType=0 where is_completed !=2 and is_check = true and source_type=0
<if test="orderNo != null and orderNo != ''"> <if test="orderNo != null and orderNo != ''">
and ( in_no ilike concat( '%',#{orderNo},'%') or order_no ilike concat( '%',#{orderNo},'%') ) and ( in_no ilike concat( '%',#{orderNo},'%') or order_no ilike concat( '%',#{orderNo},'%') )
</if> </if>

View File

@ -27,7 +27,7 @@
</where> </where>
ORDER BY "no",id DESC ORDER BY "no",id DESC
) t ) t
ORDER BY id DESC; ORDER BY id DESC
</select> </select>
<select id="getHistory" resultType="com.nflg.wms.common.pojo.vo.PackageVO"> <select id="getHistory" resultType="com.nflg.wms.common.pojo.vo.PackageVO">

View File

@ -4,7 +4,11 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.nflg.wms.common.pojo.dto.*; import com.nflg.wms.common.pojo.dto.*;
import com.nflg.wms.common.pojo.qo.BomMaterialListQO; import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
import com.nflg.wms.common.pojo.qo.EbomMaterialQO;
import com.nflg.wms.common.pojo.qo.MaterialCategoryQO; import com.nflg.wms.common.pojo.qo.MaterialCategoryQO;
import com.nflg.wms.common.pojo.qo.QueryMaterialsQO;
import com.nflg.wms.common.pojo.vo.EbomParentVO;
import com.nflg.wms.common.pojo.vo.QueryMaterialsVO;
import com.nflg.wms.common.util.VUtil; import com.nflg.wms.common.util.VUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -45,6 +49,12 @@ public class BomMaterialService {
@Value("${bom.material.list.url}") @Value("${bom.material.list.url}")
private String materialListUrl; private String materialListUrl;
@Value("${bom.material.queryMaterials.url}")
private String materialQueryMaterialsUrl;
@Value("${bom.material.queryMaterial.url}")
private String materialQueryMaterialUrl;
@Resource @Resource
private RestTemplate restTemplate; private RestTemplate restTemplate;
@ -158,4 +168,44 @@ public class BomMaterialService {
} }
return token; return token;
} }
public List<QueryMaterialsVO> queryMaterials(List<QueryMaterialsQO> qo) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("authorization", getToken());
HttpEntity<List<QueryMaterialsQO>> requestEntity = new HttpEntity<>(qo, headers);
ResponseEntity<BomResultDTO<List<QueryMaterialsVO>>> response = restTemplate.exchange(
baseUrl + materialQueryMaterialsUrl,
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() {
}
);
log.info("查询主物料系统返回状态码:" + response.getStatusCode().value());
VUtil.trueThrowBusinessError(!response.getStatusCode().is2xxSuccessful())
.throwMessage("查询主物料系统失败");
BomResultDTO<List<QueryMaterialsVO>> resultDTO = response.getBody();
log.info("查询主物料系统返回数据:" + JSONUtil.toJsonStr(resultDTO));
return resultDTO.getData();
}
public EbomParentVO queryMaterial(EbomMaterialQO qo) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("authorization", getToken());
HttpEntity<EbomMaterialQO> requestEntity = new HttpEntity<>(qo, headers);
ResponseEntity<BomResultDTO<EbomParentVO>> response = restTemplate.exchange(
baseUrl + materialQueryMaterialUrl,
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() {
}
);
log.info("查询主物料系统返回状态码:" + response.getStatusCode().value());
VUtil.trueThrowBusinessError(!response.getStatusCode().is2xxSuccessful())
.throwMessage("查询主物料系统失败");
BomResultDTO<EbomParentVO> resultDTO = response.getBody();
log.info("查询主物料系统返回数据:" + JSONUtil.toJsonStr(resultDTO));
return resultDTO.getData();
}
} }