From a36ad54acaa85e80c9ebd0cb454b4531319dafb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Thu, 4 Dec 2025 23:27:46 +0300 Subject: [PATCH] Store Seeder MovementItem ve Inventory --- .../Seeds/LanguagesData.json | 20 +- .../Seeds/ListFormSeeder_Store.cs | 840 +++++++++++++++++- .../Seeds/MenusData.json | 30 +- .../Seeds/PermissionsData.json | 167 +++- .../Enums/TableNameEnum.cs | 7 +- .../TableNameResolver.cs | 7 +- .../Erp.Platform.Domain/Data/SeedConsts.cs | 5 + .../Entities/Tenant/Store/Inventory.cs | 27 + .../Entities/Tenant/Store/Location.cs | 3 + .../Entities/Tenant/Store/Movement.cs | 20 + .../Entities/Tenant/Store/MovementItem.cs | 33 + .../Entities/Tenant/Store/MovementType.cs | 14 + .../Entities/Tenant/Store/ReferenceType.cs | 14 + .../Entities/Tenant/Store/Warehouse.cs | 3 + .../Entities/Tenant/Store/Zone.cs | 2 + .../Entities/Tenant/SupplyChain/Material.cs | 1 + .../EntityFrameworkCore/PlatformDbContext.cs | 110 +++ ....cs => 20251204192908_Initial.Designer.cs} | 434 ++++++++- ...8_Initial.cs => 20251204192908_Initial.cs} | 212 ++++- .../PlatformDbContextModelSnapshot.cs | 432 +++++++++ .../Tenants/Seeds/TenantData.json | 212 ++++- .../Tenants/TenantDataSeeder.cs | 123 ++- .../Tenants/TenantDatabaseViewCreator.cs | 62 +- .../Tenants/TenantSeederDto.cs | 65 ++ 24 files changed, 2785 insertions(+), 58 deletions(-) create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/Inventory.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/Movement.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementItem.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementType.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/ReferenceType.cs rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251204142238_Initial.Designer.cs => 20251204192908_Initial.Designer.cs} (97%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251204142238_Initial.cs => 20251204192908_Initial.cs} (97%) diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index 254f8fae..7d4d0f02 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9729,10 +9729,28 @@ }, { "resourceName": "Platform", - "key": "App.Store.Movements", + "key": "App.Store.MovementType", + "tr": "Hareket Türleri", + "en": "Movement Types" + }, + { + "resourceName": "Platform", + "key": "App.Store.ReferenceType", + "tr": "Referans Türleri", + "en": "Reference Types" + }, + { + "resourceName": "Platform", + "key": "App.Store.MovementItem", "tr": "Stok Hareketleri", "en": "Stock Movements" }, + { + "resourceName": "Platform", + "key": "App.Store.MovementItem", + "tr": "Stok Hareket Ürünleri", + "en": "Stock Movement Items" + }, { "resourceName": "Platform", "key": "App.Project.Definitions", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs index efcb2ddc..ea3ce733 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs @@ -53,7 +53,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -193,7 +194,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -333,7 +335,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -473,7 +476,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -851,7 +855,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -1064,7 +1069,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -1337,7 +1343,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -1646,7 +1653,8 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -1802,5 +1810,821 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen } }) ); + + #region Inventory + listFormName = AppCodes.Store.Inventory; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Inventory)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(listFormName), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Inventory)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, false, false, false, false, false), + } + ); + + #region Inventory 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.Guid, + FieldName = "MaterialId", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Material), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "WarehouseId", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Warehouse), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ZoneId", + Width = 150, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Zone), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "LocationId", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Location), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Quantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 6, + 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.Decimal, + FieldName = "ReservedQuantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 7, + 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.Decimal, + FieldName = "AvailableQuantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 8, + 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 = "Uom", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Uom), "Name", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "LotNumber", + Width = 200, + 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.String, + FieldName = "SerialNumber", + Width = 200, + ListOrderNo = 11, + 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.Date, + FieldName = "ExpiryDate", + Width = 100, + ListOrderNo = 12, + 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.Date, + FieldName = "ReceivedDate", + Width = 100, + ListOrderNo = 13, + 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.Date, + FieldName = "LastMovementDate", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Movement Type + listFormName = AppCodes.Store.MovementType; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MovementType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(listFormName), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MovementType)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 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 Movement 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 Reference Type + listFormName = AppCodes.Store.ReferenceType; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ReferenceType)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(listFormName), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.ReferenceType)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 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 Reference 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 Movement Item + listFormName = AppCodes.Store.MovementItem; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullViewName(nameof(TableNameEnum.MovementItem)), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = DefaultFilterJson, + SortMode = GridOptions.SortModeSingle, + FilterRowJson = DefaultFilterRowJson, + HeaderFilterJson = DefaultHeaderFilterJson, + SearchPanelJson = DefaultSearchPanelJson, + GroupPanelJson = DefaultGroupPanelJson, + SelectionJson = DefaultSelectionSingleJson, + ColumnOptionJson = DefaultColumnOptionJson, + PermissionJson = DefaultPermissionJson(listFormName), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MovementItem)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 250, false, false, false, false, false), + } + ); + + #region Movement Item 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 = "MovementNumber", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderDesc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Date, + FieldName = "MovementDate", + Width = 100, + 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 = "MovementType", + Width = 100, + 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.String, + FieldName = "ReferenceType", + Width = 100, + ListOrderNo = 5, + 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 = "ReferenceDocument", + Width = 150, + ListOrderNo = 6, + 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 = "WarehouseId", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Warehouse), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ZoneId", + Width = 200, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Zone), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "LocationId", + Width = 200, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Location), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "MaterialId", + Width = 200, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Material), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Quantity", + Format = "fixedPoint", + Alignment = "right", + Width = 200, + ListOrderNo = 11, + 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 = "Uom", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Uom), "Name", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "LotNumber", + Width = 100, + ListOrderNo = 13, + 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 = "SerialNumber", + Width = 100, + ListOrderNo = 14, + 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 = "MainDescription", + Width = 400, + ListOrderNo = 15, + 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 = 400, + ListOrderNo = 16, + 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 f522a601..35805f33 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -2658,6 +2658,26 @@ "RequiredPermissionName": "App.Store.Putaway", "IsDisabled": false }, + { + "ParentCode": "App.Store.Definitions", + "Code": "App.Store.MovementType", + "DisplayName": "App.Store.MovementType", + "Order": 10, + "Url": "/admin/list/App.Store.MovementType", + "Icon": "FcFlowChart", + "RequiredPermissionName": "App.Store.MovementType", + "IsDisabled": false + }, + { + "ParentCode": "App.Store.Definitions", + "Code": "App.Store.ReferenceType", + "DisplayName": "App.Store.ReferenceType", + "Order": 11, + "Url": "/admin/list/App.Store.ReferenceType", + "Icon": "FcDocument", + "RequiredPermissionName": "App.Store.ReferenceType", + "IsDisabled": false + }, { "ParentCode": "App.Store", "Code": "App.Store.Receipt", @@ -2693,19 +2713,19 @@ "Code": "App.Store.Inventory", "DisplayName": "App.Store.Inventory", "Order": 13, - "Url": "/admin/warehouse/inventory", + "Url": "/admin/list/App.Store.Inventory", "Icon": "FcInspection", "RequiredPermissionName": "App.Store.Inventory", "IsDisabled": false }, { "ParentCode": "App.Store", - "Code": "App.Store.Movements", - "DisplayName": "App.Store.Movements", + "Code": "App.Store.MovementItem", + "DisplayName": "App.Store.MovementItem", "Order": 14, - "Url": "/admin/warehouse/movements", + "Url": "/admin/list/App.Store.MovementItem", "Icon": "FcParallelTasks", - "RequiredPermissionName": "App.Store.Movements", + "RequiredPermissionName": "App.Store.MovementItem", "IsDisabled": false }, { diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index 74540375..2d802df1 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -6115,7 +6115,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.OrderStatus", @@ -6179,7 +6178,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.Material", @@ -6810,7 +6808,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.PurchaseOrderItem", @@ -6874,7 +6871,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.Delivery", @@ -7505,7 +7501,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Maintenance", "Name": "App.Maintenance.Workorder", @@ -7569,7 +7564,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Maintenance", "Name": "App.Maintenance.WorkorderMaterial", @@ -7633,7 +7627,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Maintenance", "Name": "App.Maintenance.WorkorderActivity", @@ -7697,7 +7690,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Store", "Name": "App.Store.WarehouseType", @@ -8202,6 +8194,132 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType", + "ParentName": null, + "DisplayName": "App.Store.MovementType", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Create", + "ParentName": "App.Store.MovementType", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Update", + "ParentName": "App.Store.MovementType", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Delete", + "ParentName": "App.Store.MovementType", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Export", + "ParentName": "App.Store.MovementType", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Import", + "ParentName": "App.Store.MovementType", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.MovementType.Note", + "ParentName": "App.Store.MovementType", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType", + "ParentName": null, + "DisplayName": "App.Store.ReferenceType", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Create", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Update", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Delete", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Export", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Import", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.ReferenceType.Note", + "ParentName": "App.Store.ReferenceType", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, { "GroupName": "App.Store", "Name": "App.Store.Receipt", @@ -8456,17 +8574,17 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements", + "Name": "App.Store.MovementItem", "ParentName": null, - "DisplayName": "App.Store.Movements", + "DisplayName": "App.Store.MovementItem", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Create", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Create", + "ParentName": "App.Store.MovementItem", "DisplayName": "Create", "IsEnabled": true, "MultiTenancySide": 3, @@ -8474,8 +8592,8 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Update", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Update", + "ParentName": "App.Store.MovementItem", "DisplayName": "Update", "IsEnabled": true, "MultiTenancySide": 3, @@ -8483,8 +8601,8 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Delete", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Delete", + "ParentName": "App.Store.MovementItem", "DisplayName": "Delete", "IsEnabled": true, "MultiTenancySide": 3, @@ -8492,8 +8610,8 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Export", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Export", + "ParentName": "App.Store.MovementItem", "DisplayName": "Export", "IsEnabled": true, "MultiTenancySide": 3, @@ -8501,8 +8619,8 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Import", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Import", + "ParentName": "App.Store.MovementItem", "DisplayName": "Import", "IsEnabled": true, "MultiTenancySide": 3, @@ -8510,8 +8628,8 @@ }, { "GroupName": "App.Store", - "Name": "App.Store.Movements.Note", - "ParentName": "App.Store.Movements", + "Name": "App.Store.MovementItem.Note", + "ParentName": "App.Store.MovementItem", "DisplayName": "Note", "IsEnabled": true, "MultiTenancySide": 3, @@ -11856,7 +11974,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Crm", "Name": "App.Crm.SalesOrder", @@ -11920,7 +12037,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Crm", "Name": "App.Crm.SalesOrderItem", @@ -11984,7 +12100,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { "GroupName": "App.Mrp", "Name": "App.Mrp.OperationCategory", @@ -13498,4 +13613,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 8b34bd37..7153004b 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -211,5 +211,10 @@ public enum TableNameEnum PurchaseOrderItem, SalesOrderStatus, SalesOrder, - SalesOrderItem + SalesOrderItem, + Inventory, + Movement, + MovementItem, + MovementType, + ReferenceType } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index d341faf1..51e7c27f 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -143,7 +143,7 @@ public static class TableNameResolver { nameof(TableNameEnum.SurveyAnswer), (TablePrefix.TenantByName, MenuPrefix.Hr) }, { nameof(TableNameEnum.SurveyResponse), (TablePrefix.TenantByName, MenuPrefix.Hr) }, - // 🔹 Intranet + // 🔹 INTRANET { nameof(TableNameEnum.EventCategory), (TablePrefix.TenantByName, MenuPrefix.Intranet) }, { nameof(TableNameEnum.EventType), (TablePrefix.TenantByName, MenuPrefix.Intranet) }, { nameof(TableNameEnum.Event), (TablePrefix.TenantByName, MenuPrefix.Intranet) }, @@ -228,6 +228,11 @@ public static class TableNameResolver { nameof(TableNameEnum.Location), (TablePrefix.TenantByName, MenuPrefix.Store) }, { nameof(TableNameEnum.Putaway), (TablePrefix.TenantByName, MenuPrefix.Store) }, { nameof(TableNameEnum.PutawayCondition), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.Inventory), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.Movement), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.MovementItem), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.MovementType), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.ReferenceType), (TablePrefix.TenantByName, MenuPrefix.Store) }, // 🔹 MRP { nameof(TableNameEnum.OperationCategory), (TablePrefix.TenantByName, MenuPrefix.Mrp) }, diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index eff100ee..9a646567 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -580,6 +580,11 @@ public static class SeedConsts public const string Location = Default + ".Location"; public const string Putaway = Default + ".Putaway"; public const string PutawayCondition = Default + ".PutawayCondition"; + public const string Inventory = Default + ".Inventory"; + public const string ReferenceType = Default + ".ReferenceType"; + public const string MovementType = Default + ".MovementType"; + public const string Movement = Default + ".Movement"; + public const string MovementItem = Default + ".MovementItem"; } public static class Project diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Inventory.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Inventory.cs new file mode 100644 index 00000000..3456b7d0 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Inventory.cs @@ -0,0 +1,27 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class Inventory : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid? MaterialId { get; set; } + public Guid? WarehouseId { get; set; } + public Guid? ZoneId { get; set; } + public Guid? LocationId { get; set; } + + public decimal Quantity { get; set; } + public decimal ReservedQuantity { get; set; } + public decimal AvailableQuantity { get; set; } + + public string Uom { get; set; } + public string LotNumber { get; set; } + public string SerialNumber { get; set; } + + public DateTime? ExpiryDate { get; set; } + public DateTime ReceivedDate { get; set; } + public DateTime LastMovementDate { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs index 19c4e9d6..3dad3119 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; @@ -28,4 +29,6 @@ public class Location : FullAuditedEntity, IMultiTenant public string Uom { get; set; } public bool IsActive { get; set; } + + public ICollection MovementItems { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Movement.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Movement.cs new file mode 100644 index 00000000..4ca72ebe --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Movement.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class Movement : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string MovementNumber { get; set; } + public DateTime MovementDate { get; set; } + public string MovementType { get; set; } // e.g., Inbound, Outbound, Transfer + public string ReferenceType { get; set; } // e.g., Sales Order, Purchase Order + public string ReferenceDocument { get; set; } + public string Description { get; set; } + + public ICollection MovementItems { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementItem.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementItem.cs new file mode 100644 index 00000000..ac680547 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementItem.cs @@ -0,0 +1,33 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MovementItem : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid? MovementId { get; set; } + public Movement? Movement { get; set; } + + public Guid? WarehouseId { get; set; } + public Warehouse? Warehouse { get; set; } + + public Guid? ZoneId { get; set; } + public Zone? Zone { get; set; } + + public Guid? LocationId { get; set; } + public Location? Location { get; set; } + + public Guid? MaterialId { get; set; } + public Material? Material { get; set; } + + public decimal Quantity { get; set; } + + public string Uom { get; set; } + public string LotNumber { get; set; } + public string SerialNumber { get; set; } + + public string Description { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementType.cs new file mode 100644 index 00000000..e1067902 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/MovementType.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class MovementType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/ReferenceType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/ReferenceType.cs new file mode 100644 index 00000000..dc21c51f --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/ReferenceType.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class ReferenceType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs index e1bb9055..1703419f 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs @@ -32,4 +32,7 @@ public class Warehouse : FullAuditedEntity, IMultiTenant public ICollection Zones { get; set; } public ICollection Locations { get; set; } + + public ICollection MovementItems { get; set; } + } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs index a2850531..a477c59a 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs @@ -24,4 +24,6 @@ public class Zone : FullAuditedEntity, IMultiTenant public bool IsActive { get; set; } public ICollection Locations { get; set; } + + public ICollection MovementItems { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs index efa651a8..887aa1ba 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs @@ -36,5 +36,6 @@ public class Material : FullAuditedEntity, IMultiTenant public List QuotationItems { get; set; } public List PurchaseOrderItems { get; set; } public List SalesOrderItems { get; set; } + public List MovementItems { get; set; } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 82639c60..46fb4c9f 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -251,6 +251,11 @@ public class PlatformDbContext : public DbSet Locations { get; set; } public DbSet Putaways { get; set; } public DbSet PutawayConditions { get; set; } + public DbSet StockItems { get; set; } + public DbSet ReferenceTypes { get; set; } + public DbSet MovementTypes { get; set; } + public DbSet Movements { get; set; } + public DbSet MovementItems { get; set; } #endregion #region Maintenance @@ -3754,5 +3759,110 @@ public class PlatformDbContext : .HasForeignKey(x => x.SalesOrderId) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Inventory)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.MaterialId).IsRequired(); + b.Property(x => x.WarehouseId).IsRequired(); + b.Property(x => x.ZoneId).IsRequired(); + b.Property(x => x.LocationId).IsRequired(); + + b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.ReservedQuantity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.AvailableQuantity).HasPrecision(18, 2).HasDefaultValue(0); + + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); + b.Property(x => x.LotNumber).HasMaxLength(100); + b.Property(x => x.SerialNumber).HasMaxLength(100); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MovementType)), 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.ReferenceType)), 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.MovementType)), 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.Movement)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.MovementNumber).IsRequired().HasMaxLength(50); + b.Property(x => x.MovementDate).IsRequired(); + b.Property(x => x.MovementType).IsRequired().HasMaxLength(50); + b.Property(x => x.ReferenceType).HasMaxLength(100); + b.Property(x => x.ReferenceDocument).HasMaxLength(100); + b.Property(x => x.Description).HasMaxLength(1000); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MovementItem)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.MovementId).IsRequired(); + b.Property(x => x.MaterialId).IsRequired(); + b.Property(x => x.WarehouseId).IsRequired(); + b.Property(x => x.ZoneId).IsRequired(); + b.Property(x => x.LocationId).IsRequired(); + b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); + b.Property(x => x.LotNumber).HasMaxLength(100); + b.Property(x => x.SerialNumber).HasMaxLength(100); + b.Property(x => x.Description).HasMaxLength(1000); + + b.HasOne(x => x.Warehouse) + .WithMany(x => x.MovementItems) + .HasForeignKey(x => x.WarehouseId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Zone) + .WithMany(x => x.MovementItems) + .HasForeignKey(x => x.ZoneId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Location) + .WithMany(x => x.MovementItems) + .HasForeignKey(x => x.LocationId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Material) + .WithMany(x => x.MovementItems) + .HasForeignKey(x => x.MaterialId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Movement) + .WithMany(x => x.MovementItems) + .HasForeignKey(x => x.MovementId) + .OnDelete(DeleteBehavior.Restrict); + }); + } } \ No newline at end of file diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.Designer.cs similarity index 97% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.Designer.cs index 7704264f..c5db0512 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251204142238_Initial")] + [Migration("20251204192908_Initial")] partial class Initial { /// @@ -5587,6 +5587,102 @@ namespace Erp.Platform.Migrations b.ToTable("Prt_T_Interesting", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Inventory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AvailableQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + 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("ExpiryDate") + .HasColumnType("datetime2"); + + 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("LastMovementDate") + .HasColumnType("datetime2"); + + b.Property("LocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LotNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("ReceivedDate") + .HasColumnType("datetime2"); + + b.Property("ReservedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SerialNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.Property("ZoneId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Inventory", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.IpRestriction", b => { b.Property("Id") @@ -7571,6 +7667,225 @@ namespace Erp.Platform.Migrations b.ToTable("Sas_H_Menu", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Movement", 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(1000) + .HasColumnType("nvarchar(1000)"); + + 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("MovementDate") + .HasColumnType("datetime2"); + + b.Property("MovementNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MovementType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReferenceDocument") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReferenceType") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Movement", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MovementItem", 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(1000) + .HasColumnType("nvarchar(1000)"); + + 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("LocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LotNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("MovementId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SerialNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.Property("ZoneId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("MaterialId"); + + b.HasIndex("MovementId"); + + b.HasIndex("WarehouseId"); + + b.HasIndex("ZoneId"); + + b.ToTable("Str_T_MovementItem", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MovementType", 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("Str_T_MovementType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Note", b => { b.Property("Id") @@ -11119,6 +11434,64 @@ namespace Erp.Platform.Migrations b.ToTable("Scp_T_QuotationStatus", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.ReferenceType", 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("Str_T_ReferenceType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.RegistrationMethod", b => { b.Property("Id") @@ -18443,6 +18816,49 @@ namespace Erp.Platform.Migrations b.Navigation("Branch"); }); + modelBuilder.Entity("Erp.Platform.Entities.MovementItem", b => + { + b.HasOne("Erp.Platform.Entities.Location", "Location") + .WithMany("MovementItems") + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany("MovementItems") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Movement", "Movement") + .WithMany("MovementItems") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Warehouse", "Warehouse") + .WithMany("MovementItems") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Zone", "Zone") + .WithMany("MovementItems") + .HasForeignKey("ZoneId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Location"); + + b.Navigation("Material"); + + b.Navigation("Movement"); + + b.Navigation("Warehouse"); + + b.Navigation("Zone"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.HasOne("Erp.Platform.Entities.OperationType", "OperationType") @@ -19901,6 +20317,11 @@ namespace Erp.Platform.Migrations b.Navigation("Faults"); }); + modelBuilder.Entity("Erp.Platform.Entities.Location", b => + { + b.Navigation("MovementItems"); + }); + modelBuilder.Entity("Erp.Platform.Entities.LocationType", b => { b.Navigation("Locations"); @@ -19917,6 +20338,8 @@ namespace Erp.Platform.Migrations b.Navigation("Boms"); + b.Navigation("MovementItems"); + b.Navigation("PurchaseOrderItems"); b.Navigation("QuotationItems"); @@ -19946,6 +20369,11 @@ namespace Erp.Platform.Migrations b.Navigation("Materials"); }); + modelBuilder.Entity("Erp.Platform.Entities.Movement", b => + { + b.Navigation("MovementItems"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.Navigation("BomOperations"); @@ -20214,6 +20642,8 @@ namespace Erp.Platform.Migrations { b.Navigation("Locations"); + b.Navigation("MovementItems"); + b.Navigation("Zones"); }); @@ -20263,6 +20693,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Zone", b => { b.Navigation("Locations"); + + b.Navigation("MovementItems"); }); modelBuilder.Entity("Erp.Platform.Entities.ZoneType", b => diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.cs similarity index 97% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.cs index cd00391f..91b7cbd0 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204142238_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204192908_Initial.cs @@ -2864,6 +2864,38 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Scp_T_SupplyType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Str_T_Inventory", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + WarehouseId = table.Column(type: "uniqueidentifier", nullable: false), + ZoneId = table.Column(type: "uniqueidentifier", nullable: false), + LocationId = table.Column(type: "uniqueidentifier", nullable: false), + Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + ReservedQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + AvailableQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + LotNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + SerialNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExpiryDate = table.Column(type: "datetime2", nullable: true), + ReceivedDate = table.Column(type: "datetime2", nullable: false), + LastMovementDate = table.Column(type: "datetime2", 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_Str_T_Inventory", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Str_T_LocationType", columns: table => new @@ -2887,6 +2919,53 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Str_T_LocationType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Str_T_Movement", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + MovementNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + MovementDate = table.Column(type: "datetime2", nullable: false), + MovementType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ReferenceType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ReferenceDocument = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Str_T_Movement", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Str_T_MovementType", + 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_Str_T_MovementType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Str_T_Putaway", columns: table => new @@ -2917,6 +2996,28 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Str_T_Putaway", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Str_T_ReferenceType", + 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_Str_T_ReferenceType", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Str_T_WarehouseType", columns: table => new @@ -7212,6 +7313,65 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "Str_T_MovementItem", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + MovementId = table.Column(type: "uniqueidentifier", nullable: false), + WarehouseId = table.Column(type: "uniqueidentifier", nullable: false), + ZoneId = table.Column(type: "uniqueidentifier", nullable: false), + LocationId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + LotNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + SerialNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Str_T_MovementItem", x => x.Id); + table.ForeignKey( + name: "FK_Str_T_MovementItem_Scp_T_Material_MaterialId", + column: x => x.MaterialId, + principalTable: "Scp_T_Material", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Str_T_MovementItem_Str_T_Location_LocationId", + column: x => x.LocationId, + principalTable: "Str_T_Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Str_T_MovementItem_Str_T_Movement_MovementId", + column: x => x.MovementId, + principalTable: "Str_T_Movement", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Str_T_MovementItem_Str_T_Warehouse_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Str_T_Warehouse", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Str_T_MovementItem_Str_T_Zone_ZoneId", + column: x => x.ZoneId, + principalTable: "Str_T_Zone", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Prj_T_ProjectPhase", columns: table => new @@ -8896,6 +9056,31 @@ namespace Erp.Platform.Migrations table: "Str_T_Location", column: "ZoneId"); + migrationBuilder.CreateIndex( + name: "IX_Str_T_MovementItem_LocationId", + table: "Str_T_MovementItem", + column: "LocationId"); + + migrationBuilder.CreateIndex( + name: "IX_Str_T_MovementItem_MaterialId", + table: "Str_T_MovementItem", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Str_T_MovementItem_MovementId", + table: "Str_T_MovementItem", + column: "MovementId"); + + migrationBuilder.CreateIndex( + name: "IX_Str_T_MovementItem_WarehouseId", + table: "Str_T_MovementItem", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Str_T_MovementItem_ZoneId", + table: "Str_T_MovementItem", + column: "ZoneId"); + migrationBuilder.CreateIndex( name: "IX_Str_T_PutawayCondition_RuleId", table: "Str_T_PutawayCondition", @@ -9448,11 +9633,20 @@ namespace Erp.Platform.Migrations name: "Scp_T_RequestItem"); migrationBuilder.DropTable( - name: "Str_T_Location"); + name: "Str_T_Inventory"); + + migrationBuilder.DropTable( + name: "Str_T_MovementItem"); + + migrationBuilder.DropTable( + name: "Str_T_MovementType"); migrationBuilder.DropTable( name: "Str_T_PutawayCondition"); + migrationBuilder.DropTable( + name: "Str_T_ReferenceType"); + migrationBuilder.DropTable( name: "AbpEntityChanges"); @@ -9577,10 +9771,10 @@ namespace Erp.Platform.Migrations name: "Scp_T_PurchaseOrder"); migrationBuilder.DropTable( - name: "Str_T_LocationType"); + name: "Str_T_Location"); migrationBuilder.DropTable( - name: "Str_T_Zone"); + name: "Str_T_Movement"); migrationBuilder.DropTable( name: "Str_T_Putaway"); @@ -9658,10 +9852,10 @@ namespace Erp.Platform.Migrations name: "Scp_T_Request"); migrationBuilder.DropTable( - name: "Str_T_Warehouse"); + name: "Str_T_LocationType"); migrationBuilder.DropTable( - name: "Str_T_ZoneType"); + name: "Str_T_Zone"); migrationBuilder.DropTable( name: "Sas_T_Branch"); @@ -9688,7 +9882,10 @@ namespace Erp.Platform.Migrations name: "Scp_T_RequestType"); migrationBuilder.DropTable( - name: "Str_T_WarehouseType"); + name: "Str_T_Warehouse"); + + migrationBuilder.DropTable( + name: "Str_T_ZoneType"); migrationBuilder.DropTable( name: "Mnt_T_WorkcenterStatus"); @@ -9696,6 +9893,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Mnt_T_WorkcenterType"); + migrationBuilder.DropTable( + name: "Str_T_WarehouseType"); + 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 95f7db7b..163d0c74 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -5584,6 +5584,102 @@ namespace Erp.Platform.Migrations b.ToTable("Prt_T_Interesting", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Inventory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AvailableQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + 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("ExpiryDate") + .HasColumnType("datetime2"); + + 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("LastMovementDate") + .HasColumnType("datetime2"); + + b.Property("LocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LotNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("ReceivedDate") + .HasColumnType("datetime2"); + + b.Property("ReservedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SerialNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.Property("ZoneId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Inventory", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.IpRestriction", b => { b.Property("Id") @@ -7568,6 +7664,225 @@ namespace Erp.Platform.Migrations b.ToTable("Sas_H_Menu", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Movement", 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(1000) + .HasColumnType("nvarchar(1000)"); + + 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("MovementDate") + .HasColumnType("datetime2"); + + b.Property("MovementNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MovementType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReferenceDocument") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReferenceType") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Movement", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MovementItem", 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(1000) + .HasColumnType("nvarchar(1000)"); + + 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("LocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LotNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("MovementId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SerialNumber") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.Property("ZoneId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("MaterialId"); + + b.HasIndex("MovementId"); + + b.HasIndex("WarehouseId"); + + b.HasIndex("ZoneId"); + + b.ToTable("Str_T_MovementItem", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.MovementType", 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("Str_T_MovementType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Note", b => { b.Property("Id") @@ -11116,6 +11431,64 @@ namespace Erp.Platform.Migrations b.ToTable("Scp_T_QuotationStatus", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.ReferenceType", 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("Str_T_ReferenceType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.RegistrationMethod", b => { b.Property("Id") @@ -18440,6 +18813,49 @@ namespace Erp.Platform.Migrations b.Navigation("Branch"); }); + modelBuilder.Entity("Erp.Platform.Entities.MovementItem", b => + { + b.HasOne("Erp.Platform.Entities.Location", "Location") + .WithMany("MovementItems") + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany("MovementItems") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Movement", "Movement") + .WithMany("MovementItems") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Warehouse", "Warehouse") + .WithMany("MovementItems") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Zone", "Zone") + .WithMany("MovementItems") + .HasForeignKey("ZoneId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Location"); + + b.Navigation("Material"); + + b.Navigation("Movement"); + + b.Navigation("Warehouse"); + + b.Navigation("Zone"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.HasOne("Erp.Platform.Entities.OperationType", "OperationType") @@ -19898,6 +20314,11 @@ namespace Erp.Platform.Migrations b.Navigation("Faults"); }); + modelBuilder.Entity("Erp.Platform.Entities.Location", b => + { + b.Navigation("MovementItems"); + }); + modelBuilder.Entity("Erp.Platform.Entities.LocationType", b => { b.Navigation("Locations"); @@ -19914,6 +20335,8 @@ namespace Erp.Platform.Migrations b.Navigation("Boms"); + b.Navigation("MovementItems"); + b.Navigation("PurchaseOrderItems"); b.Navigation("QuotationItems"); @@ -19943,6 +20366,11 @@ namespace Erp.Platform.Migrations b.Navigation("Materials"); }); + modelBuilder.Entity("Erp.Platform.Entities.Movement", b => + { + b.Navigation("MovementItems"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.Navigation("BomOperations"); @@ -20211,6 +20639,8 @@ namespace Erp.Platform.Migrations { b.Navigation("Locations"); + b.Navigation("MovementItems"); + b.Navigation("Zones"); }); @@ -20260,6 +20690,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Zone", b => { b.Navigation("Locations"); + + b.Navigation("MovementItems"); }); modelBuilder.Entity("Erp.Platform.Entities.ZoneType", b => diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 2c3c94fc..ce6a3893 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, "currency": "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": [ @@ -6448,5 +6457,200 @@ "description": "Satış siparişlerin iptal edildiğini ifade eder", "isActive": true } + ], + "Inventories": [ + { + "materialCode": "PR001", + "warehouseCode": "WH-001", + "zoneCode": "Z001", + "locationCode": "A01-01-01", + "quantity": 50, + "reservedQuantity": 10, + "availableQuantity": 40, + "uom": "adet", + "lotNumber": "LOT2024001", + "serialNumber": null, + "expiryDate": null, + "receivedDate": "2024-10-15T00:00:00.000Z", + "lastMovementDate": "2024-11-15T00:00:00.000Z" + }, + { + "materialCode": "SF001", + "warehouseCode": "WH-001", + "zoneCode": "Z002", + "locationCode": "A01-01-02", + "quantity": 25, + "reservedQuantity": 5, + "availableQuantity": 20, + "uom": "metre", + "lotNumber": "LOT2024002", + "serialNumber": null, + "expiryDate": null, + "receivedDate": "2024-11-01T00:00:00.000Z", + "lastMovementDate": "2024-11-20T00:00:00.000Z" + }, + { + "materialCode": "PR001", + "warehouseCode": "WH-002", + "zoneCode": "Z003", + "locationCode": "B02-02-01", + "quantity": 150, + "reservedQuantity": 0, + "availableQuantity": 150, + "uom": "adet", + "lotNumber": "LOT2024003", + "serialNumber": null, + "expiryDate": null, + "receivedDate": "2024-09-20T00:00:00.000Z", + "lastMovementDate": "2024-10-25T00:00:00.000Z" + }, + { + "materialCode": "MT001", + "warehouseCode": "WH-002", + "zoneCode": "Z003", + "locationCode": "B02-02-01", + "quantity": 30, + "reservedQuantity": 8, + "availableQuantity": 22, + "uom": "adet", + "lotNumber": "LOT2024004", + "serialNumber": null, + "expiryDate": null, + "receivedDate": "2024-08-10T00:00:00.000Z", + "lastMovementDate": "2024-11-18T00:00:00.000Z" + }, + { + "materialCode": "MT002", + "warehouseCode": "WH-001", + "zoneCode": "Z001", + "locationCode": "C01-02-01", + "quantity": 5, + "reservedQuantity": 0, + "availableQuantity": 0, + "uom": "adet", + "lotNumber": "LOT2024005", + "serialNumber": null, + "expiryDate": null, + "receivedDate": "2024-11-25T00:00:00.000Z", + "lastMovementDate": "2024-11-25T00:00:00.000Z" + } + ], + "MovementTypes": [ + { + "name": "Giriş", + "description": "Envantere malzeme girişi için kullanılan hareket türü", + "isActive": true + }, + { + "name": "Çıkış", + "description": "Envanterden malzeme çıkışı için kullanılan hareket türü", + "isActive": true + }, + { + "name": "Transfer", + "description": "Malzemelerin bir depo veya lokasyondan diğerine transferi için kullanılan hareket türü", + "isActive": true + } + ], + "ReferenceTypes": [ + { + "name": "Satın Alma Siparişi", + "description": "Satın alma siparişleri için kullanılan referans türü", + "isActive": true + }, + { + "name": "Satış Siparişi", + "description": "Satış siparişleri için kullanılan referans türü", + "isActive": true + }, + { + "name": "Üretim Emri", + "description": "Üretim emirleri için kullanılan referans türü", + "isActive": true + }, + { + "name": "Transfer Emri", + "description": "Transfer emirleri için kullanılan referans türü", + "isActive": true + }, + { + "name": "İade", + "description": "İade işlemleri için kullanılan referans türü", + "isActive": true + }, + { + "name": "Diğer", + "description": "Diğer işlemler için kullanılan referans türü", + "isActive": true + }, + { + "name": "Sayım", + "description": "Envanter sayımları için kullanılan referans türü", + "isActive": true + } + ], + "Movements": [ + { + "movementNumber": "GR-2024-001", + "movementDate": "2024-01-05T10:30:00", + "movementType": "Giriş", + "referenceType": "Satın Alma Siparişi", + "referenceDocument": "PO-2024-001", + "description": "Satın Alma Siparişi" + }, + { + "movementNumber": "GI-2024-001", + "movementDate": "2024-01-10T10:30:00", + "movementType": "Çıkış", + "referenceType": "Satış Siparişi", + "referenceDocument": "SO-2024-001", + "description": "Satış çıkışı" + }, + { + "movementNumber": "TR-2024-001", + "movementDate": "2024-01-17T10:30:00", + "movementType": "Transfer", + "referenceType": "Transfer Emri", + "referenceDocument": "TR-2024-001", + "description": "Depo transferi" + } + ], + "MovementItems": [ + { + "movementNumber": "GR-2024-001", + "materialCode": "PR001", + "warehouseCode": "WH-001", + "zoneCode": "Z001", + "locationCode": "A01-01-01", + "quantity": 100, + "uom": "adet", + "lotNumber": "LOT2024006", + "serialNumber": null, + "description": "2024 yılı son çeyrek 360° derece performans değerlendirmesi" + }, + { + "movementNumber": "GI-2024-001", + "materialCode": "SF001", + "warehouseCode": "WH-001", + "zoneCode": "Z002", + "locationCode": "A01-01-02", + "quantity": 20, + "uom": "adet", + "lotNumber": "LOT2024001", + "serialNumber": null, + "description": "Satış siparişi için malzeme çıkışı" + }, + { + "movementNumber": "TR-2024-001", + "materialCode": "PR001", + "warehouseCode": "WH-002", + "zoneCode": "Z003", + "locationCode": "B02-02-01", + "quantity": 10, + "uom": "metre", + "lotNumber": "LOT2024002", + "serialNumber": null, + "description": "Depo transferi" + } ] -} +} \ 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 f877f71d..18a53b53 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -14,6 +14,7 @@ using System.Linq; using System.Collections.Generic; using Volo.Abp.Identity; using Volo.Abp.Timing; +using System.Security.Cryptography.Xml; namespace Erp.Platform.Data.Seeds; @@ -141,6 +142,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _quotationStatusRepository; private readonly IRepository _orderStatusRepository; private readonly IRepository _salesOrderStatusRepository; + private readonly IRepository _inventoryRepository; + private readonly IRepository _movementTypeRepository; + private readonly IRepository _referenceTypeRepository; + private readonly IRepository _movementRepository; + private readonly IRepository _movementItemRepository; public TenantDataSeeder( IClock clock, @@ -264,7 +270,12 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository deliveryTermRepository, IRepository quotationStatusRepository, IRepository orderStatusRepository, - IRepository salesOrderStatusRepository + IRepository salesOrderStatusRepository, + IRepository inventoryRepository, + IRepository movementTypeRepository, + IRepository referenceTypeRepository, + IRepository movementRepository, + IRepository movementItemRepository ) { _clock = clock; @@ -390,6 +401,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _quotationStatusRepository = quotationStatusRepository; _orderStatusRepository = orderStatusRepository; _salesOrderStatusRepository = salesOrderStatusRepository; + _inventoryRepository = inventoryRepository; + _movementTypeRepository = movementTypeRepository; + _referenceTypeRepository = referenceTypeRepository; + _movementRepository = movementRepository; + _movementItemRepository = movementItemRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2718,6 +2734,111 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive }, autoSave: true); } + + foreach (var item in items.Inventories) + { + var material = await _materialRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialCode); + var warehouse = await _warehouseRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseCode); + var zone = await _zoneRepository.FirstOrDefaultAsync(x => x.Code == item.ZoneCode); + var location = await _locationRepository.FirstOrDefaultAsync(x => x.Code == item.LocationCode); + + var exists = await _inventoryRepository.AnyAsync(x => x.MaterialId == material.Id && + x.WarehouseId == warehouse.Id && + x.ZoneId == zone.Id && + x.LocationId == location.Id); + if (exists) + continue; + + await _inventoryRepository.InsertAsync(new Inventory + { + MaterialId = material?.Id, + WarehouseId = warehouse?.Id, + ZoneId = zone?.Id, + LocationId = location?.Id, + Quantity = item.Quantity, + ReservedQuantity = item.ReservedQuantity, + AvailableQuantity = item.AvailableQuantity, + Uom = item.Uom, + LotNumber = item.LotNumber, + SerialNumber = item.SerialNumber, + ExpiryDate = item.ExpiryDate, + ReceivedDate = item.ReceivedDate, + LastMovementDate = item.LastMovementDate + }, autoSave: true); + } + + foreach (var item in items.MovementTypes) + { + var exists = await _movementTypeRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _movementTypeRepository.InsertAsync(new MovementType + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.ReferenceTypes) + { + var exists = await _referenceTypeRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _referenceTypeRepository.InsertAsync(new ReferenceType + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.Movements) + { + var exists = await _movementRepository.AnyAsync(x => x.MovementNumber == item.MovementNumber); + if (exists) + continue; + + await _movementRepository.InsertAsync(new Movement + { + MovementNumber = item.MovementNumber, + MovementDate = item.MovementDate, + MovementType = item.MovementType, + ReferenceType = item.ReferenceType, + ReferenceDocument = item.ReferenceDocument, + Description = item.Description + }, autoSave: true); + } + + foreach (var item in items.MovementItems) + { + var movement = await _movementRepository.FirstOrDefaultAsync(x => x.MovementNumber == item.MovementNumber); + + var exists = await _movementItemRepository.AnyAsync(x => x.MovementId == movement.Id); + if (exists) + continue; + + var material = await _materialRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialCode); + var warehouse = await _warehouseRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseCode); + var zone = await _zoneRepository.FirstOrDefaultAsync(x => x.Code == item.ZoneCode); + var location = await _locationRepository.FirstOrDefaultAsync(x => x.Code == item.LocationCode); + + await _movementItemRepository.InsertAsync(new MovementItem + { + MovementId = movement?.Id, + WarehouseId = warehouse?.Id, + ZoneId = zone?.Id, + LocationId = location?.Id, + MaterialId = material?.Id, + Quantity = item.Quantity, + Uom = item.Uom, + LotNumber = item.LotNumber, + SerialNumber = item.SerialNumber, + Description = item.Description + }, autoSave: true); + } } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDatabaseViewCreator.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDatabaseViewCreator.cs index badddddd..bf4e295a 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDatabaseViewCreator.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDatabaseViewCreator.cs @@ -34,9 +34,11 @@ public class DatabaseViewSeeder : IDataSeedContributor, ITransientDependency _logger.LogInformation("Starting database view seeding..."); - await CreateOrUpdateMaterialGroupView(dbContext, nameof(TableNameEnum.MaterialGroup)); + await CreateOrUpdateMaterialGroupViewAsync(dbContext, nameof(TableNameEnum.MaterialGroup)); - await CreateOrUpdateProjectTaskView(dbContext, nameof(TableNameEnum.ProjectTask)); + await CreateOrUpdateProjectTaskViewAsync(dbContext, nameof(TableNameEnum.ProjectTask)); + + await CreateOrUpdateMovementViewAsync(dbContext, nameof(TableNameEnum.MovementItem)); _logger.LogInformation("Database view seeding completed successfully."); } @@ -50,7 +52,7 @@ public class DatabaseViewSeeder : IDataSeedContributor, ITransientDependency /// /// Creates or updates the V_T_Scp_MaterialGroup view /// - private async Task CreateOrUpdateMaterialGroupView(PlatformDbContext dbContext, string tableName) + private async Task CreateOrUpdateMaterialGroupViewAsync(PlatformDbContext dbContext, string tableName) { string fullTableName = TableNameResolver.GetFullTableName(tableName); string fullViewName = TableNameResolver.GetFullViewName(tableName); @@ -108,7 +110,7 @@ public class DatabaseViewSeeder : IDataSeedContributor, ITransientDependency /// /// Creates or updates the V_T_Scp_ProjectWorkload view /// - private async Task CreateOrUpdateProjectTaskView(PlatformDbContext dbContext, string viewName) + private async Task CreateOrUpdateProjectTaskViewAsync(PlatformDbContext dbContext, string viewName) { string fullViewName = TableNameResolver.GetFullViewName(viewName); @@ -174,5 +176,57 @@ public class DatabaseViewSeeder : IDataSeedContributor, ITransientDependency } } + /// + /// Creates or updates the V_T_Str_Movement view + /// + private async Task CreateOrUpdateMovementViewAsync(PlatformDbContext dbContext, string viewName) + { + string fullViewName = TableNameResolver.GetFullViewName(viewName); + + try + { + var createViewSql = $@" + IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[{fullViewName}]')) + DROP VIEW [dbo].[{fullViewName}]; + + EXEC(' + CREATE VIEW [dbo].[{fullViewName}] + AS + SELECT + mi.TenantId, + m.MovementNumber, + m.MovementDate, + m.MovementType, + m.ReferenceType, + m.ReferenceDocument, + m.Description AS MainDescription, + + mi.Id, + mi.MovementId, + mi.WarehouseId, + mi.ZoneId, + mi.LocationId, + mi.MaterialId, + mi.Quantity, + mi.Uom, + mi.LotNumber, + mi.SerialNumber, + mi.Description, + mi.IsDeleted + FROM dbo.Str_T_Movement AS m + INNER JOIN dbo.Str_T_MovementItem AS mi ON m.Id = mi.MovementId + ') + "; + + await dbContext.Database.ExecuteSqlRawAsync(createViewSql); + + _logger.LogInformation($"Created/Updated {fullViewName} view successfully."); + } + catch (Exception ex) + { + _logger.LogError(ex, $"Error occurred while creating {fullViewName} view."); + throw; + } + } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 5de93941..001b74d5 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -142,6 +142,71 @@ public class TenantSeederDto public List ProjectPhases { get; set; } public List ProjectTasks { get; set; } public List ProjectTaskDailies { get; set; } + public List Inventories { get; set; } + public List MovementTypes { get; set; } + public List ReferenceTypes { get; set; } + public List Movements { get; set; } + public List MovementItems { get; set; } +} + +public class MovementSeedDto +{ + public string MovementNumber { get; set; } + public DateTime MovementDate { get; set; } + public string MovementType { get; set; } + public string ReferenceType { get; set; } + public string ReferenceDocument { get; set; } + public string Description { get; set; } +} + +public class MovementItemSeedDto +{ + public string MovementNumber { get; set; } + public string WarehouseCode { get; set; } + public string ZoneCode { get; set; } + public string LocationCode { get; set; } + public string MaterialCode { get; set; } + + public decimal Quantity { get; set; } + public string Uom { get; set; } + public string LotNumber { get; set; } + public string SerialNumber { get; set; } + + public string Description { get; set; } +} + +public class ReferenceTypeSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + +public class MovementTypeSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + +public class InventorySeedDto +{ + public string MaterialCode { get; set; } + public string WarehouseCode { get; set; } + public string ZoneCode { get; set; } + public string LocationCode { get; set; } + + public decimal Quantity { get; set; } + public decimal ReservedQuantity { get; set; } + public decimal AvailableQuantity { get; set; } + + public string Uom { get; set; } + public string LotNumber { get; set; } + public string SerialNumber { get; set; } + + public DateTime? ExpiryDate { get; set; } + public DateTime ReceivedDate { get; set; } + public DateTime LastMovementDate { get; set; } } public class SalesOrderStatusSeedDto