* Added new Entities and Dtos

* Mapping new classes
* Added new services and Controllers in API
This commit is contained in:
2025-08-07 06:46:43 +02:00
parent 1842fd6146
commit 6139ce97d7
18 changed files with 855 additions and 6 deletions

View File

@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Services;
namespace FaKrosnoApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class CustomerController(ICustomerService service) : Controller
{
[HttpGet]
public async Task<ActionResult<IEnumerable<CustomerDto>>> GetAllCustomers()
{
IList<CustomerDto> customers = await service.GetAllCustomers();
return Ok(customers);
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Services;
namespace FaKrosnoApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class CustomerTpController(ICustomerTpService service) : Controller
{
[HttpGet]
public async Task<ActionResult<IEnumerable<CustomerTpDto>>> GetAllCustomers()
{
IList<CustomerTpDto> customers = await service.GetAllCustomersTp();
return Ok(customers);
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;
using SytelineSaAppEfDataModel.Services;
namespace FaKrosnoApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class EdiCustomerOrderImportController(IEdiCustomerOrderImportService service) : Controller
{
[HttpGet("last-update-date")]
public async Task<ActionResult<DateTime>> GetLastUpdateDate()
{
DateTime lastUpdateDate = await service.GetLastUpdateDate();
return Ok(lastUpdateDate);
}
}

View File

@@ -105,6 +105,9 @@ builder.Services.AddScoped<IWzClientService, WzClientService>();
builder.Services.AddScoped<IWzHeaderService, WzHeaderService>(); builder.Services.AddScoped<IWzHeaderService, WzHeaderService>();
builder.Services.AddScoped<IWzRowMeyleService, WzRowMeyleService>(); builder.Services.AddScoped<IWzRowMeyleService, WzRowMeyleService>();
builder.Services.AddScoped<IItemCustService, ItemCustService>(); builder.Services.AddScoped<IItemCustService, ItemCustService>();
builder.Services.AddScoped<IEdiCustomerOrderImportService, EdiCustomerOrderImportService>();
builder.Services.AddScoped<ICustomerService, CustomerService>();
builder.Services.AddScoped<ICustomerTpService, CustomerTpService>();
builder.Services.AddHostedService<TimedHostedService>(); builder.Services.AddHostedService<TimedHostedService>();
@@ -122,6 +125,6 @@ app.UseAuthorization();
app.MapControllers(); app.MapControllers();
app.UseHangfireDashboard(); // app.UseHangfireDashboard();
app.Run(); app.Run();

View File

@@ -0,0 +1,132 @@
namespace SytelineSaAppEfDataModel.Dtos;
public class CustomerDto
{
public string CustNum { get; set; }
public int CustSeq { get; set; }
public string Contact1 { get; set; }
public string Contact2 { get; set; }
public string Contact3 { get; set; }
public string Phone1 { get; set; }
public string Phone2 { get; set; }
public string Phone3 { get; set; }
public string CustType { get; set; }
public string TermsCode { get; set; }
public string ShipCode { get; set; }
public string Slsman { get; set; }
public string StateCycle { get; set; }
public bool FinChg { get; set; }
public DateTime? LastInv { get; set; }
public DateTime? LastPaid { get; set; }
public decimal? SalesYtd { get; set; }
public decimal? SalesLstYr { get; set; }
public decimal? DiscYtd { get; set; }
public decimal? DiscLstYr { get; set; }
public DateTime? LastFinChg { get; set; }
public decimal? SalesPtd { get; set; }
public DateTime? CalcDate { get; set; }
public int? NumPeriods { get; set; }
public int? AvgDaysOs { get; set; }
public int? NumInvoices { get; set; }
public int? HistDaysOs { get; set; }
public int? LargDaysOs { get; set; }
public int? LastDaysOs { get; set; }
public decimal? AvgBalOs { get; set; }
public decimal? LargeBalOs { get; set; }
public decimal? LastBalOs { get; set; }
public string Whse { get; set; }
public string Charfld1 { get; set; }
public string Charfld2 { get; set; }
public string Charfld3 { get; set; }
public decimal? Decifld1 { get; set; }
public decimal? Decifld2 { get; set; }
public decimal? Decifld3 { get; set; }
public bool Logifld { get; set; }
public DateTime? Datefld { get; set; }
public string TaxRegNum1 { get; set; }
public string BankCode { get; set; }
public string TaxRegNum2 { get; set; }
public string PayType { get; set; }
public bool EdiCust { get; set; }
public string BranchId { get; set; }
public string TransNat { get; set; }
public string Delterm { get; set; }
public string ProcessInd { get; set; }
public bool UseExchRate { get; set; }
public string TaxCode1 { get; set; }
public string TaxCode2 { get; set; }
public string Pricecode { get; set; }
public bool ShipEarly { get; set; }
public bool ShipPartial { get; set; }
public string LangCode { get; set; }
public string EndUserType { get; set; }
public string ShipSite { get; set; }
public bool LcrReqd { get; set; }
public string CustBank { get; set; }
public bool DraftPrintFlag { get; set; }
public bool RcvInternalEmail { get; set; }
public string CustomerEmailAddr { get; set; }
public bool SendCustomerEmail { get; set; }
public bool ApsPullUp { get; set; }
public string DoInvoice { get; set; }
public bool Consolidate { get; set; }
public string InvFreq { get; set; }
public bool Summarize { get; set; }
public bool NoteExistsFlag { get; set; }
public DateTime RecordDate { get; set; }
public Guid RowPointer { get; set; }
public bool Einvoice { get; set; }
public decimal? OrderBal { get; set; }
public decimal? PostedBal { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public DateTime CreateDate { get; set; }
public string CrmGuid { get; set; }
public bool InWorkflow { get; set; }
public bool PrintPackInv { get; set; }
public bool OnePackInv { get; set; }
public string InvCategory { get; set; }
public bool IncludeTaxInPrice { get; set; }
public string TransNat2 { get; set; }
public bool UseRevisionPayDays { get; set; }
public int? RevisionDay { get; set; }
public TimeSpan? RevisionDayStartTime1 { get; set; }
public TimeSpan? RevisionDayStartTime2 { get; set; }
public TimeSpan? RevisionDayEndTime1 { get; set; }
public TimeSpan? RevisionDayEndTime2 { get; set; }
public int? PayDay { get; set; }
public TimeSpan? PayDayStartTime1 { get; set; }
public TimeSpan? PayDayStartTime2 { get; set; }
public TimeSpan? PayDayEndTime1 { get; set; }
public TimeSpan? PayDayEndTime2 { get; set; }
public string ExportType { get; set; }
public bool ActiveForDataIntegration { get; set; }
public bool ShowInShipToDropDownList { get; set; }
public bool ShowInDropDownList { get; set; }
public string SicCode { get; set; }
public int? NumberOfEmployees { get; set; }
public decimal? CompanyRevenue { get; set; }
public string TerritoryCode { get; set; }
public string SalesTeamId { get; set; }
public int? DaysShippedBeforeDueDateTolerance { get; set; }
public int? DaysShippedAfterDueDateTolerance { get; set; }
public decimal? ShippedOverOrderedQtyTolerance { get; set; }
public decimal? ShippedUnderOrderedQtyTolerance { get; set; }
public int DefaultShipTo { get; set; }
public bool IncludeOrdersInTaxRpt { get; set; }
public decimal? ConstructiveSalePricePct { get; set; }
public string Uf_ZPL_FedId { get; set; }
public string Uf_ZPL_VATRegisterCode { get; set; }
public int? Uf_INT_CustSeq { get; set; }
public bool Uf_INT_Replicate { get; set; }
public int? Uf_FKR_FA_SL_SYKOF { get; set; }
public bool? Uf_FKR_FA_Eksport_SYKOF { get; set; }
public string Uf_FKR_FA_Kod_Dostawcy_u_Klienta { get; set; }
public string Uf_FKR_FA_Rampa { get; set; }
public string Uf_FKR_FA_Zaklad_Przeznaczenia { get; set; }
public char? Uf_FKR_Customer_Status { get; set; }
public bool? Uf_bpx_customer_printbatch { get; set; }
public string Uf_cust_receiver_line1 { get; set; }
public string Uf_cust_receiver_line2 { get; set; }
public int? Uf_cust_supplier_no { get; set; }
}

View File

@@ -0,0 +1,41 @@
namespace SytelineSaAppEfDataModel.Dtos;
public class CustomerTpDto
{
public string CustNum { get; set; }
public int CustSeq { get; set; }
public bool UpdCustAddress { get; set; }
public string TpCode { get; set; }
public string DunsNum { get; set; }
public bool GenAck { get; set; }
public bool PaperAck { get; set; }
public bool GenAsn { get; set; }
public bool PaperAsn { get; set; }
public bool GenInv { get; set; }
public bool PaperInv { get; set; }
public string AutoPost { get; set; }
public bool PostPlanned { get; set; }
public string ReleaseProc { get; set; }
public bool PooledAsn { get; set; }
public bool ValPrice { get; set; }
public string UsePrice { get; set; }
public bool ValCredit { get; set; }
public string NoteProc { get; set; }
public string UseDate { get; set; }
public int? DateOffset { get; set; }
public string InvCode { get; set; }
public string AckCode { get; set; }
public string AsnCode { get; set; }
public DateTime? LastItemDate { get; set; }
public DateTime? LastCustaDate { get; set; }
public bool IncludeSerial { get; set; }
public bool NoteExistsFlag { get; set; }
public DateTime RecordDate { get; set; }
public Guid RowPointer { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public DateTime CreateDate { get; set; }
public bool InWorkflow { get; set; }
public string Uf_FKR_EDI_RSSBussFolder { get; set; }
public string Uf_FKR_EDI_IdentificationCode { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace SytelineSaAppEfDataModel.Dtos;
public class EdiCustomerOrderImportDto
{
public int Id { get; set; }
public int ScheduleOrderId { get; set; }
public DateTime LastUpdateDate { get; set; }
public DateTime CreatedDate { get; set; }
public string Status { get; set; }
public string LogData { get; set; }
public int ItemsCount { get; set; }
}

View File

@@ -0,0 +1,132 @@
namespace SytelineSaAppEfDataModel.Entities;
public class Customer
{
public string CustNum { get; set; }
public int CustSeq { get; set; }
public string Contact1 { get; set; }
public string Contact2 { get; set; }
public string Contact3 { get; set; }
public string Phone1 { get; set; }
public string Phone2 { get; set; }
public string Phone3 { get; set; }
public string CustType { get; set; }
public string TermsCode { get; set; }
public string ShipCode { get; set; }
public string Slsman { get; set; }
public string StateCycle { get; set; }
public bool FinChg { get; set; }
public DateTime? LastInv { get; set; }
public DateTime? LastPaid { get; set; }
public decimal? SalesYtd { get; set; }
public decimal? SalesLstYr { get; set; }
public decimal? DiscYtd { get; set; }
public decimal? DiscLstYr { get; set; }
public DateTime? LastFinChg { get; set; }
public decimal? SalesPtd { get; set; }
public DateTime? CalcDate { get; set; }
public int? NumPeriods { get; set; }
public int? AvgDaysOs { get; set; }
public int? NumInvoices { get; set; }
public int? HistDaysOs { get; set; }
public int? LargDaysOs { get; set; }
public int? LastDaysOs { get; set; }
public decimal? AvgBalOs { get; set; }
public decimal? LargeBalOs { get; set; }
public decimal? LastBalOs { get; set; }
public string Whse { get; set; }
public string Charfld1 { get; set; }
public string Charfld2 { get; set; }
public string Charfld3 { get; set; }
public decimal? Decifld1 { get; set; }
public decimal? Decifld2 { get; set; }
public decimal? Decifld3 { get; set; }
public bool Logifld { get; set; }
public DateTime? Datefld { get; set; }
public string TaxRegNum1 { get; set; }
public string BankCode { get; set; }
public string TaxRegNum2 { get; set; }
public string PayType { get; set; }
public bool EdiCust { get; set; }
public string BranchId { get; set; }
public string TransNat { get; set; }
public string Delterm { get; set; }
public string ProcessInd { get; set; }
public bool UseExchRate { get; set; }
public string TaxCode1 { get; set; }
public string TaxCode2 { get; set; }
public string Pricecode { get; set; }
public bool ShipEarly { get; set; }
public bool ShipPartial { get; set; }
public string LangCode { get; set; }
public string EndUserType { get; set; }
public string ShipSite { get; set; }
public bool LcrReqd { get; set; }
public string CustBank { get; set; }
public bool DraftPrintFlag { get; set; }
public bool RcvInternalEmail { get; set; }
public string CustomerEmailAddr { get; set; }
public bool SendCustomerEmail { get; set; }
public bool ApsPullUp { get; set; }
public string DoInvoice { get; set; }
public bool Consolidate { get; set; }
public string InvFreq { get; set; }
public bool Summarize { get; set; }
public bool NoteExistsFlag { get; set; }
public DateTime RecordDate { get; set; }
public Guid RowPointer { get; set; }
public bool Einvoice { get; set; }
public decimal? OrderBal { get; set; }
public decimal? PostedBal { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public DateTime CreateDate { get; set; }
public string CrmGuid { get; set; }
public bool InWorkflow { get; set; }
public bool PrintPackInv { get; set; }
public bool OnePackInv { get; set; }
public string InvCategory { get; set; }
public bool IncludeTaxInPrice { get; set; }
public string TransNat2 { get; set; }
public bool UseRevisionPayDays { get; set; }
public int? RevisionDay { get; set; }
public TimeSpan? RevisionDayStartTime1 { get; set; }
public TimeSpan? RevisionDayStartTime2 { get; set; }
public TimeSpan? RevisionDayEndTime1 { get; set; }
public TimeSpan? RevisionDayEndTime2 { get; set; }
public int? PayDay { get; set; }
public TimeSpan? PayDayStartTime1 { get; set; }
public TimeSpan? PayDayStartTime2 { get; set; }
public TimeSpan? PayDayEndTime1 { get; set; }
public TimeSpan? PayDayEndTime2 { get; set; }
public string ExportType { get; set; }
public bool ActiveForDataIntegration { get; set; }
public bool ShowInShipToDropDownList { get; set; }
public bool ShowInDropDownList { get; set; }
public string SicCode { get; set; }
public int? NumberOfEmployees { get; set; }
public decimal? CompanyRevenue { get; set; }
public string TerritoryCode { get; set; }
public string SalesTeamId { get; set; }
public int? DaysShippedBeforeDueDateTolerance { get; set; }
public int? DaysShippedAfterDueDateTolerance { get; set; }
public decimal? ShippedOverOrderedQtyTolerance { get; set; }
public decimal? ShippedUnderOrderedQtyTolerance { get; set; }
public int DefaultShipTo { get; set; }
public bool IncludeOrdersInTaxRpt { get; set; }
public decimal? ConstructiveSalePricePct { get; set; }
public string Uf_ZPL_FedId { get; set; }
public string Uf_ZPL_VATRegisterCode { get; set; }
public int? Uf_INT_CustSeq { get; set; }
public bool Uf_INT_Replicate { get; set; }
public int? Uf_FKR_FA_SL_SYKOF { get; set; }
public bool? Uf_FKR_FA_Eksport_SYKOF { get; set; }
public string Uf_FKR_FA_Kod_Dostawcy_u_Klienta { get; set; }
public string Uf_FKR_FA_Rampa { get; set; }
public string Uf_FKR_FA_Zaklad_Przeznaczenia { get; set; }
public char? Uf_FKR_Customer_Status { get; set; }
public bool? Uf_bpx_customer_printbatch { get; set; }
public string Uf_cust_receiver_line1 { get; set; }
public string Uf_cust_receiver_line2 { get; set; }
public int? Uf_cust_supplier_no { get; set; }
}

View File

@@ -0,0 +1,41 @@
namespace SytelineSaAppEfDataModel.Entities;
public class CustomerTp
{
public string CustNum { get; set; }
public int CustSeq { get; set; }
public bool UpdCustAddress { get; set; }
public string TpCode { get; set; }
public string DunsNum { get; set; }
public bool GenAck { get; set; }
public bool PaperAck { get; set; }
public bool GenAsn { get; set; }
public bool PaperAsn { get; set; }
public bool GenInv { get; set; }
public bool PaperInv { get; set; }
public string AutoPost { get; set; }
public bool PostPlanned { get; set; }
public string ReleaseProc { get; set; }
public bool PooledAsn { get; set; }
public bool ValPrice { get; set; }
public string UsePrice { get; set; }
public bool ValCredit { get; set; }
public string NoteProc { get; set; }
public string UseDate { get; set; }
public int? DateOffset { get; set; }
public string InvCode { get; set; }
public string AckCode { get; set; }
public string AsnCode { get; set; }
public DateTime? LastItemDate { get; set; }
public DateTime? LastCustaDate { get; set; }
public bool IncludeSerial { get; set; }
public bool NoteExistsFlag { get; set; }
public DateTime RecordDate { get; set; }
public Guid RowPointer { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public DateTime CreateDate { get; set; }
public bool InWorkflow { get; set; }
public string Uf_FKR_EDI_RSSBussFolder { get; set; }
public string Uf_FKR_EDI_IdentificationCode { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace SytelineSaAppEfDataModel.Entities;
public class EdiCustomerOrderImport
{
public int Id { get; set; }
public int ScheduleOrderId { get; set; }
public DateTime LastUpdateDate { get; set; }
public DateTime CreatedDate { get; set; }
public string Status { get; set; }
public string LogData { get; set; }
public int ItemsCount { get; set; }
}

View File

@@ -25,6 +25,9 @@ namespace SytelineSaAppEfDataModel
CreateMap<WzRowMeyle, WzRowMeyleDto>().ReverseMap(); CreateMap<WzRowMeyle, WzRowMeyleDto>().ReverseMap();
CreateMap<ItemCust, ItemCustDto>().ReverseMap(); CreateMap<ItemCust, ItemCustDto>().ReverseMap();
CreateMap<Lot, LotDto>().ReverseMap(); CreateMap<Lot, LotDto>().ReverseMap();
CreateMap<EdiCustomerOrderImport, EdiCustomerOrderImportDto>().ReverseMap();
CreateMap<Customer, CustomerDto>().ReverseMap();
CreateMap<CustomerTp, CustomerTpDto>().ReverseMap();
} }
} }
} }

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class CustomerService(SytelineSaAppDbContext context, IMapper mapper) : ICustomerService
{
public async Task<IList<CustomerDto>> GetAllCustomers()
{
return await context.Customers.Select(x => mapper.Map<CustomerDto>(x)).ToListAsync();
}
}

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class CustomerTpService(SytelineSaAppDbContext context, IMapper mapper) : ICustomerTpService
{
public async Task<IList<CustomerTpDto>> GetAllCustomersTp()
{
return await context.CustomerTps.Select(x => mapper.Map<CustomerTpDto>(x)).ToListAsync();
}
}

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
namespace SytelineSaAppEfDataModel.Services;
public class EdiCustomerOrderImportService(SytelineSaAppDbContext context, IMapper mapper) : IEdiCustomerOrderImportService
{
public async Task<DateTime> GetLastUpdateDate()
{
return (await context.EdiCustomerOrderImports.OrderByDescending(x => x.LastUpdateDate)
.FirstOrDefaultAsync())?.LastUpdateDate ?? DateTime.Now.Date;
}
}

View File

@@ -0,0 +1,8 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface ICustomerService
{
Task<IList<CustomerDto>> GetAllCustomers();
}

View File

@@ -0,0 +1,8 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface ICustomerTpService
{
Task<IList<CustomerTpDto>> GetAllCustomersTp();
}

View File

@@ -0,0 +1,6 @@
namespace SytelineSaAppEfDataModel.Services;
public interface IEdiCustomerOrderImportService
{
Task<DateTime> GetLastUpdateDate();
}

View File

@@ -18,17 +18,16 @@ namespace SytelineSaAppEfDataModel
public DbSet<CustomerOrderLineItem> CustomerOrderLineItems { get; set; } public DbSet<CustomerOrderLineItem> CustomerOrderLineItems { get; set; }
public DbSet<UserName> UserNames { get; set; } public DbSet<UserName> UserNames { get; set; }
public DbSet<EdiUser> EdiUsers { get; set; } public DbSet<EdiUser> EdiUsers { get; set; }
public DbSet<MaterialTransaction> MaterialTransactions { get; set; } public DbSet<MaterialTransaction> MaterialTransactions { get; set; }
public DbSet<WzClient> WzClients { get; set; } public DbSet<WzClient> WzClients { get; set; }
public DbSet<WzHeader> WzHeaders { get; set; } public DbSet<WzHeader> WzHeaders { get; set; }
public DbSet<WzRowMeyle> WzRowsMeyle { get; set; } public DbSet<WzRowMeyle> WzRowsMeyle { get; set; }
public DbSet<ItemCust> ItemCusts { get; set; } public DbSet<ItemCust> ItemCusts { get; set; }
public DbSet<Lot> Lots { get; set; } public DbSet<Lot> Lots { get; set; }
public DbSet<EdiCustomerOrderImport> EdiCustomerOrderImports { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<CustomerTp> CustomerTps { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
var configuration = new ConfigurationBuilder() var configuration = new ConfigurationBuilder()
@@ -1306,6 +1305,369 @@ namespace SytelineSaAppEfDataModel
.HasDatabaseName("IX_lot_RowPointer") .HasDatabaseName("IX_lot_RowPointer")
.IsUnique(); .IsUnique();
}); });
modelBuilder.Entity<EdiCustomerOrderImport>(entity =>
{
entity.ToTable("edi_co_import");
entity.HasKey(e => e.Id);
entity.Property(e => e.Id)
.HasColumnName("Id")
.ValueGeneratedOnAdd();
entity.Property(e => e.ScheduleOrderId)
.HasColumnName("ScheduleOrderId")
.IsRequired();
entity.Property(e => e.LastUpdateDate)
.HasColumnName("LastUpdateDate")
.IsRequired();
entity.Property(e => e.CreatedDate)
.HasColumnName("CreatedDate")
.IsRequired();
entity.Property(e => e.Status)
.HasColumnName("Status")
.HasMaxLength(50)
.IsRequired();
entity.Property(e => e.LogData)
.HasColumnName("LogData")
.HasColumnType("varchar(max)")
.IsRequired(false);
entity.Property(e => e.ItemsCount)
.HasColumnName("ItemsCount")
.IsRequired();
});
modelBuilder.Entity<Customer>(entity =>
{
entity.ToTable("customer");
entity.HasKey(e => new { e.CustNum, e.CustSeq });
entity.Property(e => e.CustNum).HasColumnName("cust_num").HasMaxLength(14).IsRequired();
entity.Property(e => e.CustSeq).HasColumnName("cust_seq").HasDefaultValueSql("0");
entity.Property(e => e.Contact1).HasColumnName("contact##1").HasMaxLength(60).IsRequired(false);
entity.Property(e => e.Contact2).HasColumnName("contact##2").HasMaxLength(60).IsRequired(false);
entity.Property(e => e.Contact3).HasColumnName("contact##3").HasMaxLength(60).IsRequired(false);
entity.Property(e => e.Phone1).HasColumnName("phone##1").HasMaxLength(50).IsRequired(false);
entity.Property(e => e.Phone2).HasColumnName("phone##2").HasMaxLength(50).IsRequired(false);
entity.Property(e => e.Phone3).HasColumnName("phone##3").HasMaxLength(50).IsRequired(false);
entity.Property(e => e.CustType).HasColumnName("cust_type").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.TermsCode).HasColumnName("terms_code").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.ShipCode).HasColumnName("ship_code").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.Slsman).HasColumnName("slsman").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.StateCycle).HasColumnName("state_cycle").HasMaxLength(2).IsRequired(false);
entity.Property(e => e.FinChg).HasColumnName("fin_chg").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.LastInv).HasColumnName("last_inv").IsRequired(false);
entity.Property(e => e.LastPaid).HasColumnName("last_paid").IsRequired(false);
entity.Property(e => e.SalesYtd).HasColumnName("sales_ytd").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.SalesLstYr).HasColumnName("sales_lst_yr").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.DiscYtd).HasColumnName("disc_ytd").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.DiscLstYr).HasColumnName("disc_lst_yr").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.LastFinChg).HasColumnName("last_fin_chg").IsRequired(false);
entity.Property(e => e.SalesPtd).HasColumnName("sales_ptd").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.CalcDate).HasColumnName("calc_date").IsRequired(false);
entity.Property(e => e.NumPeriods).HasColumnName("num_periods").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.AvgDaysOs).HasColumnName("avg_days_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.NumInvoices).HasColumnName("num_invoices").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.HistDaysOs).HasColumnName("hist_days_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.LargDaysOs).HasColumnName("larg_days_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.LastDaysOs).HasColumnName("last_days_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.AvgBalOs).HasColumnName("avg_bal_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.LargeBalOs).HasColumnName("large_bal_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.LastBalOs).HasColumnName("last_bal_os").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.Whse).HasColumnName("whse").HasMaxLength(8).IsRequired(false);
entity.Property(e => e.Charfld1).HasColumnName("charfld1").HasMaxLength(40).IsRequired(false);
entity.Property(e => e.Charfld2).HasColumnName("charfld2").HasMaxLength(40).IsRequired(false);
entity.Property(e => e.Charfld3).HasColumnName("charfld3").HasMaxLength(40).IsRequired(false);
entity.Property(e => e.Decifld1).HasColumnName("decifld1").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.Decifld2).HasColumnName("decifld2").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.Decifld3).HasColumnName("decifld3").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.Logifld).HasColumnName("logifld").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.Datefld).HasColumnName("datefld").IsRequired(false);
entity.Property(e => e.TaxRegNum1).HasColumnName("tax_reg_num1").HasMaxLength(40).IsRequired(false);
entity.Property(e => e.BankCode).HasColumnName("bank_code").HasMaxLength(8).IsRequired(false);
entity.Property(e => e.TaxRegNum2).HasColumnName("tax_reg_num2").HasMaxLength(40).IsRequired(false);
entity.Property(e => e.PayType).HasColumnName("pay_type").HasMaxLength(1).HasDefaultValueSql("'C'");
entity.Property(e => e.EdiCust).HasColumnName("edi_cust").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.BranchId).HasColumnName("branch_id").HasMaxLength(20).IsRequired(false);
entity.Property(e => e.TransNat).HasColumnName("trans_nat").HasMaxLength(4).IsRequired(false);
entity.Property(e => e.Delterm).HasColumnName("delterm").HasMaxLength(8).IsRequired(false);
entity.Property(e => e.ProcessInd).HasColumnName("process_ind").HasMaxLength(2).IsRequired(false);
entity.Property(e => e.UseExchRate).HasColumnName("use_exch_rate").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.TaxCode1).HasColumnName("tax_code1").HasMaxLength(12).IsRequired(false);
entity.Property(e => e.TaxCode2).HasColumnName("tax_code2").HasMaxLength(12).IsRequired(false);
entity.Property(e => e.Pricecode).HasColumnName("pricecode").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.ShipEarly).HasColumnName("ship_early").HasColumnType("tinyint").HasDefaultValueSql("1");
entity.Property(e => e.ShipPartial).HasColumnName("ship_partial").HasColumnType("tinyint").HasDefaultValueSql("1");
entity.Property(e => e.LangCode).HasColumnName("lang_code").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.EndUserType).HasColumnName("end_user_type").HasMaxLength(6).IsRequired(false);
entity.Property(e => e.ShipSite).HasColumnName("ship_site").HasMaxLength(16).IsRequired(false);
entity.Property(e => e.LcrReqd).HasColumnName("lcr_reqd").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.CustBank).HasColumnName("cust_bank").HasMaxLength(8).IsRequired(false);
entity.Property(e => e.DraftPrintFlag).HasColumnName("draft_print_flag").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.RcvInternalEmail).HasColumnName("rcv_internal_email").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.CustomerEmailAddr).HasColumnName("customer_email_addr").HasMaxLength(60).IsRequired(false);
entity.Property(e => e.SendCustomerEmail).HasColumnName("send_customer_email").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.ApsPullUp).HasColumnName("aps_pull_up").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.DoInvoice).HasColumnName("do_invoice").HasMaxLength(1).HasDefaultValueSql("'S'");
entity.Property(e => e.Consolidate).HasColumnName("consolidate").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.InvFreq).HasColumnName("inv_freq").HasMaxLength(1).HasDefaultValueSql("'W'");
entity.Property(e => e.Summarize).HasColumnName("summarize").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.NoteExistsFlag).HasColumnName("NoteExistsFlag").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.RecordDate).HasColumnName("RecordDate").HasDefaultValueSql("getdate()");
entity.Property(e => e.RowPointer).HasColumnName("RowPointer").HasColumnType("uniqueidentifier").HasDefaultValueSql("newid()");
entity.Property(e => e.Einvoice).HasColumnName("einvoice").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.OrderBal).HasColumnName("order_bal").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.PostedBal).HasColumnName("posted_bal").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.CreatedBy).HasColumnName("CreatedBy").HasMaxLength(60).HasDefaultValueSql("suser_sname()");
entity.Property(e => e.UpdatedBy).HasColumnName("UpdatedBy").HasMaxLength(60).HasDefaultValueSql("suser_sname()");
entity.Property(e => e.CreateDate).HasColumnName("CreateDate").HasDefaultValueSql("getdate()");
entity.Property(e => e.CrmGuid).HasColumnName("crm_guid").HasMaxLength(36).IsRequired(false);
entity.Property(e => e.InWorkflow).HasColumnName("InWorkflow").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.PrintPackInv).HasColumnName("print_pack_inv").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.OnePackInv).HasColumnName("one_pack_inv").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.InvCategory).HasColumnName("inv_category").HasMaxLength(20).HasDefaultValueSql("'DEFAULTCATEGORY'");
entity.Property(e => e.IncludeTaxInPrice).HasColumnName("include_tax_in_price").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.TransNat2).HasColumnName("trans_nat_2").HasMaxLength(4).IsRequired(false);
entity.Property(e => e.UseRevisionPayDays).HasColumnName("use_revision_pay_days").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.RevisionDay).HasColumnName("revision_day").IsRequired(false);
entity.Property(e => e.RevisionDayStartTime1).HasColumnName("revision_day_start_time##1").IsRequired(false);
entity.Property(e => e.RevisionDayStartTime2).HasColumnName("revision_day_start_time##2").IsRequired(false);
entity.Property(e => e.RevisionDayEndTime1).HasColumnName("revision_day_end_time##1").IsRequired(false);
entity.Property(e => e.RevisionDayEndTime2).HasColumnName("revision_day_end_time##2").IsRequired(false);
entity.Property(e => e.PayDay).HasColumnName("pay_day").IsRequired(false);
entity.Property(e => e.PayDayStartTime1).HasColumnName("pay_day_start_time##1").IsRequired(false);
entity.Property(e => e.PayDayStartTime2).HasColumnName("pay_day_start_time##2").IsRequired(false);
entity.Property(e => e.PayDayEndTime1).HasColumnName("pay_day_end_time##1").IsRequired(false);
entity.Property(e => e.PayDayEndTime2).HasColumnName("pay_day_end_time##2").IsRequired(false);
entity.Property(e => e.ExportType).HasColumnName("export_type").HasMaxLength(1).HasDefaultValueSql("'N'");
entity.Property(e => e.ActiveForDataIntegration).HasColumnName("active_for_data_integration").HasColumnType("tinyint").HasDefaultValueSql("1");
entity.Property(e => e.ShowInShipToDropDownList).HasColumnName("show_in_ship_to_drop_down_list").HasColumnType("tinyint").HasDefaultValueSql("1");
entity.Property(e => e.ShowInDropDownList).HasColumnName("show_in_drop_down_list").HasColumnType("tinyint").HasDefaultValueSql("1");
entity.Property(e => e.SicCode).HasColumnName("sic_code").HasMaxLength(8).IsRequired(false);
entity.Property(e => e.NumberOfEmployees).HasColumnName("number_of_employees").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.CompanyRevenue).HasColumnName("company_revenue").HasDefaultValueSql("0").IsRequired(false);
entity.Property(e => e.TerritoryCode).HasColumnName("territory_code").HasMaxLength(10).IsRequired(false);
entity.Property(e => e.SalesTeamId).HasColumnName("sales_team_id").HasMaxLength(10).IsRequired(false);
entity.Property(e => e.DaysShippedBeforeDueDateTolerance).HasColumnName("days_shipped_before_due_date_tolerance").IsRequired(false);
entity.Property(e => e.DaysShippedAfterDueDateTolerance).HasColumnName("days_shipped_after_due_date_tolerance").IsRequired(false);
entity.Property(e => e.ShippedOverOrderedQtyTolerance).HasColumnName("shipped_over_ordered_qty_tolerance").IsRequired(false);
entity.Property(e => e.ShippedUnderOrderedQtyTolerance).HasColumnName("shipped_under_ordered_qty_tolerance").IsRequired(false);
entity.Property(e => e.DefaultShipTo).HasColumnName("default_ship_to").HasDefaultValueSql("0");
entity.Property(e => e.IncludeOrdersInTaxRpt).HasColumnName("include_orders_in_tax_rpt").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.ConstructiveSalePricePct).HasColumnName("constructive_sale_price_pct").IsRequired(false);
entity.Property(e => e.Uf_ZPL_FedId).HasColumnName("uf_ZPL_FedId").HasMaxLength(20).IsRequired(false);
entity.Property(e => e.Uf_ZPL_VATRegisterCode).HasColumnName("uf_ZPL_VATRegisterCode").HasMaxLength(20).IsRequired(false);
entity.Property(e => e.Uf_INT_CustSeq).HasColumnName("Uf_INT_CustSeq").IsRequired(false);
entity.Property(e => e.Uf_INT_Replicate).HasColumnName("UF_INT_Replicate").HasColumnType("tinyint").HasDefaultValueSql("0");
entity.Property(e => e.Uf_FKR_FA_SL_SYKOF).HasColumnName("Uf_FKR_FA_SL_SYKOF").IsRequired(false);
entity.Property(e => e.Uf_FKR_FA_Eksport_SYKOF).HasColumnName("Uf_FKR_FA_Eksport_SYKOF").HasColumnType("tinyint").IsRequired(false);
entity.Property(e => e.Uf_FKR_FA_Kod_Dostawcy_u_Klienta).HasColumnName("Uf_FKR_FA_Kod_Dostawcy_u_Klienta").HasMaxLength(20).IsRequired(false);
entity.Property(e => e.Uf_FKR_FA_Rampa).HasColumnName("Uf_FKR_FA_Rampa").HasMaxLength(20).IsRequired(false);
entity.Property(e => e.Uf_FKR_FA_Zaklad_Przeznaczenia).HasColumnName("Uf_FKR_FA_Zaklad_Przeznaczenia").HasMaxLength(100).IsRequired(false);
entity.Property(e => e.Uf_FKR_Customer_Status).HasColumnName("Uf_FKR_Customer_Status").HasMaxLength(1).IsRequired(false);
entity.Property(e => e.Uf_bpx_customer_printbatch).HasColumnName("Uf_bpx_customer_printbatch").HasColumnType("tinyint").IsRequired(false);
entity.Property(e => e.Uf_cust_receiver_line1).HasColumnName("Uf_cust_receiver_line1").HasMaxLength(100).IsRequired(false);
entity.Property(e => e.Uf_cust_receiver_line2).HasColumnName("Uf_cust_receiver_line2").HasMaxLength(100).IsRequired(false);
entity.Property(e => e.Uf_cust_supplier_no).HasColumnName("Uf_cust_supplier_no").IsRequired(false);
entity.HasIndex(e => e.RowPointer).HasDatabaseName("IX_customer_RowPointer").IsUnique();
});
modelBuilder.Entity<CustomerTp>(entity =>
{
entity.ToTable("cust_tp");
entity.HasKey(e => new { e.CustNum, e.CustSeq });
entity.Property(e => e.CustNum)
.HasColumnName("cust_num")
.HasMaxLength(14)
.IsRequired();
entity.Property(e => e.CustSeq)
.HasColumnName("cust_seq")
.HasColumnType("int")
.HasDefaultValueSql("0");
entity.Property(e => e.UpdCustAddress)
.HasColumnName("upd_cust_address")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.TpCode)
.HasColumnName("tp_code")
.HasMaxLength(6)
.IsRequired(false);
entity.Property(e => e.DunsNum)
.HasColumnName("duns_num")
.HasMaxLength(20)
.IsRequired(false);
entity.Property(e => e.GenAck)
.HasColumnName("gen_ack")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.PaperAck)
.HasColumnName("paper_ack")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.GenAsn)
.HasColumnName("gen_asn")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.PaperAsn)
.HasColumnName("paper_asn")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.GenInv)
.HasColumnName("gen_inv")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.PaperInv)
.HasColumnName("paper_inv")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.AutoPost)
.HasColumnName("auto_post")
.HasMaxLength(1)
.HasDefaultValueSql("'N'");
entity.Property(e => e.PostPlanned)
.HasColumnName("post_planned")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.ReleaseProc)
.HasColumnName("release_proc")
.HasMaxLength(1)
.HasDefaultValueSql("'R'");
entity.Property(e => e.PooledAsn)
.HasColumnName("pooled_asn")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.ValPrice)
.HasColumnName("val_price")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.UsePrice)
.HasColumnName("use_price")
.HasMaxLength(1)
.HasDefaultValueSql("'S'");
entity.Property(e => e.ValCredit)
.HasColumnName("val_credit")
.HasColumnType("tinyint")
.HasDefaultValueSql("1");
entity.Property(e => e.NoteProc)
.HasColumnName("note_proc")
.HasMaxLength(2)
.HasDefaultValueSql("'A'");
entity.Property(e => e.UseDate)
.HasColumnName("use_date")
.HasMaxLength(1)
.HasDefaultValueSql("'C'");
entity.Property(e => e.DateOffset)
.HasColumnName("date_offset")
.HasColumnType("int")
.HasDefaultValueSql("0")
.IsRequired(false);
entity.Property(e => e.InvCode)
.HasColumnName("inv_code")
.HasMaxLength(10)
.IsRequired(false);
entity.Property(e => e.AckCode)
.HasColumnName("ack_code")
.HasMaxLength(10)
.IsRequired(false);
entity.Property(e => e.AsnCode)
.HasColumnName("asn_code")
.HasMaxLength(10)
.IsRequired(false);
entity.Property(e => e.LastItemDate)
.HasColumnName("last_item_date")
.IsRequired(false);
entity.Property(e => e.LastCustaDate)
.HasColumnName("last_custa_date")
.IsRequired(false);
entity.Property(e => e.IncludeSerial)
.HasColumnName("include_serial")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.NoteExistsFlag)
.HasColumnName("NoteExistsFlag")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.RecordDate)
.HasColumnName("RecordDate")
.HasDefaultValueSql("getdate()");
entity.Property(e => e.RowPointer)
.HasColumnName("RowPointer")
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("newid()");
entity.Property(e => e.CreatedBy)
.HasColumnName("CreatedBy")
.HasMaxLength(60)
.HasDefaultValueSql("suser_sname()");
entity.Property(e => e.UpdatedBy)
.HasColumnName("UpdatedBy")
.HasMaxLength(60)
.HasDefaultValueSql("suser_sname()");
entity.Property(e => e.CreateDate)
.HasColumnName("CreateDate")
.HasDefaultValueSql("getdate()");
entity.Property(e => e.InWorkflow)
.HasColumnName("InWorkflow")
.HasColumnType("tinyint")
.HasDefaultValueSql("0");
entity.Property(e => e.Uf_FKR_EDI_RSSBussFolder)
.HasColumnName("uf_FKR_EDI_RSSBussFolder")
.HasMaxLength(100)
.IsRequired(false);
entity.Property(e => e.Uf_FKR_EDI_IdentificationCode)
.HasColumnName("uf_FKR_EDI_IdentificationCode")
.HasMaxLength(20)
.IsRequired(false);
// Index
entity.HasIndex(e => e.RowPointer)
.HasDatabaseName("IX_cust_tp_RowPointer")
.IsUnique();
});
} }
} }
} }