Browse Source

opt: 单据批量自动审核;

test-20240527
龚宝雄 9 months ago
parent
commit
d4e94e630f
  1. 8
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java
  2. 40
      nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

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

@ -199,7 +199,8 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
if (ids.size() == entityList.size() && ids.size() > 1) {
entityList.forEach(r -> {
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("djzt", "审核");
//批量待审核
updateWrapper.set("djzt", "2");
updateWrapper.eq("flid", r.getFlid());
updateWrapper.set("czsl", r.getSl());
updateWrapper.set("sysl", 0);
@ -208,7 +209,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
easOutInBillDetailMapper.update(null, updateWrapper);
ieasOutInBillService.audit(ids,false);
//ieasOutInBillService.audit(ids,false);
});
} else {
boolean isValid = entityList.stream()
@ -230,7 +231,8 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
}
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
if(sysl.compareTo(BigDecimal.ZERO)==0) {
updateWrapper.set("djzt", "待审核");
//待审核
updateWrapper.set("djzt", "1");
}
updateWrapper.eq("flid", entityList.get(0).getFlid());
updateWrapper.set("czsl", czsl);

40
nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

@ -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));
}
}
/**
* 定时删除源头已删除单据
*/

Loading…
Cancel
Save