26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
54 lines
2.1 KiB
C#
Executable File
54 lines
2.1 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using Dapper;
|
|
using DataModel.Helpers;
|
|
using DataModel.Models;
|
|
using Oracle.ManagedDataAccess.Client;
|
|
|
|
namespace DataModel.Process
|
|
{
|
|
/// <summary>
|
|
/// Work order job step tracking functionality for JDE interface
|
|
/// </summary>
|
|
public partial class JDE
|
|
{
|
|
/// <summary>
|
|
/// Fetches updates for work order steps
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns>Streaming work order steps for lots</returns>
|
|
public static IEnumerable<WorkOrderStep> GetWorkOrderSteps(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = lastUpdateDT.HasValue ?
|
|
connection.Query<WorkOrderStep>(queries["SQL_GET_WORKORDER_STEP_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
|
connection.Query<WorkOrderStep>(queries["SQL_GET_WORKORDER_STEP"], buffered: false, commandTimeout: Config.QueryTimeout);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fetches updates for work order steps archive
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns>Streaming work order steps for lots</returns>
|
|
public static IEnumerable<WorkOrderStep> GetWorkOrderStepsArchive(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = connection.Query<WorkOrderStep>(queries["SQL_GET_WORKORDER_STEP_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|