add: 增加延迟测试;
This commit is contained in:
@@ -43,6 +43,12 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
|||||||
*/
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料总数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Double wlzs;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据id
|
* 单据id
|
||||||
|
|||||||
@@ -28,12 +28,20 @@ public class ReceiptBill extends Model<ReceiptBill> {
|
|||||||
*/
|
*/
|
||||||
@TableId(value = "flid", type = IdType.NONE)
|
@TableId(value = "flid", type = IdType.NONE)
|
||||||
private String flid;
|
private String flid;
|
||||||
|
/**
|
||||||
|
* 收货数量
|
||||||
|
*/
|
||||||
|
private String shsl;
|
||||||
|
/**
|
||||||
|
* 物料总数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Double wlzs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核结果
|
* 审核结果
|
||||||
*/
|
*/
|
||||||
private String shjg;
|
private String shjg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送货单id
|
* 送货单id
|
||||||
*/
|
*/
|
||||||
@@ -102,10 +110,7 @@ public class ReceiptBill extends Model<ReceiptBill> {
|
|||||||
* 本次送货数量
|
* 本次送货数量
|
||||||
*/
|
*/
|
||||||
private String bcshsl;
|
private String bcshsl;
|
||||||
/**
|
|
||||||
* 收货数量
|
|
||||||
*/
|
|
||||||
private String shsl;
|
|
||||||
/**
|
/**
|
||||||
* 件数
|
* 件数
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ public class ReceiptBillQuery extends BaseQuery<ReceiptBillQuery> {
|
|||||||
|
|
||||||
private String djid;
|
private String djid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货数量
|
||||||
|
*/
|
||||||
|
private String shsl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送货单号
|
* 送货单号
|
||||||
@@ -90,10 +94,7 @@ public class ReceiptBillQuery extends BaseQuery<ReceiptBillQuery> {
|
|||||||
private String bcshsl;
|
private String bcshsl;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收货数量
|
|
||||||
*/
|
|
||||||
private String shsl;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
package org.nl.wms.database.eas.service.impl;
|
package org.nl.wms.database.eas.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.nl.common.exception.BadRequestException;
|
|
||||||
import org.nl.common.utils.SecurityUtils;
|
|
||||||
import org.nl.wms.database.eas.dao.*;
|
|
||||||
import org.nl.wms.database.eas.dto.*;
|
|
||||||
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
|
|
||||||
import org.nl.wms.database.eas.service.IeasOutInBillDetailService;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.base.CommonPage;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||||
|
import org.nl.wms.database.eas.dao.InventoryInfo;
|
||||||
|
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
|
||||||
|
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
|
||||||
|
import org.nl.wms.database.eas.service.IeasOutInBillDetailService;
|
||||||
import org.nl.wms.database.eas.service.IeasOutInBillService;
|
import org.nl.wms.database.eas.service.IeasOutInBillService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.nl.common.base.CommonPage;
|
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -64,53 +64,64 @@ 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);
|
for (int i = 0; i < easOutInBillDetailList.size(); i++) {
|
||||||
|
long se = 10L;
|
||||||
|
easOutInBillDetailList.get(i).setKcsl(BigDecimal.valueOf(se + i * 10L));
|
||||||
|
}
|
||||||
|
//计算相同物料编码的总数
|
||||||
|
Map<String, Double> totalQty = easOutInBillDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(EasOutInBillDetail::getWlbm, Collectors.summingDouble(bill -> bill.getSl().doubleValue())));
|
||||||
easOutInBillDetailList.forEach(bill -> {
|
easOutInBillDetailList.forEach(bill -> {
|
||||||
//查询库存信息
|
//设置物料总数
|
||||||
List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
bill.setWlzs(totalQty.get(bill.getWlbm()));
|
||||||
.filter(inventory -> {
|
|
||||||
boolean isMatched = true;
|
|
||||||
//去向部门
|
|
||||||
if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
|
||||||
}
|
|
||||||
//仓库编码
|
|
||||||
if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getCkbm(), bill.getCkbm());
|
|
||||||
}
|
|
||||||
//库位编码
|
|
||||||
if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm());
|
|
||||||
}
|
|
||||||
|
|
||||||
//物料编码
|
|
||||||
if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
|
||||||
}
|
|
||||||
// 批次
|
|
||||||
if (bill.getPc() != null && !bill.getPc().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getPc(), bill.getPc());
|
|
||||||
}
|
|
||||||
// 跟踪号
|
|
||||||
if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
|
||||||
isMatched = Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
|
||||||
}
|
|
||||||
return isMatched;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
|
||||||
// .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
|
|
||||||
// && Objects.equals(inventory.getCkbm(), bill.getCkbm())
|
|
||||||
// && Objects.equals(inventory.getWlbm(), bill.getWlbm())
|
|
||||||
// && Objects.equals(inventory.getPc(), bill.getPc())
|
|
||||||
// && Objects.equals(inventory.getTrackno(), bill.getTrackno())
|
|
||||||
// && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
|
||||||
.filter(r -> r.getUnitno().equals(bill.getJldw()))
|
|
||||||
.min(Comparator.comparing(InventoryInfo::getKcsl));
|
|
||||||
minKcsl.ifPresent(m -> bill.setKcsl(m.getKcsl()));
|
|
||||||
});
|
});
|
||||||
|
// List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
|
||||||
|
// easOutInBillDetailList.forEach(bill -> {
|
||||||
|
// //查询库存信息
|
||||||
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
||||||
|
// .filter(inventory -> {
|
||||||
|
// boolean isMatched = true;
|
||||||
|
// //去向部门
|
||||||
|
// if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
||||||
|
// }
|
||||||
|
// //仓库编码
|
||||||
|
// if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getCkbm(), bill.getCkbm());
|
||||||
|
// }
|
||||||
|
// //库位编码
|
||||||
|
// if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //物料编码
|
||||||
|
// if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
||||||
|
// }
|
||||||
|
// // 批次
|
||||||
|
// if (bill.getPc() != null && !bill.getPc().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getPc(), bill.getPc());
|
||||||
|
// }
|
||||||
|
// // 跟踪号
|
||||||
|
// if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
||||||
|
// isMatched = Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
||||||
|
// }
|
||||||
|
// return isMatched;
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
||||||
|
// .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
|
||||||
|
// && Objects.equals(inventory.getCkbm(), bill.getCkbm())
|
||||||
|
// && Objects.equals(inventory.getWlbm(), bill.getWlbm())
|
||||||
|
// && Objects.equals(inventory.getPc(), bill.getPc())
|
||||||
|
// && Objects.equals(inventory.getTrackno(), bill.getTrackno())
|
||||||
|
// && Objects.equals(inventory.getKwbm(), bill.getKwbm()))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
// Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
||||||
|
// .filter(r -> r.getUnitno().equals(bill.getJldw()))
|
||||||
|
// .min(Comparator.comparing(InventoryInfo::getKcsl));
|
||||||
|
// minKcsl.ifPresent(m -> bill.setKcsl(m.getKcsl()));
|
||||||
|
// });
|
||||||
result.setRecords(easOutInBillDetailList);
|
result.setRecords(easOutInBillDetailList);
|
||||||
return CommonPage.getPage(result);
|
return CommonPage.getPage(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
|||||||
Page<ReceiptBill> pageObject = new Page<>(params.getPage(), params.getSize());
|
Page<ReceiptBill> pageObject = new Page<>(params.getPage(), params.getSize());
|
||||||
Page<ReceiptBill> receiptBills = receiptBillMapper.receiptDetailPage(pageObject, params.getDjid(), params.getFuzzy());
|
Page<ReceiptBill> receiptBills = receiptBillMapper.receiptDetailPage(pageObject, params.getDjid(), params.getFuzzy());
|
||||||
List<ReceiptBill> receiptBillList = receiptBills.getRecords();
|
List<ReceiptBill> receiptBillList = receiptBills.getRecords();
|
||||||
|
//计算相同物料编码的总数
|
||||||
|
Map<String, Double> totalQty = receiptBillList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ReceiptBill::getWlbm, Collectors.summingDouble(bill -> Double.parseDouble(bill.getShsl()))));
|
||||||
if (!receiptBillList.isEmpty()) {
|
if (!receiptBillList.isEmpty()) {
|
||||||
List<ReceiptBill2> updateList = receiptBill2Mapper.selectList(
|
List<ReceiptBill2> updateList = receiptBill2Mapper.selectList(
|
||||||
new LambdaQueryWrapper<ReceiptBill2>().eq(ReceiptBill2::getDjid, receiptBillList.get(0).getDjid()));
|
new LambdaQueryWrapper<ReceiptBill2>().eq(ReceiptBill2::getDjid, receiptBillList.get(0).getDjid()));
|
||||||
@@ -104,6 +107,10 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
receiptBillList= receiptBillList.stream().peek(r->{
|
||||||
|
r.setWlzs(totalQty.get(r.getWlbm()));
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
receiptBills.setRecords(receiptBillList);
|
receiptBills.setRecords(receiptBillList);
|
||||||
return CommonPage.getPage(receiptBills);
|
return CommonPage.getPage(receiptBills);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class EasBillSchedule {
|
|||||||
* eas单据数据同步
|
* eas单据数据同步
|
||||||
*/
|
*/
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
@Scheduled(cron = "0/120 * * * * *")
|
// @Scheduled(cron = "0/120 * * * * *")
|
||||||
public void getEasOutInBills() {
|
public void getEasOutInBills() {
|
||||||
// 获取eas视图查询未提交的单据
|
// 获取eas视图查询未提交的单据
|
||||||
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory();
|
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory();
|
||||||
@@ -83,7 +83,7 @@ public class EasBillSchedule {
|
|||||||
* 定时清空单据
|
* 定时清空单据
|
||||||
*/
|
*/
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
@Scheduled(cron = "0/86400 * * * * *")
|
// @Scheduled(cron = "0/86400 * * * * *")
|
||||||
public void autoDeleteTask() {
|
public void autoDeleteTask() {
|
||||||
LocalDate threeMonthsAgo = LocalDate.now().minusMonths(3);
|
LocalDate threeMonthsAgo = LocalDate.now().minusMonths(3);
|
||||||
String days = threeMonthsAgo.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
String days = threeMonthsAgo.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8019
|
port: 8011
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
autoconfigure:
|
autoconfigure:
|
||||||
@@ -8,11 +8,17 @@ spring:
|
|||||||
dynamic:
|
dynamic:
|
||||||
primary: mysql
|
primary: mysql
|
||||||
datasource:
|
datasource:
|
||||||
|
# mysql:
|
||||||
|
# driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
|
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl_sq_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
|
# username: ${DB_USER:generallu}
|
||||||
|
# password: ${DB_PWD:123456}
|
||||||
|
# type: com.alibaba.druid.pool.DruidDataSource
|
||||||
mysql:
|
mysql:
|
||||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl_sq_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl_sq_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
username: ${DB_USER:generallu}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:123456}
|
password: ${DB_PWD:NLABC&hl123}
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
mysql_srm:
|
mysql_srm:
|
||||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
|
|||||||
Reference in New Issue
Block a user