|
@@ -48,6 +48,7 @@ import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -175,7 +176,10 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
|
|
|
List<String> lotNumList = invLotAttList.stream().map(InvLotAtt::getLotnum).collect(Collectors.toList());
|
|
|
List<InvLotLocId> invLotLocIds = invLotLocIdService.selectInvLotLocIdByLotnumList(lotNumList);
|
|
|
// 5.根据lotatt02分组,计算同一批号的库存数量
|
|
|
- List<String> lotNumListHasLoc = invLotLocIds.stream().map(InvLotLocId::getLotnum).distinct().collect(Collectors.toList());
|
|
|
+ // 过滤掉已经出库的库存
|
|
|
+ List<String> lotNumListHasLoc = invLotLocIds.stream()
|
|
|
+ .filter(invId -> !StringUtils.equals(invId.getLocationId(), Constant.LOC_SORTATION_FINISH.toString()))
|
|
|
+ .map(InvLotLocId::getLotnum).distinct().collect(Collectors.toList());
|
|
|
// 过滤出有库存的且是合格状态的批次信息,然后按照批号分组
|
|
|
Map<String, List<InvLotAtt>> invLotAttListMap = invLotAttList.stream()
|
|
|
.filter(item -> CollUtil.contains(lotNumListHasLoc, item.getLotnum()))
|
|
@@ -184,9 +188,7 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
|
|
|
// 找出分组后的每组批次对应的库存, 过滤掉所有已出库的库存
|
|
|
Map<String, List<InvLotLocId>> invLotLocIdListMap = invLotAttListMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, item -> {
|
|
|
List<String> lotNumGroupList = item.getValue().stream().map(InvLotAtt::getLotnum).collect(Collectors.toList());
|
|
|
- return invLotLocIds.stream().filter(invId -> CollUtil.contains(lotNumGroupList, invId.getLotnum()))
|
|
|
- .filter(invId -> !StringUtils.equals(invId.getLocationId(), Constant.LOC_SORTATION_FINISH.toString()))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ return invLotLocIds.stream().filter(invId -> CollUtil.contains(lotNumGroupList, invId.getLotnum())).collect(Collectors.toList());
|
|
|
}));
|
|
|
// 计算每组库存的所有数量
|
|
|
Map<String, BigDecimal> lotNumQtyMap = invLotLocIdListMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, item -> {
|
|
@@ -239,12 +241,11 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
|
|
|
InvLotLocId invLotLocId = invLotLocIdService.selectInvLotLocIdByModel(invLotLocIdQuery);
|
|
|
invLotLocId.setIfSample(Constant.IS_YES.Y.name());
|
|
|
invLotLocIdService.updateInvLotLocId(invLotLocId);
|
|
|
- // 2.生成移库任务
|
|
|
- InvMoveDTO invMoveDTO = new InvMoveDTO();
|
|
|
- invMoveDTO.setSourceLocationId(qcOutboundDTO.getLocationFrom());
|
|
|
- invMoveDTO.setTargetLocationId(qcOutboundDTO.getLocationTo());
|
|
|
- invMoveDTO.setUser(qcOutboundDTO.getUser());
|
|
|
- invLotLocIdService.move(invMoveDTO, username);
|
|
|
+ // 2.需要叫车,生则成移库任务
|
|
|
+ if (StringUtils.equals(qcOutboundDTO.getIfCallCar(), Constant.IS_YES.Y.name())){
|
|
|
+ InvMoveDTO invMoveDTO = new InvMoveDTO(qcOutboundDTO.getLocationFrom(), qcOutboundDTO.getLocationTo(), qcOutboundDTO.getUser());
|
|
|
+ invLotLocIdService.move(invMoveDTO, username);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -267,7 +268,8 @@ public class PdaDocQcServiceImpl implements IPdaDocQcService {
|
|
|
int updateINum = invLotLocIdService.updateInvLotLocId(invLotLocId);
|
|
|
if (!(updateINum > 0)) throw new ServiceException("质检入库修改库存失败");
|
|
|
log.info("质检入库修改库存完成:{}{}-------", qcIntoStorageDTO.getBatchNumber(), qcIntoStorageDTO.getStatus());
|
|
|
- this.createQCIntoStorageTask(qcIntoStorageDTO, username, invLotLocId);
|
|
|
+ // 如果需要叫车,则创建搬运任务
|
|
|
+ if (StringUtils.equals(qcIntoStorageDTO.getIfCallCar(), Constant.IS_YES.Y.name())) this.createQCIntoStorageTask(qcIntoStorageDTO, username, invLotLocId);
|
|
|
// throw new ServiceException("mmm");
|
|
|
}
|
|
|
|