Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mainworkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
13 changes: 8 additions & 5 deletions JMayer.Example.WebAssemblyBlazor.Shared/Data/Assets/Asset.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using JMayer.Data.Data;
using System.ComponentModel.DataAnnotations;

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

/// <summary>
/// The class represents an asset (equipment) that needs to be monitored and work orders can be preformed on it.
/// </summary>
public class Asset : UserEditableDataObject
public class Asset : DataObject
{
/// <summary>
/// The property gets/sets the common category for the asset.
Expand Down Expand Up @@ -38,16 +39,18 @@ public class Asset : UserEditableDataObject
/// <remarks>
/// This is only used by the backend when updating the parent path.
/// </remarks>
internal string MeAsParentPath
{
get => ParentID == null ? Name : $"{ParentPath}/{Name}";
}
internal string MeAsParentPath => ParentID is null ? (Name ?? string.Empty) : $"{ParentPath}/{Name ?? string.Empty}";

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

/// <inheritdoc/>
/// <remarks>Overridden to add Required data annotation.</remarks>
[Required]
public override string? Name { get => base.Name; set => base.Name = value; }

/// <summary>
/// The property gets/sets id for the parent of this asset.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
/// The class represents a storage location for an area asset.
/// </summary>
/// <remarks>
/// The OwnerId in the SubUserEditableDataObject will represent an asset.
/// The OwnerId in the SubDataObject will represent an asset.
/// </remarks>
public class StorageLocation : SubUserEditableDataObject
public class StorageLocation : SubDataObject
{
/// <summary>
/// The property gets/sets the friendly name (locations concatenated).
/// </summary>
public string FriendlyName
{
get => $"{LocationA}{(!string.IsNullOrWhiteSpace(LocationB) ? $" {LocationB}" : string.Empty)}{(!string.IsNullOrWhiteSpace(LocationC) ? $" {LocationC}" : string.Empty)}";
}
public string FriendlyName => $"{LocationA}{(string.IsNullOrWhiteSpace(LocationB) is false ? $" {LocationB}" : string.Empty)}{(string.IsNullOrWhiteSpace(LocationC) is false ? $" {LocationC}" : string.Empty)}";

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

if (dataObject is StorageLocation storageLocation)
if (dataObject is StorageLocation storageLocation)
{
LocationA = storageLocation.LocationA;
LocationB = storageLocation.LocationB;
Expand Down
8 changes: 7 additions & 1 deletion JMayer.Example.WebAssemblyBlazor.Shared/Data/Parts/Part.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using JMayer.Data.Data;
using System.ComponentModel.DataAnnotations;

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

/// <summary>
/// The class represents a part to be used for repairing an asset.
/// </summary>
public class Part : UserEditableDataObject
public class Part : DataObject
{
/// <summary>
/// The property gets/sets the common category for the part.
Expand All @@ -32,6 +33,11 @@ public class Part : UserEditableDataObject
/// </summary>
public string? Model { get; set; }

/// <inheritdoc/>
/// <remarks>Overridden to add Required data annotation.</remarks>
[Required]
public override string? Name { get => base.Name; set => base.Name = value; }

/// <summary>
/// The property gets/sets is no longer procedured by the manfacturer.
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions JMayer.Example.WebAssemblyBlazor.Shared/Data/Parts/Stock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
/// The class represents stock for a part at a particular storage location.
/// </summary>
/// <remarks>
/// The OwnerId in the SubUserEditableDataObject will represent a part.
/// The OwnerId in the SubDataObject will represent a part.
/// </remarks>
public class Stock : SubUserEditableDataObject
public class Stock : SubDataObject
{
/// <summary>
/// The property gets/sets the amount of stock at the location for the part.
Expand All @@ -22,6 +22,7 @@ public class Stock : SubUserEditableDataObject
/// The property gets/sets the id for the storage location the part is stored at.
/// </summary>
[Required]
[Range(1, long.MaxValue, ErrorMessage = "The Storage Location field is required.")]
public long StorageLocationID { get; set; }

/// <summary>
Expand Down
107 changes: 83 additions & 24 deletions JMayer.Example.WebAssemblyBlazor.Shared/Database/BHSExampleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,86 @@ public class BHSExampleBuilder
/// </summary>
public IAssetDataLayer AssetDataLayer { get; set; }

/// <summary>
/// The constant for the ATR category name.
/// </summary>
private const string AtrCategoryName = "ATR";

/// <summary>
/// The constant for the bag room category name.
/// </summary>
private const string BagRoomCategoryName = "Bag Room";

/// <summary>
/// The constant for the belt category name.
/// </summary>
private const string BeltCategoryName = "Belt";

/// <summary>
/// The constant for the conveyor category name.
/// </summary>
private const string ConveyorCategoryName = "Conveyor";

/// <summary>
/// The constant for the diverter category name.
/// </summary>
private const string DiverterCategoryName = "Diverter";

/// <summary>
/// The constant for the electrical contact category name.
/// </summary>
private const string ElectricalContactCategoryName = "Electrical Contact";

/// <summary>
/// The constant for the main part storage area asset name.
/// </summary>
public const string MainPartStorageAreaAssetName = "Main Part Storage";

/// <summary>
/// The constant for the conveyor length for the main sortation subsystem.
/// </summary>
private const int MainSortationConveyorLength = 15;

/// <summary>
/// The constant for the conveyor length for the makeup unit subsystem.
/// </summary>
private const int MakeupUnitConveyorLength = 6;

/// <summary>
/// The constant for the motor category name.
/// </summary>
private const string MotorCategoryName = "Motor";

/// <summary>
/// The property gets/sets the data layer used to interact with parts.
/// </summary>
public IPartDataLayer PartDataLayer { get; set; }

/// <summary>
/// The constant for the photoeye category name.
/// </summary>
private const string PhotoeyeCategoryName = "Photoeye";

/// <summary>
/// The property gets/sets the data layer used to interact with part stock.
/// </summary>
public IStockDataLayer StockDataLayer { get; set; }

/// <summary>
/// The constant for the storage category name.
/// </summary>
private const string StorageCategoryName = "Storage";

/// <summary>
/// The property gets/sets the data layer used to interact with asset storage locations.
/// </summary>
public IStorageLocationDataLayer StorageLocationDataLayer { get; set; }

/// <summary>
/// The constant for the subsystem category name.
/// </summary>
private const string SubSystemCategoryName = "SubSystem";

/// <summary>
/// The default constructor.
/// </summary>
Expand Down Expand Up @@ -65,15 +125,15 @@ private void BuildAssets()
{
Asset bagRoomAsset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Bag Room",
Category = BagRoomCategoryName,
Description = "The main bag room for the BHS.",
Name = "Main Bag Room",
Name = $"Main Bag Room",
Type = AssetType.Group,
}).Result;

Asset asset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "SubSystem",
Category = SubSystemCategoryName,
Description = "The main sortation line for the bag room.",
Name = "MS1",
ParentID = bagRoomAsset.Integer64ID,
Expand All @@ -82,19 +142,19 @@ private void BuildAssets()

_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "ATR",
Category = AtrCategoryName,
Description = "The scanner array for reading bags on the main sortation line.",
Name = "MS1-ATR",
ParentID = asset.Integer64ID,
Priority = Priority.High,
Type = AssetType.Equipment,
});

for (int index = 1; index <= 15; index++)
for (int index = 1; index <= MainSortationConveyorLength; index++)
{
_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Conveyor",
Category = ConveyorCategoryName,
Description = "The conveyor which makes up the main sortation line.",
Name = $"MS1-{index:00}",
ParentID = asset.Integer64ID,
Expand All @@ -105,7 +165,7 @@ private void BuildAssets()

asset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "SubSystem",
Category = SubSystemCategoryName,
Description = "The one of the destination lines for the bag room.",
Name = "MU1",
ParentID = bagRoomAsset.Integer64ID,
Expand All @@ -114,19 +174,19 @@ private void BuildAssets()

_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Diverter",
Category = DiverterCategoryName,
Description = "The diverter which pushes bags onto the MU1 destination line.",
Name = "MU1-DIV",
ParentID = asset.Integer64ID,
Priority = Priority.High,
Type = AssetType.Equipment,
});

for (int index = 1; index <= 6; index++)
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
{
_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Conveyor",
Category = ConveyorCategoryName,
Description = "The conveyor which makes up the MU1 destination line.",
Name = $"MU1-{index:00}",
ParentID = asset.Integer64ID,
Expand All @@ -137,7 +197,7 @@ private void BuildAssets()

asset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "SubSystem",
Category = SubSystemCategoryName,
Description = "The one of the destination lines for the bag room.",
Name = "MU2",
ParentID = bagRoomAsset.Integer64ID,
Expand All @@ -146,19 +206,19 @@ private void BuildAssets()

_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Diverter",
Category = DiverterCategoryName,
Description = "The diverter which pushes bags onto the MU2 destination line.",
Name = "MU2-DIV",
ParentID = asset.Integer64ID,
Priority = Priority.High,
Type = AssetType.Equipment,
});

