Browse Source

[fix]根据租户获取数据部分调试通过

master
贾荣国 3 years ago
parent
commit
535d797067
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs
  2. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs
  3. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IX12AsnRepository.cs
  4. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Asn.cs
  5. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs
  6. 3001
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519065006_X12Asn1.Designer.cs
  7. 24
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519065006_X12Asn1.cs
  8. 3004
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073201_X12Asn2.Designer.cs
  9. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073201_X12Asn2.cs
  10. 3006
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073313_X12Asn3.Designer.cs
  11. 33
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073313_X12Asn3.cs
  12. 3008
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519082225_X12Asn4.Designer.cs
  13. 42
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519082225_X12Asn4.cs
  14. 12
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs
  15. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Repositories/X12AsnRepository.cs
  16. 73
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBackgroundWorker.cs
  17. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBgWorker.cs
  18. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  19. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs
  20. 3
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs
  21. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs
  22. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs
  23. 84
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs
  24. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbAsnRepository.cs

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs

@ -14,7 +14,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary>
public interface IX12AsnAppService : IReadOnlyAppService<X12AsnDTO,Guid,RequestDTO>
{
Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(int count);
Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(string site, int count);
}

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs

@ -23,6 +23,7 @@ using Volo.Abp.Validation;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
using Volo.Abp.TenantManagement;
using Win_in.Sfs.Scp.WebApi.Asns;
using Volo.Abp.Domain.Entities;
namespace Win_in.Sfs.Scp.WebApi
{
@ -76,9 +77,14 @@ namespace Win_in.Sfs.Scp.WebApi
return await base.GetListAsync(requestDTO);
}
public async Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(int count)
[HttpGet]
[Route("unread")]
public async Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(string site, int count)
{
var entities = await _x12AsnRepository.GetUnreadListAsync(count);
var entities = await _x12AsnRepository.GetUnreadListAsync(site,count);
var dtos = entities.Select(entity => new X12AsnDTO()
{
@ -92,6 +98,7 @@ namespace Win_in.Sfs.Scp.WebApi
return new ListResultDto<X12AsnDTO>(dtos);
}
}
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IX12AsnRepository.cs

@ -7,7 +7,7 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
public interface IX12AsnRepository : IRepository<X12Asn, Guid>
{
Task<List<X12Asn>> GetUnreadListAsync(int count);
Task<List<X12Asn>> GetUnreadListAsync(string site, int count);
Task<X12Asn> UpdateStatusAsync(Guid id, EnumExchangeDataStatus status);
}

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Asn.cs

@ -10,6 +10,12 @@ public class X12Asn: EntityBase<Guid>
{
public long UID { get; set; }
/// <summary>
/// 地点
/// </summary>
public string Site { get; set; }
/// <summary>
/// 单据号
/// </summary>
@ -72,9 +78,15 @@ public class X12Asn: EntityBase<Guid>
public int RetryTimes { get; protected internal set; } = 0;
public X12Asn(long uid,string billNum,string dataContent,DateTime effectiveDate)
public X12Asn()
{
}
public X12Asn(long uid,string site,string billNum,string dataContent,DateTime effectiveDate)
{
UID = uid;
Site = site;
BillNum = billNum;
DataType = "ASN";
DataContent = dataContent;

6
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs

@ -286,7 +286,7 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.ToTable(options.TablePrefix + "_X12Asn", options.Schema);
b.ConfigureByConvention();
b.Property(q => q.Site).HasMaxLength(16).IsRequired();
b.Property(q => q.BillNum).HasMaxLength(16).IsRequired();
b.Property(q => q.EffectiveDate).HasColumnType("datetime2(7)").IsRequired();
b.Property(q => q.Status).IsRequired();
@ -298,9 +298,11 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.Property(q => q.WriteTime).IsRequired();
b.Property(q => q.Writer).HasMaxLength(16);
b.Property(q => q.DestinationSystem).IsRequired().HasMaxLength(16);
b.Property(q => q.ReadTime).IsRequired();
b.Property(q => q.ReadTime);
b.Property(q => q.Reader).HasMaxLength(16);
b.Property(q => q.Remark);
b.HasIndex(q => new { q.Site, q.UID }).IsUnique();
});
}

3001
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519065006_X12Asn1.Designer.cs

