feat: UpsertBigBag 支持 apiCode 并匹配大包拉取配置
All checks were successful
Build and Deploy / deploy (push) Successful in 49s
All checks were successful
Build and Deploy / deploy (push) Successful in 49s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3f36445894
commit
f6590de824
@ -80,6 +80,11 @@ public class Consignee
|
|||||||
|
|
||||||
public class UpsertBigBagInput
|
public class UpsertBigBagInput
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 服务商code
|
||||||
|
/// </summary>
|
||||||
|
public string ApiCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户名称,或者code,必填
|
/// 客户名称,或者code,必填
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -108,7 +113,7 @@ public class UpsertBigBagInput
|
|||||||
public string Product { get; set; }
|
public string Product { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 产品名称,或者code
|
/// 目的国家二字码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,8 @@ public partial class OrderService
|
|||||||
|
|
||||||
var config = await _trackPullConfigRepository
|
var config = await _trackPullConfigRepository
|
||||||
.FirstOrDefaultAsync(x => x.AppKey == AppKey
|
.FirstOrDefaultAsync(x => x.AppKey == AppKey
|
||||||
&& x.ServiceProviderCode == input.ApiCode);
|
&& x.ServiceProviderCode == input.ApiCode
|
||||||
|
&& x.OrderType == TrackOrderType.小包);
|
||||||
|
|
||||||
if (config == null)
|
if (config == null)
|
||||||
{
|
{
|
||||||
@ -192,11 +193,12 @@ public partial class OrderService
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<OrderEntity> BuiltOrder(UpsertBigBagInput input)
|
private async Task<OrderEntity> BuiltOrder(UpsertBigBagInput input)
|
||||||
{
|
{
|
||||||
var order = new OrderEntity
|
var order = new OrderEntity
|
||||||
{
|
{
|
||||||
AppKey = AppKey!,
|
AppKey = AppKey!,
|
||||||
|
ServiceProviderCode = input.ApiCode,
|
||||||
OrderType = TrackOrderType.大包,
|
OrderType = TrackOrderType.大包,
|
||||||
OrderNo = input.BagNo,
|
OrderNo = input.BagNo,
|
||||||
ThirdPartyOrderNumber = input.OtherNo,
|
ThirdPartyOrderNumber = input.OtherNo,
|
||||||
@ -206,8 +208,25 @@ public partial class OrderService
|
|||||||
ArrivalCountry = input.Country
|
ArrivalCountry = input.Country
|
||||||
};
|
};
|
||||||
|
|
||||||
// tips: 2025-11-29 zzh 大包没有轨迹拉取能力
|
if (string.IsNullOrWhiteSpace(input.ApiCode))
|
||||||
return Task.FromResult(order);
|
{
|
||||||
|
// 未传 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<OrderEntity> BuiltOrder(UpsertMasterOrderInput input)
|
private async Task<OrderEntity> BuiltOrder(UpsertMasterOrderInput input)
|
||||||
@ -227,7 +246,8 @@ public partial class OrderService
|
|||||||
|
|
||||||
var config = await _trackPullConfigRepository
|
var config = await _trackPullConfigRepository
|
||||||
.FirstOrDefaultAsync(x => x.AppKey == AppKey
|
.FirstOrDefaultAsync(x => x.AppKey == AppKey
|
||||||
&& x.ServiceProviderCode == input.ApiCode);
|
&& x.ServiceProviderCode == input.ApiCode
|
||||||
|
&& x.OrderType == TrackOrderType.小包);
|
||||||
|
|
||||||
if (config == null)
|
if (config == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user