for (int index = 1; index <= 6; index++)
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
{
_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Conveyor",
Category = ConveyorCategoryName,
Description = "The conveyor which makes up the MU2 destination line.",
Name = $"MU2-{index:00}",
ParentID = asset.Integer64ID,
Expand All @@ -169,18 +229,18 @@ private void BuildAssets()

asset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "SubSystem",
Category = SubSystemCategoryName,
Description = "The runout line for the bag room.",
Name = "MU3",
ParentID = bagRoomAsset.Integer64ID,
Type = AssetType.Group,
}).Result;

for (int index = 1; index <= 6; index++)
for (int index = 1; index <= MakeupUnitConveyorLength; index++)
{
_ = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Conveyor",
Category = ConveyorCategoryName,
Description = "The conveyor which makes up the MU3 destination line.",
Name = $"MU3-{index:00}",
ParentID = asset.Integer64ID,
Expand All @@ -197,22 +257,22 @@ private void BuildParts()
{
_ = PartDataLayer.CreateAsync(new Part()
{
Category = "Belt",
Category = BeltCategoryName,
Name = "Power Turn Belt",
});
_ = PartDataLayer.CreateAsync(new Part()
{
Category = "Contact",
Category = ElectricalContactCategoryName,
Name = "Motor Contactor",
});
_ = PartDataLayer.CreateAsync(new Part()
{
Category = "Motor",
Category = MotorCategoryName,
Name = "Motor 1HP Drive",
});
_ = PartDataLayer.CreateAsync(new Part()
{
Category = "Photoeye",
Category = PhotoeyeCategoryName,
Name = "Photoeye, Polarized Retro Reflective",
});
}
Expand All @@ -232,7 +292,6 @@ private void BuildStock()
_ = StockDataLayer.CreateAsync(new Stock()
{
Amount = 5 * (index + 1),
Name = "A Name",
OwnerInteger64ID = parts[index].Integer64ID,
StorageLocationID = storageLocations[index].Integer64ID,
StorageLocationName = storageLocations[index].FriendlyName,
Expand All @@ -248,13 +307,13 @@ private void BuildStorageLocations()
{
Asset asset = AssetDataLayer.CreateAsync(new Asset()
{
Category = "Storage",
Category = StorageCategoryName,
Description = "The main part storage for the BHS.",
Name = MainPartStorageAreaAssetName,
Type = AssetType.Area,
}).Result;

StorageLocation storageLocation = new StorageLocation()
StorageLocation storageLocation = new()
{
LocationA = "A1",
LocationB = "R1",
Expand Down
Loading