Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
This commit is contained in:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="mssqllocaldb"/>
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="LotFinderEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SqlClient;provider connection string="data source=DEV-PC\MSSQL2014;initial catalog=LotFinder;persist security info=True;user id=sa;password=Purdue84;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
|
||||
</connectionStrings>
|
||||
<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>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
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')
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Executable
+327
@@ -0,0 +1,327 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AEC46648-AF1B-4EED-8580-1CF7AFE3ADCD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DataModel</RootNamespace>
|
||||
<AssemblyName>DataModel</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>2</WarningLevel>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<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" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<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" />
|
||||
<Compile Include="Helpers\JsonHelpers.cs" />
|
||||
<Compile Include="Models\Branch.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Helpers\EncryptionHelper.cs" />
|
||||
<Compile Include="Helpers\SqlHelpers.cs" />
|
||||
<Compile Include="Models\CamstarMO.cs" />
|
||||
<Compile Include="Models\ColumnSpec.cs" />
|
||||
<Compile Include="Models\DataUpdate.cs" />
|
||||
<Compile Include="Models\DcsLot.cs" />
|
||||
<Compile Include="Models\FunctionCode.cs" />
|
||||
<Compile Include="Models\IBusinessUnit.cs" />
|
||||
<Compile Include="Models\Item.cs" />
|
||||
<Compile Include="Models\JdeUser.cs" />
|
||||
<Compile Include="Models\Lot.cs" />
|
||||
<Compile Include="Models\LotLocation.cs" />
|
||||
<Compile Include="Models\LotUsage.cs" />
|
||||
<Compile Include="Models\MisData.cs" />
|
||||
<Compile Include="Models\OrgHierarchy.cs" />
|
||||
<Compile Include="Models\POInspect.cs" />
|
||||
<Compile Include="Models\POReceiver.cs" />
|
||||
<Compile Include="Models\ProfitCenter.cs" />
|
||||
<Compile Include="Models\QueryTypes.cs" />
|
||||
<Compile Include="Models\RouteMaster.cs" />
|
||||
<Compile Include="Models\Search.cs" />
|
||||
<Compile Include="Models\SearchUpdate.cs" />
|
||||
<Compile Include="Models\StatusUpdate.cs" />
|
||||
<Compile Include="Models\TableSpec.cs" />
|
||||
<Compile Include="Models\WorkCenter.cs" />
|
||||
<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" />
|
||||
<Compile Include="ViewModels\SearchCriteriaViewModel.cs" />
|
||||
<Compile Include="Models\SearchStatus.cs" />
|
||||
<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">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.Lot.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.ProfitCenter.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.SearchManagement.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.User.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.WorkCenter.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Process\LotFinderDB.WorkOrder.cs">
|
||||
<DependentUpon>LotFinderDB.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Models\SearchCriteria.cs" />
|
||||
<Compile Include="ViewModels\ItemViewModel.cs" />
|
||||
<Compile Include="ViewModels\ProfitCenterViewModel.cs" />
|
||||
<Compile Include="ViewModels\SearchViewModel.cs" />
|
||||
<Compile Include="ViewModels\WorkCenterViewModel.cs" />
|
||||
<Compile Include="ViewModels\WorkOrderViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Executable
+216
@@ -0,0 +1,216 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE date/time conversion helpers
|
||||
/// </summary>
|
||||
public static class DateTimeHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Strips time component from datetime
|
||||
/// </summary>
|
||||
/// <param name="source">Datetime to strip time component from</param>
|
||||
/// <returns>Date component of source datetime</returns>
|
||||
public static int ToJDEDate(this DateTime source)
|
||||
{
|
||||
return (source.Year < 2000 ? 0 : 100000) + (source.Year % 100) * 1000 + source.DayOfYear;
|
||||
}
|
||||
|
||||
public static DateTime FromJDEDate(this int sourceDate)
|
||||
{
|
||||
if (sourceDate == 0) { return new DateTime(1900, 1, 1); }
|
||||
|
||||
DateTime baseDate = new DateTime(1900, 1, 1);
|
||||
try
|
||||
{
|
||||
string strSource = sourceDate.ToString();
|
||||
|
||||
if (strSource.Length < 5 || strSource.Length > 6) { throw new Exception($"invalid source date length ({strSource.Length})"); }
|
||||
|
||||
if (strSource.StartsWith("1"))
|
||||
{
|
||||
baseDate = new DateTime(2000, 1, 1);
|
||||
}
|
||||
|
||||
baseDate = baseDate.AddYears(int.Parse(strSource.Substring(1, 2)));
|
||||
baseDate = baseDate.AddDays(int.Parse(strSource.Substring(3)) - 1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
return baseDate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strips date component from datetime
|
||||
/// </summary>
|
||||
/// <param name="source">Datetime to strip date component from</param>
|
||||
/// <returns>Time component of source datetime</returns>
|
||||
public static int ToJDETime(this DateTime source)
|
||||
{
|
||||
return source.Hour * 10000 + source.Minute * 100 + source.Second;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the JDE date + time components into a datetime
|
||||
/// </summary>
|
||||
/// <param name="sourceDate">JDE date component</param>
|
||||
/// <param name="sourceTime">JDE time component</param>
|
||||
/// <returns>Combined datetime from source JDE date/time components</returns>
|
||||
public static DateTime FromJDEDateTime(this DateTime sourceDate, int sourceTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
int hours = sourceTime / 10000;
|
||||
int minutes = (sourceTime % 10000) / 100;
|
||||
int seconds = sourceTime % 100;
|
||||
|
||||
return sourceDate.Date.AddHours(hours).AddMinutes(minutes).AddSeconds(seconds);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return sourceDate;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper methods for encryption / decryption
|
||||
/// </summary>
|
||||
public class EncryptionHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Default salt value
|
||||
/// </summary>
|
||||
private const string DEFAULT_SALT = ")kjdnl3k1jh234a9";
|
||||
|
||||
/// <summary>
|
||||
/// Default hashing algorithm to use
|
||||
/// </summary>
|
||||
private const string DEFAULT_HASH_ALGORITHM = "SHA1";
|
||||
|
||||
/// <summary>
|
||||
/// Default number of iterations to do
|
||||
/// </summary>
|
||||
private const int DEFAULT_PASSWORD_ITERATION = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Default initialization vector
|
||||
/// </summary>
|
||||
private const string DEFAULT_INITIAL_VECTOR = "X8pgVu239uOjdKH1";
|
||||
|
||||
/// <summary>
|
||||
/// Default encryption keysize
|
||||
/// </summary>
|
||||
private const int DEFAULT_KEYSIZE = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Encrypts a string
|
||||
/// </summary>
|
||||
/// <param name="plainText">Text to be encrypted</param>
|
||||
/// <param name="password">Password to encrypt with</param>
|
||||
/// <param name="salt">Salt to encrypt with</param>
|
||||
/// <param name="hashAlgorithm">Can be either SHA1 or MD5</param>
|
||||
/// <param name="passwordIterations">Number of iterations to do</param>
|
||||
/// <param name="initialVector">Needs to be 16 ASCII characters long</param>
|
||||
/// <param name="keySize">Can be 128, 192, or 256</param>
|
||||
/// <returns>An encrypted string</returns>
|
||||
public static string Encrypt(string plainText, string password, string salt = DEFAULT_SALT, string hashAlgorithm = DEFAULT_HASH_ALGORITHM, int passwordIterations = DEFAULT_PASSWORD_ITERATION, string initialVector = DEFAULT_INITIAL_VECTOR, int keySize = DEFAULT_KEYSIZE)
|
||||
{
|
||||
if (string.IsNullOrEmpty(plainText))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
byte[] initialVectorBytes = Encoding.ASCII.GetBytes(initialVector);
|
||||
byte[] saltValueBytes = Encoding.ASCII.GetBytes(salt);
|
||||
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||
|
||||
PasswordDeriveBytes derivedPassword = new PasswordDeriveBytes(password, saltValueBytes, hashAlgorithm, passwordIterations);
|
||||
byte[] keyBytes = derivedPassword.GetBytes(keySize / 8);
|
||||
|
||||
RijndaelManaged symmetricKey = new RijndaelManaged
|
||||
{
|
||||
Mode = CipherMode.CBC
|
||||
};
|
||||
byte[] cipherTextBytes = null;
|
||||
|
||||
using (ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initialVectorBytes))
|
||||
{
|
||||
using (MemoryStream memStream = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memStream, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
cipherTextBytes = memStream.ToArray();
|
||||
memStream.Close();
|
||||
cryptoStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symmetricKey.Clear();
|
||||
|
||||
return Convert.ToBase64String(cipherTextBytes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypts a string
|
||||
/// </summary>
|
||||
/// <param name="encrypted">Text to be decrypted</param>
|
||||
/// <param name="password">Password to decrypt with</param>
|
||||
/// <param name="salt">Salt to decrypt with</param>
|
||||
/// <param name="hashAlgorithm">Can be either SHA1 or MD5</param>
|
||||
/// <param name="passwordIterations">Number of iterations to do</param>
|
||||
/// <param name="initialVector">Needs to be 16 ASCII characters long</param>
|
||||
/// <param name="keySize">Can be 128, 192, or 256</param>
|
||||
/// <returns>A decrypted string</returns>
|
||||
public static string Decrypt(string encrypted, string password, string salt = DEFAULT_SALT, string hashAlgorithm = DEFAULT_HASH_ALGORITHM, int passwordIterations = DEFAULT_PASSWORD_ITERATION, string initialVector = DEFAULT_INITIAL_VECTOR, int keySize = DEFAULT_KEYSIZE)
|
||||
{
|
||||
if (string.IsNullOrEmpty(encrypted))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
byte[] initialVectorBytes = Encoding.ASCII.GetBytes(initialVector);
|
||||
byte[] saltValueBytes = Encoding.ASCII.GetBytes(salt);
|
||||
byte[] cipherTextBytes = Convert.FromBase64String(encrypted);
|
||||
|
||||
PasswordDeriveBytes derivedPassword = new PasswordDeriveBytes(password, saltValueBytes, hashAlgorithm, passwordIterations);
|
||||
byte[] keyBytes = derivedPassword.GetBytes(keySize / 8);
|
||||
|
||||
RijndaelManaged symmetricKey = new RijndaelManaged
|
||||
{
|
||||
Mode = CipherMode.CBC
|
||||
};
|
||||
|
||||
byte[] plainTextBytes = new byte[cipherTextBytes.Length];
|
||||
int byteCount = 0;
|
||||
|
||||
using (ICryptoTransform decrypt = symmetricKey.CreateDecryptor(keyBytes, initialVectorBytes))
|
||||
{
|
||||
using (MemoryStream memStream = new MemoryStream(cipherTextBytes))
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memStream, decrypt, CryptoStreamMode.Read))
|
||||
{
|
||||
|
||||
byteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
|
||||
memStream.Close();
|
||||
cryptoStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symmetricKey.Clear();
|
||||
|
||||
return Encoding.UTF8.GetString(plainTextBytes, 0, byteCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using Fasterflect;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// IEnumerable extension helpers
|
||||
/// </summary>
|
||||
public static class GenericListDataReaderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates generic data reader for bulk copies from list
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Element data type</typeparam>
|
||||
/// <param name="list">Source list</param>
|
||||
/// <returns>Data reader to parse list contents</returns>
|
||||
public static GenericListDataReader<T> GetDataReader<T>(this IEnumerable<T> list) where T : class
|
||||
{
|
||||
return new GenericListDataReader<T>(list);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data reader that parses list of generic elements
|
||||
/// </summary>
|
||||
public class GenericListDataReader : IDataReader
|
||||
{
|
||||
public int Count { get; set; }
|
||||
private readonly IEnumerator<object> list = null;
|
||||
private readonly List<PropertyInfo> properties = new List<PropertyInfo>();
|
||||
private readonly Dictionary<string, int> nameLookup = new Dictionary<string, int>();
|
||||
private readonly string[] propertyNames;
|
||||
|
||||
public GenericListDataReader(IEnumerable<object> list, Type type)
|
||||
{
|
||||
this.list = list.GetEnumerator();
|
||||
|
||||
properties.AddRange(type.GetProperties(BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly));
|
||||
propertyNames = new string[properties.Count];
|
||||
|
||||
for (int i = 0; i < properties.Count; i++)
|
||||
{
|
||||
nameLookup[properties[i].Name] = i;
|
||||
propertyNames[i] = properties[i].Name;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
list.Dispose();
|
||||
}
|
||||
|
||||
public int Depth => throw new NotImplementedException();
|
||||
|
||||
public DataTable GetSchemaTable()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsClosed => false;
|
||||
|
||||
public bool NextResult()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Read()
|
||||
{
|
||||
bool readResult = list.MoveNext();
|
||||
|
||||
//Update counter
|
||||
if (readResult)
|
||||
{
|
||||
Count++;
|
||||
}
|
||||
|
||||
return readResult;
|
||||
}
|
||||
|
||||
public int RecordsAffected => throw new NotImplementedException();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public int FieldCount => properties.Count;
|
||||
|
||||
public bool GetBoolean(int i)
|
||||
{
|
||||
return (bool)GetValue(i);
|
||||
}
|
||||
|
||||
public byte GetByte(int i)
|
||||
{
|
||||
return (byte)GetValue(i);
|
||||
}
|
||||
|
||||
public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public char GetChar(int i)
|
||||
{
|
||||
return (char)GetValue(i);
|
||||
}
|
||||
|
||||
public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IDataReader GetData(int i)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetDataTypeName(int i)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public DateTime GetDateTime(int i)
|
||||
{
|
||||
return (DateTime)GetValue(i);
|
||||
}
|
||||
|
||||
public decimal GetDecimal(int i)
|
||||
{
|
||||
return (decimal)GetValue(i);
|
||||
}
|
||||
|
||||
public double GetDouble(int i)
|
||||
{
|
||||
return (double)GetValue(i);
|
||||
}
|
||||
|
||||
public Type GetFieldType(int i)
|
||||
{
|
||||
return properties[i].PropertyType;
|
||||
}
|
||||
|
||||
public float GetFloat(int i)
|
||||
{
|
||||
return (float)GetValue(i);
|
||||
}
|
||||
|
||||
public Guid GetGuid(int i)
|
||||
{
|
||||
return (Guid)GetValue(i);
|
||||
}
|
||||
|
||||
public short GetInt16(int i)
|
||||
{
|
||||
return (short)GetValue(i);
|
||||
}
|
||||
|
||||
public int GetInt32(int i)
|
||||
{
|
||||
return (int)GetValue(i);
|
||||
}
|
||||
|
||||
public long GetInt64(int i)
|
||||
{
|
||||
return (long)GetValue(i);
|
||||
}
|
||||
|
||||
public string GetName(int i)
|
||||
{
|
||||
return properties[i].Name;
|
||||
}
|
||||
|
||||
public int GetOrdinal(string name)
|
||||
{
|
||||
if (nameLookup.ContainsKey(name))
|
||||
{
|
||||
return nameLookup[name];
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetString(int i)
|
||||
{
|
||||
return (string)GetValue(i);
|
||||
}
|
||||
|
||||
public object GetValue(int i)
|
||||
{
|
||||
string name = propertyNames[i];
|
||||
return list.Current.GetPropertyValue(name);
|
||||
}
|
||||
|
||||
public int GetValues(object[] values)
|
||||
{
|
||||
int getValues = Math.Max(FieldCount, values.Length);
|
||||
|
||||
for (int i = 0; i < getValues; i++)
|
||||
{
|
||||
values[i] = GetValue(i);
|
||||
}
|
||||
|
||||
return getValues;
|
||||
}
|
||||
|
||||
public bool IsDBNull(int i)
|
||||
{
|
||||
return GetValue(i) == null;
|
||||
}
|
||||
|
||||
public object this[string name] => list.Current.GetPropertyValue(name);
|
||||
|
||||
public object this[int i] => GetValue(i);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data reader that parses list of generic elements
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Element data type</typeparam>
|
||||
public class GenericListDataReader<T> : GenericListDataReader where T : class
|
||||
{
|
||||
public GenericListDataReader(IEnumerable<T> list)
|
||||
: base(list, typeof(T))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON serialization helpers
|
||||
/// </summary>
|
||||
public static class JsonHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts parameter to JSON
|
||||
/// </summary>
|
||||
/// <param name="value">Value to serialize</param>
|
||||
/// <returns>Parameter value serialized in JSON format</returns>
|
||||
public static string ToJSON<T>(this T value)
|
||||
{
|
||||
return value == null ?
|
||||
"{}" :
|
||||
JsonConvert.SerializeObject(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses value from JSON
|
||||
/// </summary>
|
||||
/// <param name="json">JSON to parse</param>
|
||||
/// <returns>Parsed value</returns>
|
||||
public static T FromJSON<T>(string json)
|
||||
{
|
||||
T value = default;
|
||||
try
|
||||
{
|
||||
value = JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// LINQ helper methods
|
||||
/// </summary>
|
||||
public static class LinqHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Filters for distinct elements by given key
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">Source data type</typeparam>
|
||||
/// <typeparam name="TKey">Key data type</typeparam>
|
||||
/// <param name="source">Source data</param>
|
||||
/// <param name="keySelector">Key value function</param>
|
||||
/// <returns>Distinct elements from source</returns>
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
HashSet<TKey> keys = new HashSet<TKey>();
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (keys.Add(keySelector(element)))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Groups the data into batches of give size
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Data type of data</typeparam>
|
||||
/// <param name="allData">Data to break into batches</param>
|
||||
/// <param name="batchSize">Size of batches to create</param>
|
||||
/// <returns>Enumerable collection of batches to process</returns>
|
||||
public static IEnumerable<List<T>> BatchGroup<T>(this IEnumerable<T> allData, int batchSize)
|
||||
{
|
||||
List<T> batchGroup = new List<T>();
|
||||
|
||||
//Loop through data and group into batches
|
||||
foreach (T data in allData)
|
||||
{
|
||||
batchGroup.Add(data);
|
||||
|
||||
if (batchGroup.Count == batchSize)
|
||||
{
|
||||
//Return batch of data
|
||||
yield return batchGroup;
|
||||
batchGroup = new List<T>();
|
||||
}
|
||||
}
|
||||
|
||||
//Return remaining data
|
||||
yield return batchGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL server ADO helpers
|
||||
/// </summary>
|
||||
public static class SqlHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, object parameterValue)
|
||||
{
|
||||
return parameterValue != null
|
||||
? command.Parameters.AddWithValue(parameterName, parameterValue)
|
||||
: command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, string parameterValue)
|
||||
{
|
||||
return !string.IsNullOrEmpty(parameterValue) ?
|
||||
command.Parameters.AddWithValue(parameterName, parameterValue) :
|
||||
command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, byte[] parameterValue)
|
||||
{
|
||||
return parameterValue != null ?
|
||||
command.Parameters.AddWithValue(parameterName, parameterValue) :
|
||||
command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
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
|
||||
@@ -0,0 +1,10 @@
|
||||
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)
|
||||
)
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
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
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
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
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
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)
|
||||
)
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
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
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
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
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
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
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
)
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
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
|
||||
@@ -0,0 +1,12 @@
|
||||
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)
|
||||
)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
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
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
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
|
||||
@@ -0,0 +1,11 @@
|
||||
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)
|
||||
)
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
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
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
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
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
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
|
||||
@@ -0,0 +1,10 @@
|
||||
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
|
||||
@@ -0,0 +1,14 @@
|
||||
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)
|
||||
)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
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
|
||||
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
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
|
||||
@@ -0,0 +1,12 @@
|
||||
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
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
)
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE branch model
|
||||
/// </summary>
|
||||
public class Branch
|
||||
{
|
||||
/// <summary>
|
||||
/// Branch unique code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Branch description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Camstar manufacturing order
|
||||
/// </summary>
|
||||
public class CamstarMO
|
||||
{
|
||||
/// <summary>
|
||||
/// Manufacturing order number
|
||||
/// </summary>
|
||||
public string MONumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Database column specification
|
||||
/// </summary>
|
||||
public class ColumnSpec
|
||||
{
|
||||
/// <summary>
|
||||
/// Column name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Column definition
|
||||
/// </summary>
|
||||
public string Definition { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Cache data update
|
||||
/// </summary>
|
||||
public class DataUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// PK ID of record
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of source system (JDE/CMS/etc)
|
||||
/// </summary>
|
||||
public string SourceSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of source data (WORK_ORDER, WORK_ORDER_STEP, etc)
|
||||
/// </summary>
|
||||
public string SourceData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cache table name
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp at start of update
|
||||
/// </summary>
|
||||
public DateTime StartDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp at end of update
|
||||
/// </summary>
|
||||
public DateTime EndDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of data update
|
||||
/// </summary>
|
||||
public UpdateTypes UpdateType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the update was successful
|
||||
/// </summary>
|
||||
public bool WasSuccessful { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of records in update
|
||||
/// </summary>
|
||||
public long NumberRecords { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Types of data update
|
||||
/// </summary>
|
||||
public enum UpdateTypes
|
||||
{
|
||||
Hourly = 1,
|
||||
Daily = 2,
|
||||
Mass = 3
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// DCS lot record
|
||||
/// </summary>
|
||||
public class DcsLot
|
||||
{
|
||||
/// <summary>
|
||||
/// Item number for lot of parts
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lot number for lot of parts
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lot suffix for lot of parts
|
||||
/// </summary>
|
||||
public string LotSuffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE function code model
|
||||
/// </summary>
|
||||
public class FunctionCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique function code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic JDE business unit
|
||||
/// </summary>
|
||||
interface IBusinessUnit
|
||||
{
|
||||
/// <summary>
|
||||
/// Business unit unique code
|
||||
/// </summary>
|
||||
string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Business unit description
|
||||
/// </summary>
|
||||
string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to business unit
|
||||
/// </summary>
|
||||
DateTime LastUpdateDT { get; }
|
||||
}
|
||||
}
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE item (part type) unit model
|
||||
/// </summary>
|
||||
public class Item
|
||||
{
|
||||
/// <summary>
|
||||
/// Item unique short number
|
||||
/// </summary>
|
||||
public long ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item unique number
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item master planning family
|
||||
/// </summary>
|
||||
public string PlanningFamily { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item master stocking type code
|
||||
/// </summary>
|
||||
public string StockingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public ItemViewModel ToViewModel()
|
||||
{
|
||||
return new ItemViewModel()
|
||||
{
|
||||
ItemNumber = ItemNumber,
|
||||
Description = Description
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE user model
|
||||
/// </summary>
|
||||
public class JdeUser
|
||||
{
|
||||
/// <summary>
|
||||
/// User unique address number
|
||||
/// </summary>
|
||||
public long AddressNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User unique login ID
|
||||
/// </summary>
|
||||
public string UserID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's full name (last, first [middle initial])
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public JdeUserViewModel ToViewModel()
|
||||
{
|
||||
return new JdeUserViewModel()
|
||||
{
|
||||
AddressNumber = AddressNumber,
|
||||
UserID = UserID,
|
||||
FullName = FullName
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// LDAP search result
|
||||
/// </summary>
|
||||
public class LDAPEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// LDAP distinguished name
|
||||
/// </summary>
|
||||
public string DN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// LDAP username
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's first name
|
||||
/// </summary>
|
||||
public string FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's last name
|
||||
/// </summary>
|
||||
public string LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's display name
|
||||
/// </summary>
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(LastName) && string.IsNullOrEmpty(FirstName))
|
||||
{
|
||||
return Username;
|
||||
}
|
||||
|
||||
return $"{FirstName} {LastName}".Trim();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Organization title
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's email address
|
||||
/// </summary>
|
||||
public string EmailAddress { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE lot model
|
||||
/// </summary>
|
||||
public class Lot
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot unique number
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Business unit unique code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Short item number
|
||||
/// </summary>
|
||||
public long ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item number
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supplier address number
|
||||
/// </summary>
|
||||
public long SupplierCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lot status code
|
||||
/// </summary>
|
||||
public char StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memo line 1
|
||||
/// </summary>
|
||||
public string Memo1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memo line 2
|
||||
/// </summary>
|
||||
public string Memo2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memo line 3
|
||||
/// </summary>
|
||||
public string Memo3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public LotViewModel ToViewModel()
|
||||
{
|
||||
return new LotViewModel()
|
||||
{
|
||||
LotNumber = LotNumber,
|
||||
ItemNumber = ItemNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE lot location model
|
||||
/// </summary>
|
||||
public class LotLocation
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot unique number
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Short item number
|
||||
/// </summary>
|
||||
public long ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Business unit unique code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Location code for where lot is located
|
||||
/// </summary>
|
||||
public string Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Cardex entry
|
||||
/// </summary>
|
||||
public class LotUsage
|
||||
{
|
||||
/// <summary>
|
||||
/// Record unique / PK ID
|
||||
/// </summary>
|
||||
public long UniqueID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order unique number
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lot number of component
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Component issuance branch code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Component item short number
|
||||
/// </summary>
|
||||
public long ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction quantity
|
||||
/// </summary>
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// CMS MIS data model
|
||||
/// </summary>
|
||||
public class MisData
|
||||
{
|
||||
/// <summary>
|
||||
/// Item unique number
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Branch unique code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation job step number
|
||||
/// </summary>
|
||||
public string SequenceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MIS unique number
|
||||
/// </summary>
|
||||
public string MisNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MIS revision ID
|
||||
/// </summary>
|
||||
public string RevID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Characteristic number
|
||||
/// </summary>
|
||||
public string CharNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Test description
|
||||
/// </summary>
|
||||
public string TestDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of sampling
|
||||
/// </summary>
|
||||
public string SamplingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sampling selection value
|
||||
/// </summary>
|
||||
public string SamplingValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tools & gauges for MIS
|
||||
/// </summary>
|
||||
public string ToolsGauges { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Instructions for MIS
|
||||
/// </summary>
|
||||
public string WorkInstructions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MIS release status
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MIS release date
|
||||
/// </summary>
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Organization hierarchy (profit center -> work center mapping) model
|
||||
/// </summary>
|
||||
public class OrgHierarchy
|
||||
{
|
||||
/// <summary>
|
||||
/// Work center unique code
|
||||
/// </summary>
|
||||
public string WorkCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Branch unit code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Profit center unique code
|
||||
/// </summary>
|
||||
public string ProfitCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE PO inspect record
|
||||
/// </summary>
|
||||
public class POInspect
|
||||
{
|
||||
/// <summary>
|
||||
/// Record unique / PK ID
|
||||
/// </summary>
|
||||
public long UniqueID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO number
|
||||
/// </summary>
|
||||
public long OrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO order company code
|
||||
/// </summary>
|
||||
public string OrderCompany { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Line number within PO
|
||||
/// </summary>
|
||||
public decimal LineNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO invoice number
|
||||
/// </summary>
|
||||
public long InvoiceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product lot number
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product unique item number
|
||||
/// </summary>
|
||||
public string ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE PO receiver record
|
||||
/// </summary>
|
||||
public class POReceiver
|
||||
{
|
||||
/// <summary>
|
||||
/// PO number
|
||||
/// </summary>
|
||||
public long OrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO order company code
|
||||
/// </summary>
|
||||
public string OrderCompany { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO suffix
|
||||
/// </summary>
|
||||
public string OrderSuffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Line number within PO
|
||||
/// </summary>
|
||||
public decimal LineNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total number of lines in PO
|
||||
/// </summary>
|
||||
public int NumberOfLines { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PO invoice number
|
||||
/// </summary>
|
||||
public long InvoiceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Receiving site identifier
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product lot number
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product unique item number
|
||||
/// </summary>
|
||||
public string ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date product was received
|
||||
/// </summary>
|
||||
public DateTime DateReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Subledger name
|
||||
/// </summary>
|
||||
public string Subledger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product quantity recieved
|
||||
/// </summary>
|
||||
public decimal QtyReceived { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE profit center model
|
||||
/// </summary>
|
||||
public class ProfitCenter : IBusinessUnit
|
||||
{
|
||||
/// <summary>
|
||||
/// Profit center unique code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Profit center description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public ProfitCenterViewModel ToViewModel()
|
||||
{
|
||||
return new ProfitCenterViewModel()
|
||||
{
|
||||
Code = Code,
|
||||
Description = Description
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
public class QueryTypes
|
||||
{
|
||||
public string Code { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public int OrderIndex { get; private set; }
|
||||
|
||||
public bool TimeSpanFilter { get; }
|
||||
public bool WorkOrderFilter { get; private set; }
|
||||
public bool ItemNumberFilter { get; }
|
||||
public bool ProfitCenterFilter { get; }
|
||||
public bool WorkCenterFilter { get; }
|
||||
public bool ComponentLotFilter { get; }
|
||||
public bool OperatorFilter { get; }
|
||||
public bool ItemOperationMISFilter { get; }
|
||||
public bool ExtractMISFilter { get; }
|
||||
public bool ReceivedItemNumberIISFilter { get; }
|
||||
|
||||
private static readonly Dictionary<string, QueryTypes> definedTypes = new Dictionary<string, QueryTypes>();
|
||||
|
||||
public QueryTypes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public QueryTypes(string code, string name, int orderIndex)
|
||||
{
|
||||
Code = code;
|
||||
Name = name;
|
||||
OrderIndex = orderIndex;
|
||||
definedTypes[code] = this;
|
||||
}
|
||||
|
||||
public QueryTypes Identify(SearchCriteria searchCriteria)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static QueryTypes WorkOrder = new QueryTypes("WorkOrder", "Work Order", 10) { WorkOrderFilter = true };
|
||||
}
|
||||
}
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE item router master model
|
||||
/// </summary>
|
||||
public class RouteMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique code for branch
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique number for item
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Router type
|
||||
/// </summary>
|
||||
public string RoutingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Job step operation number
|
||||
/// </summary>
|
||||
public decimal SequenceNumber { get;set; }
|
||||
|
||||
/// <summary>
|
||||
/// Job step function code
|
||||
/// </summary>
|
||||
public string FunctionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work center unique code
|
||||
/// </summary>
|
||||
public string WorkCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Numeric representation of date record effectivity starts
|
||||
/// </summary>
|
||||
public int StartDate_Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date record effectivity starts
|
||||
/// </summary>
|
||||
public DateTime StartDate => StartDate_Date.FromJDEDate();
|
||||
|
||||
/// <summary>
|
||||
/// Numeric representation of date record effectivity ends
|
||||
/// </summary>
|
||||
public int? EndDate_Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date record effectivity ends
|
||||
/// </summary>
|
||||
public DateTime? EndDate => EndDate_Date?.FromJDEDate();
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Search model
|
||||
/// </summary>
|
||||
public class Search
|
||||
{
|
||||
/// <summary>
|
||||
/// PK ID of search
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User name of user that created search
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User-friendly name for search
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current search status
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SearchStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was submitted
|
||||
/// </summary>
|
||||
public DateTime? SubmitDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was started
|
||||
/// </summary>
|
||||
public DateTime? StartDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was completed
|
||||
/// </summary>
|
||||
public DateTime? EndDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// JSON-packed search criteria
|
||||
/// </summary>
|
||||
public string CriteriaJSON { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Search critera
|
||||
/// </summary>
|
||||
public SearchCriteria Criteria { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Excel search results file
|
||||
/// </summary>
|
||||
public byte[] Results { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE data filter criteria
|
||||
/// </summary>
|
||||
public class SearchCriteria
|
||||
{
|
||||
/// <summary>
|
||||
/// Minimum timestamp to include
|
||||
/// </summary>
|
||||
public DateTime? MinimumDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maxmimum timestamp to include
|
||||
/// </summary>
|
||||
public DateTime? MaximumDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of workorder numbers to include
|
||||
/// </summary>
|
||||
public List<long> WorkOrderNumbers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of item numbers to include
|
||||
/// </summary>
|
||||
public List<string> ItemNumbers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of included profit centers
|
||||
/// </summary>
|
||||
public List<string> ProfitCenters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of included work centers
|
||||
/// </summary>
|
||||
public List<string> WorkCenters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of included operator IDs
|
||||
/// </summary>
|
||||
public List<string> OperatorIDs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of included upper level lot numbers
|
||||
/// </summary>
|
||||
public List<LotViewModel> ComponentLotNumbers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to extract MIS data
|
||||
/// </summary>
|
||||
public bool ExtractMisData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of part/operation combinations for MIS filtering
|
||||
/// </summary>
|
||||
public List<PartOperationViewModel> PartOperations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public SearchCriteria()
|
||||
{
|
||||
WorkOrderNumbers = new List<long>();
|
||||
ItemNumbers = new List<string>();
|
||||
ProfitCenters = new List<string>();
|
||||
WorkCenters = new List<string>();
|
||||
OperatorIDs = new List<string>();
|
||||
ComponentLotNumbers = new List<LotViewModel>();
|
||||
PartOperations = new List<PartOperationViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Status of search
|
||||
/// </summary>
|
||||
public enum SearchStatus
|
||||
{
|
||||
New = 0,
|
||||
Submitted = 1,
|
||||
Started = 2,
|
||||
Ended = 3,
|
||||
Error = 4
|
||||
}
|
||||
}
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Search status update message
|
||||
/// </summary>
|
||||
public class SearchUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// Search PK ID
|
||||
/// </summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User name of user that submitted search
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of user that submitted search
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Search status code
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SearchStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was submitted
|
||||
/// </summary>
|
||||
public DateTime? SubmitDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was started
|
||||
/// </summary>
|
||||
public DateTime? StartDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp search was completed
|
||||
/// </summary>
|
||||
public DateTime? EndDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp when update was generated
|
||||
/// </summary>
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public SearchUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="search">Search to copy values from</param>
|
||||
public SearchUpdate(Search search)
|
||||
{
|
||||
ID = search.ID;
|
||||
UserName = search.UserName;
|
||||
Name = search.Name;
|
||||
Status = search.Status;
|
||||
SubmitDT = search.SubmitDT;
|
||||
StartDT = search.StartDT;
|
||||
EndDT = search.EndDT;
|
||||
Timestamp = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE work order status code model
|
||||
/// </summary>
|
||||
public class StatusCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Status code unique code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status code description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Process status update message
|
||||
/// </summary>
|
||||
public class StatusUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// Update message to display
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp message was sent
|
||||
/// </summary>
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Database table specification
|
||||
/// </summary>
|
||||
public class TableSpec
|
||||
{
|
||||
/// <summary>
|
||||
/// Table name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Temporary table name
|
||||
/// </summary>
|
||||
public string TempTableName => $"#{Name}";
|
||||
|
||||
/// <summary>
|
||||
/// Table columns
|
||||
/// </summary>
|
||||
public List<ColumnSpec> Columns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Table columns that form the primary key
|
||||
/// </summary>
|
||||
public List<ColumnSpec> PrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public TableSpec()
|
||||
{
|
||||
Columns = new List<ColumnSpec>();
|
||||
PrimaryKey = new List<ColumnSpec>();
|
||||
}
|
||||
public string GenerateIndex()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
public string GenerateDrop()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
public string GenerateCreate()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
public ColumnSpec GetColumn(string columnName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE work center model
|
||||
/// </summary>
|
||||
public class WorkCenter : IBusinessUnit
|
||||
{
|
||||
/// <summary>
|
||||
/// Work center unique code
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work center description
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public WorkCenterViewModel ToViewModel()
|
||||
{
|
||||
return new WorkCenterViewModel()
|
||||
{
|
||||
Code = Code,
|
||||
Description = Description
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+110
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE work order model
|
||||
/// </summary>
|
||||
public class WorkOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order unique number
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order branch code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order assigned lot number
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order item number
|
||||
/// </summary>
|
||||
public string ItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order short item number
|
||||
/// </summary>
|
||||
public long ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order's parent unique number
|
||||
/// </summary>
|
||||
public string ParentWorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Order quantity
|
||||
/// </summary>
|
||||
public decimal OrderQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity on hold
|
||||
/// </summary>
|
||||
public decimal HeldQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity shipped
|
||||
/// </summary>
|
||||
public decimal ShippedQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order status code
|
||||
/// </summary>
|
||||
public string StatusCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to status code
|
||||
/// </summary>
|
||||
public DateTime? StatusCodeUpdateDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date work order was issued
|
||||
/// </summary>
|
||||
public DateTime IssueDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date work order was started
|
||||
/// </summary>
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order routing type
|
||||
/// </summary>
|
||||
public string RoutingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
|
||||
/// <summary>
|
||||
/// Converts object to view model
|
||||
/// </summary>
|
||||
/// <returns>Projected view model for object</returns>
|
||||
public WorkOrderViewModel ToViewModel()
|
||||
{
|
||||
return new WorkOrderViewModel()
|
||||
{
|
||||
WorkOrderNumber = WorkOrderNumber,
|
||||
ItemNumber = ItemNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order component usage model
|
||||
/// </summary>
|
||||
public class WorkOrderComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Record unique / PK ID
|
||||
/// </summary>
|
||||
public long UniqueID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order unique number
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lot number of component
|
||||
/// </summary>
|
||||
public string LotNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Component issuance branch code
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Component item short number
|
||||
/// </summary>
|
||||
public long? ShortItemNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction quantity
|
||||
/// </summary>
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Work order step transaction model
|
||||
/// </summary>
|
||||
public class WorkOrderRouting
|
||||
{
|
||||
/// <summary>
|
||||
/// Transaction user ID
|
||||
/// </summary>
|
||||
public string UserID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction batch number
|
||||
/// </summary>
|
||||
public string BatchNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction number
|
||||
/// </summary>
|
||||
public string TransactionNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction line number
|
||||
/// </summary>
|
||||
public int LineNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence number
|
||||
/// </summary>
|
||||
public decimal StepNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for work center
|
||||
/// </summary>
|
||||
public string WorkCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique number for workorder
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Work order routing type
|
||||
/// </summary>
|
||||
public string RoutingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for branch
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence description
|
||||
/// </summary>
|
||||
public string StepDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation function code
|
||||
/// </summary>
|
||||
public string FunctionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Numeric representation of transaction original date
|
||||
/// </summary>
|
||||
private int TransactionDate_Date { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Transaction original date
|
||||
/// </summary>
|
||||
public DateTime TransactionDate => TransactionDate_Date.FromJDEDate();
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// JDE work order step model
|
||||
/// </summary>
|
||||
public class WorkOrderStep
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique number for workorder
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for branch
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for work center
|
||||
/// </summary>
|
||||
public string WorkCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence number
|
||||
/// </summary>
|
||||
public decimal StepNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence description
|
||||
/// </summary>
|
||||
public string StepDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function operation description (long text)
|
||||
/// </summary>
|
||||
public string FunctionOperationDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence type
|
||||
/// </summary>
|
||||
public string StepTypeCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp when work step began
|
||||
/// </summary>
|
||||
public DateTime? StartDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp when work step ended
|
||||
/// </summary>
|
||||
public DateTime? EndDT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation function code
|
||||
/// </summary>
|
||||
public string FunctionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantity scrapped/cancelled
|
||||
/// </summary>
|
||||
public decimal ScrappedQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using DataModel.Helpers;
|
||||
|
||||
namespace DataModel.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// F31122 work order time transaction record
|
||||
/// </summary>
|
||||
public class WorkOrderTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique ID for record
|
||||
/// </summary>
|
||||
public long UniqueID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique number for workorder
|
||||
/// </summary>
|
||||
public long WorkOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for branch
|
||||
/// </summary>
|
||||
public string BranchCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique code for work center
|
||||
/// </summary>
|
||||
public string WorkCenterCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Operation sequence number
|
||||
/// </summary>
|
||||
public decimal StepNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique address number for user
|
||||
/// </summary>
|
||||
public long AddressNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// G/L date entry was processed
|
||||
/// </summary>
|
||||
public DateTime? GlDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateDate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time of day of last update to record
|
||||
/// </summary>
|
||||
private int LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last update to record
|
||||
/// </summary>
|
||||
public DateTime LastUpdateDT => LastUpdateDate.FromJDEDate().FromJDEDateTime(LastUpdateTime);
|
||||
}
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Item tracking functions for LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Query to find items with matching item number or description
|
||||
/// </summary>
|
||||
private const string SQL_SEARCH_ITEMS = @"
|
||||
SELECT TOP 25
|
||||
i.ShortItemNumber,
|
||||
i.ItemNumber,
|
||||
i.Description,
|
||||
i.LastUpdateDT
|
||||
FROM dbo.Item AS i
|
||||
WHERE i.ItemNumber LIKE '%' + @filter + '%' OR
|
||||
i.Description LIKE '%' + @filter + '%'
|
||||
ORDER BY i.ItemNumber";
|
||||
|
||||
/// <summary>
|
||||
/// Finds items with matching item number or description
|
||||
/// </summary>
|
||||
/// <param name="filter">Search filter</param>
|
||||
/// <returns>Items with matching item number or description</returns>
|
||||
public static List<Item> SearchItems(string filter)
|
||||
{
|
||||
List<Item> results = new List<Item>();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results.AddRange(connection.Query<Item>(SQL_SEARCH_ITEMS, new {filter}));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("SearchItems: failed to search for item '{0}': {1}.", filter, error.Message);
|
||||
throw new Exception($"Failed to get serach for item '{filter}' from LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to find items with matching item numbers
|
||||
/// </summary>
|
||||
private const string SQL_LOOKUP_ITEMS = @"
|
||||
SELECT i.ShortItemNumber,
|
||||
i.ItemNumber,
|
||||
i.Description,
|
||||
i.LastUpdateDT
|
||||
FROM dbo.Item AS i INNER JOIN
|
||||
@itemNumbers AS i2 ON (i.ItemNumber = i2.ItemNumber)
|
||||
ORDER BY i.ItemNumber";
|
||||
|
||||
/// <summary>
|
||||
/// Finds items with matching item numbers
|
||||
/// </summary>
|
||||
/// <param name="itemNumbers">Item numbers to match</param>
|
||||
/// <returns></returns>
|
||||
public static List<Item> LookupItems(List<string> itemNumbers)
|
||||
{
|
||||
List<Item> results = new List<Item>();
|
||||
|
||||
try
|
||||
{
|
||||
//Create search filter parameter
|
||||
DataTable dataTable = new DataTable();
|
||||
dataTable.Columns.Add("ItemNumber", typeof(string));
|
||||
|
||||
foreach (string itemNumber in itemNumbers)
|
||||
{
|
||||
dataTable.Rows.Add(itemNumber);
|
||||
}
|
||||
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results = connection.Query<Item>(SQL_LOOKUP_ITEMS, new { itemNumbers = dataTable.AsTableValuedParameter("ItemNumberFilterParameter") }).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("LookupItems: failed to find matching items: {0}.", error.Message);
|
||||
throw new Exception("LookupItems: failed to find matching items in LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
using DataModel.ViewModels;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot tracking functions for LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Query to find lots with matching lot numbers
|
||||
/// </summary>
|
||||
private const string SQL_LOOKUP_LOTS = @"
|
||||
SELECT DISTINCT
|
||||
l.LotNumber,
|
||||
l.BranchCode,
|
||||
l.ShortItemNumber,
|
||||
l.ItemNumber,
|
||||
l.SupplierCode,
|
||||
l.LastUpdateDT
|
||||
FROM dbo.Lot AS l INNER JOIN
|
||||
@lotNumbers ln ON (l.LotNumber = ln.ComponentLotNumber AND
|
||||
((l.ItemNumber IS NULL AND ln.ItemNumber IS NULL) OR l.ItemNumber = ln.ItemNumber))";
|
||||
|
||||
/// <summary>
|
||||
/// Finds lots with matching lot numbers
|
||||
/// </summary>
|
||||
/// <param name="lots">Lot numbers to match</param>
|
||||
/// <returns>List of matching lots</returns>
|
||||
public static List<Lot> LookupLots(List<LotViewModel> lots)
|
||||
{
|
||||
List<Lot> results = new List<Lot>();
|
||||
|
||||
try
|
||||
{
|
||||
//Create search filter parameter
|
||||
DataTable dataTable = new DataTable();
|
||||
dataTable.Columns.Add("ComponentLotNumber", typeof(string));
|
||||
dataTable.Columns.Add("ItemNumber", typeof(string));
|
||||
|
||||
foreach (LotViewModel lot in lots)
|
||||
{
|
||||
dataTable.Rows.Add(lot.LotNumber, lot.ItemNumber);
|
||||
}
|
||||
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results = connection.Query<Lot>(SQL_LOOKUP_LOTS, new { lotNumbers = dataTable.AsTableValuedParameter("ComponentLotFilterParameter") }).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("LookupLots: failed to find matching lots: {0}.", error.Message);
|
||||
throw new Exception("LookupLots: failed to find matching lots in LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using Dapper;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// MIS data tracking functions for LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Post-processing script to set obsoletion dates
|
||||
/// </summary>
|
||||
private const string SQL_POSTPROCESS_MISDATA = @"
|
||||
SET ANSI_WARNINGS OFF;
|
||||
|
||||
WITH cte AS (
|
||||
SELECT md.MisNumber, md.RevID, md.Status, MIN(md.ReleaseDate) Released
|
||||
FROM dbo.MisData AS md
|
||||
GROUP BY md.MisNumber, md.RevID, md.Status
|
||||
)
|
||||
UPDATE dbo.MisData
|
||||
SET ObsoleteDate = bl.Released
|
||||
FROM cte bl
|
||||
WHERE MisData.MisNumber = bl.MisNumber AND
|
||||
MisData.RevID = bl.RevID AND
|
||||
MisData.Status = 'Current' AND
|
||||
bl.Status = 'BackLevel';
|
||||
|
||||
WITH cte AS (
|
||||
SELECT md.MisNumber, md.RevID, md.Status, MIN(md.ReleaseDate) Released
|
||||
FROM dbo.MisData AS md
|
||||
GROUP BY md.MisNumber, md.RevID, md.Status
|
||||
)
|
||||
UPDATE dbo.MisData
|
||||
SET ObsoleteDate = (SELECT TOP 1 nl.Released
|
||||
FROM cte nl
|
||||
WHERE MisData.MisNumber = nl.MisNumber AND
|
||||
MisData.RevID < nl.RevID AND
|
||||
MisData.Status = nl.Status
|
||||
ORDER BY nl.RevID)
|
||||
WHERE ObsoleteDate IS NULL;
|
||||
|
||||
ALTER INDEX [PK_MisData] ON [dbo].[MisData] REBUILD;";
|
||||
|
||||
/// <summary>
|
||||
/// Performs post processing on imported Mis data
|
||||
/// </summary>
|
||||
public static void PostProcessMisData()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
connection.Execute(SQL_POSTPROCESS_MISDATA);
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("PostProcessMisData: failed to post process MIS data: {0}.", error.Message);
|
||||
throw new Exception($"Failed to post process MIS data from LotFinderDB.", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Profit center tracking functions for LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Query to find profit centers with matching code or description
|
||||
/// </summary>
|
||||
private const string SQL_SEARCH_PROFIT_CENTERS = @"
|
||||
SELECT TOP 25
|
||||
pc.Code,
|
||||
pc.Description,
|
||||
pc.LastUpdateDT
|
||||
FROM dbo.ProfitCenter AS pc
|
||||
WHERE pc.Code LIKE '%' + @filter + '%' OR
|
||||
pc.Description LIKE '%' + @filter + '%'
|
||||
ORDER BY pc.Code";
|
||||
|
||||
/// <summary>
|
||||
/// Finds profit centers with matching code or description
|
||||
/// </summary>
|
||||
/// <param name="filter">Search filter</param>
|
||||
/// <returns>Profit centers with matching code or description</returns>
|
||||
public static List<ProfitCenter> SearchProfitCenters(string filter)
|
||||
{
|
||||
List<ProfitCenter> results = new List<ProfitCenter>();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results.AddRange(connection.Query<ProfitCenter>(SQL_SEARCH_PROFIT_CENTERS, new { filter }));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("SearchProfitCenters: failed to search for profit centers '{0}': {1}.", filter, error.Message);
|
||||
throw new Exception($"Failed to search for profit centers '{filter}' from LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to find profit centers with matching profit center codes
|
||||
/// </summary>
|
||||
private const string SQL_LOOKUP_PROFIT_CENTERS = @"
|
||||
SELECT pc.Code,
|
||||
pc.Description,
|
||||
pc.LastUpdateDT
|
||||
FROM dbo.ProfitCenter AS pc INNER JOIN
|
||||
@profitCenterCodes AS pc2 ON (pc.Code = pc2.Code)
|
||||
ORDER BY pc.Code";
|
||||
|
||||
/// <summary>
|
||||
/// Finds profit centers with matching profit center codes
|
||||
/// </summary>
|
||||
/// <param name="profitCenterCodes">Profit center codes to match</param>
|
||||
/// <returns>List of matching profit centers</returns>
|
||||
public static List<ProfitCenter> LookupProfitCenters(List<string> profitCenterCodes)
|
||||
{
|
||||
List<ProfitCenter> results = new List<ProfitCenter>();
|
||||
|
||||
try
|
||||
{
|
||||
//Create search filter parameter
|
||||
DataTable dataTable = new DataTable();
|
||||
dataTable.Columns.Add("Code", typeof(string));
|
||||
foreach (string profitCenter in profitCenterCodes)
|
||||
{
|
||||
dataTable.Rows.Add(profitCenter);
|
||||
}
|
||||
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results = connection.Query<ProfitCenter>(SQL_LOOKUP_PROFIT_CENTERS, new { profitCenterCodes = dataTable.AsTableValuedParameter("ProfitCenterFilterParameter") }).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("LookupProfitCenters: failed to find matching profit centers: {0}.", error.Message);
|
||||
throw new Exception("LookupProfitCenters: failed to find matching profit centers in LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Helpers;
|
||||
using DataModel.Models;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Search management functionality of LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Query to get user's searches
|
||||
/// </summary>
|
||||
private const string SQL_GET_USER_SEARCHES = @"
|
||||
SELECT s.ID,
|
||||
s.Name,
|
||||
s.Status,
|
||||
s.SubmitDT,
|
||||
s.StartDT,
|
||||
s.EndDT
|
||||
FROM dbo.Search s
|
||||
WHERE s.UserName = @userName
|
||||
ORDER BY s.SubmitDT";
|
||||
|
||||
/// <summary>
|
||||
/// Gets user's searches
|
||||
/// </summary>
|
||||
/// <param name="userName">User name to match</param>
|
||||
/// <returns>List of user's searches</returns>
|
||||
public static List<Search> GetUserSearches(string userName)
|
||||
{
|
||||
List<Search> results = new List<Search>();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results.AddRange(connection.Query<Search>(SQL_GET_USER_SEARCHES, new {userName}));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("GetUserSearches: failed to get searches for user '{0}': {1}.", userName, error.Message);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to get queued searches
|
||||
/// </summary>
|
||||
private const string SQL_GET_QUEUED_SEARCHES = @"
|
||||
SELECT s.ID,
|
||||
s.UserName,
|
||||
s.Name,
|
||||
s.Status,
|
||||
s.SubmitDT,
|
||||
s.StartDT,
|
||||
s.EndDT
|
||||
FROM dbo.Search s
|
||||
WHERE s.Status < 3
|
||||
ORDER BY s.SubmitDT";
|
||||
|
||||
/// <summary>
|
||||
/// Gets queued searches
|
||||
/// </summary>
|
||||
/// <returns>List of searches that have been submitted but not completed</returns>
|
||||
public static List<Search> GetQueuedSearches()
|
||||
{
|
||||
List<Search> results = new List<Search>();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results.AddRange(connection.Query<Search>(SQL_GET_QUEUED_SEARCHES));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("GetQueuedSearches: failed to get queued searches: {0}.", error.Message);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to get search with matching ID
|
||||
/// </summary>
|
||||
private const string SQL_GET_SEARCH = @"
|
||||
SELECT s.UserName,
|
||||
s.Name,
|
||||
s.Status,
|
||||
s.SubmitDT,
|
||||
s.StartDT,
|
||||
s.EndDT,
|
||||
s.Criteria as CriteriaJSON
|
||||
FROM dbo.Search s
|
||||
WHERE s.ID = @id";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the search with matching ID
|
||||
/// </summary>
|
||||
/// <param name="id">Search ID to match</param>
|
||||
/// <returns>Search with matching ID</returns>
|
||||
public static Search GetSearch(int id)
|
||||
{
|
||||
Search result = null;
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
result = connection.QueryFirstOrDefault<Search>(SQL_GET_SEARCH, new {id});
|
||||
|
||||
if (result != null && !string.IsNullOrEmpty(result.CriteriaJSON))
|
||||
{
|
||||
result.ID = id;
|
||||
result.Criteria = JsonConvert.DeserializeObject<SearchCriteria>(result.CriteriaJSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("GetSearch: failed to get search with ID '{0}': {1}.", id, error.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to get the saved results for the search with matching ID
|
||||
/// </summary>
|
||||
private const string SQL_GET_SEARCH_RESULTS = @"
|
||||
SELECT s.Results
|
||||
FROM dbo.Search AS s
|
||||
WHERE s.ID = @id";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the saved results for the search with matching ID
|
||||
/// </summary>
|
||||
/// <param name="id">Search ID to match</param>
|
||||
/// <returns>Raw data for saved search results</returns>
|
||||
public static byte[] GetSearchResults(int id)
|
||||
{
|
||||
byte[] result = null;
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
result = connection.Query<byte[]>(SQL_GET_SEARCH_RESULTS, new {id}).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("GetSearchResults: failed to get results for search with ID '{0}': {1}.", id, error.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the search to the database
|
||||
/// </summary>
|
||||
/// <param name="search">Search to submit</param>
|
||||
/// <returns>PK ID of search record generated</returns>
|
||||
public static int SubmitSearch(Search search)
|
||||
{
|
||||
int searchID = -1;
|
||||
|
||||
try
|
||||
{
|
||||
search.Status = SearchStatus.Submitted;
|
||||
search.SubmitDT = DateTime.Now;
|
||||
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand("SubmitSearch", connection))
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
//Bind parameters
|
||||
command.Bind("p_UserName", search.UserName);
|
||||
command.Bind("p_Name", search.Name);
|
||||
command.Bind("p_Criteria", search.Criteria.ToJSON());
|
||||
SqlParameter searchIDParameter = new SqlParameter("o_SearchID", SqlDbType.Int)
|
||||
{
|
||||
Direction = ParameterDirection.Output
|
||||
};
|
||||
command.Parameters.Add(searchIDParameter);
|
||||
|
||||
//Execute procedure and extract values
|
||||
command.ExecuteNonQuery();
|
||||
searchID = Convert.ToInt32(searchIDParameter.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log but do not forward error
|
||||
logger.Error("SubmitSearch: failed to get submit search: {0}.", error.Message);
|
||||
}
|
||||
|
||||
return searchID;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
using DataModel.Models;
|
||||
|
||||
namespace DataModel.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// User tracking functions for LotFinderDB interface
|
||||
/// </summary>
|
||||
public partial class LotFinderDB
|
||||
{
|
||||
/// <summary>
|
||||
/// Finds users with matching user ID or full name
|
||||
/// </summary>
|
||||
private const string SQL_SEARCH_USERS = @"
|
||||
SELECT TOP 25
|
||||
u.AddressNumber,
|
||||
COALESCE(u.UserID,' ') AS UserID,
|
||||
u.FullName,
|
||||
u.LastUpdateDT
|
||||
FROM dbo.JdeUser AS u
|
||||
WHERE u.UserID LIKE '%' + @filter + '%' OR
|
||||
u.FullName LIKE '%' + @filter + '%' OR
|
||||
CAST(u.AddressNumber AS VARCHAR(10)) LIKE '%' + @filter + '%'
|
||||
ORDER BY u.UserID, u.FullName";
|
||||
|
||||
/// <summary>
|
||||
/// Finds users with matching user ID or full name
|
||||
/// </summary>
|
||||
/// <param name="filter">Search filter</param>
|
||||
/// <returns>Users with matching matching user ID or full name</returns>
|
||||
public static List<JdeUser> SearchUsers(string filter)
|
||||
{
|
||||
List<JdeUser> results = new List<JdeUser>();
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results.AddRange(connection.Query<JdeUser>(SQL_SEARCH_USERS, new{filter}));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("SearchUsers: failed to search for user '{0}': {1}.", filter, error.Message);
|
||||
throw new Exception($"Failed to get serach for user '{filter}' from LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query to find users with matching user IDs
|
||||
/// </summary>
|
||||
private const string SQL_LOOKUP_USERS = @"
|
||||
SELECT u.AddressNumber,
|
||||
u.UserID,
|
||||
u.FullName,
|
||||
u.LastUpdateDT
|
||||
FROM dbo.JdeUser AS u INNER JOIN
|
||||
@userIDs u2 ON (u.UserID = u2.UserName OR CAST(u.AddressNumber AS VARCHAR(20)) = u2.UserName)
|
||||
ORDER BY u.UserID";
|
||||
|
||||
/// <summary>
|
||||
/// Finds users with matching user IDs
|
||||
/// </summary>
|
||||
/// <param name="userIDs">User IDs to match</param>
|
||||
/// <returns>Users with matching user IDs</returns>
|
||||
public static List<JdeUser> LookupUsers(List<string> userIDs)
|
||||
{
|
||||
List<JdeUser> results = new List<JdeUser>();
|
||||
|
||||
try
|
||||
{
|
||||
//Create search filter parameter
|
||||
DataTable dataTable = new DataTable();
|
||||
dataTable.Columns.Add("UserName", typeof(string));
|
||||
foreach (string userID in userIDs)
|
||||
{
|
||||
dataTable.Rows.Add(userID);
|
||||
}
|
||||
|
||||
using (SqlConnection connection = GetConnection())
|
||||
{
|
||||
results = connection.Query<JdeUser>(SQL_LOOKUP_USERS, new { userIDs = dataTable.AsTableValuedParameter("OperatorFilterParameter") }).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
//Log and forward exception
|
||||
logger.Error("LookupUsers: failed to find matching users: {0}.", error.Message);
|
||||
throw new Exception("LookupUsers: failed to find matching users in LotFinderDB.", error);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user