diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index fd886bdd..56087cb4 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9486,6 +9486,18 @@ "tr": "Arıza Bildirimleri", "en": "Fault Reports" }, + { + "resourceName": "Platform", + "key": "App.Maintenance.WorkorderType", + "tr": "Bakım İş Emri Türleri", + "en": "Workorder Types" + }, + { + "resourceName": "Platform", + "key": "App.Maintenance.WorkorderStatus", + "tr": "Bakım İş Emri Durumları", + "en": "Workorder Statuses" + }, { "resourceName": "Platform", "key": "App.Maintenance.Workorders", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs index 11788a7f..d2cd325f 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Maintenance.cs @@ -85,7 +85,6 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend 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 = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, @@ -114,22 +113,6 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson }, - new() { - ListFormCode = listForm.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 150, - ListOrderNo = 2, - 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, @@ -184,7 +167,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend } #endregion - #region Workcenter status + #region Workcenter Status if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.WorkcenterStatus)) { var listForm = await _listFormRepository.InsertAsync( @@ -224,10 +207,9 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend 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 = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + 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[] { @@ -253,22 +235,6 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson }, - new() { - ListFormCode = listForm.ListFormCode, - CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Code", - Width = 150, - ListOrderNo = 2, - 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, @@ -1515,7 +1481,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend new () { Key = "High", Name = "High" }, new () { Key = "Urgent", Name = "Urgent" }, }), - }), + }), ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1542,7 +1508,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend new () { Key = "High", Name = "High" }, new () { Key = "Critical", Name = "Critical" }, }), - }), + }), ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1589,7 +1555,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend IsActive = true, IsDeleted = false, AllowSearch = true, - LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.FaultStatus), "Name", "Name"), + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.FaultStatus), "Name", "Name"), ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1857,8 +1823,372 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend #endregion } #endregion - + #region Workorder Type + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.WorkorderType)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.WorkorderType, + Name = AppCodes.Maintenance.WorkorderType, + Title = AppCodes.Maintenance.WorkorderType, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.WorkorderType, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkorderType)), + 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.WorkorderType), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.WorkorderType)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.WorkorderType, 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 Workorder 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 Workorder Status + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.WorkorderStatus)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.WorkorderStatus, + Name = AppCodes.Maintenance.WorkorderStatus, + Title = AppCodes.Maintenance.WorkorderStatus, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.WorkorderStatus, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkorderStatus)), + 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.WorkorderStatus), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.WorkorderStatus)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.WorkorderStatus, 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 Workorder 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 + + #region Workorder + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Workorder)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson, + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Workorder, + Name = AppCodes.Maintenance.Workorder, + Title = AppCodes.Maintenance.Workorder, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Maintenance.Workorder, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Workorder)), + 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.Workorder), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Workorder)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.Workorder, 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 Workorder 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 5f8d1227..d9ef9b43 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -2475,11 +2475,31 @@ "RequiredPermissionName": "App.Maintenance.Fault", "IsDisabled": false }, + { + "ParentCode": "App.Maintenance", + "Code": "App.Maintenance.WorkorderType", + "DisplayName": "App.Maintenance.WorkorderType", + "Order": 9, + "Url": "/admin/list/list-workordertype", + "Icon": "FcWorkflow", + "RequiredPermissionName": "App.Maintenance.WorkorderType", + "IsDisabled": false + }, + { + "ParentCode": "App.Maintenance", + "Code": "App.Maintenance.WorkorderStatus", + "DisplayName": "App.Maintenance.WorkorderStatus", + "Order": 10, + "Url": "/admin/list/list-workorderstatus", + "Icon": "FcProcess", + "RequiredPermissionName": "App.Maintenance.WorkorderStatus", + "IsDisabled": false + }, { "ParentCode": "App.Maintenance", "Code": "App.Maintenance.Workorders", "DisplayName": "App.Maintenance.Workorders", - "Order": 10, + "Order": 11, "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 2bfd9c96..8eab2199 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -6880,7 +6880,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Maintenance", "Name": "App.Maintenance.FaultType", @@ -6944,7 +6943,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Maintenance", "Name": "App.Maintenance.FaultStatus", @@ -7008,7 +7006,132 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType", + "ParentName": null, + "DisplayName": "App.Maintenance.WorkorderType", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Create", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Update", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Delete", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Export", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Import", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderType.Note", + "ParentName": "App.Maintenance.WorkorderType", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus", + "ParentName": null, + "DisplayName": "App.Maintenance.WorkorderStatus", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Create", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Update", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Delete", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Export", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Import", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Maintenance", + "Name": "App.Maintenance.WorkorderStatus.Note", + "ParentName": "App.Maintenance.WorkorderStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, { "GroupName": "App.Maintenance", "Name": "App.Maintenance.Workorders", @@ -11735,4 +11858,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 522ce219..1590f659 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -168,4 +168,7 @@ public enum TableNameEnum Fault, FaultStatus, FaultType, + WorkorderType, + WorkorderStatus, + Workorder } diff --git a/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs index d74091bb..18f3e83a 100644 --- a/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Erp.Platform.Domain.Shared/PlatformConsts.cs @@ -542,6 +542,9 @@ public static class PlatformConsts public const string Fault = "list-fault"; public const string FaultType = "list-faulttype"; public const string FaultStatus = "list-faultstatus"; + public const string Workorder = "list-workorder"; + public const string WorkorderType = "list-workordertype"; + public const string WorkorderStatus = "list-workorderstatus"; } } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index b5037674..f269f8ac 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -196,6 +196,9 @@ public static class TableNameResolver { nameof(TableNameEnum.Fault), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.FaultStatus), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.FaultType), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.Workorder), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.WorkorderType), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, + { nameof(TableNameEnum.WorkorderStatus), (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 c1ea343f..d999e5a2 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -532,6 +532,9 @@ public static class SeedConsts public const string Fault = Default + ".Fault"; public const string FaultType = Default + ".FaultType"; public const string FaultStatus = Default + ".FaultStatus"; + public const string Workorder = Default + ".Workorder"; + public const string WorkorderType = Default + ".WorkorderType"; + public const string WorkorderStatus = Default + ".WorkorderStatus"; } public static class Accounting diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorder.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorder.cs new file mode 100644 index 00000000..04c2be59 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorder.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MaintenanceWorkorder : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string WorkorderNumber { get; set; } + public Guid WorkcenterId { get; set; } + public Workcenter Workcenter { get; set; } + + public Guid? PlanId { get; set; } + public MaintenancePlan Plan { get; set; } + + public Guid OrderTypeId { get; set; } //Preventive, Corrective, Emergency, Inspection, Calibration + public MaintenanceWorkorderType OrderType { get; set; } + + public string Priority { get; set; } //Low, Medium, High, Urgent + public string Status { get; set; } //Created, Planned, Released, InProgress, OnHold, Completed, Cancelled + + public string Description { get; set; } + public string AssignedTo { get; set; } + public string MaintenanceTeamId { get; set; } + + public DateTime? ScheduledStart { get; set; } + public DateTime? ScheduledEnd { get; set; } + public DateTime? ActualStart { get; set; } + public DateTime? ActualEnd { get; set; } + + public int EstimatedCost { get; set; } + public int ActualCost { get; set; } + + public string Notes { get; set; } + public string CompletionNotes { get; set; } + + public ICollection Materials { get; set; } + public ICollection Activities { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderActivity.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderActivity.cs new file mode 100644 index 00000000..7db2d97a --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderActivity.cs @@ -0,0 +1,23 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MaintenanceWorkorderActivity : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid WorkOrderId { get; set; } + public MaintenanceWorkorder WorkOrder { get; set; } + + public string ActivityDescription { get; set; } + + public int PlannedDuration { get; set; } + public int ActualDuration { get; set; } + + public string PerformedBy { get; set; } + public DateTime? CompletedAt { get; set; } + public string Notes { get; set; } + +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderMaterial.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderMaterial.cs new file mode 100644 index 00000000..14b24f85 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderMaterial.cs @@ -0,0 +1,23 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MaintenanceWorkorderMaterial : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid WorkOrderId { get; set; } + public MaintenanceWorkorder WorkOrder { get; set; } + + public Guid MaterialId { get; set; } + public Material Material { get; set; } + + public int PlannedQuantity { get; set; } + public int ActualQuantity { get; set; } + + public int UnitCost { get; set; } + public int TotalCost { get; set; } + +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderStatus.cs new file mode 100644 index 00000000..c1792aac --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderStatus.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 MaintenanceWorkorderStatus : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Workorders { get; set; } +} + diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderType.cs new file mode 100644 index 00000000..51032355 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/MaintenanceWorkorderType.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MaintenanceWorkorderType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } + + public ICollection Workorders { get; set; } +} + diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs index a8733334..be30eb9c 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs @@ -1,7 +1,6 @@ // Domain/Entities/PmWorkCenter.cs using System; using System.Collections.Generic; -using Erp.Platform.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkcenterType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkcenterType.cs index b8c1906f..faf3a30b 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkcenterType.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkcenterType.cs @@ -9,7 +9,6 @@ public class WorkcenterType : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } - public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } public bool IsActive { get; set; } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 5e49476c..dac7d8e2 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -239,6 +239,9 @@ public class PlatformDbContext : public DbSet Faults { get; set; } public DbSet FaultStatuses { get; set; } public DbSet FaultTypes { get; set; } + public DbSet WorkorderTypes { get; set; } + public DbSet WorkorderStatuses { get; set; } + public DbSet Workorders { get; set; } #endregion public PlatformDbContext(DbContextOptions options) @@ -2835,5 +2838,25 @@ public class PlatformDbContext : b.Property(x => x.Description).HasMaxLength(500); b.Property(x => x.IsActive).HasDefaultValue(true); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkorderType)), 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.WorkorderStatus)), 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/20251121142619_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.Designer.cs similarity index 97% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121142619_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.Designer.cs index cf3a6f83..07a659d7 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121142619_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251121142619_Initial")] + [Migration("20251123181533_Initial")] partial class Initial { /// @@ -6372,6 +6372,364 @@ namespace Erp.Platform.Migrations b.ToTable("Mnt_T_PlanMaterial", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualCost") + .HasColumnType("int"); + + b.Property("ActualEnd") + .HasColumnType("datetime2"); + + b.Property("ActualStart") + .HasColumnType("datetime2"); + + b.Property("AssignedTo") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletionNotes") + .HasColumnType("nvarchar(max)"); + + 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("EstimatedCost") + .HasColumnType("int"); + + 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("MaintenanceTeamId") + .HasColumnType("nvarchar(max)"); + + b.Property("MaintenanceWorkorderStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlanId") + .HasColumnType("uniqueidentifier"); + + b.Property("Priority") + .HasColumnType("nvarchar(max)"); + + b.Property("ScheduledEnd") + .HasColumnType("datetime2"); + + b.Property("ScheduledStart") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkcenterId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkorderNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("MaintenanceWorkorderStatusId"); + + b.HasIndex("OrderTypeId"); + + b.HasIndex("PlanId"); + + b.HasIndex("WorkcenterId"); + + b.ToTable("Workorders"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderActivity", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("ActualDuration") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetime2"); + + 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("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("PerformedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("PlannedDuration") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkOrderId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WorkOrderId"); + + b.ToTable("MaintenanceWorkorderActivity"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderMaterial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualQuantity") + .HasColumnType("int"); + + 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("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlannedQuantity") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalCost") + .HasColumnType("int"); + + b.Property("UnitCost") + .HasColumnType("int"); + + b.Property("WorkOrderId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("WorkOrderId"); + + b.ToTable("MaintenanceWorkorderMaterial"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderStatus", 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_WorkorderStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + 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_WorkorderType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.Property("Id") @@ -11834,9 +12192,6 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Code") - .HasColumnType("nvarchar(max)"); - b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); @@ -14663,6 +15018,65 @@ namespace Erp.Platform.Migrations b.Navigation("MaintenancePlan"); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorderStatus", null) + .WithMany("Workorders") + .HasForeignKey("MaintenanceWorkorderStatusId"); + + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorderType", "OrderType") + .WithMany("Workorders") + .HasForeignKey("OrderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.MaintenancePlan", "Plan") + .WithMany() + .HasForeignKey("PlanId"); + + b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter") + .WithMany() + .HasForeignKey("WorkcenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrderType"); + + b.Navigation("Plan"); + + b.Navigation("Workcenter"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderActivity", b => + { + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorder", "WorkOrder") + .WithMany("Activities") + .HasForeignKey("WorkOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkOrder"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderMaterial", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorder", "WorkOrder") + .WithMany("Materials") + .HasForeignKey("WorkOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("WorkOrder"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.HasOne("Erp.Platform.Entities.Currency", "Currency") @@ -15652,6 +16066,23 @@ namespace Erp.Platform.Migrations b.Navigation("Materials"); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.Navigation("Activities"); + + b.Navigation("Materials"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderStatus", b => + { + b.Navigation("Workorders"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderType", b => + { + b.Navigation("Workorders"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.Navigation("AlternativeUoms"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121142619_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.cs similarity index 97% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121142619_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.cs index 526b7e3a..a9f1e16b 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251121142619_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251123181533_Initial.cs @@ -1348,7 +1348,6 @@ namespace Erp.Platform.Migrations { Id = table.Column(type: "uniqueidentifier", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: true), - Code = table.Column(type: "nvarchar(max)", 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), @@ -1365,6 +1364,51 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Mnt_T_WorkcenterType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Mnt_T_WorkorderStatus", + 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_WorkorderStatus", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Mnt_T_WorkorderType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(max)", 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_WorkorderType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Net_T_EventCategory", columns: table => new @@ -5616,6 +5660,65 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Workorders", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + WorkorderNumber = table.Column(type: "nvarchar(max)", nullable: true), + WorkcenterId = table.Column(type: "uniqueidentifier", nullable: false), + PlanId = table.Column(type: "uniqueidentifier", nullable: true), + OrderTypeId = table.Column(type: "uniqueidentifier", nullable: false), + Priority = table.Column(type: "nvarchar(max)", nullable: true), + Status = table.Column(type: "nvarchar(max)", nullable: true), + Description = table.Column(type: "nvarchar(max)", nullable: true), + AssignedTo = table.Column(type: "nvarchar(max)", nullable: true), + MaintenanceTeamId = table.Column(type: "nvarchar(max)", nullable: true), + ScheduledStart = table.Column(type: "datetime2", nullable: true), + ScheduledEnd = table.Column(type: "datetime2", nullable: true), + ActualStart = table.Column(type: "datetime2", nullable: true), + ActualEnd = table.Column(type: "datetime2", nullable: true), + EstimatedCost = table.Column(type: "int", nullable: false), + ActualCost = table.Column(type: "int", nullable: false), + Notes = table.Column(type: "nvarchar(max)", nullable: true), + CompletionNotes = table.Column(type: "nvarchar(max)", nullable: true), + MaintenanceWorkorderStatusId = table.Column(type: "uniqueidentifier", 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_Workorders", x => x.Id); + table.ForeignKey( + name: "FK_Workorders_Mnt_T_Plan_PlanId", + column: x => x.PlanId, + principalTable: "Mnt_T_Plan", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Workorders_Mnt_T_Workcenter_WorkcenterId", + column: x => x.WorkcenterId, + principalTable: "Mnt_T_Workcenter", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Workorders_Mnt_T_WorkorderStatus_MaintenanceWorkorderStatusId", + column: x => x.MaintenanceWorkorderStatusId, + principalTable: "Mnt_T_WorkorderStatus", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Workorders_Mnt_T_WorkorderType_OrderTypeId", + column: x => x.OrderTypeId, + principalTable: "Mnt_T_WorkorderType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Hr_T_SurveyAnswer", columns: table => new @@ -5880,6 +5983,75 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "MaintenanceWorkorderActivity", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + WorkOrderId = table.Column(type: "uniqueidentifier", nullable: false), + ActivityDescription = table.Column(type: "nvarchar(max)", nullable: true), + PlannedDuration = table.Column(type: "int", nullable: false), + ActualDuration = table.Column(type: "int", nullable: false), + PerformedBy = table.Column(type: "nvarchar(max)", nullable: true), + CompletedAt = table.Column(type: "datetime2", nullable: true), + Notes = 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_MaintenanceWorkorderActivity", x => x.Id); + table.ForeignKey( + name: "FK_MaintenanceWorkorderActivity_Workorders_WorkOrderId", + column: x => x.WorkOrderId, + principalTable: "Workorders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "MaintenanceWorkorderMaterial", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + WorkOrderId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + PlannedQuantity = table.Column(type: "int", nullable: false), + ActualQuantity = table.Column(type: "int", nullable: false), + UnitCost = table.Column(type: "int", nullable: false), + TotalCost = table.Column(type: "int", nullable: false), + 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_MaintenanceWorkorderMaterial", x => x.Id); + table.ForeignKey( + name: "FK_MaintenanceWorkorderMaterial_Scp_T_Material_MaterialId", + column: x => x.MaterialId, + principalTable: "Scp_T_Material", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_MaintenanceWorkorderMaterial_Workorders_WorkOrderId", + column: x => x.WorkOrderId, + principalTable: "Workorders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Net_T_SocialPollOption", columns: table => new @@ -6538,6 +6710,21 @@ namespace Erp.Platform.Migrations table: "Hr_T_SurveyResponse", column: "SurveyId"); + migrationBuilder.CreateIndex( + name: "IX_MaintenanceWorkorderActivity_WorkOrderId", + table: "MaintenanceWorkorderActivity", + column: "WorkOrderId"); + + migrationBuilder.CreateIndex( + name: "IX_MaintenanceWorkorderMaterial_MaterialId", + table: "MaintenanceWorkorderMaterial", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_MaintenanceWorkorderMaterial_WorkOrderId", + table: "MaintenanceWorkorderMaterial", + column: "WorkOrderId"); + migrationBuilder.CreateIndex( name: "IX_Mnt_T_Fault_FaultStatusId", table: "Mnt_T_Fault", @@ -6969,6 +7156,26 @@ namespace Erp.Platform.Migrations table: "Scp_T_RequestItem", column: "UomId"); + migrationBuilder.CreateIndex( + name: "IX_Workorders_MaintenanceWorkorderStatusId", + table: "Workorders", + column: "MaintenanceWorkorderStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Workorders_OrderTypeId", + table: "Workorders", + column: "OrderTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_Workorders_PlanId", + table: "Workorders", + column: "PlanId"); + + migrationBuilder.CreateIndex( + name: "IX_Workorders_WorkcenterId", + table: "Workorders", + column: "WorkcenterId"); + migrationBuilder.AddForeignKey( name: "FK_Adm_T_BlogPost_Hr_T_Employee_EmployeeId", table: "Adm_T_BlogPost", @@ -7276,6 +7483,12 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Hr_T_SurveyQuestionOption"); + migrationBuilder.DropTable( + name: "MaintenanceWorkorderActivity"); + + migrationBuilder.DropTable( + name: "MaintenanceWorkorderMaterial"); + migrationBuilder.DropTable( name: "Mnt_T_Fault"); @@ -7495,15 +7708,15 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Hr_T_SurveyQuestion"); + migrationBuilder.DropTable( + name: "Workorders"); + migrationBuilder.DropTable( name: "Mnt_T_FaultStatus"); migrationBuilder.DropTable( name: "Mnt_T_FaultType"); - migrationBuilder.DropTable( - name: "Mnt_T_Plan"); - migrationBuilder.DropTable( name: "Net_T_Training"); @@ -7586,7 +7799,13 @@ namespace Erp.Platform.Migrations name: "Hr_T_Survey"); migrationBuilder.DropTable( - name: "Mnt_T_Workcenter"); + name: "Mnt_T_Plan"); + + migrationBuilder.DropTable( + name: "Mnt_T_WorkorderStatus"); + + migrationBuilder.DropTable( + name: "Mnt_T_WorkorderType"); migrationBuilder.DropTable( name: "Net_T_EventCategory"); @@ -7621,15 +7840,18 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Sas_T_Branch"); + migrationBuilder.DropTable( + name: "Mnt_T_Workcenter"); + + migrationBuilder.DropTable( + name: "Sas_H_CountryGroup"); + migrationBuilder.DropTable( name: "Mnt_T_WorkcenterStatus"); migrationBuilder.DropTable( name: "Mnt_T_WorkcenterType"); - migrationBuilder.DropTable( - name: "Sas_H_CountryGroup"); - migrationBuilder.DropTable( name: "Acc_T_Bank"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 306fed38..d13fe02b 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -6369,6 +6369,364 @@ namespace Erp.Platform.Migrations b.ToTable("Mnt_T_PlanMaterial", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualCost") + .HasColumnType("int"); + + b.Property("ActualEnd") + .HasColumnType("datetime2"); + + b.Property("ActualStart") + .HasColumnType("datetime2"); + + b.Property("AssignedTo") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletionNotes") + .HasColumnType("nvarchar(max)"); + + 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("EstimatedCost") + .HasColumnType("int"); + + 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("MaintenanceTeamId") + .HasColumnType("nvarchar(max)"); + + b.Property("MaintenanceWorkorderStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlanId") + .HasColumnType("uniqueidentifier"); + + b.Property("Priority") + .HasColumnType("nvarchar(max)"); + + b.Property("ScheduledEnd") + .HasColumnType("datetime2"); + + b.Property("ScheduledStart") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkcenterId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkorderNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("MaintenanceWorkorderStatusId"); + + b.HasIndex("OrderTypeId"); + + b.HasIndex("PlanId"); + + b.HasIndex("WorkcenterId"); + + b.ToTable("Workorders"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderActivity", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("ActualDuration") + .HasColumnType("int"); + + b.Property("CompletedAt") + .HasColumnType("datetime2"); + + 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("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("PerformedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("PlannedDuration") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkOrderId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WorkOrderId"); + + b.ToTable("MaintenanceWorkorderActivity"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderMaterial", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualQuantity") + .HasColumnType("int"); + + 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("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlannedQuantity") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalCost") + .HasColumnType("int"); + + b.Property("UnitCost") + .HasColumnType("int"); + + b.Property("WorkOrderId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("WorkOrderId"); + + b.ToTable("MaintenanceWorkorderMaterial"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderStatus", 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_WorkorderStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + 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_WorkorderType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.Property("Id") @@ -11831,9 +12189,6 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Code") - .HasColumnType("nvarchar(max)"); - b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); @@ -14660,6 +15015,65 @@ namespace Erp.Platform.Migrations b.Navigation("MaintenancePlan"); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorderStatus", null) + .WithMany("Workorders") + .HasForeignKey("MaintenanceWorkorderStatusId"); + + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorderType", "OrderType") + .WithMany("Workorders") + .HasForeignKey("OrderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.MaintenancePlan", "Plan") + .WithMany() + .HasForeignKey("PlanId"); + + b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter") + .WithMany() + .HasForeignKey("WorkcenterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrderType"); + + b.Navigation("Plan"); + + b.Navigation("Workcenter"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderActivity", b => + { + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorder", "WorkOrder") + .WithMany("Activities") + .HasForeignKey("WorkOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkOrder"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderMaterial", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.MaintenanceWorkorder", "WorkOrder") + .WithMany("Materials") + .HasForeignKey("WorkOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("WorkOrder"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.HasOne("Erp.Platform.Entities.Currency", "Currency") @@ -15649,6 +16063,23 @@ namespace Erp.Platform.Migrations b.Navigation("Materials"); }); + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorder", b => + { + b.Navigation("Activities"); + + b.Navigation("Materials"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderStatus", b => + { + b.Navigation("Workorders"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MaintenanceWorkorderType", b => + { + b.Navigation("Workorders"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Material", b => { b.Navigation("AlternativeUoms"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 2d67267f..d37aeded 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -100,7 +100,9 @@ "props": null, "description": null, "isActive": true, - "dependencies": ["DynamicEntityComponent"] + "dependencies": [ + "DynamicEntityComponent" + ] } ], "ReportCategories": [ @@ -2429,7 +2431,12 @@ "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", @@ -4124,7 +4131,9 @@ { "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": [ @@ -4831,25 +4840,21 @@ ], "WorkcenterTypes": [ { - "code": "CNC", "name": "CNC Makineleri", "description": "Bilgisayar kontrollü kesim ve şekillendirme makineleri", "isActive": true }, { - "code": "COMP", "name": "Kompresörler", "description": "Hava ve gaz sıkıştırma makineleri", "isActive": true }, { - "code": "CONV", "name": "Konveyörler", "description": "Malzeme taşıma sistemleri", "isActive": true }, { - "code": "WELD", "name": "Kaynak Makineleri", "description": "Metal parçaların birleştirilmesi için kullanılan makineler", "isActive": true @@ -4882,7 +4887,7 @@ "code": "CNC-001", "name": "CNC Torna Tezgahı", "description": "Yüksek hassasiyetli CNC torna tezgahı", - "workcenterTypeCode": "CNC", + "workcenterTypeName": "CNC Makineleri", "manufacturer": "HAAS Automation", "model": "ST-30", "serialNumber": "SN123456789", @@ -4901,7 +4906,7 @@ "code": "COMP-001", "name": "Hava Kompresörü", "description": "Endüstriyel hava kompresörü sistemi", - "workcenterTypeCode": "COMP", + "workcenterTypeName": "Kompresörler", "manufacturer": "Atlas Copco", "model": "GA55VSD+", "serialNumber": "AC987654321", @@ -4920,7 +4925,7 @@ "code": "CONV-001", "name": "Konveyör Sistemi", "description": "Ana hat konveyör sistemi", - "workcenterTypeCode": "CONV", + "workcenterTypeName": "Konveyörler", "manufacturer": "Siemens", "model": "SIMATIC S7-1500", "serialNumber": "SM112233445", @@ -5139,5 +5144,69 @@ "description": "Arıza giderildi ve kayıt kapatıldı", "isActive": true } + ], + "WorkorderTypes": [ + { + "name": "Önleyici", + "description": "Planlı bakım ve kontroller için yapılan iş emri türü", + "isActive": true + }, + { + "name": "Düzeltici", + "description": "Arızaların önlenmesi için yapılan rutin bakım türü", + "isActive": true + }, + { + "name": "Acil", + "description": "Acil durumlarda hızlı müdahale gerektiren bakım türü", + "isActive": true + }, + { + "name": "Denetim", + "description": "Periyodik denetim ve kontrol işlemleri için yapılan iş emri türü", + "isActive": true + }, + { + "name": "Kalibrasyon", + "description": "Ekipman kalibrasyonu ve ayarları için yapılan iş emri türü", + "isActive": true + } + ], + "WorkorderStatuses": [ + { + "name": "Oluşturuldu", + "description": "İş emri oluşturuldu ancak henüz başlatılmadı", + "isActive": true + }, + { + "name": "Planlandı", + "description": "İş emri planlandı ve atama bekliyor", + "isActive": true + }, + { + "name": "Serbest Bırakıldı", + "description": "İş emri serbest bırakıldı ve çalışmaya hazır", + "isActive": true + }, + { + "name": "Devam Ediyor", + "description": "İş emri devam ediyor ve çalışmalar sürüyor", + "isActive": true + }, + { + "name": "Beklemede", + "description": "İş emri beklemede ve işlem yapılmayı bekliyor", + "isActive": true + }, + { + "name": "Tamamlandı", + "description": "İş emri tamamlandı ve işlem sona erdi", + "isActive": true + }, + { + "name": "İptal Edildi", + "description": "İş emri iptal edildi ve işlem sona erdi", + "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 fc3b08bd..d7b2f4f7 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -113,6 +113,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _faultRepository; private readonly IRepository _faultStatusRepository; private readonly IRepository _faultTypeRepository; + private readonly IRepository _workorderTypeRepository; + private readonly IRepository _workorderStatusRepository; public TenantDataSeeder( IClock clock, @@ -208,7 +210,9 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository maintenancePlanRepository, IRepository faultRepository, IRepository faultStatusRepository, - IRepository faultTypeRepository + IRepository faultTypeRepository, + IRepository workorderTypeRepository, + IRepository workorderStatusRepository ) { _clock = clock; @@ -306,6 +310,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _faultRepository = faultRepository; _faultStatusRepository = faultStatusRepository; _faultTypeRepository = faultTypeRepository; + _workorderTypeRepository = workorderTypeRepository; + _workorderStatusRepository = workorderStatusRepository; } private static IConfigurationRoot BuildConfiguration() @@ -1935,13 +1941,12 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency foreach (var item in items.WorkcenterTypes) { - var exists = await _workcenterTypeRepository.AnyAsync(x => x.Code == item.Code); + var exists = await _workcenterTypeRepository.AnyAsync(x => x.Name == item.Name); if (exists) continue; await _workcenterTypeRepository.InsertAsync(new WorkcenterType { - Code = item.Code, Name = item.Name, Description = item.Description, IsActive = item.IsActive @@ -1969,7 +1974,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency continue; var department = await _departmentRepository.FirstOrDefaultAsync(x => x.Code == item.DepartmentCode); - var workcenterType = await _workcenterTypeRepository.FirstOrDefaultAsync(x => x.Code == item.WorkcenterTypeCode); + var workcenterType = await _workcenterTypeRepository.FirstOrDefaultAsync(x => x.Name == item.WorkcenterTypeName); await _workcenterRepository.InsertAsync(new Workcenter { @@ -2075,6 +2080,34 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive, }, autoSave: true); } + + foreach (var item in items.WorkorderTypes) + { + var exists = await _workorderTypeRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _workorderTypeRepository.InsertAsync(new MaintenanceWorkorderType + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.WorkorderStatuses) + { + var exists = await _workorderStatusRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _workorderStatusRepository.InsertAsync(new MaintenanceWorkorderStatus + { + Name = item.Name, + Description = item.Description, + 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 f575cabb..47329d60 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -105,6 +105,22 @@ public class TenantSeederDto public List Faults { get; set; } public List FaultStatuses { get; set; } public List FaultTypes { get; set; } + public List WorkorderTypes { get; set; } + public List WorkorderStatuses { get; set; } +} + +public class WorkorderTypeSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + +public class WorkorderStatusSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } } public class FaultSeedDto @@ -161,7 +177,7 @@ public class WorkcenterSeedDto public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } - public string WorkcenterTypeCode { get; set; } + public string WorkcenterTypeName { get; set; } public string Manufacturer { get; set; } public string Model { get; set; } public string SerialNumber { get; set; } diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 1acfe6ff..aea0570a 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -30,24 +30,27 @@ export default defineConfig(async ({ mode }) => { type: 'module', // Modern module worker kullan }, - workbox: { - // Büyük asset'leri de cache'leyebil - maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, + workbox: + mode === 'production' + ? { + globDirectory: 'dist', + globPatterns: ['**/*.{js,css,html,wasm}'], - // EN KRİTİK: yeni SW beklemeden kontrolü alsın - clientsClaim: true, - skipWaiting: true, + // Büyük asset'leri de cache'leyebil + maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, - // Eski workbox cache'lerini temizle - cleanupOutdatedCaches: true, + // EN KRİTİK: yeni SW beklemeden kontrolü alsın + clientsClaim: true, + skipWaiting: true, - // SPA fallback'i API çağrılarına uygulama - navigateFallbackDenylist: [/^\/api\//], + // Eski workbox cache'lerini temizle + cleanupOutdatedCaches: true, - // ⭐⭐ BU KISMI EKLEYİN: Cache sorununu çözecek runtime caching - runtimeCaching: - mode === 'production' - ? [ + // SPA fallback'i API çağrılarına uygulama + navigateFallbackDenylist: [/^\/api\//], + + // ⭐⭐ BU KISMI EKLEYİN: Cache sorununu çözecek runtime caching + runtimeCaching: [ { urlPattern: /\.(?:js|css|json)$/, handler: 'NetworkFirst', @@ -74,13 +77,13 @@ export default defineConfig(async ({ mode }) => { }, }, }, - ] - : [], + ], - // ⭐ YENİ EKLENEN: Additional navigation route for SPA - navigateFallback: '/index.html', - navigateFallbackAllowlist: [/^(?!\/__).*/], - }, + // ⭐ YENİ EKLENEN: Additional navigation route for SPA + navigateFallback: '/index.html', + navigateFallbackAllowlist: [/^(?!\/__).*/], + } + : undefined, manifest: { name: 'Erp Platform',