From 279d285f76f34ec83b14ce2520cf911128d76073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Thu, 20 Nov 2025 23:30:49 +0300 Subject: [PATCH] Maintenance Plan, Employee, Material --- .../LookUpQueryValues.cs | 8 + .../Seeds/LanguagesData.json | 12 + .../Seeds/ListFormSeeder_Maintenance.cs | 98 +++++--- .../Seeds/PermissionsData.json | 126 ++++++++++ .../Enums/TableNameEnum.cs | 6 +- .../TableNameResolver.cs | 6 +- .../BackgroundWorkers/NotificationWorker.cs | 16 +- .../Tenant/Maintenance/MaintenancePlan.cs | 3 +- .../EntityFrameworkCore/PlatformDbContext.cs | 8 +- ....cs => 20251120201509_Initial.Designer.cs} | 27 ++- ...9_Initial.cs => 20251120201509_Initial.cs} | 219 +++++++++--------- .../PlatformDbContextModelSnapshot.cs | 25 +- .../Tenants/Seeds/TenantData.json | 93 ++++++++ .../Tenants/TenantDataSeeder.cs | 31 ++- .../Tenants/TenantSeederDto.cs | 18 ++ ui/safelist.txt | 4 + .../assets/styles/components/_menu-item.css | 2 +- .../components/layouts/AuthLayout/Simple.tsx | 4 +- ui/tailwind.config.ts | 3 + 19 files changed, 541 insertions(+), 168 deletions(-) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251120142319_Initial.Designer.cs => 20251120201509_Initial.Designer.cs} (99%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251120142319_Initial.cs => 20251120201509_Initial.cs} (99%) diff --git a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs index 7255cb42..dec29322 100644 --- a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs +++ b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs @@ -27,6 +27,14 @@ public static class LookupQueryValues $"ORDER BY \"{DisplayExpr}\";" }); + public static string TechnicalSkillsValues = + $"SELECT " + + $"\"Name\" AS \"Key\", " + + $"\"Name\" AS \"Name\" " + + $"FROM \"{FullNameTable(TableNameEnum.Skill)}\" " + + $"WHERE \"SkillTypeId\" IN (SELECT \"Id\" FROM \"{FullNameTable(TableNameEnum.SkillType)}\" WHERE \"Name\"='Technical Skills' ) " + + $"ORDER BY \"Name\""; + public static string CustomerValues = $"SELECT " + $"\"Id\" AS \"Key\", " + diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index 09935111..48e0c7e0 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9432,6 +9432,18 @@ "tr": "Bakım Planları", "en": "Maintenance Plans" }, + { + "resourceName": "Platform", + "key": "App.Maintenance.PlanEmployee", + "tr": "Bakım Planı Personelleri", + "en": "Maintenance Plan Employees" + }, + { + "resourceName": "Platform", + "key": "App.Maintenance.PlanMaterial", + "tr": "Bakım Planı Malzemeleri", + "en": "Maintenance Plan Materials" + }, { "resourceName": "Platform", "key": "App.Maintenance.Calendar", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs index 7c43c38d..2e41bbb6 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs @@ -714,7 +714,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend IsOrganizationUnit = false, Description = AppCodes.Maintenance.Plan, SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlan)), + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Plan)), KeyFieldName = "Id", KeyFieldDbSourceType = DbType.Guid, DefaultFilter = DefaultFilterJson, @@ -726,11 +726,11 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend SelectionJson = DefaultSelectionSingleJson, ColumnOptionJson = DefaultColumnOptionJson, PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.Plan), - DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlan)), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Plan)), DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, PagerOptionJson = DefaultPagerOptionJson, InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, - EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.Plan, 500, 500, true, true, true, true, false), + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.Plan, 800, 550, true, true, true, true, false), EditingFormJson = JsonSerializer.Serialize(new List() { new() { Order=1, ColCount=2, ColSpan=1, Caption="General", ItemType="group", Items= @@ -758,9 +758,9 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend ]} }), FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Frequency", FieldDbType = DbType.Boolean, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Frequency", FieldDbType = DbType.Int32, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, - new() { FieldName = "EstimatedDuration", FieldDbType = DbType.Boolean, Value = "60", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "EstimatedDuration", FieldDbType = DbType.Int32, Value = "60", CustomValueType = FieldCustomValueTypeEnum.Value }, }), CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { new() { @@ -770,6 +770,13 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend AuthName = AppCodes.Maintenance.Plan, Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.Plan)}/@Id" }, + new() { + Hint = "Work Order", + Text ="Work Order", + UrlTarget="_blank", + AuthName = AppCodes.Maintenance.Plan, + Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.Plan)}/@Id" + }, }), }, autoSave: true ); @@ -796,7 +803,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Code", - Width = 150, + Width = 100, ListOrderNo = 2, Visible = true, IsActive = true, @@ -814,7 +821,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.Guid, FieldName = "WorkCenterId", - Width = 350, + Width = 150, ListOrderNo = 3, Visible = true, IsActive = true, @@ -831,7 +838,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "PlanType", - Width = 500, + Width = 100, ListOrderNo = 4, Visible = true, IsActive = true, @@ -887,8 +894,8 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Description", - Width = 100, - ListOrderNo = 5, + Width = 300, + ListOrderNo = 6, Visible = true, IsActive = true, IsDeleted = false, @@ -903,7 +910,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend SourceDbType = DbType.Int32, FieldName = "Frequency", Width = 100, - ListOrderNo = 6, + ListOrderNo = 7, Visible = true, IsActive = true, IsDeleted = false, @@ -964,7 +971,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Instructions", - Width = 100, + Width = 350, ListOrderNo = 9, Visible = true, IsActive = true, @@ -980,12 +987,19 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "RequiredSkillsJson", - Width = 100, + Width = 250, ListOrderNo = 10, Visible = true, IsActive = true, IsDeleted = false, AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.TechnicalSkillsValues, + }), ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1046,7 +1060,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend IsOrganizationUnit = false, Description = AppCodes.Maintenance.PlanMaterial, SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanMaterial)), + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.PlanMaterial)), KeyFieldName = "Id", KeyFieldDbSourceType = DbType.Guid, DefaultFilter = DefaultFilterJson, @@ -1058,7 +1072,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend SelectionJson = DefaultSelectionSingleJson, ColumnOptionJson = DefaultColumnOptionJson, PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.PlanMaterial), - DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlanMaterial)), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.PlanMaterial)), DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, PagerOptionJson = DefaultPagerOptionJson, InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, @@ -1067,11 +1081,11 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ new EditingFormItemDto { Order = 1, DataField = "MaterialId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "Quantity", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 2, DataField = "Quantity", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox }, ]} }), FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { - new() { FieldName = "Quantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value } + new() { FieldName = "Quantity", FieldDbType = DbType.Decimal, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value } }), }, autoSave: true ); @@ -1098,7 +1112,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.Guid, FieldName = "MaterialId", - Width = 150, + Width = 300, ListOrderNo = 2, Visible = true, IsActive = true, @@ -1115,7 +1129,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend CultureName = LanguageCodes.En, SourceDbType = DbType.Decimal, FieldName = "Quantity", - Width = 350, + Width = 100, ListOrderNo = 3, Visible = true, IsActive = true, @@ -1123,7 +1137,6 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend SortIndex = 1, SortDirection = GridColumnOptions.SortOrderAsc, AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1153,7 +1166,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend IsOrganizationUnit = false, Description = AppCodes.Maintenance.PlanEmployee, SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanEmployee)), + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.PlanEmployee)), KeyFieldName = "Id", KeyFieldDbSourceType = DbType.Guid, DefaultFilter = DefaultFilterJson, @@ -1165,7 +1178,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend SelectionJson = DefaultSelectionSingleJson, ColumnOptionJson = DefaultColumnOptionJson, PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.PlanEmployee), - DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlanEmployee)), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.PlanEmployee)), DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, PagerOptionJson = DefaultPagerOptionJson, InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, @@ -1174,7 +1187,9 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ new EditingFormItemDto { Order = 1, DataField = "EmployeeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, - new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 2, DataField = "StartDate", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 3, DataField = "EndDate", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxDateBox }, + new EditingFormItemDto { Order = 4, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, ]} }), }, autoSave: true @@ -1217,9 +1232,9 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend new() { ListFormCode = listForm.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - Width = 350, + SourceDbType = DbType.Date, + FieldName = "StartDate", + Width = 100, ListOrderNo = 3, Visible = true, IsActive = true, @@ -1230,6 +1245,37 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "EndDate", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 350, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, ], autoSave: true); #endregion } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index 92e8908e..383a4f66 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -6628,6 +6628,132 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial", + "ParentName": null, + "DisplayName": "App.Maintenance.PlanMaterial", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Create", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Update", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Delete", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Export", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Import", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanMaterial.Note", + "ParentName": "App.Maintenance.PlanMaterial", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee", + "ParentName": null, + "DisplayName": "App.Maintenance.PlanEmployee", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Create", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Update", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Delete", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Export", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Import", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.PlanEmployee.Note", + "ParentName": "App.Maintenance.PlanEmployee", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, { "GroupName": "App.Maintenance", "Name": "App.Maintenance.Calendar", diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 3c6f45cc..03bca260 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -162,7 +162,7 @@ public enum TableNameEnum WorkcenterStatus, Workcenter, WorkcenterSpecification, - MaintenancePlan, - MaintenancePlanMaterial, - MaintenancePlanEmployee + Plan, + PlanMaterial, + PlanEmployee } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index cf6a4ef1..4d40ee4b 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -190,9 +190,9 @@ public static class TableNameResolver { nameof(TableNameEnum.WorkcenterStatus), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.Workcenter), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.WorkcenterSpecification), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, - { nameof(TableNameEnum.MaintenancePlan), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, - { nameof(TableNameEnum.MaintenancePlanMaterial), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, - { nameof(TableNameEnum.MaintenancePlanEmployee), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.Plan), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.PlanMaterial), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.PlanEmployee), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, // 🔹 ACCOUNTING diff --git a/api/src/Erp.Platform.Domain/BackgroundWorkers/NotificationWorker.cs b/api/src/Erp.Platform.Domain/BackgroundWorkers/NotificationWorker.cs index 1e884a12..5a8faa98 100644 --- a/api/src/Erp.Platform.Domain/BackgroundWorkers/NotificationWorker.cs +++ b/api/src/Erp.Platform.Domain/BackgroundWorkers/NotificationWorker.cs @@ -34,19 +34,19 @@ public class NotificationWorker : BackgroundWorkerBase IRepository repository, IIdentityUserRepository userRepository, IdentityUserManager identityUserManager, - IErpSmsSender ErpSmsSender, - IErpRocketSender ErpRocketSender, - IErpEmailSender ErpEmailSender, - IErpWhatsAppSender ErpWhatsAppSender, + IErpSmsSender erpSmsSender, + IErpRocketSender erpRocketSender, + IErpEmailSender erpEmailSender, + IErpWhatsAppSender erpWhatsAppSender, ISettingProvider settingProvider) { Repository = repository; - ErpSmsSender = ErpSmsSender; + ErpSmsSender = erpSmsSender; UserRepository = userRepository; IdentityUserManager = identityUserManager; - ErpRocketSender = ErpRocketSender; - ErpEmailSender = ErpEmailSender; - ErpWhatsAppSender = ErpWhatsAppSender; + ErpRocketSender = erpRocketSender; + ErpEmailSender = erpEmailSender; + ErpWhatsAppSender = erpWhatsAppSender; SettingProvider = settingProvider; } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenancePlan.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenancePlan.cs index b6f39753..17ab2635 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenancePlan.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenancePlan.cs @@ -10,7 +10,8 @@ public class MaintenancePlan : FullAuditedEntity, IMultiTenant public Guid? TenantId { get; set; } public string Code { get; set; } - public string WorkCenterId { 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; } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 061f3568..6fab1848 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -2752,11 +2752,11 @@ public class PlatformDbContext : builder.Entity(b => { - b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlan)), Prefix.DbSchema); + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Plan)), Prefix.DbSchema); b.ConfigureByConvention(); b.Property(x => x.Code).IsRequired().HasMaxLength(100); - b.Property(x => x.WorkCenterId).IsRequired().HasMaxLength(100); + 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); @@ -2772,7 +2772,7 @@ public class PlatformDbContext : builder.Entity(b => { - b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanMaterial)), Prefix.DbSchema); + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PlanMaterial)), Prefix.DbSchema); b.ConfigureByConvention(); b.Property(x => x.MaintenancePlanId).IsRequired(); @@ -2787,7 +2787,7 @@ public class PlatformDbContext : builder.Entity(b => { - b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanEmployee)), Prefix.DbSchema); + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PlanEmployee)), Prefix.DbSchema); b.ConfigureByConvention(); b.Property(x => x.MaintenancePlanId).IsRequired(); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs index 7aa32bb0..42d3a041 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251120142319_Initial")] + [Migration("20251120201509_Initial")] partial class Initial { /// @@ -6008,14 +6008,14 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); - b.Property("WorkCenterId") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + b.Property("WorkCenterId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); - b.ToTable("Mnt_T_MaintenancePlan", (string)null); + b.HasIndex("WorkCenterId"); + + b.ToTable("Mnt_T_Plan", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b => @@ -6076,7 +6076,7 @@ namespace Erp.Platform.Migrations b.HasIndex("MaintenancePlanId"); - b.ToTable("Mnt_T_MaintenancePlanEmployee", (string)null); + b.ToTable("Mnt_T_PlanEmployee", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b => @@ -6134,7 +6134,7 @@ namespace Erp.Platform.Migrations b.HasIndex("MaintenancePlanId"); - b.ToTable("Mnt_T_MaintenancePlanMaterial", (string)null); + b.ToTable("Mnt_T_PlanMaterial", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Material", b => @@ -14370,6 +14370,17 @@ namespace Erp.Platform.Migrations .IsRequired(); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b => + { + b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter") + .WithMany() + .HasForeignKey("WorkCenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkCenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b => { b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan") diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs index 00c549ad..388cb4ee 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120142319_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs @@ -1276,38 +1276,6 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Hr_T_Template360", x => x.Id); }); - migrationBuilder.CreateTable( - name: "Mnt_T_MaintenancePlan", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - Code = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - WorkCenterId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PlanType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Priority = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), - Frequency = table.Column(type: "int", nullable: false), - FrequencyUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - EstimatedDuration = table.Column(type: "int", nullable: false), - Instructions = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), - NextDue = table.Column(type: "datetime2", nullable: false), - IsActive = table.Column(type: "bit", nullable: false), - LastExecuted = table.Column(type: "datetime2", nullable: false), - RequiredSkillsJson = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Mnt_T_MaintenancePlan", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Mnt_T_WorkcenterStatus", columns: table => new @@ -3064,64 +3032,6 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "Mnt_T_MaintenancePlanEmployee", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - MaintenancePlanId = table.Column(type: "uniqueidentifier", nullable: false), - EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), - StartDate = table.Column(type: "datetime2", nullable: false), - EndDate = table.Column(type: "datetime2", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Mnt_T_MaintenancePlanEmployee", x => x.Id); - table.ForeignKey( - name: "FK_Mnt_T_MaintenancePlanEmployee_Mnt_T_MaintenancePlan_MaintenancePlanId", - column: x => x.MaintenancePlanId, - principalTable: "Mnt_T_MaintenancePlan", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Mnt_T_MaintenancePlanMaterial", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - MaintenancePlanId = table.Column(type: "uniqueidentifier", nullable: false), - MaterialId = table.Column(type: "uniqueidentifier", nullable: false), - Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Mnt_T_MaintenancePlanMaterial", x => x.Id); - table.ForeignKey( - name: "FK_Mnt_T_MaintenancePlanMaterial_Mnt_T_MaintenancePlan_MaintenancePlanId", - column: x => x.MaintenancePlanId, - principalTable: "Mnt_T_MaintenancePlan", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "OpenIddictAuthorizations", columns: table => new @@ -5026,6 +4936,44 @@ namespace Erp.Platform.Migrations principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "Mnt_T_Plan", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + WorkCenterId = table.Column(type: "uniqueidentifier", nullable: false), + PlanType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Priority = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Frequency = table.Column(type: "int", nullable: false), + FrequencyUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + EstimatedDuration = table.Column(type: "int", nullable: false), + Instructions = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), + NextDue = table.Column(type: "datetime2", nullable: false), + IsActive = table.Column(type: "bit", nullable: false), + LastExecuted = table.Column(type: "datetime2", nullable: false), + RequiredSkillsJson = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Mnt_T_Plan", x => x.Id); + table.ForeignKey( + name: "FK_Mnt_T_Plan_Mnt_T_Workcenter_WorkCenterId", + column: x => x.WorkCenterId, + principalTable: "Mnt_T_Workcenter", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Mnt_T_WorkcenterSpecification", columns: table => new @@ -5512,6 +5460,64 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Mnt_T_PlanEmployee", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + MaintenancePlanId = table.Column(type: "uniqueidentifier", nullable: false), + EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), + StartDate = table.Column(type: "datetime2", nullable: false), + EndDate = table.Column(type: "datetime2", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Mnt_T_PlanEmployee", x => x.Id); + table.ForeignKey( + name: "FK_Mnt_T_PlanEmployee_Mnt_T_Plan_MaintenancePlanId", + column: x => x.MaintenancePlanId, + principalTable: "Mnt_T_Plan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Mnt_T_PlanMaterial", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + MaintenancePlanId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Mnt_T_PlanMaterial", x => x.Id); + table.ForeignKey( + name: "FK_Mnt_T_PlanMaterial_Mnt_T_Plan_MaintenancePlanId", + column: x => x.MaintenancePlanId, + principalTable: "Mnt_T_Plan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Hr_T_SurveyAnswer", columns: table => new @@ -6435,13 +6441,18 @@ namespace Erp.Platform.Migrations column: "SurveyId"); migrationBuilder.CreateIndex( - name: "IX_Mnt_T_MaintenancePlanEmployee_MaintenancePlanId", - table: "Mnt_T_MaintenancePlanEmployee", + name: "IX_Mnt_T_Plan_WorkCenterId", + table: "Mnt_T_Plan", + column: "WorkCenterId"); + + migrationBuilder.CreateIndex( + name: "IX_Mnt_T_PlanEmployee_MaintenancePlanId", + table: "Mnt_T_PlanEmployee", column: "MaintenancePlanId"); migrationBuilder.CreateIndex( - name: "IX_Mnt_T_MaintenancePlanMaterial_MaintenancePlanId", - table: "Mnt_T_MaintenancePlanMaterial", + name: "IX_Mnt_T_PlanMaterial_MaintenancePlanId", + table: "Mnt_T_PlanMaterial", column: "MaintenancePlanId"); migrationBuilder.CreateIndex( @@ -7153,10 +7164,10 @@ namespace Erp.Platform.Migrations name: "Hr_T_SurveyQuestionOption"); migrationBuilder.DropTable( - name: "Mnt_T_MaintenancePlanEmployee"); + name: "Mnt_T_PlanEmployee"); migrationBuilder.DropTable( - name: "Mnt_T_MaintenancePlanMaterial"); + name: "Mnt_T_PlanMaterial"); migrationBuilder.DropTable( name: "Mnt_T_WorkcenterSpecification"); @@ -7369,10 +7380,7 @@ namespace Erp.Platform.Migrations name: "Hr_T_SurveyQuestion"); migrationBuilder.DropTable( - name: "Mnt_T_MaintenancePlan"); - - migrationBuilder.DropTable( - name: "Mnt_T_Workcenter"); + name: "Mnt_T_Plan"); migrationBuilder.DropTable( name: "Net_T_Training"); @@ -7456,10 +7464,7 @@ namespace Erp.Platform.Migrations name: "Hr_T_Survey"); migrationBuilder.DropTable( - name: "Mnt_T_WorkcenterStatus"); - - migrationBuilder.DropTable( - name: "Mnt_T_WorkcenterType"); + name: "Mnt_T_Workcenter"); migrationBuilder.DropTable( name: "Net_T_EventCategory"); @@ -7494,6 +7499,12 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Sas_T_Branch"); + migrationBuilder.DropTable( + name: "Mnt_T_WorkcenterStatus"); + + migrationBuilder.DropTable( + name: "Mnt_T_WorkcenterType"); + migrationBuilder.DropTable( name: "Sas_H_CountryGroup"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index cfa6baa3..81768502 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -6005,14 +6005,14 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); - b.Property("WorkCenterId") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + b.Property("WorkCenterId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); - b.ToTable("Mnt_T_MaintenancePlan", (string)null); + b.HasIndex("WorkCenterId"); + + b.ToTable("Mnt_T_Plan", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b => @@ -6073,7 +6073,7 @@ namespace Erp.Platform.Migrations b.HasIndex("MaintenancePlanId"); - b.ToTable("Mnt_T_MaintenancePlanEmployee", (string)null); + b.ToTable("Mnt_T_PlanEmployee", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b => @@ -6131,7 +6131,7 @@ namespace Erp.Platform.Migrations b.HasIndex("MaintenancePlanId"); - b.ToTable("Mnt_T_MaintenancePlanMaterial", (string)null); + b.ToTable("Mnt_T_PlanMaterial", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Material", b => @@ -14367,6 +14367,17 @@ namespace Erp.Platform.Migrations .IsRequired(); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b => + { + b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter") + .WithMany() + .HasForeignKey("WorkCenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkCenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b => { b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan") diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index b5fdb018..875ef600 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -777,6 +777,9 @@ }, { "Name": "Soft Skills" + }, + { + "Name": "Technical Skills" } ], "Skills": [ @@ -875,6 +878,34 @@ { "SkillTypeName": "Soft Skills", "Name": "İletişim" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Torna Operatörü" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Mekanik" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Kompresör Teknisyeni" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Elektrikçi" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "PLC Teknisyeni" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Robot Teknisyeni" + }, + { + "SkillTypeName": "Technical Skills", + "Name": "Kaynak Uzmanı" } ], "SkillLevels": [ @@ -4916,5 +4947,67 @@ "setupTime": 20, "isActive": true } + ], + "MaintenancePlans": [ + { + "code": "PM-CNC-001", + "workCenterCode": "CNC-001", + "planType": "Düzeltici", + "priority": "Düşük", + "description": "CNC torna tezgahı için haftalık rutin bakım planı", + "frequency": 1, + "frequencyUnit": "Haftalık", + "estimatedDuration": 120, + "instructions": "Yağlama, temizlik ve genel kontrol yapılacaktır.", + "requiredSkillsJson": "Torna Operatörü|Mekanik", + "nextDue": "2024-02-12T00:00:00.000Z", + "isActive": true, + "lastExecuted": "2024-02-05T00:00:00.000Z" + }, + { + "code": "PM-COMP-001", + "workCenterCode": "COMP-001", + "planType": "Tahminsel", + "priority": "Acil", + "description": "Hava kompresörü aylık bakım ve kontrol planı", + "frequency": 1, + "frequencyUnit": "Aylık", + "estimatedDuration": 240, + "instructions": "Filtre değişimi, yağ seviyesi kontrolü ve basınç testi yapılacaktır.", + "requiredSkillsJson": "Kompresör Teknisyeni|Elektrikçi", + "nextDue": "2024-02-15T00:00:00.000Z", + "isActive": true, + "lastExecuted": "2024-01-15T00:00:00.000Z" + }, + { + "code": "CM-CONV-001", + "workCenterCode": "CONV-001", + "planType": "Düzeltici", + "description": "Konveyör sistemi arıza durumunda müdahale planı", + "frequency": 10, + "frequencyUnit": "Günlük", + "estimatedDuration": 180, + "priority": "Yüksek", + "requiredSkillsJson": "Mekanik|Elektrikçi|PLC Teknisyeni", + "instructions": "Acil durum müdahale prosedürleri uygulanacaktır.", + "nextDue": "2024-02-10T00:00:00.000Z", + "isActive": false, + "lastExecuted": "2025-08-15T00:00:00.000Z" + }, + { + "code": "PM-WELD-001", + "workCenterCode": "CONV-001", + "planType": "Tahminsel", + "description": "Robot kaynak sistemi 6 aylık periyodik bakımı", + "frequency": 6, + "frequencyUnit": "Aylık", + "estimatedDuration": 480, + "priority": "Yüksek", + "requiredSkillsJson": "Robot Teknisyeni|Kaynak Uzmanı|Elektrikçi", + "instructions": "Robotik kaynak ekipmanlarının detaylı kontrolü ve kalibrasyonu yapılacaktır.", + "nextDue": "2024-02-15T00:00:00.000Z", + "isActive": true, + "lastExecuted": "2023-08-15T00:00:00.000Z" + } ] } \ No newline at end of file diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index 5aa3253c..903fb09d 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -109,6 +109,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _workcenterTypeRepository; private readonly IRepository _workcenterStatusRepository; private readonly IRepository _workcenterRepository; + private readonly IRepository _maintenancePlanRepository; public TenantDataSeeder( IClock clock, @@ -200,7 +201,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository approvalRepository, IRepository workcenterTypeRepository, IRepository workcenterStatusRepository, - IRepository workcenterRepository + IRepository workcenterRepository, + IRepository maintenancePlanRepository ) { _clock = clock; @@ -294,6 +296,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _workcenterTypeRepository = workcenterTypeRepository; _workcenterStatusRepository = workcenterStatusRepository; _workcenterRepository = workcenterRepository; + _maintenancePlanRepository = maintenancePlanRepository; } private static IConfigurationRoot BuildConfiguration() @@ -1982,6 +1985,32 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive }, autoSave: true); } + + foreach (var item in items.MaintenancePlans) + { + var exists = await _maintenancePlanRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var workcenter = await _workcenterRepository.FirstOrDefaultAsync(x => x.Code == item.WorkCenterCode); + + await _maintenancePlanRepository.InsertAsync(new MaintenancePlan + { + Code = item.Code, + WorkCenterId = workcenter?.Id, + PlanType = item.PlanType, + Priority = item.Priority, + Description = item.Description, + Frequency = item.Frequency, + FrequencyUnit = item.FrequencyUnit, + EstimatedDuration = item.EstimatedDuration, + RequiredSkillsJson = item.RequiredSkillsJson, + Instructions = item.Instructions, + NextDue = item.NextDue, + IsActive = item.IsActive, + LastExecuted = item.LastExecuted + }, autoSave: true); + } } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index eb4b3bf4..4cc6a81c 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -101,6 +101,24 @@ public class TenantSeederDto public List WorkcenterTypes { get; set; } public List WorkcenterStatuses { get; set; } public List Workcenters { get; set; } + public List MaintenancePlans { get; set; } +} + +public class MaintenancePlanSeedDto +{ + public string Code { get; set; } + public string WorkCenterCode { get; set; } + public string PlanType { get; set; } + public string Priority { get; set; } + public string Description { get; set; } + public int Frequency { get; set; } + public string FrequencyUnit { get; set; } + public int EstimatedDuration { get; set; } + public string RequiredSkillsJson { get; set; } + public string Instructions { get; set; } + public DateTime NextDue { get; set; } + public bool IsActive { get; set; } + public DateTime? LastExecuted { get; set; } } public class WorkcenterSeedDto diff --git a/ui/safelist.txt b/ui/safelist.txt index 1e626577..2110b34b 100644 --- a/ui/safelist.txt +++ b/ui/safelist.txt @@ -4318,6 +4318,7 @@ h-0.5 h-1.5 h-2.5 h-3.5 +h-1.2 h-1/2 h-1/3 h-2/3 @@ -4377,6 +4378,7 @@ w-0.5 w-1.5 w-2.5 w-3.5 +w-1.2 w-1/2 w-1/3 w-2/3 @@ -4447,6 +4449,7 @@ ml-0.5 ml-1.5 ml-2.5 ml-3.5 +ml-1.2 mr-0 mr-1 mr-2 @@ -4483,4 +4486,5 @@ mr-0.5 mr-1.5 mr-2.5 mr-3.5 +mr-1.2 erp-* \ No newline at end of file diff --git a/ui/src/assets/styles/components/_menu-item.css b/ui/src/assets/styles/components/_menu-item.css index 1cf7f936..55eebd71 100644 --- a/ui/src/assets/styles/components/_menu-item.css +++ b/ui/src/assets/styles/components/_menu-item.css @@ -1,5 +1,5 @@ .menu-item { - @apply cursor-pointer font-medium rounded-md flex items-center w-full whitespace-nowrap px-1.5; + @apply cursor-pointer font-medium rounded-md flex items-center w-full whitespace-nowrap px-1.2; &.menu-item-light { @apply text-gray-600; diff --git a/ui/src/components/layouts/AuthLayout/Simple.tsx b/ui/src/components/layouts/AuthLayout/Simple.tsx index 157902c9..6639a351 100644 --- a/ui/src/components/layouts/AuthLayout/Simple.tsx +++ b/ui/src/components/layouts/AuthLayout/Simple.tsx @@ -90,8 +90,8 @@ const Simple = ({ children, content, ...rest }: SimpleProps) => { return (
- -
+ +
{!hasSubdomain() && (