* Added MaterialTransaction entity, dto and service
This commit is contained in:
41
SytelineSaAppEfDataModel/Dtos/MaterialTransactionDto.cs
Normal file
41
SytelineSaAppEfDataModel/Dtos/MaterialTransactionDto.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
namespace SytelineSaAppEfDataModel.Dtos;
|
||||||
|
|
||||||
|
public class MaterialTransactionDto
|
||||||
|
{
|
||||||
|
public string MTGroup { get; set; }
|
||||||
|
public string MTGroupNum { get; set; }
|
||||||
|
public long TransNum { get; set; }
|
||||||
|
public string Item { get; set; }
|
||||||
|
public DateTime? TransDate { get; set; }
|
||||||
|
public decimal? Qty { get; set; }
|
||||||
|
public decimal? Cost { get; set; }
|
||||||
|
public string Whse { get; set; }
|
||||||
|
public string Loc { get; set; }
|
||||||
|
public string RefNum { get; set; }
|
||||||
|
public short? RefLineSuf { get; set; }
|
||||||
|
public short? RefRelease { get; set; }
|
||||||
|
public string ReasonCode { get; set; }
|
||||||
|
public string TransType { get; set; }
|
||||||
|
public string RefType { get; set; }
|
||||||
|
public string MTReasonType { get; set; }
|
||||||
|
public string PrefixId { get; set; }
|
||||||
|
public string SequenceId { get; set; }
|
||||||
|
public string WhseSequenceId { get; set; }
|
||||||
|
public bool WhseSplit { get; set; }
|
||||||
|
public Guid? VariableId { get; set; }
|
||||||
|
public string FormName { get; set; }
|
||||||
|
public bool InWorkflow { 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 string CustNum { get; set; }
|
||||||
|
public string VendNum { get; set; }
|
||||||
|
public int? RecipNum { get; set; }
|
||||||
|
public string Uf_FKR_internal_num_matltran_zn { get; set; }
|
||||||
|
public Guid? Session_Id { get; set; }
|
||||||
|
public string Uf_MobileAppUser { get; set; }
|
||||||
|
public string NR_KARTY_KONTROLNEJ { get; set; }
|
||||||
|
}
|
||||||
41
SytelineSaAppEfDataModel/Entities/MaterialTransaction.cs
Normal file
41
SytelineSaAppEfDataModel/Entities/MaterialTransaction.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
namespace SytelineSaAppEfDataModel.Entities;
|
||||||
|
|
||||||
|
public class MaterialTransaction
|
||||||
|
{
|
||||||
|
public string MTGroup { get; set; }
|
||||||
|
public string MTGroupNum { get; set; }
|
||||||
|
public long TransNum { get; set; }
|
||||||
|
public string Item { get; set; }
|
||||||
|
public DateTime? TransDate { get; set; }
|
||||||
|
public decimal? Qty { get; set; }
|
||||||
|
public decimal? Cost { get; set; }
|
||||||
|
public string Whse { get; set; }
|
||||||
|
public string Loc { get; set; }
|
||||||
|
public string RefNum { get; set; }
|
||||||
|
public short? RefLineSuf { get; set; }
|
||||||
|
public short? RefRelease { get; set; }
|
||||||
|
public string ReasonCode { get; set; }
|
||||||
|
public string TransType { get; set; }
|
||||||
|
public string RefType { get; set; }
|
||||||
|
public string MTReasonType { get; set; }
|
||||||
|
public string PrefixId { get; set; }
|
||||||
|
public string SequenceId { get; set; }
|
||||||
|
public string WhseSequenceId { get; set; }
|
||||||
|
public bool WhseSplit { get; set; }
|
||||||
|
public Guid? VariableId { get; set; }
|
||||||
|
public string FormName { get; set; }
|
||||||
|
public bool InWorkflow { 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 string CustNum { get; set; }
|
||||||
|
public string VendNum { get; set; }
|
||||||
|
public int? RecipNum { get; set; }
|
||||||
|
public string Uf_FKR_internal_num_matltran_zn { get; set; }
|
||||||
|
public Guid? Session_Id { get; set; }
|
||||||
|
public string Uf_MobileAppUser { get; set; }
|
||||||
|
public string NR_KARTY_KONTROLNEJ { get; set; }
|
||||||
|
}
|
||||||
@@ -1,9 +1,4 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SytelineSaAppEfDataModel.Dtos;
|
using SytelineSaAppEfDataModel.Dtos;
|
||||||
using SytelineSaAppEfDataModel.Entities;
|
using SytelineSaAppEfDataModel.Entities;
|
||||||
|
|
||||||
@@ -24,6 +19,7 @@ namespace SytelineSaAppEfDataModel
|
|||||||
CreateMap<CustomerOrderLineItem, CustomerOrderLineItemDto>().ReverseMap();
|
CreateMap<CustomerOrderLineItem, CustomerOrderLineItemDto>().ReverseMap();
|
||||||
CreateMap<UserName, UserNameDto>().ReverseMap();
|
CreateMap<UserName, UserNameDto>().ReverseMap();
|
||||||
CreateMap<EdiUser, EdiUserDto>().ReverseMap();
|
CreateMap<EdiUser, EdiUserDto>().ReverseMap();
|
||||||
|
CreateMap<MaterialTransaction, MaterialTransactionDto>().ReverseMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using SytelineSaAppEfDataModel.Dtos;
|
||||||
|
|
||||||
|
namespace SytelineSaAppEfDataModel.Services;
|
||||||
|
|
||||||
|
public interface IMaterialTransactionService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<MaterialTransactionDto>> GetAll();
|
||||||
|
Task<MaterialTransactionDto?> GetByWzNumber(string wzNumber);
|
||||||
|
Task<IEnumerable<MaterialTransactionDto?>> GetByOrderNumber(string orderNumber);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SytelineSaAppEfDataModel.Dtos;
|
||||||
|
|
||||||
|
namespace SytelineSaAppEfDataModel.Services;
|
||||||
|
|
||||||
|
public class MaterialTransactionService(SytelineSaAppDbContext context, IMapper mapper) : IMaterialTransactionService
|
||||||
|
{
|
||||||
|
public async Task<IEnumerable<MaterialTransactionDto>> GetAll()
|
||||||
|
{
|
||||||
|
return await context.MaterialTransactions.Select(x => mapper.Map<MaterialTransactionDto>(x)).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<MaterialTransactionDto?> GetByWzNumber(string wzNumber)
|
||||||
|
{
|
||||||
|
return await context.MaterialTransactions
|
||||||
|
.Where(x => x.MTGroupNum == wzNumber)
|
||||||
|
.Select(x => mapper.Map<MaterialTransactionDto>(x)).FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<MaterialTransactionDto?>> GetByOrderNumber(string orderNumber)
|
||||||
|
{
|
||||||
|
return await context.MaterialTransactions.Where(x => x.RefNum == orderNumber)
|
||||||
|
.Select(x => mapper.Map<MaterialTransactionDto>(x)).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,8 @@ 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; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@@ -694,6 +696,184 @@ namespace SytelineSaAppEfDataModel
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Login).IsUnique();
|
entity.HasIndex(e => e.Login).IsUnique();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<MaterialTransaction>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("ZPL_InternalNum_Matltran");
|
||||||
|
|
||||||
|
entity.HasKey(e => e.TransNum);
|
||||||
|
|
||||||
|
entity.Property(e => e.MTGroup)
|
||||||
|
.HasColumnName("MTGroup")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.MTGroupNum)
|
||||||
|
.HasColumnName("MTGroupNum")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
entity.Property(e => e.TransNum)
|
||||||
|
.HasColumnName("trans_num")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
entity.Property(e => e.Item)
|
||||||
|
.HasColumnName("item")
|
||||||
|
.HasMaxLength(60)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.TransDate)
|
||||||
|
.HasColumnName("trans_date")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Qty)
|
||||||
|
.HasColumnName("qty")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Cost)
|
||||||
|
.HasColumnName("cost")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Whse)
|
||||||
|
.HasColumnName("whse")
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Loc)
|
||||||
|
.HasColumnName("loc")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.RefNum)
|
||||||
|
.HasColumnName("ref_num")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.RefLineSuf)
|
||||||
|
.HasColumnName("ref_line_suf")
|
||||||
|
.HasColumnType("smallint")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.RefRelease)
|
||||||
|
.HasColumnName("ref_release")
|
||||||
|
.HasColumnType("smallint")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.ReasonCode)
|
||||||
|
.HasColumnName("reason_code")
|
||||||
|
.HasMaxLength(6)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.TransType)
|
||||||
|
.HasColumnName("trans_type")
|
||||||
|
.HasMaxLength(2)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.RefType)
|
||||||
|
.HasColumnName("ref_type")
|
||||||
|
.HasMaxLength(2)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.MTReasonType)
|
||||||
|
.HasColumnName("MTReasonType")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.PrefixId)
|
||||||
|
.HasColumnName("PrefixId")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.SequenceId)
|
||||||
|
.HasColumnName("SequenceId")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.WhseSequenceId)
|
||||||
|
.HasColumnName("WhseSequenceId")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.WhseSplit)
|
||||||
|
.HasColumnName("WhseSplit")
|
||||||
|
.HasColumnType("tinyint");
|
||||||
|
|
||||||
|
entity.Property(e => e.VariableId)
|
||||||
|
.HasColumnName("VariableId")
|
||||||
|
.HasColumnType("uniqueidentifier")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.FormName)
|
||||||
|
.HasColumnName("FormName")
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.InWorkflow)
|
||||||
|
.HasColumnName("InWorkflow")
|
||||||
|
.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.CustNum)
|
||||||
|
.HasColumnName("CustNum")
|
||||||
|
.HasMaxLength(14)
|
||||||
|
.HasDefaultValueSql("NULL");
|
||||||
|
|
||||||
|
entity.Property(e => e.VendNum)
|
||||||
|
.HasColumnName("VendNum")
|
||||||
|
.HasMaxLength(14)
|
||||||
|
.HasDefaultValueSql("NULL");
|
||||||
|
|
||||||
|
entity.Property(e => e.RecipNum)
|
||||||
|
.HasColumnName("RecipNum")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Uf_FKR_internal_num_matltran_zn)
|
||||||
|
.HasColumnName("Uf_FKR_internal_num_matltran_zn")
|
||||||
|
.HasMaxLength(2)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Session_Id)
|
||||||
|
.HasColumnName("Session_Id")
|
||||||
|
.HasColumnType("uniqueidentifier")
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.Uf_MobileAppUser)
|
||||||
|
.HasColumnName("Uf_MobileAppUser")
|
||||||
|
.HasMaxLength(15)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
entity.Property(e => e.NR_KARTY_KONTROLNEJ)
|
||||||
|
.HasColumnName("NR_KARTY_KONTROLNEJ")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user