Compare commits
13 Commits
d32289c833
...
37f2518589
| Author | SHA1 | Date | |
|---|---|---|---|
| 37f2518589 | |||
| 90be86d972 | |||
| 68d75277c2 | |||
| 84aacd5b71 | |||
| c72b4d3261 | |||
| b397fd7f32 | |||
| f90ce8cba7 | |||
| 88c1c29437 | |||
| f7c9f93d30 | |||
| 83f31b97f5 | |||
| b97f8175f9 | |||
| 92901a8762 | |||
| 0071237b24 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -11,6 +11,10 @@ backend-0.1.2-218.zip
|
||||
backend-0.1.2.zip
|
||||
postgresql-17.2-3-windows-x64.exe
|
||||
jsTesting
|
||||
dotnetwrapper/bin
|
||||
dotnetwrapper/obj
|
||||
dotnetwrapper/wwwroot
|
||||
prodBuild
|
||||
|
||||
|
||||
# ---> Node
|
||||
|
||||
26
dotnetwrapper/Program.cs
Normal file
26
dotnetwrapper/Program.cs
Normal 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();
|
||||
23
dotnetwrapper/Properties/launchSettings.json
Normal file
23
dotnetwrapper/Properties/launchSettings.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
dotnetwrapper/appsettings.json
Normal file
9
dotnetwrapper/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
27
dotnetwrapper/lst-wrapper.csproj
Normal file
27
dotnetwrapper/lst-wrapper.csproj
Normal 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>
|
||||
24
dotnetwrapper/lst-wrapper.sln
Normal file
24
dotnetwrapper/lst-wrapper.sln
Normal 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
|
||||
@@ -1,5 +1,10 @@
|
||||
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() {
|
||||
return (
|
||||
@@ -9,10 +14,16 @@ export function Header() {
|
||||
<Link to="/">
|
||||
<SidebarMenuButton size="lg" asChild>
|
||||
<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">
|
||||
<span className="font-semibold">Logistics Support Tool</span>
|
||||
<span className="font-semibold">
|
||||
Logistics Support Tool
|
||||
</span>
|
||||
<span className="">v2.0.0</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -242,7 +242,9 @@ export default function Lots() {
|
||||
{lot.overPrinting}
|
||||
</TableCell>
|
||||
{user &&
|
||||
roles.includes(accessRoles[0].role) && (
|
||||
roles.includes(
|
||||
accessRoles[0]?.role
|
||||
) && (
|
||||
<>
|
||||
{server === "usday1vms006" ||
|
||||
server === "localhost" ? (
|
||||
|
||||
@@ -10,7 +10,10 @@ import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
|
||||
// Create a client
|
||||
const queryClient = new QueryClient();
|
||||
// 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
|
||||
declare module "@tanstack/react-router" {
|
||||
|
||||
@@ -17,6 +17,7 @@ export default defineConfig({
|
||||
tailwindcss(),
|
||||
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: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
"dev:frontend": "cd frontend && npm run dev",
|
||||
"dev:dbgen": " drizzle-kit generate --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: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: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",
|
||||
@@ -35,7 +36,7 @@
|
||||
}
|
||||
},
|
||||
"admConfig": {
|
||||
"build": 410,
|
||||
"build": 418,
|
||||
"oldBuild": "backend-0.1.3.zip"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -37,6 +37,7 @@ const ignoreList = [
|
||||
"frontend/components.json",
|
||||
//misc files
|
||||
"jsTesting",
|
||||
"dotnetwrapper",
|
||||
];
|
||||
|
||||
const shouldIgnore = (itemPath: any) => {
|
||||
|
||||
24
server/services/dataMart/controller/getFinanceAudit.ts
Normal file
24
server/services/dataMart/controller/getFinanceAudit.ts
Normal 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;
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import getDeliveryByDate from "./route/getDeliveryDateByRange.js";
|
||||
import fakeEDI from "./route/fakeEDI.js";
|
||||
import addressCorrections from "./route/getCityStateData.js";
|
||||
import fifoIndex from "./route/getFifoIndex.js";
|
||||
import financeAudit from "./route/getFinanceAudit.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
@@ -21,6 +22,7 @@ const routes = [
|
||||
fakeEDI,
|
||||
addressCorrections,
|
||||
fifoIndex,
|
||||
financeAudit,
|
||||
] as const;
|
||||
|
||||
const appRoutes = routes.forEach((route) => {
|
||||
|
||||
@@ -111,6 +111,14 @@ const current: any = [
|
||||
"Returns fifo index for all pallets shipped within the last 90 days.",
|
||||
//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(
|
||||
|
||||
69
server/services/dataMart/route/getFinanceAudit.ts
Normal file
69
server/services/dataMart/route/getFinanceAudit.ts
Normal 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;
|
||||
@@ -17,6 +17,8 @@ export const pickedup = async (data: any) => {
|
||||
};
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
|
||||
if (data.areaFrom) {
|
||||
try {
|
||||
const updateRn = await db
|
||||
|
||||
@@ -49,6 +49,6 @@ export const palletSendTag = async (tagData: any) => {
|
||||
Date.now() - tagTime <= 5000 &&
|
||||
!tagData.value
|
||||
) {
|
||||
await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper1" });
|
||||
await pickedup({ runningNr: 1234, all: true, areaFrom: "wrapper_1" });
|
||||
}
|
||||
};
|
||||
|
||||
55
server/services/sqlServer/querys/dataMart/financeAudit.ts
Normal file
55
server/services/sqlServer/querys/dataMart/financeAudit.ts
Normal 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
|
||||
`;
|
||||
Reference in New Issue
Block a user