修正销售出货的单据同一个物料有两行时的picking数据存储问题

This commit is contained in:
彭枝刚 2025-01-21 16:12:39 +08:00
parent a8a475e06f
commit 35b2352d84
2 changed files with 28 additions and 2 deletions

View File

@ -38,4 +38,6 @@ public class ScanCodeDTO {
private String secrecyId;
private String description;
private BigDecimal detailSeq;
}

View File

@ -3177,7 +3177,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
if (checkScanAll) {
checkPickingTrayAllScan(site, list);
}
List<String> documentTypeList = Arrays.asList(Constant.DOCUMENT_INTERCOMPANY_STORAGE, Constant.DOCUMENT_INTERCOMPANY_RETURN, Constant.INTERCOMPANY_TH_STORAGE, Constant.INTERCOMPANY_TH_RETURN, Constant.DOCUMENT_SALES_OUT);
List<String> documentTypeList = Arrays.asList(Constant.DOCUMENT_INTERCOMPANY_STORAGE, Constant.DOCUMENT_INTERCOMPANY_RETURN, Constant.INTERCOMPANY_TH_STORAGE, Constant.INTERCOMPANY_TH_RETURN);
boolean isInterCompany = documentTypeList.contains(document.getDocumentType());
if(isInterCompany){
for (ScanCodeDTO scanCodeDTO : list) {
@ -3199,7 +3199,31 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
picking.setCreateUser(user);
pickingService.save(picking);
}
}else{
}else if(Constant.DOCUMENT_SALES_OUT.equals(document.getDocumentType())){
for (ScanCodeDTO scanCodeDTO : list) {
if(scanCodeDTO.getDetailSeq()==null){
throw BusinessException.build("拣配明细数据未匹配到单据明细的行");
}else{
DocumentDetailed documentDetailed = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getSite, site).eq(DocumentDetailed::getDocumentBo, documentBo).eq(DocumentDetailed::getItem, scanCodeDTO.getItem()).eq(DocumentDetailed::getSeq, scanCodeDTO.getDetailSeq()).one();
Picking picking = new Picking();
picking.setSite(site);
picking.setDocumentNo(documentNo);
picking.setPickingStatus(Constant.PICKING_STATUS_PICKING);
picking.setSeq(documentDetailed.getSeq());
picking.setItem(scanCodeDTO.getItem());
picking.setBatchNumber(scanCodeDTO.getBatchNo());
picking.setQty(scanCodeDTO.getQty());
picking.setDocumentType(document.getDocumentType());
picking.setInventoryId(scanCodeDTO.getInventoryId());
picking.setQualityInspectionStatus(scanCodeDTO.getLevel());
picking.setGradeOneCarrier(scanCodeDTO.getCarrier());
picking.setStorageBin(scanCodeDTO.getStorageBin());
picking.setCreateDateTime(now);
picking.setCreateUser(user);
pickingService.save(picking);
}
}
} else {
Map<String, Integer> seqMap = documentDetailedService.lambdaQuery().eq(DocumentDetailed::getDocumentBo, documentBo).select(DocumentDetailed::getItem, DocumentDetailed::getSeq).list().stream().collect(Collectors.toMap(DocumentDetailed::getItem, DocumentDetailed::getSeq, (s, s2) -> s));
pickingService.saveBatch(list.stream().map(o -> {
Picking picking = new Picking();