Commit 84153a28 authored by 李驰骋's avatar 李驰骋

查询库存添加参数

parent 4f7a30d8
......@@ -22,9 +22,9 @@ public interface InvmlDao extends JpaRepository<Invml, InvmlId>, JpaSpecificatio
List<Invml> findByMl001OrderByMl002AscMl003AscMl004Asc(String ml001);
List<Invml> findByMl001InOrderByMl002AscMl003AscMl004Asc(List<String> ml001List);
@Query(value = "select il.*,ib.MB002 materialName from INVML il left join INVMB ib on il.ML001 = ib.MB001 where il.ML001 = :ml001 and ('' = ISNULL(CONVERT(varchar(200), :ml002),'') or il.ML002 = :ml002)", nativeQuery = true)
List<IInvmlDto> findJoinInvmb(@Param(value = "ml001") String ml001, @Param(value = "ml002") String ml002);
@Query(value = "select il.*,ib.MB002 materialName from INVML il left join INVMB ib on il.ML001 = ib.MB001 where il.ML001 = :ml001 and ('' = ISNULL(CONVERT(varchar(200), :ml002),'') or il.ML002 = :ml002)" +
" and ('' = ISNULL(CONVERT(varchar(200), :gtStock),'') or il.ML005 > :gtStock)", nativeQuery = true)
List<IInvmlDto> findJoinInvmb(@Param(value = "ml001") String ml001, @Param(value = "ml002") String ml002, @Param(value = "gtStock") Integer gtStock);
/*
关联通知单查询库明细
......
......@@ -20,4 +20,7 @@ public class InvmlCriteria {
@ApiModelProperty("仓库")
private String ml002;
@ApiModelProperty("库存大于")
private Integer gtStock;
}
......@@ -74,22 +74,8 @@ public class InvmcService {
public List<InvmlDto> getInvmlList2(InvmlCriteria criteria) {
invmbDao.findById(criteria.getMl001()).orElseThrow(()->new TopsunitException(String.format("未找到物料:%s",criteria.getMl001())));
Specification<Invml> query = new Specification<Invml>() {
@Override
public Predicate toPredicate(Root<Invml> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<Predicate>();
if (StringUtils.isNotBlank(criteria.getMl001())) {
Predicate predicate = criteriaBuilder.equal(root.get("ml001"), criteria.getMl001() );
predicates.add(predicate);
}
if (StringUtils.isNotBlank(criteria.getMl002())) {
Predicate predicate = criteriaBuilder.equal(root.get("ml002"), criteria.getMl002());
predicates.add(predicate);
}
return criteriaQuery.where(predicates.toArray(new Predicate[0])).getRestriction();
}
};
List<IInvmlDto> data = invmlDao.findJoinInvmb(criteria.getMl001(), criteria.getMl002());
List<IInvmlDto> data = invmlDao.findJoinInvmb(criteria.getMl001(), criteria.getMl002(), criteria.getGtStock());
return data.stream().map(s->{
InvmlDto temp = new InvmlDto();
BeanUtils.copyProperties(s, temp);
......
......@@ -4,7 +4,7 @@ topsunit:
authentication-enabled: false
print-api-url: http://192.168.1.107:8085/ximaiprintservice/print/PrintLabelByBarTender
share-url: smb://127.0.0.1/share
mes-url: http://localhost:8088
mes-url: http://192.168.1.128:8088
default-password: 123456
db-name: TPYS
print:
......@@ -38,6 +38,10 @@ logging:
springframework:
web: info
com.topsunit: info
org.springframework.web.servlet.DispatcherServlet: DEBUG
org.springframework.web.filter.CommonsRequestLoggingFilter: DEBUG
file:
name: logs/erp-service.log
spring:
devtools:
restart:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment