一些优化
This commit is contained in:
parent
9c55faa3d7
commit
d210cd94c5
|
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class BomMaterialDTO {
|
||||||
/**
|
/**
|
||||||
* 重量
|
* 重量
|
||||||
*/
|
*/
|
||||||
@NotBlank
|
@NotNull
|
||||||
private BigDecimal materialWeight;
|
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;
|
||||||
|
}
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue