Strip JDE/CMS data-sync from OLD/ for v5 POC
Remove JDE/CMS source-system integration: JDE/CMS query classes, SQL files, WorkerService UpdateProcessor pipeline, dsconfig data-source configs, and Oracle/Sybase/DDTek driver references. WorkProcessor now goes straight to processing queued searches against the existing local SQL Server cache; DB schema (DataUpdate table, MatchMis function) is left intact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
<configSections>
|
||||
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
@@ -21,26 +20,4 @@
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="Oracle.ManagedDataAccess.Client"/>
|
||||
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<publisherPolicy apply="no"/>
|
||||
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="4.121.0.0 - 4.65535.65535.65535" newVersion="4.122.19.1"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<oracle.manageddataaccess.client>
|
||||
<version number="*">
|
||||
<dataSources>
|
||||
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) "/>
|
||||
</dataSources>
|
||||
</version>
|
||||
</oracle.manageddataaccess.client>
|
||||
</configuration>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
SELECT DISTINCT
|
||||
mis.P_PART_NUMBER AS ItemNumber,
|
||||
mis.P_OPERATION_NUMBER AS SequenceNumber,
|
||||
item.PITEM_ID AS MISNumber,
|
||||
itemrev.PITEM_REVISION_ID AS RevID,
|
||||
TRIM(mis.P_SITE) AS BranchCode,
|
||||
zim_test_details.P_SEQ_NUMBER AS CharNumber,
|
||||
zim_test_details.P_TEST_DESC AS TestDescription,
|
||||
zim_test_details.P_SAMPL_TYPE AS SamplingType,
|
||||
zim_test_details.P_SAMPL_VALUE AS SamplingValue,
|
||||
zim_test_details.P_TOOLS AS ToolsGauges,
|
||||
zim_test_details.P_WORK_INTR AS WorkInstructions,
|
||||
Status.PNAME AS Status,
|
||||
Status.PDATE_RELEASED AS ReleaseDate
|
||||
FROM INFODBA.PITEM item
|
||||
INNER JOIN INFODBA.PITEMREVISION itemrev ON (item.PUID = itemrev.RITEMS_TAGU)
|
||||
INNER JOIN INFODBA.PRELEASE_STATUS_LIST listing ON (itemrev.PUID = listing.PUID)
|
||||
INNER JOIN INFODBA.PRELEASESTATUS Status ON (listing.PVALU_0 = Status.PUID)
|
||||
INNER JOIN INFODBA.PIMANRELATION imanrel ON (itemrev.PUID = imanrel.RPRIMARY_OBJECTU)
|
||||
INNER JOIN INFODBA.PFORM form ON (imanrel.RSECONDARY_OBJECTU = form.PUID)
|
||||
INNER JOIN INFODBA.PZIMMERMISDETAILS zim_mis ON (form.RDATA_FILEU = zim_mis.PUID)
|
||||
INNER JOIN INFODBA.P_TEST_DETAILS test_details ON (zim_mis.PUID = test_details.PUID)
|
||||
INNER JOIN INFODBA.P_PART_ASSOCIATION ppa ON (ppa.PUID = test_details.PUID)
|
||||
INNER JOIN INFODBA.PMISDATAOBJECT mis ON (mis.PUID = ppa.PVALU_0)
|
||||
INNER JOIN INFODBA.PZIMTESTDETAILS zim_test_details ON (test_details.PVALU_0 = zim_test_details.PUID)
|
||||
WHERE Status.PNAME IN ('Current', 'BackLevel')
|
||||
@@ -1,27 +0,0 @@
|
||||
SELECT DISTINCT
|
||||
mis.P_PART_NUMBER AS ItemNumber,
|
||||
mis.P_OPERATION_NUMBER AS SequenceNumber,
|
||||
item.PITEM_ID AS MISNumber,
|
||||
itemrev.PITEM_REVISION_ID AS RevID,
|
||||
TRIM(mis.P_SITE) AS BranchCode,
|
||||
zim_test_details.P_SEQ_NUMBER AS CharNumber,
|
||||
zim_test_details.P_TEST_DESC AS TestDescription,
|
||||
zim_test_details.P_SAMPL_TYPE AS SamplingType,
|
||||
zim_test_details.P_SAMPL_VALUE AS SamplingValue,
|
||||
zim_test_details.P_TOOLS AS ToolsGauges,
|
||||
zim_test_details.P_WORK_INTR AS WorkInstructions,
|
||||
Status.PNAME AS Status,
|
||||
Status.PDATE_RELEASED AS ReleaseDate
|
||||
FROM INFODBA.PITEM item
|
||||
INNER JOIN INFODBA.PITEMREVISION itemrev ON (item.PUID = itemrev.RITEMS_TAGU)
|
||||
INNER JOIN INFODBA.PRELEASE_STATUS_LIST listing ON (itemrev.PUID = listing.PUID)
|
||||
INNER JOIN INFODBA.PRELEASESTATUS Status ON (listing.PVALU_0 = Status.PUID)
|
||||
INNER JOIN INFODBA.PIMANRELATION imanrel ON (itemrev.PUID = imanrel.RPRIMARY_OBJECTU)
|
||||
INNER JOIN INFODBA.PFORM form ON (imanrel.RSECONDARY_OBJECTU = form.PUID)
|
||||
INNER JOIN INFODBA.PZIMMERMISDETAILS zim_mis ON (form.RDATA_FILEU = zim_mis.PUID)
|
||||
INNER JOIN INFODBA.P_TEST_DETAILS test_details ON (zim_mis.PUID = test_details.PUID)
|
||||
INNER JOIN INFODBA.P_PART_ASSOCIATION ppa ON (ppa.PUID = test_details.PUID)
|
||||
INNER JOIN INFODBA.PMISDATAOBJECT mis ON (mis.PUID = ppa.PVALU_0)
|
||||
INNER JOIN INFODBA.PZIMTESTDETAILS zim_test_details ON (test_details.PVALU_0 = zim_test_details.PUID)
|
||||
WHERE Status.PNAME IN ('Current', 'BackLevel') AND
|
||||
Status.PDATE_RELEASED >= :lastUpdateDT
|
||||
@@ -45,10 +45,6 @@
|
||||
<Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapper.1.50.2\lib\net45\Dapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DDTek.Oracle, Version=4.2.0.0, Culture=neutral, PublicKeyToken=c84cd5c63851e072, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\DDTek.Oracle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Fasterflect, Version=2.1.3.0, Culture=neutral, PublicKeyToken=38d18473284c1ca7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\fasterflect.2.1.3\lib\net40\Fasterflect.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -60,17 +56,10 @@
|
||||
<HintPath>..\packages\NLog.4.3.5\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Oracle.ManagedDataAccess.19.9.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sybase.AdoNet4.AseClient, Version=4.157.104.0, Culture=neutral, PublicKeyToken=95d94fac46c88e1e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Sybase.AdoNet4.AseClient.1.0.0\lib\net45\Sybase.AdoNet4.AseClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.OracleClient" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -81,7 +70,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Db\DbManager.cs" />
|
||||
<Compile Include="Helpers\DateTimeHelpers.cs" />
|
||||
<Compile Include="Helpers\GenericListDataReaderExtensions.cs" />
|
||||
<Compile Include="Helpers\LinqHelpers.cs" />
|
||||
@@ -116,59 +104,9 @@
|
||||
<Compile Include="Models\WorkOrderComponent.cs" />
|
||||
<Compile Include="Models\WorkOrderRouting.cs" />
|
||||
<Compile Include="Models\WorkOrderTime.cs" />
|
||||
<Compile Include="Process\CMS.cs" />
|
||||
<Compile Include="Process\CMS.MisData.cs">
|
||||
<DependentUpon>CMS.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.BusinessUnits.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.FunctionCode.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.Items.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.LotLocation.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.Lots.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.LotUsage.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.OrgHierarchy.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.RouteMaster.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.StatusCodes.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.Users.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.WorkOrderComponent.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.WorkOrderRouting.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.WorkOrders.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.WorkOrderStep.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\JDE.WorkOrderTime.cs">
|
||||
<DependentUpon>JDE.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.MisData.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\QueryRepository.cs" />
|
||||
<Compile Include="ViewModels\JdeUserViewModel.cs" />
|
||||
<Compile Include="ViewModels\LotViewModel.cs" />
|
||||
<Compile Include="ViewModels\PartOperationViewModel.cs" />
|
||||
@@ -177,7 +115,6 @@
|
||||
<Compile Include="Models\StatusCode.cs" />
|
||||
<Compile Include="Models\WorkOrder.cs" />
|
||||
<Compile Include="Models\WorkOrderStep.cs" />
|
||||
<Compile Include="Process\JDE.cs" />
|
||||
<Compile Include="Models\LDAPEntry.cs" />
|
||||
<Compile Include="Process\LotFinderDB.cs" />
|
||||
<Compile Include="Process\LotFinderDB.Item.cs">
|
||||
@@ -216,105 +153,6 @@
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="C:\Users\dohertj2\Desktop\MIS_JDE_SCOPING_TOOL_MISQUERY.sql" />
|
||||
<Content Include="CmsQueries\SQL_GET_MIS_DATA_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_FUNCTION_CODES.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_BUSINESS_UNITS_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_LOT_USAGES_ARCHIVE.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDERS_ARCHIVE.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_COMPONENTS_ARCHIVE.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_BUSINESS_UNITS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ITEMS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ITEMS_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_LOTS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_LOTS_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_LOT_USAGES.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_LOT_USAGES_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ORG_HIERARCHY.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ORG_HIERARCHY_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ROUTE_MASTER.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_ROUTE_MASTER_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_STATUS_CODES.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_STATUS_CODES_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_USERS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDERS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDERS_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_COMPONENTS.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_COMPONENTS_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_ROUTING.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_ROUTING_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_STEP_ARCHIVE.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_STEP.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_STEP_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_TIMES_ARCHIVE.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_TIMES.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="JdeQueries\SQL_GET_WORKORDER_TIMES_FILTERED.sql">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
+72
-216
@@ -1,216 +1,72 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Text.RegularExpressions;
|
||||
using DataModel.Helpers;
|
||||
using static System.Configuration.ConfigurationManager;
|
||||
|
||||
namespace DataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Application configuration
|
||||
/// </summary>
|
||||
public class Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Default query timeout (in seconds)
|
||||
/// </summary>
|
||||
public static int QueryTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_queryTimeout.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
string queryTimeoutStr = ConfigurationManager.AppSettings["querytimeout"];
|
||||
_queryTimeout = int.Parse(queryTimeoutStr);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse query timeout", error);
|
||||
}
|
||||
}
|
||||
|
||||
return _queryTimeout.Value;
|
||||
}
|
||||
}
|
||||
private static int? _queryTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// GIW connection string
|
||||
/// </summary>
|
||||
public static string GIWCS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_giwCS))
|
||||
{
|
||||
try
|
||||
{
|
||||
//Extract configured connection string
|
||||
string encryptedCS = ConnectionStrings["GIW"].ConnectionString;
|
||||
|
||||
//Extract encrypted password and decrypt it
|
||||
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
|
||||
string encyptedPassword = matches[0].Groups[1].Value;
|
||||
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
|
||||
|
||||
//Update connection string with decyrpted password
|
||||
_giwCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse GIW connection string", error);
|
||||
}
|
||||
}
|
||||
return _giwCS;
|
||||
}
|
||||
}
|
||||
private static string _giwCS;
|
||||
|
||||
/// <summary>
|
||||
/// JDE connection string
|
||||
/// </summary>
|
||||
public static string JDECS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_jdeCS))
|
||||
{
|
||||
try
|
||||
{
|
||||
//Extract configured connection string
|
||||
string encryptedCS = ConnectionStrings["JDE"].ConnectionString;
|
||||
|
||||
//Extract encrypted password and decrypt it
|
||||
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
|
||||
string encyptedPassword = matches[0].Groups[1].Value;
|
||||
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
|
||||
|
||||
//Update connection string with decyrpted password
|
||||
_jdeCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse JDE connection string", error);
|
||||
}
|
||||
}
|
||||
return _jdeCS;
|
||||
}
|
||||
}
|
||||
private static string _jdeCS;
|
||||
|
||||
/// <summary>
|
||||
/// JDE query repo directory
|
||||
/// </summary>
|
||||
public static string JDEQueryRepo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_jdeQueryRepo))
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get query repo directory
|
||||
_jdeQueryRepo = ConfigurationManager.AppSettings["JDE_QUERY_REPO"];
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse JDE query repo directory", error);
|
||||
}
|
||||
}
|
||||
return _jdeQueryRepo;
|
||||
}
|
||||
}
|
||||
private static string _jdeQueryRepo;
|
||||
|
||||
/// <summary>
|
||||
/// Lot finder DB
|
||||
/// </summary>
|
||||
public static string LotFinderDBCS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_lotFinderDBCS))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//Extract configured connection string
|
||||
string encryptedCS = ConnectionStrings["LotFinderDB"].ConnectionString;
|
||||
|
||||
//Extract encrypted password and decrypt it
|
||||
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
|
||||
string encyptedPassword = matches[0].Groups[1].Value;
|
||||
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
|
||||
|
||||
//Update connection string with decyrpted password
|
||||
_lotFinderDBCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse LotFinderDB connection string", error);
|
||||
}
|
||||
}
|
||||
return _lotFinderDBCS;
|
||||
}
|
||||
}
|
||||
private static string _lotFinderDBCS;
|
||||
|
||||
/// <summary>
|
||||
/// CMS DB
|
||||
/// </summary>
|
||||
public static string CMSCS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_cmsCS))
|
||||
{
|
||||
try
|
||||
{
|
||||
//Extract configured connection string
|
||||
string encryptedCS = ConnectionStrings["CMS"].ConnectionString;
|
||||
|
||||
//Extract encrypted password and decrypt it
|
||||
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
|
||||
string encyptedPassword = matches[0].Groups[1].Value;
|
||||
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
|
||||
|
||||
//Update connection string with decyrpted password
|
||||
_cmsCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse CMS connection string", error);
|
||||
}
|
||||
}
|
||||
return _cmsCS;
|
||||
}
|
||||
}
|
||||
private static string _cmsCS;
|
||||
|
||||
/// <summary>
|
||||
/// CMS query repo directory
|
||||
/// </summary>
|
||||
public static string CMSQueryRepo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_cmsQueryRepo))
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get query repo directory
|
||||
_cmsQueryRepo = ConfigurationManager.AppSettings["CMS_QUERY_REPO"];
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse CMS query repo directory", error);
|
||||
}
|
||||
}
|
||||
return _cmsQueryRepo;
|
||||
}
|
||||
}
|
||||
private static string _cmsQueryRepo;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Text.RegularExpressions;
|
||||
using DataModel.Helpers;
|
||||
using static System.Configuration.ConfigurationManager;
|
||||
|
||||
namespace DataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Application configuration
|
||||
/// </summary>
|
||||
public class Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Default query timeout (in seconds)
|
||||
/// </summary>
|
||||
public static int QueryTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_queryTimeout.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
string queryTimeoutStr = ConfigurationManager.AppSettings["querytimeout"];
|
||||
_queryTimeout = int.Parse(queryTimeoutStr);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse query timeout", error);
|
||||
}
|
||||
}
|
||||
|
||||
return _queryTimeout.Value;
|
||||
}
|
||||
}
|
||||
private static int? _queryTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// Lot finder DB
|
||||
/// </summary>
|
||||
public static string LotFinderDBCS
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_lotFinderDBCS))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//Extract configured connection string
|
||||
string encryptedCS = ConnectionStrings["LotFinderDB"].ConnectionString;
|
||||
|
||||
//Extract encrypted password and decrypt it
|
||||
MatchCollection matches = Regex.Matches(encryptedCS, @"Password=([^\;;]+ {0,1})");
|
||||
string encyptedPassword = matches[0].Groups[1].Value;
|
||||
string decryptedPassword = EncryptionHelper.Decrypt(encyptedPassword, "JDESCOPETOOL");
|
||||
|
||||
//Update connection string with decyrpted password
|
||||
_lotFinderDBCS = encryptedCS.Replace(encyptedPassword, decryptedPassword);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
throw new Exception("Failed to parse LotFinderDB connection string", error);
|
||||
}
|
||||
}
|
||||
return _lotFinderDBCS;
|
||||
}
|
||||
}
|
||||
private static string _lotFinderDBCS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using DDTek.Oracle;
|
||||
using NLog;
|
||||
|
||||
namespace DataModel.Db
|
||||
{
|
||||
public class DbManager
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static readonly Dictionary<string, DbConnectionString> connectionStrings = new Dictionary<string, DbConnectionString>();
|
||||
|
||||
|
||||
public static void Initialize(List<DbConnectionString> dbConnectionStrings)
|
||||
{
|
||||
foreach (DbConnectionString dbConnectionString in dbConnectionStrings)
|
||||
{
|
||||
connectionStrings.Add(dbConnectionString.Name, dbConnectionString);
|
||||
}
|
||||
}
|
||||
|
||||
public static DbConnection GetConnection(string name)
|
||||
{
|
||||
if (!connectionStrings.TryGetValue(name, out var connectionString))
|
||||
{
|
||||
throw new Exception($"DB Connection definition for '{name}' not found.");
|
||||
}
|
||||
|
||||
DbConnection connection = connectionString.GetConnection();
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
string errorMessage = $"Failed to open DB connection to '{name}': {error.Message}.";
|
||||
logger.Error(errorMessage);
|
||||
throw new Exception(errorMessage, error);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
public enum DbTypes { SqlServer, Oracle }
|
||||
|
||||
public class DbConnectionString
|
||||
{
|
||||
public string Environment { get; set; }
|
||||
public DbTypes DbType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ConnectionString { get; set; }
|
||||
|
||||
public DbConnection GetConnection()
|
||||
{
|
||||
switch (DbType)
|
||||
{
|
||||
case DbTypes.Oracle:
|
||||
return new OracleConnection(ConnectionString);
|
||||
case DbTypes.SqlServer:
|
||||
return new SqlConnection(ConnectionString);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
SELECT TRIM(wc.MCMCU) AS Code,
|
||||
TRIM(wc.MCDL01) AS Description,
|
||||
wc.MCUPMJ AS LastUpdateDate,
|
||||
wc.MCUPMT AS LastUpdateTime
|
||||
FROM PRODDTA.F0006 wc
|
||||
WHERE wc.MCSTYL = :typeCode
|
||||
@@ -1,10 +0,0 @@
|
||||
SELECT TRIM(wc.MCMCU) AS Code,
|
||||
TRIM(wc.MCDL01) AS Description,
|
||||
wc.MCUPMJ AS LastUpdateDate,
|
||||
wc.MCUPMT AS LastUpdateTime
|
||||
FROM PRODDTA.F0006 wc
|
||||
WHERE wc.MCSTYL = :typeCode AND
|
||||
(
|
||||
wc.MCUPMT > :dateUpdated OR
|
||||
(wc.MCUPMT = :dateUpdated AND wc.MCUPMT >= :timeUpdated)
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
SELECT Code,
|
||||
TRIM(LISTAGG(Description, ' ') WITHIN GROUP(ORDER BY Description) || CASE WHEN MAX(total_lengthb) > 4000 THEN '...' ELSE '' END) Description,
|
||||
SYSDATE AS LastUpdateDT
|
||||
FROM (
|
||||
SELECT TRIM(fc.CFKY) AS Code,
|
||||
TRIM(ASCIISTR(fc.CFDS80)) AS Description,
|
||||
SUM(LENGTHB(TRIM(fc.CFDS80))+1) OVER(PARTITION BY TRIM(fc.CFKY) ORDER BY TRIM(fc.CFDS80)) - 1 cumul_lengthb,
|
||||
SUM(LENGTHB(TRIM(fc.CFDS80))+1) OVER(PARTITION BY TRIM(fc.CFKY)) - 1 total_lengthb,
|
||||
COUNT(*) OVER(PARTITION BY TRIM(fc.CFKY)) num_values
|
||||
FROM PRODDTA.F00192 fc
|
||||
WHERE TRIM(fc.CFKY) IS NOT NULL
|
||||
)
|
||||
WHERE total_lengthb <= 4000 OR cumul_lengthb <= 4000 - length('...')
|
||||
GROUP BY Code
|
||||
@@ -1,9 +0,0 @@
|
||||
SELECT pn.IMITM AS ShortItemNumber,
|
||||
TRIM(pn.IMLITM) AS ItemNumber,
|
||||
TRIM(pn.IMDSC1) AS Description,
|
||||
TRIM(pn.IMPRP4) AS PlanningFamily,
|
||||
TRIM(pn.IMSTKT) AS StockingType,
|
||||
pn.IMUPMJ AS LastUpdateDate,
|
||||
pn.IMTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4101 pn
|
||||
WHERE TRIM(pn.IMLITM) IS NOT NULL
|
||||
@@ -1,13 +0,0 @@
|
||||
SELECT pn.IMITM AS ShortItemNumber,
|
||||
TRIM(pn.IMLITM) AS ItemNumber,
|
||||
TRIM(pn.IMDSC1) AS Description,
|
||||
TRIM(pn.IMPRP4) AS PlanningFamily,
|
||||
TRIM(pn.IMSTKT) AS StockingType,
|
||||
pn.IMUPMJ AS LastUpdateDate,
|
||||
pn.IMTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4101 pn
|
||||
WHERE TRIM(pn.IMLITM) IS NOT NULL AND
|
||||
(
|
||||
pn.IMUPMJ > :dateUpdated OR
|
||||
(pn.IMUPMJ = :dateUpdated AND pn.IMTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
SELECT TRIM(lot.IOLOTN) AS LotNumber,
|
||||
TRIM(lot.IOMCU) AS BranchCode,
|
||||
lot.IOITM AS ShortItemNumber,
|
||||
TRIM(lot.IOLITM) AS ItemNumber,
|
||||
lot.IOVEND AS SupplierCode,
|
||||
lot.IOLOTS AS StatusCode,
|
||||
lot.IOLOT1 AS Memo1,
|
||||
lot.IOLOT2 AS Memo2,
|
||||
lot.IOLOT3 AS Memo3,
|
||||
lot.IOUPMJ AS LastUpdateDate,
|
||||
lot.IOTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4108 lot
|
||||
WHERE TRIM(lot.IOLOTN) IS NOT NULL AND
|
||||
TRIM(lot.IOMCU) IS NOT NULL
|
||||
@@ -1,18 +0,0 @@
|
||||
SELECT TRIM(lot.IOLOTN) AS LotNumber,
|
||||
TRIM(lot.IOMCU) AS BranchCode,
|
||||
lot.IOITM AS ShortItemNumber,
|
||||
TRIM(lot.IOLITM) AS ItemNumber,
|
||||
lot.IOVEND AS SupplierCode,
|
||||
lot.IOLOTS AS StatusCode,
|
||||
lot.IOLOT1 AS Memo1,
|
||||
lot.IOLOT2 AS Memo2,
|
||||
lot.IOLOT3 AS Memo3,
|
||||
lot.IOUPMJ AS LastUpdateDate,
|
||||
lot.IOTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4108 lot
|
||||
WHERE TRIM(lot.IOLOTN) IS NOT NULL AND
|
||||
TRIM(lot.IOMCU) IS NOT NULL AND
|
||||
(
|
||||
lot.IOUPMJ > :dateUpdated OR
|
||||
(lot.IOUPMJ = :dateUpdated AND lot.IOTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
SELECT lu.ILUKID AS UniqueID,
|
||||
lu.ILDOCO AS WorkOrderNumber,
|
||||
TRIM(lu.ILLOTN) AS LotNumber,
|
||||
TRIM(lu.ILMCU) AS BranchCode,
|
||||
lu.ILITM AS ShortItemNumber,
|
||||
lu.ILTRQT AS Quantity,
|
||||
lu.ILTRDJ AS LastUpdateDate,
|
||||
lu.ILTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4111 lu
|
||||
WHERE lu.ILDCT = 'IM' AND
|
||||
TRIM(lu.ILLOTN) IS NOT NULL
|
||||
@@ -1,11 +0,0 @@
|
||||
SELECT lu.ILUKID AS UniqueID,
|
||||
lu.ILDOCO AS WorkOrderNumber,
|
||||
TRIM(lu.ILLOTN) AS LotNumber,
|
||||
TRIM(lu.ILMCU) AS BranchCode,
|
||||
lu.ILITM AS ShortItemNumber,
|
||||
lu.ILTRQT AS Quantity,
|
||||
lu.ILTRDJ AS LastUpdateDate,
|
||||
lu.ILTDAY AS LastUpdateTime
|
||||
FROM ARCDTAPD.F4111 lu
|
||||
WHERE lu.ILDCT = 'IM' AND
|
||||
TRIM(lu.ILLOTN) IS NOT NULL
|
||||
@@ -1,16 +0,0 @@
|
||||
SELECT lu.ILUKID AS UniqueID,
|
||||
lu.ILDOCO AS WorkOrderNumber,
|
||||
TRIM(lu.ILLOTN) AS LotNumber,
|
||||
TRIM(lu.ILMCU) AS BranchCode,
|
||||
lu.ILITM AS ShortItemNumber,
|
||||
lu.ILTRQT AS Quantity,
|
||||
lu.ILTRDJ AS LastUpdateDate,
|
||||
lu.ILTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4111 lu
|
||||
WHERE lu.ILDCT = 'IM' AND
|
||||
TRIM(lu.ILLOTN) IS NOT NULL AND
|
||||
(
|
||||
lu.ILTRDJ > :dateUpdated OR
|
||||
(lu.ILTRDJ = :dateUpdated AND lu.ILTDAY >= :timeUpdated)
|
||||
)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
SELECT TRIM(oh.IWMCUW) AS ProfitCenterCode,
|
||||
TRIM(oh.IWMCU) AS WorkCenterCode,
|
||||
TRIM(oh.IWMMCU) AS BranchCode,
|
||||
oh.IWUPMJ AS LastUpdateDate,
|
||||
oh.IWTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F30006 oh
|
||||
WHERE TRIM(oh.IWMCU) IS NOT NULL AND
|
||||
TRIM(oh.IWMMCU) IS NOT NULL
|
||||
@@ -1,12 +0,0 @@
|
||||
SELECT TRIM(oh.IWMCUW) AS ProfitCenterCode,
|
||||
TRIM(oh.IWMCU) AS WorkCenterCode,
|
||||
TRIM(oh.IWMMCU) AS BranchCode,
|
||||
oh.IWUPMJ AS LastUpdateDate,
|
||||
oh.IWTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F30006 oh
|
||||
WHERE TRIM(oh.IWMCU) IS NOT NULL AND
|
||||
TRIM(oh.IWMMCU) IS NOT NULL AND
|
||||
(
|
||||
oh.IWUPMJ > :dateUpdated OR
|
||||
(oh.IWUPMJ = :dateUpdated AND oh.IWTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
SELECT TRIM(rm.IRMMCU) AS BranchCode,
|
||||
TRIM(rm.IRKITL) AS ItemNumber,
|
||||
TRIM(rm.IRTRT) AS RoutingType,
|
||||
rm.IROPSQ / 10.0 AS SequenceNumber,
|
||||
TRIM(rm.IRURRF) AS FunctionCode,
|
||||
TRIM(rm.IRMCU) AS WorkCenterCode,
|
||||
rm.IREFFF AS StartDate_Date,
|
||||
rm.IREFFT AS EndDate_Date,
|
||||
rm.IRUPMJ AS LastUpdateDate,
|
||||
rm.IRTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3003 rm
|
||||
WHERE TRIM(rm.IRKITL) IS NOT NULL
|
||||
@@ -1,16 +0,0 @@
|
||||
SELECT TRIM(rm.IRMMCU) AS BranchCode,
|
||||
TRIM(rm.IRKITL) AS ItemNumber,
|
||||
TRIM(rm.IRTRT) AS RoutingType,
|
||||
rm.IROPSQ / 10.0 AS SequenceNumber,
|
||||
TRIM(rm.IRURRF) AS FunctionCode,
|
||||
TRIM(rm.IRMCU) AS WorkCenterCode,
|
||||
rm.IREFFF AS StartDate_Date,
|
||||
rm.IREFFT AS EndDate_Date,
|
||||
rm.IRUPMJ AS LastUpdateDate,
|
||||
rm.IRTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3003 rm
|
||||
WHERE TRIM(rm.IRKITL) IS NOT NULL AND
|
||||
(
|
||||
rm.IRUPMJ > :dateUpdated OR
|
||||
(rm.IRUPMJ = :dateUpdated AND rm.IRTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,7 +0,0 @@
|
||||
SELECT TRIM(sc.USERDEFINEDCODE_DRKY) AS CODE,
|
||||
TRIM(sc.DESCRIPTION001_DRDL01) AS Description,
|
||||
sc.DATEUPDATED_DRUPMJ + FLOOR(sc.TIMELASTUPDATED_DRUPMT / 10000) / 24 + FLOOR(MOD(sc.TIMELASTUPDATED_DRUPMT, 10000) / 100) / 1440 + MOD(sc.TIMELASTUPDATED_DRUPMT, 100) / 86400 AS LastUpdateDT
|
||||
FROM JDESTAGE.F0005_VIEW sc
|
||||
WHERE TRIM(sc.PRODUCTCODE_DRSY) = '00' AND
|
||||
sc.USERDEFINEDCODES_DRRT = 'SS' AND
|
||||
TRIM(sc.USERDEFINEDCODE_DRKY) IS NOT NULL
|
||||
@@ -1,11 +0,0 @@
|
||||
SELECT TRIM(sc.USERDEFINEDCODE_DRKY) AS CODE,
|
||||
TRIM(sc.DESCRIPTION001_DRDL01) AS Description,
|
||||
sc.DATEUPDATED_DRUPMJ + FLOOR(sc.TIMELASTUPDATED_DRUPMT / 10000) / 24 + FLOOR(MOD(sc.TIMELASTUPDATED_DRUPMT, 10000) / 100) / 1440 + MOD(sc.TIMELASTUPDATED_DRUPMT, 100) / 86400 AS LastUpdateDT
|
||||
FROM JDESTAGE.F0005_VIEW sc
|
||||
WHERE TRIM(sc.PRODUCTCODE_DRSY) = '00' AND
|
||||
sc.USERDEFINEDCODES_DRRT = 'SS' AND
|
||||
TRIM(sc.USERDEFINEDCODE_DRKY) IS NOT NULL AND
|
||||
(
|
||||
sc.DATEUPDATED_DRUPMJ > :dateUpdated OR
|
||||
(sc.DATEUPDATED_DRUPMJ = :dateUpdated AND sc.TIMELASTUPDATED_DRUPMT >= :timeUpdated)
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
WITH USER_CTE AS (
|
||||
SELECT ab.ABAN8 AS AddressNumber,
|
||||
TRIM(pro.ULUSER) AS UserID,
|
||||
TRIM(ab.ABALPH) AS FullName,
|
||||
ab.ABUPMJ AS LastUpdateDate,
|
||||
ab.ABUPMT AS LastUpdateTime,
|
||||
ROW_NUMBER() OVER (PARTITION BY ab.ABAN8 ORDER BY ab.ABUPMJ DESC, ab.ABUPMT DESC) RN
|
||||
FROM PRODDTA.F0101 ab LEFT OUTER JOIN
|
||||
SY920.F0092 pro ON (ab.ABAN8 = pro.ULAN8)
|
||||
)
|
||||
SELECT AddressNumber,
|
||||
UserID,
|
||||
FullName,
|
||||
LastUpdateDate,
|
||||
LastUpdateTime
|
||||
FROM USER_CTE
|
||||
WHERE RN = 1
|
||||
@@ -1,17 +0,0 @@
|
||||
SELECT wo.WADOCO AS WorkOrderNumber,
|
||||
TRIM(wo.WAMMCU) AS BranchCode,
|
||||
TRIM(wo.WALOTN) AS LotNumber,
|
||||
TRIM(wo.WALITM) AS ItemNumber,
|
||||
wo.WAITM AS ShortItemNumber,
|
||||
TRIM(wo.WAPARS) AS ParentWorkOrderNumber,
|
||||
wo.WAUORG / 100.0 AS OrderQuantity,
|
||||
wo.WASOBK / 100.0 AS HeldQuantity,
|
||||
wo.WASOQS / 100.0 AS ShippedQuantity,
|
||||
TRIM(wo.WASRST) AS StatusCode,
|
||||
CASE wo.WADCG WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WADCG+1900000,'YYYYDDD') END AS StatusCodeUpdateDT,
|
||||
CASE wo.WATRDJ WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WATRDJ+1900000,'YYYYDDD') END AS IssueDate,
|
||||
CASE wo.WASTRT WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WASTRT+1900000,'YYYYDDD') END AS StartDate,
|
||||
TRIM(wo.WATRT) AS RoutingType,
|
||||
wo.WAUPMJ AS LastUpdateDate,
|
||||
wo.WATDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4801 wo
|
||||
@@ -1,17 +0,0 @@
|
||||
SELECT wo.WADOCO AS WorkOrderNumber,
|
||||
TRIM(wo.WAMMCU) AS BranchCode,
|
||||
TRIM(wo.WALOTN) AS LotNumber,
|
||||
TRIM(wo.WALITM) AS ItemNumber,
|
||||
wo.WAITM AS ShortItemNumber,
|
||||
TRIM(wo.WAPARS) AS ParentWorkOrderNumber,
|
||||
wo.WAUORG / 100.0 AS OrderQuantity,
|
||||
wo.WASOBK / 100.0 AS HeldQuantity,
|
||||
wo.WASOQS / 100.0 AS ShippedQuantity,
|
||||
TRIM(wo.WASRST) AS StatusCode,
|
||||
CASE wo.WADCG WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WADCG+1900000,'YYYYDDD') END AS StatusCodeUpdateDT,
|
||||
CASE wo.WATRDJ WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WATRDJ+1900000,'YYYYDDD') END AS IssueDate,
|
||||
CASE wo.WASTRT WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WASTRT+1900000,'YYYYDDD') END AS StartDate,
|
||||
TRIM(wo.WATRT) AS RoutingType,
|
||||
wo.WAUPMJ AS LastUpdateDate,
|
||||
wo.WATDAY AS LastUpdateTime
|
||||
FROM ARCDTAPD.F4801 wo
|
||||
@@ -1,21 +0,0 @@
|
||||
SELECT wo.WADOCO AS WorkOrderNumber,
|
||||
TRIM(wo.WAMMCU) AS BranchCode,
|
||||
TRIM(wo.WALOTN) AS LotNumber,
|
||||
TRIM(wo.WALITM) AS ItemNumber,
|
||||
wo.WAITM AS ShortItemNumber,
|
||||
TRIM(wo.WAPARS) AS ParentWorkOrderNumber,
|
||||
wo.WAUORG / 100.0 AS OrderQuantity,
|
||||
wo.WASOBK / 100.0 AS HeldQuantity,
|
||||
wo.WASOQS / 100.0 AS ShippedQuantity,
|
||||
TRIM(wo.WASRST) AS StatusCode,
|
||||
CASE wo.WADCG WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WADCG+1900000,'YYYYDDD') END AS StatusCodeUpdateDT,
|
||||
CASE wo.WATRDJ WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WATRDJ+1900000,'YYYYDDD') END AS IssueDate,
|
||||
CASE wo.WASTRT WHEN 0 THEN TO_DATE('1900-01-01', 'YYYY-MM-DD') ELSE TO_DATE(wo.WASTRT+1900000,'YYYYDDD') END AS StartDate,
|
||||
TRIM(wo.WATRT) AS RoutingType,
|
||||
wo.WAUPMJ AS LastUpdateDate,
|
||||
wo.WATDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F4801 wo
|
||||
WHERE (
|
||||
wo.WAUPMJ > :dateUpdated OR
|
||||
(wo.WAUPMJ = :dateUpdated AND wo.WATDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
SELECT woc.WMUKID AS UniqueID,
|
||||
woc.WMDOCO AS WorkOrderNumber,
|
||||
TRIM(woc.WMLOTN) AS LotNumber,
|
||||
TRIM(woc.WMCMCU) AS BranchCode,
|
||||
woc.WMCPIT AS ShortItemNumber,
|
||||
woc.WMTRQT / 100.0 AS Quantity,
|
||||
woc.WMUPMJ AS LastUpdateDate,
|
||||
woc.WMTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3111 woc
|
||||
WHERE TRIM(woc.WMLOTN) IS NOT NULL
|
||||
@@ -1,10 +0,0 @@
|
||||
SELECT woc.WMUKID AS UniqueID,
|
||||
woc.WMDOCO AS WorkOrderNumber,
|
||||
TRIM(woc.WMLOTN) AS LotNumber,
|
||||
TRIM(woc.WMCMCU) AS BranchCode,
|
||||
woc.WMCPIT AS ShortItemNumber,
|
||||
woc.WMTRQT / 100.0 AS Quantity,
|
||||
woc.WMUPMJ AS LastUpdateDate,
|
||||
woc.WMTDAY AS LastUpdateTime
|
||||
FROM ARCDTAPD.F3111 woc
|
||||
WHERE TRIM(woc.WMLOTN) IS NOT NULL
|
||||
@@ -1,14 +0,0 @@
|
||||
SELECT woc.WMUKID AS UniqueID,
|
||||
woc.WMDOCO AS WorkOrderNumber,
|
||||
TRIM(woc.WMLOTN) AS LotNumber,
|
||||
TRIM(woc.WMCMCU) AS BranchCode,
|
||||
woc.WMCPIT AS ShortItemNumber,
|
||||
woc.WMTRQT / 100.0 AS Quantity,
|
||||
woc.WMUPMJ AS LastUpdateDate,
|
||||
woc.WMTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3111 woc
|
||||
WHERE TRIM(woc.WMLOTN) IS NOT NULL AND
|
||||
(
|
||||
woc.WMUPMJ > :dateUpdated OR
|
||||
(woc.WMUPMJ = :dateUpdated AND woc.WMUPMJ >= :timeUpdated)
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
SELECT TRIM(woz.SZEDUS) AS UserID,
|
||||
TRIM(woz.SZEDBT) AS BatchNumber,
|
||||
TRIM(woz.SZEDTN) AS TransactionNumber,
|
||||
woz.SZEDLN AS LineNumber,
|
||||
woz.SZOPSQ / 10.0 AS StepNumber,
|
||||
TRIM(woz.SZMCU) AS WorkCenterCode,
|
||||
woz.SZDOCO AS WorkOrderNumber,
|
||||
TRIM(woz.SZTRT) AS RoutingType,
|
||||
TRIM(woz.SZMMCU) AS BranchCode,
|
||||
TRIM(woz.SZDSC1) AS StepDescription,
|
||||
TRIM(woz.SZURRF) AS FunctionCode,
|
||||
woz.SZTRDJ AS TransactionDate_Date,
|
||||
woz.SZUPMJ AS LastUpdateDate,
|
||||
woz.SZTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3112Z1 woz
|
||||
WHERE woz.SZTYTN = 'JDERTG' AND
|
||||
woz.SZDRIN = '2' AND
|
||||
woz.SZTNAC = '02' AND
|
||||
woz.SZPID = 'ER31410' AND
|
||||
TRIM(woz.SZEDUS) IS NOT NULL AND
|
||||
TRIM(woz.SZEDBT) IS NOT NULL AND
|
||||
TRIM(woz.SZEDTN) IS NOT NULL AND
|
||||
TRIM(woz.SZMCU) IS NOT NULL
|
||||
@@ -1,27 +0,0 @@
|
||||
SELECT TRIM(woz.SZEDUS) AS UserID,
|
||||
TRIM(woz.SZEDBT) AS BatchNumber,
|
||||
TRIM(woz.SZEDTN) AS TransactionNumber,
|
||||
woz.SZEDLN AS LineNumber,
|
||||
woz.SZOPSQ / 10.0 AS StepNumber,
|
||||
TRIM(woz.SZMCU) AS WorkCenterCode,
|
||||
woz.SZDOCO AS WorkOrderNumber,
|
||||
TRIM(woz.SZTRT) AS RoutingType,
|
||||
TRIM(woz.SZMMCU) AS BranchCode,
|
||||
TRIM(woz.SZDSC1) AS StepDescription,
|
||||
TRIM(woz.SZURRF) AS FunctionCode,
|
||||
woz.SZTRDJ AS TransactionDate_Date,
|
||||
woz.SZUPMJ AS LastUpdateDate,
|
||||
woz.SZTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3112Z1 woz
|
||||
WHERE woz.SZTYTN = 'JDERTG' AND
|
||||
woz.SZDRIN = '2' AND
|
||||
woz.SZTNAC = '02' AND
|
||||
woz.SZPID = 'ER31410' AND
|
||||
TRIM(woz.SZEDUS) IS NOT NULL AND
|
||||
TRIM(woz.SZEDBT) IS NOT NULL AND
|
||||
TRIM(woz.SZEDTN) IS NOT NULL AND
|
||||
TRIM(woz.SZMCU) IS NOT NULL AND
|
||||
(
|
||||
woz.SZUPMJ > :dateUpdated OR
|
||||
(woz.SZUPMJ = :dateUpdated AND woz.SZTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
SELECT wos.WLDOCO AS WorkOrderNumber,
|
||||
wos.WLOPSQ/10 AS StepNumber,
|
||||
TRIM(wos.WLMCU) AS WorkCenterCode,
|
||||
TRIM(wos.WLMMCU) AS BranchCode,
|
||||
TRIM(wos.WLDSC1) AS StepDescription,
|
||||
TRIM(mes.CFDS80) AS FunctionOperationDescription,
|
||||
wos.WLOPSC AS StepTypeCode,
|
||||
CASE wos.WLSTRT WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRT+1900000,'YYYYDDD') END AS StartDT,
|
||||
CASE wos.WLSTRX WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRX+1900000,'YYYYDDD') END AS EndDT,
|
||||
TRIM(wos.WLURRF) AS FunctionCode,
|
||||
wos.WLSOCN / 100.0 AS ScrappedQuantity,
|
||||
wos.WLUPMJ AS LastUpdateDate,
|
||||
wos.WLTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3112 wos LEFT OUTER JOIN
|
||||
PRODDTA.F00192 mes ON (wos.WLURRF = mes.CFKY)
|
||||
WHERE TRIM(wos.WLMCU) IS NOT NULL AND
|
||||
TRIM(wos.WLMMCU) IS NOT NULL
|
||||
@@ -1,17 +0,0 @@
|
||||
SELECT wos.WLDOCO AS WorkOrderNumber,
|
||||
wos.WLOPSQ/10 AS StepNumber,
|
||||
TRIM(wos.WLMCU) AS WorkCenterCode,
|
||||
TRIM(wos.WLMMCU) AS BranchCode,
|
||||
TRIM(wos.WLDSC1) AS StepDescription,
|
||||
TRIM(mes.CFDS80) AS FunctionOperationDescription,
|
||||
wos.WLOPSC AS StepTypeCode,
|
||||
CASE wos.WLSTRT WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRT+1900000,'YYYYDDD') END AS StartDT,
|
||||
CASE wos.WLSTRX WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRX+1900000,'YYYYDDD') END AS EndDT,
|
||||
TRIM(wos.WLURRF) AS FunctionCode,
|
||||
wos.WLSOCN / 100.0 AS ScrappedQuantity,
|
||||
wos.WLUPMJ AS LastUpdateDate,
|
||||
wos.WLTDAY AS LastUpdateTime
|
||||
FROM ARCDTAPD.F3112 wos LEFT OUTER JOIN
|
||||
PRODDTA.F00192 mes ON (wos.WLURRF = mes.CFKY)
|
||||
WHERE TRIM(wos.WLMCU) IS NOT NULL AND
|
||||
TRIM(wos.WLMMCU) IS NOT NULL
|
||||
@@ -1,21 +0,0 @@
|
||||
SELECT wos.WLDOCO AS WorkOrderNumber,
|
||||
wos.WLOPSQ/10 AS StepNumber,
|
||||
TRIM(wos.WLMCU) AS WorkCenterCode,
|
||||
TRIM(wos.WLMMCU) AS BranchCode,
|
||||
TRIM(wos.WLDSC1) AS StepDescription,
|
||||
TRIM(mes.CFDS80) AS FunctionOperationDescription,
|
||||
wos.WLOPSC AS StepTypeCode,
|
||||
CASE wos.WLSTRT WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRT+1900000,'YYYYDDD') END AS StartDT,
|
||||
CASE wos.WLSTRX WHEN 0 THEN NULL ELSE TO_DATE(wos.WLSTRX+1900000,'YYYYDDD') END AS EndDT,
|
||||
TRIM(wos.WLURRF) AS FunctionCode,
|
||||
wos.WLSOCN / 100.0 AS ScrappedQuantity,
|
||||
wos.WLUPMJ AS LastUpdateDate,
|
||||
wos.WLTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F3112 wos LEFT OUTER JOIN
|
||||
PRODDTA.F00192 mes ON (wos.WLURRF = mes.CFKY)
|
||||
WHERE TRIM(wos.WLMCU) IS NOT NULL AND
|
||||
TRIM(wos.WLMMCU) IS NOT NULL AND
|
||||
(
|
||||
wos.WLUPMJ > :dateUpdated OR
|
||||
(wos.WLUPMJ = :dateUpdated AND wos.WLTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
SELECT wot.WTUKID AS UniqueID,
|
||||
wot.WTDOCO AS WorkOrderNumber,
|
||||
wot.WTOPSQ/10 AS StepNumber,
|
||||
TRIM(wot.WTMCU) AS WorkCenterCode,
|
||||
TRIM(wot.WTMMCU) AS BranchCode,
|
||||
wot.WTAN8 AS AddressNumber,
|
||||
CASE wot.WTDGL WHEN 0 THEN NULL ELSE TO_DATE(wot.WTDGL+1900000,'YYYYDDD') END AS GlDate,
|
||||
wot.WTUPMJ AS LastUpdateDate,
|
||||
wot.WTTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F31122 wot
|
||||
WHERE TRIM(wot.WTMCU) IS NOT NULL AND
|
||||
TRIM(wot.WTMMCU) IS NOT NULL
|
||||
@@ -1,12 +0,0 @@
|
||||
SELECT wot.WTUKID AS UniqueID,
|
||||
wot.WTDOCO AS WorkOrderNumber,
|
||||
wot.WTOPSQ/10 AS StepNumber,
|
||||
TRIM(wot.WTMCU) AS WorkCenterCode,
|
||||
TRIM(wot.WTMMCU) AS BranchCode,
|
||||
wot.WTAN8 AS AddressNumber,
|
||||
CASE wot.WTDGL WHEN 0 THEN NULL ELSE TO_DATE(wot.WTDGL+1900000,'YYYYDDD') END AS GlDate,
|
||||
wot.WTUPMJ AS LastUpdateDate,
|
||||
wot.WTTDAY AS LastUpdateTime
|
||||
FROM ARCDTAPD.F31122 wot
|
||||
WHERE TRIM(wot.WTMCU) IS NOT NULL AND
|
||||
TRIM(wot.WTMMCU) IS NOT NULL
|
||||
@@ -1,16 +0,0 @@
|
||||
SELECT wot.WTUKID AS UniqueID,
|
||||
wot.WTDOCO AS WorkOrderNumber,
|
||||
wot.WTOPSQ/10 AS StepNumber,
|
||||
TRIM(wot.WTMCU) AS WorkCenterCode,
|
||||
TRIM(wot.WTMMCU) AS BranchCode,
|
||||
wot.WTAN8 AS AddressNumber,
|
||||
CASE wot.WTDGL WHEN 0 THEN NULL ELSE TO_DATE(wot.WTDGL+1900000,'YYYYDDD') END AS GlDate,
|
||||
wot.WTUPMJ AS LastUpdateDate,
|
||||
wot.WTTDAY AS LastUpdateTime
|
||||
FROM PRODDTA.F31122 wot
|
||||
WHERE TRIM(wot.WTMCU) IS NOT NULL AND
|
||||
TRIM(wot.WTMMCU) IS NOT NULL AND
|
||||
(
|
||||
wot.WTUPMJ > :dateUpdated OR
|
||||
(wot.WTUPMJ = :dateUpdated AND wot.WTTDAY >= :timeUpdated)
|
||||
)
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
using DDTek.Oracle;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// MIS data loader for CMS interface
|
||||
/// </summary>
|
||||
public partial class CMS
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for MIS data
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for MIS data</returns>
|
||||
public static IEnumerable<MisData> GetMisData(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<MisData>(queries["SQL_GET_MIS_DATA_FILTERED"], new { lastUpdateDT }, buffered: false, commandTimeout: 1200*50) :
|
||||
connection.Query<MisData>(queries["SQL_GET_MIS_DATA"], buffered: false, commandTimeout: 1200*50);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
if (result.ReleaseDate.HasValue)
|
||||
{
|
||||
result.ReleaseDate = result.ReleaseDate.Value.ToLocalTime();
|
||||
}
|
||||
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using DDTek.Oracle;
|
||||
using NLog;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// CMS interface
|
||||
/// </summary>
|
||||
public partial class CMS
|
||||
{
|
||||
/// <summary>
|
||||
/// Query repository name
|
||||
/// </summary>
|
||||
private const string RepositoryName = "CMS";
|
||||
|
||||
/// <summary>
|
||||
/// Query repository instance
|
||||
/// </summary>
|
||||
private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.CMSQueryRepo);
|
||||
|
||||
/// <summary>
|
||||
/// Shared logger instance
|
||||
/// </summary>
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an open connection to the CMS DB
|
||||
/// </summary>
|
||||
/// <returns>Opened connection to the CMS DB</returns>
|
||||
private static OracleConnection GetConnection()
|
||||
{
|
||||
OracleConnection connection;
|
||||
|
||||
try
|
||||
{
|
||||
//Create the connection to the database and open it
|
||||
connection = new OracleConnection(Config.CMSCS);
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log error and forward
|
||||
logger.Error("GetConnection: failed to open connection to CMS: {0}.", error.Message);
|
||||
throw new Exception("CMS: failed to open connection to CMS database.", error);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE business units tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updated branches
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last updated record already imported</param>
|
||||
/// <returns>Streaming updated branches</returns>
|
||||
public static IEnumerable<Branch> GetBranches(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<Branch>(queries["SQL_GET_BUSINESS_UNITS_FILTERED"], new { typeCode = "BP", dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<Branch>(queries["SQL_GET_BUSINESS_UNITS"], new { typeCode = "BP" }, buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updated profit centers
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last updated record already imported</param>
|
||||
/// <returns>Streaming updated profit centers</returns>
|
||||
public static IEnumerable<ProfitCenter> GetProfitCenters(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<ProfitCenter>(queries["SQL_GET_BUSINESS_UNITS_FILTERED"], new { typeCode = "I3", dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<ProfitCenter>(queries["SQL_GET_BUSINESS_UNITS"], new { typeCode = "I3" }, buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updated work centers
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last updated record already imported</param>
|
||||
/// <returns>Streaming updated work centers</returns>
|
||||
public static IEnumerable<WorkCenter> GetWorkCenters(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<WorkCenter>(queries["SQL_GET_BUSINESS_UNITS_FILTERED"], new { typeCode = "WC", dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<WorkCenter>(queries["SQL_GET_BUSINESS_UNITS"], new { typeCode = "WC" }, buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Function code tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for function codes
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for function codes</returns>
|
||||
public static IEnumerable<FunctionCode> GetFunctionCodes(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = connection.Query<FunctionCode>(queries["SQL_GET_FUNCTION_CODES"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Item/part number tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for items (part numbers)
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for items (part numbers)</returns>
|
||||
public static IEnumerable<Item> GetItems(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<Item>(queries["SQL_GET_ITEMS_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<Item>(queries["SQL_GET_ITEMS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot location tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for lot locations
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for lot locations</returns>
|
||||
public static IEnumerable<LotLocation> GetLotLocations(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<LotLocation>(queries["SQL_GET_LOT_LOCATIONS_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<LotLocation>(queries["SQL_GET_LOT_LOCATIONS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot usage (CARDEX) tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for lot usages
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for lot usages</returns>
|
||||
public static IEnumerable<LotUsage> GetLotUsages(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<LotUsage>(queries["SQL_GET_LOT_USAGES_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: 999999) :
|
||||
connection.Query<LotUsage>(queries["SQL_GET_LOT_USAGES"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updates for lot usages archive
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for lot usages</returns>
|
||||
public static IEnumerable<LotUsage> GetLotUsagesArchive(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = connection.Query<LotUsage>(queries["SQL_GET_LOT_USAGES_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for lots
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for lots</returns>
|
||||
public static IEnumerable<Lot> GetLots(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<Lot>(queries["SQL_GET_LOTS_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<Lot>(queries["SQL_GET_LOTS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE organization hierarchy tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for organization hierarchy
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for organization hierarchy</returns>
|
||||
public static IEnumerable<OrgHierarchy> GetOrgHierarchy(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<OrgHierarchy>(queries["SQL_GET_ORG_HIERARCHY_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<OrgHierarchy>(queries["SQL_GET_ORG_HIERARCHY"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Item master router tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for route masters
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming route masters</returns>
|
||||
public static IEnumerable<RouteMaster> GetRouteMasters(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<RouteMaster>(queries["SQL_GET_ROUTE_MASTER_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<RouteMaster>(queries["SQL_GET_ROUTE_MASTER"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Status codes tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updated status codes
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last updated record already imported</param>
|
||||
/// <returns>Streaming updated status codes</returns>
|
||||
public static IEnumerable<StatusCode> GetStatusCodes(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (DDTek.Oracle.OracleConnection connection = new DDTek.Oracle.OracleConnection(Config.GIWCS))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<StatusCode>(queries["SQL_GET_STATUS_CODES_FILTERED"], new { dateUpdated = lastUpdateDT.Value.Date, timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<StatusCode>(queries["SQL_GET_STATUS_CODES"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// User/operator tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for users
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for users</returns>
|
||||
public static IEnumerable<JdeUser> GetUsers(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<JdeUser>(queries["SQL_GET_USERS"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<JdeUser>(queries["SQL_GET_USERS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order component tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for workorder components
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for workorder components</returns>
|
||||
public static IEnumerable<WorkOrderComponent> GetWorkOrderComponents(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<WorkOrderComponent>(queries["SQL_GET_WORKORDER_COMPONENTS_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<WorkOrderComponent>(queries["SQL_GET_WORKORDER_COMPONENTS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updates for workorder components archive
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for workorder components</returns>
|
||||
public static IEnumerable<WorkOrderComponent> GetWorkOrderComponentsArchive(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = connection.Query<WorkOrderComponent>(queries["SQL_GET_WORKORDER_COMPONENTS_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order time tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for work order time transactions
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<WorkOrderTime> GetWorkOrderTimes(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updates for work order time transactions archive
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<WorkOrderTime> GetWorkOrderTimesArchive(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = connection.Query<WorkOrderTime>(queries["SQL_GET_WORKORDER_TIMES_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order tracking functionality for JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches updates for work orders
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for work orders</returns>
|
||||
public static IEnumerable<WorkOrder> GetWorkOrders(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = lastUpdateDT.HasValue ?
|
||||
connection.Query<WorkOrder>(queries["SQL_GET_WORKORDERS_FILTERED"], new { dateUpdated = lastUpdateDT.Value.ToJDEDate(), timeUpdated = lastUpdateDT.Value.ToJDETime() }, buffered: false, commandTimeout: Config.QueryTimeout) :
|
||||
connection.Query<WorkOrder>(queries["SQL_GET_WORKORDERS"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches updates for work orders archive
|
||||
/// </summary>
|
||||
/// <param name="lastUpdateDT">Timestamp of last imported data</param>
|
||||
/// <returns>Streaming updates for work orders</returns>
|
||||
public static IEnumerable<WorkOrder> GetWorkOrdersArchive(DateTime? lastUpdateDT = null)
|
||||
{
|
||||
using (OracleConnection connection = GetConnection())
|
||||
{
|
||||
var results = connection.Query<WorkOrder>(queries["SQL_GET_WORKORDERS_ARCHIVE"], buffered: false, commandTimeout: Config.QueryTimeout);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using NLog;
|
||||
using Oracle.ManagedDataAccess.Client;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE interface
|
||||
/// </summary>
|
||||
public partial class JDE
|
||||
{
|
||||
/// <summary>
|
||||
/// Query repository name
|
||||
/// </summary>
|
||||
private const string RepositoryName = "JDE";
|
||||
|
||||
/// <summary>
|
||||
/// Query repository instance
|
||||
/// </summary>
|
||||
private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.JDEQueryRepo);
|
||||
|
||||
/// <summary>
|
||||
/// Shared logger instance
|
||||
/// </summary>
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an open connection to the JDE DB
|
||||
/// </summary>
|
||||
/// <returns>Opened connection to the JDE DB</returns>
|
||||
public static OracleConnection GetConnection()
|
||||
{
|
||||
OracleConnection connection;
|
||||
|
||||
try
|
||||
{
|
||||
//Create the connection to the database and open it
|
||||
connection = new OracleConnection(Config.JDECS);
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log error and forward
|
||||
logger.Error("GetConnection: failed to open connection to JDE: {0}.", error.Message);
|
||||
throw new Exception("JDE: failed to open connection to JDE database.", error);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
public class QueryRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Repository name
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Repository base directory
|
||||
/// </summary>
|
||||
public string BaseDirectory { get; }
|
||||
|
||||
/// <summary>
|
||||
/// In memory cache
|
||||
/// </summary>
|
||||
private static readonly Dictionary<string, string> cache = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Shared logger instance
|
||||
/// </summary>
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="name">Repository name</param>
|
||||
/// <param name="baseDirectory">Repository base directory</param>
|
||||
public QueryRepository(string name, string baseDirectory)
|
||||
{
|
||||
Name = name;
|
||||
BaseDirectory = baseDirectory;
|
||||
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(baseDirectory);
|
||||
}
|
||||
|
||||
logger.Info($"Query repository '{name}' initialized at base directory '{baseDirectory}'.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets query SQL
|
||||
/// </summary>
|
||||
/// <param name="queryName">Name of query to get SQL for</param>
|
||||
/// <returns>Query SQL</returns>
|
||||
public string GetQuery(string queryName)
|
||||
{
|
||||
string querySource = string.Empty;
|
||||
|
||||
if (!cache.TryGetValue(queryName, out querySource))
|
||||
{
|
||||
//Check if file exists
|
||||
string fullPath = Path.Combine(BaseDirectory, $"{queryName}.sql");
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
throw new Exception($"Cannot retreive query '{queryName}': '{fullPath}' does not exist");
|
||||
}
|
||||
|
||||
//Read file
|
||||
querySource = File.ReadAllText(fullPath);
|
||||
|
||||
querySource = querySource.Replace("PRODDTA", "PRODDTA");
|
||||
querySource = querySource.Replace("ARCDTAPD", "ARCDTAPD");
|
||||
File.WriteAllText(fullPath, querySource);
|
||||
|
||||
//Cache source
|
||||
cache.Add(queryName, querySource);
|
||||
}
|
||||
|
||||
return querySource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets querie's SQL
|
||||
/// </summary>
|
||||
/// <param name="queryName">Name of query to set SQL for</param>
|
||||
/// <param name="querySource">SQL to set for query</param>
|
||||
public void SetQuery(string queryName, string querySource)
|
||||
{
|
||||
logger.Info($"[{Name}] setting SQL for query '{queryName}'.");
|
||||
|
||||
//Update cache
|
||||
cache[queryName] = querySource;
|
||||
|
||||
//Write source to file
|
||||
string fullPath = Path.Combine(BaseDirectory, $"{queryName}.sql");
|
||||
File.WriteAllText(fullPath, querySource);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indexer override
|
||||
/// </summary>
|
||||
/// <param name="queryName">Name of query</param>
|
||||
/// <returns>SQL for query</returns>
|
||||
public string this[string queryName]
|
||||
{
|
||||
get => GetQuery(queryName);
|
||||
set => SetQuery(queryName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,4 @@
|
||||
<package id="fasterflect" version="2.1.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
||||
<package id="NLog" version="4.3.5" targetFramework="net452" />
|
||||
<package id="Oracle.ManagedDataAccess" version="19.9.0" targetFramework="net45" />
|
||||
<package id="Sybase.AdoNet4.AseClient" version="1.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -12,16 +12,9 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<publisherPolicy apply="no"/>
|
||||
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="4.122.0.0 - 4.65535.65535.65535" newVersion="4.122.18.3"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<connectionStrings>
|
||||
<add name="JDE" connectionString="HOST=sbracqa01-scan.nam.zimmer.com;Service Name=GIWQA1_USER;Fetch Array Size=1280000;Port=1521;User ID=JDE_SCOPING;Password=r39Pw67AmLxsmjBgob0d3g==;"/>
|
||||
<add name="CMS" connectionString="HOST=sbracqa01-scan.nam.zimmer.com;Service Name=GIWQA1_USER;Fetch Array Size=1280000;Port=1521;User ID=JDE_SCOPING;Password=r39Pw67AmLxsmjBgob0d3g==;"/>
|
||||
<add name="LotFinderDB" connectionString="Server=JDESCP-SQL-VQ01;Database=ScopingTool;User Id=ScopingTool;Password=wIk7KexO9sIEO+b+ILpfcA==;" providerName="System.Data.SqlClient"/>
|
||||
<!--<add name="LotFinderDB" connectionString="Server=(local)\MSSQL2014;Database=ScopingTool;User Id=sa;Password=4DacH/qWG7DGGCGpZ1XnJw==;" providerName="System.Data.SqlClient" />!-->
|
||||
</connectionStrings>
|
||||
|
||||
@@ -42,9 +42,6 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Oracle.ManagedDataAccess.18.3.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@@ -3,5 +3,4 @@
|
||||
<package id="Dapper" version="1.50.2" targetFramework="net452" />
|
||||
<package id="EPPlus" version="4.1.0" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
<package id="Oracle.ManagedDataAccess" version="18.3.0" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -2,7 +2,6 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0"/>
|
||||
@@ -65,10 +64,6 @@
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<publisherPolicy apply="no"/>
|
||||
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
|
||||
@@ -99,17 +94,6 @@
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="Oracle.ManagedDataAccess.Client"/>
|
||||
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
<oracle.manageddataaccess.client>
|
||||
<version number="*">
|
||||
<dataSources/>
|
||||
</version>
|
||||
</oracle.manageddataaccess.client>
|
||||
<connectionStrings>
|
||||
<add name="LotFinderDB" connectionString="Server=wwtest.nam.zimmer.com\MSSQL2014;Database=ScopingTool;User Id=sa;Password=4DacH/qWG7DGGCGpZ1XnJw==;" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
|
||||
@@ -123,10 +123,6 @@
|
||||
<HintPath>..\packages\NLog.4.3.5\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Oracle.ManagedDataAccess.12.1.24160419\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
<package id="NLog" version="4.3.5" targetFramework="net452" />
|
||||
<package id="NLog.Config" version="4.3.5" targetFramework="net452" />
|
||||
<package id="NLog.Schema" version="4.3.4" targetFramework="net452" />
|
||||
<package id="Oracle.ManagedDataAccess" version="12.1.24160419" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="Respond" version="1.2.0" targetFramework="net452" />
|
||||
<package id="WebGrease" version="1.5.2" targetFramework="net452" />
|
||||
|
||||
@@ -14,11 +14,6 @@
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<connectionStrings>
|
||||
<add name="JDE" connectionString="Data Source=JE2PRD_APP;User ID=SCOPING_TOOL;Password=ibj77wrpujxOEqPGbpduVw==;"/>
|
||||
<!--<add name="JDE" connectionString="Data Source=JE1QA_APP;User ID=DOHERTJ2;Password=Jri2ZYCVNotsqrazeXs//g==;" />!-->
|
||||
<add name="GIW" connectionString="HOST=giwprd1.zmr.zimmer.com;Service Name=giwprd1_app;Port=1521;User ID=MFGREPORTING;Password=hS1mVvXwdRgbLVz48PD2wS9mFHD5XNheBYB+PIurOxQ=;"/>
|
||||
<add name="CMS" connectionString="HOST=ha-iman;Service Name=imanprd;Fetch Array Size=1280000;Port=1522;User ID=app_teamcenter;Password=8mjtcCypgFya2i3njdhm9w==;"/>
|
||||
<!--<add name="CMS" connectionString="HOST=sbracqa01-scan.nam.zimmer.com;Service Name=GIWQA1_USER;Fetch Array Size=1280000;Port=1521;User ID=JDE_SCOPING;Password=r39Pw67AmLxsmjBgob0d3g==;" />!-->
|
||||
<!--<add name="LotFinderDB" connectionString="Server=sbconsqlprd03.zmr.zimmer.com;Database=ScopingTool;User Id=scoping;Password=X4Uxe6hggSnlFTWwzBhodg==;" providerName="System.Data.SqlClient" />!-->
|
||||
<!--<add name="LotFinderDB" connectionString="Server=JDESCP-SQL-VP01;Database=ScopingTool;User Id=ScopingToolPrd;Password=8AC/5qz4KbUnad9O/Ghn+g==;" providerName="System.Data.SqlClient" />!-->
|
||||
<add name="LotFinderDB" connectionString="Server=JDESCP-SQL-VQ01.zmr.zimmer.com;Database=ScopingTool;User Id=ScopingTool;Password=wIk7KexO9sIEO+b+ILpfcA==;" providerName="System.Data.SqlClient"/>
|
||||
@@ -29,8 +24,6 @@
|
||||
<!--<add key="HubHost" value="http://sbtriwebdev01.zmr.zimmer.com/jdescopingtoolv4" />!-->
|
||||
<!--<add key="HubHost" value="http://localhost:39148" />!-->
|
||||
<add key="querytimeout" value="600"/>
|
||||
<add key="JDE_QUERY_REPO" value="JdeQueries"/>
|
||||
<add key="CMS_QUERY_REPO" value="CmsQueries"/>
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
public class DataSource
|
||||
{
|
||||
public int DataSourceID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string HostName { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class DataLoad
|
||||
{
|
||||
public int DataLoadID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public int DataSourceID { get; set; }
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
public List<DataLoadSchedule> Schedules { get; set; }
|
||||
}
|
||||
|
||||
public class DataLoadSchedule
|
||||
{
|
||||
public int DataLoadScheduleID { get; set; }
|
||||
public int DataLoadID { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool PurgeBeforeLoad { get; set; }
|
||||
public bool ReIndexAfterLoad { get; set; }
|
||||
public bool IsDaily { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using WorkerService.Process;
|
||||
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Database update configuration
|
||||
/// </summary>
|
||||
public class DataSourceConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of source data system
|
||||
/// </summary>
|
||||
public string SourceSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of source data set
|
||||
/// </summary>
|
||||
public string SourceData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of table being updated
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the data source is enabled
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Source data fetch function
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(FunctionConverter<DateTime?, IEnumerable<dynamic>>))]
|
||||
public Func<DateTime?, IEnumerable<dynamic>> DataFetchFunction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Post data update processing action
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ActionConverter))]
|
||||
public Action PostProcessingAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data update entry for mass update typ
|
||||
/// </summary>
|
||||
public DataUpdateConfig MassUpdateConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data update entry for daily update typ
|
||||
/// </summary>
|
||||
public DataUpdateConfig DailyUpdateConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data update entry for hourly update typ
|
||||
/// </summary>
|
||||
public DataUpdateConfig HourlyUpdateConfig { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Database update entry
|
||||
/// </summary>
|
||||
public class DataUpdateConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not the update config is enabled
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Interval (in minutes) between updates
|
||||
/// </summary>
|
||||
public int Interval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the table should be purged prior to update
|
||||
/// </summary>
|
||||
public bool PrepurgeData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the table should be re-indexed after update
|
||||
/// </summary>
|
||||
public bool ReIndexData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using DataModel.Models;
|
||||
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Cached data update task
|
||||
/// </summary>
|
||||
public class DataUpdateTask
|
||||
{
|
||||
/// <summary>
|
||||
/// Data update configuration
|
||||
/// </summary>
|
||||
public DataSourceConfig Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of update needed
|
||||
/// </summary>
|
||||
public UpdateTypes UpdateType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minimum timestamp to import changeset from
|
||||
/// </summary>
|
||||
public DateTime? MinimumDT { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Table index
|
||||
/// </summary>
|
||||
public class Index
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of index
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the index is a primary key
|
||||
/// </summary>
|
||||
public bool IsPrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the index is unique
|
||||
/// </summary>
|
||||
public bool IsUnique { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the index is unique constraint
|
||||
/// </summary>
|
||||
public bool IsUniqueConstraint { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace WorkerService.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Set of last successful data updates for table
|
||||
/// </summary>
|
||||
public class LastDataUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// Data table name
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last successful mass data update
|
||||
/// </summary>
|
||||
public DateTime MassUpdateDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last successful daily data update
|
||||
/// </summary>
|
||||
public DateTime DailyUpdateDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last successful hourly data update
|
||||
/// </summary>
|
||||
public DateTime HourlyUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
using DataModel.Process;
|
||||
using WorkerService.Models;
|
||||
|
||||
namespace WorkerService.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Data update entry management functionality for data update processor
|
||||
/// </summary>
|
||||
public partial class UpdateProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL to close any open update entries (identified by number records = -2)
|
||||
/// </summary>
|
||||
private const string SQL_CLOSE_OPEN_UPDATE_ENTRIES = @"
|
||||
UPDATE dbo.DataUpdate
|
||||
SET EndDT = GETDATE(), WasSuccessful = 0, NumberRecords = -1
|
||||
WHERE NumberRecords = -2";
|
||||
|
||||
/// <summary>
|
||||
/// Closes any open data update entries
|
||||
/// </summary>
|
||||
private static void CloseOpenUpdateEntries()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = LotFinderDB.GetConnection())
|
||||
{
|
||||
//Close any open update entries
|
||||
connection.Execute(SQL_CLOSE_OPEN_UPDATE_ENTRIES);
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("CloseOpenUpdateEntries: failed to close open data update entries: {0}.", error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL to purge data update records
|
||||
/// </summary>
|
||||
private const string SQL_PURGE_UPDATE_ENTRIES = @"
|
||||
DELETE FROM dbo.DataUpdate
|
||||
WHERE StartDT < DATEADD(DAY, @maxAge * -1, GETDATE())";
|
||||
|
||||
/// <summary>
|
||||
/// Purges any data update entries older than given max age
|
||||
/// </summary>
|
||||
/// <param name="maxAge">Maximum entry age (in days)</param>
|
||||
private static void PurgeUpdateEntries(int maxAge)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = LotFinderDB.GetConnection())
|
||||
{
|
||||
//Purge the records
|
||||
connection.Execute(SQL_PURGE_UPDATE_ENTRIES, new { maxAge });
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("PurgeUpdateEntries: failed to purge data update entries older than {0} days: {1}.", maxAge, error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL to insert data update record
|
||||
/// </summary>
|
||||
private const string SQL_LOG_DATA_UPDATE_START = @"
|
||||
INSERT INTO dbo.DataUpdate(SourceSystem, SourceData, TableName, StartDT, EndDT, UpdateType, WasSuccessful, NumberRecords)
|
||||
OUTPUT INSERTED.*
|
||||
VALUES(@sourceSystem, @sourceData, @tableName, GETDATE(), '1970-01-01', @updateType, 0, -2);";
|
||||
|
||||
/// <summary>
|
||||
/// Logs the data update entry at the start of the update
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="dataUpdate">Data update entry to log</param>
|
||||
public static void LogDataUpdateStart(SqlConnection connection, DataUpdate dataUpdate)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Update the record
|
||||
DataUpdate inserted = connection.QueryFirst<DataUpdate>(SQL_LOG_DATA_UPDATE_START,
|
||||
new
|
||||
{
|
||||
sourceSystem = dataUpdate.SourceSystem,
|
||||
sourceData = dataUpdate.SourceData,
|
||||
tableName = dataUpdate.TableName,
|
||||
updateType = dataUpdate.UpdateType
|
||||
});
|
||||
|
||||
//Copy output values to model
|
||||
dataUpdate.ID = inserted.ID;
|
||||
dataUpdate.StartDT = inserted.StartDT;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("LogDataUpdateStart: failed to log starting data update entry: {0}.", error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL to update data update record with results
|
||||
/// </summary>
|
||||
private const string SQL_LOG_DATA_UPDATE_END = @"
|
||||
UPDATE dbo.DataUpdate
|
||||
SET EndDT = GETDATE(), WasSuccessful = @wasSuccessful, NumberRecords = @numberRecords
|
||||
OUTPUT INSERTED.*
|
||||
WHERE ID = @id";
|
||||
|
||||
/// <summary>
|
||||
/// Logs the data update entry at the end of the update
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="dataUpdate">Data update entry to log</param>
|
||||
public static void LogDataUpdateEnd(SqlConnection connection, DataUpdate dataUpdate)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Update the record
|
||||
DataUpdate updated = connection.QueryFirst<DataUpdate>(SQL_LOG_DATA_UPDATE_END,
|
||||
new
|
||||
{
|
||||
id = dataUpdate.ID,
|
||||
wasSuccessful = dataUpdate.WasSuccessful,
|
||||
numberRecords = dataUpdate.NumberRecords
|
||||
});
|
||||
|
||||
//Copy output values to model
|
||||
dataUpdate.EndDT = updated.EndDT;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("LogDataUpdateEnd: failed to log ending data update entry: {0}.", error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets set of last successful data updates for all tables
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <returns>Set of last successful data updates for all tables</returns>
|
||||
private static List<LastDataUpdate> GetLastDataUpdates(SqlConnection connection)
|
||||
{
|
||||
return connection.Query<LastDataUpdate>("SELECT * FROM dbo.LastDataUpdates").ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,350 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Dapper;
|
||||
using WorkerService.Models;
|
||||
|
||||
namespace WorkerService.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Table management functionality for data update processor
|
||||
/// </summary>
|
||||
public partial class UpdateProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates staging table with matching column layout of given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to create staging table for</param>
|
||||
/// <returns>Name of created temporary table</returns>
|
||||
public static string CreateStagingTable(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get table specification
|
||||
TableSpec tableSpec = GetTableSpec(connection, tableName);
|
||||
|
||||
//Drop temp table if it already exists
|
||||
connection.Execute($"IF OBJECT_ID('tempdb..{tableSpec.StagingTableName}') IS NOT NULL DROP TABLE {tableSpec.StagingTableName};");
|
||||
|
||||
//Create temp table
|
||||
connection.Execute($"CREATE TABLE {tableSpec.StagingTableName}({string.Join(",", tableSpec.Columns.Select(c => $"{c.Name} {c.Definition}"))});");
|
||||
|
||||
//Create indicies on temp table
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append($"CREATE INDEX IDX_STAGING_{tableSpec.Name} ON {tableSpec.StagingTableName}(");
|
||||
builder.Append(string.Join(",", tableSpec.PrimaryKey.Select(c => $"{c.Name}")));
|
||||
if (tableSpec.Columns.Any(c => c.Name.Equals("LastUpdateDT", StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
builder.Append(", LastUpdateDT DESC");
|
||||
}
|
||||
else if (tableSpec.Columns.Any(c => c.Name.Equals("ReleaseDate", StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
builder.Append(", ReleaseDate DESC");
|
||||
}
|
||||
builder.Append(");");
|
||||
|
||||
connection.Execute(builder.ToString());
|
||||
|
||||
//Disable indicies on temp table
|
||||
DisableIndicies(connection, tableSpec.StagingTableName);
|
||||
|
||||
return tableSpec.StagingTableName;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward error
|
||||
logger.Error("GetStagingTable: failed to create staging table for '{0}': {1}.", tableName, error.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates temporary table with matching column layout of given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to create temporary table for</param>
|
||||
/// <returns>Name of created temporary table</returns>
|
||||
public static string CreateTempTable(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get table specification
|
||||
TableSpec tableSpec = GetTableSpec(connection, tableName);
|
||||
|
||||
//Drop temp table if it already exists
|
||||
connection.Execute($"IF OBJECT_ID('tempdb..{tableSpec.TempTableName}') IS NOT NULL DROP TABLE {tableSpec.TempTableName};");
|
||||
|
||||
//Create temp table
|
||||
connection.Execute($"CREATE TABLE {tableSpec.TempTableName}({string.Join(",", tableSpec.Columns.Select(c => $"{c.Name} {c.Definition}"))}, CONSTRAINT PK_{tableSpec.TempTableName} PRIMARY KEY CLUSTERED({string.Join(",", tableSpec.PrimaryKey.Select(c => $"{c.Name}"))}));");
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("WITH StagingCTE AS (");
|
||||
builder.Append($"SELECT st.*, ROW_NUMBER() OVER(PARTITION BY {string.Join(", ", tableSpec.PrimaryKey.Select(c=>c.Name))} ORDER BY {tableSpec.Columns.FirstOrDefault(c => c.Name.Equals("LastUpdateDT", StringComparison.CurrentCultureIgnoreCase) || c.Name.Equals("ReleaseDate", StringComparison.CurrentCultureIgnoreCase))?.Name}) RN FROM {tableSpec.StagingTableName} st");
|
||||
builder.AppendLine(")");
|
||||
builder.AppendLine($"INSERT INTO {tableSpec.TempTableName}({string.Join(", ", tableSpec.Columns.Select(c=>c.Name))})");
|
||||
builder.AppendLine($"SELECT {string.Join(", ", tableSpec.Columns.Select(c => c.Name))} FROM StagingCTE WHERE RN = 1 ORDER BY {string.Join(", ", tableSpec.PrimaryKey.Select(c=>c.Name))};");
|
||||
|
||||
connection.Execute(builder.ToString(),commandTimeout:600);
|
||||
|
||||
return tableSpec.TempTableName;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward error
|
||||
logger.Error("CreateTableTable: failed to create temporary table for '{0}': {1}.", tableName, error.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates merge statement for given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to generate merge statement for</param>
|
||||
/// <returns>Merge statement for given table</returns>
|
||||
private static string GenerateMerge(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get table specification
|
||||
TableSpec tableSpec = GetTableSpec(connection, tableName);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendFormat("MERGE {0} AS TARGET", tableSpec.Name);
|
||||
builder.AppendLine("");
|
||||
|
||||
builder.AppendFormat("USING {0} AS SOURCE ON({1})", tableSpec.TempTableName, string.Join(" AND ", tableSpec.PrimaryKey.Select(c => $"TARGET.{c.Name} = SOURCE.{c.Name}")));
|
||||
builder.AppendLine("");
|
||||
|
||||
builder.Append("WHEN MATCHED");
|
||||
if (tableSpec.Columns.Exists(c => c.Name.Equals("LastUpdateDT", StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
builder.Append(" AND TARGET.LastUpdateDT < SOURCE.LastUpdateDT");
|
||||
}
|
||||
builder.AppendLine(" THEN");
|
||||
|
||||
builder.Append("UPDATE SET ");
|
||||
builder.Append(string.Join(", ", tableSpec.Columns.Where(c => !tableSpec.PrimaryKey.Contains(c)).Select(c => $"TARGET.{c.Name} = SOURCE.{c.Name}")));
|
||||
builder.AppendLine();
|
||||
|
||||
builder.AppendLine("WHEN NOT MATCHED BY TARGET THEN");
|
||||
|
||||
builder.Append("INSERT(");
|
||||
builder.Append(string.Join(", ", tableSpec.Columns.Select(c => c.Name)));
|
||||
builder.AppendLine(")");
|
||||
|
||||
builder.Append("VALUES(");
|
||||
builder.Append(string.Join(", ", tableSpec.Columns.Select(c => $"SOURCE.{c.Name}")));
|
||||
builder.AppendLine(");");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward error
|
||||
logger.Error("GenerateMerge: failed to generate merge statement for '{0}': {1}.", tableName, error.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates bulk copy specification for given table
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Data type being bulk copied</typeparam>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to generate bulk copy for</param>
|
||||
/// <returns>Bulk copy for given table</returns>
|
||||
private static SqlBulkCopy GenerateBulkCopy<T>(SqlConnection connection, string tableName)
|
||||
{
|
||||
return GenerateBulkCopy(connection, tableName, typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates bulk copy specification for given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to generate bulk copy for</param>
|
||||
/// <param name="type">Data type being bulk copied</param>
|
||||
/// <returns>Bulk copy for given table</returns>
|
||||
private static SqlBulkCopy GenerateBulkCopy(SqlConnection connection, string tableName, Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get table specification
|
||||
TableSpec tableSpec = GetTableSpec(connection, tableName);
|
||||
|
||||
//Get class properties
|
||||
List<string> properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(p => p.Name).ToList();
|
||||
|
||||
//Build bulk copy specification
|
||||
SqlBulkCopy bulkCopy = new SqlBulkCopy(connection)
|
||||
{
|
||||
BatchSize = 10000,
|
||||
NotifyAfter = 5000,
|
||||
EnableStreaming = true,
|
||||
DestinationTableName = tableSpec.StagingTableName
|
||||
};
|
||||
|
||||
foreach (ColumnSpec columnSpec in tableSpec.Columns)
|
||||
{
|
||||
string property = properties.FirstOrDefault(p => p.Equals(columnSpec.Name, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (!string.IsNullOrEmpty(property))
|
||||
{
|
||||
bulkCopy.ColumnMappings.Add(property, columnSpec.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return bulkCopy;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward error
|
||||
logger.Error("GenerateBulkCopy: failed to generate bulk copy for '{0}': {1}.", tableName, error.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL to get the columns for the given table
|
||||
/// </summary>
|
||||
private const string SQL_GET_TABLE_COLUMNS = @"
|
||||
SELECT c.name AS Name,
|
||||
CASE t2.name
|
||||
WHEN 'char' THEN 'CHAR(' + CAST(c.max_length AS VARCHAR(10)) + ')'
|
||||
WHEN 'varchar' THEN 'VARCHAR(' + CASE c.max_length WHEN -1 THEN 'MAX' ELSE CAST(c.max_length AS VARCHAR(10)) END + ')'
|
||||
WHEN 'decimal' THEN 'DECIMAL(' + CAST(c.precision AS VARCHAR(4)) + ',' + CAST(c.scale AS VARCHAR(4)) + ')'
|
||||
ELSE UPPER(t2.name)
|
||||
END AS Definition
|
||||
FROM sys.columns c INNER JOIN
|
||||
sys.types AS t2 ON (c.system_type_id = t2.system_type_id) INNER JOIN
|
||||
sys.tables t ON (c.object_id = t.object_id)
|
||||
WHERE t.name = @tableName
|
||||
ORDER BY c.column_id";
|
||||
|
||||
/// <summary>
|
||||
/// SQL to get the primary key columns for the given table
|
||||
/// </summary>
|
||||
private const string SQL_GET_TABLE_PRIMARY_KEY = @"
|
||||
SELECT COLUMN_NAME AS Name
|
||||
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||
WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + QUOTENAME(CONSTRAINT_NAME)), 'IsPrimaryKey') = 1 AND
|
||||
TABLE_NAME = @tableName
|
||||
ORDER BY ORDINAL_POSITION";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the table specification for the given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to get specification for</param>
|
||||
/// <returns>Table specification for the given table</returns>
|
||||
public static TableSpec GetTableSpec(SqlConnection connection, string tableName)
|
||||
{
|
||||
TableSpec tableSpec = new TableSpec() { Name = tableName };
|
||||
|
||||
//Load columns
|
||||
tableSpec.Columns.AddRange(connection.Query<ColumnSpec>(SQL_GET_TABLE_COLUMNS, new { tableName }));
|
||||
|
||||
//Load primary key
|
||||
tableSpec.PrimaryKey.AddRange(connection.Query<string>(SQL_GET_TABLE_PRIMARY_KEY, new { tableName }).Select(cn => tableSpec.Columns.First(c => c.Name.Equals(cn, StringComparison.CurrentCultureIgnoreCase))));
|
||||
|
||||
return tableSpec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Truncates given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to truncate</param>
|
||||
private static void TruncateTable(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.Debug("TruncateTable: truncating table '{0}'", tableName);
|
||||
|
||||
//Generate and execute SQL to truncate table
|
||||
string sql = $"TRUNCATE TABLE {tableName};";
|
||||
connection.Execute(sql);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("TruncateTable: failed to truncate table '{0}': {1}.", tableName, error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL to get indices on given table
|
||||
/// </summary>
|
||||
private const string SQL_GET_INDICES = @"
|
||||
SELECT DISTINCT
|
||||
ind.name AS Name,
|
||||
ind.is_primary_key AS IsPrimaryKey,
|
||||
ind.is_unique AS IsUnique,
|
||||
ind.is_unique_constraint AS IsUniqueConstraint
|
||||
FROM sys.indexes ind INNER JOIN
|
||||
sys.index_columns ic ON (ind.object_id = ic.object_id AND ind.index_id = ic.index_id) INNER JOIN
|
||||
sys.columns col ON (ic.object_id = col.object_id AND ic.column_id = col.column_id) INNER JOIN
|
||||
sys.tables t ON (ind.object_id = t.object_id)
|
||||
WHERE t.name = @tableName";
|
||||
|
||||
/// <summary>
|
||||
/// Disables all non-PK indices on given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>
|
||||
/// <param name="tableName">Name of table to disable non-PK indices for</param>
|
||||
private static void DisableIndicies(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get all indices on table
|
||||
List<Index> indices = connection.Query<Index>(SQL_GET_INDICES, new { tableName }).ToList();
|
||||
|
||||
//Loop through all non-PK/non-cluster indices
|
||||
foreach (Index index in indices.Where(i => !i.IsPrimaryKey && !i.IsUnique && !i.IsUniqueConstraint))
|
||||
{
|
||||
//Generate and execute SQL to disable index
|
||||
string sql = $"ALTER INDEX {index.Name} ON {tableName} DISABLE;";
|
||||
connection.Execute(sql);
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("DisableIndicies: failed to disable non-PK indicies on table '{0}': {1}.", tableName, error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rebuilds all indices on given table
|
||||
/// </summary>
|
||||
/// <param name="connection">SQL connection to execute commands on</param>So
|
||||
/// <param name="tableName">Name of table to rebuild indices for</param>
|
||||
private static void RebuildIndicies(SqlConnection connection, string tableName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Get all indices on table
|
||||
List<Index> indices = connection.Query<Index>(SQL_GET_INDICES, new { tableName }).ToList();
|
||||
|
||||
//Loop through indices
|
||||
foreach (Index index in indices.Where(i => !i.IsPrimaryKey && !i.IsUnique && !i.IsUniqueConstraint))
|
||||
{
|
||||
//Generate and execute SQL to rebuild index
|
||||
string sql = $"ALTER INDEX {index.Name} ON {tableName} REBUILD;";
|
||||
connection.Execute(sql);
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("RebuildIndicies: failed to rebuild indicies on table '{0}': {1}.", tableName, error.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using DataModel.Process;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using WorkerService.Models;
|
||||
|
||||
namespace WorkerService.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Data update processor
|
||||
/// </summary>
|
||||
public partial class UpdateProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Shared logger instance
|
||||
/// </summary>
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Collection of configured data source update configurations
|
||||
/// </summary>
|
||||
public static readonly List<DataSourceConfig> configs = new List<DataSourceConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Static class initializer
|
||||
/// </summary>
|
||||
static UpdateProcessor()
|
||||
{
|
||||
foreach (string configFileName in Directory.GetFiles("dsconfig"))
|
||||
{
|
||||
//continue;
|
||||
DataSourceConfig config = JsonConvert.DeserializeObject<DataSourceConfig>(File.ReadAllText(configFileName));
|
||||
|
||||
if (config.IsEnabled) { configs.Add(config); }
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoUpdate(string tableName, UpdateTypes updateType = UpdateTypes.Mass)
|
||||
{
|
||||
DataSourceConfig dataSourceConfig = configs.FirstOrDefault(c => c.TableName.Equals(tableName, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
//Get last data updates
|
||||
List<LastDataUpdate> lastDataUpdates = null;
|
||||
using (SqlConnection connection = LotFinderDB.GetConnection())
|
||||
{
|
||||
lastDataUpdates = GetLastDataUpdates(connection);
|
||||
}
|
||||
|
||||
LastDataUpdate lastDataUpdate = lastDataUpdates.FirstOrDefault(ldu => ldu.TableName.Equals(dataSourceConfig.TableName));
|
||||
DateTime? minDT = null;
|
||||
switch (updateType)
|
||||
{
|
||||
case UpdateTypes.Mass:
|
||||
minDT = null;
|
||||
break;
|
||||
case UpdateTypes.Daily:
|
||||
minDT = lastDataUpdate.DailyUpdateDT.AddMinutes(-3 * dataSourceConfig.DailyUpdateConfig.Interval);
|
||||
break;
|
||||
case UpdateTypes.Hourly:
|
||||
minDT = lastDataUpdate.HourlyUpdateDT.AddMinutes(-3 * dataSourceConfig.HourlyUpdateConfig.Interval);
|
||||
break;
|
||||
}
|
||||
|
||||
DoUpdate(dataSourceConfig, updateType, minDT);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets list of pending data update tasks
|
||||
/// </summary>
|
||||
/// <returns>Pending data update tasks</returns>
|
||||
public static List<DataUpdateTask> GetPendingUpdateTasks()
|
||||
{
|
||||
List<DataUpdateTask> pending = new List<DataUpdateTask>();
|
||||
|
||||
using (SqlConnection connection = LotFinderDB.GetConnection())
|
||||
{
|
||||
//Get last data updates
|
||||
List<LastDataUpdate> lastDataUpdates = GetLastDataUpdates(connection);
|
||||
|
||||
foreach (DataSourceConfig dataSourceConfig in configs)
|
||||
{
|
||||
LastDataUpdate lastDataUpdate = lastDataUpdates.FirstOrDefault(ldu => ldu.TableName.Equals(dataSourceConfig.TableName));
|
||||
|
||||
if (lastDataUpdate == null || (dataSourceConfig.MassUpdateConfig.Enabled && DateTime.Now > lastDataUpdate.MassUpdateDT.AddMinutes(dataSourceConfig.MassUpdateConfig.Interval)))
|
||||
{
|
||||
pending.Add(new DataUpdateTask() { Configuration = dataSourceConfig, UpdateType = UpdateTypes.Mass });
|
||||
}
|
||||
else if (dataSourceConfig.DailyUpdateConfig.Enabled && DateTime.Now > lastDataUpdate.DailyUpdateDT.AddMinutes(dataSourceConfig.DailyUpdateConfig.Interval))
|
||||
{
|
||||
pending.Add(new DataUpdateTask() { Configuration = dataSourceConfig, UpdateType = UpdateTypes.Daily, MinimumDT = lastDataUpdate.DailyUpdateDT.AddMinutes(-3 * dataSourceConfig.DailyUpdateConfig.Interval) });
|
||||
}
|
||||
else if (dataSourceConfig.HourlyUpdateConfig.Enabled && DateTime.Now > lastDataUpdate.HourlyUpdateDT.AddMinutes(dataSourceConfig.HourlyUpdateConfig.Interval))
|
||||
{
|
||||
pending.Add(new DataUpdateTask() { Configuration = dataSourceConfig, UpdateType = UpdateTypes.Hourly, MinimumDT = lastDataUpdate.DailyUpdateDT.AddMinutes(-3 * dataSourceConfig.DailyUpdateConfig.Interval) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the data update
|
||||
/// </summary>
|
||||
/// <param name="dataUpdateTask">Data update task to execute</param>
|
||||
/// <returns>Data update results</returns>
|
||||
public static DataUpdate DoUpdate(DataUpdateTask dataUpdateTask)
|
||||
{
|
||||
logger.Info($"Starting [{dataUpdateTask.UpdateType}] data update for {dataUpdateTask.Configuration.TableName}...");
|
||||
return DoUpdate(dataUpdateTask.Configuration, dataUpdateTask.UpdateType, dataUpdateTask.MinimumDT);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs the data update
|
||||
/// </summary>
|
||||
/// <param name="config">Data source configuration</param>
|
||||
/// <param name="updateType">Type of update to perform</param>
|
||||
/// <param name="minDT">Minimum timestamp to update data from</param>
|
||||
/// <returns>Data update results</returns>
|
||||
public static DataUpdate DoUpdate(DataSourceConfig config, UpdateTypes updateType, DateTime? minDT)
|
||||
{
|
||||
//Log start of data update
|
||||
DataUpdate dataUpdate = new DataUpdate()
|
||||
{
|
||||
SourceSystem = config.SourceSystem,
|
||||
SourceData = config.SourceData,
|
||||
TableName = config.TableName,
|
||||
UpdateType = updateType,
|
||||
StartDT = DateTime.Now,
|
||||
NumberRecords = 0
|
||||
};
|
||||
|
||||
//Get data update configuration details
|
||||
DataUpdateConfig updateConfig;
|
||||
switch (updateType)
|
||||
{
|
||||
case UpdateTypes.Hourly:
|
||||
updateConfig = config.HourlyUpdateConfig;
|
||||
break;
|
||||
case UpdateTypes.Daily:
|
||||
updateConfig = config.DailyUpdateConfig;
|
||||
break;
|
||||
case UpdateTypes.Mass:
|
||||
updateConfig = config.MassUpdateConfig;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(updateType), updateType, null);
|
||||
}
|
||||
|
||||
using (SqlConnection connection = LotFinderDB.GetConnection())
|
||||
{
|
||||
LogDataUpdateStart(connection, dataUpdate);
|
||||
|
||||
//Clear destination table if needed
|
||||
if (updateConfig.PrepurgeData)
|
||||
{
|
||||
TruncateTable(connection, config.TableName);
|
||||
}
|
||||
|
||||
Type sourceType = config.DataFetchFunction.Method.ReturnType.GenericTypeArguments[0];
|
||||
|
||||
//Fetch data
|
||||
IEnumerable<dynamic> data = config.DataFetchFunction(minDT);
|
||||
|
||||
//Generate SQL to merge temp data to destination table
|
||||
string mergeSQL = GenerateMerge(connection, config.TableName);
|
||||
|
||||
foreach (var batch in data.BatchGroup(1000000))
|
||||
{
|
||||
//Setup temp table
|
||||
string stagingTableName = CreateStagingTable(connection, config.TableName);
|
||||
|
||||
//Copy data to temp table
|
||||
SqlBulkCopy bulkCopy = GenerateBulkCopy(connection, config.TableName, sourceType);
|
||||
IDataReader reader = new GenericListDataReader(batch, sourceType);
|
||||
bulkCopy.WriteToServer(reader);
|
||||
dataUpdate.NumberRecords += batch.Count;
|
||||
|
||||
//Index temp table
|
||||
RebuildIndicies(connection, stagingTableName);
|
||||
|
||||
//Copy to temp table
|
||||
string tempTableName = CreateTempTable(connection, config.TableName);
|
||||
|
||||
//Merge data from temp table to destination table
|
||||
connection.Execute(mergeSQL, commandTimeout: 6000);
|
||||
|
||||
logger.Debug("DoUpdate: {0:n0} rows merged to {1}", dataUpdate.NumberRecords, config.TableName);
|
||||
}
|
||||
|
||||
//Run post processing action if configured
|
||||
if (config.PostProcessingAction != null)
|
||||
{
|
||||
config.PostProcessingAction();
|
||||
}
|
||||
|
||||
//Re-index destination table if needed
|
||||
if (updateConfig.ReIndexData)
|
||||
{
|
||||
RebuildIndicies(connection, dataUpdate.TableName);
|
||||
}
|
||||
|
||||
//Update data update entry
|
||||
dataUpdate.WasSuccessful = true;
|
||||
LogDataUpdateEnd(connection, dataUpdate);
|
||||
}
|
||||
|
||||
return dataUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SQLite;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Commons.Helpers;
|
||||
using Commons.Models;
|
||||
using Commons.Process;
|
||||
using Dapper;
|
||||
|
||||
namespace WorkerService.Process
|
||||
{
|
||||
public partial class Updater
|
||||
{
|
||||
private const string SQL_GET_MIS_DATA = @"
|
||||
select
|
||||
ItemNumber, BranchCode, SequenceNumber, MisNumber, RevID,
|
||||
CharNumber, TestGroup, TestDefinition, TestDescription, SamplingType, SamplingValue, ToolsGauges, WorkInstructions,
|
||||
Status, ReleaseDate, ObsoleteDate
|
||||
FROM infodb.MisInfo info INNER JOIN
|
||||
relationdb.MisRelation rel ON (info.RevFK = rel.RevFK) INNER JOIN
|
||||
detaildb.MisDetail det ON (rel.MisFK = det.MisFK) INNER JOIN
|
||||
partdb.MisPart part ON (det.PartFK = part.PartFK)
|
||||
ORDER BY ItemNumber, BranchCode, SequenceNumber, MisNumber, RevID, Status, CharNumber";
|
||||
|
||||
public static IEnumerable<MisData> GetMisData()
|
||||
{
|
||||
Task misInfoTask = Task.Run(() => PrepareMisInfo());
|
||||
Task misRelationTask = Task.Run(() => PrepareMisRelation());
|
||||
Task misDetailTask = Task.Run(() => PrepareMisDetail());
|
||||
Task misPartTask = Task.Run(() => PrepareMisPart());
|
||||
|
||||
Task.WaitAll(misInfoTask, misRelationTask, misDetailTask, misPartTask);
|
||||
|
||||
if (File.Exists("misdata.db"))
|
||||
{
|
||||
File.Delete("misdata.db");
|
||||
}
|
||||
SQLiteConnection.CreateFile("misdata.db");
|
||||
using (SQLiteConnection sqlite = new SQLiteConnection(@"Data Source=misdata.db;Version=3;Journal Mode=Off;"))
|
||||
{
|
||||
sqlite.Open();
|
||||
|
||||
//Attach databases
|
||||
sqlite.Execute("ATTACH DATABASE 'misinfo.db' AS infodb;");
|
||||
sqlite.Execute("ATTACH DATABASE 'misrelation.db' AS relationdb;");
|
||||
sqlite.Execute("ATTACH DATABASE 'misdetail.db' AS detaildb;");
|
||||
sqlite.Execute("ATTACH DATABASE 'mispart.db' AS partdb;");
|
||||
|
||||
foreach (MisData misData in sqlite.Query<MisData>(SQL_GET_MIS_DATA, buffered: false))
|
||||
{
|
||||
yield return misData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrepareMisInfo()
|
||||
{
|
||||
return;
|
||||
if (File.Exists("misinfo.db"))
|
||||
{
|
||||
File.Delete("misinfo.db");
|
||||
}
|
||||
SQLiteConnection.CreateFile("misinfo.db");
|
||||
|
||||
//Fetch MIS info
|
||||
List<MisInfo> misInfos = CMS.GetMisInfos().ToList();
|
||||
|
||||
//Lookup obsolete date by backlevel release
|
||||
foreach (var group in misInfos.GroupBy(m => new { m.MisNumber, m.RevID }))
|
||||
{
|
||||
DateTime? obsoleteDate = group.Where(g => g.Status.Equals("BackLevel") && g.ReleaseDate != null).Select(g => g.ReleaseDate).FirstOrDefault();
|
||||
|
||||
foreach (MisInfo current in group.Where(g => g.Status.Equals("Current")))
|
||||
{
|
||||
current.ObsoleteDate = obsoleteDate;
|
||||
}
|
||||
}
|
||||
|
||||
//Lookup obsolete date by next revision release
|
||||
var lookup = misInfos.Where(m => m.ReleaseDate != null).GroupBy(m => new { m.MisNumber, m.RevID, m.Status }).Select(g => new { g.Key.MisNumber, g.Key.RevID, g.Key.Status, ReleaseDate = g.Min(m => m.ReleaseDate) }).ToDictionary(g => new { g.MisNumber, g.RevID, g.Status }, g => g.ReleaseDate);
|
||||
foreach (MisInfo misInfo in misInfos.Where(m => !m.ObsoleteDate.HasValue))
|
||||
{
|
||||
DateTime? obsoleteDate;
|
||||
if (lookup.TryGetValue(new { misInfo.MisNumber, misInfo.RevID, misInfo.Status }, out obsoleteDate))
|
||||
{
|
||||
misInfo.ObsoleteDate = obsoleteDate;
|
||||
}
|
||||
}
|
||||
|
||||
//Write MIS info to database
|
||||
using (SQLiteConnection sqlite = new SQLiteConnection(@"Data Source=misinfo.db;Version=3;Journal Mode=Off;"))
|
||||
{
|
||||
sqlite.Open();
|
||||
|
||||
//Create table for MIS info
|
||||
sqlite.Execute("CREATE TABLE MisInfo(RevFK TEXT, MisNumber TEXT, RevID Text, Status TEXT, ReleaseDate DATETIME, ObsoleteDate DATETIME);");
|
||||
|
||||
foreach (var batch in misInfos.BatchGroup(10000))
|
||||
{
|
||||
using (SQLiteTransaction transaction = sqlite.BeginTransaction())
|
||||
{
|
||||
foreach (MisInfo misInfo in batch)
|
||||
{
|
||||
sqlite.Execute("INSERT INTO MisInfo(RevFK, MisNumber, RevID, Status, ReleaseDate, ObsoleteDate) VALUES(@RevFK, @MisNumber, @RevID, @Status, @ReleaseDate, @ObsoleteDate)", misInfo);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
//Add index on FK field
|
||||
sqlite.Execute("CREATE INDEX IDX_MisInfo_RevFK ON MisInfo(RevFK);");
|
||||
|
||||
sqlite.Execute("VACUUM");
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrepareMisRelation()
|
||||
{
|
||||
return;
|
||||
if (File.Exists("misrelation.db"))
|
||||
{
|
||||
File.Delete("misrelation.db");
|
||||
}
|
||||
SQLiteConnection.CreateFile("misrelation.db");
|
||||
|
||||
IEnumerable<MisRelation> misRelations = CMS.GetMisRelations();
|
||||
|
||||
//Write MIS relation to database
|
||||
using (SQLiteConnection sqlite = new SQLiteConnection(@"Data Source=misrelation.db;Version=3;Journal Mode=Off;"))
|
||||
{
|
||||
sqlite.Open();
|
||||
|
||||
//Create table for MIS relation
|
||||
sqlite.Execute("CREATE TABLE MisRelation(RevFK TEXT, MisFK TEXT);");
|
||||
|
||||
foreach (var batch in misRelations.BatchGroup(10000))
|
||||
{
|
||||
using (SQLiteTransaction transaction = sqlite.BeginTransaction())
|
||||
{
|
||||
foreach (MisRelation misRelation in batch)
|
||||
{
|
||||
sqlite.Execute("INSERT INTO MisRelation(RevFK, MisFK) VALUES(@RevFK, @MisFK)", misRelation);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
//Add indices on FK fields
|
||||
sqlite.Execute("CREATE INDEX IDX_MisRelation_RevFK ON MisRelation(RevFK);");
|
||||
sqlite.Execute("CREATE INDEX IDX_MisRelation_MisFK ON MisRelation(MisFK);");
|
||||
|
||||
sqlite.Execute("VACUUM");
|
||||
}
|
||||
}
|
||||
|
||||
public static void PrepareMisDetail()
|
||||
{
|
||||
return;
|
||||
if (File.Exists("misdetail.db"))
|
||||
{
|
||||
File.Delete("misdetail.db");
|
||||
}
|
||||
SQLiteConnection.CreateFile("misdetail.db");
|
||||
|
||||
IEnumerable<MisDetail> misDetails = CMS.GetMisDetails();
|
||||
|
||||
//Write MIS relation to database
|
||||
using (SQLiteConnection sqlite = new SQLiteConnection(@"Data Source=misdetail.db;Version=3;Journal Mode=Off;"))
|
||||
{
|
||||
sqlite.Open();
|
||||
|
||||
//Create table for MIS detail
|
||||
sqlite.Execute("CREATE TABLE MisDetail(MisFK TEXT, PartFK TEXT, CharNumber TEXT, TestGroup TEXT, TestDefinition TEXT, TestDescription TEXT, SamplingType TEXT, SamplingValue TEXT, ToolsGauges TEXT, WorkInstructions TEXT);");
|
||||
|
||||
foreach (var batch in misDetails.BatchGroup(250000))
|
||||
{
|
||||
using (SQLiteTransaction transaction = sqlite.BeginTransaction())
|
||||
{
|
||||
foreach (MisDetail misDetail in batch)
|
||||
{
|
||||
sqlite.Execute("INSERT INTO MisDetail(MisFK, PartFK, CharNumber, TestGroup, TestDefinition, TestDescription, SamplingType, SamplingValue, ToolsGauges, WorkInstructions) VALUES(@MisFK, @PartFK, @CharNumber, @TestGroup, @TestDefinition, @TestDescription, @SamplingType, @SamplingValue, @ToolsGauges, @WorkInstructions)", misDetail);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
//Add indices on FK fields
|
||||
sqlite.Execute("CREATE INDEX IDX_MisDetail_MisFK ON MisDetail(MisFK);");
|
||||
sqlite.Execute("CREATE INDEX IDX_MisDetail_PartFK ON MisDetail(PartFK);");
|
||||
|
||||
sqlite.Execute("VACUUM");
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrepareMisPart()
|
||||
{
|
||||
return;
|
||||
if (File.Exists("mispart.db"))
|
||||
{
|
||||
File.Delete("mispart.db");
|
||||
}
|
||||
SQLiteConnection.CreateFile("mispart.db");
|
||||
|
||||
IEnumerable<MisPart> misParts = CMS.GetMisParts();
|
||||
|
||||
//Write MIS relation to database
|
||||
using (SQLiteConnection sqlite = new SQLiteConnection(@"Data Source=mispart.db;Version=3;Journal Mode=Off;"))
|
||||
{
|
||||
sqlite.Open();
|
||||
|
||||
//Create table for MIS detail
|
||||
sqlite.Execute("CREATE TABLE MisPart(PartFK TEXT, ItemNumber TEXT, BranchCode TEXT, SequenceNumber TEXT);");
|
||||
|
||||
foreach (var batch in misParts.BatchGroup(100000))
|
||||
{
|
||||
using (SQLiteTransaction transaction = sqlite.BeginTransaction())
|
||||
{
|
||||
foreach (MisPart misPart in batch)
|
||||
{
|
||||
sqlite.Execute("INSERT INTO MisPart(PartFK, ItemNumber, BranchCode, SequenceNumber) VALUES(@PartFK, @ItemNumber, @BranchCode, @SequenceNumber);", misPart);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
//Add indices on FK fields
|
||||
sqlite.Execute("CREATE INDEX IDX_MisPart_PartFK ON MisPart(PartFK);");
|
||||
|
||||
sqlite.Execute("VACUUM");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DataModel.Models;
|
||||
using Microsoft.AspNet.SignalR.Client;
|
||||
using NLog;
|
||||
@@ -146,54 +143,44 @@ namespace WorkerService.Process
|
||||
{
|
||||
try
|
||||
{
|
||||
//Verify all data sources up to date
|
||||
List<DataUpdateTask> pending = UpdateProcessor.GetPendingUpdateTasks();
|
||||
if (pending.Any())
|
||||
{
|
||||
Status = "Updating data cache";
|
||||
Parallel.ForEach(pending, new ParallelOptions() { MaxDegreeOfParallelism = 8 }, pendingTask => { UpdateProcessor.DoUpdate(pendingTask); });
|
||||
}
|
||||
else
|
||||
{
|
||||
//Reset any partially completed searches
|
||||
LotFinderDBExt.ResetPartialSearches();
|
||||
//Reset any partially completed searches
|
||||
LotFinderDBExt.ResetPartialSearches();
|
||||
|
||||
//Check for queued searches
|
||||
Search search = LotFinderDBExt.GetNextSearch();
|
||||
if (search != null)
|
||||
//Check for queued searches
|
||||
Search search = LotFinderDBExt.GetNextSearch();
|
||||
if (search != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Status = $"Processing search #{search.ID}";
|
||||
Status = $"Processing search #{search.ID}";
|
||||
|
||||
//Start search
|
||||
LotFinderDBExt.StartSearch(search);
|
||||
PublishSearchUpdate(search);
|
||||
//Start search
|
||||
LotFinderDBExt.StartSearch(search);
|
||||
PublishSearchUpdate(search);
|
||||
|
||||
//Do search
|
||||
SearchModel searchModel = search.ToSearchModel();
|
||||
LotFinderDBExt.Search(searchModel);
|
||||
//Do search
|
||||
SearchModel searchModel = search.ToSearchModel();
|
||||
LotFinderDBExt.Search(searchModel);
|
||||
|
||||
//Record end timestamp
|
||||
search.EndDT = DateTime.Now;
|
||||
//Record end timestamp
|
||||
search.EndDT = DateTime.Now;
|
||||
|
||||
//Generate output
|
||||
search.Results = ExcelWriter.Generate(searchModel);
|
||||
//Generate output
|
||||
search.Results = ExcelWriter.Generate(searchModel);
|
||||
|
||||
File.WriteAllBytes($"search_{search.ID}.xlsx", search.Results);
|
||||
File.WriteAllBytes($"search_{search.ID}.xlsx", search.Results);
|
||||
|
||||
//Complete search
|
||||
LotFinderDBExt.CompleteSearch(search, true);
|
||||
PublishSearchUpdate(search);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log error and mark search as failed
|
||||
logger.Error("DoWork: failed to process search: {0}.", error.Message);
|
||||
search.EndDT = DateTime.Now;
|
||||
LotFinderDBExt.CompleteSearch(search, false);
|
||||
PublishSearchUpdate(search);
|
||||
}
|
||||
//Complete search
|
||||
LotFinderDBExt.CompleteSearch(search, true);
|
||||
PublishSearchUpdate(search);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log error and mark search as failed
|
||||
logger.Error("DoWork: failed to process search: {0}.", error.Message);
|
||||
search.EndDT = DateTime.Now;
|
||||
LotFinderDBExt.CompleteSearch(search, false);
|
||||
PublishSearchUpdate(search);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Dapper;
|
||||
using DataModel;
|
||||
using Topshelf;
|
||||
using WorkerService.Helpers;
|
||||
using WorkerService.Models;
|
||||
using WorkerService.Models.Reporting;
|
||||
using WorkerService.Process;
|
||||
|
||||
namespace WorkerService
|
||||
@@ -32,20 +27,6 @@ namespace WorkerService
|
||||
SqlMapper.Settings.CommandTimeout = 1200 * 50;
|
||||
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
||||
|
||||
DataSourceConfig dsConfig = UpdateProcessor.configs.FirstOrDefault(c => c.TableName.Contains("User"));
|
||||
UpdateProcessor.DoUpdate(dsConfig.TableName);
|
||||
|
||||
return;
|
||||
|
||||
if (args.Length > 0 && args[0].Equals("REFRESH_ARCHIVE", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Parallel.ForEach(UpdateProcessor.configs.Where(c => c.TableName.Contains("Hist")), config =>
|
||||
{
|
||||
UpdateProcessor.DoUpdate(config.TableName);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Host host = HostFactory.New(x =>
|
||||
{
|
||||
x.UseNLog();
|
||||
|
||||
@@ -83,10 +83,6 @@
|
||||
<Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapper.1.50.2\lib\net451\Dapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DDTek.Oracle, Version=4.2.0.0, Culture=neutral, PublicKeyToken=c84cd5c63851e072, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\DDTek.Oracle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EPPlus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -170,12 +166,6 @@
|
||||
<Compile Include="Helpers\ExcelHelpers.cs" />
|
||||
<Compile Include="Helpers\SearchModelHelpers.cs" />
|
||||
<Compile Include="Models\ColumnSpec.cs" />
|
||||
<Compile Include="Models\DataLoad.cs" />
|
||||
<Compile Include="Models\DataSourceConfig.cs" />
|
||||
<Compile Include="Models\DataUpdateConfig.cs" />
|
||||
<Compile Include="Models\DataUpdateTask.cs" />
|
||||
<Compile Include="Models\Index.cs" />
|
||||
<Compile Include="Models\LastDataUpdate.cs" />
|
||||
<Compile Include="Models\Reporting\ComponentLotFilterEntry.cs" />
|
||||
<Compile Include="Models\Reporting\ItemNumberFilterEntry.cs" />
|
||||
<Compile Include="Models\Reporting\ItemOperationMisFilterEntry.cs" />
|
||||
@@ -196,13 +186,6 @@
|
||||
<Compile Include="Process\ExcelWriter.cs" />
|
||||
<Compile Include="Process\FunctionConverter.cs" />
|
||||
<Compile Include="Process\LotFinderDBExt.cs" />
|
||||
<Compile Include="Process\UpdateProcessor.cs" />
|
||||
<Compile Include="Process\UpdateProcessor.DataUpdateEntry.cs">
|
||||
<DependentUpon>UpdateProcessor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\UpdateProcessor.TableManagement.cs">
|
||||
<DependentUpon>UpdateProcessor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\WorkProcessor.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -226,72 +209,6 @@
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="dsconfig\FunctionCode.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\Branch.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\Item.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\JdeUser.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\Lot.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\LotUsage_Archive.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\LotUsage.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\MisData.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\OrgHierarchy.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\ProfitCenter.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\RouteMaster.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\StatusCode.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkCenter.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderComponent_Archive.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderStep_Archive.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderTime_Archive.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrder_Archive.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrder.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderComponent.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderRouting.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderStep.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="dsconfig\WorkOrderTime.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "BRANCH",
|
||||
"TableName": "Branch",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetBranches",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "FUNCTIONCODE",
|
||||
"TableName": "FunctionCode",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetFunctionCodes",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "ITEM",
|
||||
"TableName": "Item",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetItems",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "USER",
|
||||
"TableName": "JdeUser",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetUsers",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "LOT",
|
||||
"TableName": "Lot",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetLots",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "LOTUSAGE",
|
||||
"TableName": "LotUsage_Curr",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetLotUsages",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "LOTUSAGEARCHIVE",
|
||||
"TableName": "LotUsage_Hist",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetLotUsagesArchive",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "CMS",
|
||||
"SourceData": "MISDATA",
|
||||
"TableName": "MisData",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.CMS.GetMisData",
|
||||
"PostProcessingAction": "Commons.Process.LotFinderDB.PostProcessMisData",
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 100800,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "ORGHIERARCHY",
|
||||
"TableName": "OrgHierarchy",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetOrgHierarchy",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "PROFITCENTER",
|
||||
"TableName": "ProfitCenter",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetProfitCenters",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "ROUTEMASTER",
|
||||
"TableName": "RouteMaster",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetRouteMasters",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "STATUSCODE",
|
||||
"TableName": "StatusCode",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetStatusCodes",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKCENTER",
|
||||
"TableName": "WorkCenter",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkCenters",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDER",
|
||||
"TableName": "WorkOrder_Curr",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrders",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERCOMPONENT",
|
||||
"TableName": "WorkOrderComponent_Curr",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderComponents",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERCOMPONENTARCHIVE",
|
||||
"TableName": "WorkOrderComponent_Hist",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderComponentsArchive",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERROUTING",
|
||||
"TableName": "WorkOrderRouting",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderRoutings",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERSTEP",
|
||||
"TableName": "WorkOrderStep_Curr",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderSteps",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERSTEPARCHIVE",
|
||||
"TableName": "WorkOrderStep_Hist",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderStepsArchive",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERTIME",
|
||||
"TableName": "WorkOrderTime_Curr",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderTimes",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": true,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERTIMEARCHIVE",
|
||||
"TableName": "WorkOrderTime_Hist",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrderTimesArchive",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"SourceSystem": "JDE",
|
||||
"SourceData": "WORKORDERARCHIVE",
|
||||
"TableName": "WorkOrder_Hist",
|
||||
"IsEnabled": true,
|
||||
"DataFetchFunction": "Commons.Process.JDE.GetWorkOrdersArchive",
|
||||
"PostProcessingAction": null,
|
||||
"MassUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 10080,
|
||||
"PrepurgeData": true,
|
||||
"ReIndexData": true
|
||||
},
|
||||
"DailyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 1440,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
},
|
||||
"HourlyUpdateConfig": {
|
||||
"Enabled": false,
|
||||
"Interval": 60,
|
||||
"PrepurgeData": false,
|
||||
"ReIndexData": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user