diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index 171a1bac..fc23bd5c 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -9439,6 +9439,12 @@ "tr": "Teklif Durumları", "en": "Quotation Status" }, + { + "resourceName": "Platform", + "key": "App.SupplyChain.OrderStatus", + "tr": "Sipariş Durumları", + "en": "Order Status" + }, { "resourceName": "Platform", "key": "App.SupplyChain.MaterialType", @@ -9537,10 +9543,16 @@ }, { "resourceName": "Platform", - "key": "App.SupplyChain.Order", + "key": "App.SupplyChain.PurchaseOrder", "tr": "Siparişler", "en": "Orders" }, + { + "resourceName": "Platform", + "key": "App.SupplyChain.PurchaseOrderItem", + "tr": "Sipariş Ürünleri", + "en": "Order Items" + }, { "resourceName": "Platform", "key": "App.SupplyChain.Delivery", diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs index bc76b476..7e2d9d2f 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs @@ -2080,7 +2080,7 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency ExportJson = DefaultExportJson, IsSubForm = false, ShowNote = true, - LayoutJson = DefaultLayoutJson(), + LayoutJson = DefaultLayoutJson("gantt"), CultureName = LanguageCodes.En, ListFormCode = listFormName, Name = listFormName, diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs index 45ef76d7..ab5f034b 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_SupplyChain.cs @@ -4357,5 +4357,687 @@ public class ListFormSeeder_SupplyChain : IDataSeedContributor, ITransientDepend } }) ); + + #region Order Status + listFormName = AppCodes.SupplyChain.OrderStatus; + 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.OrderStatus)), + 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.OrderStatus)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 300, true, true, true, true, false), + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="Name", ColSpan = 1, IsRequired =true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField="Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 3, DataField="IsActive", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + } + ); + + #region Payment Term 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, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Name", + Width = 300, + 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 = "Description", + Width = 500, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ]); + #endregion + } + #endregion + + #region Purchase Order + listFormName = AppCodes.SupplyChain.PurchaseOrder; + 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.PurchaseOrder)), + 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.PurchaseOrder)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 500, true, true, true, true, false), + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="OrderNumber", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox, EditorOptions = EditorOptionValues.Disabled }, + new EditingFormItemDto { Order = 2, DataField="SupplierId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 3, DataField="OrderDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateFormat }, + new EditingFormItemDto { Order = 4, DataField="PaymentTermId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="RequestId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 6, DataField="QuotationId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 7, DataField="Terms", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 8, DataField="Notes", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, + new EditingFormItemDto { Order = 9, DataField="Currency", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 10, DataField="ExchangeRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 11, DataField="Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "OrderNumber", FieldDbType = DbType.String, Value = "@AUTONUMBER", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "OrderDate", FieldDbType = DbType.Date, Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ExchangeRate", FieldDbType = DbType.Decimal, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Status", FieldDbType = DbType.String, Value = "Taslak", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] { + new() { + Hint = "Manage", + Text ="Manage", + UrlTarget="_blank", + AuthName = listFormName, + Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id", + IsVisible=true, + }, + }), + }, autoSave: true + ); + + #region Purchase Order 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, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "OrderNumber", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "SupplierId", + Width = 200, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + DataSourceType = UiLookupDataSourceTypeEnum.Query, + DisplayExpr = "Name", + ValueExpr = "Key", + LookupQuery = LookupQueryValues.SupplierValues + }), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "OrderDate", + Width = 130, + ListOrderNo = 4, + 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.DateTime, + FieldName = "DeliveryDate", + Width = 100, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "PaymentTermId", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.PaymentTerm), "Id", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "RequestId", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Request), "Id", "RequestNumber"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "QuotationId", + Width = 150, + ListOrderNo = 8, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Quotation), "Id", "QuotationNumber"), + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Terms", + Width = 300, + ListOrderNo = 9, + 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 = "Notes", + Width = 300, + ListOrderNo = 10, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Currency", + Width = 100, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Currency), "Code", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "ExchangeRate", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson, + EditorOptions = EditorOptionValues.NumberStandartFormat + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "Subtotal", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson, + EditorOptions = EditorOptionValues.NumberStandartFormat + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "TaxAmount", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson, + EditorOptions = EditorOptionValues.NumberStandartFormat + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "TotalAmount", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson, + EditorOptions = EditorOptionValues.NumberStandartFormat + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Status", + Width = 100, + ListOrderNo = 16, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.OrderStatus), "Name", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ], autoSave: true); + #endregion + } + #endregion + + #region Purchase Order Item + listFormName = AppCodes.SupplyChain.PurchaseOrderItem; + 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.PurchaseOrderItem)), + 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.PurchaseOrderItem)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 350, true, true, true, true, false), + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingFormJson = JsonSerializer.Serialize(new List() + { + new() { + Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[ + new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 2, DataField="UnitPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField="Quantity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 4, DataField="Uom", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField="TotalPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 6, DataField="Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "Quantity", FieldDbType = DbType.Decimal, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "UnitPrice", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "TotalPrice", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Uom", FieldDbType = DbType.String, Value = "Adet", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + }, autoSave: true + ); + + #region Purchase Order Item Fields + await _listFormFieldRepository.InsertManyAsync([ + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + SortIndex = 0, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "MaterialId", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Material), "Id", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "UnitPrice", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 3, + 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 = "Quantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 4, + 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 = "Uom", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Uom), "Name", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "TotalPrice", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 5, + 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 = "Description", + Width = 500, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + ], autoSave: true); + #endregion + } + #endregion + + // Purchase Order ve Purchase Order Item arasında SubForm ilişki kurulması + await utils.CloneFormLayoutAsync( + AppCodes.SupplyChain.PurchaseOrder, + JsonSerializer.Serialize(new List() { + new { + TabType = ListFormTabTypeEnum.List, + TabTitle = AppCodes.SupplyChain.PurchaseOrderItem, + Code = AppCodes.SupplyChain.PurchaseOrderItem, + Relation = new List() { + new { + ParentFieldName = "Id", + DbType = DbType.Guid, + ChildFieldName = "PurchaseOrderId" + } + } + } + }) + ); } } diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index 9d2ea236..c5d91d67 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -2378,6 +2378,16 @@ "RequiredPermissionName": "App.SupplyChain.QuotationStatus", "IsDisabled": false }, + { + "ParentCode": "App.SupplyChain.Definitions", + "Code": "App.SupplyChain.OrderStatus", + "DisplayName": "App.SupplyChain.OrderStatus", + "Order": 12, + "Url": "/admin/list/App.SupplyChain.OrderStatus", + "Icon": "FcGraduationCap", + "RequiredPermissionName": "App.SupplyChain.OrderStatus", + "IsDisabled": false + }, { "ParentCode": "App.SupplyChain", "Code": "App.SupplyChain.Request", @@ -2400,12 +2410,12 @@ }, { "ParentCode": "App.SupplyChain", - "Code": "App.SupplyChain.Order", - "DisplayName": "App.SupplyChain.Order", + "Code": "App.SupplyChain.PurchaseOrder", + "DisplayName": "App.SupplyChain.PurchaseOrder", "Order": 4, - "Url": "/admin/supplychain/orders", + "Url": "/admin/list/App.SupplyChain.PurchaseOrder", "Icon": "FcShop", - "RequiredPermissionName": "App.SupplyChain.Order", + "RequiredPermissionName": "App.SupplyChain.PurchaseOrder", "IsDisabled": false }, { diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index 535676a8..60943d14 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -6097,6 +6097,89 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.QuotationStatus.Import", + "ParentName": "App.SupplyChain.QuotationStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.QuotationStatus.Note", + "ParentName": "App.SupplyChain.QuotationStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus", + "ParentName": null, + "DisplayName": "App.SupplyChain.OrderStatus", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Create", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Update", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Delete", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Export", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Import", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.OrderStatus.Note", + "ParentName": "App.SupplyChain.OrderStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.Material", @@ -6666,17 +6749,17 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder", "ParentName": null, - "DisplayName": "App.SupplyChain.Order", + "DisplayName": "App.SupplyChain.PurchaseOrder", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Create", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Create", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Create", "IsEnabled": true, "MultiTenancySide": 3, @@ -6684,8 +6767,8 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Update", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Update", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Update", "IsEnabled": true, "MultiTenancySide": 3, @@ -6693,8 +6776,8 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Delete", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Delete", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Delete", "IsEnabled": true, "MultiTenancySide": 3, @@ -6702,8 +6785,8 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Export", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Export", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Export", "IsEnabled": true, "MultiTenancySide": 3, @@ -6711,8 +6794,8 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Import", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Import", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Import", "IsEnabled": true, "MultiTenancySide": 3, @@ -6720,13 +6803,78 @@ }, { "GroupName": "App.SupplyChain", - "Name": "App.SupplyChain.Order.Note", - "ParentName": "App.SupplyChain.Order", + "Name": "App.SupplyChain.PurchaseOrder.Note", + "ParentName": "App.SupplyChain.PurchaseOrder", "DisplayName": "Note", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, + + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem", + "ParentName": null, + "DisplayName": "App.SupplyChain.PurchaseOrderItem", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Create", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Update", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Delete", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Export", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Import", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.SupplyChain", + "Name": "App.SupplyChain.PurchaseOrderItem.Note", + "ParentName": "App.SupplyChain.PurchaseOrderItem", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { "GroupName": "App.SupplyChain", "Name": "App.SupplyChain.Delivery", @@ -7357,7 +7505,7 @@ "MultiTenancySide": 3, "MenuGroup": "Erp" }, - + { "GroupName": "App.Maintenance", "Name": "App.Maintenance.Workorder", @@ -13221,4 +13369,4 @@ "MenuGroup": "Erp" } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 36d8bbe1..c49df15b 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -205,5 +205,8 @@ public enum TableNameEnum Quotation, QuotationItem, QuotationStatus, - DeliveryTerm + DeliveryTerm, + OrderStatus, + PurchaseOrder, + PurchaseOrderItem } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index b00a2f4c..91c75032 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -180,6 +180,9 @@ public static class TableNameResolver { nameof(TableNameEnum.Quotation), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, { nameof(TableNameEnum.QuotationItem), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, { nameof(TableNameEnum.QuotationStatus), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.OrderStatus), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.PurchaseOrder), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, + { nameof(TableNameEnum.PurchaseOrderItem), (TablePrefix.TenantByName, MenuPrefix.SupplyChain) }, // CRM { nameof(TableNameEnum.CustomerSegment), (TablePrefix.TenantByName, MenuPrefix.Crm) }, diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index 78ba8353..7d8f0f30 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -533,6 +533,9 @@ public static class SeedConsts public const string QuotationStatus = Default + ".QuotationStatus"; public const string Quotation = Default + ".Quotation"; public const string QuotationItem = Default + ".QuotationItem"; + public const string OrderStatus = Default + ".OrderStatus"; + public const string PurchaseOrder = Default + ".PurchaseOrder"; + public const string PurchaseOrderItem = Default + ".PurchaseOrderItem"; } public static class Maintenance diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs new file mode 100644 index 00000000..e2748ac7 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs @@ -0,0 +1,15 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class OrderStatus : 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/SupplyChain/Partner.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs index 58c23023..1ecac7ac 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Partner.cs @@ -48,6 +48,7 @@ public class Partner : FullAuditedEntity, IMultiTenant public ICollection Banks { get; set; } public ICollection Certificates { get; set; } public ICollection Contacts { get; set; } + public ICollection PurchaseOrders { get; set; } //Customer ile ilgil bilgiler public Guid? CustomerTypeId { get; set; } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs index 3b050758..b7b1be07 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PaymentTerm.cs @@ -15,6 +15,7 @@ public class PaymentTerm : FullAuditedEntity, IMultiTenant public bool IsActive { get; set; } public ICollection Quotations { get; set; } + public ICollection PurchaseOrders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrder.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrder.cs new file mode 100644 index 00000000..94670470 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrder.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class PurchaseOrder : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string OrderNumber { get; set; } + + public Guid SupplierId { get; set; } + public Partner Supplier { get; set; } + + public DateTime OrderDate { get; set; } + public DateTime? DeliveryDate { get; set; } + + public Guid PaymentTermId { get; set; } + public PaymentTerm PaymentTerm { get; set; } + + public string Terms { get; set; } + public string Notes { get; set; } + + public Guid? RequestId { get; set; } + public Request? Request { get; set; } + + public Guid? QuotationId { get; set; } + public Quotation? Quotation { get; set; } + + public string Currency { get; set; } + public decimal ExchangeRate { get; set; } + public decimal Subtotal { get; set; } + public decimal TaxAmount { get; set; } + public decimal TotalAmount { get; set; } + + public string Status { get; set; } + + public ICollection PurchaseOrders { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrderItem.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrderItem.cs new file mode 100644 index 00000000..4e2f5922 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/PurchaseOrderItem.cs @@ -0,0 +1,27 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class PurchaseOrderItem : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public Guid PurchaseOrderId { get; set; } + public PurchaseOrder PurchaseOrder { get; set; } + + public Guid MaterialId { get; set; } + public Material Material { get; set; } + + public decimal UnitPrice { get; set; } + public decimal Quantity { get; set; } + public string Uom { get; set; } + public decimal TotalPrice { get; set; } + + public decimal ReceivedQuantity { get; set; } + public decimal DeliveredQuantity { get; set; } + public decimal RemainingQuantity { get; set; } + + public string Description { get; set; } +} diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Quotation.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Quotation.cs index 141c1283..0cfdca16 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Quotation.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Quotation.cs @@ -50,4 +50,5 @@ public class Quotation : FullAuditedEntity, IMultiTenant public DateTime? EvaluatedAt { get; set; } //Değerlendirme Tarihi public ICollection Items { get; set; } + public ICollection PurchaseOrders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Request.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Request.cs index c82b6fb9..3425de20 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Request.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Request.cs @@ -28,5 +28,7 @@ public class Request : FullAuditedEntity, IMultiTenant public string Description { get; set; } public List Items { get; set; } = []; + + public ICollection PurchaseOrders { get; set; } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index e32a24b9..784e16d6 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -220,6 +220,8 @@ public class PlatformDbContext : public DbSet QuotationStatuses { get; set; } public DbSet Quotations { get; set; } public DbSet QuotationItems { get; set; } + public DbSet OrderStatuses { get; set; } + public DbSet PurchaseOrders { get; set; } #endregion #region Crm @@ -2749,7 +2751,7 @@ public class PlatformDbContext : b.Property(x => x.MaterialId).IsRequired(); b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0); - b.Property(x => x.Uom).IsRequired(); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); b.Property(x => x.EstimatedPrice).HasPrecision(18, 2).HasDefaultValue(0); b.Property(x => x.Specification).HasMaxLength(500); b.Property(x => x.Justification).HasMaxLength(500); @@ -2817,7 +2819,7 @@ public class PlatformDbContext : b.Property(x => x.SpecificationName).IsRequired().HasMaxLength(200); b.Property(x => x.SpecificationValue).IsRequired().HasMaxLength(200); - b.Property(x => x.Uom).IsRequired(); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); b.Property(x => x.IsRequired).HasDefaultValue(false); b.HasOne(x => x.Workcenter) @@ -3180,7 +3182,7 @@ public class PlatformDbContext : b.Property(x => x.BomId).IsRequired(); b.Property(x => x.MaterialId).IsRequired(); b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0); - b.Property(x => x.Uom).IsRequired(); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); b.Property(x => x.ScrapPercentage).HasPrecision(18, 2).HasDefaultValue(0); b.Property(x => x.IsPhantom).HasDefaultValue(false); b.Property(x => x.Position).HasDefaultValue(0); @@ -3513,7 +3515,7 @@ public class PlatformDbContext : b.Property(x => x.QuotationId).IsRequired(); b.Property(x => x.MaterialId).IsRequired(); b.Property(x => x.Quantity).HasPrecision(18, 2).IsRequired(); - b.Property(x => x.Uom).IsRequired().HasMaxLength(128); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); b.Property(x => x.UnitPrice).HasPrecision(18, 2).IsRequired(); b.Property(x => x.TotalPrice).HasPrecision(18, 2).IsRequired(); b.Property(x => x.LeadTime).HasDefaultValue(0); @@ -3576,5 +3578,82 @@ public class PlatformDbContext : .HasForeignKey(x => x.WorkorderId) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.OrderStatus)), 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.PurchaseOrder)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.OrderNumber).IsRequired().HasMaxLength(50); + b.Property(x => x.SupplierId).IsRequired(); + b.Property(x => x.OrderDate).IsRequired(); + b.Property(x => x.PaymentTermId).IsRequired(); + b.Property(x => x.Status).IsRequired().HasMaxLength(64); + b.Property(x => x.Currency).IsRequired().HasMaxLength(8); + + b.Property(x => x.ExchangeRate).HasPrecision(18, 2).HasDefaultValue(1); + b.Property(x => x.Subtotal).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.TaxAmount).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.TotalAmount).HasPrecision(18, 2).HasDefaultValue(0); + + b.Property(x => x.Notes).HasMaxLength(1000); + b.Property(x => x.Terms).HasMaxLength(1000); + + b.HasOne(x => x.PaymentTerm) + .WithMany(x => x.PurchaseOrders) + .HasForeignKey(x => x.PaymentTermId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Supplier) + .WithMany(x => x.PurchaseOrders) + .HasForeignKey(x => x.SupplierId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Request) + .WithMany(x => x.PurchaseOrders) + .HasForeignKey(x => x.RequestId) + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(false); + + b.HasOne(x => x.Quotation) + .WithMany(x => x.PurchaseOrders) + .HasForeignKey(x => x.QuotationId) + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(false); + }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.PurchaseOrderItem)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.PurchaseOrderId).IsRequired(); + b.Property(x => x.MaterialId).IsRequired(); + b.Property(x => x.UnitPrice).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(1); + b.Property(x => x.Uom).IsRequired().HasMaxLength(64); + b.Property(x => x.TotalPrice).HasPrecision(18, 2).HasDefaultValue(0); + + b.Property(x => x.ReceivedQuantity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.DeliveredQuantity).HasPrecision(18, 2).HasDefaultValue(0); + b.Property(x => x.RemainingQuantity).HasPrecision(18, 2).HasDefaultValue(0); + + b.Property(x => x.Description).HasMaxLength(1000); + + b.HasOne(x => x.PurchaseOrder) + .WithMany(x => x.PurchaseOrders) + .HasForeignKey(x => x.PurchaseOrderId) + .OnDelete(DeleteBehavior.Restrict); + }); } } \ No newline at end of file diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.Designer.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.Designer.cs index da39d549..1000df8c 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251203205612_Initial")] + [Migration("20251204121428_Initial")] partial class Initial { /// @@ -1677,7 +1677,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ValidFrom") .HasColumnType("datetime2"); @@ -8252,6 +8253,64 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_OrderItem", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.OrderStatus", 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("Scp_T_OrderStatus", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Overtime", b => { b.Property("Id") @@ -10144,6 +10203,222 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_Psychologist", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("ExchangeRate") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(1m); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("OrderDate") + .HasColumnType("datetime2"); + + b.Property("OrderNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuotationId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Subtotal") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SupplierId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaxAmount") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Terms") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("TotalAmount") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.HasKey("Id"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("QuotationId"); + + b.HasIndex("RequestId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Scp_T_PurchaseOrder", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrderItem", 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("DeliveredQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("PurchaseOrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(1m); + + b.Property("ReceivedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("RemainingQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalPrice") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("UnitPrice") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("Scp_T_PurchaseOrderItem", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => { b.Property("Id") @@ -10774,8 +11049,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -11374,7 +11649,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -14283,7 +14559,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("WorkcenterId") .HasColumnType("uniqueidentifier"); @@ -18268,6 +18545,58 @@ namespace Erp.Platform.Migrations b.Navigation("Project"); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.HasOne("Erp.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany("PurchaseOrders") + .HasForeignKey("PaymentTermId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Quotation", "Quotation") + .WithMany("PurchaseOrders") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Erp.Platform.Entities.Request", "Request") + .WithMany("PurchaseOrders") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Erp.Platform.Entities.Partner", "Supplier") + .WithMany("PurchaseOrders") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PaymentTerm"); + + b.Navigation("Quotation"); + + b.Navigation("Request"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrderItem", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseOrders") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("PurchaseOrder"); + }); + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => { b.HasOne("Erp.Platform.Entities.Putaway", "Rule") @@ -19274,6 +19603,8 @@ namespace Erp.Platform.Migrations b.Navigation("Certificates"); b.Navigation("Contacts"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.PaymentMethod", b => @@ -19283,6 +19614,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.PaymentTerm", b => { + b.Navigation("PurchaseOrders"); + b.Navigation("Quotations"); }); @@ -19319,6 +19652,11 @@ namespace Erp.Platform.Migrations b.Navigation("DailyLogs"); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.Navigation("PurchaseOrders"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => { b.Navigation("Conditions"); @@ -19337,6 +19675,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Quotation", b => { b.Navigation("Items"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.QuotationStatus", b => @@ -19366,6 +19706,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Request", b => { b.Navigation("Items"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.RequestType", b => diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.cs similarity index 98% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.cs index e2a5f30b..b7994f9a 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251203205612_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251204121428_Initial.cs @@ -2710,6 +2710,28 @@ namespace Erp.Platform.Migrations table.PrimaryKey("PK_Scp_T_MaterialType", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Scp_T_OrderStatus", + 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_Scp_T_OrderStatus", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Scp_T_PaymentTerm", columns: table => new @@ -5616,7 +5638,7 @@ namespace Erp.Platform.Migrations WorkcenterId = table.Column(type: "uniqueidentifier", nullable: false), SpecificationName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), SpecificationValue = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Uom = table.Column(type: "nvarchar(max)", nullable: false), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), IsRequired = table.Column(type: "bit", nullable: false, defaultValue: false), CreationTime = table.Column(type: "datetime2", nullable: false), CreatorId = table.Column(type: "uniqueidentifier", nullable: true), @@ -6392,7 +6414,7 @@ namespace Erp.Platform.Migrations MaterialId = table.Column(type: "uniqueidentifier", nullable: false), OperationId = table.Column(type: "uniqueidentifier", nullable: true), Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), - Uom = table.Column(type: "nvarchar(max)", nullable: false), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), ScrapPercentage = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), IsPhantom = table.Column(type: "bit", nullable: false, defaultValue: false), Position = table.Column(type: "int", nullable: false, defaultValue: 0), @@ -6708,7 +6730,7 @@ namespace Erp.Platform.Migrations QuotationId = table.Column(type: "uniqueidentifier", nullable: false), MaterialId = table.Column(type: "uniqueidentifier", nullable: false), Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), - Uom = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), UnitPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), TotalPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), LeadTime = table.Column(type: "int", nullable: true, defaultValue: 0), @@ -6738,6 +6760,64 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Scp_T_PurchaseOrder", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + OrderNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + SupplierId = table.Column(type: "uniqueidentifier", nullable: false), + OrderDate = table.Column(type: "datetime2", nullable: false), + DeliveryDate = table.Column(type: "datetime2", nullable: true), + PaymentTermId = table.Column(type: "uniqueidentifier", nullable: false), + Terms = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Notes = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + RequestId = table.Column(type: "uniqueidentifier", nullable: true), + QuotationId = table.Column(type: "uniqueidentifier", nullable: true), + Currency = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: false), + ExchangeRate = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 1m), + Subtotal = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + TaxAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + TotalAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Status = table.Column(type: "nvarchar(64)", maxLength: 64, 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_Scp_T_PurchaseOrder", x => x.Id); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrder_Adm_T_Partner_SupplierId", + column: x => x.SupplierId, + principalTable: "Adm_T_Partner", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrder_Scp_T_PaymentTerm_PaymentTermId", + column: x => x.PaymentTermId, + principalTable: "Scp_T_PaymentTerm", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrder_Scp_T_Quotation_QuotationId", + column: x => x.QuotationId, + principalTable: "Scp_T_Quotation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrder_Scp_T_Request_RequestId", + column: x => x.RequestId, + principalTable: "Scp_T_Request", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Scp_T_RequestItem", columns: table => new @@ -6747,7 +6827,7 @@ namespace Erp.Platform.Migrations RequestId = table.Column(type: "uniqueidentifier", nullable: false), MaterialId = table.Column(type: "uniqueidentifier", nullable: false), Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), - Uom = table.Column(type: "nvarchar(max)", nullable: false), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), EstimatedPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), Specification = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), Justification = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), @@ -6915,6 +6995,47 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "Scp_T_PurchaseOrderItem", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + PurchaseOrderId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + UnitPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Quantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 1m), + Uom = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + TotalPrice = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + ReceivedQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + DeliveredQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + RemainingQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Scp_T_PurchaseOrderItem", x => x.Id); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrderItem_Scp_T_Material_MaterialId", + column: x => x.MaterialId, + principalTable: "Scp_T_Material", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Scp_T_PurchaseOrderItem_Scp_T_PurchaseOrder_PurchaseOrderId", + column: x => x.PurchaseOrderId, + principalTable: "Scp_T_PurchaseOrder", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Str_T_Location", columns: table => new @@ -8502,6 +8623,36 @@ namespace Erp.Platform.Migrations table: "Scp_T_MaterialSpecification", column: "UnitId"); + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrder_PaymentTermId", + table: "Scp_T_PurchaseOrder", + column: "PaymentTermId"); + + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrder_QuotationId", + table: "Scp_T_PurchaseOrder", + column: "QuotationId"); + + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrder_RequestId", + table: "Scp_T_PurchaseOrder", + column: "RequestId"); + + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrder_SupplierId", + table: "Scp_T_PurchaseOrder", + column: "SupplierId"); + + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrderItem_MaterialId", + table: "Scp_T_PurchaseOrderItem", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Scp_T_PurchaseOrderItem_PurchaseOrderId", + table: "Scp_T_PurchaseOrderItem", + column: "PurchaseOrderId"); + migrationBuilder.CreateIndex( name: "IX_Scp_T_Quotation_DeliveryTermId", table: "Scp_T_Quotation", @@ -9123,6 +9274,12 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Scp_T_MaterialSpecification"); + migrationBuilder.DropTable( + name: "Scp_T_OrderStatus"); + + migrationBuilder.DropTable( + name: "Scp_T_PurchaseOrderItem"); + migrationBuilder.DropTable( name: "Scp_T_QuotationItem"); @@ -9253,10 +9410,7 @@ namespace Erp.Platform.Migrations name: "Adm_T_Uom"); migrationBuilder.DropTable( - name: "Scp_T_Quotation"); - - migrationBuilder.DropTable( - name: "Scp_T_Request"); + name: "Scp_T_PurchaseOrder"); migrationBuilder.DropTable( name: "Str_T_LocationType"); @@ -9331,16 +9485,10 @@ namespace Erp.Platform.Migrations name: "Adm_T_UomCategory"); migrationBuilder.DropTable( - name: "Adm_T_PaymentMethod"); + name: "Scp_T_Quotation"); migrationBuilder.DropTable( - name: "Scp_T_DeliveryTerm"); - - migrationBuilder.DropTable( - name: "Scp_T_QuotationStatus"); - - migrationBuilder.DropTable( - name: "Scp_T_RequestType"); + name: "Scp_T_Request"); migrationBuilder.DropTable( name: "Str_T_Warehouse"); @@ -9360,6 +9508,18 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Sas_H_CountryGroup"); + migrationBuilder.DropTable( + name: "Adm_T_PaymentMethod"); + + migrationBuilder.DropTable( + name: "Scp_T_DeliveryTerm"); + + migrationBuilder.DropTable( + name: "Scp_T_QuotationStatus"); + + migrationBuilder.DropTable( + name: "Scp_T_RequestType"); + migrationBuilder.DropTable( name: "Str_T_WarehouseType"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 5a6bc9ed..11063c92 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -1674,7 +1674,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("ValidFrom") .HasColumnType("datetime2"); @@ -8249,6 +8250,64 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_OrderItem", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.OrderStatus", 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("Scp_T_OrderStatus", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Overtime", b => { b.Property("Id") @@ -10141,6 +10200,222 @@ namespace Erp.Platform.Migrations b.ToTable("Adm_T_Psychologist", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("ExchangeRate") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(1m); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("OrderDate") + .HasColumnType("datetime2"); + + b.Property("OrderNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PaymentTermId") + .HasColumnType("uniqueidentifier"); + + b.Property("QuotationId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Subtotal") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("SupplierId") + .HasColumnType("uniqueidentifier"); + + b.Property("TaxAmount") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Terms") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("TotalAmount") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.HasKey("Id"); + + b.HasIndex("PaymentTermId"); + + b.HasIndex("QuotationId"); + + b.HasIndex("RequestId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Scp_T_PurchaseOrder", (string)null); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrderItem", 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("DeliveredQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialId") + .HasColumnType("uniqueidentifier"); + + b.Property("PurchaseOrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(1m); + + b.Property("ReceivedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("RemainingQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TotalPrice") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("UnitPrice") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Uom") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("Scp_T_PurchaseOrderItem", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => { b.Property("Id") @@ -10771,8 +11046,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -11371,7 +11646,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.HasKey("Id"); @@ -14280,7 +14556,8 @@ namespace Erp.Platform.Migrations b.Property("Uom") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); b.Property("WorkcenterId") .HasColumnType("uniqueidentifier"); @@ -18265,6 +18542,58 @@ namespace Erp.Platform.Migrations b.Navigation("Project"); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.HasOne("Erp.Platform.Entities.PaymentTerm", "PaymentTerm") + .WithMany("PurchaseOrders") + .HasForeignKey("PaymentTermId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Quotation", "Quotation") + .WithMany("PurchaseOrders") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Erp.Platform.Entities.Request", "Request") + .WithMany("PurchaseOrders") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Erp.Platform.Entities.Partner", "Supplier") + .WithMany("PurchaseOrders") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PaymentTerm"); + + b.Navigation("Quotation"); + + b.Navigation("Request"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrderItem", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany() + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseOrders") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("PurchaseOrder"); + }); + modelBuilder.Entity("Erp.Platform.Entities.PutawayCondition", b => { b.HasOne("Erp.Platform.Entities.Putaway", "Rule") @@ -19271,6 +19600,8 @@ namespace Erp.Platform.Migrations b.Navigation("Certificates"); b.Navigation("Contacts"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.PaymentMethod", b => @@ -19280,6 +19611,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.PaymentTerm", b => { + b.Navigation("PurchaseOrders"); + b.Navigation("Quotations"); }); @@ -19316,6 +19649,11 @@ namespace Erp.Platform.Migrations b.Navigation("DailyLogs"); }); + modelBuilder.Entity("Erp.Platform.Entities.PurchaseOrder", b => + { + b.Navigation("PurchaseOrders"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Putaway", b => { b.Navigation("Conditions"); @@ -19334,6 +19672,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Quotation", b => { b.Navigation("Items"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.QuotationStatus", b => @@ -19363,6 +19703,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Request", b => { b.Navigation("Items"); + + b.Navigation("PurchaseOrders"); }); modelBuilder.Entity("Erp.Platform.Entities.RequestType", b => diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index d2446bd0..e07a404d 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": [ @@ -6299,9 +6290,7 @@ "isActive": true } ], - "ProjectTaskDailies" : [ - - ], + "ProjectTaskDailies": [], "DeliveryTerms": [ { "name": "15 Gün", @@ -6355,5 +6344,72 @@ "description": "Teklifin süresinin dolduğunu ifade eder", "isActive": true } + ], + "OrderStatuses": [ + { + "name": "Taslak", + "description": "Teklifin taslak aşamasında olduğunu ifade eder", + "isActive": true + }, + { + "name": "Beklemede", + "description": "Teklifin beklemede olduğunu ifade eder", + "isActive": true + }, + { + "name": "Onaylandı", + "description": "Teklifin onaylandığını ifade eder", + "isActive": true + }, + { + "name": "Gönderildi", + "description": "Teklifin gönderildiğini ifade eder", + "isActive": true + }, + { + "name": "Onaylandı", + "description": "Teklifin onaylandığını ifade eder", + "isActive": true + }, + { + "name": "Kısmen Teslim Edildi", + "description": "Teklifin bir kısmının teslim edildiğini ifade eder", + "isActive": true + }, + { + "name": "Kısmen Alındı", + "description": "Teklifin bir kısmının alındığını ifade eder", + "isActive": true + }, + { + "name": "Alındı", + "description": "Teklifin alındığını ifade eder", + "isActive": true + }, + { + "name": "Teslim Edildi", + "description": "Teklifin teslim edildiğini ifade eder", + "isActive": true + }, + { + "name": "Faturalandırıldı", + "description": "Teklifin faturalandırıldığını ifade eder", + "isActive": true + }, + { + "name": "Tamamlandı", + "description": "Teklifin tamamlandığını ifade eder", + "isActive": true + }, + { + "name": "Kapatıldı", + "description": "Teklifin kapatıldığını ifade eder", + "isActive": true + }, + { + "name": "İptal Edildi", + "description": "Teklifin iptal edildiğini ifade eder", + "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 4fbaa655..8dbc7e2f 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -139,6 +139,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _projectTaskRepository; private readonly IRepository _deliveryTermRepository; private readonly IRepository _quotationStatusRepository; + private readonly IRepository _orderStatusRepository; public TenantDataSeeder( IClock clock, @@ -260,7 +261,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository projectPhaseRepository, IRepository projectTaskRepository, IRepository deliveryTermRepository, - IRepository quotationStatusRepository + IRepository quotationStatusRepository, + IRepository orderStatusRepository ) { _clock = clock; @@ -384,6 +386,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _projectTaskRepository = projectTaskRepository; _deliveryTermRepository = deliveryTermRepository; _quotationStatusRepository = quotationStatusRepository; + _orderStatusRepository = orderStatusRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2684,6 +2687,20 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive }, autoSave: true); } + + foreach (var item in items.OrderStatuses) + { + var exists = await _orderStatusRepository.AnyAsync(x => x.Name == item.Name); + if (exists) + continue; + + await _orderStatusRepository.InsertAsync(new OrderStatus + { + 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 a16990c3..4eb44ad3 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -92,6 +92,7 @@ public class TenantSeederDto public List Approvals { get; set; } public List DeliveryTerms { get; set; } public List QuotationStatuses { get; set; } + public List OrderStatuses { get; set; } //Crm public List Partners { get; set; } @@ -142,6 +143,13 @@ public class TenantSeederDto public List ProjectTaskDailies { get; set; } } +public class OrderStatusSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } +} + public class DeliveryTermSeedDto { public string Name { get; set; } diff --git a/ui/src/views/list/Utils.ts b/ui/src/views/list/Utils.ts index 51bcdf82..cbb8357e 100644 --- a/ui/src/views/list/Utils.ts +++ b/ui/src/views/list/Utils.ts @@ -299,13 +299,14 @@ export function autoNumber() { const now = new Date() const pad = (n: number, width: number) => n.toString().padStart(width, '0') + const shortYear = pad(now.getFullYear() % 100, 2); // 2025 → 25 + return ( - `${now.getFullYear()}` + + `${shortYear}` + `${pad(now.getMonth() + 1, 2)}` + `${pad(now.getDate(), 2)}` + `${pad(now.getHours(), 2)}` + `${pad(now.getMinutes(), 2)}` + - `${pad(now.getSeconds(), 2)}` + - `${pad(now.getMilliseconds(), 3)}` + `${pad(now.getSeconds(), 2)}` ) }