feat(公司间发货入库):

1.点击保存按钮时,先按照站点,单据主键,物料,批次查询单据明细,若查不到则按照站点,单据主键,物料3个条件查询单据明细,然后根据不同场景处理信息
This commit is contained in:
leiqiaozhen 2025-03-17 10:37:53 +08:00
parent d2da101c21
commit 1c0f56afe0

View File

@ -3255,10 +3255,23 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
if(isInterCompany){
for (ScanCodeDTO scanCodeDTO : list) {
String batchNo = StringUtils.isBlank(scanCodeDTO.getBatchNo())?scanCodeDTO.getBatch():scanCodeDTO.getBatchNo();
DocumentDetailed documentDetailed = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getSite, site).eq(DocumentDetailed::getDocumentBo, documentBo).eq(DocumentDetailed::getItem, scanCodeDTO.getItem()).eq(DocumentDetailed::getBatch, batchNo).one();
if(documentDetailed==null){
throw BusinessException.build("公司间入库根据批次、物料、单据号未找到单据明细数据");
}
List<DocumentDetailed> documentDetailedList = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getSite, site).eq(DocumentDetailed::getDocumentBo, documentBo).eq(DocumentDetailed::getItem, scanCodeDTO.getItem()).eq(DocumentDetailed::getBatch, batchNo).list();
// 如果 documentDetailedList 不为空,并且size > 1,报错
if (CollectionUtil.isNotEmpty(documentDetailedList) && documentDetailedList.size() > 1) {
throw BusinessException.build("公司间入库根据站点[" + site + "]单据主键[" + documentBo + "]物料[" + scanCodeDTO.getItem() +"]批次[" + batchNo + "]找到多个单据明细数据");
} else if (CollectionUtil.isEmpty(documentDetailedList) && documentDetailedList.size() == 0) {
// 根据站点、批次、物料、单据号
documentDetailedList = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getSite, site).eq(DocumentDetailed::getDocumentBo, documentBo).eq(DocumentDetailed::getItem, scanCodeDTO.getItem()).list();
if (CollectionUtil.isNotEmpty(documentDetailedList) && documentDetailedList.size() > 1) {
throw BusinessException.build("公司间入库根据站点[" + site + "]单据主键[" + documentBo + "]物料[" + scanCodeDTO.getItem() + "找到多个单据明细数据");
} else if (CollectionUtil.isEmpty(documentDetailedList) && documentDetailedList.size() == 0) {
throw BusinessException.build("公司间入库根据站点[" + site + "]单据主键[" + documentBo + "]物料[" + scanCodeDTO.getItem() + "未找到单据明细数据");
}
}
DocumentDetailed documentDetailed = documentDetailedList.get(0);
if (documentDetailed == null) {
throw BusinessException.build("公司间入库根据站点[" + site + "]单据主键[" + documentBo + "]物料[" + scanCodeDTO.getItem() + "未找到单据明细数据");
}
Picking picking = new Picking();
picking.setSite(site);
picking.setDocumentNo(documentNo);