Seeder hataları düzeltildi.

This commit is contained in:
Sedat ÖZTÜRK 2025-12-12 16:52:59 +03:00
parent 77b040e528
commit e024ebeafd
15 changed files with 2439 additions and 2444 deletions

View file

@ -38,7 +38,7 @@ public class EmployeeDto : FullAuditedEntityDto<Guid>
public Guid? EmploymentTypeId { get; set; } public Guid? EmploymentTypeId { get; set; }
public EmploymentTypeDto EmploymentType { get; set; } public EmploymentTypeDto EmploymentType { get; set; }
public Guid? JobPositionId { get; set; } public string? JobPositionId { get; set; }
public JobPositionDto JobPosition { get; set; } public JobPositionDto JobPosition { get; set; }
public Guid? DepartmentId { get; set; } public Guid? DepartmentId { get; set; }

View file

@ -3,8 +3,9 @@ using Volo.Abp.Application.Dtos;
namespace Erp.Platform.Intranet; namespace Erp.Platform.Intranet;
public class EmploymentTypeDto : FullAuditedEntityDto<Guid> public class EmploymentTypeDto : FullAuditedEntityDto<string>
{ {
public Guid? TenantId { get; set; } public Guid? TenantId { get; set; }
public string Name { get; set; } public string Name { get; set; }
} }

View file

