Maintenance.Plan

This commit is contained in:
Sedat ÖZTÜRK 2025-11-20 17:55:13 +03:00
parent c32a00f156
commit a3c307c72a
15 changed files with 1317 additions and 95 deletions

View file

@ -9428,7 +9428,7 @@
}, },
{ {
"resourceName": "Platform", "resourceName": "Platform",
"key": "App.Maintenance.Plans", "key": "App.Maintenance.Plan",
"tr": "Bakım Planları", "tr": "Bakım Planları",
"en": "Maintenance Plans" "en": "Maintenance Plans"
}, },

View file

@ -693,6 +693,580 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
#endregion #endregion
} }
#endregion #endregion
#region Maintenance Plan
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Plan))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson,
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Lists.Plan,
Name = AppCodes.Maintenance.Plan,
Title = AppCodes.Maintenance.Plan,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.Maintenance.Plan,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlan)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = DefaultSearchPanelJson,
GroupPanelJson = DefaultGroupPanelJson,
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.Plan),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlan)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
PagerOptionJson = DefaultPagerOptionJson,
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.Plan, 500, 500, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() {
Order=1, ColCount=2, ColSpan=1, Caption="General", ItemType="group", Items=
[
new() { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new() { Order = 2, DataField = "WorkCenterId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 3, DataField = "PlanType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 4, DataField = "Priority", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 5, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
]},
new() {
Order=1, ColCount=2, ColSpan=1, Caption="Frequency", ItemType="group", Items=
[
new() { Order = 1, DataField = "Frequency", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
new() { Order = 2, DataField = "FrequencyUnit", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new() { Order = 3, DataField = "EstimatedDuration", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
]},
new() {
Order=1, ColCount=2, ColSpan=1, Caption="Other", ItemType="group", Items=
[
new() { Order = 1, DataField = "Instructions", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new() { Order = 2, DataField = "RequiredSkillsJson", ColSpan = 2, EditorType2 = EditorTypes.dxTagBox },
new() { Order = 3, DataField = "NextDue", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox },
new() { Order = 4, DataField = "IsActive", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
]}
}),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() { FieldName = "Frequency", FieldDbType = DbType.Boolean, Value = "1", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value },
new() { FieldName = "EstimatedDuration", FieldDbType = DbType.Boolean, Value = "60", CustomValueType = FieldCustomValueTypeEnum.Value },
}),
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
new() {
Hint = "Manage",
Text ="Manage",
UrlTarget="_blank",
AuthName = AppCodes.Maintenance.Plan,
Url=$"/admin/form/{utils.GetDefaultFormCodes(ListFormCodes.Lists.Plan)}/@Id"
},
}),
}, autoSave: true
);
#region MaintenancePlan Fields
await _listFormFieldRepository.InsertManyAsync([
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
Visible = false,
IsActive = true,
IsDeleted = false,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Code",
Width = 150,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
SortIndex = 1,
SortDirection = GridColumnOptions.SortOrderAsc,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "WorkCenterId",
Width = 350,
ListOrderNo = 3,
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.String,
FieldName = "PlanType",
Width = 500,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
ValueExpr = "key",
DisplayExpr = "name",
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
new () { Key = "Önleyici", Name = "Önleyici" },
new () { Key = "Tahminsel", Name = "Tahminsel" },
new () { Key = "Düzeltici", Name = "Düzeltici" },
new () { Key = "Duruma Bağlı", Name = "Duruma Bağlı" },
}),
}),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Priority",
Width = 100,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
ValueExpr = "key",
DisplayExpr = "name",
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
new () { Key = "Düşük", Name = "Düşük" },
new () { Key = "Normal", Name = "Normal" },
new () { Key = "Yüksek", Name = "Yüksek" },
new () { Key = "Acil", Name = "Acil" },
}),
}),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Description",
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.Int32,
FieldName = "Frequency",
Width = 100,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "FrequencyUnit",
Width = 100,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.StaticData,
ValueExpr = "key",
DisplayExpr = "name",
LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] {
new () { Key = "Günlük", Name = "Günlük" },
new () { Key = "Haftalık", Name = "Haftalık" },
new () { Key = "Aylık", Name = "Aylık" },
new () { Key = "Yıllık", Name = "Yıllık" },
new () { Key = "Saatlik", Name = "Saatlik" },
new () { Key = "Döngü", Name = "Döngü" },
}),
}),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Int32,
FieldName = "EstimatedDuration",
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.String,
FieldName = "Instructions",
Width = 100,
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.String,
FieldName = "RequiredSkillsJson",
Width = 100,
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.Date,
FieldName = "NextDue",
Width = 100,
ListOrderNo = 11,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Boolean,
FieldName = "IsActive",
Width = 100,
ListOrderNo = 12,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
], autoSave: true);
#endregion
}
#endregion
#region Maintenance Plan Material
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PlanMaterial))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson,
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Lists.PlanMaterial,
Name = AppCodes.Maintenance.PlanMaterial,
Title = AppCodes.Maintenance.PlanMaterial,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.Maintenance.PlanMaterial,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanMaterial)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = DefaultSearchPanelJson,
GroupPanelJson = DefaultGroupPanelJson,
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.PlanMaterial),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlanMaterial)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
PagerOptionJson = DefaultPagerOptionJson,
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.PlanMaterial, 500, 250, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
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 = "Quantity", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox },
]}
}),
FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() { FieldName = "Quantity", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }
}),
}, autoSave: true
);
#region Maintenance Plan Material 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.Guid,
FieldName = "MaterialId",
Width = 150,
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 = "Quantity",
Width = 350,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
SortIndex = 1,
SortDirection = GridColumnOptions.SortOrderAsc,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
], autoSave: true);
#endregion
}
#endregion
#region Maintenance Plan Employee
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.PlanEmployee))
{
var listForm = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.List,
IsSubForm = false,
ShowNote = true,
LayoutJson = DefaultLayoutJson,
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Lists.PlanEmployee,
Name = AppCodes.Maintenance.PlanEmployee,
Title = AppCodes.Maintenance.PlanEmployee,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.Maintenance.PlanEmployee,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanEmployee)),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
SortMode = GridOptions.SortModeSingle,
FilterRowJson = DefaultFilterRowJson,
HeaderFilterJson = DefaultHeaderFilterJson,
SearchPanelJson = DefaultSearchPanelJson,
GroupPanelJson = DefaultGroupPanelJson,
SelectionJson = DefaultSelectionSingleJson,
ColumnOptionJson = DefaultColumnOptionJson,
PermissionJson = DefaultPermissionJson(AppCodes.Maintenance.PlanEmployee),
DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.MaintenancePlanEmployee)),
DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson,
PagerOptionJson = DefaultPagerOptionJson,
InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson,
EditingOptionJson = DefaultEditingOptionJson(AppCodes.Maintenance.PlanEmployee, 500, 250, true, true, true, true, false),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() {
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items= [
new EditingFormItemDto { Order = 1, DataField = "EmployeeId", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Description", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextArea },
]}
}),
}, autoSave: true
);
#region Maintenance Plan Employee 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.Guid,
FieldName = "EmployeeId",
Width = 150,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"),
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
new() {
ListFormCode = listForm.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Description",
Width = 350,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = DefaultValidationRuleRequiredJson,
ColumnCustomizationJson = DefaultColumnCustomizationJson,
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
PivotSettingsJson = DefaultPivotSettingsJson
},
], autoSave: true);
#endregion
}
#endregion
// Maintenance Plan ile Maintenance Plan Material ve Maintenance Plan Employee arasında Sub Forms ilişkisinin kurulması
await utils.CloneListFormWithFieldsAsync(
_listFormRepository,
_listFormFieldRepository,
ListFormCodes.Lists.Plan,
JsonSerializer.Serialize(new List<dynamic>() {
new {
TabTitle = "Materials",
TabType = ListFormTabTypeEnum.List,
Code = ListFormCodes.Lists.PlanMaterial,
Relation = new List<dynamic>() {
new {
ParentFieldName = "Id",
DbType = DbType.Guid,
ChildFieldName = "MaintenancePlanId"
}
}
},
new {
TabTitle = "Employees",
TabType = ListFormTabTypeEnum.List,
Code = ListFormCodes.Lists.PlanEmployee,
Relation = new List<dynamic>() {
new {
ParentFieldName = "Id",
DbType = DbType.Guid,
ChildFieldName = "MaintenancePlanId"
}
}
}
})
);
} }
} }

