|
|
@ -15,6 +15,7 @@ import org.nl.config.IdUtil; |
|
|
|
import org.nl.wms.database.eas.dao.EasOutInBillDetail; |
|
|
|
import org.nl.wms.database.eas.dao.HomeBillCounts; |
|
|
|
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper; |
|
|
|
import org.nl.wms.database.eas.dao.mapper.EasOutInBillMapper; |
|
|
|
import org.nl.wms.database.eas.service.IeasOutInBillService; |
|
|
|
import org.nl.wms.ext.eas.WmsToEasService; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -76,21 +77,48 @@ public class EasBillSchedule { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* eas单据数据同步 |
|
|
|
* eas单据自动审核 |
|
|
|
*/ |
|
|
|
@Async("taskExecutor") |
|
|
|
@Scheduled(cron = "0/30 * * * * *") |
|
|
|
public void automaticAuditBills() { |
|
|
|
|
|
|
|
List<EasOutInBillDetail> easOutInBillDetailList = easOutInBillDetailMapper.selectList(new LambdaQueryWrapper<EasOutInBillDetail>().eq(EasOutInBillDetail::getDjzt, "待审核")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 单据明细批量出入库单
|
|
|
|
List<EasOutInBillDetail> easOutInBillDetailList1 = easOutInBillDetailMapper |
|
|
|
.selectList(new LambdaQueryWrapper<EasOutInBillDetail>().eq(EasOutInBillDetail::getDjzt, "1")); |
|
|
|
List<String> djidList = easOutInBillDetailList1.stream() |
|
|
|
.map(EasOutInBillDetail::getDjid) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
//单个明细出入库单
|
|
|
|
List<EasOutInBillDetail> easOutInBillDetailList2 = easOutInBillDetailMapper |
|
|
|
.selectList(new LambdaQueryWrapper<EasOutInBillDetail>().eq(EasOutInBillDetail::getDjzt, "2")); |
|
|
|
Map<String, Long> groupSizeMap = easOutInBillDetailList2.stream() |
|
|
|
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting())); |
|
|
|
List<String> auditDjidList = new ArrayList<>(); |
|
|
|
groupSizeMap.forEach((id, count) -> { |
|
|
|
List<EasOutInBill> billList = easOutInBillService |
|
|
|
.list(new LambdaQueryWrapper<EasOutInBill>().eq(EasOutInBill::getDjid, id)); |
|
|
|
if (billList.size() == count) { |
|
|
|
auditDjidList.add(id); |
|
|
|
} |
|
|
|
}); |
|
|
|
updateBillsInBatch(djidList, auditDjidList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateBillsInBatch(List<String> djidList, List<String> auditDjidList) { |
|
|
|
if (!auditDjidList.isEmpty()||!djidList.isEmpty()) { |
|
|
|
EasOutInBill easOutInBills = new EasOutInBill(); |
|
|
|
easOutInBills.setDjzt("审核"); |
|
|
|
djidList.addAll(auditDjidList); |
|
|
|
easOutInBillService.update(easOutInBills, new LambdaQueryWrapper<EasOutInBill>().in(EasOutInBill::getDjid, djidList)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 定时删除源头已删除单据 |
|
|
|
*/ |
|
|
|