Mrp Bom, BomType, BomOperation, BomComponent

This commit is contained in:
Sedat ÖZTÜRK 2025-11-26 16:58:31 +03:00
parent e664ad4ccc
commit 6eb18fbdda
19 changed files with 1740 additions and 92 deletions

View file

@ -705,7 +705,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
Order=1, ColCount=2, ColSpan=1, Caption="General", ItemType="group", Items=
[
new() { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new() { Order = 2, DataField = "WorkCenterId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 2, DataField = "WorkcenterId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 3, DataField = "PlanType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 4, DataField = "Priority", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 5, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
@ -791,7 +791,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "WorkCenterId",
FieldName = "WorkcenterId",
Width = 150,
ListOrderNo = 3,
Visible = true,
@ -1329,7 +1329,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 2, DataField = "Title", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 4, DataField = "WorkCenterId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 4, DataField = "WorkcenterId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 5, DataField = "Location", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "FaultTypeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 7, DataField = "Priority", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
@ -1419,7 +1419,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "WorkCenterId",
FieldName = "WorkcenterId",
Width = 150,
ListOrderNo = 5,
Visible = true,

View file

@ -442,7 +442,7 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 4, DataField = "OperationTypeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 5, DataField = "WorkCenterId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 5, DataField = "WorkcenterId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 6, DataField = "StandardTime", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "SetupTime", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 8, DataField = "LaborCost", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
@ -554,7 +554,7 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "WorkCenterId",
FieldName = "WorkcenterId",
Width = 150,
ListOrderNo = 6,
Visible = true,

View file

@ -183,5 +183,9 @@ public enum TableNameEnum
PutawayCondition,
OperationCategory,
OperationType,
Operation
Operation,
BomType,
Bom,
BomOperation,
BomComponent
}

View file

@ -221,6 +221,10 @@ public static class TableNameResolver
{ nameof(TableNameEnum.OperationCategory), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.OperationType), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.Operation), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.BomType), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.Bom), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.BomOperation), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
{ nameof(TableNameEnum.BomComponent), (TablePrefix.TenantByName, MenuPrefix.Mrp) },
};
public static string GetFullTableName(string tableName)

View file

@ -11,7 +11,7 @@ public class Fault : FullAuditedEntity<Guid>, IMultiTenant
public string Code { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public Guid? WorkCenterId { get; set; }
public Guid? WorkcenterId { get; set; }
public Workcenter? WorkCenter { get; set; }
public string Location { get; set; }
public Guid? FaultTypeId { get; set; }

View file

@ -10,8 +10,8 @@ public class MaintenancePlan : FullAuditedEntity<Guid>, IMultiTenant
public Guid? TenantId { get; set; }
public string Code { get; set; }
public Guid? WorkCenterId { get; set; }
public Workcenter WorkCenter { get; set; }
public Guid? WorkcenterId { get; set; }
public Workcenter Workcenter { get; set; }
public string PlanType { get; set; }
public string Priority { get; set; }
public string Description { get; set; }

View file

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class Bom : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid? MaterialId { get; set; }
public Material? Material { get; set; }
public Guid? BomTypeId { get; set; }
public BomType? BomType { get; set; } // Production, Engineering, Planning, Costing
public string Code { get; set; }
public string Version { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime? ValidTo { get; set; }
public decimal BaseQuantity { get; set; }
public bool IsActive { get; set; }
public ICollection<BomComponent> Components { get; set; }
public ICollection<BomOperation> Operations { get; set; }
}

View file

@ -0,0 +1,31 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class BomComponent : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid? BomId { get; set; }
public Bom? Bom { get; set; }
public Guid? MaterialId { get; set; }
public Material? Material { get; set; }
public Guid? OperationId { get; set; }
public Operation? Operation { get; set; }
public decimal Quantity { get; set; }
public Guid? UomId { get; set; }
public Uom? Uom { get; set; }
public decimal ScrapPercentage { get; set; }
public bool IsPhantom { get; set; }
public int Position { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime? ValidTo { get; set; }
public bool IsActive { get; set; }
}

View file

@ -0,0 +1,33 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class BomOperation : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid? BomId { get; set; }
public Bom? Bom { get; set; }
public Guid? OperationId { get; set; }
public Operation? Operation { get; set; }
public Guid? WorkcenterId { get; set; }
public Workcenter? Workcenter { get; set; }
public int Sequence { get; set; }
public int SetupTime { get; set; }
public int RunTime { get; set; }
public int WaitTime { get; set; }
public int QueueTime { get; set; }
public int MoveTime { get; set; }
public bool IsActive { get; set; }
public bool IsParallel { get; set; }
public string PrerequisitesJson { get; set; }
public string QualityChecksJson { get; set; }
public string ToolsJson { get; set; }
public string SkillsJson { get; set; }
}

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class BomType : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
public ICollection<Bom> Boms { get; set; }
}

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
@ -15,8 +16,8 @@ public class Operation : FullAuditedEntity<Guid>, IMultiTenant
public Guid? OperationTypeId { get; set; }
public OperationType? OperationType { get; set; }
public Guid? WorkCenterId { get; set; }
public Workcenter? WorkCenter { get; set; }
public Guid? WorkcenterId { get; set; }
public Workcenter? Workcenter { get; set; }
public int StandardTime { get; set; }
public int SetupTime { get; set; }
@ -27,4 +28,6 @@ public class Operation : FullAuditedEntity<Guid>, IMultiTenant
public bool QualityCheckRequired { get; set; }
public bool IsActive { get; set; }
public ICollection<BomOperation> BomOperations { get; set; }
}

