Merge test fixes into dev dropship flow
This commit is contained in:
+5
-13
@@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -39,6 +38,9 @@ import java.util.Set;
|
||||
@Service
|
||||
public class WarehousePalletBatchService {
|
||||
private static final String BUSINESS_TYPE = "INBOUND_PLAN_AUTO";
|
||||
private static final BigDecimal AUTO_PALLET_CAPACITY_CBM = new BigDecimal("2.0000");
|
||||
private static final BigDecimal AUTO_PALLET_UNIT_PRICE_USD = new BigDecimal("5.00");
|
||||
private static final String AUTO_PALLET_REMARK = "自动生成";
|
||||
|
||||
@Resource private WarehousePalletBatchMapper batches;
|
||||
@Resource private WarehousePalletBatchItemMapper items;
|
||||
@@ -47,8 +49,6 @@ public class WarehousePalletBatchService {
|
||||
@Resource private WarehouseResourceLockRepository lockRecords;
|
||||
@Resource private WarehouseResourceRepository repository;
|
||||
@Resource private ObjectMapper objectMapper;
|
||||
@Value("${baiyue.pallet.auto-created-unit-price:1.00}")
|
||||
private BigDecimal autoCreatedPalletUnitPrice;
|
||||
|
||||
@Transactional
|
||||
public WarehousePalletBatchResponse ensureReserved(WarehousePalletBatchRequests.EnsureReserved request) {
|
||||
@@ -83,9 +83,8 @@ public class WarehousePalletBatchService {
|
||||
List<WarehousePalletBatchItemEntity> created = new ArrayList<>();
|
||||
for (WarehousePalletBatchRequests.Item requested : normalized.items()) {
|
||||
Long palletId = resources.createPallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), new PalletRequests.SaveRequest(requested.palletCode(), requested.palletType(), null,
|
||||
requiredAutoCreatedPalletUnitPrice(), "IDLE", null,
|
||||
"Auto-created for inbound plan " + requested.inboundPlanNo(),
|
||||
normalized.warehouseId(), new PalletRequests.SaveRequest(requested.palletCode(), "WOOD",
|
||||
AUTO_PALLET_CAPACITY_CBM, AUTO_PALLET_UNIT_PRICE_USD, "IDLE", null, AUTO_PALLET_REMARK,
|
||||
requested.fbaWarehouseCode()));
|
||||
WarehousePalletEntity pallet = resources.pallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), palletId);
|
||||
@@ -114,13 +113,6 @@ public class WarehousePalletBatchService {
|
||||
return response(batch, created, false);
|
||||
}
|
||||
|
||||
private BigDecimal requiredAutoCreatedPalletUnitPrice() {
|
||||
if (autoCreatedPalletUnitPrice == null || autoCreatedPalletUnitPrice.signum() <= 0) {
|
||||
throw new IllegalStateException("Auto-created pallet unit price must be greater than zero");
|
||||
}
|
||||
return autoCreatedPalletUnitPrice.setScale(2, java.math.RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public WarehousePalletBatchResponse confirm(WarehousePalletBatchRequests.Confirm request) {
|
||||
WarehousePalletBatchRequests.Confirm normalized = normalize(request);
|
||||
|
||||
Reference in New Issue
Block a user