fix(overseas): price generated receiving pallets
This commit is contained in:
+12
-1
@@ -21,6 +21,7 @@ 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;
|
||||
@@ -46,6 +47,8 @@ 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) {
|
||||
@@ -81,7 +84,8 @@ public class WarehousePalletBatchService {
|
||||
for (WarehousePalletBatchRequests.Item requested : normalized.items()) {
|
||||
Long palletId = resources.createPallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), new PalletRequests.SaveRequest(null, requested.palletType(), null,
|
||||
BigDecimal.ZERO, "IDLE", null, "Auto-created for inbound plan " + requested.inboundPlanNo(),
|
||||
requiredAutoCreatedPalletUnitPrice(), "IDLE", null,
|
||||
"Auto-created for inbound plan " + requested.inboundPlanNo(),
|
||||
requested.fbaWarehouseCode()));
|
||||
WarehousePalletEntity pallet = resources.pallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), palletId);
|
||||
@@ -110,6 +114,13 @@ 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);
|
||||
|
||||
@@ -39,6 +39,8 @@ spring:
|
||||
management.endpoints.web.exposure.include: health,info,prometheus
|
||||
|
||||
baiyue:
|
||||
pallet:
|
||||
auto-created-unit-price: ${AUTO_CREATED_PALLET_UNIT_PRICE:1.00}
|
||||
clients:
|
||||
domestic-warehouse:
|
||||
url: ${DOMESTIC_WAREHOUSE_URL:}
|
||||
|
||||
Reference in New Issue
Block a user