admin/src/Oms.SqlSugarCore/Orders/Customs9610OrderRepository.cs
zzh a70f6f2a87 feat: 接入 9610 汇总申报,字段按业务含义命名并对齐运单
含清单/报关单拉取、ITFX 转发配置、迁移脚本与拣货单号扩展。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-30 17:46:04 +08:00

57 lines
2.1 KiB
C#

using Fake.DependencyInjection;
using Oms.Domain.OrdersAggregate.Entities;
using Oms.Domain.OrdersAggregate.Repositories;
using Oms.SqlSugarCore.Repositories;
namespace Oms.SqlSugarCore.Orders;
public class Customs9610OrderRepository : OmsSqlSugarRepository<Customs9610Order>, ICustoms9610OrderRepository, IScopedDependency
{
public Task<Customs9610Order?> GetByOrderIdAsync(int orderId, CancellationToken cancellationToken = default)
{
return FirstOrDefaultAsync(x => x.OrderId == orderId, cancellationToken);
}
public async Task HardDeleteItemsByHeaderIdAsync(int customs9610OrderId, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
await db.Deleteable<Customs9610OrderItem>()
.Where(x => x.Customs9610OrderId == customs9610OrderId)
.ExecuteCommandAsync(cancellationToken);
}
public async Task HardDeleteAsync(Customs9610Order entity, CancellationToken cancellationToken = default)
{
var db = await GetDbContextAsync(cancellationToken);
await db.Deleteable<Customs9610Order>()
.Where(x => x.Id == entity.Id)
.ExecuteCommandAsync(cancellationToken);
}
}
public class Customs9610OrderItemRepository
: OmsSqlSugarRepository<Customs9610OrderItem>,
ICustoms9610OrderItemRepository,
IScopedDependency
{
public Task<List<Customs9610OrderItem>> GetByHeaderIdAsync(
int customs9610OrderId,
CancellationToken cancellationToken = default)
{
return GetListAsync(x => x.Customs9610OrderId == customs9610OrderId, cancellationToken: cancellationToken);
}
public async Task<List<Customs9610OrderItem>> GetByHeaderIdsAsync(
IReadOnlyCollection<int> headerIds,
CancellationToken cancellationToken = default)
{
if (headerIds == null || headerIds.Count == 0)
{
return [];
}
var ids = headerIds.Distinct().ToList();
return await GetListAsync(x => ids.Contains(x.Customs9610OrderId), cancellationToken: cancellationToken);
}
}