From 3ba59ee87061815689aac8e86ac3ac3e24d071fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Tue, 25 Nov 2025 15:35:29 +0300 Subject: [PATCH] =?UTF-8?q?Yerle=C5=9Fim=20Kurallar=C4=B1=20tan=C4=B1mlama?= =?UTF-8?q?lar=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LookUpQueryValues.cs | 13 +- .../Permissions/PermissionAppService.cs | 1 - .../Seeds/LanguagesData.json | 18 +- .../Seeds/ListFormSeeder_Administration.cs | 46 +- .../Seeds/ListFormSeeder_Coordinator.cs | 24 +- .../Seeds/ListFormSeeder_Store.cs | 531 +++++++++++++++++- .../Seeds/MenusData.json | 29 +- .../Seeds/PermissionsData.json | 254 +++------ .../Enums/TableNameEnum.cs | 2 + .../TableNameResolver.cs | 2 + .../Erp.Platform.Domain/Data/SeedConsts.cs | 2 + .../Entities/Tenant/Store/Location.cs | 4 + .../Entities/Tenant/Store/Putaway.cs | 26 + .../Entities/Tenant/Store/PutawayCondition.cs | 17 + .../EntityFrameworkCore/PlatformDbContext.cs | 32 ++ ....cs => 20251125115039_Initial.Designer.cs} | 182 +++++- ...7_Initial.cs => 20251125115039_Initial.cs} | 82 +++ .../PlatformDbContextModelSnapshot.cs | 180 ++++++ .../Tenants/Seeds/TenantData.json | 51 ++ .../Tenants/TenantDataSeeder.cs | 41 +- .../Tenants/TenantSeederDto.cs | 19 + .../warehouse/components/LocationTracking.tsx | 491 ---------------- 22 files changed, 1283 insertions(+), 764 deletions(-) create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/Putaway.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Store/PutawayCondition.cs rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251125092407_Initial.Designer.cs => 20251125115039_Initial.Designer.cs} (98%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251125092407_Initial.cs => 20251125115039_Initial.cs} (98%) delete mode 100644 ui/src/views/warehouse/components/LocationTracking.tsx diff --git a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs index 7933a108..e13fa396 100644 --- a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs +++ b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs @@ -228,5 +228,16 @@ public static class LookupQueryValues $"WHERE " + $"(\"WarehouseId\" = @param0 OR @param0 IS NULL) " + $"AND \"IsDeleted\" = 'false' " + - $"ORDER BY \"Name\";"; + $"ORDER BY \"Name\";"; + + public static string LocationValues = + $"SELECT " + + $"\"Id\" AS \"Key\", " + + $"\"Name\" AS \"Name\" " + + $"FROM \"{FullNameTable(TableNameEnum.Location)}\" " + + $"WHERE " + + $"(\"WarehouseId\" = @param0 OR @param0 IS NULL) " + + $"AND (\"ZoneId\" = @param1 OR @param1 IS NULL) " + + $"AND \"IsDeleted\" = 'false' " + + $"ORDER BY \"Name\";"; } diff --git a/api/src/Erp.Platform.Application/Permissions/PermissionAppService.cs b/api/src/Erp.Platform.Application/Permissions/PermissionAppService.cs index 130bf114..ba0a6239 100644 --- a/api/src/Erp.Platform.Application/Permissions/PermissionAppService.cs +++ b/api/src/Erp.Platform.Application/Permissions/PermissionAppService.cs @@ -7,7 +7,6 @@ using Volo.Abp.PermissionManagement; using System.Linq; using System.Threading.Tasks; using Volo.Abp; -using System.Text.Json; namespace Erp.Platform.PermissionManagement; diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index f5363713..6b4c4468 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9537,15 +9537,15 @@ }, { "resourceName": "Platform", - "key": "App.Store.Tracking", - "tr": "Lokasyon Takibi", - "en": "Location Tracking" + "key": "App.Store.Putaway", + "tr": "Yerleştirme Kuralları", + "en": "Putaway Rules" }, { "resourceName": "Platform", - "key": "App.Store.Putaway", - "tr": "Yerleştirme", - "en": "Putaway" + "key": "App.Store.PutawayCondition", + "tr": "Yerleştirme Kuralı Koşulları", + "en": "Putaway Rule Conditions" }, { "resourceName": "Platform", @@ -9577,12 +9577,6 @@ "tr": "Stok Hareketleri", "en": "Stock Movements" }, - { - "resourceName": "Platform", - "key": "App.Store.Stocklevel", - "tr": "Lot ve Seri No Takibi", - "en": "Lot and Serial Number Tracking" - }, { "resourceName": "Platform", "key": "App.Projects.List", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs index 72ec9aa2..a5a54426 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs @@ -344,9 +344,9 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key=1,Name="Tenant" }, - new () { Key=2,Name="Host" }, - new () { Key=3,Name="Both" }, + new () { Key=1, Name="Tenant" }, + new () { Key=2, Name="Host" }, + new () { Key=3, Name="Both" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -496,10 +496,10 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key=0,Name="String" }, - new () { Key=1,Name="Number" }, - new () { Key=2,Name="Boolean" }, - new () { Key=3,Name="DateTime" }, + new () { Key=0, Name="String" }, + new () { Key=1, Name="Number" }, + new () { Key=2, Name="Boolean" }, + new () { Key=3, Name="DateTime" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -1011,9 +1011,9 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="User",Name="User" }, - new () { Key="Role",Name="Role" }, - new () { Key="Global",Name="Global" }, + new () { Key="User", Name="User" }, + new () { Key="Role", Name="Role" }, + new () { Key="Global", Name="Global" }, }), }), ValidationRuleJson = DefaultValidationRuleRequiredJson, @@ -1395,8 +1395,8 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="GET",Name="GET" }, - new () { Key="POSt",Name="POST" }, + new () { Key="GET", Name="GET" }, + new () { Key="POSt", Name="POST" }, }), }), ValidationRuleJson = DefaultValidationRuleRequiredJson, @@ -1855,8 +1855,8 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="service",Name="Service" }, - new () { Key="support",Name="Support" }, + new () { Key="service", Name="Service" }, + new () { Key="support", Name="Support" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -4600,9 +4600,9 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Reference",Name="Reference" }, - new () { Key="SmallerThanReference",Name="Smaller Than Reference" }, - new () { Key="BiggerThanReference",Name="Bigger Than Reference" }, + new () { Key="Reference", Name="Referans" }, + new () { Key="SmallerThanReference", Name="Referanstan Küçük" }, + new () { Key="BiggerThanReference", Name="Referanstan Büyük" }, }), }), ValidationRuleJson = DefaultValidationRuleRequiredJson, @@ -5405,8 +5405,8 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -5582,8 +5582,8 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -5835,8 +5835,8 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ValidationRuleJson = DefaultValidationRuleRequiredJson, diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs index 49da15c6..ee7a59fe 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Coordinator.cs @@ -148,8 +148,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -312,8 +312,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -690,8 +690,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -864,8 +864,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -1073,8 +1073,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, @@ -1247,8 +1247,8 @@ public class ListFormSeeder_Coordinator : IDataSeedContributor, ITransientDepend DisplayExpr = "name", ValueExpr = "key", LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { - new () { Key="Aktif",Name="Aktif" }, - new () { Key="Pasif",Name="Pasif" }, + new () { Key="Aktif", Name="Aktif" }, + new () { Key="Pasif", Name="Pasif" }, }), }), ColumnCustomizationJson = DefaultColumnCustomizationJson, diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs index 5fd54ad0..50b8b60a 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs @@ -43,6 +43,7 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen public async Task SeedAsync(DataSeedContext context) { + using var utils = new SeederUtils(); var listFormName = String.Empty; #region Warehouse Type @@ -1152,7 +1153,7 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Name", - Width = 150, + Width = 200, ListOrderNo = 3, Visible = true, IsActive = true, @@ -1170,7 +1171,7 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen CultureName = LanguageCodes.En, SourceDbType = DbType.String, FieldName = "Description", - Width = 250, + Width = 350, ListOrderNo = 4, Visible = true, IsActive = true, @@ -1262,13 +1263,60 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Kind", + 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.Guid, + FieldName = "UomId", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Uom), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "LastModificationTime", + Width = 130, + 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.Boolean, FieldName = "IsActive", Width = 100, - ListOrderNo = 8, + ListOrderNo = 11, Visible = true, IsActive = true, IsDeleted = false, @@ -1280,6 +1328,481 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen ]); #endregion } - #endregion + #endregion + + #region Putaway + listFormName = AppCodes.Store.Putaway; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + 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.Putaway)), + 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.Putaway)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 800, 400, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=2, ColSpan=1, Caption="General", ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Priority", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField = "Strategy", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "Description", ColSpan = 2, EditorType2=EditorTypes.dxTextArea }, + ]}, + new() { + Order=2, ColCount=2, ColSpan=1, Caption="Target", ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "WarehouseId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "MaterialTypeId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "MaterialGroupId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 5, DataField = "TargetZoneId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField = "TargetLocationId", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox }, + ]}, + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Priority", FieldDbType = DbType.Int32, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Strategy", FieldDbType = DbType.String, Value = "FIFO", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Conditions", + Text = "Conditions", + UrlTarget = "_blank", + AuthName = listFormName, + Url = $"/admin/form/{utils.GetDefaultFormCodes(listFormName)}/@Id", + IsVisible = true, + }, + }), + }, autoSave: true + ); + + #region Putaway Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 200, + ListOrderNo = 3, + 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 = 300, + 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.Int32, + FieldName = "Priority", + 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 = "Strategy", + Width = 200, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="FIFO",Name="First In First Out" }, + new () { Key="LIFO",Name="Last In First Out" }, + new () { Key="NEAREST_LOCATION",Name="En Yakın Lokasyon" }, + new () { Key="EMPTY_LOCATION",Name="Boş Lokasyon" }, + new () { Key="SAME_PRODUCT",Name="Aynı Ürün" }, + }), + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + 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.Guid, + FieldName = "WarehouseId", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.WarehouseValues, + CascadeEmptyFields = "TargetZoneId,TargetLocationId" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "MaterialTypeId", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.MaterialType), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "MaterialGroupId", + Width = 150, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.MaterialGroup), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "TargetZoneId", + Width = 150, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.ZoneValues, + CascadeRelationField = "WarehouseId", + CascadeFilterOperator="=", + CascadeParentFields = "WarehouseId", + CascadeEmptyFields = "TargetLocationId" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "TargetLocationId", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.LocationValues, + CascadeRelationField = "ZoneId", + CascadeFilterOperator="=", + CascadeParentFields = "WarehouseId,TargetZoneId", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ], autoSave: true); + #endregion + } + #endregion + + #region Putaway Condition + listFormName = AppCodes.Store.PutawayCondition; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + 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.PutawayCondition)), + 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.PutawayCondition)), + 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 = "ConditionType", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField = "Operator", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField = "Value", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }, autoSave: true + ); + + #region Putaway Condition 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 = "ConditionType", + Width = 200, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Quantity",Name="Miktar" }, + new () { Key="Weight",Name="Ağırlık" }, + new () { Key="Volume",Name="Hacim" }, + new () { Key="MaterialType",Name="Malzeme Türü" }, + new () { Key="MaterialGroup",Name="Material Grup" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Operator", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="Equals",Name="Eşittir" }, + new () { Key="NotEquals",Name="Eşit Değildir" }, + new () { Key="GreaterThan",Name="Daha Büyüktür" }, + new () { Key="LessThan",Name="Daha Küçüktür" }, + new () { Key="Contains",Name="İçerir" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Value", + Width = 200, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ], autoSave: true); + #endregion + } + #endregion + + // Putaway ve Putaway Condition Sub Forms ilişkisinin kurulması + await utils.CloneListFormWithFieldsAsync( + _listFormRepository, + _listFormFieldRepository, + AppCodes.Store.Putaway, + JsonSerializer.Serialize(new List() { + new { + TabTitle = AppCodes.Store.PutawayCondition, + TabType = ListFormTabTypeEnum.List, + Code = AppCodes.Store.PutawayCondition, + Relation = new List() { + new { + ParentFieldName = "Id", + DbType = DbType.Guid, + ChildFieldName = "RuleId" + } + } + } + }) + ); } } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index 6f8fa5f2..9b9834b1 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -694,13 +694,6 @@ "routeType": "protected", "authority": null }, - { - "key": "admin.warehouse.tracking", - "path": "/admin/warehouse/tracking", - "componentPath": "@/views/warehouse/components/LocationTracking", - "routeType": "protected", - "authority": null - }, { "key": "admin.warehouse.putaway", "path": "/admin/warehouse/putaway", @@ -2575,22 +2568,12 @@ "RequiredPermissionName": "App.Store.Location", "IsDisabled": false }, - { - "ParentCode": "App.Store", - "Code": "App.Store.Tracking", - "DisplayName": "App.Store.Tracking", - "Order": 8, - "Url": "/admin/warehouse/tracking", - "Icon": "FcSearch", - "RequiredPermissionName": "App.Store.Tracking", - "IsDisabled": false - }, { "ParentCode": "App.Store", "Code": "App.Store.Putaway", "DisplayName": "App.Store.Putaway", "Order": 9, - "Url": "/admin/warehouse/putaway", + "Url": "/admin/list/App.Store.Putaway", "Icon": "FcCompactCamera", "RequiredPermissionName": "App.Store.Putaway", "IsDisabled": false @@ -2645,16 +2628,6 @@ "RequiredPermissionName": "App.Store.Movements", "IsDisabled": false }, - { - "ParentCode": "App.Store", - "Code": "App.Store.Stocklevel", - "DisplayName": "App.Store.Stocklevel", - "Order": 15, - "Url": "/admin/warehouse/stocklevel", - "Icon": "FcViewDetails", - "RequiredPermissionName": "App.Store.Stocklevel", - "IsDisabled": false - }, { "ParentCode": null, "Code": "App.Projects", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index b0bf7188..9d3262c2 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -7573,132 +7573,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions", - "ParentName": null, - "DisplayName": "App.Store.Definitions", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Create", - "ParentName": "App.Store.Definitions", - "DisplayName": "Create", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Update", - "ParentName": "App.Store.Definitions", - "DisplayName": "Update", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Delete", - "ParentName": "App.Store.Definitions", - "DisplayName": "Delete", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Export", - "ParentName": "App.Store.Definitions", - "DisplayName": "Export", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Import", - "ParentName": "App.Store.Definitions", - "DisplayName": "Import", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Definitions.Note", - "ParentName": "App.Store.Definitions", - "DisplayName": "Note", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking", - "ParentName": null, - "DisplayName": "App.Store.Tracking", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Create", - "ParentName": "App.Store.Tracking", - "DisplayName": "Create", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Update", - "ParentName": "App.Store.Tracking", - "DisplayName": "Update", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Delete", - "ParentName": "App.Store.Tracking", - "DisplayName": "Delete", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Export", - "ParentName": "App.Store.Tracking", - "DisplayName": "Export", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Import", - "ParentName": "App.Store.Tracking", - "DisplayName": "Import", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Tracking.Note", - "ParentName": "App.Store.Tracking", - "DisplayName": "Note", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, { "GroupName": "App.Store", "Name": "App.Store.Putaway", @@ -7762,6 +7636,71 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition", + "ParentName": null, + "DisplayName": "App.Store.PutawayCondition", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Create", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Update", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Delete", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Export", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Import", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Store", + "Name": "App.Store.PutawayCondition.Note", + "ParentName": "App.Store.PutawayCondition", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { "GroupName": "App.Store", "Name": "App.Store.Receipt", @@ -8077,69 +8016,6 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel", - "ParentName": null, - "DisplayName": "App.Store.Stocklevel", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Create", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Create", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Update", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Update", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Delete", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Delete", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Export", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Export", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Import", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Import", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, - { - "GroupName": "App.Store", - "Name": "App.Store.Stocklevel.Note", - "ParentName": "App.Store.Stocklevel", - "DisplayName": "Note", - "IsEnabled": true, - "MultiTenancySide": 3, - "MenuGroup": "Erp" - }, { "GroupName": "App.Projects", "Name": "App.Projects.List", diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 05c34e2b..1d959cab 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -177,4 +177,6 @@ public enum TableNameEnum Zone, LocationType, Location, + Putaway, + PutawayCondition, } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index f3a71fac..326d45d9 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -212,6 +212,8 @@ public static class TableNameResolver { nameof(TableNameEnum.Zone), (TablePrefix.TenantByName, MenuPrefix.Store) }, { nameof(TableNameEnum.LocationType), (TablePrefix.TenantByName, MenuPrefix.Store) }, { nameof(TableNameEnum.Location), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.Putaway), (TablePrefix.TenantByName, MenuPrefix.Store) }, + { nameof(TableNameEnum.PutawayCondition), (TablePrefix.TenantByName, MenuPrefix.Store) }, }; diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index 22a9d6f1..3f4574e6 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -553,6 +553,8 @@ public static class SeedConsts public const string Zone = Default + ".Zone"; public const string LocationType = Default + ".LocationType"; public const string Location = Default + ".Location"; + public const string Putaway = Default + ".Putaway"; + public const string PutawayCondition = Default + ".PutawayCondition"; } } 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 aeb041e1..57b0dea0 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs @@ -23,6 +23,10 @@ public class Location : FullAuditedEntity, IMultiTenant public decimal Capacity { get; set; } public decimal CurrentStock { get; set; } + public int Kind { get; set; } + public Guid? UomId { get; set; } + public Uom? Uom { get; set; } + public bool IsActive { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Putaway.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Putaway.cs new file mode 100644 index 00000000..f66bf1b3 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Putaway.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class Putaway : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public int Priority { get; set; } + public string Strategy { get; set; } + public bool IsActive { get; set; } + + public Guid? WarehouseId { get; set; } + public Guid? MaterialTypeId { get; set; } + public Guid? MaterialGroupId { get; set; } + public Guid? TargetZoneId { get; set; } + public Guid? TargetLocationId { get; set; } + + public ICollection Conditions { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/PutawayCondition.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/PutawayCondition.cs new file mode 100644 index 00000000..474f419c --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/PutawayCondition.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class PutawayCondition : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid RuleId { get; set; } + public Putaway Rule { get; set; } + + public string ConditionType { get; set; } + public string Operator { get; set; } + public string Value { get; set; } +} diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index a04a1c64..f20a3d1e 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -237,6 +237,8 @@ public class PlatformDbContext : public DbSet Zones { get; set; } public DbSet LocationTypes { get; set; } public DbSet Locations { get; set; } + public DbSet Putaways { get; set; } + public DbSet PutawayConditions { get; set; } #endregion #region Maintenance @@ -3000,5 +3002,35 @@ public class PlatformDbContext : .HasForeignKey(x => x.ZoneId) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Putaway)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Code).IsRequired().HasMaxLength(100); + b.Property(x => x.Name).IsRequired().HasMaxLength(200); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.WarehouseId).IsRequired(); + b.Property(x => x.Priority).IsRequired().HasDefaultValue(1); + b.Property(x => x.Strategy).IsRequired(); + b.Property(x => x.IsActive).HasDefaultValue(true); + + b.HasMany(x => x.Conditions) + .WithOne(x => x.Rule) + .HasForeignKey(x => x.RuleId) + .OnDelete(DeleteBehavior.Cascade); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PutawayCondition)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.RuleId).IsRequired(); + b.Property(x => x.ConditionType).IsRequired().HasMaxLength(50); + b.Property(x => x.Operator).IsRequired().HasMaxLength(20); + b.Property(x => x.Value).HasMaxLength(200); + }); } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.Designer.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.Designer.cs index 7e1aecce..41564609 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251125092407_Initial")] + [Migration("20251125115039_Initial")] partial class Initial { /// @@ -6128,6 +6128,9 @@ namespace Erp.Platform.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("Kind") + .HasColumnType("int"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -6148,6 +6151,9 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); + b.Property("UomId") + .HasColumnType("uniqueidentifier"); + b.Property("WarehouseId") .HasColumnType("uniqueidentifier"); @@ -6158,6 +6164,8 @@ namespace Erp.Platform.Migrations b.HasIndex("LocationTypeId"); + b.HasIndex("UomId"); + b.HasIndex("WarehouseId"); b.HasIndex("ZoneId"); @@ -9029,6 +9037,156 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_Psychologist", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .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("MaterialGroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("MaterialTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Strategy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TargetLocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetZoneId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Putaway", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConditionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Operator") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RuleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("RuleId"); + + b.ToTable("Str_T_PutawayCondition", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.Property("Id") @@ -15482,6 +15640,10 @@ namespace Erp.Platform.Migrations .OnDelete(DeleteBehavior.Restrict) .IsRequired(); + b.HasOne("Erp.Platform.Entities.Uom", "Uom") + .WithMany() + .HasForeignKey("UomId"); + b.HasOne("Erp.Platform.Entities.Warehouse", "Warehouse") .WithMany("Locations") .HasForeignKey("WarehouseId") @@ -15496,6 +15658,8 @@ namespace Erp.Platform.Migrations b.Navigation("LocationType"); + b.Navigation("Uom"); + b.Navigation("Warehouse"); b.Navigation("Zone"); @@ -15820,6 +15984,17 @@ namespace Erp.Platform.Migrations b.Navigation("Template"); }); + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => + { + b.HasOne("Erp.Platform.Entities.Putaway", "Rule") + .WithMany("Conditions") + .HasForeignKey("RuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rule"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.HasOne("Erp.Platform.Entities.QuestionPool", "QuestionPool") @@ -16662,6 +16837,11 @@ namespace Erp.Platform.Migrations b.Navigation("Items"); }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => + { + b.Navigation("Conditions"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.Navigation("Options"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.cs index 46299f31..86a91db4 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125115039_Initial.cs @@ -2592,6 +2592,36 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Str_T_LocationType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Str_T_Putaway", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Priority = table.Column(type: "int", nullable: false, defaultValue: 1), + Strategy = table.Column(type: "nvarchar(max)", nullable: false), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + WarehouseId = table.Column(type: "uniqueidentifier", nullable: false), + TargetZoneId = table.Column(type: "uniqueidentifier", nullable: true), + TargetLocationId = table.Column(type: "uniqueidentifier", nullable: true), + MaterialTypeId = table.Column(type: "uniqueidentifier", nullable: true), + MaterialGroupId = table.Column(type: "uniqueidentifier", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Str_T_Putaway", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Str_T_WarehouseType", columns: table => new @@ -3781,6 +3811,35 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Str_T_PutawayCondition", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + RuleId = table.Column(type: "uniqueidentifier", nullable: false), + ConditionType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Operator = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), + Value = table.Column(type: "nvarchar(200)", maxLength: 200, 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_PutawayCondition", x => x.Id); + table.ForeignKey( + name: "FK_Str_T_PutawayCondition_Str_T_Putaway_RuleId", + column: x => x.RuleId, + principalTable: "Str_T_Putaway", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpEntityPropertyChanges", columns: table => new @@ -6227,6 +6286,8 @@ namespace Erp.Platform.Migrations Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), Capacity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), CurrentStock = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Kind = table.Column(type: "int", nullable: false), + UomId = table.Column(type: "uniqueidentifier", 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), @@ -6239,6 +6300,11 @@ namespace Erp.Platform.Migrations constraints: table => { table.PrimaryKey("PK_Str_T_Location", x => x.Id); + table.ForeignKey( + name: "FK_Str_T_Location_Adm_T_Uom_UomId", + column: x => x.UomId, + principalTable: "Adm_T_Uom", + principalColumn: "Id"); table.ForeignKey( name: "FK_Str_T_Location_Str_T_LocationType_LocationTypeId", column: x => x.LocationTypeId, @@ -7320,6 +7386,11 @@ namespace Erp.Platform.Migrations table: "Str_T_Location", column: "LocationTypeId"); + migrationBuilder.CreateIndex( + name: "IX_Str_T_Location_UomId", + table: "Str_T_Location", + column: "UomId"); + migrationBuilder.CreateIndex( name: "IX_Str_T_Location_WarehouseId", table: "Str_T_Location", @@ -7330,6 +7401,11 @@ namespace Erp.Platform.Migrations table: "Str_T_Location", column: "ZoneId"); + migrationBuilder.CreateIndex( + name: "IX_Str_T_PutawayCondition_RuleId", + table: "Str_T_PutawayCondition", + column: "RuleId"); + migrationBuilder.CreateIndex( name: "IX_Str_T_Warehouse_EmployeeId", table: "Str_T_Warehouse", @@ -7850,6 +7926,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Str_T_Location"); + migrationBuilder.DropTable( + name: "Str_T_PutawayCondition"); + migrationBuilder.DropTable( name: "AbpEntityChanges"); @@ -7964,6 +8043,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Str_T_Zone"); + migrationBuilder.DropTable( + name: "Str_T_Putaway"); + migrationBuilder.DropTable( name: "AbpAuditLogs"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index d8e17b37..801b22f7 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -6125,6 +6125,9 @@ namespace Erp.Platform.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("Kind") + .HasColumnType("int"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -6145,6 +6148,9 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); + b.Property("UomId") + .HasColumnType("uniqueidentifier"); + b.Property("WarehouseId") .HasColumnType("uniqueidentifier"); @@ -6155,6 +6161,8 @@ namespace Erp.Platform.Migrations b.HasIndex("LocationTypeId"); + b.HasIndex("UomId"); + b.HasIndex("WarehouseId"); b.HasIndex("ZoneId"); @@ -9026,6 +9034,156 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_Psychologist", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .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("MaterialGroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("MaterialTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("Strategy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TargetLocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetZoneId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WarehouseId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Str_T_Putaway", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ConditionType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Operator") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RuleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("RuleId"); + + b.ToTable("Str_T_PutawayCondition", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.Property("Id") @@ -15479,6 +15637,10 @@ namespace Erp.Platform.Migrations .OnDelete(DeleteBehavior.Restrict) .IsRequired(); + b.HasOne("Erp.Platform.Entities.Uom", "Uom") + .WithMany() + .HasForeignKey("UomId"); + b.HasOne("Erp.Platform.Entities.Warehouse", "Warehouse") .WithMany("Locations") .HasForeignKey("WarehouseId") @@ -15493,6 +15655,8 @@ namespace Erp.Platform.Migrations b.Navigation("LocationType"); + b.Navigation("Uom"); + b.Navigation("Warehouse"); b.Navigation("Zone"); @@ -15817,6 +15981,17 @@ namespace Erp.Platform.Migrations b.Navigation("Template"); }); + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => + { + b.HasOne("Erp.Platform.Entities.Putaway", "Rule") + .WithMany("Conditions") + .HasForeignKey("RuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rule"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.HasOne("Erp.Platform.Entities.QuestionPool", "QuestionPool") @@ -16659,6 +16834,11 @@ namespace Erp.Platform.Migrations b.Navigation("Items"); }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => + { + b.Navigation("Conditions"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Question", b => { b.Navigation("Options"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index be7fa539..293703ee 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -5378,6 +5378,8 @@ "description": "Yüksek raf - Ağır malzemeler", "capacity": 100, "currentStock": 75, + "kind": 2, + "uomName": "Kg", "isActive": true }, { @@ -5389,6 +5391,8 @@ "description": "Orta raf - Orta ağırlık malzemeler", "capacity": 50, "currentStock": 30, + "kind": 10, + "uomName": "Kg", "isActive": true }, { @@ -5400,6 +5404,8 @@ "description": "Küçük parçalar rafı", "capacity": 200, "currentStock": 180, + "kind": 3, + "uomName": "Kg", "isActive": true }, { @@ -5411,6 +5417,8 @@ "description": "Küçük parçalar rafı", "capacity": 200, "currentStock": 180, + "kind": 1, + "uomName": "Kg", "isActive": true }, { @@ -5422,6 +5430,49 @@ "description": "Büyük parçalar rafı", "capacity": 200, "currentStock": 180, + "kind": 8, + "uomName": "Adet", + "isActive": true + } + ], + "Putaways": [ + { + "code": "RULE001", + "name": "Ağır Malzemeler", + "description": "Ağır malzemeler için zemin seviye yerleştirme kuralı", + "priority": 1, + "strategy": "FIFO", + "isActive": true, + "warehouseCode": "WH-001", + "materialTypeCode": "RAW", + "materialGroupCode": "MAMUL", + "targetZoneCode": "Z002", + "targetLocationCode": null + }, + { + "code": "RULE002", + "name": "Hızlı Hareket Eden Malzemeler", + "description": "A sınıfı malzemeler için kolay erişim bölgesi", + "warehouseCode": "WH-001", + "materialTypeCode": "SERVICE", + "materialGroupCode": "MOTOR", + "priority": 2, + "targetZoneCode": "Z002", + "targetLocationCode": null, + "strategy": "NEAREST_LOCATION", + "isActive": true + }, + { + "code": "RULE003", + "name": "FIFO Kuralı", + "description": "Son kullanma tarihi olan malzemeler için FIFO", + "warehouseCode": "WH-001", + "materialTypeCode": "FINISHED", + "materialGroupCode": "METAL", + "priority": 3, + "targetZoneCode": "Z002", + "targetLocationCode": null, + "strategy": "FIFO", "isActive": true } ] diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index 29601272..286d2d56 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -121,6 +121,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _zoneRepository; private readonly IRepository _locationTypeRepository; private readonly IRepository _locationRepository; + private readonly IRepository _putawayRepository; public TenantDataSeeder( IClock clock, @@ -224,7 +225,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository zoneTypeRepository, IRepository zoneRepository, IRepository locationTypeRepository, - IRepository locationRepository + IRepository locationRepository, + IRepository putawayRepository ) { _clock = clock; @@ -330,6 +332,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _zoneRepository = zoneRepository; _locationTypeRepository = locationTypeRepository; _locationRepository = locationRepository; + _putawayRepository = putawayRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2226,6 +2229,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency var warehouse = await _warehouseRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseCode); var zone = await _zoneRepository.FirstOrDefaultAsync(x => x.Code == item.ZoneCode); var locationtype = await _locationTypeRepository.FirstOrDefaultAsync(x => x.Code == item.LocationTypeCode); + var uom = await _uomRepository.FirstOrDefaultAsync(x => x.Name == item.UomName); await _locationRepository.InsertAsync(new Location { @@ -2235,7 +2239,40 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency Code = item.Code, Name = item.Name, Description = item.Description, - IsActive = item.IsActive + IsActive = item.IsActive, + Capacity = item.Capacity, + Kind = item.Kind, + UomId = uom?.Id, + CurrentStock = item.CurrentStock + }, autoSave: true); + } + + foreach (var item in items.Putaways) + { + var exists = await _putawayRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var warehouse = await _warehouseRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseCode); + var materialtype = await _materialTypeRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialTypeCode); + var materialgroup = await _materialGroupRepository.FirstOrDefaultAsync(x => x.Code == item.MaterialGroupCode); + var targetzone = await _zoneRepository.FirstOrDefaultAsync(x => x.Code == item.TargetZoneCode); + var targetlocation = await _locationRepository.FirstOrDefaultAsync(x => x.Code == item.TargetLocationCode); + + await _putawayRepository.InsertAsync(new Putaway + { + Code = item.Code, + Name = item.Name, + Description = item.Description, + Priority = item.Priority, + Strategy = item.Strategy, + IsActive = item.IsActive, + WarehouseId = warehouse?.Id, + MaterialTypeId = materialtype?.Id, + MaterialGroupId = materialgroup?.Id, + TargetZoneId = targetzone?.Id, + TargetLocationId = targetlocation?.Id, + }, autoSave: true); } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index ab4299c4..ae1909b7 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -115,6 +115,23 @@ public class TenantSeederDto public List Zones { get; set; } public List LocationTypes { get; set; } public List Locations { get; set; } + public List Putaways { get; set; } +} + +public class PutawaySeedDto +{ + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public int Priority { get; set; } + public string Strategy { get; set; } + public bool IsActive { get; set; } + + public string WarehouseCode { get; set; } + public string MaterialTypeCode { get; set; } + public string MaterialGroupCode { get; set; } + public string TargetZoneCode { get; set; } + public string TargetLocationCode { get; set; } } public class LocationSeedDto @@ -128,6 +145,8 @@ public class LocationSeedDto public decimal Capacity { get; set; } public decimal CurrentStock { get; set; } + public int Kind { get; set; } + public string UomName { get; set; } public bool IsActive { get; set; } } diff --git a/ui/src/views/warehouse/components/LocationTracking.tsx b/ui/src/views/warehouse/components/LocationTracking.tsx deleted file mode 100644 index 4510d85c..00000000 --- a/ui/src/views/warehouse/components/LocationTracking.tsx +++ /dev/null @@ -1,491 +0,0 @@ -import React, { useState } from 'react' -import { - FaSearch, - FaMapMarkerAlt, - FaExclamationTriangle, - FaCheckCircle, - FaEye, - FaTh, - FaList, -} from 'react-icons/fa' -import { mockWarehouses } from '../../../mocks/mockWarehouses' -import { mockLocations } from '../../../mocks/mockLocations' -import { mockStockItems } from '../../../mocks/mockStockItems' -import { getStockStatusColor, getStockStatusText } from '../../../utils/erp' -import { Container } from '@/components/shared' - -const LocationTracking: React.FC = () => { - const [searchTerm, setSearchTerm] = useState('') - const [selectedWarehouse, setSelectedWarehouse] = useState('') - const [selectedLocation, setSelectedLocation] = useState('') - const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid') - - const getLocationUtilization = (locationId: string) => { - const location = mockLocations.find((l) => l.id === locationId) - if (!location) return 0 - return (location.currentStock / location.capacity) * 100 - } - - const getLocationStockItems = (locationId: string) => { - return mockStockItems.filter((item) => item.locationId === locationId) - } - - const filteredLocations = mockLocations.filter((location) => { - const matchesSearch = - location.name.toLowerCase().includes(searchTerm.toLowerCase()) || - location.locationCode.toLowerCase().includes(searchTerm.toLowerCase()) - const matchesWarehouse = selectedWarehouse === '' || location.warehouseId === selectedWarehouse - return matchesSearch && matchesWarehouse - }) - - const GridView = () => ( -
- {filteredLocations.map((location) => { - const warehouse = mockWarehouses.find((w) => w.id === location.warehouseId) - const locationStockItems = getLocationStockItems(location.id) - const utilization = getLocationUtilization(location.id) - - return ( -
-
-
-
- -
-
-

{location.name}

-

{location.locationCode}

-
-
- -
- -
-
-

- Depo: {warehouse?.name} -

-

{location.description}

-
- - {/* Utilization */} -
-
- Doluluk Oranı - %{Math.round(utilization)} -
-
-
90 - ? 'bg-red-500' - : utilization > 70 - ? 'bg-yellow-500' - : 'bg-green-500' - }`} - style={{ width: `${utilization}%` }} - /> -
-
- {location.currentStock} / {location.capacity} birim -
-
- - {/* Stock Items Summary */} -
-
-

Malzemeler

- {locationStockItems.length} çeşit -
- - {locationStockItems.length > 0 ? ( -
- {locationStockItems.slice(0, 3).map((item) => ( -
- - {item.material?.code || 'N/A'} - -
- {item.quantity} - - {getStockStatusText(item.status)} - -
-
- ))} - {locationStockItems.length > 3 && ( -
- +{locationStockItems.length - 3} malzeme daha -
- )} -
- ) : ( -
Malzeme bulunmuyor
- )} -
- - {/* Restrictions */} - {location.restrictions && location.restrictions.length > 0 && ( -
-

Kısıtlamalar

-
- {location.restrictions.slice(0, 2).map((restriction, index) => ( - - {restriction} - - ))} - {location.restrictions.length > 2 && ( - - +{location.restrictions.length - 2} - - )} -
-
- )} -
- -
-
- {location.isActive ? ( - <> - - Aktif - - ) : ( - <> - - Pasif - - )} -
-
- Son hareket:{' '} - {locationStockItems.length > 0 - ? new Date( - Math.max( - ...locationStockItems.map((item) => item.lastMovementDate.getTime()), - ), - ).toLocaleDateString('tr-TR') - : 'N/A'} -
-
-
- ) - })} -
- ) - - const ListView = () => ( -
-
- - - - - - - - - - - - - - {filteredLocations.map((location) => { - const warehouse = mockWarehouses.find((w) => w.id === location.warehouseId) - const locationStockItems = getLocationStockItems(location.id) - const utilization = getLocationUtilization(location.id) - - return ( - - - - - - - - - - ) - })} - -
- Lokasyon - - Depo - - Doluluk - - Malzeme Çeşidi - - Son Hareket - - Durum - - İşlemler -
-
-
- -
-
-
{location.name}
-
{location.locationCode}
-
-
-
-
{warehouse?.name}
-
{warehouse?.code}
-
-
-
-
90 - ? 'bg-red-500' - : utilization > 70 - ? 'bg-yellow-500' - : 'bg-green-500' - }`} - style={{ width: `${utilization}%` }} - /> -
- %{Math.round(utilization)} -
-
- {location.currentStock} / {location.capacity} -
-
- {locationStockItems.length} çeşit - - {locationStockItems.length > 0 - ? new Date( - Math.max( - ...locationStockItems.map((item) => item.lastMovementDate.getTime()), - ), - ).toLocaleDateString('tr-TR') - : 'N/A'} - - {location.isActive ? ( - - - Aktif - - ) : ( - - - Pasif - - )} - - -
-
-
- ) - - const LocationDetailModal = () => { - const location = mockLocations.find((l) => l.id === selectedLocation) - const locationStockItems = getLocationStockItems(selectedLocation) - - if (!selectedLocation || !location) return null - - return ( -
-
-
setSelectedLocation('')} - /> - -
-
-
-

{location.name} - Detaylar

- -
- -
- {/* Location Info */} -
-

Lokasyon Bilgileri

-
-
- Kod: {location.locationCode} -
-
- Açıklama: {location.description} -
-
- Tip: {location.locationType} -
-
- Kapasite: {location.capacity} birim -
-
- Mevcut Stok: {location.currentStock} birim -
- {location.dimensions && ( -
- Boyutlar: {location.dimensions.length}x - {location.dimensions.width}x{location.dimensions.height}m -
- )} -
-
- - {/* Stock Items */} -
-

- Stok Malzemeleri ({locationStockItems.length}) -

-
- {locationStockItems.map((item) => ( -
-
-
-
{item.material?.code}
-
{item.material?.code}
-
- - {getStockStatusText(item.status)} - -
-
-
- Miktar: {item.quantity} {item.unitId} -
-
- Mevcut: {item.availableQuantity} {item.unitId} -
-
- Rezerve: {item.reservedQuantity} {item.unitId} -
-
Lot: {item.lotNumber || 'N/A'}
-
-
- Son hareket: {item.lastMovementDate.toLocaleDateString('tr-TR')} -
-
- ))} - {locationStockItems.length === 0 && ( -
- Bu lokasyonda malzeme bulunmuyor -
- )} -
-
-
-
-
-
-
- ) - } - - return ( - -
-
-
-

Raf/Lokasyon Bazlı Takip

-

Lokasyonlardaki stok durumunu takip edin

-
- -
- - -
-
- - {/* Filters */} -
-
- - setSearchTerm(e.target.value)} - className="pl-10 pr-4 py-1.5 text-sm w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
- -
- - {/* Content */} - {viewMode === 'grid' ? : } -
- - {/* Location Detail Modal */} - -
- ) -} - -export default LocationTracking