Compare commits
9 Commits
7cc07aac8b
...
d210cd94c5
| Author | SHA1 | Date |
|---|---|---|
|
|
d210cd94c5 | |
|
|
9c55faa3d7 | |
|
|
f4b2ef7608 | |
|
|
51e56cdf0c | |
|
|
eaa57a56f4 | |
|
|
e9de23c491 | |
|
|
03e2d272d8 | |
|
|
45d678f980 | |
|
|
a37736494a |
|
|
@ -5,17 +5,17 @@ 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;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialUpdateQO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.EbomParentVO;
|
||||
import com.nflg.wms.common.pojo.vo.MaterialVO;
|
||||
import com.nflg.wms.common.pojo.vo.QueryMaterialsVO;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -144,10 +144,19 @@ public class MaterialController extends BaseController {
|
|||
|
||||
/**
|
||||
* 批量获取物料信息
|
||||
* @param materialNos 物料编号列表
|
||||
* @param request 物料信息列表
|
||||
*/
|
||||
@PostMapping("getBomMaterials")
|
||||
public ApiResult<List<BomMaterialDTO>> getBomMaterials(@Valid @RequestBody @NotEmpty List<String> materialNos) {
|
||||
return ApiResult.success(materialControllerService.getBomMaterials(materialNos));
|
||||
@PostMapping("queryMaterials")
|
||||
public ApiResult<List<QueryMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQO> request) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,16 +58,22 @@ public class BomControllerService {
|
|||
|
||||
@Transactional
|
||||
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()
|
||||
.setParentId(0L)
|
||||
.setNo(dto.getMaterialNo())
|
||||
.setDescribe(dto.getMaterialDesc())
|
||||
.setDrawingNo(dto.getDrawingNo())
|
||||
.setWeight(dto.getMaterialWeight())
|
||||
.setNum(dto.getNum())
|
||||
.setWeight(totalWight)
|
||||
.setNum(new BigDecimal(1))
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.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())
|
||||
.setDescribe(it.getMaterialDesc())
|
||||
.setDrawingNo(it.getDrawingNo())
|
||||
|
|
@ -86,7 +92,7 @@ public class BomControllerService {
|
|||
.setDrawingNo(it.getDrawingNo())
|
||||
.setWeight(it.getMaterialWeight())
|
||||
.setNum(it.getNum());
|
||||
if (Objects.isNull(wmsBom.getId())){
|
||||
if (Objects.isNull(wmsBom.getId())) {
|
||||
wmsBom.setParentId(request.getId());
|
||||
wmsBom.setCreateBy(UserUtil.getUserName());
|
||||
wmsBom.setCreateTime(LocalDateTime.now());
|
||||
|
|
@ -108,14 +114,14 @@ public class BomControllerService {
|
|||
} else {
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
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()
|
||||
.addSheet(new ListSheet<>(data))
|
||||
.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"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return ApiResult.error(STATE.BusinessError, "保存文件出错");
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +141,7 @@ public class BomControllerService {
|
|||
if (Objects.isNull(pm)) {
|
||||
sb.append("父级物料编号无效");
|
||||
} 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)) {
|
||||
pb = new WmsBom()
|
||||
.setId(IdUtil.getSnowflakeNextId())
|
||||
|
|
@ -152,12 +158,12 @@ public class BomControllerService {
|
|||
}
|
||||
if (StrUtil.isBlank(dto.getChildNo())) {
|
||||
sb.append("子级物料编号不能为空;");
|
||||
}else {
|
||||
} else {
|
||||
BomMaterialDTO cm = bomMaterialService.getMaterialInfo(dto.getChildNo());
|
||||
if (Objects.isNull(cm)) {
|
||||
sb.append("子级物料编号无效;");
|
||||
}else if (bom.getParentId()!=0L){
|
||||
WmsBom cb=bomService.lambdaQuery().eq(WmsBom::getParentId, bom.getParentId()).eq(WmsBom::getNo, dto.getChildNo()).one();
|
||||
} else if (bom.getParentId() != 0L) {
|
||||
WmsBom cb = bomService.lambdaQuery().eq(WmsBom::getParentId, bom.getParentId()).eq(WmsBom::getNo, dto.getChildNo()).one();
|
||||
if (Objects.isNull(cb)) {
|
||||
bom.setNo(dto.getChildNo())
|
||||
.setDrawingNo(cm.getDrawingNo())
|
||||
|
|
@ -175,18 +181,18 @@ public class BomControllerService {
|
|||
}
|
||||
if (StrUtil.isBlank(dto.getNum())) {
|
||||
sb.append("数量不能为空;");
|
||||
} else if (!NumberUtils.isCreatable(dto.getNum())){
|
||||
} else if (!NumberUtils.isCreatable(dto.getNum())) {
|
||||
sb.append("数量格式错误;");
|
||||
}else {
|
||||
} else {
|
||||
bom.setNum(new BigDecimal(dto.getNum()));
|
||||
}
|
||||
dto.setError(sb.toString());
|
||||
}
|
||||
if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))) {
|
||||
if (CollectionUtil.isNotEmpty(bomForSave)){
|
||||
if (CollectionUtil.isNotEmpty(bomForSave)) {
|
||||
bomService.saveBatch(bomForSave);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(bomForUpdate)){
|
||||
if (CollectionUtil.isNotEmpty(bomForUpdate)) {
|
||||
bomService.updateBatchById(bomForUpdate);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -194,25 +200,25 @@ public class BomControllerService {
|
|||
return false;
|
||||
}
|
||||
|
||||
private String getResultName(String name){
|
||||
int index=name.lastIndexOf(".");
|
||||
return name.substring(0,index)+"_结果"+"."+name.substring(index+1);
|
||||
private String getResultName(String name) {
|
||||
int index = name.lastIndexOf(".");
|
||||
return name.substring(0, index) + "_结果" + "." + name.substring(index + 1);
|
||||
}
|
||||
|
||||
public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException {
|
||||
if (CollectionUtil.isEmpty(ids)){
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
exportTemplate(response);
|
||||
}else {
|
||||
} else {
|
||||
List<WmsBom> parents = bomService.lambdaQuery().eq(WmsBom::getParentId, 0L).in(WmsBom::getId, ids).list();
|
||||
if (CollectionUtil.isEmpty(parents)){
|
||||
if (CollectionUtil.isEmpty(parents)) {
|
||||
exportTemplate(response);
|
||||
return;
|
||||
}
|
||||
List<BomExportExcelDTO> datas=new ArrayList<>();
|
||||
parents.forEach(p->{
|
||||
List<WmsBom> children=bomService.lambdaQuery().eq(WmsBom::getParentId, p.getId()).list();
|
||||
if (CollectionUtil.isNotEmpty(children)){
|
||||
datas.addAll(children.stream().map(c->new BomExportExcelDTO()
|
||||
List<BomExportExcelDTO> datas = new ArrayList<>();
|
||||
parents.forEach(p -> {
|
||||
List<WmsBom> children = bomService.lambdaQuery().eq(WmsBom::getParentId, p.getId()).list();
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
datas.addAll(children.stream().map(c -> new BomExportExcelDTO()
|
||||
.setParentNo(p.getNo())
|
||||
.setParentDrawingNo(p.getDrawingNo())
|
||||
.setParentDesc(p.getDescribe())
|
||||
|
|
@ -222,7 +228,7 @@ public class BomControllerService {
|
|||
.setNum(String.valueOf(c.getNum()))).toList());
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isEmpty(datas)){
|
||||
if (CollectionUtil.isEmpty(datas)) {
|
||||
exportTemplate(response);
|
||||
return;
|
||||
}
|
||||
|
|
@ -237,7 +243,7 @@ public class BomControllerService {
|
|||
private void exportTemplate(HttpServletResponse response) throws IOException {
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
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()
|
||||
.setParentNo("父级物料编号")
|
||||
.setParentDrawingNo("父级物料图号")
|
||||
|
|
@ -252,11 +258,11 @@ public class BomControllerService {
|
|||
}
|
||||
|
||||
public void exportSearch(HttpServletResponse response, @Valid BomSearchQO request) throws IOException {
|
||||
List<BomMaterialVO> list=bomService.searchNonPage(request);
|
||||
List<BomExportExcelDTO> datas=new ArrayList<>();
|
||||
list.forEach(p->{
|
||||
if (CollectionUtil.isNotEmpty(p.getChildren())){
|
||||
datas.addAll(p.getChildren().stream().map(c->new BomExportExcelDTO()
|
||||
List<BomMaterialVO> list = bomService.searchNonPage(request);
|
||||
List<BomExportExcelDTO> datas = new ArrayList<>();
|
||||
list.forEach(p -> {
|
||||
if (CollectionUtil.isNotEmpty(p.getChildren())) {
|
||||
datas.addAll(p.getChildren().stream().map(c -> new BomExportExcelDTO()
|
||||
.setParentNo(p.getMaterialNo())
|
||||
.setParentDrawingNo(p.getDrawingNo())
|
||||
.setParentDesc(p.getMaterialDesc())
|
||||
|
|
@ -266,7 +272,7 @@ public class BomControllerService {
|
|||
.setNum(String.valueOf(c.getNum()))).toList());
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isEmpty(datas)){
|
||||
if (CollectionUtil.isEmpty(datas)) {
|
||||
datas.add(new BomExportExcelDTO());
|
||||
}
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ import com.nflg.wms.common.constant.STATE;
|
|||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
import com.nflg.wms.common.pojo.qo.BomMaterialListQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.MaterialUpdateQO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.EbomParentVO;
|
||||
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.EecExcelUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
|
|
@ -332,7 +331,11 @@ public class MaterialControllerService {
|
|||
return bomMaterialService.getCategory(name);
|
||||
}
|
||||
|
||||
public List<BomMaterialDTO> getBomMaterials(@Valid @NotEmpty List<String> materialNos) {
|
||||
return bomMaterialService.getList(materialNos);
|
||||
public List<QueryMaterialsVO> queryMaterials(@Valid @NotEmpty List<QueryMaterialsQO> request) {
|
||||
return bomMaterialService.queryMaterials(request);
|
||||
}
|
||||
|
||||
public EbomParentVO queryMaterial(@Valid @NotEmpty EbomMaterialQO request) {
|
||||
return bomMaterialService.queryMaterial(request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class BomMaterialDTO {
|
|||
/**
|
||||
* 重量
|
||||
*/
|
||||
@NotBlank
|
||||
@NotNull
|
||||
private BigDecimal materialWeight;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EbomMaterialQO {
|
||||
|
||||
/**
|
||||
* 图号
|
||||
*/
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialNo;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<select id="getTask" resultType="com.nflg.wms.repository.entity.WmsPoReceipt">
|
||||
select *
|
||||
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 !='' ">
|
||||
and ( order_no ilike #{orederNo} or in_num ilike #{orederNo} )
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
create_time,
|
||||
factory_code
|
||||
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 != ''">
|
||||
and ( in_no ilike concat( '%',#{orderNo},'%') or order_no ilike concat( '%',#{orderNo},'%') )
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
</where>
|
||||
ORDER BY "no",id DESC
|
||||
) t
|
||||
ORDER BY id DESC;
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<select id="getHistory" resultType="com.nflg.wms.common.pojo.vo.PackageVO">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,11 @@ 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.EbomMaterialQO;
|
||||
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 jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -45,6 +49,12 @@ public class BomMaterialService {
|
|||
@Value("${bom.material.list.url}")
|
||||
private String materialListUrl;
|
||||
|
||||
@Value("${bom.material.queryMaterials.url}")
|
||||
private String materialQueryMaterialsUrl;
|
||||
|
||||
@Value("${bom.material.queryMaterial.url}")
|
||||
private String materialQueryMaterialUrl;
|
||||
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
|
|
@ -158,4 +168,44 @@ public class BomMaterialService {
|
|||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue