Compare commits

..

13 Commits

19 changed files with 304 additions and 12 deletions

4
.gitignore vendored
View File

@@ -11,6 +11,10 @@ backend-0.1.2-218.zip
backend-0.1.2.zip backend-0.1.2.zip
postgresql-17.2-3-windows-x64.exe postgresql-17.2-3-windows-x64.exe
jsTesting jsTesting
dotnetwrapper/bin
dotnetwrapper/obj
dotnetwrapper/wwwroot
prodBuild
# ---> Node # ---> Node

26
dotnetwrapper/Program.cs Normal file
View File

@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
// if (!app.Environment.IsDevelopment())
// {
// // app.UseExceptionHandler("/Home/Error");
// // app.UseHsts();
// }
// app.UseHttpsRedirection(); // to force https
app.UseStaticFiles();
app.UseRouting();
app.MapFallbackToFile("index.html");
app.Run();

View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:3000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:3000;http://localhost:3000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<Target Name="CopyToProjectWwwRoot" AfterTargets="BuildViteApp">
<ItemGroup>
<ViteDistFiles Include="..\my-vite-app\dist\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ViteDistFiles)" DestinationFolder="wwwroot\%(RecursiveDir)" />
</Target>
<!-- <Target Name="CopyViteFiles" AfterTargets="Build">
<ItemGroup>
<ViteDistFiles Include="..\my-vite-app\dist\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ViteDistFiles)" DestinationFolder="$(OutDir)wwwroot\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target> -->
<!-- <ItemGroup>
<Content Include="..\my-vite-app\dist\**" LinkBase="wwwroot" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup> -->
</Project>

View File

@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lst-wrapper", "lst-wrapper.csproj", "{073770C2-0E50-484C-BB72-0A7B602D10B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{073770C2-0E50-484C-BB72-0A7B602D10B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{073770C2-0E50-484C-BB72-0A7B602D10B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{073770C2-0E50-484C-BB72-0A7B602D10B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{073770C2-0E50-484C-BB72-0A7B602D10B7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {39D31A4B-FECC-425A-9AD5-95EF563F5BE7}
EndGlobalSection
EndGlobal

View File

@@ -1,5 +1,10 @@
import { Link } from "@tanstack/react-router"; import { Link } from "@tanstack/react-router";
import {SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem} from "../../ui/sidebar"; import {
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "../../ui/sidebar";
export function Header() { export function Header() {
return ( return (
@@ -9,10 +14,16 @@ export function Header() {
<Link to="/"> <Link to="/">
<SidebarMenuButton size="lg" asChild> <SidebarMenuButton size="lg" asChild>
<div className="flex flex-row"> <div className="flex flex-row">
<img src="/imgs/dkLst.png" alt="Description" className="size-8" /> <img
src={"imgs/dkLst.png"}
alt="Description"
className="size-8"
/>
<div className="flex flex-col gap-0.5 leading-none"> <div className="flex flex-col gap-0.5 leading-none">
<span className="font-semibold">Logistics Support Tool</span> <span className="font-semibold">
Logistics Support Tool
</span>
<span className="">v2.0.0</span> <span className="">v2.0.0</span>
</div> </div>
</div> </div>

View File

@@ -242,7 +242,9 @@ export default function Lots() {
{lot.overPrinting} {lot.overPrinting}
</TableCell> </TableCell>
{user && {user &&
roles.includes(accessRoles[0].role) && ( roles.includes(
accessRoles[0]?.role
) && (
<> <>
{server === "usday1vms006" || {server === "usday1vms006" ||
server === "localhost" ? ( server === "localhost" ? (

View File

@@ -10,7 +10,10 @@ import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
// Create a client // Create a client
const queryClient = new QueryClient(); const queryClient = new QueryClient();
// Create a new router instance // Create a new router instance
const router = createRouter({routeTree}); const router = createRouter({
routeTree,
//basepath: import.meta.env.BASE_URL, // This is the key part!
});
// Register the router instance for type safety // Register the router instance for type safety
declare module "@tanstack/react-router" { declare module "@tanstack/react-router" {

View File

@@ -17,6 +17,7 @@ export default defineConfig({
tailwindcss(), tailwindcss(),
TanStackRouterVite({ target: "react", autoCodeSplitting: true }), TanStackRouterVite({ target: "react", autoCodeSplitting: true }),
], ],
// base: "/lst", // this is whats showing in the ssl version and we need this to work on both versions that also have a port on them.
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),

View File

@@ -8,9 +8,10 @@
"dev:frontend": "cd frontend && npm run dev", "dev:frontend": "cd frontend && npm run dev",
"dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts", "dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts",
"dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts", "dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts",
"build": "npm run build:server && npm run build:frontend && npm run zipServer && npm run dev", "build": "npm run build:server && npm run build:frontend && npm run build:iisNet && npm run zipServer && npm run dev",
"build:server": "rimraf dist && tsc --build && npm run copy:scripts && xcopy server\\services\\notifications\\utils\\views\\ dist\\server\\services\\notifications\\utils\\views\\ /E /I /Y", "build:server": "rimraf dist && tsc --build && npm run copy:scripts && xcopy server\\services\\notifications\\utils\\views\\ dist\\server\\services\\notifications\\utils\\views\\ /E /I /Y",
"build:frontend": "cd frontend && npm run build", "build:frontend": "cd frontend && npm run build",
"build:iisNet": "rimraf dotnetwrapper\\bin && xcopy frontend\\dist dotnetwrapper\\wwwroot /E /I /Y && cd dotnetwrapper && dotnet publish lst-wrapper.csproj --configuration Release --output ../prodBuild",
"copy:scripts": "tsx server/scripts/copyScripts.ts", "copy:scripts": "tsx server/scripts/copyScripts.ts",
"copy:servers": "xcopy server\\services\\server\\utils\\serverData.json dist\\server\\services\\server\\utils /E /I /Y", "copy:servers": "xcopy server\\services\\server\\utils\\serverData.json dist\\server\\services\\server\\utils /E /I /Y",
"start": "set NODE_ENV=production && npm run start:server", "start": "set NODE_ENV=production && npm run start:server",
@@ -35,7 +36,7 @@
} }
}, },
"admConfig": { "admConfig": {
"build": 410, "build": 418,
"oldBuild": "backend-0.1.3.zip" "oldBuild": "backend-0.1.3.zip"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -37,6 +37,7 @@ const ignoreList = [
"frontend/components.json", "frontend/components.json",
//misc files //misc files
"jsTesting", "jsTesting",
"dotnetwrapper",
]; ];
const shouldIgnore = (itemPath: any) => { const shouldIgnore = (itemPath: any) => {

View File

@@ -0,0 +1,24 @@
import { format } from "date-fns-tz";
import { tryCatch } from "../../../globalUtils/tryCatch.js";
import { query } from "../../sqlServer/prodSqlServer.js";
import { financeAudit } from "../../sqlServer/querys/dataMart/financeAudit.js";
export const getfinanceAudit = async (date: any) => {
let inventoryAudit: any = [];
const { data, error } = (await tryCatch(
query(financeAudit.replace("[date]", date), "inventory audit")
)) as any;
//console.log(data);
if (error) {
return [];
}
inventoryAudit = data.data.map((i: any) => {
return { ...i, bookinDate: format(i.bookinDate, "MM/dd/yyyy") };
});
return inventoryAudit;
};

View File

@@ -8,6 +8,7 @@ import getDeliveryByDate from "./route/getDeliveryDateByRange.js";
import fakeEDI from "./route/fakeEDI.js"; import fakeEDI from "./route/fakeEDI.js";
import addressCorrections from "./route/getCityStateData.js"; import addressCorrections from "./route/getCityStateData.js";
import fifoIndex from "./route/getFifoIndex.js"; import fifoIndex from "./route/getFifoIndex.js";
import financeAudit from "./route/getFinanceAudit.js";
const app = new OpenAPIHono(); const app = new OpenAPIHono();
@@ -21,6 +22,7 @@ const routes = [
fakeEDI, fakeEDI,
addressCorrections, addressCorrections,
fifoIndex, fifoIndex,
financeAudit,
] as const; ] as const;
const appRoutes = routes.forEach((route) => { const appRoutes = routes.forEach((route) => {

View File

@@ -111,6 +111,14 @@ const current: any = [
"Returns fifo index for all pallets shipped within the last 90 days.", "Returns fifo index for all pallets shipped within the last 90 days.",
//criteria: "address", // uncomment this out once the improt process can be faster //criteria: "address", // uncomment this out once the improt process can be faster
}, },
{
name: "Finance Audit inv",
endpoint: "/api/datamart/getfinanceaudit",
// description: "Returns all inventory, by default excludes running numebrs, also excludes inv locations.",
description:
"Returns all inventory past the date provided, ie: 5/31/2025",
criteria: "date", // uncomment this out once the improt process can be faster
},
]; ];
app.openapi( app.openapi(

View File

@@ -0,0 +1,69 @@
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { apiHit } from "../../../globalUtils/apiHits.js";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import { getfinanceAudit } from "../controller/getFinanceAudit.js";
import { tryCatch } from "../../../globalUtils/tryCatch.js";
const app = new OpenAPIHono({ strict: false });
const EomStat = z.object({
plant: z.string().openapi({ example: "Salt Lake City" }),
userRan: z.string().openapi({ example: "smith034" }),
eomSheetVersion: z.string().openapi({ example: "0.0.223" }),
});
app.openapi(
createRoute({
tags: ["dataMart"],
summary:
"Returns inventory to date and current sales prices and booking date of the inventory.",
method: "get",
path: "/getfinanceaudit",
responses: responses(),
}),
async (c: any) => {
//const body = await c.req.json();
// make sure we have a vaid user being accessed thats really logged in
const { data, error } = (await tryCatch(c.req.query())) as any;
//console.log(data.date);
if (error) {
return {
success: false,
message: "Missing Mandatory Data",
data: error,
};
}
if (!data.date) {
return {
success: false,
message: "Missing Date",
data: [],
};
}
apiHit(c, { endpoint: "/getfinanceaudit", lastBody: data });
try {
return c.json(
{
success: true,
message: `Inventory older than ${data.date}`,
data: await getfinanceAudit(data.date),
},
200
);
} catch (error) {
return c.json(
{
success: false,
message: "There was an error getting inventory data",
data: error,
},
400
);
}
}
);
export default app;

View File

@@ -17,6 +17,8 @@ export const pickedup = async (data: any) => {
}; };
} }
console.log(data);
if (data.areaFrom) { if (data.areaFrom) {
try { try {
const updateRn = await db const updateRn = await db

View File

@@ -49,6 +49,6 @@ export const palletSendTag = async (tagData: any) => {
Date.now() - tagTime <= 5000 && Date.now() - tagTime <= 5000 &&
!tagData.value !tagData.value
) { ) {
await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper1" }); await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper_1" });
} }
}; };

View File

@@ -0,0 +1,55 @@
export const financeAudit = `
use AlplaPROD_test1
select
(select wert from dbo.T_SystemParameter where Bezeichnung = 'Werkskuerzel') as Plant,
b.IdArtikelVarianten
,ArtikelVariantenAlias
,ArtikelVariantenBez
,sum(EinlagerungsMengeVPKSum) totalPal
,sum(EinlagerungsMengeSum) totalPieces
--,ProduktionsDatumMin
,pp.VKPreis as salesPrice
,sp.EKPreis as purhcasePrice
,convert(date, ProduktionsDatumMin, 111) as bookinDate
,DATEDIFF(DAY, convert(date, ProduktionsDatumMin, 111), getdate()) as aged
--,*
from dbo.V_LagerPositionenBarcodes (nolock) b
/* purhcase price */
left join
(select * from (select
IdArtikelvarianten
,VKPreis
,ROW_NUMBER() OVER (PARTITION BY IdArtikelVarianten ORDER BY gueltigabDatum DESC) AS rn
--,*
from T_HistoryVK (nolock))c
where rn = 1) as pp on
b.IdArtikelVarianten = pp.IdArtikelvarianten
/* sales price */
left join
(select * from (select
IdArtikelvarianten
,EKPreis
,ROW_NUMBER() OVER (PARTITION BY IdArtikelVarianten ORDER BY gueltigabDatum DESC) AS rn
--,*
from T_HistoryEK (nolock) )x
where rn = 1) sp on
sp.IdArtikelvarianten = b.IdArtikelVarianten
where IdWarenlager not in (1,5,6)
and ProduktionsDatumMin < '[date]' -- '2025-05-31'
group by b.IdArtikelVarianten
,ArtikelVariantenAlias
,ArtikelVariantenBez
,convert(date, ProduktionsDatumMin, 111)
,pp.VKPreis
,sp.EKPreis
order by IdArtikelVarianten
`;