diff --git a/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs b/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs index edf9b3aa..8256c0d4 100644 --- a/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs +++ b/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs @@ -80,6 +80,11 @@ public class Consignee public class UpsertBigBagInput { + /// + /// 服务商code + /// + public string ApiCode { get; set; } + /// /// 客户名称,或者code,必填 /// @@ -108,7 +113,7 @@ public class UpsertBigBagInput public string Product { get; set; } /// - /// 产品名称,或者code + /// 目的国家二字码 /// public string Country { get; set; } } diff --git a/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs b/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs index f8949f36..cbcfc734 100644 --- a/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs +++ b/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs @@ -179,7 +179,8 @@ public partial class OrderService var config = await _trackPullConfigRepository .FirstOrDefaultAsync(x => x.AppKey == AppKey - && x.ServiceProviderCode == input.ApiCode); + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.小包); if (config == null) { @@ -192,11 +193,12 @@ public partial class OrderService return order; } - private Task BuiltOrder(UpsertBigBagInput input) + private async Task BuiltOrder(UpsertBigBagInput input) { var order = new OrderEntity { AppKey = AppKey!, + ServiceProviderCode = input.ApiCode, OrderType = TrackOrderType.大包, OrderNo = input.BagNo, ThirdPartyOrderNumber = input.OtherNo, @@ -206,8 +208,25 @@ public partial class OrderService ArrivalCountry = input.Country }; - // tips: 2025-11-29 zzh 大包没有轨迹拉取能力 - return Task.FromResult(order); + if (string.IsNullOrWhiteSpace(input.ApiCode)) + { + // 未传 apiCode 时保持兼容:不挂拉取配置 + return order; + } + + var config = await _trackPullConfigRepository + .FirstOrDefaultAsync(x => x.AppKey == AppKey + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.大包); + + if (config == null) + { + throw ProviderServiceActionResult.Exception("创建/更新失败", + "没有适用的大包拉取配置,请先配置轨迹拉取,否则无法拉取轨迹"); + } + + order.OrderPullStatus = [CreateOrderPullStatus(config, order)]; + return order; } private async Task BuiltOrder(UpsertMasterOrderInput input) @@ -227,7 +246,8 @@ public partial class OrderService var config = await _trackPullConfigRepository .FirstOrDefaultAsync(x => x.AppKey == AppKey - && x.ServiceProviderCode == input.ApiCode); + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.小包); if (config == null) {