View file

@ -2427,12 +2427,12 @@
}, },
{ {
"ParentCode": "App.Maintenance", "ParentCode": "App.Maintenance",
"Code": "App.Maintenance.Plans", "Code": "App.Maintenance.Plan",
"DisplayName": "App.Maintenance.Plans", "DisplayName": "App.Maintenance.Plan",
"Order": 5, "Order": 5,
"Url": "/admin/maintenance/plans", "Url": "/admin/list/list-maintenanceplan",
"Icon": "FcPlanner", "Icon": "FcPlanner",
"RequiredPermissionName": "App.Maintenance.Plans", "RequiredPermissionName": "App.Maintenance.Plan",
"IsDisabled": false "IsDisabled": false
}, },
{ {
@ -2445,16 +2445,6 @@
"RequiredPermissionName": "App.Maintenance.Calendar", "RequiredPermissionName": "App.Maintenance.Calendar",
"IsDisabled": false "IsDisabled": false
}, },
{
"ParentCode": "App.Maintenance",
"Code": "App.Maintenance.Teams",
"DisplayName": "App.Maintenance.Teams",
"Order": 7,
"Url": "/admin/maintenance/teams",
"Icon": "FcConferenceCall",
"RequiredPermissionName": "App.Maintenance.Teams",
"IsDisabled": false
},
{ {
"ParentCode": "App.Maintenance", "ParentCode": "App.Maintenance",
"Code": "App.Maintenance.Faults", "Code": "App.Maintenance.Faults",

View file

@ -6567,17 +6567,17 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans", "Name": "App.Maintenance.Plan",
"ParentName": null, "ParentName": null,
"DisplayName": "App.Maintenance.Plans", "DisplayName": "App.Maintenance.Plan",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Create", "Name": "App.Maintenance.Plan.Create",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Create", "DisplayName": "Create",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6585,8 +6585,8 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Update", "Name": "App.Maintenance.Plan.Update",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Update", "DisplayName": "Update",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6594,8 +6594,8 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Delete", "Name": "App.Maintenance.Plan.Delete",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Delete", "DisplayName": "Delete",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6603,8 +6603,8 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Export", "Name": "App.Maintenance.Plan.Export",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Export", "DisplayName": "Export",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6612,8 +6612,8 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Import", "Name": "App.Maintenance.Plan.Import",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Import", "DisplayName": "Import",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6621,8 +6621,8 @@
}, },
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Plans.Note", "Name": "App.Maintenance.Plan.Note",
"ParentName": "App.Maintenance.Plans", "ParentName": "App.Maintenance.Plan",
"DisplayName": "Note", "DisplayName": "Note",
"IsEnabled": true, "IsEnabled": true,
"MultiTenancySide": 3, "MultiTenancySide": 3,
@ -6691,69 +6691,6 @@
"MultiTenancySide": 3, "MultiTenancySide": 3,
"MenuGroup": "Erp" "MenuGroup": "Erp"
}, },
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams",
"ParentName": null,
"DisplayName": "App.Maintenance.Teams",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Create",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Create",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Update",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Update",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Delete",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Delete",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Export",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Export",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Import",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Import",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{
"GroupName": "App.Maintenance",
"Name": "App.Maintenance.Teams.Note",
"ParentName": "App.Maintenance.Teams",
"DisplayName": "Note",
"IsEnabled": true,
"MultiTenancySide": 3,
"MenuGroup": "Erp"
},
{ {
"GroupName": "App.Maintenance", "GroupName": "App.Maintenance",
"Name": "App.Maintenance.Faults", "Name": "App.Maintenance.Faults",

View file

@ -161,5 +161,8 @@ public enum TableNameEnum
WorkcenterType, WorkcenterType,
WorkcenterStatus, WorkcenterStatus,
Workcenter, Workcenter,
WorkcenterSpecification WorkcenterSpecification,
MaintenancePlan,
MaintenancePlanMaterial,
MaintenancePlanEmployee
} }

