Skip to content

Commit 0b0984c

Browse files
authored
Merge pull request #9 from jmayer913/v9.0.0/VersionBranch
V9.0.0/version branch
2 parents 4fb4065 + 45adb5f commit 0b0984c

56 files changed

Lines changed: 579 additions & 745 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/mainworkflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup .NET
2121
uses: actions/setup-dotnet@v4
2222
with:
23-
dotnet-version: 8.0.x
23+
dotnet-version: 9.0.x
2424
- name: Restore dependencies
2525
run: dotnet restore
2626
- name: Build

JMayer.Example.WebAssemblyBlazor.Shared/Data/Assets/Asset.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using JMayer.Data.Data;
2+
using System.ComponentModel.DataAnnotations;
23

34
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
45

56
/// <summary>
67
/// The class represents an asset (equipment) that needs to be monitored and work orders can be preformed on it.
78
/// </summary>
8-
public class Asset : UserEditableDataObject
9+
public class Asset : DataObject
910
{
1011
/// <summary>
1112
/// The property gets/sets the common category for the asset.
@@ -38,16 +39,18 @@ public class Asset : UserEditableDataObject
3839
/// <remarks>
3940
/// This is only used by the backend when updating the parent path.
4041
/// </remarks>
41-
internal string MeAsParentPath
42-
{
43-
get => ParentID == null ? Name : $"{ParentPath}/{Name}";
44-
}
42+
internal string MeAsParentPath => ParentID is null ? (Name ?? string.Empty) : $"{ParentPath}/{Name ?? string.Empty}";
4543

4644
/// <summary>
4745
/// The property gets/sets the model for the asset.
4846
/// </summary>
4947
public string? Model { get; set; }
5048

49+
/// <inheritdoc/>
50+
/// <remarks>Overridden to add Required data annotation.</remarks>
51+
[Required]
52+
public override string? Name { get => base.Name; set => base.Name = value; }
53+
5154
/// <summary>
5255
/// The property gets/sets id for the parent of this asset.
5356
/// </summary>

JMayer.Example.WebAssemblyBlazor.Shared/Data/Assets/StorageLocation.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
77
/// The class represents a storage location for an area asset.
88
/// </summary>
99
/// <remarks>
10-
/// The OwnerId in the SubUserEditableDataObject will represent an asset.
10+
/// The OwnerId in the SubDataObject will represent an asset.
1111
/// </remarks>
12-
public class StorageLocation : SubUserEditableDataObject
12+
public class StorageLocation : SubDataObject
1313
{
1414
/// <summary>
1515
/// The property gets/sets the friendly name (locations concatenated).
1616
/// </summary>
17-
public string FriendlyName
18-
{
19-
get => $"{LocationA}{(!string.IsNullOrWhiteSpace(LocationB) ? $" {LocationB}" : string.Empty)}{(!string.IsNullOrWhiteSpace(LocationC) ? $" {LocationC}" : string.Empty)}";
20-
}
17+
public string FriendlyName => $"{LocationA}{(string.IsNullOrWhiteSpace(LocationB) is false ? $" {LocationB}" : string.Empty)}{(string.IsNullOrWhiteSpace(LocationC) is false ? $" {LocationC}" : string.Empty)}";
2118

2219
/// <summary>
2320
/// The property gets/sets the name of the A location for the storage location.
@@ -46,7 +43,7 @@ public override void MapProperties(DataObject dataObject)
4643
{
4744
base.MapProperties(dataObject);
4845

49-
if (dataObject is StorageLocation storageLocation)
46+
if (dataObject is StorageLocation storageLocation)
5047
{
5148
LocationA = storageLocation.LocationA;
5249
LocationB = storageLocation.LocationB;

JMayer.Example.WebAssemblyBlazor.Shared/Data/Parts/Part.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using JMayer.Data.Data;
2+
using System.ComponentModel.DataAnnotations;
23

34
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
45

56
/// <summary>
67
/// The class represents a part to be used for repairing an asset.
78
/// </summary>
8-
public class Part : UserEditableDataObject
9+
public class Part : DataObject
910
{
1011
/// <summary>
1112
/// The property gets/sets the common category for the part.
@@ -32,6 +33,11 @@ public class Part : UserEditableDataObject
3233
/// </summary>
3334
public string? Model { get; set; }
3435

36+
/// <inheritdoc/>
37+
/// <remarks>Overridden to add Required data annotation.</remarks>
38+
[Required]
39+
public override string? Name { get => base.Name; set => base.Name = value; }
40+
3541
/// <summary>
3642
/// The property gets/sets is no longer procedured by the manfacturer.
3743
/// </summary>

JMayer.Example.WebAssemblyBlazor.Shared/Data/Parts/Stock.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
77
/// The class represents stock for a part at a particular storage location.
88
/// </summary>
99
/// <remarks>
10-
/// The OwnerId in the SubUserEditableDataObject will represent a part.
10+
/// The OwnerId in the SubDataObject will represent a part.
1111
/// </remarks>
12-
public class Stock : SubUserEditableDataObject
12+
public class Stock : SubDataObject
1313
{
1414
/// <summary>
1515
/// The property gets/sets the amount of stock at the location for the part.
@@ -22,6 +22,7 @@ public class Stock : SubUserEditableDataObject
2222
/// The property gets/sets the id for the storage location the part is stored at.
2323
/// </summary>
2424
[Required]
25+
[Range(1, long.MaxValue, ErrorMessage = "The Storage Location field is required.")]
2526
public long StorageLocationID { get; set; }
2627

2728
/// <summary>

JMayer.Example.WebAssemblyBlazor.Shared/Database/BHSExampleBuilder.cs

Lines changed: 83 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,86 @@ public class BHSExampleBuilder
1616
/// </summary>
1717
public IAssetDataLayer AssetDataLayer { get; set; }
1818

19+
/// <summary>
20+
/// The constant for the ATR category name.
21+
/// </summary>
22+
private const string AtrCategoryName = "ATR";
23+
24+
/// <summary>
25+
/// The constant for the bag room category name.
26+
/// </summary>
27+
private const string BagRoomCategoryName = "Bag Room";
28+
29+
/// <summary>
30+
/// The constant for the belt category name.
31+
/// </summary>
32+
private const string BeltCategoryName = "Belt";
33+
34+
/// <summary>
35+
/// The constant for the conveyor category name.
36+
/// </summary>
37+
private const string ConveyorCategoryName = "Conveyor";
38+
39+
/// <summary>
40+
/// The constant for the diverter category name.
41+
/// </summary>
42+
private const string DiverterCategoryName = "Diverter";
43+
44+
/// <summary>
45+
/// The constant for the electrical contact category name.
46+
/// </summary>
47+
private const string ElectricalContactCategoryName = "Electrical Contact";
48+
1949
/// <summary>
2050
/// The constant for the main part storage area asset name.
2151
/// </summary>
2252
public const string MainPartStorageAreaAssetName = "Main Part Storage";
2353

54+
/// <summary>
55+
/// The constant for the conveyor length for the main sortation subsystem.
56+
/// </summary>
57+
private const int MainSortationConveyorLength = 15;
58+
59+
/// <summary>
60+
/// The constant for the conveyor length for the makeup unit subsystem.
61+
/// </summary>
62+
private const int MakeupUnitConveyorLength = 6;
63+
64+
/// <summary>
65+
/// The constant for the motor category name.
66+
/// </summary>
67+
private const string MotorCategoryName = "Motor";
68+
2469
/// <summary>
2570
/// The property gets/sets the data layer used to interact with parts.
2671
/// </summary>
2772
public IPartDataLayer PartDataLayer { get; set; }
2873

74+
/// <summary>
75+
/// The constant for the photoeye category name.
76+
/// </summary>
77+
private const string PhotoeyeCategoryName = "Photoeye";
78+
2979
/// <summary>
3080
/// The property gets/sets the data layer used to interact with part stock.
3181
/// </summary>
3282
public IStockDataLayer StockDataLayer { get; set; }
3383

84+
/// <summary>
85+
/// The constant for the storage category name.
86+
/// </summary>
87+
private const string StorageCategoryName = "Storage";
88+
3489
/// <summary>
3590
/// The property gets/sets the data layer used to interact with asset storage locations.
3691
/// </summary>
3792
public IStorageLocationDataLayer StorageLocationDataLayer { get; set; }
3893

94+
/// <summary>
95+
/// The constant for the subsystem category name.
96+
/// </summary>
97+
private const string SubSystemCategoryName = "SubSystem";
98+
3999
/// <summary>
40100
/// The default constructor.
41101
/// </summary>
@@ -65,15 +125,15 @@ private void BuildAssets()
65125
{
66126
Asset bagRoomAsset = AssetDataLayer.CreateAsync(new Asset()
67127
{
68-
Category = "Bag Room",
128+
Category = BagRoomCategoryName,
69129
Description = "The main bag room for the BHS.",
70-
Name = "Main Bag Room",
130+
Name = $"Main Bag Room",
71131
Type = AssetType.Group,
72132
}).Result;
73133

74134
Asset asset = AssetDataLayer.CreateAsync(new Asset()
75135
{
76-
Category = "SubSystem",
136+
Category = SubSystemCategoryName,
77137
Description = "The main sortation line for the bag room.",
78138
Name = "MS1",
79139
ParentID = bagRoomAsset.Integer64ID,
@@ -82,19 +142,19 @@ private void BuildAssets()
82142

83143
_ = AssetDataLayer.CreateAsync(new Asset()
84144
{
85-
Category = "ATR",
145+
Category = AtrCategoryName,
86146
Description = "The scanner array for reading bags on the main sortation line.",
87147
Name = "MS1-ATR",
88148
ParentID = asset.Integer64ID,
89149
Priority = Priority.High,
90150
Type = AssetType.Equipment,
91151
});
92152

93-
for (int index = 1; index <= 15; index++)
153+
for (int index = 1; index <= MainSortationConveyorLength; index++)
94154
{
95155
_ = AssetDataLayer.CreateAsync(new Asset()
96156
{
97-
Category = "Conveyor",
157+
Category = ConveyorCategoryName,
98158
Description = "The conveyor which makes up the main sortation line.",
99159
Name = $"MS1-{index:00}",
100160
ParentID = asset.Integer64ID,
@@ -105,7 +165,7 @@ private void BuildAssets()
105165

106166
asset = AssetDataLayer.CreateAsync(new Asset()
107167
{
108-
Category = "SubSystem",
168+
Category = SubSystemCategoryName,
109169
Description = "The one of the destination lines for the bag room.",
110170
Name = "MU1",
111171
ParentID = bagRoomAsset.Integer64ID,
@@ -114,19 +174,19 @@ private void BuildAssets()
114174

115175
_ = AssetDataLayer.CreateAsync(new Asset()
116176
{
117-
Category = "Diverter",
177+
Category = DiverterCategoryName,
118178
Description = "The diverter which pushes bags onto the MU1 destination line.",
119179
Name = "MU1-DIV",
120180
ParentID = asset.Integer64ID,
121181
Priority = Priority.High,
122182
Type = AssetType.Equipment,
123183
});
124184

125-
for (int index = 1; index <= 6; index++)
185+
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
126186
{
127187
_ = AssetDataLayer.CreateAsync(new Asset()
128188
{
129-
Category = "Conveyor",
189+
Category = ConveyorCategoryName,
130190
Description = "The conveyor which makes up the MU1 destination line.",
131191
Name = $"MU1-{index:00}",
132192
ParentID = asset.Integer64ID,
@@ -137,7 +197,7 @@ private void BuildAssets()
137197

138198
asset = AssetDataLayer.CreateAsync(new Asset()
139199
{
140-
Category = "SubSystem",
200+
Category = SubSystemCategoryName,
141201
Description = "The one of the destination lines for the bag room.",
142202
Name = "MU2",
143203
ParentID = bagRoomAsset.Integer64ID,
@@ -146,19 +206,19 @@ private void BuildAssets()
146206

147207
_ = AssetDataLayer.CreateAsync(new Asset()
148208
{
149-
Category = "Diverter",
209+
Category = DiverterCategoryName,
150210
Description = "The diverter which pushes bags onto the MU2 destination line.",
151211
Name = "MU2-DIV",
152212
ParentID = asset.Integer64ID,
153213
Priority = Priority.High,
154214
Type = AssetType.Equipment,
155215
});
156216

157-
for (int index = 1; index <= 6; index++)
217+
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
158218
{
159219
_ = AssetDataLayer.CreateAsync(new Asset()
160220
{
161-
Category = "Conveyor",
221+
Category = ConveyorCategoryName,
162222
Description = "The conveyor which makes up the MU2 destination line.",
163223
Name = $"MU2-{index:00}",
164224
ParentID = asset.Integer64ID,
@@ -169,18 +229,18 @@ private void BuildAssets()
169229

170230
asset = AssetDataLayer.CreateAsync(new Asset()
171231
{
172-
Category = "SubSystem",
232+
Category = SubSystemCategoryName,
173233
Description = "The runout line for the bag room.",
174234
Name = "MU3",
175235
ParentID = bagRoomAsset.Integer64ID,
176236
Type = AssetType.Group,
177237
}).Result;
178238

179-
for (int index = 1; index <= 6; index++)
239+
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
180240
{
181241
_ = AssetDataLayer.CreateAsync(new Asset()
182242
{
183-
Category = "Conveyor",
243+
Category = ConveyorCategoryName,
184244
Description = "The conveyor which makes up the MU3 destination line.",
185245
Name = $"MU3-{index:00}",
186246
ParentID = asset.Integer64ID,
@@ -197,22 +257,22 @@ private void BuildParts()
197257
{
198258
_ = PartDataLayer.CreateAsync(new Part()
199259
{
200-
Category = "Belt",
260+
Category = BeltCategoryName,
201261
Name = "Power Turn Belt",
202262
});
203263
_ = PartDataLayer.CreateAsync(new Part()
204264
{
205-
Category = "Contact",
265+
Category = ElectricalContactCategoryName,
206266
Name = "Motor Contactor",
207267
});
208268
_ = PartDataLayer.CreateAsync(new Part()
209269
{
210-
Category = "Motor",
270+
Category = MotorCategoryName,
211271
Name = "Motor 1HP Drive",
212272
});
213273
_ = PartDataLayer.CreateAsync(new Part()
214274
{
215-
Category = "Photoeye",
275+
Category = PhotoeyeCategoryName,
216276
Name = "Photoeye, Polarized Retro Reflective",
217277
});
218278
}
@@ -232,7 +292,6 @@ private void BuildStock()
232292
_ = StockDataLayer.CreateAsync(new Stock()
233293
{
234294
Amount = 5 * (index + 1),
235-
Name = "A Name",
236295
OwnerInteger64ID = parts[index].Integer64ID,
237296
StorageLocationID = storageLocations[index].Integer64ID,
238297
StorageLocationName = storageLocations[index].FriendlyName,
@@ -248,13 +307,13 @@ private void BuildStorageLocations()
248307
{
249308
Asset asset = AssetDataLayer.CreateAsync(new Asset()
250309
{
251-
Category = "Storage",
310+
Category = StorageCategoryName,
252311
Description = "The main part storage for the BHS.",
253312
Name = MainPartStorageAreaAssetName,
254313
Type = AssetType.Area,
255314
}).Result;
256315

257-
StorageLocation storageLocation = new StorageLocation()
316+
StorageLocation storageLocation = new()
258317
{
259318
LocationA = "A1",
260319
LocationB = "R1",

0 commit comments

Comments
 (0)