File diff suppressed because it is too large

24
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519065006_X12Asn1.cs

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class X12Asn1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "UID",
table: "WebApi_X12Asn",
type: "bigint",
nullable: false,
defaultValue: 0L);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UID",
table: "WebApi_X12Asn");
}
}
}

3004
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073201_X12Asn2.Designer.cs

File diff suppressed because it is too large

23
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073201_X12Asn2.cs

@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class X12Asn2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Site",
table: "WebApi_X12Asn",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Site",
table: "WebApi_X12Asn");
}
}
}

3006
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073313_X12Asn3.Designer.cs

File diff suppressed because it is too large

33
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519073313_X12Asn3.cs

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class X12Asn3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Site",
table: "WebApi_X12Asn",
type: "nvarchar(16)",
maxLength: 16,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Site",
table: "WebApi_X12Asn",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(16)",
oldMaxLength: 16);
}
}
}

3008
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519082225_X12Asn4.Designer.cs

File diff suppressed because it is too large

42
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220519082225_X12Asn4.cs

@ -0,0 +1,42 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class X12Asn4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "ReadTime",
table: "WebApi_X12Asn",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.CreateIndex(
name: "IX_WebApi_X12Asn_Site_UID",
table: "WebApi_X12Asn",
columns: new[] { "Site", "UID" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_WebApi_X12Asn_Site_UID",
table: "WebApi_X12Asn");
migrationBuilder.AlterColumn<DateTime>(
name: "ReadTime",
table: "WebApi_X12Asn",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
}
}
}

12
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs

@ -1979,7 +1979,6 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("ReadTime")
.IsRequired()
.HasColumnType("datetime2");
b.Property<string>("Reader")
@ -1992,6 +1991,11 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<int>("RetryTimes")
.HasColumnType("int");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("SourceSystem")
.IsRequired()
.HasMaxLength(16)
@ -2003,6 +2007,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<string>("TraceId")
.HasColumnType("nvarchar(max)");
b.Property<long>("UID")
.HasColumnType("bigint");
b.Property<DateTime>("WriteTime")
.HasColumnType("datetime2");
@ -2012,6 +2019,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.HasKey("Id");
b.HasIndex("Site", "UID")
.IsUnique();
b.ToTable("WebApi_X12Asn");
});

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Repositories/X12AsnRepository.cs

