26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
46 lines
1.7 KiB
C#
Executable File
46 lines
1.7 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 routing transaction tracking functionality for JDE interface
|
|
/// </summary>
|
|
public partial class JDE
|
|
{
|
|
/// <summary>
|
|
/// Fetches updates for work order routings
|
|
/// </summary>
|
|
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
|
/// <returns>Streaming work order routings for lots</returns>
|
|
public static IEnumerable<WorkOrderRouting> GetWorkOrderRoutings(DateTime? lastUpdateDT = null)
|
|
{
|
|
using (OracleConnection connection = GetConnection())
|
|
{
|
|
var results = lastUpdateDT.HasValue ?
|
|
connection.Query<WorkOrderRouting>(queries["SQL_GET_WORKORDER_ROUTING_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
|
connection.Query<WorkOrderRouting>(queries["SQL_GET_WORKORDER_ROUTING"], buffered: false, commandTimeout: Config.QueryTimeout);
|
|
|
|
foreach (var result in results)
|
|
{
|
|
if (result.LastUpdateDT.Year < 1900 || result.LastUpdateDT.Year > 2500)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (result.TransactionDate.Year < 1900 || result.TransactionDate.Year > 2500)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
yield return result;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|