All checks were successful
Build and Deploy / deploy (push) Successful in 1m17s
Co-authored-by: Cursor <cursoragent@cursor.com>
86 lines
3.8 KiB
C#
86 lines
3.8 KiB
C#
using Fake.DependencyInjection;
|
|
using Oms.Domain.WarehouseAggregate.Entities;
|
|
using Oms.Domain.WarehouseAggregate.Repositories;
|
|
using Oms.SqlSugarCore.Repositories;
|
|
|
|
namespace Oms.SqlSugarCore.Warehouse;
|
|
|
|
public class CSkuRepository : OmsSqlSugarRepository<CSku>, ICSkuRepository, IScopedDependency
|
|
{
|
|
public async Task<CSku?> GetByCustomerAndSkuCodeIncludingDeletedAsync(
|
|
int customerId,
|
|
string skuCode,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
var db = await GetDbContextAsync(cancellationToken);
|
|
return await SoftDeleteQuery.FirstIncludingDeletedAsync<CSku>(
|
|
db,
|
|
x => x.CustomerId == customerId && x.SkuCode == skuCode,
|
|
cancellationToken);
|
|
}
|
|
}
|
|
|
|
public class CBinLocationRepository : OmsSqlSugarRepository<CBinLocation>, ICBinLocationRepository, IScopedDependency
|
|
{
|
|
public async Task<CBinLocation?> GetByWarehouseAndBinCodeIncludingDeletedAsync(
|
|
int warehouseId,
|
|
string binCode,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
var db = await GetDbContextAsync(cancellationToken);
|
|
return await SoftDeleteQuery.FirstIncludingDeletedAsync<CBinLocation>(
|
|
db,
|
|
x => x.WarehouseId == warehouseId && x.BinCode == binCode,
|
|
cancellationToken);
|
|
}
|
|
}
|
|
|
|
public class CInventoryRepository : OmsSqlSugarRepository<CInventory>, ICInventoryRepository, IScopedDependency;
|
|
|
|
public class CInboundNoticeRepository : OmsSqlSugarRepository<CInboundNotice>, ICInboundNoticeRepository, IScopedDependency;
|
|
|
|
public class CInboundBoxRepository : OmsSqlSugarRepository<CInboundBox>, ICInboundBoxRepository, IScopedDependency;
|
|
|
|
public class CInboundBoxLineRepository : OmsSqlSugarRepository<CInboundBoxLine>, ICInboundBoxLineRepository, IScopedDependency;
|
|
|
|
public class CParcelRepository : OmsSqlSugarRepository<CParcel>, ICParcelRepository, IScopedDependency;
|
|
|
|
public class CParcelItemRepository : OmsSqlSugarRepository<CParcelItem>, ICParcelItemRepository, IScopedDependency;
|
|
|
|
public class CParcelArrivalRepository : OmsSqlSugarRepository<CParcelArrival>, ICParcelArrivalRepository, IScopedDependency;
|
|
|
|
public class CSkuPlatformMapRepository : OmsSqlSugarRepository<CSkuPlatformMap>, ICSkuPlatformMapRepository, IScopedDependency;
|
|
|
|
public class CWarehouseRentRateRepository : OmsSqlSugarRepository<CWarehouseRentRate>, ICWarehouseRentRateRepository, IScopedDependency;
|
|
|
|
public class CWarehouseRentRateFactorRepository : OmsSqlSugarRepository<CWarehouseRentRateFactor>, ICWarehouseRentRateFactorRepository, IScopedDependency;
|
|
|
|
public class CWarehouseRentRateDetailRepository : OmsSqlSugarRepository<CWarehouseRentRateDetail>, ICWarehouseRentRateDetailRepository, IScopedDependency;
|
|
|
|
public class CWarehouseRentLotRepository : OmsSqlSugarRepository<CWarehouseRentLot>, ICWarehouseRentLotRepository, IScopedDependency;
|
|
|
|
public class CWarehouseRentBillRepository : OmsSqlSugarRepository<CWarehouseRentBill>, ICWarehouseRentBillRepository, IScopedDependency
|
|
{
|
|
public async Task<bool> TryAcquireBillingLockAsync(
|
|
string lockName,
|
|
int timeoutSeconds,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
var db = await GetDbContextAsync(cancellationToken);
|
|
var result = await db.Ado.SqlQuerySingleAsync<int?>(
|
|
"SELECT GET_LOCK(@lockName, @timeoutSeconds)",
|
|
new { lockName, timeoutSeconds });
|
|
return result == 1;
|
|
}
|
|
|
|
public async Task ReleaseBillingLockAsync(string lockName, CancellationToken cancellationToken = default)
|
|
{
|
|
var db = await GetDbContextAsync(cancellationToken);
|
|
await db.Ado.SqlQuerySingleAsync<int?>(
|
|
"SELECT RELEASE_LOCK(@lockName)",
|
|
new { lockName });
|
|
}
|
|
}
|
|
|
|
public class CWarehouseRentBillLineRepository : OmsSqlSugarRepository<CWarehouseRentBillLine>, ICWarehouseRentBillLineRepository, IScopedDependency;
|