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,13 +58,19 @@ 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()
|
||||
|
|
|
|||
|
|
@ -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