@ -15,10 +15,11 @@ public class X12AsnRepository : EfCoreRepository<WebApiDbContext, X12Asn, Guid>,
{
}
public async Task<List<X12Asn>> GetUnreadListAsync(int count)
public async Task<List<X12Asn>> GetUnreadListAsync(string site, int count)
{
var dbSet = await GetDbSetAsync();
var list =await dbSet.Where(p => p.Status == EnumExchangeDataStatus.Ready)
var list =await dbSet
.Where(p =>p.Site ==site && p.Status == EnumExchangeDataStatus.Ready)
.OrderBy(p => p.UID)
.Take(count)
.ToListAsync();

73
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBackgroundWorker.cs

@ -1,15 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.MultiTenancy;
using Volo.Abp.TenantManagement;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.v1.Domain.Asns;
using Win_in.Sfs.Scp.WebApi.Asns;
namespace Win_in.Sfs.Scp.WebApi;
@ -38,22 +46,38 @@ public class AsnBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
return;
}
//Resolve dependencies
var scpAsnManager = workerContext
.ServiceProvider
.GetRequiredService<IScpAsnManager>();
var x12AsnRepository = workerContext
.ServiceProvider
.GetRequiredService<IX12AsnRepository>();
var scpAsnManager = workerContext.ServiceProvider.GetRequiredService<IScpAsnManager>();
var x12AsnRepository = workerContext.ServiceProvider.GetRequiredService<IX12AsnRepository>();
var tenantStore = workerContext.ServiceProvider.GetRequiredService<ITenantStore>();
var currentTenant = workerContext.ServiceProvider.GetRequiredService<ICurrentTenant>();
var dataFilter = workerContext.ServiceProvider.GetRequiredService<IDataFilter>();
//Do the work
var maxUid = await x12AsnRepository.MaxAsync(p => p.UID);
long maxUid = 0;
var x12 = await x12AsnRepository.OrderByDescending(p => p.UID).FirstOrDefaultAsync();
maxUid = x12?.UID ?? 0;
var asnX12List = new List<X12Asn>();
foreach (var site in _options.Value.Sites)
{
try
{
var tenant = await tenantStore.FindAsync(site);
using (currentTenant.Change(tenant.Id, tenant.Name))
{
using (dataFilter.Disable<IMultiTenant>())
{
var scpAsns = await scpAsnManager.GetUnreadAsnsAsync(maxUid, _options.Value.BatchSize);
Logger.LogInformation($"{scpAsns.Count} Scp ASN records were Found");
if (scpAsns.Count > 0)
if (scpAsns.Count <= 0)
{
var asnX12List = new List<X12Asn>();
continue;
}
foreach (var asn in scpAsns)
{
var barcodes = await scpAsnManager.GetBarcodesAsync(asn.AsnBillNum);
@ -62,11 +86,36 @@ public class AsnBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
var asnX128563060 = asnFactory.CreateAsnX128563060(asn, barcodes);
var dataContent = JsonSerializer.Serialize(asnX128563060);
var asnX12 = new X12Asn(asn.UID, asn.AsnBillNum, dataContent,asn.ShipTime??DateTime.Today);
var asnX12 = new X12Asn(asn.Id, asn.Site, asn.AsnBillNum, dataContent, asn.ShipTime ?? DateTime.Today);
asnX12List.Add(asnX12);
}
await x12AsnRepository.InsertManyAsync(asnX12List);
}
}
}
catch (Exception ex)
{
Logger.LogException(ex);
}
}
foreach (var x12Asn in asnX12List)
{
var exist = await x12AsnRepository.FirstOrDefaultAsync(p => p.UID == x12Asn.UID && p.Site == x12Asn.Site);
if (exist==null)
{
await x12AsnRepository.InsertAsync(x12Asn);
}
else
{
exist.DataContent = x12Asn.DataContent;
exist.Reset();
await x12AsnRepository.UpdateAsync(exist);
}
}
await x12AsnRepository.InsertManyAsync(asnX12List, true);
Logger.LogInformation("Completed: Handling Scp Asn data...");
}

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnBgWorker.cs

@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace Win_in.Sfs.Scp.WebApi;
public class AsnBgWorker
@ -6,4 +8,5 @@ public class AsnBgWorker
public int PeriodSeconds { get; set; } = 60;
public int RetryTimes { get; set; } = 3;
public int BatchSize { get; set; } = 10;
public List<string> Sites { get; set; } =new() ;
}

6
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -38,8 +38,8 @@
"Active": true,
"PeriodSeconds": 10,
"RetryTimes": 3,
"BatchSize": 10
"BatchSize": 10,
"Sites": ["T8","T9"]
},
"AlwaysAllowAuthorization": true,
"ValidSites": "T8,T9"
"AlwaysAllowAuthorization": true
}

2
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs

@ -10,8 +10,6 @@ namespace Win_in.Sfs.Scp.v1.Domain.Asns
public class TB_ASN : Entity<long>, IMultiTenant
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[StringLength(50)]
[Key]
public string AsnBillNum { get; set; }//发货单号

3
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs

@ -10,9 +10,6 @@ namespace Win_in.Sfs.Scp.v1.Domain.Asns
{
public partial class TS_BARCODE : Entity<long>, IMultiTenant
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[StringLength(50)]

4
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.v1.Domain.Asns;
namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
@ -12,5 +13,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
DbSet<TB_PO_DETAIL> PurchaseOrderDetails { get; set; }
DbSet<TB_RECEIVE_QAD> Receipts { get; set; }
DbSet<TB_RECEIVE_DETAIL_QAD> ReceiptDetails { get; set; }
DbSet<TB_ASN> Asns { get; set; }
DbSet<TS_BARCODE> barcodes { get; set; }
}
}

4
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs

@ -2,6 +2,7 @@
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.v1.Domain.Asns;
namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
@ -19,6 +20,9 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
public virtual DbSet<TB_RECEIVE_QAD> Receipts { get; set; }
public virtual DbSet<TB_RECEIVE_DETAIL_QAD> ReceiptDetails { get; set; }
public virtual DbSet<TB_ASN> Asns { get; set; }
public virtual DbSet<TS_BARCODE> barcodes { get; set; }
public V1ScpDbContext(DbContextOptions<V1ScpDbContext> options)

