refactor(DataAccess): remove duplicate Models and Attributes (now in Core/ExcelIO)
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
namespace JdeScoping.DataAccess.Attributes;
|
||||
|
||||
/// <summary>
|
||||
/// Excel output column specification attribute.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class OutputColumnAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard format.
|
||||
/// </summary>
|
||||
public const string StdFormat = "@";
|
||||
|
||||
/// <summary>
|
||||
/// Standard date format.
|
||||
/// </summary>
|
||||
public const string DateFormat = "[$-409]MM/dd/yyyy;@";
|
||||
|
||||
/// <summary>
|
||||
/// Standard timestamp format.
|
||||
/// </summary>
|
||||
public const string TimestampFormat = "[$-409]m/d/yy h:mm AM/PM;@";
|
||||
|
||||
/// <summary>
|
||||
/// Wrapped text column default width.
|
||||
/// </summary>
|
||||
public const double WrappedColumnWidth = 65;
|
||||
|
||||
/// <summary>
|
||||
/// Order to display column.
|
||||
/// </summary>
|
||||
public int Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Override text to display for column header.
|
||||
/// </summary>
|
||||
public string HeaderText { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Column format (Excel formatting string).
|
||||
/// </summary>
|
||||
public string Format { get; set; } = StdFormat;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not width should be set automatically.
|
||||
/// </summary>
|
||||
public bool AutoWidth { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Manually set width (only used if AutoWidth = FALSE).
|
||||
/// </summary>
|
||||
public double Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not text should be wrapped.
|
||||
/// </summary>
|
||||
public bool WrapText { get; set; }
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace JdeScoping.DataAccess.Attributes;
|
||||
|
||||
/// <summary>
|
||||
/// Excel output table specification attribute.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public class OutputTableAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Output tab name in Excel.
|
||||
/// </summary>
|
||||
public string TabName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Table name for the Excel table.
|
||||
/// </summary>
|
||||
public string TableName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not merged header should be shown.
|
||||
/// </summary>
|
||||
public bool ShowHeader { get; set; }
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
using JdeScoping.DataAccess.Attributes;
|
||||
|
||||
namespace JdeScoping.DataAccess.Models.Results;
|
||||
|
||||
/// <summary>
|
||||
/// MIS non-match reporting model.
|
||||
/// </summary>
|
||||
[OutputTable(TabName = "Investigation", TableName = "Investigation")]
|
||||
public sealed record MisNonMatchSearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order job step work center code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 10, HeaderText = "Work Center Code")]
|
||||
public string WorkCenterCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Work order unique number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 20, HeaderText = "Work Order Number")]
|
||||
public long WorkOrderNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order start date.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 30, HeaderText = "Work Order Start Date", Format = OutputColumnAttribute.DateFormat)]
|
||||
public DateTime WorkOrderStartDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order job step number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 40, HeaderText = "Job Step Number")]
|
||||
public decimal JobStepNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order job step description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 50, HeaderText = "Function Operation Description")]
|
||||
public string JobStepDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Work order job step completion date.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 60, HeaderText = "Job Step End Date", Format = OutputColumnAttribute.DateFormat)]
|
||||
public DateTime? JobStepEndDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order job step function code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 70, HeaderText = "Function Code")]
|
||||
public string FunctionCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the job step was added (not in original router).
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 75, HeaderText = "Was Job Step Added?")]
|
||||
public bool WasJobStepAdded { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Matched work order job step number (match to original router by work order number, work center code, and function code).
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 76, HeaderText = "Matched Job Step Number")]
|
||||
public decimal? MatchedJobStepNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order item number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 80, HeaderText = "Item Number")]
|
||||
public string ItemNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Work order item description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 90, HeaderText = "Item Description")]
|
||||
public string ItemDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Work order router type.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 100, HeaderText = "Routing Type")]
|
||||
public string RoutingType { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
using JdeScoping.DataAccess.Attributes;
|
||||
|
||||
namespace JdeScoping.DataAccess.Models.Results;
|
||||
|
||||
/// <summary>
|
||||
/// MIS data reporting model.
|
||||
/// </summary>
|
||||
[OutputTable(TabName = "MIS Info", TableName = "MIS_Info")]
|
||||
public sealed record MisSearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Item unique number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 10, HeaderText = "Item Number")]
|
||||
public string ItemNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Item description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 50, HeaderText = "Item Description")]
|
||||
public string ItemDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Operation job step number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 20, HeaderText = "MIS Job Step Sequence Number")]
|
||||
public string SequenceNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// MIS unique number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 30, HeaderText = "MIS Number")]
|
||||
public string MisNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// MIS revision ID.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 40, HeaderText = "MIS Revision")]
|
||||
public string RevId { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// MIS release status.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 60, HeaderText = "MIS Release Status")]
|
||||
public string Status { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// MIS release date.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 70, HeaderText = "MIS Release Date", Format = OutputColumnAttribute.TimestampFormat)]
|
||||
public DateTime? ReleaseDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Branch unique code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 80, HeaderText = "Branch Code")]
|
||||
public string BranchCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Job step number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 90, HeaderText = "Job Step Sequence Number")]
|
||||
public decimal JobStepSequenceNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Job step number for matched F3112Z1 / F3111 record.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 100, HeaderText = "Matched Sequence Number")]
|
||||
public decimal? MatchedSequenceNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the job step was matched to F3112Z1 record.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 110, HeaderText = "Matched to F3112Z1?")]
|
||||
public bool RoutingMatch { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the job step was matched to F3111 record.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 120, HeaderText = "Matched to F3003?")]
|
||||
public bool MasterMatch { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Job step function description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 130, HeaderText = "Function Operation Description")]
|
||||
public string FunctionOperationDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Characteristic number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 140, HeaderText = "Char Number")]
|
||||
public string CharNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Test description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 150, HeaderText = "Test Description", AutoWidth = false, Width = OutputColumnAttribute.WrappedColumnWidth, WrapText = true)]
|
||||
public string TestDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Type of sampling.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 160, HeaderText = "Sampling Type")]
|
||||
public string SamplingType { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Sampling selection value.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 170, HeaderText = "Sampling Value")]
|
||||
public string SamplingValue { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Tools and gauges for MIS.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 180, HeaderText = "Tools & Gauges", AutoWidth = false, Width = OutputColumnAttribute.WrappedColumnWidth, WrapText = true)]
|
||||
public string ToolsGauges { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Instructions for MIS.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 190, HeaderText = "Work Instructions", AutoWidth = false, Width = OutputColumnAttribute.WrappedColumnWidth, WrapText = true)]
|
||||
public string WorkInstructions { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
using JdeScoping.DataAccess.Attributes;
|
||||
|
||||
namespace JdeScoping.DataAccess.Models.Results;
|
||||
|
||||
/// <summary>
|
||||
/// JDE search result reporting model.
|
||||
/// </summary>
|
||||
[OutputTable(TabName = "Search Results", TableName = "Search_Results")]
|
||||
public sealed record SearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Order unique number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 10, HeaderText = "Work Order Number")]
|
||||
public long WorkOrderNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Order branch code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 20, HeaderText = "Work Order Branch Code")]
|
||||
public string WorkOrderBranchCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Order lot number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 30, HeaderText = "Lot Number")]
|
||||
public string LotNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Order item number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 40, HeaderText = "Item Number")]
|
||||
public string ItemNumber { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Item master planning family.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 50, HeaderText = "Planning Family")]
|
||||
public string PlanningFamily { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Item master stocking type.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 55, HeaderText = "Stocking Type")]
|
||||
public string StockingType { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Order quantity.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 60, HeaderText = "Order Quantity")]
|
||||
public decimal OrderQuantity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity on hold.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 70, HeaderText = "Held Quantity")]
|
||||
public decimal HeldQuantity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity scrapped/cancelled.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 80, HeaderText = "Scrapped Quantity")]
|
||||
public decimal ScrappedQuantity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity shipped.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 90, HeaderText = "Shipped Quantity")]
|
||||
public decimal ShippedQuantity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation branch code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 100, HeaderText = "Operation Step Branch Code")]
|
||||
public string StepBranchCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Operation step number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 110, HeaderText = "Operation Step")]
|
||||
public decimal StepNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation step description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 120, HeaderText = "Operation Step Description")]
|
||||
public string StepDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Function operation description (long text).
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 130, HeaderText = "Function Operation Description")]
|
||||
public string FunctionOperationDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to operation step number.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 140, HeaderText = "Operation Step Update Timestamp", Format = OutputColumnAttribute.TimestampFormat)]
|
||||
public DateTime StepUpdateDt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Order status code.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 150, HeaderText = "Status Code")]
|
||||
public string StatusCode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Order status description.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 160, HeaderText = "Status Description")]
|
||||
public string StatusDescription { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to order status.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 170, HeaderText = "Status Update Timestamp", Format = OutputColumnAttribute.DateFormat)]
|
||||
public DateTime? StatusUpdateDt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order was included because it was manually specified.
|
||||
/// </summary>
|
||||
public bool ManuallySpecified { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order was included because it was split from a flagged work order.
|
||||
/// </summary>
|
||||
public bool SplitOrder { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order was included because it received parts from a flagged work order (CARDEX / F4111).
|
||||
/// </summary>
|
||||
public bool Cardex { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order was included because it received parts from a flagged work order (parts list / F3111).
|
||||
/// </summary>
|
||||
public bool PartsList { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order was included because it met the filter criteria.
|
||||
/// </summary>
|
||||
public bool Flagged { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Reason work order was included in results.
|
||||
/// </summary>
|
||||
[OutputColumn(Order = 180, HeaderText = "Inclusion Reason")]
|
||||
public string InclusionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ManuallySpecified)
|
||||
{
|
||||
return "ManuallySpecified";
|
||||
}
|
||||
if (Flagged)
|
||||
{
|
||||
return "Flagged";
|
||||
}
|
||||
if (Cardex && PartsList)
|
||||
{
|
||||
return "ComponentUsage (CARDEX + Parts List)";
|
||||
}
|
||||
if (Cardex && !PartsList)
|
||||
{
|
||||
return "ComponentUsage (CARDEX)";
|
||||
}
|
||||
if (!Cardex && PartsList)
|
||||
{
|
||||
return "ComponentUsage (Parts List)";
|
||||
}
|
||||
if (SplitOrder)
|
||||
{
|
||||
return "Split order";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using JdeScoping.DataAccess.Models.Results;
|
||||
|
||||
namespace JdeScoping.DataAccess.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Reporting search data model.
|
||||
/// Filter criteria are stored as JSON in the Search.Criteria column
|
||||
/// and are extracted using SQL functions (fn_GetSearch*) during query execution.
|
||||
/// </summary>
|
||||
public class SearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// PK ID of search.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User name of user that created search.
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// User-friendly name for search.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was submitted.
|
||||
/// </summary>
|
||||
public DateTime? SubmitDt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was started.
|
||||
/// </summary>
|
||||
public DateTime? StartDt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was completed.
|
||||
/// </summary>
|
||||
public DateTime? EndDt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order search results.
|
||||
/// </summary>
|
||||
public List<SearchResult> Results { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// MIS results.
|
||||
/// </summary>
|
||||
public List<MisSearchResult> MisResults { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// MIS no match found results.
|
||||
/// </summary>
|
||||
public List<MisNonMatchSearchResult> MisNonMatchResults { get; set; } = [];
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using JdeScoping.DataAccess.Options;
|
||||
using JdeScoping.DataAccess.Interfaces;
|
||||
using JdeScoping.Core.Models.SearchResults;
|
||||
using JdeScoping.DataAccess.Models;
|
||||
using SearchModel = JdeScoping.Core.Models.SearchResults.SearchModel;
|
||||
using JdeScoping.DataAccess.QueryBuilders;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
Reference in New Issue
Block a user