fix: 揽收推费按承运运单号 CarrierWaybillNo 匹配
All checks were successful
Build and Deploy / deploy (push) Successful in 1m1s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-09-29 19:56:40 +08:00
parent 5fb6888b55
commit 955a3c8c6d
4 changed files with 16 additions and 5 deletions

View File

@ -388,6 +388,9 @@ public class PickupOpenApiPushFeeResult
public class PickupOpenApiPushFeeInput
{
/// <summary>
/// 承运运单号,对应库字段 CarrierWaybillNo。
/// </summary>
public string? WaybillNumber { get; set; }
public decimal ActualWeight { get; set; }

View File

@ -70,10 +70,10 @@ public class PickupOrderFeePushService : IScopedDependency
throw new BusinessException("请求体不能为空");
}
var pickupNo = (input.WaybillNumber ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(pickupNo))
var carrierWaybillNo = (input.WaybillNumber ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(carrierWaybillNo))
{
throw new BusinessException("waybillNumber 不能为空");
throw new BusinessException("waybillNumber(承运运单号 CarrierWaybillNo)不能为空");
}
if (input.ActualWeight <= 0)
@ -87,8 +87,8 @@ public class PickupOrderFeePushService : IScopedDependency
throw new BusinessException("goodsSizeList 不能为空");
}
var pickup = await _pickupOrderRepository.GetByPickupNoAsync(pickupNo)
?? throw new BusinessException("揽收单不存在");
var pickup = await _pickupOrderRepository.GetByCarrierWaybillNoAsync(carrierWaybillNo)
?? throw new BusinessException($"揽收单不存在:承运运单号 {carrierWaybillNo}");
await EnsureAppKeyAsync(key, pickup);

View File

@ -7,6 +7,8 @@ public interface IPickupOrderRepository : IRepository<PickupOrder>
{
Task<PickupOrder?> GetByPickupNoAsync(string pickupNo, CancellationToken cancellationToken = default);
Task<PickupOrder?> GetByCarrierWaybillNoAsync(string carrierWaybillNo, CancellationToken cancellationToken = default);
Task<PickupOrder?> GetOwnedAsync(int id, int customerId, CancellationToken cancellationToken = default);
Task<PickupWorkplaceCountRow> GetWorkplaceCountsAsync(

View File

@ -14,6 +14,12 @@ public class PickupOrderRepository : OmsSqlSugarRepository<PickupOrder>, IPickup
return FirstOrDefaultAsync(x => x.PickupNo == no, cancellationToken);
}
public Task<PickupOrder?> GetByCarrierWaybillNoAsync(string carrierWaybillNo, CancellationToken cancellationToken = default)
{
var no = carrierWaybillNo.Trim();
return FirstOrDefaultAsync(x => x.CarrierWaybillNo == no, cancellationToken);
}
public Task<PickupOrder?> GetOwnedAsync(int id, int customerId, CancellationToken cancellationToken = default)
{
return FirstOrDefaultAsync(x => x.Id == id && x.CustomerId == customerId, cancellationToken);