From 83165cbc9fe6282d5a3408534fc21fdaac195291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:04:16 +0300 Subject: [PATCH] Mrp Production Work order --- .../Localization/DatabaseResourceLocalizer.cs | 2 - .../Seeds/LanguagesData.json | 18 +- .../Seeds/ListFormSeeder_Mrp.cs | 408 +++++++++++++++++- .../Seeds/MenusData.json | 18 +- .../Seeds/PermissionsData.json | 92 +++- .../Enums/TableNameEnum.cs | 3 +- .../TableNameResolver.cs | 1 + .../Erp.Platform.Domain/Data/SeedConsts.cs | 2 + .../Entities/Tenant/Maintenance/Fault.cs | 2 +- .../Entities/Tenant/Maintenance/Workcenter.cs | 2 +- .../Tenant/Maintenance/WorkorderStatus.cs | 1 + .../Entities/Tenant/Mrp/Operation.cs | 1 + .../Entities/Tenant/Mrp/ProductionOrder.cs | 1 + .../Tenant/Mrp/ProductionWorkorder.cs | 41 ++ .../Entities/Tenant/SupplyChain/Material.cs | 1 + .../Tenant/SupplyChain/OrderStatus.cs | 1 + .../EntityFrameworkCore/PlatformDbContext.cs | 49 ++- ....cs => 20251210125522_Initial.Designer.cs} | 192 ++++++++- ...9_Initial.cs => 20251210125522_Initial.cs} | 105 ++++- .../PlatformDbContextModelSnapshot.cs | 190 +++++++- .../Tenants/Seeds/TenantData.json | 2 +- .../Tenants/TenantDataSeeder.cs | 1 - .../Tenants/TenantSeederDto.cs | 8 + 23 files changed, 1090 insertions(+), 51 deletions(-) create mode 100644 api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionWorkorder.cs rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251210103609_Initial.Designer.cs => 20251210125522_Initial.Designer.cs} (99%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251210103609_Initial.cs => 20251210125522_Initial.cs} (99%) diff --git a/api/modules/Erp.Languages/Erp.Languages.Domain/Localization/DatabaseResourceLocalizer.cs b/api/modules/Erp.Languages/Erp.Languages.Domain/Localization/DatabaseResourceLocalizer.cs index e9c99ab0..dcd5793e 100644 --- a/api/modules/Erp.Languages/Erp.Languages.Domain/Localization/DatabaseResourceLocalizer.cs +++ b/api/modules/Erp.Languages/Erp.Languages.Domain/Localization/DatabaseResourceLocalizer.cs @@ -55,8 +55,6 @@ public class DatabaseResourceLocalizer : IDatabaseResourceLocalizer, ISingletonD protected virtual LanguageTextCacheItem CreateCacheItem(LocalizationResourceBase resource, string cultureName) { - //TODO VT'den textleri alip cache'e dolduran kismi yazalim - //TODO:SÖ var task = languageTextRepository.GetListAsync(a => a.ResourceName == resource.ResourceName && a.CultureName == cultureName); var texts = AsyncHelper.RunSync(() => task); diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json index 7c55974f..634e87f4 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/LanguagesData.json @@ -10132,14 +10132,20 @@ { "resourceName": "Platform", "key": "App.Mrp.ProductionOrderType", - "tr": "Sipariş Türleri", - "en": "Order Types" + "tr": "Üretim Sipariş Türleri", + "en": "Production Order Types" }, { "resourceName": "Platform", "key": "App.Mrp.ProductionOrderStatus", - "tr": "Sipariş Durumları", - "en": "Order Statuses" + "tr": "Üretim Sipariş Durumları", + "en": "Production Order Statuses" + }, + { + "resourceName": "Platform", + "key": "App.Mrp.WorkorderStatus", + "tr": "İş Emri Durumları", + "en": "Work Order Statuses" }, { "resourceName": "Platform", @@ -10155,7 +10161,7 @@ }, { "resourceName": "Platform", - "key": "App.Mrp.WorkOrder", + "key": "App.Mrp.Workorder", "tr": "İş Emirleri", "en": "Work Orders" }, @@ -11048,4 +11054,4 @@ "en": "Delete" } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs index 25e9fb5f..59228b1a 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Mrp.cs @@ -2316,7 +2316,7 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency CultureName = LanguageCodes.En, SourceDbType = DbType.Guid, FieldName = "SalesOrderId", - Width = 150, + Width = 200, ListOrderNo = 2, Visible = true, IsActive = true, @@ -2333,7 +2333,7 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency CultureName = LanguageCodes.En, SourceDbType = DbType.Guid, FieldName = "MaterialId", - Width = 150, + Width = 350, ListOrderNo = 3, Visible = true, IsActive = true, @@ -2454,7 +2454,405 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency } }) ); - - - } + + // Clone Maintenance Forms to MRP Forms + await utils.CloneListFormWithFieldsAsync(AppCodes.Maintenance.WorkorderStatus, AppCodes.Mrp.WorkorderStatus); + + #region Production Workorder + listFormName = AppCodes.Mrp.Workorder; + 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.ProductionWorkorder)), + 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.ProductionWorkorder)), + DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, + PagerOptionJson = DefaultPagerOptionJson, + InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, + EditingOptionJson = DefaultEditingOptionJson(listFormName, 800, 450, true, true, true, true, false), + EditingFormJson = JsonSerializer.Serialize(new List() { + new() { + Order=1, ColCount=2, ColSpan=1, ItemType="group", Items= [ + new EditingFormItemDto { Order = 1, DataField = "WorkorderNumber", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "ProductionOrderId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 3, DataField = "OperationId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 4, DataField = "MaterialId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 5, DataField = "WorkcenterId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 6, DataField = "StatusId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton }, + new EditingFormItemDto { Order = 7, DataField = "Sequence", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 8, DataField = "PlannedStartDate", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxDateBox, EditorOptions=EditorOptionValues.DateTimeFormat }, + new EditingFormItemDto { Order = 9, DataField = "PlannedEndDate", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxDateBox, EditorOptions=EditorOptionValues.DateTimeFormat }, + new EditingFormItemDto { Order = 10, DataField = "ActualStartDate", ColSpan = 1, EditorType2=EditorTypes.dxDateBox, EditorOptions=EditorOptionValues.DateTimeFormat }, + new EditingFormItemDto { Order = 11, DataField = "ActualEndDate", ColSpan = 1, EditorType2=EditorTypes.dxDateBox, EditorOptions=EditorOptionValues.DateTimeFormat }, + new EditingFormItemDto { Order = 12, DataField = "PlannedQuantity", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 13, DataField = "ConfirmedQuantity", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 14, DataField = "ScrapQuantity", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat }, + new EditingFormItemDto { Order = 15, DataField = "SetupTime", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 16, DataField = "ProcessTime", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 17, DataField = "ActualSetupTime", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 18, DataField = "ActualProcessTime", ColSpan = 1, EditorType2=EditorTypes.dxNumberBox }, + ]} + }), + FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "WorkorderNumber", FieldDbType = DbType.String, Value = "@AUTONUMBER", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Sequence", FieldDbType = DbType.Int32, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "PlannedStartDate", FieldDbType = DbType.Date, Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "PlannedEndDate", FieldDbType = DbType.Date, Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "PlannedQuantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ConfirmedQuantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ScrapQuantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "SetupTime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ProcessTime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ActualSetupTime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ActualProcessTime", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + }), + }, autoSave: true + ); + + #region Production Workorder 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 = "WorkorderNumber", + Width = 150, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + SortIndex = 1, + SortDirection = GridColumnOptions.SortOrderDesc, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "ProductionOrderId", + Width = 150, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.ProductionOrder), "Id", "OrderNumber"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "OperationId", + Width = 100, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Operation), "Id", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "MaterialId", + Width = 250, + ListOrderNo = 5, + 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.Guid, + FieldName = "WorkcenterId", + Width = 150, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Workcenter), "Id", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "StatusId", + Width = 150, + ListOrderNo = 7, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.WorkorderStatus), "Id", "Name"), + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "Sequence", + Width = 100, + ListOrderNo = 8, + 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 = "PlannedStartDate", + Width = 150, + ListOrderNo = 9, + 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 = "PlannedEndDate", + Width = 150, + ListOrderNo = 10, + 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 = "ActualStartDate", + Width = 150, + ListOrderNo = 11, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.DateTime, + FieldName = "ActualEndDate", + Width = 150, + ListOrderNo = 12, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "PlannedQuantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 13, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "ConfirmedQuantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 14, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Decimal, + FieldName = "ScrapQuantity", + Format = "fixedPoint", + Alignment = "right", + Width = 100, + ListOrderNo = 15, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "SetupTime", + Width = 100, + ListOrderNo = 16, + 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.Int32, + FieldName = "ProcessTime", + Width = 100, + ListOrderNo = 17, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ActualSetupTime", + Width = 100, + ListOrderNo = 18, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ColumnCustomizationJson = DefaultColumnCustomizationJson, + PermissionJson = DefaultFieldPermissionJson(listForm.Name), + PivotSettingsJson = DefaultPivotSettingsJson + }, + new() { + ListFormCode = listForm.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Int32, + FieldName = "ActualProcessTime", + Width = 100, + ListOrderNo = 19, + 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 5a44402e..480965bf 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -3081,6 +3081,16 @@ "RequiredPermissionName": "App.Mrp.ProductionOrderStatus", "IsDisabled": false }, + { + "ParentCode": "App.Mrp.Definitions", + "Code": "App.Mrp.WorkorderStatus", + "DisplayName": "App.Mrp.WorkorderStatus", + "Order": 10, + "Url": "/admin/list/App.Mrp.WorkorderStatus", + "Icon": "FcOk", + "RequiredPermissionName": "App.Mrp.WorkorderStatus", + "IsDisabled": false + }, { "ParentCode": "App.Mrp", "Code": "App.Mrp.ProductionOrder", @@ -3093,12 +3103,12 @@ }, { "ParentCode": "App.Mrp", - "Code": "App.Mrp.WorkOrder", - "DisplayName": "App.Mrp.WorkOrder", + "Code": "App.Mrp.Workorder", + "DisplayName": "App.Mrp.Workorder", "Order": 3, - "Url": "/admin/mrp/work-orders", + "Url": "/admin/list/App.Mrp.Workorder", "Icon": "FcList", - "RequiredPermissionName": "App.Mrp.WorkOrder", + "RequiredPermissionName": "App.Mrp.Workorder", "IsDisabled": false }, { diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json index bebafa04..8f9b04b2 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/PermissionsData.json @@ -12994,6 +12994,70 @@ "MenuGroup": "Erp" }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus", + "ParentName": null, + "DisplayName": "App.Mrp.WorkorderStatus", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Create", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Update", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Delete", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Export", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Import", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Import", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { + "GroupName": "App.Mrp", + "Name": "App.Mrp.WorkorderStatus.Note", + "ParentName": "App.Mrp.WorkorderStatus", + "DisplayName": "Note", + "IsEnabled": true, + "MultiTenancySide": 3, + "MenuGroup": "Erp" + }, + { "GroupName": "App.Mrp", "Name": "App.Mrp.ProductionOrderItem", @@ -13060,17 +13124,17 @@ { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder", "ParentName": null, - "DisplayName": "App.Mrp.WorkOrder", + "DisplayName": "App.Mrp.Workorder", "IsEnabled": true, "MultiTenancySide": 3, "MenuGroup": "Erp" }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Create", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Create", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Create", "IsEnabled": true, "MultiTenancySide": 3, @@ -13078,8 +13142,8 @@ }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Update", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Update", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Update", "IsEnabled": true, "MultiTenancySide": 3, @@ -13087,8 +13151,8 @@ }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Delete", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Delete", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Delete", "IsEnabled": true, "MultiTenancySide": 3, @@ -13096,8 +13160,8 @@ }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Export", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Export", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Export", "IsEnabled": true, "MultiTenancySide": 3, @@ -13105,8 +13169,8 @@ }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Import", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Import", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Import", "IsEnabled": true, "MultiTenancySide": 3, @@ -13114,8 +13178,8 @@ }, { "GroupName": "App.Mrp", - "Name": "App.Mrp.WorkOrder.Note", - "ParentName": "App.Mrp.WorkOrder", + "Name": "App.Mrp.Workorder.Note", + "ParentName": "App.Mrp.Workorder", "DisplayName": "Note", "IsEnabled": true, "MultiTenancySide": 3, diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 8b3c293c..ec07a2e4 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -233,5 +233,6 @@ public enum TableNameEnum ProductionOrderType, ProductionOrderStatus, ProductionOrder, - ProductionOrderItem + ProductionOrderItem, + ProductionWorkorder, } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index 2ab4be95..97d2f983 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -258,6 +258,7 @@ public static class TableNameResolver { nameof(TableNameEnum.ProductionOrderStatus), (TablePrefix.TenantByName, MenuPrefix.Mrp) }, { nameof(TableNameEnum.ProductionOrder), (TablePrefix.TenantByName, MenuPrefix.Mrp) }, { nameof(TableNameEnum.ProductionOrderItem), (TablePrefix.TenantByName, MenuPrefix.Mrp) }, + { nameof(TableNameEnum.ProductionWorkorder), (TablePrefix.TenantByName, MenuPrefix.Mrp) }, // 🔹 R&D { nameof(TableNameEnum.Type), (TablePrefix.TenantByName, MenuPrefix.Project) }, diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index e9294c6a..bbc0cf20 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -640,6 +640,8 @@ public static class SeedConsts public const string ProductionOrderStatus = Default + ".ProductionOrderStatus"; public const string ProductionOrder = Default + ".ProductionOrder"; public const string ProductionOrderItem = Default + ".ProductionOrderItem"; + public const string WorkorderStatus = Default + ".WorkorderStatus"; + public const string Workorder = Default + ".Workorder"; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs index 4f5aa6cf..d547d23d 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Fault.cs @@ -25,7 +25,7 @@ public class Fault : FullAuditedEntity, IMultiTenant public string AssignedTo { get; set; } public int? ActualRepairTime { get; set; } - public Guid WorkOrderId { get; set; } + public Guid WorkorderId { get; set; } public string ResolutionNotes { get; set; } public string ClosedBy { get; set; } public DateTime? ClosedAt { get; set; } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs index ea5487bb..3240549f 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/Workcenter.cs @@ -37,5 +37,5 @@ public class Workcenter : FullAuditedEntity, IMultiTenant public ICollection Operations { get; set; } public virtual ICollection PlanWizards { get; set; } public virtual ICollection Workorders { get; set; } - // public virtual ICollection DownTimeHistory { get; set; } + public virtual ICollection ProductionWorkorders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkorderStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkorderStatus.cs index 26574965..c91a57b7 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkorderStatus.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Maintenance/WorkorderStatus.cs @@ -14,5 +14,6 @@ public class WorkorderStatus : FullAuditedEntity, IMultiTenant public bool IsActive { get; set; } public ICollection Workorders { get; set; } + public ICollection ProductionWorkorders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/Operation.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/Operation.cs index 40060f6b..13794ada 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/Operation.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/Operation.cs @@ -30,4 +30,5 @@ public class Operation : FullAuditedEntity, IMultiTenant public bool IsActive { get; set; } public ICollection BomOperations { get; set; } + public ICollection Workorders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionOrder.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionOrder.cs index d8c5e2c8..d23bb864 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionOrder.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionOrder.cs @@ -33,4 +33,5 @@ public class ProductionOrder : FullAuditedEntity, IMultiTenant public string CustomerRequirement { get; set; } public ICollection Items { get; set; } + public ICollection Workorders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionWorkorder.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionWorkorder.cs new file mode 100644 index 00000000..94a91262 --- /dev/null +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Mrp/ProductionWorkorder.cs @@ -0,0 +1,41 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Erp.Platform.Entities; + +public class ProductionWorkorder : FullAuditedEntity, IMultiTenant +{ + public Guid? TenantId { get; set; } + + public string WorkorderNumber { get; set; } + + public Guid ProductionOrderId { get; set; } + public ProductionOrder ProductionOrder { get; set; } + + public Guid OperationId { get; set; } + public Operation Operation { get; set; } + + public Guid MaterialId { get; set; } + public Material Material { get; set; } + + public Guid WorkcenterId { get; set; } + public Workcenter Workcenter { get; set; } + + public Guid StatusId { get; set; } + public WorkorderStatus Status { get; set; } + + public int Sequence { get; set; } + public DateTime PlannedStartDate { get; set; } + public DateTime PlannedEndDate { get; set; } + public DateTime? ActualStartDate { get; set; } + public DateTime? ActualEndDate { get; set; } + public decimal PlannedQuantity { get; set; } + public decimal ConfirmedQuantity { get; set; } + public decimal ScrapQuantity { get; set; } + + public int SetupTime { get; set; } // Kurulum süresi + public int ProcessTime { get; set; } // İşlem süresi + public int? ActualSetupTime { get; set; } // Gerçekleşen kurulum süresi + public int? ActualProcessTime { get; set; } // Gerçekleşen işlem süresi +} \ No newline at end of file diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs index 52caca52..489d13d4 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/Material.cs @@ -40,5 +40,6 @@ public class Material : FullAuditedEntity, IMultiTenant public List WaybillItems { get; set; } public List InvoiceItems { get; set; } public List ProductionOrderItems { get; set; } + public List ProductionWorkorders { get; set; } } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs index e2748ac7..7c4dbc29 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/SupplyChain/OrderStatus.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index c0f5b805..24b25991 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -313,6 +313,7 @@ public class PlatformDbContext : public DbSet ProductionOrderStatuses { get; set; } public DbSet ProductionOrders { get; set; } public DbSet ProductionOrderItems { get; set; } + public DbSet ProductionWorkorders { get; set; } #endregion public PlatformDbContext(DbContextOptions options) @@ -2930,7 +2931,7 @@ public class PlatformDbContext : b.Property(x => x.Status).IsRequired().HasMaxLength(20); b.Property(x => x.ResolutionNotes); b.Property(x => x.ClosedBy).HasMaxLength(150); - b.Property(x => x.WorkOrderId).HasMaxLength(100); + b.Property(x => x.WorkorderId).HasMaxLength(100); }); builder.Entity(b => @@ -4225,5 +4226,51 @@ public class PlatformDbContext : .HasForeignKey(x => x.MaterialId) .OnDelete(DeleteBehavior.Restrict); }); + + builder.Entity(b => + { + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.ProductionWorkorder)), Prefix.DbSchema); + b.ConfigureByConvention(); + + b.Property(x => x.WorkorderNumber).IsRequired().HasMaxLength(50); + b.Property(x => x.ProductionOrderId).IsRequired(); + b.Property(x => x.OperationId).IsRequired(); + b.Property(x => x.MaterialId).IsRequired(); + b.Property(x => x.Sequence).IsRequired().HasDefaultValue(1); + b.Property(x => x.PlannedQuantity).HasDefaultValue(0).HasPrecision(18, 2); + b.Property(x => x.ConfirmedQuantity).HasDefaultValue(0).HasPrecision(18, 2); + b.Property(x => x.ScrapQuantity).HasDefaultValue(0).HasPrecision(18, 2); + b.Property(x => x.WorkcenterId).IsRequired(); + b.Property(x => x.SetupTime).HasDefaultValue(0); + b.Property(x => x.ProcessTime).HasDefaultValue(0); + b.Property(x => x.ActualSetupTime).HasDefaultValue(0); + b.Property(x => x.ActualProcessTime).HasDefaultValue(0); + b.Property(x => x.StatusId).IsRequired(); + + b.HasOne(x => x.ProductionOrder) + .WithMany(po => po.Workorders) + .HasForeignKey(x => x.ProductionOrderId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Operation) + .WithMany(po => po.Workorders) + .HasForeignKey(x => x.OperationId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Material) + .WithMany(po => po.ProductionWorkorders) + .HasForeignKey(x => x.MaterialId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Workcenter) + .WithMany(po => po.ProductionWorkorders) + .HasForeignKey(x => x.WorkcenterId) + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne(x => x.Status) + .WithMany(po => po.ProductionWorkorders) + .HasForeignKey(x => x.StatusId) + .OnDelete(DeleteBehavior.Restrict); + }); } } \ No newline at end of file diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.Designer.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.Designer.cs index 82dba844..4d937801 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251210103609_Initial")] + [Migration("20251210125522_Initial")] partial class Initial { /// @@ -5539,14 +5539,14 @@ namespace Erp.Platform.Migrations .HasMaxLength(200) .HasColumnType("nvarchar(200)"); - b.Property("WorkOrderId") - .HasMaxLength(100) - .HasColumnType("uniqueidentifier"); - b.Property("WorkcenterId") .HasMaxLength(50) .HasColumnType("uniqueidentifier"); + b.Property("WorkorderId") + .HasMaxLength(100) + .HasColumnType("uniqueidentifier"); + b.HasKey("Id"); b.HasIndex("FaultStatusId"); @@ -10843,6 +10843,135 @@ namespace Erp.Platform.Migrations b.ToTable("Mrp_T_ProductionOrderType", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.ProductionWorkorder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualEndDate") + .HasColumnType("datetime2"); + + b.Property("ActualProcessTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ActualSetupTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ActualStartDate") + .HasColumnType("datetime2"); + + b.Property("ConfirmedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("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("OperationId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlannedEndDate") + .HasColumnType("datetime2"); + + b.Property("PlannedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("PlannedStartDate") + .HasColumnType("datetime2"); + + b.Property("ProcessTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProductionOrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScrapQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Sequence") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("SetupTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkcenterId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkorderNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("OperationId"); + + b.HasIndex("ProductionOrderId"); + + b.HasIndex("StatusId"); + + b.HasIndex("WorkcenterId"); + + b.ToTable("Mrp_T_ProductionWorkorder", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Program", b => { b.Property("Id") @@ -20993,6 +21122,49 @@ namespace Erp.Platform.Migrations b.Navigation("SalesOrder"); }); + modelBuilder.Entity("Erp.Platform.Entities.ProductionWorkorder", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany("ProductionWorkorders") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Operation", "Operation") + .WithMany("Workorders") + .HasForeignKey("OperationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.ProductionOrder", "ProductionOrder") + .WithMany("Workorders") + .HasForeignKey("ProductionOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WorkorderStatus", "Status") + .WithMany("ProductionWorkorders") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter") + .WithMany("ProductionWorkorders") + .HasForeignKey("WorkcenterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Operation"); + + b.Navigation("ProductionOrder"); + + b.Navigation("Status"); + + b.Navigation("Workcenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Project", b => { b.HasOne("Erp.Platform.Entities.Partner", "Customer") @@ -22330,6 +22502,8 @@ namespace Erp.Platform.Migrations b.Navigation("ProductionOrderItems"); + b.Navigation("ProductionWorkorders"); + b.Navigation("PurchaseOrderItems"); b.Navigation("QuotationItems"); @@ -22369,6 +22543,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.Navigation("BomOperations"); + + b.Navigation("Workorders"); }); modelBuilder.Entity("Erp.Platform.Entities.OperationCategory", b => @@ -22440,6 +22616,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.ProductionOrder", b => { b.Navigation("Items"); + + b.Navigation("Workorders"); }); modelBuilder.Entity("Erp.Platform.Entities.ProductionOrderStatus", b => @@ -22687,6 +22865,8 @@ namespace Erp.Platform.Migrations b.Navigation("PlanWizards"); + b.Navigation("ProductionWorkorders"); + b.Navigation("Specifications"); b.Navigation("Workorders"); @@ -22711,6 +22891,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.WorkorderStatus", b => { + b.Navigation("ProductionWorkorders"); + b.Navigation("Workorders"); }); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.cs index cb4fab73..07708348 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210103609_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251210125522_Initial.cs @@ -6472,7 +6472,7 @@ namespace Erp.Platform.Migrations IsActive = table.Column(type: "bit", nullable: false), AssignedTo = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: true), ActualRepairTime = table.Column(type: "int", nullable: true), - WorkOrderId = table.Column(type: "uniqueidentifier", maxLength: 100, nullable: false), + WorkorderId = table.Column(type: "uniqueidentifier", maxLength: 100, nullable: false), ResolutionNotes = table.Column(type: "nvarchar(max)", nullable: true), ClosedBy = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: true), ClosedAt = table.Column(type: "datetime2", nullable: true), @@ -7418,6 +7418,73 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "Mrp_T_ProductionWorkorder", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + WorkorderNumber = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ProductionOrderId = table.Column(type: "uniqueidentifier", nullable: false), + OperationId = table.Column(type: "uniqueidentifier", nullable: false), + MaterialId = table.Column(type: "uniqueidentifier", nullable: false), + WorkcenterId = table.Column(type: "uniqueidentifier", nullable: false), + StatusId = table.Column(type: "uniqueidentifier", nullable: false), + Sequence = table.Column(type: "int", nullable: false, defaultValue: 1), + PlannedStartDate = table.Column(type: "datetime2", nullable: false), + PlannedEndDate = table.Column(type: "datetime2", nullable: false), + ActualStartDate = table.Column(type: "datetime2", nullable: true), + ActualEndDate = table.Column(type: "datetime2", nullable: true), + PlannedQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + ConfirmedQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + ScrapQuantity = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + SetupTime = table.Column(type: "int", nullable: false, defaultValue: 0), + ProcessTime = table.Column(type: "int", nullable: false, defaultValue: 0), + ActualSetupTime = table.Column(type: "int", nullable: true, defaultValue: 0), + ActualProcessTime = table.Column(type: "int", nullable: true, defaultValue: 0), + 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_Mrp_T_ProductionWorkorder", x => x.Id); + table.ForeignKey( + name: "FK_Mrp_T_ProductionWorkorder_Mnt_T_Workcenter_WorkcenterId", + column: x => x.WorkcenterId, + principalTable: "Mnt_T_Workcenter", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Mrp_T_ProductionWorkorder_Mnt_T_WorkorderStatus_StatusId", + column: x => x.StatusId, + principalTable: "Mnt_T_WorkorderStatus", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Mrp_T_ProductionWorkorder_Mrp_T_Operation_OperationId", + column: x => x.OperationId, + principalTable: "Mrp_T_Operation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Mrp_T_ProductionWorkorder_Mrp_T_ProductionOrder_ProductionOrderId", + column: x => x.ProductionOrderId, + principalTable: "Mrp_T_ProductionOrder", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Mrp_T_ProductionWorkorder_Scp_T_Material_MaterialId", + column: x => x.MaterialId, + principalTable: "Scp_T_Material", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Hr_T_SurveyAnswer", columns: table => new @@ -9266,6 +9333,31 @@ namespace Erp.Platform.Migrations table: "Mrp_T_ProductionOrderItem", column: "SalesOrderId"); + migrationBuilder.CreateIndex( + name: "IX_Mrp_T_ProductionWorkorder_MaterialId", + table: "Mrp_T_ProductionWorkorder", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Mrp_T_ProductionWorkorder_OperationId", + table: "Mrp_T_ProductionWorkorder", + column: "OperationId"); + + migrationBuilder.CreateIndex( + name: "IX_Mrp_T_ProductionWorkorder_ProductionOrderId", + table: "Mrp_T_ProductionWorkorder", + column: "ProductionOrderId"); + + migrationBuilder.CreateIndex( + name: "IX_Mrp_T_ProductionWorkorder_StatusId", + table: "Mrp_T_ProductionWorkorder", + column: "StatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Mrp_T_ProductionWorkorder_WorkcenterId", + table: "Mrp_T_ProductionWorkorder", + column: "WorkcenterId"); + migrationBuilder.CreateIndex( name: "IX_Net_B_Meal_BranchId", table: "Net_B_Meal", @@ -10351,6 +10443,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Mrp_T_ProductionOrderItem"); + migrationBuilder.DropTable( + name: "Mrp_T_ProductionWorkorder"); + migrationBuilder.DropTable( name: "Net_B_Meal"); @@ -10625,10 +10720,10 @@ namespace Erp.Platform.Migrations name: "Mrp_T_Bom"); migrationBuilder.DropTable( - name: "Mrp_T_Operation"); + name: "Crm_T_SalesOrder"); migrationBuilder.DropTable( - name: "Crm_T_SalesOrder"); + name: "Mrp_T_Operation"); migrationBuilder.DropTable( name: "Mrp_T_ProductionOrder"); @@ -10745,10 +10840,10 @@ namespace Erp.Platform.Migrations name: "Mrp_T_BomType"); migrationBuilder.DropTable( - name: "Mrp_T_OperationType"); + name: "Crm_T_SalesOrderStatus"); migrationBuilder.DropTable( - name: "Crm_T_SalesOrderStatus"); + name: "Mrp_T_OperationType"); migrationBuilder.DropTable( name: "Mrp_T_ProductionOrderStatus"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 42044230..16bafbc8 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -5536,14 +5536,14 @@ namespace Erp.Platform.Migrations .HasMaxLength(200) .HasColumnType("nvarchar(200)"); - b.Property("WorkOrderId") - .HasMaxLength(100) - .HasColumnType("uniqueidentifier"); - b.Property("WorkcenterId") .HasMaxLength(50) .HasColumnType("uniqueidentifier"); + b.Property("WorkorderId") + .HasMaxLength(100) + .HasColumnType("uniqueidentifier"); + b.HasKey("Id"); b.HasIndex("FaultStatusId"); @@ -10840,6 +10840,135 @@ namespace Erp.Platform.Migrations b.ToTable("Mrp_T_ProductionOrderType", (string)null); }); + modelBuilder.Entity("Erp.Platform.Entities.ProductionWorkorder", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ActualEndDate") + .HasColumnType("datetime2"); + + b.Property("ActualProcessTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ActualSetupTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ActualStartDate") + .HasColumnType("datetime2"); + + b.Property("ConfirmedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("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("OperationId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlannedEndDate") + .HasColumnType("datetime2"); + + b.Property("PlannedQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("PlannedStartDate") + .HasColumnType("datetime2"); + + b.Property("ProcessTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProductionOrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScrapQuantity") + .ValueGeneratedOnAdd() + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)") + .HasDefaultValue(0m); + + b.Property("Sequence") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("SetupTime") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("WorkcenterId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkorderNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("OperationId"); + + b.HasIndex("ProductionOrderId"); + + b.HasIndex("StatusId"); + + b.HasIndex("WorkcenterId"); + + b.ToTable("Mrp_T_ProductionWorkorder", (string)null); + }); + modelBuilder.Entity("Erp.Platform.Entities.Program", b => { b.Property("Id") @@ -20990,6 +21119,49 @@ namespace Erp.Platform.Migrations b.Navigation("SalesOrder"); }); + modelBuilder.Entity("Erp.Platform.Entities.ProductionWorkorder", b => + { + b.HasOne("Erp.Platform.Entities.Material", "Material") + .WithMany("ProductionWorkorders") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Operation", "Operation") + .WithMany("Workorders") + .HasForeignKey("OperationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.ProductionOrder", "ProductionOrder") + .WithMany("Workorders") + .HasForeignKey("ProductionOrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.WorkorderStatus", "Status") + .WithMany("ProductionWorkorders") + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Erp.Platform.Entities.Workcenter", "Workcenter") + .WithMany("ProductionWorkorders") + .HasForeignKey("WorkcenterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Operation"); + + b.Navigation("ProductionOrder"); + + b.Navigation("Status"); + + b.Navigation("Workcenter"); + }); + modelBuilder.Entity("Erp.Platform.Entities.Project", b => { b.HasOne("Erp.Platform.Entities.Partner", "Customer") @@ -22327,6 +22499,8 @@ namespace Erp.Platform.Migrations b.Navigation("ProductionOrderItems"); + b.Navigation("ProductionWorkorders"); + b.Navigation("PurchaseOrderItems"); b.Navigation("QuotationItems"); @@ -22366,6 +22540,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Operation", b => { b.Navigation("BomOperations"); + + b.Navigation("Workorders"); }); modelBuilder.Entity("Erp.Platform.Entities.OperationCategory", b => @@ -22437,6 +22613,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.ProductionOrder", b => { b.Navigation("Items"); + + b.Navigation("Workorders"); }); modelBuilder.Entity("Erp.Platform.Entities.ProductionOrderStatus", b => @@ -22684,6 +22862,8 @@ namespace Erp.Platform.Migrations b.Navigation("PlanWizards"); + b.Navigation("ProductionWorkorders"); + b.Navigation("Specifications"); b.Navigation("Workorders"); @@ -22708,6 +22888,8 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.WorkorderStatus", b => { + b.Navigation("ProductionWorkorders"); + b.Navigation("Workorders"); }); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index e42ad979..01984425 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -6892,5 +6892,5 @@ "description": "Üretim siparişi beklemede", "isActive": true } - ] + ] } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index 7934c426..7c720737 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -2997,7 +2997,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency 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 8a12b745..a687dd9e 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -158,6 +158,14 @@ public class TenantSeederDto public List CheckTypes { get; set; } public List ProductionOrderTypes { get; set; } public List ProductionOrderStatuses { get; set; } + public List ProductionWorkorderStatuses { get; set; } +} + +public class ProductionWorkorderStatusSeedDto +{ + public string Name { get; set; } + public string Description { get; set; } + public bool IsActive { get; set; } } public class ProductionOrderStatusSeedDto