View file

@ -30,6 +30,7 @@ public class Material : FullAuditedEntity<Guid>, IMultiTenant
public List<Uom> AlternativeUoms { get; set; }
public List<MaterialSpecification> Specifications { get; set; }
public List<Partner> Suppliers { get; set; }
// public List<MmStockLevel> StockLevels { get; set; }
public List<Bom> Boms { get; set; }
public List<BomComponent> BomComponents { get; set; }
}

View file

@ -261,6 +261,10 @@ public class PlatformDbContext :
public DbSet<OperationCategory> OperationCategories { get; set; }
public DbSet<OperationType> OperationTypes { get; set; }
public DbSet<Operation> Operations { get; set; }
public DbSet<BomType> BomTypes { get; set; }
public DbSet<Bom> Boms { get; set; }
public DbSet<BomOperation> BomOperations { get; set; }
public DbSet<BomComponent> BomComponents { get; set; }
#endregion
public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
@ -2811,7 +2815,7 @@ public class PlatformDbContext :
b.ConfigureByConvention();
b.Property(x => x.Code).IsRequired().HasMaxLength(100);
b.Property(x => x.WorkCenterId).IsRequired();
b.Property(x => x.WorkcenterId).IsRequired();
b.Property(x => x.PlanType).IsRequired().HasMaxLength(50);
b.Property(x => x.Priority).HasMaxLength(50);
b.Property(x => x.Description).HasMaxLength(1000);
@ -2860,7 +2864,7 @@ public class PlatformDbContext :
b.ConfigureByConvention();
b.Property(x => x.Code).IsRequired().HasMaxLength(100);
b.Property(x => x.WorkCenterId).IsRequired().HasMaxLength(50);
b.Property(x => x.WorkcenterId).IsRequired().HasMaxLength(50);
b.Property(x => x.Location).HasMaxLength(250);
b.Property(x => x.FaultTypeId).IsRequired();
b.Property(x => x.Priority).HasMaxLength(50);
@ -3107,7 +3111,7 @@ public class PlatformDbContext :
b.Property(x => x.Name).IsRequired().HasMaxLength(200);
b.Property(x => x.Description).HasMaxLength(500);
b.Property(x => x.OperationTypeId).IsRequired();
b.Property(x => x.WorkCenterId).IsRequired();
b.Property(x => x.WorkcenterId).IsRequired();
b.Property(x => x.StandardTime).HasDefaultValue(0);
b.Property(x => x.SetupTime).HasDefaultValue(0);
b.Property(x => x.LaborCost).HasPrecision(18, 2).HasDefaultValue(0);
@ -3122,5 +3126,82 @@ public class PlatformDbContext :
.HasForeignKey(x => x.OperationTypeId)
.OnDelete(DeleteBehavior.Restrict);
});
builder.Entity<Bom>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Bom)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.MaterialId).IsRequired();
b.Property(x => x.BomTypeId).IsRequired();
b.Property(x => x.Code).IsRequired().HasMaxLength(100);
b.Property(x => x.Version).IsRequired().HasMaxLength(50);
b.Property(x => x.BaseQuantity).HasPrecision(18, 2).HasDefaultValue(1);
b.Property(x => x.IsActive).HasDefaultValue(true);
b.HasOne(x => x.Material)
.WithMany(x => x.Boms)
.HasForeignKey(x => x.MaterialId)
.OnDelete(DeleteBehavior.Restrict);
});
builder.Entity<BomComponent>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.BomComponent)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.BomId).IsRequired();
b.Property(x => x.MaterialId).IsRequired();
b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0);
b.Property(x => x.UomId).IsRequired();
b.Property(x => x.ScrapPercentage).HasPrecision(18, 2).HasDefaultValue(0);
b.Property(x => x.IsPhantom).HasDefaultValue(false);
b.Property(x => x.Position).HasDefaultValue(0);
b.Property(x => x.ValidFrom).IsRequired();
b.Property(x => x.IsActive).HasDefaultValue(true);
b.HasOne(x => x.Bom)
.WithMany(x => x.Components)
.HasForeignKey(x => x.BomId)
.OnDelete(DeleteBehavior.Restrict);
});
builder.Entity<BomOperation>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.BomOperation)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.BomId).IsRequired();
b.Property(x => x.OperationId).IsRequired();
b.Property(x => x.WorkcenterId).IsRequired(false);
b.Property(x => x.Sequence).IsRequired();
b.Property(x => x.SetupTime).HasDefaultValue(0);
b.Property(x => x.RunTime).HasDefaultValue(0);
b.Property(x => x.WaitTime).HasDefaultValue(0);
b.Property(x => x.QueueTime).HasDefaultValue(0);
b.Property(x => x.MoveTime).HasDefaultValue(0);
b.Property(x => x.IsActive).HasDefaultValue(true);
b.Property(x => x.IsParallel).HasDefaultValue(false);
b.HasOne(x => x.Bom)
.WithMany(x => x.Operations)
.HasForeignKey(x => x.BomId)
.OnDelete(DeleteBehavior.Restrict);
b.HasOne(x => x.Operation)
.WithMany(x => x.BomOperations)
.HasForeignKey(x => x.OperationId)
.OnDelete(DeleteBehavior.Restrict);
});
builder.Entity<BomType>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.BomType)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(50);
b.Property(x => x.Description).HasMaxLength(500);
b.Property(x => x.IsActive).HasDefaultValue(true);
});
}
}

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Erp.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
[Migration("20251126071128_Initial")]
[Migration("20251126135352_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -1510,6 +1510,351 @@ namespace Erp.Platform.Migrations
b.ToTable("Adm_T_BlogPost", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("BaseQuantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(1m);
b.Property<Guid>("BomTypeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime?>("ValidTo")
.HasColumnType("datetime2");
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.HasIndex("BomTypeId");
b.HasIndex("MaterialId");
b.ToTable("Mrp_T_Bom", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomComponent", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsPhantom")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("OperationId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Position")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<decimal>("Quantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<decimal>("ScrapPercentage")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("UomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime?>("ValidTo")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("BomId");
b.HasIndex("MaterialId");
b.HasIndex("OperationId");
b.HasIndex("UomId");
b.ToTable("Mrp_T_BomComponent", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomOperation", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsParallel")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<int>("MoveTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<Guid>("OperationId")
.HasColumnType("uniqueidentifier");
b.Property<string>("PrerequisitesJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("QualityChecksJson")
.HasColumnType("nvarchar(max)");
b.Property<int>("QueueTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<int>("RunTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<int>("Sequence")
.HasColumnType("int");
b.Property<int>("SetupTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("SkillsJson")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("ToolsJson")
.HasColumnType("nvarchar(max)");
b.Property<int>("WaitTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<Guid?>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("BomId");
b.HasIndex("OperationId");
b.HasIndex("WorkcenterId");
b.ToTable("Mrp_T_BomOperation", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomType", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("Mrp_T_BomType", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Branch", b =>
{
b.Property<Guid>("Id")
@ -4830,21 +5175,21 @@ namespace Erp.Platform.Migrations
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid>("WorkCenterId")
.HasMaxLength(50)
.HasColumnType("uniqueidentifier");
b.Property<Guid>("WorkOrderId")
.HasMaxLength(100)
.HasColumnType("uniqueidentifier");
b.Property<Guid>("WorkcenterId")
.HasMaxLength(50)
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("FaultStatusId");
b.HasIndex("FaultTypeId");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mnt_T_Fault", (string)null);
});
@ -6595,12 +6940,12 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("WorkCenterId")
b.Property<Guid>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mnt_T_Plan", (string)null);
});
@ -7828,10 +8173,11 @@ namespace Erp.Platform.Migrations
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<int>("LaborCost")
b.Property<decimal>("LaborCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
@ -7841,10 +8187,11 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<int>("MachineCost")
b.Property<decimal>("MachineCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<string>("Name")
.IsRequired()
@ -7854,10 +8201,11 @@ namespace Erp.Platform.Migrations
b.Property<Guid>("OperationTypeId")
.HasColumnType("uniqueidentifier");
b.Property<int>("OverheadCost")
b.Property<decimal>("OverheadCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<bool>("QualityCheckRequired")
.ValueGeneratedOnAdd()
@ -7878,14 +8226,14 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("WorkCenterId")
b.Property<Guid>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("OperationTypeId");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mrp_T_Operation", (string)null);
});
@ -15637,6 +15985,83 @@ namespace Erp.Platform.Migrations
b.Navigation("Employee");
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.HasOne("Erp.Platform.Entities.BomType", "BomType")
.WithMany("Boms")
.HasForeignKey("BomTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Material", "Material")
.WithMany("Boms")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("BomType");
b.Navigation("Material");
});
modelBuilder.Entity("Erp.Platform.Entities.BomComponent", b =>
{
b.HasOne("Erp.Platform.Entities.Bom", "Bom")
.WithMany("Components")
.HasForeignKey("BomId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Material", "Material")
.WithMany("BomComponents")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Operation", "Operation")
.WithMany()
.HasForeignKey("OperationId");
b.HasOne("Erp.Platform.Entities.Uom", "Uom")
.WithMany()
.HasForeignKey("UomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Bom");
b.Navigation("Material");
b.Navigation("Operation");
b.Navigation("Uom");
});
modelBuilder.Entity("Erp.Platform.Entities.BomOperation", b =>
{
b.HasOne("Erp.Platform.Entities.Bom", "Bom")
.WithMany("Operations")
.HasForeignKey("BomId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Operation", "Operation")
.WithMany("BomOperations")
.HasForeignKey("OperationId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany()
.HasForeignKey("WorkcenterId");
b.Navigation("Bom");
b.Navigation("Operation");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.BranchUsers", b =>
{
b.HasOne("Erp.Platform.Entities.Branch", "Branch")
@ -15982,7 +16407,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
.WithMany()
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -16113,13 +16538,13 @@ namespace Erp.Platform.Migrations
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany()
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WorkCenter");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
@ -16274,15 +16699,15 @@ namespace Erp.Platform.Migrations
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany("Operations")
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OperationType");
b.Navigation("WorkCenter");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.OperationType", b =>
@ -17102,6 +17527,18 @@ namespace Erp.Platform.Migrations
b.Navigation("Posts");
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.Navigation("Components");
b.Navigation("Operations");
});
modelBuilder.Entity("Erp.Platform.Entities.BomType", b =>
{
b.Navigation("Boms");
});
modelBuilder.Entity("Erp.Platform.Entities.Branch", b =>
{
b.Navigation("ClassTypes");
@ -17268,6 +17705,10 @@ namespace Erp.Platform.Migrations
{
b.Navigation("AlternativeUoms");
b.Navigation("BomComponents");
b.Navigation("Boms");
b.Navigation("Specifications");
b.Navigation("Suppliers");
@ -17287,6 +17728,11 @@ namespace Erp.Platform.Migrations
b.Navigation("Materials");
});
modelBuilder.Entity("Erp.Platform.Entities.Operation", b =>
{
b.Navigation("BomOperations");
});
modelBuilder.Entity("Erp.Platform.Entities.OperationCategory", b =>
{
b.Navigation("OperationTypes");

View file

@ -1435,6 +1435,28 @@ namespace Erp.Platform.Migrations
table.PrimaryKey("PK_Mnt_T_WorkorderType", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Mrp_T_BomType",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mrp_T_BomType", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Mrp_T_OperationCategory",
columns: table => new
@ -4787,6 +4809,45 @@ namespace Erp.Platform.Migrations
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Mrp_T_Bom",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MaterialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BomTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Version = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ValidFrom = table.Column<DateTime>(type: "datetime2", nullable: false),
ValidTo = table.Column<DateTime>(type: "datetime2", nullable: true),
BaseQuantity = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 1m),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mrp_T_Bom", x => x.Id);
table.ForeignKey(
name: "FK_Mrp_T_Bom_Mrp_T_BomType_BomTypeId",
column: x => x.BomTypeId,
principalTable: "Mrp_T_BomType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Mrp_T_Bom_Scp_T_Material_MaterialId",
column: x => x.MaterialId,
principalTable: "Scp_T_Material",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Scp_T_MaterialSpecification",
columns: table => new
@ -5258,7 +5319,7 @@ namespace Erp.Platform.Migrations
Code = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
WorkCenterId = table.Column<Guid>(type: "uniqueidentifier", maxLength: 50, nullable: false),
WorkcenterId = table.Column<Guid>(type: "uniqueidentifier", maxLength: 50, nullable: false),
Location = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
FaultTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
@ -5297,8 +5358,8 @@ namespace Erp.Platform.Migrations
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Mnt_T_Fault_Mnt_T_Workcenter_WorkCenterId",
column: x => x.WorkCenterId,
name: "FK_Mnt_T_Fault_Mnt_T_Workcenter_WorkcenterId",
column: x => x.WorkcenterId,
principalTable: "Mnt_T_Workcenter",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
@ -5311,7 +5372,7 @@ namespace Erp.Platform.Migrations
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
WorkCenterId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
WorkcenterId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PlanType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
@ -5335,8 +5396,8 @@ namespace Erp.Platform.Migrations
{
table.PrimaryKey("PK_Mnt_T_Plan", x => x.Id);
table.ForeignKey(
name: "FK_Mnt_T_Plan_Mnt_T_Workcenter_WorkCenterId",
column: x => x.WorkCenterId,
name: "FK_Mnt_T_Plan_Mnt_T_Workcenter_WorkcenterId",
column: x => x.WorkcenterId,
principalTable: "Mnt_T_Workcenter",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
@ -5388,12 +5449,12 @@ namespace Erp.Platform.Migrations
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
OperationTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
WorkCenterId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
WorkcenterId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StandardTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
SetupTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
LaborCost = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
MachineCost = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
OverheadCost = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
LaborCost = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
MachineCost = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
OverheadCost = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
Instructions = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
QualityCheckRequired = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
@ -5409,8 +5470,8 @@ namespace Erp.Platform.Migrations
{
table.PrimaryKey("PK_Mrp_T_Operation", x => x.Id);
table.ForeignKey(
name: "FK_Mrp_T_Operation_Mnt_T_Workcenter_WorkCenterId",
column: x => x.WorkCenterId,
name: "FK_Mrp_T_Operation_Mnt_T_Workcenter_WorkcenterId",
column: x => x.WorkcenterId,
principalTable: "Mnt_T_Workcenter",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
@ -6035,6 +6096,110 @@ namespace Erp.Platform.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Mrp_T_BomComponent",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
BomId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MaterialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OperationId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Quantity = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
UomId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ScrapPercentage = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
IsPhantom = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
Position = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
ValidFrom = table.Column<DateTime>(type: "datetime2", nullable: false),
ValidTo = table.Column<DateTime>(type: "datetime2", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mrp_T_BomComponent", x => x.Id);
table.ForeignKey(
name: "FK_Mrp_T_BomComponent_Adm_T_Uom_UomId",
column: x => x.UomId,
principalTable: "Adm_T_Uom",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Mrp_T_BomComponent_Mrp_T_Bom_BomId",
column: x => x.BomId,
principalTable: "Mrp_T_Bom",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Mrp_T_BomComponent_Mrp_T_Operation_OperationId",
column: x => x.OperationId,
principalTable: "Mrp_T_Operation",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Mrp_T_BomComponent_Scp_T_Material_MaterialId",
column: x => x.MaterialId,
principalTable: "Scp_T_Material",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Mrp_T_BomOperation",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
BomId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OperationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
WorkcenterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Sequence = table.Column<int>(type: "int", nullable: false),
SetupTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
RunTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
WaitTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
QueueTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
MoveTime = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
IsParallel = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PrerequisitesJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
QualityChecksJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
ToolsJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
SkillsJson = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mrp_T_BomOperation", x => x.Id);
table.ForeignKey(
name: "FK_Mrp_T_BomOperation_Mnt_T_Workcenter_WorkcenterId",
column: x => x.WorkcenterId,
principalTable: "Mnt_T_Workcenter",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Mrp_T_BomOperation_Mrp_T_Bom_BomId",
column: x => x.BomId,
principalTable: "Mrp_T_Bom",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Mrp_T_BomOperation_Mrp_T_Operation_OperationId",
column: x => x.OperationId,
principalTable: "Mrp_T_Operation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Hr_T_SurveyAnswer",
columns: table => new
@ -7139,14 +7304,14 @@ namespace Erp.Platform.Migrations
column: "FaultTypeId");
migrationBuilder.CreateIndex(
name: "IX_Mnt_T_Fault_WorkCenterId",
name: "IX_Mnt_T_Fault_WorkcenterId",
table: "Mnt_T_Fault",
column: "WorkCenterId");
column: "WorkcenterId");
migrationBuilder.CreateIndex(
name: "IX_Mnt_T_Plan_WorkCenterId",
name: "IX_Mnt_T_Plan_WorkcenterId",
table: "Mnt_T_Plan",
column: "WorkCenterId");
column: "WorkcenterId");
migrationBuilder.CreateIndex(
name: "IX_Mnt_T_PlanEmployee_MaintenancePlanId",
@ -7183,15 +7348,60 @@ namespace Erp.Platform.Migrations
table: "Mnt_T_WorkcenterSpecification",
column: "WorkcenterId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_Bom_BomTypeId",
table: "Mrp_T_Bom",
column: "BomTypeId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_Bom_MaterialId",
table: "Mrp_T_Bom",
column: "MaterialId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomComponent_BomId",
table: "Mrp_T_BomComponent",
column: "BomId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomComponent_MaterialId",
table: "Mrp_T_BomComponent",
column: "MaterialId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomComponent_OperationId",
table: "Mrp_T_BomComponent",
column: "OperationId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomComponent_UomId",
table: "Mrp_T_BomComponent",
column: "UomId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomOperation_BomId",
table: "Mrp_T_BomOperation",
column: "BomId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomOperation_OperationId",
table: "Mrp_T_BomOperation",
column: "OperationId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_BomOperation_WorkcenterId",
table: "Mrp_T_BomOperation",
column: "WorkcenterId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_Operation_OperationTypeId",
table: "Mrp_T_Operation",
column: "OperationTypeId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_Operation_WorkCenterId",
name: "IX_Mrp_T_Operation_WorkcenterId",
table: "Mrp_T_Operation",
column: "WorkCenterId");
column: "WorkcenterId");
migrationBuilder.CreateIndex(
name: "IX_Mrp_T_OperationType_CategoryId",
@ -7969,7 +8179,10 @@ namespace Erp.Platform.Migrations
name: "Mnt_T_WorkcenterSpecification");
migrationBuilder.DropTable(
name: "Mrp_T_Operation");
name: "Mrp_T_BomComponent");
migrationBuilder.DropTable(
name: "Mrp_T_BomOperation");
migrationBuilder.DropTable(
name: "Net_B_Meal");
@ -8197,7 +8410,10 @@ namespace Erp.Platform.Migrations
name: "Mnt_T_FaultType");
migrationBuilder.DropTable(
name: "Mrp_T_OperationType");
name: "Mrp_T_Bom");
migrationBuilder.DropTable(
name: "Mrp_T_Operation");
migrationBuilder.DropTable(
name: "Net_T_Training");
@ -8299,7 +8515,10 @@ namespace Erp.Platform.Migrations
name: "Mnt_T_WorkorderType");
migrationBuilder.DropTable(
name: "Mrp_T_OperationCategory");
name: "Mrp_T_BomType");
migrationBuilder.DropTable(
name: "Mrp_T_OperationType");
migrationBuilder.DropTable(
name: "Net_T_EventCategory");
@ -8343,6 +8562,9 @@ namespace Erp.Platform.Migrations
migrationBuilder.DropTable(
name: "Mnt_T_Workcenter");
migrationBuilder.DropTable(
name: "Mrp_T_OperationCategory");
migrationBuilder.DropTable(
name: "Sas_H_CountryGroup");

View file

@ -1507,6 +1507,351 @@ namespace Erp.Platform.Migrations
b.ToTable("Adm_T_BlogPost", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("BaseQuantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(1m);
b.Property<Guid>("BomTypeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime?>("ValidTo")
.HasColumnType("datetime2");
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.HasIndex("BomTypeId");
b.HasIndex("MaterialId");
b.ToTable("Mrp_T_Bom", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomComponent", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsPhantom")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("OperationId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Position")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<decimal>("Quantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<decimal>("ScrapPercentage")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("UomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime?>("ValidTo")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("BomId");
b.HasIndex("MaterialId");
b.HasIndex("OperationId");
b.HasIndex("UomId");
b.ToTable("Mrp_T_BomComponent", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomOperation", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BomId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsParallel")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<int>("MoveTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<Guid>("OperationId")
.HasColumnType("uniqueidentifier");
b.Property<string>("PrerequisitesJson")
.HasColumnType("nvarchar(max)");
b.Property<string>("QualityChecksJson")
.HasColumnType("nvarchar(max)");
b.Property<int>("QueueTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<int>("RunTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<int>("Sequence")
.HasColumnType("int");
b.Property<int>("SetupTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("SkillsJson")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("ToolsJson")
.HasColumnType("nvarchar(max)");
b.Property<int>("WaitTime")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<Guid?>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("BomId");
b.HasIndex("OperationId");
b.HasIndex("WorkcenterId");
b.ToTable("Mrp_T_BomOperation", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.BomType", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("Mrp_T_BomType", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Branch", b =>
{
b.Property<Guid>("Id")
@ -4827,21 +5172,21 @@ namespace Erp.Platform.Migrations
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid>("WorkCenterId")
.HasMaxLength(50)
.HasColumnType("uniqueidentifier");
b.Property<Guid>("WorkOrderId")
.HasMaxLength(100)
.HasColumnType("uniqueidentifier");
b.Property<Guid>("WorkcenterId")
.HasMaxLength(50)
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("FaultStatusId");
b.HasIndex("FaultTypeId");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mnt_T_Fault", (string)null);
});
@ -6592,12 +6937,12 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("WorkCenterId")
b.Property<Guid>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mnt_T_Plan", (string)null);
});
@ -7825,10 +8170,11 @@ namespace Erp.Platform.Migrations
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<int>("LaborCost")
b.Property<decimal>("LaborCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
@ -7838,10 +8184,11 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<int>("MachineCost")
b.Property<decimal>("MachineCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<string>("Name")
.IsRequired()
@ -7851,10 +8198,11 @@ namespace Erp.Platform.Migrations
b.Property<Guid>("OperationTypeId")
.HasColumnType("uniqueidentifier");
b.Property<int>("OverheadCost")
b.Property<decimal>("OverheadCost")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<bool>("QualityCheckRequired")
.ValueGeneratedOnAdd()
@ -7875,14 +8223,14 @@ namespace Erp.Platform.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<Guid>("WorkCenterId")
b.Property<Guid>("WorkcenterId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("OperationTypeId");
b.HasIndex("WorkCenterId");
b.HasIndex("WorkcenterId");
b.ToTable("Mrp_T_Operation", (string)null);
});
@ -15634,6 +15982,83 @@ namespace Erp.Platform.Migrations
b.Navigation("Employee");
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.HasOne("Erp.Platform.Entities.BomType", "BomType")
.WithMany("Boms")
.HasForeignKey("BomTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Material", "Material")
.WithMany("Boms")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("BomType");
b.Navigation("Material");
});
modelBuilder.Entity("Erp.Platform.Entities.BomComponent", b =>
{
b.HasOne("Erp.Platform.Entities.Bom", "Bom")
.WithMany("Components")
.HasForeignKey("BomId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Material", "Material")
.WithMany("BomComponents")
.HasForeignKey("MaterialId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Operation", "Operation")
.WithMany()
.HasForeignKey("OperationId");
b.HasOne("Erp.Platform.Entities.Uom", "Uom")
.WithMany()
.HasForeignKey("UomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Bom");
b.Navigation("Material");
b.Navigation("Operation");
b.Navigation("Uom");
});
modelBuilder.Entity("Erp.Platform.Entities.BomOperation", b =>
{
b.HasOne("Erp.Platform.Entities.Bom", "Bom")
.WithMany("Operations")
.HasForeignKey("BomId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Operation", "Operation")
.WithMany("BomOperations")
.HasForeignKey("OperationId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany()
.HasForeignKey("WorkcenterId");
b.Navigation("Bom");
b.Navigation("Operation");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.BranchUsers", b =>
{
b.HasOne("Erp.Platform.Entities.Branch", "Branch")
@ -15979,7 +16404,7 @@ namespace Erp.Platform.Migrations
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
.WithMany()
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -16110,13 +16535,13 @@ namespace Erp.Platform.Migrations
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany()
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WorkCenter");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
@ -16271,15 +16696,15 @@ namespace Erp.Platform.Migrations
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter")
b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter")
.WithMany("Operations")
.HasForeignKey("WorkCenterId")
.HasForeignKey("WorkcenterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OperationType");
b.Navigation("WorkCenter");
b.Navigation("Workcenter");
});
modelBuilder.Entity("Erp.Platform.Entities.OperationType", b =>
@ -17099,6 +17524,18 @@ namespace Erp.Platform.Migrations
b.Navigation("Posts");
});
modelBuilder.Entity("Erp.Platform.Entities.Bom", b =>
{
b.Navigation("Components");
b.Navigation("Operations");
});
modelBuilder.Entity("Erp.Platform.Entities.BomType", b =>
{
b.Navigation("Boms");
});
modelBuilder.Entity("Erp.Platform.Entities.Branch", b =>
{
b.Navigation("ClassTypes");
@ -17265,6 +17702,10 @@ namespace Erp.Platform.Migrations
{
b.Navigation("AlternativeUoms");
b.Navigation("BomComponents");
b.Navigation("Boms");
b.Navigation("Specifications");
b.Navigation("Suppliers");
@ -17284,6 +17725,11 @@ namespace Erp.Platform.Migrations
b.Navigation("Materials");
});
modelBuilder.Entity("Erp.Platform.Entities.Operation", b =>
{
b.Navigation("BomOperations");
});
modelBuilder.Entity("Erp.Platform.Entities.OperationCategory", b =>
{
b.Navigation("OperationTypes");

View file

@ -5636,5 +5636,175 @@
"instructions": "Teknik çizimlere göre boyutsal kontrol yapılacak",
"qualityCheckRequired": false
}
],
"BomTypes": [
{
"name": "Production",
"description": "Üretim için kullanılan malzeme listesi tipi",
"isActive": true
},
{
"name": "Engineering",
"description": "Mühendislik değişiklikleri için kullanılan malzeme listesi tipi",
"isActive": true
},
{
"name": "Planning",
"description": "Planlama amaçlı kullanılan malzeme listesi tipi",
"isActive": true
},
{
"name": "Costing",
"description": "Maliyet hesaplamaları için kullanılan malzeme listesi tipi",
"isActive": true
}
],
"Boms": [
{
"materialCode": "MT001",
"bomTypeName": "Production",
"code": "BOM-MOT-001",
"version": "1.0",
"validFrom": "2024-01-01T00:00:00.000Z",
"validTo": "2024-12-31T00:00:00.000Z",
"baseQuantity": 1,
"isActive": true
},
{
"materialCode": "MT002",
"bomTypeName": "Production",
"code": "BOM-GEAR-001",
"version": "2.1",
"validFrom": "2024-02-01T00:00:00.000Z",
"validTo": "2024-12-31T00:00:00.000Z",
"baseQuantity": 1,
"isActive": true
},
{
"materialCode": "PR001",
"bomTypeName": "Engineering",
"code": "BOM-PCB-001",
"version": "1.0",
"validFrom": "2024-03-01T00:00:00.000Z",
"baseQuantity": 1,
"isActive": true
}
],
"BomComponents": [
{
"bomCode": "BOM-MOT-001",
"materialCode": "MT001",
"operationCode": "OP001",
"quantity": 2,
"uomName": "Adet",
"scrapPercentage": 0.05,
"isPhantom": false,
"validFrom": "2024-01-01T00:00:00.000Z",
"position": 10,
"isActive": true
},
{
"bomCode": "BOM-MOT-001",
"materialCode": "MT002",
"operationCode": "OP001",
"quantity": 4,
"uomName": "Adet",
"scrapPercentage": 0.01,
"validFrom": "2024-01-01T00:00:00.000Z",
"isPhantom": false,
"position": 20,
"isActive": true
},
{
"bomCode": "BOM-GEAR-001",
"materialCode": "PR001",
"operationCode": "OP001",
"quantity": 1,
"uomName": "Adet",
"scrapPercentage": 0.01,
"isPhantom": false,
"validFrom": "2024-01-01T00:00:00.000Z",
"position": 30,
"isActive": true
},
{
"bomCode": "BOM-PCB-001",
"materialCode": "MT002",
"operationCode": "OP001",
"quantity": 1,
"uomName": "Adet",
"scrapPercentage": 0.01,
"isPhantom": false,
"validFrom": "2024-01-01T00:00:00.000Z",
"position": 40,
"isActive": true
}
],
"BomOperations": [
{
"bomCode": "BOM-MOT-001",
"operationCode": "OP001",
"workcenterCode": null,
"sequence": 10,
"setupTime": 30,
"runTime": 45,
"waitTime": 0,
"queueTime": 15,
"moveTime": 5,
"isActive": true,
"isParallel": false
},
{
"bomCode": "BOM-MOT-001",
"operationCode": "OP002",
"workcenterCode": null,
"sequence": 20,
"setupTime": 15,
"runTime": 60,
"waitTime": 0,
"queueTime": 10,
"moveTime": 5,
"isActive": true,
"isParallel": false
},
{
"bomCode": "BOM-MOT-001",
"operationCode": "OP002",
"workcenterCode": null,
"sequence": 30,
"setupTime": 5,
"runTime": 20,
"waitTime": 0,
"queueTime": 5,
"moveTime": 3,
"isActive": true,
"isParallel": false
},
{
"bomCode": "BOM-GEAR-001",
"operationCode": "OP003",
"workcenterCode": null,
"sequence": 30,
"setupTime": 5,
"runTime": 20,
"waitTime": 0,
"queueTime": 5,
"moveTime": 3,
"isActive": true,
"isParallel": false
},
{
"bomCode": "BOM-PCB-001",
"operationCode": "OP004",
"workcenterCode": null,
"sequence": 10,
"setupTime": 15,
"runTime": 30,
"waitTime": 0,
"queueTime": 20,
"moveTime": 3,
"isActive": true,
"isParallel": false
}
]
}

View file

@ -125,6 +125,10 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository<OperationCategory, Guid> _operationCategoryRepository;
private readonly IRepository<OperationType, Guid> _operationTypeRepository;
private readonly IRepository<Operation, Guid> _operationRepository;
private readonly IRepository<BomType, Guid> _bomTypeRepository;
private readonly IRepository<Bom, Guid> _bomRepository;
private readonly IRepository<BomComponent, Guid> _bomComponentRepository;
private readonly IRepository<BomOperation, Guid> _bomOperationRepository;
public TenantDataSeeder(
IClock clock,
@ -232,7 +236,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
IRepository<Putaway, Guid> putawayRepository,
IRepository<OperationCategory, Guid> operationCategoryRepository,
IRepository<OperationType, Guid> operationTypeRepository,
IRepository<Operation, Guid> operationRepository
IRepository<Operation, Guid> operationRepository,
IRepository<BomType, Guid> bomTypeRepository,
IRepository<Bom, Guid> bomRepository,
IRepository<BomComponent, Guid> bomComponentRepository,
IRepository<BomOperation, Guid> bomOperationRepository
)
{
_clock = clock;
@ -342,6 +350,10 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
_operationCategoryRepository = operationCategoryRepository;
_operationTypeRepository = operationTypeRepository;
_operationRepository = operationRepository;
_bomTypeRepository = bomTypeRepository;
_bomRepository = bomRepository;
_bomComponentRepository = bomComponentRepository;
_bomOperationRepository = bomOperationRepository;
}
private static IConfigurationRoot BuildConfiguration()
@ -2033,7 +2045,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
await _maintenancePlanRepository.InsertAsync(new MaintenancePlan
{
Code = item.Code,
WorkCenterId = workcenter?.Id,
WorkcenterId = workcenter?.Id,
PlanType = item.PlanType,
Priority = item.Priority,
Description = item.Description,
@ -2089,7 +2101,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
await _faultRepository.InsertAsync(new Fault
{
Code = item.Code,
WorkCenterId = workcenter?.Id,
WorkcenterId = workcenter?.Id,
Location = item.Location,
FaultTypeId = faultType?.Id,
Priority = item.Priority,
@ -2336,7 +2348,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
Name = item.Name,
Description = item.Description,
OperationTypeId = operationType?.Id,
WorkCenterId = workcenter?.Id,
WorkcenterId = workcenter?.Id,
StandardTime = item.StandardTime,
SetupTime = item.SetupTime,
LaborCost = item.LaborCost,
@ -2347,6 +2359,96 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
IsActive = item.IsActive
}, autoSave: true);
}
foreach (var item in items.BomTypes)
{
var exists = await _bomTypeRepository.AnyAsync(x => x.Name == item.Name);
if (exists)
continue;
await _bomTypeRepository.InsertAsync(new BomType
{
Name = item.Name,
Description = item.Description,
IsActive = item.IsActive
}, autoSave: true);
}
foreach (var item in items.Boms)
{
var exists = await _bomRepository.AnyAsync(x => x.Code == item.Code);
if (exists)
continue;
var material = await _materialRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialCode);
var bomType = await _bomTypeRepository.FirstOrDefaultAsync(x => x.Name == item.BomTypeName);
await _bomRepository.InsertAsync(new Bom
{
BomTypeId = bomType?.Id,
MaterialId = material?.Id,
Code = item.Code,
Version = item.Version,
ValidFrom = item.ValidFrom,
ValidTo = item.ValidTo,
BaseQuantity = item.BaseQuantity,
IsActive = item.IsActive,
}, autoSave: true);
}
foreach (var item in items.BomComponents)
{
var bom = await _bomRepository.FirstOrDefaultAsync(x => x.Code == item.BomCode);
var material = await _materialRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialCode);
var uom = await _uomRepository.FirstOrDefaultAsync(x => x.Name == item.UomName);
var operation = await _operationRepository.FirstOrDefaultAsync(x => x.Code == item.OperationCode);
var exists = await _bomComponentRepository.AnyAsync(x => x.BomId == bom.Id && x.MaterialId == material.Id);
if (exists)
continue;
await _bomComponentRepository.InsertAsync(new BomComponent
{
BomId = bom?.Id,
MaterialId = material?.Id,
OperationId = operation?.Id,
Quantity = item.Quantity,
UomId = uom?.Id,
ScrapPercentage = item.ScrapPercentage,
IsPhantom = item.IsPhantom,
Position = item.Position,
ValidFrom = item.ValidFrom,
ValidTo = item.ValidTo,
IsActive = item.IsActive
}, autoSave: true);
}
foreach (var item in items.BomOperations)
{
var bom = await _bomRepository.FirstOrDefaultAsync(x => x.Code == item.BomCode);
var operation = await _operationRepository.FirstOrDefaultAsync(x => x.Code == item.OperationCode);
var exists = await _bomOperationRepository.AnyAsync(x => x.BomId == bom.Id && x.OperationId == operation.Id);
if (exists)
continue;
var workcenter = await _workcenterRepository.FirstOrDefaultAsync(x => x.Code == item.WorkcenterCode);
await _bomOperationRepository.InsertAsync(new BomOperation
{
BomId = bom?.Id,
OperationId = operation?.Id,
WorkcenterId = workcenter?.Id,
Sequence = item.Sequence,
SetupTime = item.SetupTime,
RunTime = item.RunTime,
WaitTime = item.WaitTime,
QueueTime = item.QueueTime,
MoveTime = item.MoveTime,
IsActive = item.IsActive,
IsParallel = item.IsParallel
}, autoSave: true);
}
}
}

View file

@ -7,6 +7,7 @@ namespace Erp.Platform.Seeds;
public class TenantSeederDto
{
//Saas
public List<GlobalSearchSeedDto> GlobalSearch { get; set; }
public List<ForumCategorySeedDto> ForumCategories { get; set; }
public List<CustomEndpointSeedDto> CustomEndpoints { get; set; }
@ -119,6 +120,66 @@ public class TenantSeederDto
public List<OperationCategorySeedDto> OperationCategories { get; set; }
public List<OperationTypeSeedDto> OperationTypes { get; set; }
public List<OperationSeedDto> Operations { get; set; }
//Mrp
public List<BomTypeSeedDto> BomTypes { get; set; }
public List<BomSeedDto> Boms { get; set; }
public List<BomComponentSeedDto> BomComponents { get; set; }
public List<BomOperationSeedDto> BomOperations { get; set; }
}
public class BomOperationSeedDto
{
public string BomCode { get; set; }
public string OperationCode { get; set; }
public string? WorkcenterCode { get; set; }
public int Sequence { get; set; }
public int SetupTime { get; set; }
public int RunTime { get; set; }
public int WaitTime { get; set; }
public int QueueTime { get; set; }
public int MoveTime { get; set; }
public bool IsActive { get; set; }
public bool IsParallel { get; set; }
}
public class BomComponentSeedDto
{
public string BomCode { get; set; }
public string MaterialCode { get; set; }
public string OperationCode { get; set; }
public decimal Quantity { get; set; }
public string UomName { get; set; }
public decimal ScrapPercentage { get; set; }
public bool IsPhantom { get; set; }
public int Position { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime? ValidTo { get; set; }
public bool IsActive { get; set; }
}
public class BomSeedDto
{
public string MaterialCode { get; set; }
public string BomTypeName { get; set; }
public string Code { get; set; }
public string Version { get; set; }
public DateTime ValidFrom { get; set; }
public DateTime? ValidTo { get; set; }
public decimal BaseQuantity { get; set; }
public bool IsActive { get; set; }
}
public class BomTypeSeedDto
{
public string Name { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
}
public class OperationSeedDto