diff --git a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs index dec29322..7933a108 100644 --- a/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs +++ b/api/src/Erp.Platform.Application.Contracts/LookUpQueryValues.cs @@ -210,5 +210,23 @@ public static class LookupQueryValues $"\"DisplayName\" AS \"Name\" " + $"FROM \"AbpOrganizationUnits\"" + $"WHERE \"Code\" LIKE '00001%' " + - $"ORDER BY \"DisplayName\""; + $"ORDER BY \"DisplayName\""; + + public static string WarehouseValues = + $"SELECT " + + $"\"Id\" AS \"Key\", " + + $"\"Name\" AS \"Name\" " + + $"FROM \"{FullNameTable(TableNameEnum.Warehouse)}\" " + + $"WHERE \"IsDeleted\" = 'false' " + + $"ORDER BY \"Name\";"; + + public static string ZoneValues = + $"SELECT " + + $"\"Id\" AS \"Key\", " + + $"\"Name\" AS \"Name\" " + + $"FROM \"{FullNameTable(TableNameEnum.Zone)}\" " + + $"WHERE " + + $"(\"WarehouseId\" = @param0 OR @param0 IS NULL) " + + $"AND \"IsDeleted\" = 'false' " + + $"ORDER BY \"Name\";"; } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs index 756f94d1..72ec9aa2 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs @@ -4596,10 +4596,10 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep IsDeleted = false, AllowSearch = true, LookupJson = JsonSerializer.Serialize(new LookupDto { - DataSourceType = UiLookupDataSourceTypeEnum.StaticData, - DisplayExpr = "name", - ValueExpr = "key", - LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + 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" }, diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs index 011b2e83..5fd54ad0 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Store.cs @@ -464,5 +464,822 @@ public class ListFormSeeder_Warehouse : IDataSeedContributor, ITransientDependen #endregion } #endregion + + #region Warehouse + listFormName = AppCodes.Store.Warehouse; + 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.Warehouse)), + 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.Warehouse)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 600, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "EmployeeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "WarehouseTypeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "City", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 8, DataField = "District", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 9, DataField = "Township", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 11, DataField = "IsMainWarehouse", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 12, DataField = "Capacity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 13, DataField = "TemperatureControlled", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order = 14, DataField = "Security", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 15, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Country", FieldDbType = DbType.String, Value = "TR", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Capacity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Security", FieldDbType = DbType.String, Value = "Low", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "TemperatureControlled", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsMainWarehouse", FieldDbType = DbType.Boolean, Value = "false", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Warehouse Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + 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 = 150, + 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 = 250, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "EmployeeId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "WarehouseTypeId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.WarehouseType), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Country", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CountryValues, + CascadeEmptyFields = "City,District,Township" + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "City", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.CityValues, + CascadeRelationField = "Country", + CascadeFilterOperator="=", + CascadeParentFields = "Country", + CascadeEmptyFields = "District,Township" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "District", + Width = 100, + ListOrderNo = 9, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.DistrictValues, + CascadeRelationField = "City", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City", + CascadeEmptyFields = "Township", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Township", + Width = 100, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.TownshipValues, + CascadeRelationField = "District", + CascadeFilterOperator="=", + CascadeParentFields = "Country,City,District", + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "PostalCode", + Width = 100, + 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.Boolean, + FieldName = "IsMainWarehouse", + 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.Decimal, + FieldName = "Capacity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "TemperatureControlled", + 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 = "Security", + Width = 100, + ListOrderNo = 15, + 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="Low",Name="Low" }, + new () { Key="Medium",Name="Medium" }, + new () { Key="High",Name="High" }, + new () { Key="Restricted",Name="Restricted" }, + }), + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region Zone + listFormName = AppCodes.Store.Zone; + 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.Zone)), + 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.Zone)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 400, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "WarehouseId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "ZoneTypeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "Humidity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 7, DataField = "Temperature", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 8, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Humidity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Temperature", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Warehouse Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + 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 = 150, + 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 = 250, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "WarehouseId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Warehouse), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ZoneTypeId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.ZoneType), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Humidity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Temperature", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ]); + #endregion + } + #endregion + + #region Location + listFormName = AppCodes.Store.Location; + 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.Location)), + 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.Location)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 400, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "WarehouseId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "ZoneId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "LocationTypeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "Capacity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 8, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Capacity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + } + ); + + #region Location Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Code", + Width = 100, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + 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 = 150, + 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 = 250, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "WarehouseId", + Width = 150, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.WarehouseValues, + CascadeEmptyFields = "ZoneId" + }), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ZoneId", + Width = 150, + ListOrderNo = 5, + 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", + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "LocationTypeId", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.LocationType), "Id", "Name"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Capacity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 8, + 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 4b001a44..6f8fa5f2 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -2575,16 +2575,6 @@ "RequiredPermissionName": "App.Store.Location", "IsDisabled": false }, - { - "ParentCode": "App.Store", - "Code": "App.Store.Definitions", - "DisplayName": "App.Store.Definitions", - "Order": 7, - "Url": "/admin/warehouse/definitions", - "Icon": "FcTodoList", - "RequiredPermissionName": "App.Store.Definitions", - "IsDisabled": false - }, { "ParentCode": "App.Store", "Code": "App.Store.Tracking", 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 e998949f..aeb041e1 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Location.cs @@ -8,21 +8,21 @@ public class Location : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } - public Guid WarehouseId { get; set; } - public Warehouse Warehouse { get; set; } + public Guid? WarehouseId { get; set; } + public Warehouse? Warehouse { get; set; } - public Guid ZoneId { get; set; } - public Zone Zone { get; set; } + public Guid? ZoneId { get; set; } + public Zone? Zone { get; set; } + + public Guid? LocationTypeId { get; set; } + public LocationType? LocationType { get; set; } public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } - public Guid LocationTypeId { get; set; } - public LocationType LocationType { get; set; } - - public int Capacity { get; set; } - public int CurrentStock { get; set; } + public decimal Capacity { get; set; } + public decimal CurrentStock { 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 775940f7..e1bb9055 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Warehouse.cs @@ -12,8 +12,11 @@ public class Warehouse : FullAuditedEntity, IMultiTenant public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } - public Guid EmployeeId { get; set; } - public Employee Employee { get; set; } + + public Guid? EmployeeId { get; set; } + public Employee? Employee { get; set; } + public Guid? WarehouseTypeId { get; set; } + public WarehouseType? WarehouseType { get; set; } public string Country { get; set; } public string City { get; set; } @@ -21,14 +24,11 @@ public class Warehouse : FullAuditedEntity, IMultiTenant public string Township { get; set; } public string PostalCode { get; set; } - public Guid WarehouseTypeId { get; set; } - public WarehouseType WarehouseType { get; set; } - public bool IsMainWarehouse { get; set; } - public int Capacity { get; set; } + public decimal Capacity { get; set; } public bool IsActive { get; set; } public bool TemperatureControlled { get; set; } - public int SecurityLevel { get; set; } + public string Security { get; set; } public ICollection Zones { get; set; } public ICollection Locations { 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 1eb40b30..a2850531 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Store/Zone.cs @@ -9,18 +9,18 @@ public class Zone : FullAuditedEntity, IMultiTenant { public Guid? TenantId { get; set; } - public Guid WarehouseId { get; set; } - public Warehouse Warehouse { get; set; } + public Guid? WarehouseId { get; set; } + public Warehouse? Warehouse { get; set; } + + public Guid? ZoneTypeId { get; set; } + public ZoneType? ZoneType { get; set; } public string Code { get; set; } public string Name { get; set; } public string Description { get; set; } - public Guid ZoneTypeId { get; set; } - public ZoneType ZoneType { get; set; } - - public int? Temperature { get; set; } //Sıcaklık - public int? Humidity { get; set; } //Nem + public decimal Temperature { get; set; } //Sıcaklık + public decimal Humidity { get; set; } //Nem public bool IsActive { get; set; } public ICollection Locations { get; set; } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 80c11b19..a04a1c64 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -898,7 +898,7 @@ public class PlatformDbContext : b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.City)), Prefix.DbSchema); b.ConfigureByConvention(); - b.Property(x => x.Country).HasMaxLength(8); + b.Property(x => x.Country).HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Code).IsRequired().HasMaxLength(16); b.Property(x => x.PlateCode).HasMaxLength(20); @@ -911,8 +911,8 @@ public class PlatformDbContext : b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.District)), Prefix.DbSchema); b.ConfigureByConvention(); - b.Property(x => x.Country).HasMaxLength(8); - b.Property(x => x.City).IsRequired().HasMaxLength(16); + b.Property(x => x.Country).HasMaxLength(128); + b.Property(x => x.City).IsRequired().HasMaxLength(128); b.Property(x => x.Name).IsRequired().HasMaxLength(128); b.Property(x => x.Township).HasMaxLength(128); @@ -2387,9 +2387,9 @@ public class PlatformDbContext : b.Property(p => p.TaxNumber).IsRequired(); b.Property(p => p.TaxOffice).HasMaxLength(128); b.Property(p => p.PaymentTermId).IsRequired(); - b.Property(p => p.Country).IsRequired().HasMaxLength(64); - b.Property(p => p.City).IsRequired().HasMaxLength(64); - b.Property(p => p.District).HasMaxLength(64); + b.Property(p => p.Country).IsRequired().HasMaxLength(128); + b.Property(p => p.City).IsRequired().HasMaxLength(128); + b.Property(p => p.District).HasMaxLength(128); b.Property(p => p.Township).HasMaxLength(128); b.Property(p => p.Address1).HasMaxLength(256); b.Property(p => p.Address2).HasMaxLength(256); @@ -2898,20 +2898,19 @@ public class PlatformDbContext : b.Property(x => x.Name).IsRequired().HasMaxLength(200); b.Property(x => x.Description).HasMaxLength(500); b.Property(x => x.EmployeeId).IsRequired(); - b.Property(x => x.WarehouseTypeId).IsRequired(); - b.Property(x => x.Country).HasMaxLength(100); - b.Property(x => x.City).HasMaxLength(100); - b.Property(x => x.District).HasMaxLength(200); - b.Property(x => x.Township).HasMaxLength(100); + b.Property(x => x.Country).HasMaxLength(128); + b.Property(x => x.City).HasMaxLength(128); + b.Property(x => x.District).HasMaxLength(128); + b.Property(x => x.Township).HasMaxLength(128); b.Property(x => x.PostalCode).HasMaxLength(20); b.Property(x => x.IsMainWarehouse).HasDefaultValue(false); - b.Property(x => x.Capacity).HasDefaultValue(0); + b.Property(x => x.Capacity).HasPrecision(18, 2).HasDefaultValue(0); b.Property(x => x.IsActive).HasDefaultValue(true); b.Property(x => x.TemperatureControlled).HasDefaultValue(false); - b.Property(x => x.SecurityLevel).HasDefaultValue(1); + b.Property(x => x.Security).HasMaxLength(20); b.HasOne(x => x.WarehouseType) .WithMany(x => x.Warehouses) @@ -2945,8 +2944,8 @@ public class PlatformDbContext : b.Property(x => x.Name).IsRequired().HasMaxLength(50); b.Property(x => x.Description).HasMaxLength(500); b.Property(x => x.ZoneTypeId).IsRequired(); - b.Property(x => x.Temperature).HasDefaultValue(0); - b.Property(x => x.Humidity).HasDefaultValue(0); + b.Property(x => x.Temperature).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.Humidity).HasPrecision(18, 2).HasDefaultValue(0); b.Property(x => x.IsActive).HasDefaultValue(true); b.HasOne(x => x.ZoneType) @@ -2982,8 +2981,8 @@ public class PlatformDbContext : b.Property(x => x.Name).IsRequired().HasMaxLength(50); b.Property(x => x.Description).HasMaxLength(500); b.Property(x => x.LocationTypeId).IsRequired(); - b.Property(x => x.Capacity).HasDefaultValue(0); - b.Property(x => x.CurrentStock).HasDefaultValue(0); + b.Property(x => x.Capacity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.CurrentStock).HasPrecision(18, 2).HasDefaultValue(0); b.Property(x => x.IsActive).HasDefaultValue(true); b.HasOne(x => x.LocationType) diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs index 131117b1..7e1aecce 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251124204213_Initial")] + [Migration("20251125092407_Initial")] partial class Initial { /// @@ -1724,8 +1724,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(16)"); b.Property("Country") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CountryId") .HasColumnType("uniqueidentifier"); @@ -3676,15 +3676,15 @@ namespace Erp.Platform.Migrations b.Property("City") .IsRequired() - .HasMaxLength(16) - .HasColumnType("nvarchar(16)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CityId") .HasColumnType("uniqueidentifier"); b.Property("Country") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -6080,10 +6080,11 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Capacity") + b.Property("Capacity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("Code") .IsRequired() @@ -6098,10 +6099,11 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); - b.Property("CurrentStock") + b.Property("CurrentStock") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("DeleterId") .HasColumnType("uniqueidentifier") @@ -8018,8 +8020,8 @@ namespace Erp.Platform.Migrations b.Property("City") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Code") .IsRequired() @@ -8028,8 +8030,8 @@ namespace Erp.Platform.Migrations b.Property("Country") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -8077,8 +8079,8 @@ namespace Erp.Platform.Migrations .HasDefaultValue(0m); b.Property("District") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Email") .IsRequired() @@ -12025,14 +12027,15 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Capacity") + b.Property("Capacity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("City") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Code") .IsRequired() @@ -12040,8 +12043,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(50)"); b.Property("Country") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -12064,8 +12067,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(500)"); b.Property("District") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("EmployeeId") .HasColumnType("uniqueidentifier"); @@ -12103,10 +12106,9 @@ namespace Erp.Platform.Migrations .HasMaxLength(20) .HasColumnType("nvarchar(20)"); - b.Property("SecurityLevel") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(1); + b.Property("Security") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); b.Property("TemperatureControlled") .ValueGeneratedOnAdd() @@ -12118,8 +12120,8 @@ namespace Erp.Platform.Migrations .HasColumnName("TenantId"); b.Property("Township") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("WarehouseTypeId") .HasColumnType("uniqueidentifier"); @@ -12614,10 +12616,11 @@ namespace Erp.Platform.Migrations .HasMaxLength(500) .HasColumnType("nvarchar(500)"); - b.Property("Humidity") + b.Property("Humidity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("IsActive") .ValueGeneratedOnAdd() @@ -12643,10 +12646,11 @@ namespace Erp.Platform.Migrations .HasMaxLength(50) .HasColumnType("nvarchar(50)"); - b.Property("Temperature") + b.Property("Temperature") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("TenantId") .HasColumnType("uniqueidentifier") diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs index aa1accc7..46299f31 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251124204213_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251125092407_Initial.cs @@ -3929,7 +3929,7 @@ namespace Erp.Platform.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - Country = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true), + Country = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Code = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), PlateCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), @@ -4193,8 +4193,8 @@ namespace Erp.Platform.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - Country = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true), - City = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: false), + Country = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + City = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Township = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), CityId = table.Column(type: "uniqueidentifier", nullable: true), @@ -4342,9 +4342,9 @@ namespace Erp.Platform.Migrations SectorId = table.Column(type: "uniqueidentifier", nullable: false), TaxNumber = table.Column(type: "bigint", nullable: false), TaxOffice = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), - Country = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - City = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - District = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + Country = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + City = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + District = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Township = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), Address1 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), Address2 = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), @@ -5660,17 +5660,17 @@ namespace Erp.Platform.Migrations Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), - Country = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - District = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - Township = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - PostalCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), WarehouseTypeId = table.Column(type: "uniqueidentifier", nullable: false), + Country = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + City = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + District = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Township = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + PostalCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), IsMainWarehouse = table.Column(type: "bit", nullable: false, defaultValue: false), - Capacity = table.Column(type: "int", nullable: false, defaultValue: 0), + Capacity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), TemperatureControlled = table.Column(type: "bit", nullable: false, defaultValue: false), - SecurityLevel = table.Column(type: "int", nullable: false, defaultValue: 1), + Security = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), @@ -6084,12 +6084,12 @@ namespace Erp.Platform.Migrations Id = table.Column(type: "uniqueidentifier", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: true), WarehouseId = table.Column(type: "uniqueidentifier", nullable: false), + ZoneTypeId = table.Column(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - ZoneTypeId = table.Column(type: "uniqueidentifier", nullable: false), - Temperature = table.Column(type: "int", nullable: true, defaultValue: 0), - Humidity = table.Column(type: "int", nullable: true, defaultValue: 0), + Temperature = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Humidity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), @@ -6221,12 +6221,12 @@ namespace Erp.Platform.Migrations TenantId = table.Column(type: "uniqueidentifier", nullable: true), WarehouseId = table.Column(type: "uniqueidentifier", nullable: false), ZoneId = table.Column(type: "uniqueidentifier", nullable: false), + LocationTypeId = table.Column(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - LocationTypeId = table.Column(type: "uniqueidentifier", nullable: false), - Capacity = table.Column(type: "int", nullable: false, defaultValue: 0), - CurrentStock = table.Column(type: "int", nullable: false, defaultValue: 0), + 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), IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index e0e710d9..d8e17b37 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -1721,8 +1721,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(16)"); b.Property("Country") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CountryId") .HasColumnType("uniqueidentifier"); @@ -3673,15 +3673,15 @@ namespace Erp.Platform.Migrations b.Property("City") .IsRequired() - .HasMaxLength(16) - .HasColumnType("nvarchar(16)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CityId") .HasColumnType("uniqueidentifier"); b.Property("Country") - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -6077,10 +6077,11 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Capacity") + b.Property("Capacity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("Code") .IsRequired() @@ -6095,10 +6096,11 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); - b.Property("CurrentStock") + b.Property("CurrentStock") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("DeleterId") .HasColumnType("uniqueidentifier") @@ -8015,8 +8017,8 @@ namespace Erp.Platform.Migrations b.Property("City") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Code") .IsRequired() @@ -8025,8 +8027,8 @@ namespace Erp.Platform.Migrations b.Property("Country") .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -8074,8 +8076,8 @@ namespace Erp.Platform.Migrations .HasDefaultValue(0m); b.Property("District") - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Email") .IsRequired() @@ -12022,14 +12024,15 @@ namespace Erp.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Capacity") + b.Property("Capacity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("City") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("Code") .IsRequired() @@ -12037,8 +12040,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(50)"); b.Property("Country") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -12061,8 +12064,8 @@ namespace Erp.Platform.Migrations .HasColumnType("nvarchar(500)"); b.Property("District") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("EmployeeId") .HasColumnType("uniqueidentifier"); @@ -12100,10 +12103,9 @@ namespace Erp.Platform.Migrations .HasMaxLength(20) .HasColumnType("nvarchar(20)"); - b.Property("SecurityLevel") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(1); + b.Property("Security") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); b.Property("TemperatureControlled") .ValueGeneratedOnAdd() @@ -12115,8 +12117,8 @@ namespace Erp.Platform.Migrations .HasColumnName("TenantId"); b.Property("Township") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("WarehouseTypeId") .HasColumnType("uniqueidentifier"); @@ -12611,10 +12613,11 @@ namespace Erp.Platform.Migrations .HasMaxLength(500) .HasColumnType("nvarchar(500)"); - b.Property("Humidity") + b.Property("Humidity") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("IsActive") .ValueGeneratedOnAdd() @@ -12640,10 +12643,11 @@ namespace Erp.Platform.Migrations .HasMaxLength(50) .HasColumnType("nvarchar(50)"); - b.Property("Temperature") + b.Property("Temperature") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); b.Property("TenantId") .HasColumnType("uniqueidentifier") diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 4f60a97e..be7fa539 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -100,9 +100,7 @@ "props": null, "description": null, "isActive": true, - "dependencies": [ - "DynamicEntityComponent" - ] + "dependencies": ["DynamicEntityComponent"] } ], "ReportCategories": [ @@ -2431,12 +2429,7 @@ "minSalary": 80000, "maxSalary": 120000, "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", @@ -4131,9 +4124,7 @@ { "postContent": "CI/CD pipeline güncellememiz tamamlandı! Deployment süremiz %40 azaldı. Otomasyonun gücü 💪", "type": "video", - "urls": [ - "https://www.w3schools.com/html/mov_bbb.mp4" - ] + "urls": ["https://www.w3schools.com/html/mov_bbb.mp4"] } ], "SocialPollOptions": [ @@ -5316,5 +5307,122 @@ "description": "Sıvı malzemelerin depolandığı tanklar", "isActive": true } + ], + "Warehouses": [ + { + "code": "WH-001", + "name": "Merkez Depo", + "description": "Ana depo alanı", + "employeeCode": "EMP-001", + "warehouseTypeCode": "RawMaterials", + "country": "TR", + "isMainWarehouse": true, + "capacity": 10000, + "isActive": true, + "temperatureControlled": false, + "security": "Low" + }, + { + "code": "WH-002", + "name": "Yedek Parça Deposu", + "description": "Yedek parçaların depolandığı alan", + "employeeCode": "EMP-002", + "warehouseTypeCode": "FinishedGoods", + "country": "TR", + "isMainWarehouse": false, + "capacity": 5000, + "isActive": true, + "temperatureControlled": false, + "security": "Low" + } + ], + "Zones": [ + { + "warehouseCode": "WH-001", + "zoneTypeCode": "Receiving", + "code": "Z001", + "name": "Giriş Bölgesi", + "description": "Malzeme kabul bölgesi", + "temperature": 20, + "humidity": 45, + "isActive": true + }, + { + "warehouseCode": "WH-001", + "zoneTypeCode": "Storage", + "code": "Z002", + "name": "Ana Depolama", + "description": "Ana depolama alanı", + "temperature": 18, + "humidity": 40, + "isActive": true + }, + { + "warehouseCode": "WH-002", + "zoneTypeCode": "Picking", + "code": "Z003", + "name": "Sevkiyat Hazırlık", + "description": "Sevkiyat hazırlık alanı", + "temperature": 22, + "humidity": 50, + "isActive": true + } + ], + "Locations": [ + { + "warehouseCode": "WH-001", + "zoneCode": "Z001", + "locationTypeCode": "Raf", + "code": "A01-01-01", + "name": "A Blok 1. Koridor 1. Raf", + "description": "Yüksek raf - Ağır malzemeler", + "capacity": 100, + "currentStock": 75, + "isActive": true + }, + { + "warehouseCode": "WH-001", + "zoneCode": "Z002", + "locationTypeCode": "Kutu", + "code": "A01-01-02", + "name": "A Blok 1. Koridor 2. Raf", + "description": "Orta raf - Orta ağırlık malzemeler", + "capacity": 50, + "currentStock": 30, + "isActive": true + }, + { + "warehouseCode": "WH-002", + "zoneCode": "Z003", + "locationTypeCode": "Zemin", + "code": "B02-02-01", + "name": "B Blok 2. Koridor 1. Raf", + "description": "Küçük parçalar rafı", + "capacity": 200, + "currentStock": 180, + "isActive": true + }, + { + "warehouseCode": "WH-002", + "zoneCode": "Z003", + "locationTypeCode": "Palet", + "code": "B02-02-01", + "name": "B Blok 2. Koridor 1. Raf", + "description": "Küçük parçalar rafı", + "capacity": 200, + "currentStock": 180, + "isActive": true + }, + { + "warehouseCode": "WH-001", + "zoneCode": "Z001", + "locationTypeCode": "Raf", + "code": "C01-02-01", + "name": "C Blok 2. Koridor 1. Raf", + "description": "Büyük parçalar rafı", + "capacity": 200, + "currentStock": 180, + "isActive": true + } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index bbfd5f4d..29601272 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -116,8 +116,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _workorderTypeRepository; private readonly IRepository _workorderStatusRepository; private readonly IRepository _warehouseTypeRepository; + private readonly IRepository _warehouseRepository; private readonly IRepository _zoneTypeRepository; + private readonly IRepository _zoneRepository; private readonly IRepository _locationTypeRepository; + private readonly IRepository _locationRepository; public TenantDataSeeder( IClock clock, @@ -217,8 +220,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository workorderTypeRepository, IRepository workorderStatusRepository, IRepository warehouseTypeRepository, + IRepository warehouseRepository, IRepository zoneTypeRepository, - IRepository locationTypeRepository + IRepository zoneRepository, + IRepository locationTypeRepository, + IRepository locationRepository ) { _clock = clock; @@ -319,8 +325,11 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _workorderTypeRepository = workorderTypeRepository; _workorderStatusRepository = workorderStatusRepository; _warehouseTypeRepository = warehouseTypeRepository; + _warehouseRepository = warehouseRepository; _zoneTypeRepository = zoneTypeRepository; + _zoneRepository = zoneRepository; _locationTypeRepository = locationTypeRepository; + _locationRepository = locationRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2156,6 +2165,79 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive }, autoSave: true); } + + foreach (var item in items.Warehouses) + { + var exists = await _warehouseRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var employee = await _employeeRepository.FirstOrDefaultAsync(x => x.Code == item.EmployeeCode); + var warehousetype = await _warehouseTypeRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseTypeCode); + + await _warehouseRepository.InsertAsync(new Warehouse + { + Code = item.Code, + Name = item.Name, + Description = item.Description, + EmployeeId = employee?.Id, + WarehouseTypeId = warehousetype?.Id, + Country = item.Country, + City = item.City, + District = item.District, + Township = item.Township, + PostalCode = item.PostalCode, + IsMainWarehouse = item.IsMainWarehouse, + Capacity = item.Capacity, + TemperatureControlled = item.TemperatureControlled, + Security = item.Security, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.Zones) + { + var exists = await _zoneRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var warehouse = await _warehouseRepository.FirstOrDefaultAsync(x => x.Code == item.WarehouseCode); + var zoneType = await _zoneTypeRepository.FirstOrDefaultAsync(x => x.Code == item.ZoneTypeCode); + + await _zoneRepository.InsertAsync(new Zone + { + WarehouseId = warehouse?.Id, + ZoneTypeId = zoneType?.Id, + Code = item.Code, + Name = item.Name, + Description = item.Description, + Temperature = item.Temperature, + Humidity = item.Humidity, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.Locations) + { + var exists = await _locationRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + 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); + + await _locationRepository.InsertAsync(new Location + { + WarehouseId = warehouse?.Id, + ZoneId = zone?.Id, + LocationTypeId = locationtype?.Id, + Code = item.Code, + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 5b97786b..ab4299c4 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -110,11 +110,60 @@ public class TenantSeederDto //Store public List WarehouseTypes { get; set; } - // public List Warehouses { get; set; } + public List Warehouses { get; set; } public List ZoneTypes { get; set; } - // public List Zones { get; set; } + public List Zones { get; set; } public List LocationTypes { get; set; } - // public List Locations { get; set; } + public List Locations { get; set; } +} + +public class LocationSeedDto +{ + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string WarehouseCode { get; set; } + public string ZoneCode { get; set; } + public string LocationTypeCode { get; set; } + + public decimal Capacity { get; set; } + public decimal CurrentStock { get; set; } + public bool IsActive { get; set; } +} + +public class ZoneSeedDto +{ + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string ZoneTypeCode { get; set; } + public string WarehouseCode { get; set; } + + public decimal Temperature { get; set; } + public decimal Humidity { get; set; } + public bool IsActive { get; set; } +} + +public class WarehouseSeedDto +{ + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string EmployeeCode { get; set; } + public string WarehouseTypeCode { get; set; } + + public string Country { get; set; } + public string City { get; set; } + public string District { get; set; } + public string Township { get; set; } + public string PostalCode { get; set; } + + public bool IsMainWarehouse { get; set; } + public decimal Capacity { get; set; } + public bool TemperatureControlled { get; set; } + public string Security { get; set; } + + public bool IsActive { get; set; } } public class WarehouseTypeSeedDto