84
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs

@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Scp.v1.Domain;
using Win_in.Sfs.Scp.v1.Domain.Asns;
using Win_in.Sfs.Scp.WebApi;
namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
@ -29,6 +30,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
builder.ConfigPurchaseOrderDetail(options);
builder.ConfigReceipt(options);
builder.ConfigReceiptDetail(options);
builder.ConfigAsn(options);
builder.ConfigBarcode(options);
}
private static void ConfigurePart(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
@ -261,5 +264,86 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
});
}
private static void ConfigAsn(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<TB_ASN>(b =>
{
//Table
b.ToTable($"{nameof(TB_ASN)}", options.Schema);
//Convention
b.ConfigureByConvention();
//Properties
b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd();
b.Property(q => q.Site).HasMaxLength(50).IsRequired();
b.Property(q => q.AsnBillNum).HasMaxLength(50);
b.Property(q => q.AskBillNum).HasMaxLength(50);
b.Property(q => q.PoBillNum).HasMaxLength(50);
b.Property(q => q.VendId).HasMaxLength(50);
b.Property(q => q.ShipTime);
b.Property(q => q.State);
b.Property(q => q.Remark).HasMaxLength(50);
b.Property(q => q.ShipUser).HasMaxLength(50);
b.Property(q => q.ReceiveTime);
b.Property(q => q.ReceiveUser).HasMaxLength(50);
b.Property(q => q.Price).HasPrecision(18, 5);
b.Property(q => q.Currency).HasMaxLength(50);
b.Property(q => q.PlateNumber).HasMaxLength(50);
b.Property(q => q.ReceivedPort).HasMaxLength(50);
b.Property(q => q.Extend1);
b.Property(q => q.Extend2);
b.Property(q => q.Extend3);
b.Property(q => q.SubSite).HasMaxLength(50);
//Indexes
b.HasIndex(q => new { q.Site, q.AsnBillNum }).IsUnique();
});
}
private static void ConfigBarcode(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options)
{
builder.Entity<TS_BARCODE>(b =>
{
//Table
b.ToTable($"{nameof(TS_BARCODE)}", options.Schema);
//Convention
b.ConfigureByConvention();
//Properties
b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd();
b.Property(q => q.Site).HasMaxLength(50).IsRequired();
b.Property(q => q.BarCode).HasMaxLength(50);
b.Property(q => q.FullBarCode).HasMaxLength(500);
b.Property(q => q.PartCode).HasMaxLength(50).IsRequired();
b.Property(q => q.VendPartCode).HasMaxLength(50);
b.Property(q => q.Batch).HasMaxLength(50).IsRequired();
b.Property(q => q.ProduceDate);
b.Property(q => q.ManageType);
b.Property(q => q.SerialNum).HasMaxLength(50);
b.Property(q => q.BarCodeType);
b.Property(q => q.BillNum).HasMaxLength(50).IsRequired();
b.Property(q => q.PoBillLine);
b.Property(q => q.VendId).HasMaxLength(50);
b.Property(q => q.VendBatch).HasMaxLength(50);
b.Property(q => q.CreateOper).HasMaxLength(50).IsRequired();
b.Property(q => q.State);
b.Property(q => q.Remark).HasMaxLength(500);
b.Property(q => q.PoUnit);
b.Property(q => q.LocUnit);
b.Property(q => q.Qlevel);
b.Property(q => q.QMark);
b.Property(q => q.ProjectId);
b.Property(q => q.PoBillNum).HasMaxLength(50);
b.Property(q => q.Extend1);
b.Property(q => q.Extend2);
b.Property(q => q.Extend3);
b.Property(q => q.IsScanned);
//Indexes
b.HasIndex(q => new { q.Site, q.BillNum });
});
}
}
}

4
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbAsnRepository.cs

@ -19,8 +19,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
var dbSet = await GetDbSetAsync();
var list = await dbSet
.Where(p => p.UID > uid)
.OrderBy(p => p.UID)
.Where(p => p.Id > uid)
.OrderBy(p => p.Id)
.Take(batchSize)
.ToListAsync();
return list;

Loading…
Cancel
Save