修改提交
This commit is contained in:
+25
-1
@@ -8,6 +8,9 @@ import com.baiyue.lastleg.dropship.service.DropshipOrderService;
|
||||
import com.baiyue.lastleg.inboundplan.entity.InboundPlanCarton;
|
||||
import com.baiyue.lastleg.inboundplan.mapper.InboundPlanCartonMapper;
|
||||
import com.baiyue.lastleg.inboundplan.service.InboundPlanService;
|
||||
import com.baiyue.lastleg.inboundplan.dto.InboundPlanResponse;
|
||||
import com.baiyue.lastleg.inventory.command.dto.InventoryCommandRequests;
|
||||
import com.baiyue.lastleg.inventory.command.service.InventoryCommandService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -35,6 +38,7 @@ public class LoadingCompletedConsumer {
|
||||
@Resource private ObjectMapper objectMapper;
|
||||
@Resource private LastlegOrderNoGenerator orderNoGenerator;
|
||||
@Resource private DropshipOrderService dropshipOrders;
|
||||
@Resource private InventoryCommandService inventory;
|
||||
|
||||
@Transactional
|
||||
public int consume(EventEnvelope envelope) {
|
||||
@@ -184,7 +188,10 @@ public class LoadingCompletedConsumer {
|
||||
LastlegOrderStatusHistory history=new LastlegOrderStatusHistory();
|
||||
history.setOrderId(order.getId()); history.setToStatus("PENDING_ASSIGNMENT"); history.setEventId(event.eventId());
|
||||
history.setRemark("头程装柜完成自动生成"); history.setCreatedAt(LocalDateTime.now()); historyMapper.insert(history);
|
||||
if ("FIRST_LEG".equals(orderType)) inboundPlans.convert(customerId, order.getId());
|
||||
if ("FIRST_LEG".equals(orderType)) {
|
||||
InboundPlanResponse plan = inboundPlans.convert(customerId, order.getId());
|
||||
registerInTransit(event, payload, source, order, plan.planNo());
|
||||
}
|
||||
if ("ONE_CLICK_DROPSHIP".equals(orderType)) {
|
||||
long warehouseId;
|
||||
try { warehouseId = Long.parseLong(payload.warehouseId()); }
|
||||
@@ -194,6 +201,23 @@ public class LoadingCompletedConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
private void registerInTransit(EventEnvelope event, FirstLegLoadingPlanCompletedV1 payload,
|
||||
FirstLegLoadingPlanCompletedV1.Order source, LastlegOrder order,
|
||||
String inboundOrderNo) {
|
||||
for (int index = 0; index < source.items().size(); index++) {
|
||||
FirstLegLoadingPlanCompletedV1.Item item = source.items().get(index);
|
||||
if (item.packageCount() <= 0) continue;
|
||||
inventory.registerInTransit(order.getCustomerId(), "SYSTEM",
|
||||
new InventoryCommandRequests.InTransit(order.getCustomerName(), payload.warehouseId(), null,
|
||||
payload.warehouseName(), item.destinationWarehouseId(), item.destinationWarehouseCode(),
|
||||
item.destinationWarehouseName(), order.getId(), inboundOrderNo, source.inboundCode(),
|
||||
item.skuCode(), item.productNameZh(), item.productNameEn(), item.packageCount(),
|
||||
order.getOrderNo(), event.eventId(),
|
||||
"TAIL_IN_TRANSIT:" + event.eventId() + ":" + order.getId() + ":" + index,
|
||||
"Tail-leg order created from completed loading plan"));
|
||||
}
|
||||
}
|
||||
|
||||
private void createCartonLabelPool(String customerId, FirstLegLoadingPlanCompletedV1.Item item) {
|
||||
List<String> marks = item.cartonMarks() == null ? List.of() : item.cartonMarks();
|
||||
if (marks.isEmpty()) return; // 历史 V1 事件保持原有按箱数入库路径。
|
||||
|
||||
Reference in New Issue
Block a user