From a2788c1d413bb74a81169b112d5138dda42a4dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Mon, 8 Dec 2025 22:12:16 +0300 Subject: [PATCH] Accounting Wayybill Type ve Waybill Status --- .../Seeds/LanguagesData.json | 18 + .../Seeds/ListFormSeeder_Accounting.cs | 259 +++++++++++- .../Seeds/MenusData.json | 42 +- .../Seeds/PermissionsData.json | 126 ++++++ .../Enums/TableNameEnum.cs | 4 + .../TableNameResolver.cs | 14 +- .../Erp.Platform.Domain/Data/SeedConsts.cs | 4 + .../Entities/Branch/Accounting/Waybill.cs | 43 ++ .../Entities/Branch/Accounting/WaybillItem.cs | 31 ++ .../Tenant/Accounting/WaybillStatus.cs | 14 + .../Entities/Tenant/Accounting/WaybillType.cs | 14 + .../EntityFrameworkCore/PlatformDbContext.cs | 37 +- ....cs => 20251208185357_Initial.Designer.cs} | 372 +++++++++++++++++- ...6_Initial.cs => 20251208185357_Initial.cs} | 237 +++++++++-- .../PlatformDbContextModelSnapshot.cs | 370 ++++++++++++++++- .../Tenants/Seeds/TenantData.json | 44 +++ .../Tenants/TenantDataSeeder.cs | 36 +- .../Tenants/TenantSeederDto.cs | 18 + 18 files changed, 1623 insertions(+), 60 deletions(-) create mode 100644 api/src/Erp.Platform.Domain/Entities/Branch/Accounting/Waybill.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Branch/Accounting/WaybillItem.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillStatus.cs create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillType.cs rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251208072106_Initial.Designer.cs => 20251208185357_Initial.Designer.cs} (98%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251208072106_Initial.cs => 20251208185357_Initial.cs} (98%) diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index da97e9a3..13cd59a1 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -10159,6 +10159,24 @@ "tr": "Planlama Gantt", "en": "Planning Gantt" }, + { + "resourceName": "Platform", + "key": "App.Accounting.WaybillType", + "tr": "İrsaliye Türleri", + "en": "Waybill Types" + }, + { + "resourceName": "Platform", + "key": "App.Accounting.Definitions", + "tr": "Tanımlamalar", + "en": "Definitions" + }, + { + "resourceName": "Platform", + "key": "App.Accounting.WaybillStatus", + "tr": "İrsaliye Durumları", + "en": "Waybill Statuses" + }, { "resourceName": "Platform", "key": "App.Accounting.CurrentAccount", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs index 0696ee5c..6996def8 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Accounting.cs @@ -53,7 +53,8 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -353,7 +354,8 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = true, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -518,7 +520,8 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -719,7 +722,8 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende var listForm = await _listFormRepository.InsertAsync( new ListForm() { - ListFormType = ListFormTypeEnum.List, ExportJson = DefaultExportJson, + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, LayoutJson = DefaultLayoutJson(), @@ -1027,6 +1031,253 @@ public class ListFormSeeder_Accounting : IDataSeedContributor, ITransientDepende #endregion } #endregion + + #region Waybill Status + listFormName = AppCodes.Accounting.WaybillStatus; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WaybillStatus)), + 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.WaybillStatus)), + 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 = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }, autoSave: true + ); + + #region WaybillStatus Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 350, + ListOrderNo = 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 = 500, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ], autoSave: true); + #endregion + } + #endregion + + #region Waybill Type + listFormName = AppCodes.Accounting.WaybillType; + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == listFormName)) + { + var listForm = await _listFormRepository.InsertAsync( + new ListForm() + { + ListFormType = ListFormTypeEnum.List, + ExportJson = DefaultExportJson, + IsSubForm = false, + ShowNote = true, + LayoutJson = DefaultLayoutJson(), + CultureName = LanguageCodes.En, + ListFormCode = listFormName, + Name = listFormName, + Title = listFormName, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = true, + IsBranch = false, + IsOrganizationUnit = false, + Description = listFormName, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WaybillType)), + 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.WaybillType)), + 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 = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "Description", ColSpan = 1, EditorType2=EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2=EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }, autoSave: true + ); + + #region WaybillType Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 350, + ListOrderNo = 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 = 500, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + } + ], autoSave: true); + #endregion + } + #endregion + } } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index eb2c8915..3c0a4ba3 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -3187,11 +3187,41 @@ "RequiredPermissionName": null, "IsDisabled": false }, + { + "ParentCode": "App.Accounting", + "Code": "App.Accounting.Definitions", + "DisplayName": "App.Accounting.Definitions", + "Order": 1, + "Url": null, + "Icon": "FcFilingCabinet", + "RequiredPermissionName": null, + "IsDisabled": false + }, + { + "ParentCode": "App.Accounting.Definitions", + "Code": "App.Accounting.WaybillType", + "DisplayName": "App.Accounting.WaybillType", + "Order": 1, + "Url": "/admin/list/App.Accounting.WaybillType", + "Icon": "FcShare", + "RequiredPermissionName": "App.Accounting.WaybillType", + "IsDisabled": false + }, + { + "ParentCode": "App.Accounting.Definitions", + "Code": "App.Accounting.WaybillStatus", + "DisplayName": "App.Accounting.WaybillStatus", + "Order": 2, + "Url": "/admin/list/App.Accounting.WaybillStatus", + "Icon": "FcSwitch", + "RequiredPermissionName": "App.Accounting.WaybillStatus", + "IsDisabled": false + }, { "ParentCode": "App.Accounting", "Code": "App.Accounting.Cash", "DisplayName": "App.Accounting.Cash", - "Order": 1, + "Order": 2, "Url": "/admin/list/App.Accounting.Cash", "Icon": "FcCurrencyExchange", "RequiredPermissionName": "App.Accounting.Cash", @@ -3201,7 +3231,7 @@ "ParentCode": "App.Accounting", "Code": "App.Accounting.Bank", "DisplayName": "App.Accounting.Bank", - "Order": 2, + "Order": 3, "Url": "/admin/list/App.Accounting.Bank", "Icon": "FcHome", "RequiredPermissionName": "App.Accounting.Bank", @@ -3211,7 +3241,7 @@ "ParentCode": "App.Accounting", "Code": "App.Accounting.CurrentAccount", "DisplayName": "App.Accounting.CurrentAccount", - "Order": 3, + "Order": 4, "Url": "/admin/list/App.Accounting.CurrentAccount", "Icon": "FcDebt", "RequiredPermissionName": "App.Accounting.CurrentAccount", @@ -3221,7 +3251,7 @@ "ParentCode": "App.Accounting", "Code": "App.Accounting.Waybill", "DisplayName": "App.Accounting.Waybill", - "Order": 4, + "Order": 5, "Url": "/admin/accounting/waybills", "Icon": "FcSurvey", "RequiredPermissionName": "App.Accounting.Waybill", @@ -3231,7 +3261,7 @@ "ParentCode": "App.Accounting", "Code": "App.Accounting.Invoice", "DisplayName": "App.Accounting.Invoice", - "Order": 5, + "Order": 6, "Url": "/admin/accounting/invoices", "Icon": "FcSalesPerformance", "RequiredPermissionName": "App.Accounting.Invoice", @@ -3241,7 +3271,7 @@ "ParentCode": "App.Accounting", "Code": "App.Accounting.CheckNote", "DisplayName": "App.Accounting.CheckNote", - "Order": 6, + "Order": 7, "Url": "/admin/accounting/check-note", "Icon": "FcInspection", "RequiredPermissionName": "App.Accounting.CheckNote", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index f61cddaf..5d23b510 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -13180,6 +13180,132 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType", + "ParentName": null, + "DisplayName": "App.Accounting.WaybillType", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Create", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Update", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Delete", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Export", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Import", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillType.Note", + "ParentName": "App.Accounting.WaybillType", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus", + "ParentName": null, + "DisplayName": "App.Accounting.WaybillStatus", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Create", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Update", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Delete", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Export", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Import", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Accounting", + "Name": "App.Accounting.WaybillStatus.Note", + "ParentName": "App.Accounting.WaybillStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, { "GroupName": "App.Accounting", "Name": "App.Accounting.Waybill", diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index e951cef8..ea3b34b9 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -218,4 +218,8 @@ public enum TableNameEnum MovementType, ReferenceType, TransferItem, //Gerçek bir tablo ismi değil. View eklemek amacıyla eklendi. + WaybillType, + WaybillStatus, + Waybill, + WaybillItem } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index 2913c8a1..d2e584d8 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -214,10 +214,14 @@ public static class TableNameResolver // 🔹 ACCOUNTING - { nameof(TableNameEnum.Bank), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, - { nameof(TableNameEnum.BankAccount), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, - { nameof(TableNameEnum.Cash), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, - { nameof(TableNameEnum.CurrentAccount), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.WaybillType), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.WaybillStatus), (TablePrefix.TenantByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.Bank), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.BankAccount), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.Cash), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.CurrentAccount), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.Waybill), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, + { nameof(TableNameEnum.WaybillItem), (TablePrefix.BranchByName, MenuPrefix.Accounting) }, // 🔹 STORE { nameof(TableNameEnum.WarehouseType), (TablePrefix.TenantByName, MenuPrefix.Store) }, @@ -282,7 +286,7 @@ public static class TableNameResolver public static string GetFullSpecialViewName(MenuPrefix menu, string Prefix, string objectName) { - return $"{ViewPrefix}{MenuPrefixExtensions.ToPrefix(menu)}_{Prefix}_{objectName}"; + return $"{ViewPrefix}{MenuPrefixExtensions.ToPrefix(menu)}_{Prefix}_{objectName}"; } } diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index cc2ecf4b..74f96b26 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -567,6 +567,10 @@ public static class SeedConsts public const string BankAccount = Default + ".BankAccount"; public const string Cash = Default + ".Cash"; public const string CurrentAccount = Default + ".CurrentAccount"; + public const string WaybillType = Default + ".WaybillType"; + public const string WaybillStatus = Default + ".WaybillStatus"; + public const string Waybill = Default + ".Waybill"; + public const string WaybillItem = Default + ".WaybillItem"; } public static class Store diff --git a/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/Waybill.cs b/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/Waybill.cs new file mode 100644 index 00000000..51c2da76 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/Waybill.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class Waybill : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + public Guid? BranchId { get; set; } + + public string WaybillNumber { get; set; } + public Guid WaybillTypeId { get; set; } + public WaybillType WaybillType { get; set; } + + public Guid CurrentAccountId { get; set; } + public CurrentAccount CurrentAccount { get; set; } + + public DateTime WaybillDate { get; set; } + public DateTime? DeliveryDate { get; set; } + + public double Subtotal { get; set; } + public double TaxAmount { get; set; } + public double DiscountAmount { get; set; } + public double TotalAmount { get; set; } + public string Currency { get; set; } + + public Guid WaybillStatusId { get; set; } + public WaybillStatus WaybillStatus { get; set; } + + public bool IsInvoiced { get; set; } + public Guid? InvoiceId { get; set; } + + public string DeliveryAddress { get; set; } + public string ReceiverName { get; set; } + public string ReceiverPhone { get; set; } + public string CarrierCompany { get; set; } + public string TrackingNumber { get; set; } + public string Notes { get; set; } + + public ICollection Items { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/WaybillItem.cs b/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/WaybillItem.cs new file mode 100644 index 00000000..5932894b --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Branch/Accounting/WaybillItem.cs @@ -0,0 +1,31 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class WaybillItem : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + public Guid? BranchId { get; set; } + + public Guid WaybillId { get; set; } + public Waybill Waybill { get; set; } + + public Guid? MaterialId { get; set; } + public Material Material { get; set; } + + public string Description { get; set; } + + public double Quantity { get; set; } + public string Unit { get; set; } + public double UnitPrice { get; set; } + public double LineTotal { get; set; } + + public double DiscountRate { get; set; } + public double DiscountAmount { get; set; } + + public double TaxRate { get; set; } + public double TaxAmount { get; set; } + public double NetAmount { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillStatus.cs new file mode 100644 index 00000000..ff78c619 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillStatus.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class WaybillStatus : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillType.cs new file mode 100644 index 00000000..76afe974 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Accounting/WaybillType.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class WaybillType : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 9674d3c9..ec4aa340 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -236,13 +236,6 @@ public class PlatformDbContext : public DbSet SalesOrderStatuses { get; set; } #endregion - #region Accounting - public DbSet Banks { get; set; } - public DbSet BankAccounts { get; set; } - public DbSet CashAccounts { get; set; } - public DbSet CurrentAccounts { get; set; } - #endregion - #region Store public DbSet WarehouseTypes { get; set; } public DbSet Warehouses { get; set; } @@ -300,6 +293,17 @@ public class PlatformDbContext : public DbSet ProjectTaskDailies { get; set; } #endregion + #region Accounting + public DbSet Banks { get; set; } + public DbSet BankAccounts { get; set; } + public DbSet CashAccounts { get; set; } + public DbSet CurrentAccounts { get; set; } + public DbSet WaybillTypes { get; set; } + public DbSet WaybillStatuses { get; set; } + public DbSet Waybills { get; set; } + public DbSet WaybillItems { get; set; } + #endregion + public PlatformDbContext(DbContextOptions options) : base(options) { @@ -3872,5 +3876,24 @@ public class PlatformDbContext : .OnDelete(DeleteBehavior.Restrict); }); + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.WaybillStatus)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.WaybillType)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(50); + b.Property(x => x.Description).HasMaxLength(500); + b.Property(x => x.IsActive).HasDefaultValue(true); + }); } } \ No newline at end of file diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.Designer.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.Designer.cs index 69ea2ff9..7e8bd8f2 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251208072106_Initial")] + [Migration("20251208185357_Initial")] partial class Initial { /// @@ -1218,7 +1218,7 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); - b.ToTable("Acc_T_Bank", (string)null); + b.ToTable("Acc_B_Bank", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.BankAccount", b => @@ -1289,7 +1289,7 @@ namespace Erp.Platform.Migrations b.HasIndex("BankId"); - b.ToTable("Acc_T_BankAccount", (string)null); + b.ToTable("Acc_B_BankAccount", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Behavior", b => @@ -2074,7 +2074,7 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); - b.ToTable("Acc_T_Cash", (string)null); + b.ToTable("Acc_B_Cash", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Category", b => @@ -3568,7 +3568,7 @@ namespace Erp.Platform.Migrations b.HasIndex("PaymentTermId"); - b.ToTable("Acc_T_CurrentAccount", (string)null); + b.ToTable("Acc_B_CurrentAccount", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.CustomComponent", b => @@ -14958,6 +14958,319 @@ namespace Erp.Platform.Migrations b.ToTable("Str_T_WarehouseType", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("CarrierCompany") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("CurrentAccountId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliveryAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("DiscountAmount") + .HasColumnType("float"); + + b.Property("InvoiceId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsInvoiced") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiverName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiverPhone") + .HasColumnType("nvarchar(max)"); + + b.Property("Subtotal") + .HasColumnType("float"); + + b.Property("TaxAmount") + .HasColumnType("float"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalAmount") + .HasColumnType("float"); + + b.Property("TrackingNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("WaybillDate") + .HasColumnType("datetime2"); + + b.Property("WaybillNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("WaybillStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("WaybillTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CurrentAccountId"); + + b.HasIndex("WaybillStatusId"); + + b.HasIndex("WaybillTypeId"); + + b.ToTable("Waybills"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillItem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DiscountAmount") + .HasColumnType("float"); + + b.Property("DiscountRate") + .HasColumnType("float"); + + 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("LineTotal") + .HasColumnType("float"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("NetAmount") + .HasColumnType("float"); + + b.Property("Quantity") + .HasColumnType("float"); + + b.Property("TaxAmount") + .HasColumnType("float"); + + b.Property("TaxRate") + .HasColumnType("float"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Unit") + .HasColumnType("nvarchar(max)"); + + b.Property("UnitPrice") + .HasColumnType("float"); + + b.Property("WaybillId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("WaybillId"); + + b.ToTable("WaybillItems"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillStatus", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Acc_T_WaybillStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Acc_T_WaybillType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.WorkHour", b => { b.Property("Id") @@ -20268,6 +20581,50 @@ namespace Erp.Platform.Migrations b.Navigation("WarehouseType"); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount") + .WithMany() + .HasForeignKey("CurrentAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WaybillStatus", "WaybillStatus") + .WithMany() + .HasForeignKey("WaybillStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WaybillType", "WaybillType") + .WithMany() + .HasForeignKey("WaybillTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CurrentAccount"); + + b.Navigation("WaybillStatus"); + + b.Navigation("WaybillType"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillItem", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId"); + + b.HasOne("Erp.Platform.Entities.Waybill", "Waybill") + .WithMany("Items") + .HasForeignKey("WaybillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Waybill"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Workcenter", b => { b.HasOne("Erp.Platform.Entities.Department", "Department") @@ -21103,6 +21460,11 @@ namespace Erp.Platform.Migrations b.Navigation("Warehouses"); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.Navigation("Items"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Workcenter", b => { b.Navigation("Operations"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.cs index 837a6d1d..be81d3d9 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208072106_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251208185357_Initial.cs @@ -435,7 +435,7 @@ namespace Erp.Platform.Migrations }); migrationBuilder.CreateTable( - name: "Acc_T_Bank", + name: "Acc_B_Bank", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -461,11 +461,11 @@ namespace Erp.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_Acc_T_Bank", x => x.Id); + table.PrimaryKey("PK_Acc_B_Bank", x => x.Id); }); migrationBuilder.CreateTable( - name: "Acc_T_Cash", + name: "Acc_B_Cash", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -487,7 +487,51 @@ namespace Erp.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_Acc_T_Cash", x => x.Id); + table.PrimaryKey("PK_Acc_B_Cash", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Acc_T_WaybillStatus", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Acc_T_WaybillStatus", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Acc_T_WaybillType", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Acc_T_WaybillType", x => x.Id); }); migrationBuilder.CreateTable( @@ -3402,7 +3446,7 @@ namespace Erp.Platform.Migrations }); migrationBuilder.CreateTable( - name: "Acc_T_BankAccount", + name: "Acc_B_BankAccount", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -3423,11 +3467,11 @@ namespace Erp.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_Acc_T_BankAccount", x => x.Id); + table.PrimaryKey("PK_Acc_B_BankAccount", x => x.Id); table.ForeignKey( - name: "FK_Acc_T_BankAccount_Acc_T_Bank_BankId", + name: "FK_Acc_B_BankAccount_Acc_B_Bank_BankId", column: x => x.BankId, - principalTable: "Acc_T_Bank", + principalTable: "Acc_B_Bank", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); @@ -5060,7 +5104,7 @@ namespace Erp.Platform.Migrations }); migrationBuilder.CreateTable( - name: "Acc_T_CurrentAccount", + name: "Acc_B_CurrentAccount", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -5088,14 +5132,114 @@ namespace Erp.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_Acc_T_CurrentAccount", x => x.Id); + table.PrimaryKey("PK_Acc_B_CurrentAccount", x => x.Id); table.ForeignKey( - name: "FK_Acc_T_CurrentAccount_Scp_T_PaymentTerm_PaymentTermId", + name: "FK_Acc_B_CurrentAccount_Scp_T_PaymentTerm_PaymentTermId", column: x => x.PaymentTermId, principalTable: "Scp_T_PaymentTerm", principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "Waybills", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + BranchId = table.Column(type: "uniqueidentifier", nullable: true), + WaybillNumber = table.Column(type: "nvarchar(max)", nullable: true), + WaybillTypeId = table.Column(type: "uniqueidentifier", nullable: false), + CurrentAccountId = table.Column(type: "uniqueidentifier", nullable: false), + WaybillDate = table.Column(type: "datetime2", nullable: false), + DeliveryDate = table.Column(type: "datetime2", nullable: true), + Subtotal = table.Column(type: "float", nullable: false), + TaxAmount = table.Column(type: "float", nullable: false), + DiscountAmount = table.Column(type: "float", nullable: false), + TotalAmount = table.Column(type: "float", nullable: false), + Currency = table.Column(type: "nvarchar(max)", nullable: true), + WaybillStatusId = table.Column(type: "uniqueidentifier", nullable: false), + IsInvoiced = table.Column(type: "bit", nullable: false), + InvoiceId = table.Column(type: "uniqueidentifier", nullable: true), + DeliveryAddress = table.Column(type: "nvarchar(max)", nullable: true), + ReceiverName = table.Column(type: "nvarchar(max)", nullable: true), + ReceiverPhone = table.Column(type: "nvarchar(max)", nullable: true), + CarrierCompany = table.Column(type: "nvarchar(max)", nullable: true), + TrackingNumber = table.Column(type: "nvarchar(max)", nullable: true), + Notes = table.Column(type: "nvarchar(max)", nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Waybills", x => x.Id); + table.ForeignKey( + name: "FK_Waybills_Acc_B_CurrentAccount_CurrentAccountId", + column: x => x.CurrentAccountId, + principalTable: "Acc_B_CurrentAccount", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Waybills_Acc_T_WaybillStatus_WaybillStatusId", + column: x => x.WaybillStatusId, + principalTable: "Acc_T_WaybillStatus", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Waybills_Acc_T_WaybillType_WaybillTypeId", + column: x => x.WaybillTypeId, + principalTable: "Acc_T_WaybillType", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "WaybillItems", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + BranchId = table.Column(type: "uniqueidentifier", nullable: true), + WaybillId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: true), + Description = table.Column(type: "nvarchar(max)", nullable: true), + Quantity = table.Column(type: "float", nullable: false), + Unit = table.Column(type: "nvarchar(max)", nullable: true), + UnitPrice = table.Column(type: "float", nullable: false), + LineTotal = table.Column(type: "float", nullable: false), + DiscountRate = table.Column(type: "float", nullable: false), + DiscountAmount = table.Column(type: "float", nullable: false), + TaxRate = table.Column(type: "float", nullable: false), + TaxAmount = table.Column(type: "float", nullable: false), + NetAmount = table.Column(type: "float", nullable: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WaybillItems", x => x.Id); + table.ForeignKey( + name: "FK_WaybillItems_Scp_T_Material_MaterialId", + column: x => x.MaterialId, + principalTable: "Scp_T_Material", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_WaybillItems_Waybills_WaybillId", + column: x => x.WaybillId, + principalTable: "Waybills", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "Adm_T_BlogPost", columns: table => new @@ -5877,9 +6021,9 @@ namespace Erp.Platform.Migrations { table.PrimaryKey("PK_Hr_T_Employee", x => x.Id); table.ForeignKey( - name: "FK_Hr_T_Employee_Acc_T_Bank_BankId", + name: "FK_Hr_T_Employee_Acc_B_Bank_BankId", column: x => x.BankId, - principalTable: "Acc_T_Bank", + principalTable: "Acc_B_Bank", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( @@ -8042,18 +8186,18 @@ namespace Erp.Platform.Migrations column: "UserName"); migrationBuilder.CreateIndex( - name: "IX_Acc_T_BankAccount_BankId", - table: "Acc_T_BankAccount", + name: "IX_Acc_B_BankAccount_BankId", + table: "Acc_B_BankAccount", column: "BankId"); migrationBuilder.CreateIndex( - name: "IX_Acc_T_CurrentAccount_PartnerId", - table: "Acc_T_CurrentAccount", + name: "IX_Acc_B_CurrentAccount_PartnerId", + table: "Acc_B_CurrentAccount", column: "PartnerId"); migrationBuilder.CreateIndex( - name: "IX_Acc_T_CurrentAccount_PaymentTermId", - table: "Acc_T_CurrentAccount", + name: "IX_Acc_B_CurrentAccount_PaymentTermId", + table: "Acc_B_CurrentAccount", column: "PaymentTermId"); migrationBuilder.CreateIndex( @@ -9344,9 +9488,34 @@ namespace Erp.Platform.Migrations table: "Str_T_Zone", column: "ZoneTypeId"); + migrationBuilder.CreateIndex( + name: "IX_WaybillItems_MaterialId", + table: "WaybillItems", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_WaybillItems_WaybillId", + table: "WaybillItems", + column: "WaybillId"); + + migrationBuilder.CreateIndex( + name: "IX_Waybills_CurrentAccountId", + table: "Waybills", + column: "CurrentAccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Waybills_WaybillStatusId", + table: "Waybills", + column: "WaybillStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Waybills_WaybillTypeId", + table: "Waybills", + column: "WaybillTypeId"); + migrationBuilder.AddForeignKey( - name: "FK_Acc_T_CurrentAccount_Adm_T_Partner_PartnerId", - table: "Acc_T_CurrentAccount", + name: "FK_Acc_B_CurrentAccount_Adm_T_Partner_PartnerId", + table: "Acc_B_CurrentAccount", column: "PartnerId", principalTable: "Adm_T_Partner", principalColumn: "Id"); @@ -9425,7 +9594,7 @@ namespace Erp.Platform.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( - name: "FK_Hr_T_Employee_Acc_T_Bank_BankId", + name: "FK_Hr_T_Employee_Acc_B_Bank_BankId", table: "Hr_T_Employee"); migrationBuilder.DropForeignKey( @@ -9529,13 +9698,10 @@ namespace Erp.Platform.Migrations name: "AbpUserTokens"); migrationBuilder.DropTable( - name: "Acc_T_BankAccount"); + name: "Acc_B_BankAccount"); migrationBuilder.DropTable( - name: "Acc_T_Cash"); - - migrationBuilder.DropTable( - name: "Acc_T_CurrentAccount"); + name: "Acc_B_Cash"); migrationBuilder.DropTable( name: "Adm_T_About"); @@ -9894,6 +10060,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Str_T_PutawayCondition"); + migrationBuilder.DropTable( + name: "WaybillItems"); + migrationBuilder.DropTable( name: "AbpEntityChanges"); @@ -10026,6 +10195,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Str_T_Putaway"); + migrationBuilder.DropTable( + name: "Waybills"); + migrationBuilder.DropTable( name: "AbpAuditLogs"); @@ -10107,6 +10279,15 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Str_T_ReferenceType"); + migrationBuilder.DropTable( + name: "Acc_B_CurrentAccount"); + + migrationBuilder.DropTable( + name: "Acc_T_WaybillStatus"); + + migrationBuilder.DropTable( + name: "Acc_T_WaybillType"); + migrationBuilder.DropTable( name: "Sas_T_Branch"); @@ -10147,7 +10328,7 @@ namespace Erp.Platform.Migrations name: "Str_T_WarehouseType"); migrationBuilder.DropTable( - name: "Acc_T_Bank"); + name: "Acc_B_Bank"); migrationBuilder.DropTable( name: "Adm_T_Partner"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 28880598..d1b7da33 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -1215,7 +1215,7 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); - b.ToTable("Acc_T_Bank", (string)null); + b.ToTable("Acc_B_Bank", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.BankAccount", b => @@ -1286,7 +1286,7 @@ namespace Erp.Platform.Migrations b.HasIndex("BankId"); - b.ToTable("Acc_T_BankAccount", (string)null); + b.ToTable("Acc_B_BankAccount", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Behavior", b => @@ -2071,7 +2071,7 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); - b.ToTable("Acc_T_Cash", (string)null); + b.ToTable("Acc_B_Cash", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.Category", b => @@ -3565,7 +3565,7 @@ namespace Erp.Platform.Migrations b.HasIndex("PaymentTermId"); - b.ToTable("Acc_T_CurrentAccount", (string)null); + b.ToTable("Acc_B_CurrentAccount", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.CustomComponent", b => @@ -14955,6 +14955,319 @@ namespace Erp.Platform.Migrations b.ToTable("Str_T_WarehouseType", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("CarrierCompany") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("CurrentAccountId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliveryAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("DiscountAmount") + .HasColumnType("float"); + + b.Property("InvoiceId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsInvoiced") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiverName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiverPhone") + .HasColumnType("nvarchar(max)"); + + b.Property("Subtotal") + .HasColumnType("float"); + + b.Property("TaxAmount") + .HasColumnType("float"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalAmount") + .HasColumnType("float"); + + b.Property("TrackingNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("WaybillDate") + .HasColumnType("datetime2"); + + b.Property("WaybillNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("WaybillStatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("WaybillTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CurrentAccountId"); + + b.HasIndex("WaybillStatusId"); + + b.HasIndex("WaybillTypeId"); + + b.ToTable("Waybills"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillItem", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DiscountAmount") + .HasColumnType("float"); + + b.Property("DiscountRate") + .HasColumnType("float"); + + 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("LineTotal") + .HasColumnType("float"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("NetAmount") + .HasColumnType("float"); + + b.Property("Quantity") + .HasColumnType("float"); + + b.Property("TaxAmount") + .HasColumnType("float"); + + b.Property("TaxRate") + .HasColumnType("float"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Unit") + .HasColumnType("nvarchar(max)"); + + b.Property("UnitPrice") + .HasColumnType("float"); + + b.Property("WaybillId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("WaybillId"); + + b.ToTable("WaybillItems"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillStatus", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Acc_T_WaybillStatus", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillType", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("Acc_T_WaybillType", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.WorkHour", b => { b.Property("Id") @@ -20265,6 +20578,50 @@ namespace Erp.Platform.Migrations b.Navigation("WarehouseType"); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.HasOne("Erp.Platform.Entities.CurrentAccount", "CurrentAccount") + .WithMany() + .HasForeignKey("CurrentAccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WaybillStatus", "WaybillStatus") + .WithMany() + .HasForeignKey("WaybillStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WaybillType", "WaybillType") + .WithMany() + .HasForeignKey("WaybillTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CurrentAccount"); + + b.Navigation("WaybillStatus"); + + b.Navigation("WaybillType"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.WaybillItem", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId"); + + b.HasOne("Erp.Platform.Entities.Waybill", "Waybill") + .WithMany("Items") + .HasForeignKey("WaybillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Waybill"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Workcenter", b => { b.HasOne("Erp.Platform.Entities.Department", "Department") @@ -21100,6 +21457,11 @@ namespace Erp.Platform.Migrations b.Navigation("Warehouses"); }); + modelBuilder.Entity("Erp.Platform.Entities.Waybill", b => + { + b.Navigation("Items"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Workcenter", b => { b.Navigation("Operations"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index 11705cc2..f11e7e36 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -6688,5 +6688,49 @@ "serialNumber": null, "description": "Depo transferi" } + ], + "WaybillStatuses": [ + { + "name": "Taslak", + "description": "Taslak aşamasında", + "isActive": true + }, + { + "name": "Onaylandı", + "description": "Onaylanmış durumda", + "isActive": true + }, + { + "name": "Teslim Edildi", + "description": "Teslim edilmiş durumda", + "isActive": true + }, + { + "name": "İptal", + "description": "İptal edilmiş durumda", + "isActive": true + } + ], + "WaybillTypes": [ + { + "name": "Çıkış İrsaliyesi", + "description": "Malzeme çıkışları için kullanılan irsaliye türü", + "isActive": true + }, + { + "name": "Giriş İrsaliyesi", + "description": "Malzeme girişleri için kullanılan irsaliye türü", + "isActive": true + }, + { + "name": "Transfer İrsaliyesi", + "description": "Malzeme transferleri için kullanılan irsaliye türü", + "isActive": true + }, + { + "name": "İade İrsaliyesi", + "description": "Malzeme iadeleri için kullanılan irsaliye türü", + "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 935d5cc1..63c1b0a7 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -147,6 +147,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _referenceTypeRepository; private readonly IRepository _movementRepository; private readonly IRepository _movementItemRepository; + private readonly IRepository _waybillStatusRepository; + private readonly IRepository _waybillTypeRepository; public TenantDataSeeder( IClock clock, @@ -275,7 +277,9 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository movementTypeRepository, IRepository referenceTypeRepository, IRepository movementRepository, - IRepository movementItemRepository + IRepository movementItemRepository, + IRepository waybillStatusRepository, + IRepository waybillTypeRepository ) { _clock = clock; @@ -406,6 +410,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _referenceTypeRepository = referenceTypeRepository; _movementRepository = movementRepository; _movementItemRepository = movementItemRepository; + _waybillStatusRepository = waybillStatusRepository; + _waybillTypeRepository = waybillTypeRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2844,6 +2850,34 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency Description = item.Description }, autoSave: true); } + + foreach (var item in items.WaybillStatuses) + { + var exists = await _waybillStatusRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _waybillStatusRepository.InsertAsync(new WaybillStatus + { + Name = item.Name, + Description = item.Description, + IsActive = item.IsActive + }, autoSave: true); + } + + foreach (var item in items.WaybillTypes) + { + var exists = await _waybillTypeRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _waybillTypeRepository.InsertAsync(new WaybillType + { + 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 b4999355..b53090c5 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -147,6 +147,24 @@ public class TenantSeederDto public List ReferenceTypes { get; set; } public List Movements { get; set; } public List MovementItems { get; set; } + + //Accounting + public List WaybillTypes { get; set; } + public List WaybillStatuses { get; set; } +} + +public class WaybillTypeSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + +public class WaybillStatusSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } } public class MovementSeedDto