Merge branch 'test' of http://8.163.30.128:10082/java-project/baiyue-firstleg into dev
This commit is contained in:
+2
-1
@@ -60,7 +60,8 @@ public class InboundMeasurementRepository {
|
||||
.eq(InboundOrderEntity::getTenantId, inbound.getTenantId())
|
||||
.eq(InboundOrderEntity::getId, inbound.getId())
|
||||
.set(InboundOrderEntity::getActualGrossWeightKg, inbound.getActualGrossWeightKg())
|
||||
.set(InboundOrderEntity::getActualNetWeightKg, inbound.getActualNetWeightKg())) == 1;
|
||||
.set(InboundOrderEntity::getActualNetWeightKg, inbound.getActualNetWeightKg())
|
||||
.set(InboundOrderEntity::getPalletCount, inbound.getPalletCount())) == 1;
|
||||
}
|
||||
|
||||
public InboundMeasurementEntity findMeasurement(long tenantId, long inboundId, long measurementId) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.baiyue.firstleg.entity.InboundPalletAllocationEntity;
|
||||
import com.baiyue.firstleg.entity.InboundStatusHistoryEntity;
|
||||
import com.baiyue.firstleg.entity.InboundTransportSnapshotEntity;
|
||||
import com.baiyue.firstleg.entity.InboundPickupSnapshotEntity;
|
||||
import com.baiyue.firstleg.entity.InboundWeightResultEntity;
|
||||
import com.baiyue.firstleg.mapper.InboundFileMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundInternalNoteMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundOrderMapper;
|
||||
@@ -22,6 +23,7 @@ import com.baiyue.firstleg.mapper.InboundPalletAllocationMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundStatusHistoryMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundTransportSnapshotMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundPickupSnapshotMapper;
|
||||
import com.baiyue.firstleg.mapper.InboundWeightResultMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -48,6 +50,8 @@ public class InboundOrderRepository {
|
||||
private InboundInternalNoteMapper notes;
|
||||
@Resource
|
||||
private InboundStatusHistoryMapper histories;
|
||||
@Resource
|
||||
private InboundWeightResultMapper weights;
|
||||
|
||||
public PageResult<InboundOrderSummary> page(Long tenantId, InboundOrderQuery query) {
|
||||
LambdaQueryWrapper<InboundOrderEntity> wrapper = new LambdaQueryWrapper<InboundOrderEntity>()
|
||||
@@ -287,6 +291,18 @@ public class InboundOrderRepository {
|
||||
Collectors.joining("、"))));
|
||||
}
|
||||
|
||||
public Map<Long, Integer> confirmedPalletCountsMap(Long tenantId, Map<Long, Long> tenantByInbound) {
|
||||
if (tenantByInbound.isEmpty()) return Map.of();
|
||||
return weights.selectList(new LambdaQueryWrapper<InboundWeightResultEntity>()
|
||||
.eq(tenantId != null, InboundWeightResultEntity::getTenantId, tenantId)
|
||||
.in(InboundWeightResultEntity::getInboundId, tenantByInbound.keySet())
|
||||
.eq(InboundWeightResultEntity::getRecognitionStatus, "CONFIRMED"))
|
||||
.stream()
|
||||
.filter(item -> owns(tenantByInbound, item.getInboundId(), item.getTenantId()))
|
||||
.collect(Collectors.groupingBy(InboundWeightResultEntity::getInboundId,
|
||||
java.util.LinkedHashMap::new, Collectors.summingInt(item -> 1)));
|
||||
}
|
||||
|
||||
private static boolean owns(Map<Long, Long> tenantByInbound, Long inboundId, Long tenantId) {
|
||||
return inboundId != null && tenantId != null && tenantId.equals(tenantByInbound.get(inboundId));
|
||||
}
|
||||
|
||||
@@ -330,6 +330,7 @@ public class InboundMeasurementService {
|
||||
repository.listWeights(inbound.getTenantId(), inbound.getId()));
|
||||
inbound.setActualGrossWeightKg(totals.grossWeightKg());
|
||||
inbound.setActualNetWeightKg(totals.netWeightKg());
|
||||
inbound.setPalletCount(totals.palletCount());
|
||||
if ("WAIT_MEASURE".equals(inbound.getProcessStatus())) {
|
||||
inbound.setProcessStatus("MEASURING");
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class UnifiedInboundQueryService {
|
||||
public UnifiedInboundDetail detail(long tenantId, long orderId) {
|
||||
InboundOrderEntity inbound = inbounds.findByOrderId(tenantId, orderId);
|
||||
if (inbound == null) return null;
|
||||
applyConfirmedPalletCount(inbound, inbounds.confirmedPalletCountsMap(tenantId,
|
||||
Map.of(inbound.getId(), inbound.getTenantId())));
|
||||
InboundOrderDetail detail = inbounds.detail(tenantId, inbound);
|
||||
String mainStatus = mainStatus(inbound.getProcessStatus());
|
||||
boolean includePhaseThree = requiresPhaseThreeSummary(mainStatus);
|
||||
@@ -93,6 +95,8 @@ public class UnifiedInboundQueryService {
|
||||
var transports = operations.findTransports(phaseThreeOwners);
|
||||
Map<Long, Long> owners = records.stream().collect(Collectors.toMap(
|
||||
InboundOrderEntity::getId, InboundOrderEntity::getTenantId, (left, right) -> left));
|
||||
var confirmedPalletCounts = inbounds.confirmedPalletCountsMap(null, owners);
|
||||
records.forEach(inbound -> applyConfirmedPalletCount(inbound, confirmedPalletCounts));
|
||||
var locationCodes = inbounds.locationCodesMap(null, owners);
|
||||
var pickups = inbounds.pickupMap(null, owners);
|
||||
return records.stream().map(inbound -> summary(inbound, null, preloads.get(inbound.getId()),
|
||||
@@ -101,6 +105,14 @@ public class UnifiedInboundQueryService {
|
||||
transports.get(inbound.getId()), locationCodes.get(inbound.getId()), pickups.get(inbound.getId()))).toList();
|
||||
}
|
||||
|
||||
private static void applyConfirmedPalletCount(InboundOrderEntity inbound,
|
||||
Map<Long, Integer> confirmedPalletCounts) {
|
||||
if ((inbound.getPalletCount() == null || inbound.getPalletCount() <= 0)
|
||||
&& confirmedPalletCounts.getOrDefault(inbound.getId(), 0) > 0) {
|
||||
inbound.setPalletCount(confirmedPalletCounts.get(inbound.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
private UnifiedInboundSummary summary(InboundOrderEntity inbound, InboundOrderDetail detail,
|
||||
com.baiyue.firstleg.split.entity.PreloadPlanEntity preload,
|
||||
com.baiyue.firstleg.loading.entity.InboundLoadingPickTaskEntity pick,
|
||||
|
||||
Reference in New Issue
Block a user