fix: reserve stable inbound code for draft label printing
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.baiyue.firstleg.client;
|
||||
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.firstleg.dto.OrderApprovedInboundCommand;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
@FeignClient(name = "order-service", contextId = "printableOrderInboundClient",
|
||||
url = "${baiyue.clients.order.url:}", path = "/internal/order/v1/cargoes")
|
||||
public interface PrintableOrderInboundClient {
|
||||
@PostMapping("/{tenantId}/{orderId}/printable-inbound-snapshot")
|
||||
ApiResponse<OrderApprovedInboundCommand> reserve(
|
||||
@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@PathVariable long tenantId,
|
||||
@PathVariable long orderId);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.common.core.api.ResultCode;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.firstleg.client.OrderCargoClient;
|
||||
import com.baiyue.firstleg.client.PrintableOrderInboundClient;
|
||||
import com.baiyue.firstleg.dto.InboundCartonLabels;
|
||||
import com.baiyue.firstleg.entity.InboundCartonLabelEntity;
|
||||
import com.baiyue.firstleg.entity.InboundOrderEntity;
|
||||
@@ -35,6 +36,7 @@ public class InboundCartonLabelService implements CartonLabelBindingResolver {
|
||||
|
||||
@Resource private InboundCartonLabelRepository repository;
|
||||
@Resource private OrderCargoClient orderCargoClient;
|
||||
@Resource private PrintableOrderInboundClient printableOrderInboundClient;
|
||||
@Resource private InboundOrderCreationService inboundOrderCreationService;
|
||||
@Value("${baiyue.security.internal-service-token}") private String internalToken;
|
||||
|
||||
@@ -101,7 +103,7 @@ public class InboundCartonLabelService implements CartonLabelBindingResolver {
|
||||
private InboundOrderEntity prepareMissingInbound(long tenantId, long orderId) {
|
||||
try {
|
||||
ApiResponse<com.baiyue.firstleg.dto.OrderApprovedInboundCommand> response =
|
||||
orderCargoClient.inboundSnapshot(internalToken, tenantId, orderId);
|
||||
printableOrderInboundClient.reserve(internalToken, tenantId, orderId);
|
||||
if (response == null || !response.successful() || response.data() == null) {
|
||||
throw new BizException(ResultCode.NOT_FOUND, "订单不存在或无法生成预入库单");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user