LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
ProductionSetupFamily.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Xml.Serialization;
9
11
12/// <summary>
13/// Represents a shared production setup family on one work center.
14/// </summary>
15/// <remarks>
16/// A production setup family is distinct from a commercial product family,
17/// a BOM grouping, GroupingConstraint, and an item-level setup.
18/// </remarks>
19[Serializable]
20[XmlType(TypeName = "productionSetupFamily")]
21public sealed class ProductionSetupFamily :
24{
25 private WorkCenterReference _workCenter = new();
26 private ProductionFamilySetupTime? _setupTime;
27
28 [XmlElement("workCenter")]
30 {
31 get => _workCenter;
32 set
33 {
34 ArgumentNullException.ThrowIfNull(value);
35 SetProperty(ref _workCenter, value);
36 }
37 }
38
39 [XmlArray("memberItemIds")]
40 [XmlArrayItem("itemId")]
41 public List<int> MemberItemIds { get; } = new();
42
43 [XmlElement("setupTime")]
45 {
46 get => _setupTime;
47 set
48 {
49 if (ReferenceEquals(_setupTime, value))
50 {
51 return;
52 }
53
54 if (_setupTime is not null)
55 {
56 _setupTime.PropertyChanged -= OnSetupTimePropertyChanged;
57 }
58
59 _setupTime = value;
60
61 if (_setupTime is not null)
62 {
63 _setupTime.PropertyChanged += OnSetupTimePropertyChanged;
64 }
65
68 }
69 }
70
71 [XmlIgnore]
72 public int PlanningHorizon =>
73 SetupTime?.PlanningHorizon ?? 0;
74
75 [XmlIgnore]
77 MemberItemIds.All(itemId => itemId > 0) &&
78 MemberItemIds.Distinct().Count() == MemberItemIds.Count;
79
80 [XmlIgnore]
81 public bool HasMembers => MemberItemIds.Count > 0;
82
83 public void ResizeTimeSeries(int periodCount)
84 {
85 if (periodCount < 0)
86 {
87 throw new ArgumentOutOfRangeException(
88 nameof(periodCount));
89 }
90
91 SetupTime?.ResizeTimeSeries(periodCount);
93 }
94
95 public bool ContainsItem(int itemId) =>
96 MemberItemIds.Contains(itemId);
97
98 private void OnSetupTimePropertyChanged(
99 object? sender,
100 System.ComponentModel.PropertyChangedEventArgs e)
101 {
104 }
105}
IdentifiedEntity()
Initializes a new instance of the IdentifiedEntity class.
virtual void OnPropertyChanged([CallerMemberName] string? propertyName=null)
Raises the PropertyChanged event.
Capacity consumed when a shared production-family setup is active.
Represents a serializable reference to a work center.
Represents a shared production setup family on one work center.
int PlanningHorizon
Gets the number of planning periods currently represented by the object's time-dependent data.
void ResizeTimeSeries(int periodCount)
Resizes every time-dependent series contained in the object.
Defines a model object containing data indexed by planning period.