View file

@ -536,7 +536,9 @@ public static class PlatformConsts
public const string WorkcenterType = "list-workcentertype"; public const string WorkcenterType = "list-workcentertype";
public const string WorkcenterStatus = "list-workcenterstatus"; public const string WorkcenterStatus = "list-workcenterstatus";
public const string Workcenter = "list-workcenter"; public const string Workcenter = "list-workcenter";
public const string Plan = "list-maintenanceplan";
public const string PlanMaterial = "list-maintenanceplanmaterial";
public const string PlanEmployee = "list-maintenanceplanemployee";
} }
} }

View file

@ -190,6 +190,9 @@ public static class TableNameResolver
{ nameof(TableNameEnum.WorkcenterStatus), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.WorkcenterStatus), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
{ nameof(TableNameEnum.Workcenter), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.Workcenter), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
{ nameof(TableNameEnum.WorkcenterSpecification), (TablePrefix.TenantByName, MenuPrefix.Maintenance) }, { nameof(TableNameEnum.WorkcenterSpecification), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
{ nameof(TableNameEnum.MaintenancePlan), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
{ nameof(TableNameEnum.MaintenancePlanMaterial), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
{ nameof(TableNameEnum.MaintenancePlanEmployee), (TablePrefix.TenantByName, MenuPrefix.Maintenance) },
// 🔹 ACCOUNTING // 🔹 ACCOUNTING

View file

@ -526,6 +526,9 @@ public static class SeedConsts
public const string WorkcenterType = Default + ".WorkcenterType"; public const string WorkcenterType = Default + ".WorkcenterType";
public const string WorkcenterStatus = Default + ".WorkcenterStatus"; public const string WorkcenterStatus = Default + ".WorkcenterStatus";
public const string Workcenter = Default + ".Workcenter"; public const string Workcenter = Default + ".Workcenter";
public const string Plan = Default + ".Plan";
public const string PlanMaterial = Default + ".PlanMaterial";
public const string PlanEmployee = Default + ".PlanEmployee";
} }
public static class Accounting public static class Accounting

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class MaintenancePlan : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public string Code { get; set; }
public string WorkCenterId { get; set; }
public string PlanType { get; set; }
public string Priority { get; set; }
public string Description { get; set; }
public int Frequency { get; set; }
public string FrequencyUnit { get; set; }
public int EstimatedDuration { get; set; }
public string Instructions { get; set; }
public DateTime NextDue { get; set; }
public bool IsActive { get; set; }
public DateTime? LastExecuted { get; set; }
// Collections
public string RequiredSkillsJson { get; set; }
public List<MaintenancePlanMaterial> Materials { get; set; }
public List<MaintenancePlanEmployee> Employees { get; set; }
}

