优化销售出货没有拣配数据时的报错提示

This commit is contained in:
彭枝刚 2025-01-04 19:58:56 +08:00
parent 88294d9858
commit ee948bd3c5

View File

@ -3006,18 +3006,18 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
throw BusinessException.build("此单据状态未提交");
} else {
List<DocumentDetailed> documentDetail = new ArrayList<>();
if(Constant.DOCUMENT_SALES_OUT.equalsIgnoreCase(byId.getDocumentType())){
if (Constant.DOCUMENT_SALES_OUT.equalsIgnoreCase(byId.getDocumentType())) {
List<DocumentDetailed> srcDetail = getDocumentDetailWithSaleOrder(site, documentNo);
if(srcDetail!=null && srcDetail.size()>0){
for (DocumentDetailed documentDetailed : srcDetail){
if(!"E".equalsIgnoreCase(documentDetailed.getInventorySpecialMarking())){
if (srcDetail != null && srcDetail.size() > 0) {
for (DocumentDetailed documentDetailed : srcDetail) {
if (!"E".equalsIgnoreCase(documentDetailed.getInventorySpecialMarking())) {
documentDetailed.setSalesOrder(null);
documentDetailed.setSalesOrderSeq(null);
}
documentDetail.add(documentDetailed);
}
}
}else{
} else {
documentDetail = getDocumentDetail(site, documentNo);
}
if (CollectionUtil.isEmpty(documentDetail)) {
@ -3180,7 +3180,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
sapJsonBody.put("VBELN", document.getExternalDocumentNo()); // 销售和分销凭证号
Map<String, String> resultMap = remoteFssm007Service.doExecute(sapJsonBody).getData();
if ("E".equals(resultMap.get("RESULT"))) {
throw BusinessException.build("SAP错误:" +resultMap.get("MSG"));
throw BusinessException.build("SAP错误:" + resultMap.get("MSG"));
}
}
}
@ -3205,7 +3205,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
sapJsonBody.put("VBELN", document.getExternalDocumentNo()); // 销售和分销凭证号
Map<String, String> resultMap = remoteFssm007Service.doExecute(sapJsonBody).getData();
if ("E".equals(resultMap.get("RESULT"))) {
throw BusinessException.build("SAP错误:" +resultMap.get("MSG"));
throw BusinessException.build("SAP错误:" + resultMap.get("MSG"));
}
}
} else {
@ -3290,6 +3290,9 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
LocalDateTime now = LocalDateTime.now();
if (Constant.DOCUMENT_STATUS_TBC.equals(document.getState())) {
List<Picking> pickingList = pickingService.lambdaQuery().eq(Picking::getSite, site).eq(Picking::getDocumentNo, documentNo).list();
if (pickingList.isEmpty()) {
throw BusinessException.build("单据[" + documentNo + "]没有拣配数据!");
}
List<String> inventoryBoList = pickingList.stream().map(o -> Inventory.genHandle(site, o.getInventoryId())).collect(Collectors.toList());
Map<String, Inventory> inventoryMap = inventoryService.listByIds(inventoryBoList).stream().collect(Collectors.toMap(Inventory::getInventoryId, inventory -> inventory));
if (inventoryMap.size() != pickingList.size()) {
@ -4004,7 +4007,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
sapJsonBody.put("VBELN", externalDocumentNo); // 交货单号
Map<String, String> resultMap = remoteMesDlvRefReverseService.doExecute(sapJsonBody).getData();
if ("E".equals(resultMap.get("RESULT"))) {
throw BusinessException.build("SAP错误:" +resultMap.get("MSG"));
throw BusinessException.build("SAP错误:" + resultMap.get("MSG"));
}
}