@ -12,17 +12,14 @@ public class ExpenseDto : FullAuditedEntityDto<Guid>
public string Category { get; set; } public string Category { get; set; }
public decimal Amount { get; set; } public decimal Amount { get; set; }
public string Currency { get; set; } public string Currency { get; set; }
public DateTime RequestDate { get; set; } public DateTime RequestDate { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Project { get; set; } public string Project { get; set; }
public string Status { get; set; } public string Status { get; set; }
public Guid? ApproverId { get; set; } public Guid? ApproverId { get; set; }
public EmployeeDto Approver { get; set; } public EmployeeDto Approver { get; set; }
public DateTime? ApprovalDate { get; set; } public DateTime? ApprovalDate { get; set; }
public string RejectionReason { get; set; } public string RejectionReason { get; set; }
public string Notes { get; set; } public string Notes { get; set; }

View file

@ -3,7 +3,7 @@ using Volo.Abp.Application.Dtos;
namespace Erp.Platform.Intranet; namespace Erp.Platform.Intranet;
public class JobPositionDto : FullAuditedEntityDto<Guid> public class JobPositionDto : FullAuditedEntityDto<string>
{ {
public Guid? TenantId { get; set; } public Guid? TenantId { get; set; }

View file

@ -118,7 +118,7 @@ public static class LookupQueryValues
public static string CountryValues = public static string CountryValues =
$"SELECT " + $"SELECT " +
$"\"Code\" AS \"Key\", " + $"\"Id\" AS \"Key\", " +
$"\"Name\" AS \"Name\" " + $"\"Name\" AS \"Name\" " +
$"FROM \"{FullNameTable(TableNameEnum.Country)}\" " + $"FROM \"{FullNameTable(TableNameEnum.Country)}\" " +
$"WHERE \"IsDeleted\" = 'false' " + $"WHERE \"IsDeleted\" = 'false' " +
@ -126,7 +126,7 @@ public static class LookupQueryValues
public static string CityValues = public static string CityValues =
$"SELECT " + $"SELECT " +
$"\"Code\" AS \"Key\", " + $"\"Name\" AS \"Key\", " +
$"\"Name\" AS \"Name\" " + $"\"Name\" AS \"Name\" " +
$"FROM \"{FullNameTable(TableNameEnum.City)}\" " + $"FROM \"{FullNameTable(TableNameEnum.City)}\" " +
$"WHERE " + $"WHERE " +

View file

@ -5,7 +5,6 @@ namespace Erp.Platform.Public;
public class CityDto : AuditedEntityDto<Guid> public class CityDto : AuditedEntityDto<Guid>
{ {
public string Code { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string PlateCode { get; set; } public string PlateCode { get; set; }
public string Country { get; set; } public string Country { get; set; }

View file

@ -6,7 +6,6 @@ namespace Erp.Platform.Public;
public class CountryDto : AuditedEntityDto<Guid> public class CountryDto : AuditedEntityDto<Guid>
{ {
public string Code { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string GroupName { get; set; } public string GroupName { get; set; }
public string Currency { get; set; } public string Currency { get; set; }

File diff suppressed because it is too large Load diff

View file

@ -282,14 +282,14 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<CountryDto>(fs, options)) await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<CountryDto>(fs, options))
{ {
if (item == null) continue; if (item == null) continue;
if (string.IsNullOrWhiteSpace(item.Code)) continue; // boş kodları atla if (string.IsNullOrWhiteSpace(item.Name)) continue; // boş kodları atla
// hem DB’de hem JSON içinde duplicate engelle // hem DB’de hem JSON içinde duplicate engelle
if (!seenCodes.Add(item.Code) || existingCodes.Contains(item.Code)) if (!seenCodes.Add(item.Name) || existingCodes.Contains(item.Name))
continue; continue;
buffer.Add(new Country( buffer.Add(new Country(
item.Code, item.Name,
item.Name, item.Name,
item.GroupName, item.GroupName,
item.Currency, item.Currency,
@ -325,11 +325,11 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
// 1. Mevcut kayıtları çek (tek sorguda) // 1. Mevcut kayıtları çek (tek sorguda)
var existingCities = await dbCtx.Set<City>() var existingCities = await dbCtx.Set<City>()
.Select(d => new { d.Name }) .Select(d => new { d.Country, d.Name })
.ToListAsync(); .ToListAsync();
var existingSet = existingCities var existingSet = existingCities
.Select(d => d.Name) .Select(d => $"{d.Country}.{d.Name}")
.ToHashSet(); .ToHashSet();
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
@ -405,14 +405,13 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
{ {
if (item == null) continue; if (item == null) continue;
var key = $"{item.Country}:{item.Country}.{item.City}:{item.Name}:{item.Township}"; var key = $"{item.Country}:{item.City}:{item.Name}:{item.Township}";
var city = $"{item.Country}.{item.City}";
if (existingSet.Contains(key)) continue; if (existingSet.Contains(key)) continue;
buffer.Add(new District( buffer.Add(new District(
Guid.NewGuid(), Guid.NewGuid(),
item.Country, item.Country,
city, item.City,
item.Name, item.Name,
item.Township item.Township
)); ));

View file

@ -557,12 +557,12 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
ColumnOptionJson = DefaultColumnOptionJson, ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(listFormName), PermissionJson = DefaultPermissionJson(listFormName),
PagerOptionJson = DefaultPagerOptionJson, PagerOptionJson = DefaultPagerOptionJson,
EditingOptionJson = DefaultEditingOptionJson(listFormName, 800, 650, true, true, true, true, false), EditingOptionJson = DefaultEditingOptionJson(listFormName, 800, 500, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
{ {
new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =
[ [
new EditingFormItemDto { Order=1, DataField = "TenantId", ColSpan=1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, new EditingFormItemDto { Order=1, DataField = "TenantId", ColSpan=2, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order=2, DataField = "Code", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=2, DataField = "Code", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=3, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=3, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, new EditingFormItemDto { Order=4, DataField = "VknTckn", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxNumberBox },
@ -573,17 +573,17 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, new EditingFormItemDto { Order=9, DataField = "IsActive", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxCheckBox },
] ]
}, },
new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = new() { Order=2, ColCount=2, ColSpan=1, ItemType="group", Items =
[ [
new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order=2, DataField = "City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, new EditingFormItemDto { Order=2, DataField = "City", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order=3, DataField = "District", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, new EditingFormItemDto { Order=3, DataField = "District", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order=4, DataField = "Township", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, new EditingFormItemDto { Order=4, DataField = "Township", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
new EditingFormItemDto { Order=5, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=5, DataField = "Address1", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextArea },
new EditingFormItemDto { Order=6, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=6, DataField = "Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextArea },
new EditingFormItemDto { Order=7, DataField = "PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=7, DataField = "Email", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=8, DataField = "Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=8, DataField = "Website", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=9, DataField = "Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order=9, DataField = "PostalCode", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
] ]
} }
}), }),

View file

@ -948,7 +948,7 @@ public class PlatformDbContext :
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country)), Prefix.DbSchema); b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Country)), Prefix.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Id).HasMaxLength(8); b.Property(x => x.Id).HasMaxLength(128);
b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128);
b.Property(x => x.GroupName).HasMaxLength(128); b.Property(x => x.GroupName).HasMaxLength(128);
b.Property(x => x.TaxLabel).HasMaxLength(64); b.Property(x => x.TaxLabel).HasMaxLength(64);

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Erp.Platform.Migrations namespace Erp.Platform.Migrations
{ {
[DbContext(typeof(PlatformDbContext))] [DbContext(typeof(PlatformDbContext))]
[Migration("20251212092917_Initial")] [Migration("20251212132226_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -2453,7 +2453,7 @@ namespace Erp.Platform.Migrations
.HasColumnType("nvarchar(128)"); .HasColumnType("nvarchar(128)");
b.Property<string>("CountryId") b.Property<string>("CountryId")
.HasColumnType("nvarchar(8)"); .HasColumnType("nvarchar(128)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
@ -3376,8 +3376,8 @@ namespace Erp.Platform.Migrations
modelBuilder.Entity("Erp.Platform.Entities.Country", b => modelBuilder.Entity("Erp.Platform.Entities.Country", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasMaxLength(8) .HasMaxLength(128)
.HasColumnType("nvarchar(8)"); .HasColumnType("nvarchar(128)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")

View file

@ -4039,7 +4039,7 @@ namespace Erp.Platform.Migrations
name: "Sas_H_Country", name: "Sas_H_Country",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false), Id = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true), GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Currency = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false), Currency = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false),
@ -4678,7 +4678,7 @@ namespace Erp.Platform.Migrations
Country = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true), Country = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
PlateCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true), PlateCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
CountryId = table.Column<string>(type: "nvarchar(8)", nullable: true), CountryId = table.Column<string>(type: "nvarchar(128)", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),

View file

@ -2450,7 +2450,7 @@ namespace Erp.Platform.Migrations
.HasColumnType("nvarchar(128)"); .HasColumnType("nvarchar(128)");
b.Property<string>("CountryId") b.Property<string>("CountryId")
.HasColumnType("nvarchar(8)"); .HasColumnType("nvarchar(128)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
@ -3373,8 +3373,8 @@ namespace Erp.Platform.Migrations
modelBuilder.Entity("Erp.Platform.Entities.Country", b => modelBuilder.Entity("Erp.Platform.Entities.Country", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasMaxLength(8) .HasMaxLength(128)
.HasColumnType("nvarchar(8)"); .HasColumnType("nvarchar(128)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")

View file

@ -2696,7 +2696,7 @@
"name": "İnsan Kaynakları", "name": "İnsan Kaynakları",
"description": "İnsan kaynakları departmanı masrafları", "description": "İnsan kaynakları departmanı masrafları",
"costCenterType": "Support", "costCenterType": "Support",
"parentCostCenterName": null, "parentCostCenterName": "Genel Yönetim",
"responsibleEmployeeCode": "EMP-001", "responsibleEmployeeCode": "EMP-001",
"departmentName": "İdari İşler", "departmentName": "İdari İşler",
"budgetedAmount": 1800000, "budgetedAmount": 1800000,
@ -2826,7 +2826,7 @@
"name": "Müşteri Hizmetleri", "name": "Müşteri Hizmetleri",
"description": "Müşteri hizmetleri masrafları", "description": "Müşteri hizmetleri masrafları",
"costCenterType": "Service", "costCenterType": "Service",
"parentCostCenterName": null, "parentCostCenterName": "Genel Yönetim",
"responsibleEmployeeCode": "EMP-003", "responsibleEmployeeCode": "EMP-003",
"departmentName": "İdari İşler", "departmentName": "İdari İşler",
"budgetedAmount": 1000000, "budgetedAmount": 1000000,
@ -4871,7 +4871,7 @@
"faultTypeName": "Mekanik", "faultTypeName": "Mekanik",
"priority": "High", "priority": "High",
"severity": "High", "severity": "High",
"title": "Motor Aşırı Titreşim", "name": "Motor Aşırı Titreşim",
"description": "CNC torna tezgahında motor aşırı titreşim yapıyor. Ses seviyesi normalden yüksek ve hassas işlemlerde problem yaşanıyor.", "description": "CNC torna tezgahında motor aşırı titreşim yapıyor. Ses seviyesi normalden yüksek ve hassas işlemlerde problem yaşanıyor.",
"assignedTo": "Mehmet Kaya - Mekanik Ekibi", "assignedTo": "Mehmet Kaya - Mekanik Ekibi",
"status": "Açık", "status": "Açık",
@ -4885,7 +4885,7 @@
"faultTypeName": "Elektrik", "faultTypeName": "Elektrik",
"priority": "Urgent", "priority": "Urgent",
"severity": "Critical", "severity": "Critical",
"title": "Elektrik Panosu Arızası", "name": "Elektrik Panosu Arızası",
"description": "Kompresör elektrik panosunda kısa devre meydana geldi. Sistem tamamen durdu.", "description": "Kompresör elektrik panosunda kısa devre meydana geldi. Sistem tamamen durdu.",
"assignedTo": "Ahmet Yılmaz - Elektrik Ekibi", "assignedTo": "Ahmet Yılmaz - Elektrik Ekibi",
"status": "Kapandı", "status": "Kapandı",
@ -4901,7 +4901,7 @@
"faultTypeName": "Performans", "faultTypeName": "Performans",
"priority": "Normal", "priority": "Normal",
"severity": "Medium", "severity": "Medium",
"title": "Kayış Gerilimi Azaldı", "name": "Kayış Gerilimi Azaldı",
"description": "Konveyör kayışında gevşeme tespit edildi. Hız düşüklüğü gözlemleniyor.", "description": "Konveyör kayışında gevşeme tespit edildi. Hız düşüklüğü gözlemleniyor.",
"status": "Onarımda", "status": "Onarımda",
"estimatedRepairTime": 60, "estimatedRepairTime": 60,
@ -4914,7 +4914,7 @@
"faultTypeName": "Yazılım", "faultTypeName": "Yazılım",
"priority": "High", "priority": "High",
"severity": "High", "severity": "High",
"title": "Program Kalibrasyon Hatası", "name": "Program Kalibrasyon Hatası",
"description": "Robot kaynak pozisyonlarında sapma var. Kalibrasyon gerekiyor.", "description": "Robot kaynak pozisyonlarında sapma var. Kalibrasyon gerekiyor.",
"assignedTo": "Sema Korkmaz - Robot Teknisyeni", "assignedTo": "Sema Korkmaz - Robot Teknisyeni",
"status": "İnceleniyor", "status": "İnceleniyor",
@ -4928,7 +4928,7 @@
"faultTypeName": "Hidrolik", "faultTypeName": "Hidrolik",
"priority": "Low", "priority": "Low",
"severity": "Low", "severity": "Low",
"title": "Yağ Sızıntısı", "name": "Yağ Sızıntısı",
"description": "Hidrolik sistem borularında hafif yağ sızıntısı tespit edildi.", "description": "Hidrolik sistem borularında hafif yağ sızıntısı tespit edildi.",
"status": "Açık", "status": "Açık",
"estimatedRepairTime": 45, "estimatedRepairTime": 45,