feat(wms_picking保存):移动端,所有单据执行功能,保存拣配表数据时,如果BATCH_NUMBER为空,则去库存表查询BATCH_NO的值;

This commit is contained in:
leiqiaozhen 2025-04-11 10:59:11 +08:00
parent f99fd309d4
commit d5d2c335bf

View File

@ -3272,13 +3272,17 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
if (documentDetailed == null) {
throw BusinessException.build("公司间入库根据站点[" + site + "]单据主键[" + documentBo + "]物料[" + scanCodeDTO.getItem() + "未找到单据明细数据");
}
// 如果 batchNo 为空,则根据 inventoryId 查询库存表的 batchNo
if (StringUtils.isBlank(batchNo)) {
batchNo = getBatchNo(site, scanCodeDTO.getInventoryId());
}
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(batchNo);
picking.setBatchNumber(StringUtils.isBlank(batchNo) ? null : batchNo);
picking.setQty(scanCodeDTO.getQty());
picking.setDocumentType(document.getDocumentType());
picking.setInventoryId(scanCodeDTO.getInventoryId());
@ -3294,6 +3298,11 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
if(scanCodeDTO.getDetailSeq()==null){
throw BusinessException.build("拣配明细数据未匹配到单据明细的行");
}else{
// 如果 batchNo 为空,则根据 inventoryId 查询库存表的 batchNo
String batchNo = scanCodeDTO.getBatchNo();
if (StringUtils.isBlank(batchNo)) {
batchNo = getBatchNo(site, scanCodeDTO.getInventoryId());
}
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);
@ -3301,7 +3310,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
picking.setPickingStatus(Constant.PICKING_STATUS_PICKING);
picking.setSeq(documentDetailed.getSeq());
picking.setItem(scanCodeDTO.getItem());
picking.setBatchNumber(scanCodeDTO.getBatchNo());
picking.setBatchNumber(StringUtils.isBlank(batchNo) ? null : batchNo);
picking.setQty(scanCodeDTO.getQty());
picking.setDocumentType(document.getDocumentType());
picking.setInventoryId(scanCodeDTO.getInventoryId());
@ -3316,13 +3325,18 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
} 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 -> {
// 如果 batchNo 为空,则根据 inventoryId 查询库存表的 batchNo
String batchNo = o.getBatchNo();
if (StringUtils.isBlank(batchNo)) {
batchNo = getBatchNo(site, o.getInventoryId());
}
Picking picking = new Picking();
picking.setSite(site);
picking.setDocumentNo(documentNo);
picking.setPickingStatus(Constant.PICKING_STATUS_PICKING);
picking.setSeq(seqMap.get(o.getItem()));
picking.setItem(o.getItem());
picking.setBatchNumber(o.getBatchNo());
picking.setBatchNumber(StringUtils.isBlank(batchNo) ? null : batchNo);
picking.setQty(o.getQty());
picking.setDocumentType(document.getDocumentType());
picking.setInventoryId(o.getInventoryId());
@ -3354,6 +3368,19 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
}
}
// 获取库存表 batchNo
public String getBatchNo(String site, String inventoryId) {
String handle = Inventory.genHandle(site, inventoryId);
String batchNo = "" ;
Inventory inventory = inventoryService.getById(handle);
if (inventory == null) {
throw BusinessException.build("条码" + inventoryId + "在库存表不存在");
} else {
batchNo = inventory.getBatchNo();
}
return batchNo;
}
@Override
@Transactional
public void cleanPicking(String site, String user, String documentNo, List<String> seqList) {