View file

@ -0,0 +1,18 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class MaintenancePlanEmployee : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid MaintenancePlanId { get; set; }
public MaintenancePlan MaintenancePlan { get; set; }
public Guid EmployeeId { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Description { get; set; }
}

View file

@ -0,0 +1,16 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Erp.Platform.Entities;
public class MaintenancePlanMaterial : FullAuditedEntity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid MaintenancePlanId { get; set; }
public MaintenancePlan MaintenancePlan { get; set; }
public Guid MaterialId { get; set; }
public decimal Quantity { get; set; }
}

View file

@ -236,6 +236,7 @@ public class PlatformDbContext :
public DbSet<WorkcenterStatus> WorkcenterStatuses { get; set; } public DbSet<WorkcenterStatus> WorkcenterStatuses { get; set; }
public DbSet<Workcenter> Workcenters { get; set; } public DbSet<Workcenter> Workcenters { get; set; }
public DbSet<WorkcenterSpecification> WorkcenterSpecifications { get; set; } public DbSet<WorkcenterSpecification> WorkcenterSpecifications { get; set; }
public DbSet<MaintenancePlan> MaintenancePlans { get; set; }
#endregion #endregion
public PlatformDbContext(DbContextOptions<PlatformDbContext> options) public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
@ -2748,5 +2749,54 @@ public class PlatformDbContext :
.HasForeignKey(x => x.WorkcenterId) .HasForeignKey(x => x.WorkcenterId)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
builder.Entity<MaintenancePlan>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlan)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Code).IsRequired().HasMaxLength(100);
b.Property(x => x.WorkCenterId).IsRequired().HasMaxLength(100);
b.Property(x => x.PlanType).IsRequired().HasMaxLength(50);
b.Property(x => x.Priority).HasMaxLength(50);
b.Property(x => x.Description).HasMaxLength(1000);
b.Property(x => x.Frequency).IsRequired();
b.Property(x => x.FrequencyUnit).IsRequired().HasMaxLength(50);
b.Property(x => x.EstimatedDuration).IsRequired();
b.Property(x => x.Instructions).IsRequired().HasMaxLength(2000);
b.Property(x => x.RequiredSkillsJson).HasMaxLength(1000);
b.Property(x => x.NextDue).IsRequired();
b.Property(x => x.IsActive);
b.Property(x => x.LastExecuted).IsRequired();
});
builder.Entity<MaintenancePlanMaterial>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanMaterial)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.MaintenancePlanId).IsRequired();
b.Property(x => x.MaterialId).IsRequired();
b.Property(x => x.Quantity).HasPrecision(18, 2).HasDefaultValue(0);
b.HasOne(x => x.MaintenancePlan)
.WithMany(x => x.Materials)
.HasForeignKey(x => x.MaintenancePlanId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<MaintenancePlanEmployee>(b =>
{
b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaintenancePlanEmployee)), Prefix.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.MaintenancePlanId).IsRequired();
b.Property(x => x.EmployeeId).IsRequired();
b.HasOne(x => x.MaintenancePlan)
.WithMany(x => x.Employees)
.HasForeignKey(x => x.MaintenancePlanId)
.OnDelete(DeleteBehavior.Cascade);
});
} }
} }

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Erp.Platform.Migrations namespace Erp.Platform.Migrations
{ {
[DbContext(typeof(PlatformDbContext))] [DbContext(typeof(PlatformDbContext))]
[Migration("20251120065949_Initial")] [Migration("20251120142319_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -5922,6 +5922,221 @@ namespace Erp.Platform.Migrations
b.ToTable("Crm_T_LossReason", (string)null); b.ToTable("Crm_T_LossReason", (string)null);
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<int>("EstimatedDuration")
.HasColumnType("int");
b.Property<int>("Frequency")
.HasColumnType("int");
b.Property<string>("FrequencyUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Instructions")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("LastExecuted")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime>("NextDue")
.HasColumnType("datetime2");
b.Property<string>("PlanType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Priority")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RequiredSkillsJson")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("WorkCenterId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.ToTable("Mnt_T_MaintenancePlan", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("EmployeeId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaintenancePlanId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("MaintenancePlanId");
b.ToTable("Mnt_T_MaintenancePlanEmployee", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaintenancePlanId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("Quantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("MaintenancePlanId");
b.ToTable("Mnt_T_MaintenancePlanMaterial", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -14155,6 +14370,28 @@ namespace Erp.Platform.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
{
b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan")
.WithMany("Employees")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b =>
{
b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan")
.WithMany("Materials")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.HasOne("Erp.Platform.Entities.Currency", "Currency") b.HasOne("Erp.Platform.Entities.Currency", "Currency")
@ -15131,6 +15368,13 @@ namespace Erp.Platform.Migrations
b.Navigation("Opportunities"); b.Navigation("Opportunities");
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.Navigation("Employees");
b.Navigation("Materials");
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.Navigation("AlternativeUoms"); b.Navigation("AlternativeUoms");

View file

@ -1276,6 +1276,38 @@ namespace Erp.Platform.Migrations
table.PrimaryKey("PK_Hr_T_Template360", x => x.Id); table.PrimaryKey("PK_Hr_T_Template360", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "Mnt_T_MaintenancePlan",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
WorkCenterId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
PlanType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
Frequency = table.Column<int>(type: "int", nullable: false),
FrequencyUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
EstimatedDuration = table.Column<int>(type: "int", nullable: false),
Instructions = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
NextDue = table.Column<DateTime>(type: "datetime2", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
LastExecuted = table.Column<DateTime>(type: "datetime2", nullable: false),
RequiredSkillsJson = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mnt_T_MaintenancePlan", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Mnt_T_WorkcenterStatus", name: "Mnt_T_WorkcenterStatus",
columns: table => new columns: table => new
@ -3032,6 +3064,64 @@ namespace Erp.Platform.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "Mnt_T_MaintenancePlanEmployee",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MaintenancePlanId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EmployeeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mnt_T_MaintenancePlanEmployee", x => x.Id);
table.ForeignKey(
name: "FK_Mnt_T_MaintenancePlanEmployee_Mnt_T_MaintenancePlan_MaintenancePlanId",
column: x => x.MaintenancePlanId,
principalTable: "Mnt_T_MaintenancePlan",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Mnt_T_MaintenancePlanMaterial",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MaintenancePlanId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MaterialId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Quantity = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Mnt_T_MaintenancePlanMaterial", x => x.Id);
table.ForeignKey(
name: "FK_Mnt_T_MaintenancePlanMaterial_Mnt_T_MaintenancePlan_MaintenancePlanId",
column: x => x.MaintenancePlanId,
principalTable: "Mnt_T_MaintenancePlan",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "OpenIddictAuthorizations", name: "OpenIddictAuthorizations",
columns: table => new columns: table => new
@ -6344,6 +6434,16 @@ namespace Erp.Platform.Migrations
table: "Hr_T_SurveyResponse", table: "Hr_T_SurveyResponse",
column: "SurveyId"); column: "SurveyId");
migrationBuilder.CreateIndex(
name: "IX_Mnt_T_MaintenancePlanEmployee_MaintenancePlanId",
table: "Mnt_T_MaintenancePlanEmployee",
column: "MaintenancePlanId");
migrationBuilder.CreateIndex(
name: "IX_Mnt_T_MaintenancePlanMaterial_MaintenancePlanId",
table: "Mnt_T_MaintenancePlanMaterial",
column: "MaintenancePlanId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Mnt_T_Workcenter_DepartmentId", name: "IX_Mnt_T_Workcenter_DepartmentId",
table: "Mnt_T_Workcenter", table: "Mnt_T_Workcenter",
@ -7052,6 +7152,12 @@ namespace Erp.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Hr_T_SurveyQuestionOption"); name: "Hr_T_SurveyQuestionOption");
migrationBuilder.DropTable(
name: "Mnt_T_MaintenancePlanEmployee");
migrationBuilder.DropTable(
name: "Mnt_T_MaintenancePlanMaterial");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Mnt_T_WorkcenterSpecification"); name: "Mnt_T_WorkcenterSpecification");
@ -7262,6 +7368,9 @@ namespace Erp.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Hr_T_SurveyQuestion"); name: "Hr_T_SurveyQuestion");
migrationBuilder.DropTable(
name: "Mnt_T_MaintenancePlan");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Mnt_T_Workcenter"); name: "Mnt_T_Workcenter");

View file

@ -5919,6 +5919,221 @@ namespace Erp.Platform.Migrations
b.ToTable("Crm_T_LossReason", (string)null); b.ToTable("Crm_T_LossReason", (string)null);
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<int>("EstimatedDuration")
.HasColumnType("int");
b.Property<int>("Frequency")
.HasColumnType("int");
b.Property<string>("FrequencyUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Instructions")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("LastExecuted")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime>("NextDue")
.HasColumnType("datetime2");
b.Property<string>("PlanType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Priority")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RequiredSkillsJson")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<string>("WorkCenterId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.ToTable("Mnt_T_MaintenancePlan", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("EmployeeId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaintenancePlanId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("MaintenancePlanId");
b.ToTable("Mnt_T_MaintenancePlanEmployee", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("MaintenancePlanId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("MaterialId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("Quantity")
.ValueGeneratedOnAdd()
.HasPrecision(18, 2)
.HasColumnType("decimal(18,2)")
.HasDefaultValue(0m);
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("MaintenancePlanId");
b.ToTable("Mnt_T_MaintenancePlanMaterial", (string)null);
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -14152,6 +14367,28 @@ namespace Erp.Platform.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanEmployee", b =>
{
b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan")
.WithMany("Employees")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlanMaterial", b =>
{
b.HasOne("Erp.Platform.Entities.MaintenancePlan", "MaintenancePlan")
.WithMany("Materials")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.HasOne("Erp.Platform.Entities.Currency", "Currency") b.HasOne("Erp.Platform.Entities.Currency", "Currency")
@ -15128,6 +15365,13 @@ namespace Erp.Platform.Migrations
b.Navigation("Opportunities"); b.Navigation("Opportunities");
}); });
modelBuilder.Entity("Erp.Platform.Entities.MaintenancePlan", b =>
{
b.Navigation("Employees");
b.Navigation("Materials");
});
modelBuilder.Entity("Erp.Platform.Entities.Material", b => modelBuilder.Entity("Erp.Platform.Entities.Material", b =>
{ {
b.Navigation("AlternativeUoms"); b.Navigation("AlternativeUoms");