From 174570769141fe62b2ec2d56607a2301d92732fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:31:59 +0300 Subject: [PATCH] Maintenance Fault --- .../Seeds/LanguagesData.json | 14 +- .../Seeds/ListFormSeeder_Maintenance.cs | 526 ++++++++++++++++++ .../Seeds/MenusData.json | 30 +- .../Seeds/PermissionsData.json | 159 +++++- .../Enums/TableNameEnum.cs | 5 +- .../PlatformConsts.cs | 3 + .../TableNameResolver.cs | 3 + .../Erp.Platform.Domain/Data/SeedConsts.cs | 3 + .../Entities/Tenant/Maintenance/Fault.cs | 33 ++ .../Tenant/Maintenance/FaultStatus.cs | 18 + .../Entities/Tenant/Maintenance/FaultType.cs | 18 + .../EntityFrameworkCore/PlatformDbContext.cs | 44 +- ....cs => 20251121074401_Initial.Designer.cs} | 269 ++++++++- ...9_Initial.cs => 20251121074401_Initial.cs} | 123 ++++ .../PlatformDbContextModelSnapshot.cs | 267 +++++++++ .../Tenants/Seeds/TenantData.json | 160 +++++- .../Tenants/TenantDataSeeder.cs | 68 ++- .../Tenants/TenantSeederDto.cs | 35 ++ 18 files changed, 1740 insertions(+), 38 deletions(-) create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultStatus.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultType.cs rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251120201509_Initial.Designer.cs => 20251121074401_Initial.Designer.cs} (98%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251120201509_Initial.cs => 20251121074401_Initial.cs} (98%) diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index 48e0c7e0..dad83cb8 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9452,7 +9452,19 @@ }, { "resourceName": "Platform", - "key": "App.Maintenance.Faults", + "key": "App.Maintenance.FaultType", + "tr": "Arıza Türleri", + "en": "Fault Types" + }, + { + "resourceName": "Platform", + "key": "App.Maintenance.FaultStatus", + "tr": "Arıza Durumları", + "en": "Fault Statuses" + }, + { + "resourceName": "Platform", + "key": "App.Maintenance.Fault", "tr": "Arıza Bildirimleri", "en": "Fault Reports" }, diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs index 2e41bbb6..1d05785b 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs @@ -1313,6 +1313,532 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend } }) ); + + #region Fault + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Fault)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Fault, + Name = AppCodes.Maintenance.Fault, + Title = AppCodes.Maintenance.Fault, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.Fault, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Fault)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.Fault), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Fault)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.Fault, 500, 250, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + 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 = 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 }, + new EditingFormItemDto { Order = 8, DataField = "Severity", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 9, DataField = "AssignedTo", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 10, DataField = "EstimatedRepairTime", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 11, DataField = "FollowUpRequired", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 12, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 13, DataField = "FaultStatusId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Fault Type Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Title", + Width = 180, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Description", + Width = 500, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "WorkCenterId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Workcenter), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Location", + Width = 150, + ListOrderNo = 6, + 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.Guid, + FieldName = "FaultTypeId", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.FaultType), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Priority", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + ValueExpr = "key", + DisplayExpr = "name", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key = "Low", Name = "Low" }, + new () { Key = "Medium", Name = "Medium" }, + new () { Key = "High", Name = "High" }, + new () { Key = "Urgent", Name = "Urgent" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Severity", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + ValueExpr = "key", + DisplayExpr = "name", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key = "Low", Name = "Low" }, + new () { Key = "Medium", Name = "Medium" }, + new () { Key = "High", Name = "High" }, + new () { Key = "Critical", Name = "Critical" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "EstimatedRepairTime", + Width = 100, + ListOrderNo = 9, + 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.Boolean, + FieldName = "FollowUpRequired", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "FaultStatusId", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.FaultStatus), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Fault Type + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.FaultType)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.FaultType, + Name = AppCodes.Maintenance.FaultType, + Title = AppCodes.Maintenance.FaultType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.FaultType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.FaultType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.FaultType), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.FaultType)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.FaultType, 500, 250, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Fault Type Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 350, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + 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 = 500, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region Fault Status + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.FaultStatus)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.FaultStatus, + Name = AppCodes.Maintenance.FaultStatus, + Title = AppCodes.Maintenance.FaultStatus, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.FaultStatus, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.FaultStatus)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.FaultStatus), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.FaultStatus)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.FaultStatus, 500, 250, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Fault Status Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 350, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderAsc, + 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 = 500, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + } } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index 15174080..5f8d1227 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -2447,19 +2447,39 @@ }, { "ParentCode": "App.Maintenance", - "Code": "App.Maintenance.Faults", - "DisplayName": "App.Maintenance.Faults", + "Code": "App.Maintenance.FaultType", + "DisplayName": "App.Maintenance.FaultType", + "Order": 7, + "Url": "/admin/list/list-faulttype", + "Icon": "FcInspection", + "RequiredPermissionName": "App.Maintenance.FaultType", + "IsDisabled": false + }, + { + "ParentCode": "App.Maintenance", + "Code": "App.Maintenance.FaultStatus", + "DisplayName": "App.Maintenance.FaultStatus", "Order": 8, - "Url": "/admin/maintenance/faults", + "Url": "/admin/list/list-faultstatus", + "Icon": "FcMediumPriority", + "RequiredPermissionName": "App.Maintenance.FaultStatus", + "IsDisabled": false + }, + { + "ParentCode": "App.Maintenance", + "Code": "App.Maintenance.Fault", + "DisplayName": "App.Maintenance.Fault", + "Order": 9, + "Url": "/admin/list/list-fault", "Icon": "FcHighPriority", - "RequiredPermissionName": "App.Maintenance.Faults", + "RequiredPermissionName": "App.Maintenance.Fault", "IsDisabled": false }, { "ParentCode": "App.Maintenance", "Code": "App.Maintenance.Workorders", "DisplayName": "App.Maintenance.Workorders", - "Order": 9, + "Order": 10, "Url": "/admin/maintenance/workorders", "Icon": "FcList", "RequiredPermissionName": "App.Maintenance.Workorders", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index 383a4f66..2bfd9c96 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -6819,17 +6819,17 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault", "ParentName": null, - "DisplayName": "App.Maintenance.Faults", + "DisplayName": "App.Maintenance.Fault", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Create", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Create", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Create", "IsEnabled": true, "MultiTenancySide": 3, @@ -6837,8 +6837,8 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Update", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Update", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Update", "IsEnabled": true, "MultiTenancySide": 3, @@ -6846,8 +6846,8 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Delete", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Delete", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Delete", "IsEnabled": true, "MultiTenancySide": 3, @@ -6855,8 +6855,8 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Export", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Export", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Export", "IsEnabled": true, "MultiTenancySide": 3, @@ -6864,8 +6864,8 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Import", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Import", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Import", "IsEnabled": true, "MultiTenancySide": 3, @@ -6873,13 +6873,142 @@ }, { "GroupName": "App.Maintenance", - "Name": "App.Maintenance.Faults.Note", - "ParentName": "App.Maintenance.Faults", + "Name": "App.Maintenance.Fault.Note", + "ParentName": "App.Maintenance.Fault", "DisplayName": "Note", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, + + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType", + "ParentName": null, + "DisplayName": "App.Maintenance.FaultType", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Create", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Update", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Delete", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Export", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Import", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultType.Note", + "ParentName": "App.Maintenance.FaultType", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus", + "ParentName": null, + "DisplayName": "App.Maintenance.FaultStatus", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Create", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Update", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Delete", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Export", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Import", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.FaultStatus.Note", + "ParentName": "App.Maintenance.FaultStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { "GroupName": "App.Maintenance", "Name": "App.Maintenance.Workorders", @@ -11606,4 +11735,4 @@ "MenuGroup": "Erp" } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 03bca260..522ce219 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -164,5 +164,8 @@ public enum TableNameEnum WorkcenterSpecification, Plan, PlanMaterial, - PlanEmployee + PlanEmployee, + Fault, + FaultStatus, + FaultType, } diff --git a/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs index 1a1f586b..d74091bb 100644 --- a/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs @@ -539,6 +539,9 @@ public static class PlatformConsts public const string Plan = "list-maintenanceplan"; public const string PlanMaterial = "list-maintenanceplanmaterial"; public const string PlanEmployee = "list-maintenanceplanemployee"; + public const string Fault = "list-fault"; + public const string FaultType = "list-faulttype"; + public const string FaultStatus = "list-faultstatus"; } } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index 4d40ee4b..b5037674 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -193,6 +193,9 @@ public static class TableNameResolver { nameof(TableNameEnum.Plan), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.PlanMaterial), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.PlanEmployee), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.Fault), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.FaultStatus), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.FaultType), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, // 🔹 ACCOUNTING diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index 2bc53fe7..c1ea343f 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -529,6 +529,9 @@ public static class SeedConsts public const string Plan = Default + ".Plan"; public const string PlanMaterial = Default + ".PlanMaterial"; public const string PlanEmployee = Default + ".PlanEmployee"; + public const string Fault = Default + ".Fault"; + public const string FaultType = Default + ".FaultType"; + public const string FaultStatus = Default + ".FaultStatus"; } public static class Accounting diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs new file mode 100644 index 00000000..db245f00 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs @@ -0,0 +1,33 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class Fault : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Code { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public Guid? WorkCenterId { get; set; } + public Workcenter? WorkCenter { get; set; } + public string Location { get; set; } + public Guid? FaultTypeId { get; set; } + public FaultType? FaultType { get; set; } + public string Priority { get; set; } + public string Severity { get; set; } + public int? EstimatedRepairTime { get; set; } + public bool FollowUpRequired { get; set; } + public Guid? FaultStatusId { get; set; } + public FaultStatus? FaultStatus { get; set; } + public bool IsActive { get; set; } + + public string AssignedTo { get; set; } + public int? ActualRepairTime { get; set; } + public Guid WorkOrderId { get; set; } + public string ResolutionNotes { get; set; } + public string ClosedBy { get; set; } + public DateTime? ClosedAt { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultStatus.cs new file mode 100644 index 00000000..33c062c5 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultStatus.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class FaultStatus : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Faults { get; set; } +} + diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultType.cs new file mode 100644 index 00000000..86c3f754 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/FaultType.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class FaultType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Faults { get; set; } +} + diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 6fab1848..10dafb58 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -26,7 +26,6 @@ using System.Text.Json; using static Erp.Platform.PlatformConsts; using static Erp.Settings.SettingsConsts; using Erp.Platform.Enums; -using Erp.Platform.Domain.DeveloperKit; namespace Erp.Platform.EntityFrameworkCore; @@ -237,6 +236,9 @@ public class PlatformDbContext : public DbSet Workcenters { get; set; } public DbSet WorkcenterSpecifications { get; set; } public DbSet MaintenancePlans { get; set; } + public DbSet Faults { get; set; } + public DbSet FaultStatuses { get; set; } + public DbSet FaultTypes { get; set; } #endregion public PlatformDbContext(DbContextOptions options) @@ -2798,5 +2800,45 @@ public class PlatformDbContext : .HasForeignKey(x => x.MaintenancePlanId) .OnDelete(DeleteBehavior.Cascade); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Fault)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Code).IsRequired().HasMaxLength(100); + 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); + b.Property(x => x.Severity).HasMaxLength(50); + b.Property(x => x.Title).HasMaxLength(200); + b.Property(x => x.Description); + b.Property(x => x.AssignedTo).HasMaxLength(150); + b.Property(x => x.FaultStatusId).IsRequired(); + b.Property(x => x.ResolutionNotes); + b.Property(x => x.ClosedBy).HasMaxLength(150); + b.Property(x => x.WorkOrderId).HasMaxLength(100); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.FaultStatus)), 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); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.FaultType)), 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); + }); } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.Designer.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.Designer.cs index 42d3a041..4ef373be 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251120201509_Initial")] + [Migration("20251121074401_Initial")] partial class Initial { /// @@ -4540,6 +4540,236 @@ namespace Erp.Platform.Migrations b.ToTable("Hr_T_Expense", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Fault", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualRepairTime") + .HasColumnType("int"); + + b.Property("AssignedTo") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ClosedAt") + .HasColumnType("datetime2"); + + b.Property("ClosedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("EstimatedRepairTime") + .HasColumnType("int"); + + b.Property("FaultStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("FaultTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("FollowUpRequired") + .HasColumnType("bit"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Location") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Priority") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ResolutionNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("Severity") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("WorkCenterId") + .HasMaxLength(50) + .HasColumnType("uniqueidentifier"); + + b.Property("WorkOrderId") + .HasMaxLength(100) + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FaultStatusId"); + + b.HasIndex("FaultTypeId"); + + b.HasIndex("WorkCenterId"); + + b.ToTable("Mnt_T_Fault", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultStatus", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Mnt_T_FaultStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Mnt_T_FaultType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.GlobalSearch", b => { b.Property("Id") @@ -14283,6 +14513,33 @@ namespace Erp.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Erp.Platform.Entities.Fault", b => + { + b.HasOne("Erp.Platform.Entities.FaultStatus", "FaultStatus") + .WithMany("Faults") + .HasForeignKey("FaultStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.FaultType", "FaultType") + .WithMany("Faults") + .HasForeignKey("FaultTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter") + .WithMany() + .HasForeignKey("WorkCenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FaultStatus"); + + b.Navigation("FaultType"); + + b.Navigation("WorkCenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.JobPosition", b => { b.HasOne("Erp.Platform.Entities.Department", "Department") @@ -15374,6 +15631,16 @@ namespace Erp.Platform.Migrations b.Navigation("Events"); }); + modelBuilder.Entity("Erp.Platform.Entities.FaultStatus", b => + { + b.Navigation("Faults"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultType", b => + { + b.Navigation("Faults"); + }); + modelBuilder.Entity("Erp.Platform.Entities.LossReason", b => { b.Navigation("Opportunities"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.cs index 388cb4ee..a1c17a2f 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251120201509_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121074401_Initial.cs @@ -1276,6 +1276,50 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Hr_T_Template360", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Mnt_T_FaultStatus", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: 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_FaultStatus", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Mnt_T_FaultType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: 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_FaultType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Mnt_T_WorkcenterStatus", columns: table => new @@ -4936,6 +4980,61 @@ namespace Erp.Platform.Migrations principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "Mnt_T_Fault", + 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), + Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(max)", nullable: true), + WorkCenterId = table.Column(type: "uniqueidentifier", maxLength: 50, nullable: false), + Location = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), + FaultTypeId = table.Column(type: "uniqueidentifier", nullable: false), + Priority = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Severity = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + EstimatedRepairTime = table.Column(type: "int", nullable: true), + FollowUpRequired = table.Column(type: "bit", nullable: false), + FaultStatusId = table.Column(type: "uniqueidentifier", nullable: false), + IsActive = table.Column(type: "bit", nullable: false), + AssignedTo = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: true), + ActualRepairTime = table.Column(type: "int", nullable: true), + WorkOrderId = table.Column(type: "uniqueidentifier", maxLength: 100, nullable: false), + ResolutionNotes = table.Column(type: "nvarchar(max)", nullable: true), + ClosedBy = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: true), + ClosedAt = table.Column(type: "datetime2", 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_Fault", x => x.Id); + table.ForeignKey( + name: "FK_Mnt_T_Fault_Mnt_T_FaultStatus_FaultStatusId", + column: x => x.FaultStatusId, + principalTable: "Mnt_T_FaultStatus", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Mnt_T_Fault_Mnt_T_FaultType_FaultTypeId", + column: x => x.FaultTypeId, + principalTable: "Mnt_T_FaultType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Mnt_T_Fault_Mnt_T_Workcenter_WorkCenterId", + column: x => x.WorkCenterId, + principalTable: "Mnt_T_Workcenter", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Mnt_T_Plan", columns: table => new @@ -6440,6 +6539,21 @@ namespace Erp.Platform.Migrations table: "Hr_T_SurveyResponse", column: "SurveyId"); + migrationBuilder.CreateIndex( + name: "IX_Mnt_T_Fault_FaultStatusId", + table: "Mnt_T_Fault", + column: "FaultStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Mnt_T_Fault_FaultTypeId", + table: "Mnt_T_Fault", + column: "FaultTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_Mnt_T_Fault_WorkCenterId", + table: "Mnt_T_Fault", + column: "WorkCenterId"); + migrationBuilder.CreateIndex( name: "IX_Mnt_T_Plan_WorkCenterId", table: "Mnt_T_Plan", @@ -7163,6 +7277,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Hr_T_SurveyQuestionOption"); + migrationBuilder.DropTable( + name: "Mnt_T_Fault"); + migrationBuilder.DropTable( name: "Mnt_T_PlanEmployee"); @@ -7379,6 +7496,12 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Hr_T_SurveyQuestion"); + migrationBuilder.DropTable( + name: "Mnt_T_FaultStatus"); + + migrationBuilder.DropTable( + name: "Mnt_T_FaultType"); + migrationBuilder.DropTable( name: "Mnt_T_Plan"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 81768502..155f02c5 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -4537,6 +4537,236 @@ namespace Erp.Platform.Migrations b.ToTable("Hr_T_Expense", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Fault", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualRepairTime") + .HasColumnType("int"); + + b.Property("AssignedTo") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ClosedAt") + .HasColumnType("datetime2"); + + b.Property("ClosedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("EstimatedRepairTime") + .HasColumnType("int"); + + b.Property("FaultStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("FaultTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("FollowUpRequired") + .HasColumnType("bit"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Location") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Priority") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ResolutionNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("Severity") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("WorkCenterId") + .HasMaxLength(50) + .HasColumnType("uniqueidentifier"); + + b.Property("WorkOrderId") + .HasMaxLength(100) + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FaultStatusId"); + + b.HasIndex("FaultTypeId"); + + b.HasIndex("WorkCenterId"); + + b.ToTable("Mnt_T_Fault", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultStatus", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Mnt_T_FaultStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Mnt_T_FaultType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.GlobalSearch", b => { b.Property("Id") @@ -14280,6 +14510,33 @@ namespace Erp.Platform.Migrations b.Navigation("Employee"); }); + modelBuilder.Entity("Erp.Platform.Entities.Fault", b => + { + b.HasOne("Erp.Platform.Entities.FaultStatus", "FaultStatus") + .WithMany("Faults") + .HasForeignKey("FaultStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.FaultType", "FaultType") + .WithMany("Faults") + .HasForeignKey("FaultTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Workcenter", "WorkCenter") + .WithMany() + .HasForeignKey("WorkCenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FaultStatus"); + + b.Navigation("FaultType"); + + b.Navigation("WorkCenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.JobPosition", b => { b.HasOne("Erp.Platform.Entities.Department", "Department") @@ -15371,6 +15628,16 @@ namespace Erp.Platform.Migrations b.Navigation("Events"); }); + modelBuilder.Entity("Erp.Platform.Entities.FaultStatus", b => + { + b.Navigation("Faults"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.FaultType", b => + { + b.Navigation("Faults"); + }); + modelBuilder.Entity("Erp.Platform.Entities.LossReason", b => { b.Navigation("Opportunities"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 875ef600..be1ea144 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -100,9 +100,7 @@ "props": null, "description": null, "isActive": true, - "dependencies": [ - "DynamicEntityComponent" - ] + "dependencies": ["DynamicEntityComponent"] } ], "ReportCategories": [ @@ -2431,12 +2429,7 @@ "minSalary": 80000, "maxSalary": 120000, "currencyCode": "USD", - "requiredSkills": [ - "JavaScript", - "TypeScript", - "React", - "Node.js" - ], + "requiredSkills": ["JavaScript", "TypeScript", "React", "Node.js"], "responsibilities": [ "Develop frontend and backend applications", "Write clean and maintainable code", @@ -4131,9 +4124,7 @@ { "postContent": "CI/CD pipeline güncellememiz tamamlandı! Deployment süremiz %40 azaldı. Otomasyonun gücü 💪", "type": "video", - "urls": [ - "https://www.w3schools.com/html/mov_bbb.mp4" - ] + "urls": ["https://www.w3schools.com/html/mov_bbb.mp4"] } ], "SocialPollOptions": [ @@ -5009,5 +5000,148 @@ "isActive": true, "lastExecuted": "2023-08-15T00:00:00.000Z" } + ], + "Faults": [ + { + "code": "ARZ-2024-001", + "workCenterCode": "CNC-001", + "location": "Atölye A - Hat 1", + "faultTypeName": "Mekanik", + "priority": "High", + "severity": "High", + "title": "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.", + "assignedTo": "Mehmet Kaya - Mekanik Ekibi", + "status": "Açık", + "estimatedRepairTime": 180, + "followUpRequired": true, + "isActive": true + }, + { + "code": "ARZ-2024-002", + "workCenterCode": "COMP-001", + "location": "Kompresör Odası", + "faultTypeName": "Elektrik", + "priority": "Urgent", + "severity": "Critical", + "title": "Elektrik Panosu Arızası", + "description": "Kompresör elektrik panosunda kısa devre meydana geldi. Sistem tamamen durdu.", + "assignedTo": "Ahmet Yılmaz - Elektrik Ekibi", + "status": "Kapandı", + "estimatedRepairTime": 240, + "actualRepairTime": 195, + "resolutionNotes": "Yanık sigorta değiştirildi ve pano kontrolleri yapıldı. Sistem normal çalışıyor.", + "followUpRequired": false, + "isActive": true + }, + { + "code": "ARZ-2024-003", + "workCenterCode": "CONV-001", + "location": "Ana Üretim Hattı", + "faultTypeName": "Performans", + "priority": "Normal", + "severity": "Medium", + "title": "Kayış Gerilimi Azaldı", + "description": "Konveyör kayışında gevşeme tespit edildi. Hız düşüklüğü gözlemleniyor.", + "status": "Onarımda", + "estimatedRepairTime": 60, + "followUpRequired": false, + "isActive": true + }, + { + "code": "ARZ-2024-004", + "workCenterCode": "CONV-001", + "location": "Kaynak Atölyesi", + "faultTypeName": "Yazılım", + "priority": "High", + "severity": "High", + "title": "Program Kalibrasyon Hatası", + "description": "Robot kaynak pozisyonlarında sapma var. Kalibrasyon gerekiyor.", + "assignedTo": "Sema Korkmaz - Robot Teknisyeni", + "status": "İnceleniyor", + "estimatedRepairTime": 120, + "followUpRequired": true, + "isActive": true + }, + { + "code": "ARZ-2024-005", + "workCenterCode": "CONV-001", + "location": "Pres Atölyesi", + "faultTypeName": "Hidrolik", + "priority": "Low", + "severity": "Low", + "title": "Yağ Sızıntısı", + "description": "Hidrolik sistem borularında hafif yağ sızıntısı tespit edildi.", + "status": "Açık", + "estimatedRepairTime": 45, + "actualRepairTime": 30, + "resolutionNotes": "Boru bağlantıları sıkılaştırıldı. Sızıntı durduruldu.", + "followUpRequired": true, + "isActive": true + } + ], + "FaultTypes": [ + { + "name": "Mekanik", + "description": "Mekanik bileşenlerde meydana gelen arızalar", + "isActive": true + }, + { + "name": "Elektrik", + "description": "Elektrik sistemlerinde meydana gelen arızalar", + "isActive": true + }, + { + "name": "Hidrolik", + "description": "Hidrolik sistemlerde meydana gelen arızalar", + "isActive": true + }, + { + "name": "Pnömatik", + "description": "Pnömatik sistemlerde meydana gelen arızalar", + "isActive": true + }, + { + "name": "Yazılım", + "description": "Yazılım ve programlama hatalarından kaynaklanan arızalar", + "isActive": true + }, + { + "name": "Güvenlik", + "description": "Güvenlik sistemlerinde meydana gelen arızalar", + "isActive": true + }, + { + "name": "Performans", + "description": "Performans ile ilgili arızalar", + "isActive": true + }, + { + "name": "Diğer", + "description": "Diğer arızalar", + "isActive": true + } + ], + "FaultStatuses": [ + { + "name": "Açık", + "description": "Arıza kaydı yeni oluşturuldu ve henüz müdahale edilmedi", + "isActive": true + }, + { + "name": "İnceleniyor", + "description": "Arıza üzerinde inceleme ve teşhis çalışmaları devam ediyor", + "isActive": true + }, + { + "name": "Onarımda", + "description": "Arıza giderme ve onarım işlemleri sürüyor", + "isActive": true + }, + { + "name": "Kapandı", + "description": "Arıza giderildi ve kayıt kapatıldı", + "isActive": true + } ] -} \ 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 903fb09d..e460729c 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -110,6 +110,9 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _workcenterStatusRepository; private readonly IRepository _workcenterRepository; private readonly IRepository _maintenancePlanRepository; + private readonly IRepository _faultRepository; + private readonly IRepository _faultStatusRepository; + private readonly IRepository _faultTypeRepository; public TenantDataSeeder( IClock clock, @@ -202,7 +205,10 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository workcenterTypeRepository, IRepository workcenterStatusRepository, IRepository workcenterRepository, - IRepository maintenancePlanRepository + IRepository maintenancePlanRepository, + IRepository faultRepository, + IRepository faultStatusRepository, + IRepository faultTypeRepository ) { _clock = clock; @@ -297,6 +303,9 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _workcenterStatusRepository = workcenterStatusRepository; _workcenterRepository = workcenterRepository; _maintenancePlanRepository = maintenancePlanRepository; + _faultRepository = faultRepository; + _faultStatusRepository = faultStatusRepository; + _faultTypeRepository = faultTypeRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2011,6 +2020,63 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency LastExecuted = item.LastExecuted }, autoSave: true); } + + foreach (var item in items.FaultTypes) + { + var exists = await _faultTypeRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _faultTypeRepository.InsertAsync(new FaultType + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.FaultStatuses) + { + var exists = await _faultStatusRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _faultStatusRepository.InsertAsync(new FaultStatus + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.Faults) + { + var exists = await _faultRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var workcenter = await _workcenterRepository.FirstOrDefaultAsync(x => x.Code == item.WorkCenterCode); + var faultType = await _faultTypeRepository.FirstOrDefaultAsync(x => x.Name == item.FaultTypeName); + var faultStatus = await _faultStatusRepository.FirstOrDefaultAsync(x => x.Name == item.Status); + + await _faultRepository.InsertAsync(new Fault + { + Code = item.Code, + WorkCenterId = workcenter?.Id, + Location = item.Location, + FaultTypeId = faultType?.Id, + Priority = item.Priority, + Severity = item.Severity, + Title = item.Title, + Description = item.Description, + FaultStatusId = faultStatus?.Id, + EstimatedRepairTime = item.EstimatedRepairTime, + ActualRepairTime = item.ActualRepairTime, + ResolutionNotes = item.ResolutionNotes, + FollowUpRequired = item.FollowUpRequired, + IsActive = item.IsActive, + }, autoSave: true); + } } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 4cc6a81c..6a0cebab 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -102,6 +102,41 @@ public class TenantSeederDto public List WorkcenterStatuses { get; set; } public List Workcenters { get; set; } public List MaintenancePlans { get; set; } + public List Faults { get; set; } + public List FaultStatuses { get; set; } + public List FaultTypes { get; set; } +} + +public class FaultSeedDto +{ + public string Code { get; set; } + public string WorkCenterCode { get; set; } + public string Location { get; set; } + public string FaultTypeName { get; set; } + public string Priority { get; set; } + public string Severity { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public string Status { get; set; } + public int? EstimatedRepairTime { get; set; } + public int? ActualRepairTime { get; set; } + public string ResolutionNotes { get; set; } + public bool FollowUpRequired { get; set; } + public bool IsActive { get; set; } +} + +public class FaultStatusSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + +public class FaultTypeSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } } public class MaintenancePlanSeedDto