Browse Source

opt:测试环境不查询库存信息

test-20240527
龚宝雄 7 months ago
parent
commit
d0324fb3ce
  1. 8
      nlsso-server/pom.xml
  2. 49
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java

8
nlsso-server/pom.xml

@ -71,6 +71,7 @@
<version>0.2</version> <version>0.2</version>
</dependency> </dependency>
<!-- 控制台高亮--> <!-- 控制台高亮-->
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <artifactId>jansi</artifactId>
@ -107,13 +108,6 @@
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>4.1.3</version> <version>4.1.3</version>
</dependency> </dependency>
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.17.1</version>
</dependency>
<!--工具包--> <!--工具包-->
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>

49
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java

@ -56,22 +56,22 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
.eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid()) .eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid())
); );
List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords(); List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords();
List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList); //List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
easOutInBillDetailList.forEach(bill -> { // easOutInBillDetailList.forEach(bill -> {
//查询库存信息 // //查询库存信息
List<InventoryInfo> matchedInventory = inventoryInfoList.stream() // List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
.filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm()) // .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
&& Objects.equals(inventory.getCkbm(), bill.getCkbm()) // && Objects.equals(inventory.getCkbm(), bill.getCkbm())
&& Objects.equals(inventory.getWlbm(), bill.getWlbm()) // && Objects.equals(inventory.getWlbm(), bill.getWlbm())
&& Objects.equals(inventory.getPc(), bill.getPc()) // && Objects.equals(inventory.getPc(), bill.getPc())
&& Objects.equals(inventory.getTrackno(), bill.getTrackno()) // && Objects.equals(inventory.getTrackno(), bill.getTrackno())
&& Objects.equals(inventory.getKwbm(), bill.getKwbm())) // && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
.collect(Collectors.toList()); // .collect(Collectors.toList());
//将库存数量赋值给单据 // //将库存数量赋值给单据
if (CollectionUtils.isNotEmpty(matchedInventory)) { // if (CollectionUtils.isNotEmpty(matchedInventory)) {
bill.setKcsl(matchedInventory.get(0).getKcsl()); // bill.setKcsl(matchedInventory.get(0).getKcsl());
} // }
}); // });
result.setRecords(easOutInBillDetailList); result.setRecords(easOutInBillDetailList);
return CommonPage.getPage(result); return CommonPage.getPage(result);
} }
@ -149,11 +149,10 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
@Override @Override
public void update(List<EasOutInBillDetailVO> entityList) { public void update(List<EasOutInBillDetailVO> entityList) {
if (CollectionUtils.isNotEmpty(entityList)) { if (CollectionUtils.isNotEmpty(entityList)) {
List<EasOutInBillDetailVO> entityLists= entityList.stream().filter(r->StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList()); List<EasOutInBillDetailVO> entityLists = entityList.stream().filter(r -> StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList());
List<String> ids =entityLists.stream().map(EasOutInBillDetailVO::getCode).collect(Collectors.toList()); List<String> ids = entityLists.stream().map(EasOutInBillDetailVO::getCode).collect(Collectors.toList());
if(ids.size()==entityList.size()&&ids.size()>1) if (ids.size() == entityList.size() && ids.size() > 1) {
{ entityList.forEach(r -> {
entityList.forEach(r->{
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("flid", r.getFlid()); updateWrapper.eq("flid", r.getFlid());
updateWrapper.set("czsl", r.getSl()); updateWrapper.set("czsl", r.getSl());
@ -165,16 +164,14 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
easOutInBillDetailMapper.update(null, updateWrapper); easOutInBillDetailMapper.update(null, updateWrapper);
}); });
}else } else {
{
boolean isValid = entityList.stream() boolean isValid = entityList.stream()
.filter(r -> StringUtils.isNotEmpty(r.getKwbm())) .filter(r -> StringUtils.isNotEmpty(r.getKwbm()))
.map(EasOutInBillDetailVO::getSysl) .map(EasOutInBillDetailVO::getSysl)
.reduce(BigDecimal.ZERO, BigDecimal::add) .reduce(BigDecimal.ZERO, BigDecimal::add)
.compareTo(BigDecimal.ZERO) == 0; .compareTo(BigDecimal.ZERO) == 0;
if(isValid) if (isValid) {
{
throw new BadRequestException("请检查库位和数量信息"); throw new BadRequestException("请检查库位和数量信息");
} }
BigDecimal amount = entityList.stream() BigDecimal amount = entityList.stream()
@ -198,8 +195,6 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
} }
} }
} }

Loading…
Cancel
Save