Existing code

This commit is contained in:
Stoyan Zlatev
2023-04-04 11:12:07 +02:00
parent 994af6e7af
commit fdfb42da9e
55 changed files with 2239 additions and 39 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
{
"CSD 770951": "Anglian Water",
"CSD 773102": "Yorkshire Water",
"38977_LP": "Stream/Leep"
}
@@ -18,16 +18,16 @@
public IController CreateController(RequestContext requestContext, string controllerName)
{
var controllerTypeName = requestContext.RouteData.DataTokens.TryGetValue("area", out object areaName)
var controllerTypeName = requestContext.RouteData.Values.TryGetValue("area", out object areaName)
? string.Format(AREAS_PATTERN, areaName, controllerName)
: string.Format(CONTROLLERS_PATTERN, controllerName);
var controllerType = Type.GetType(controllerTypeName, throwOnError: false, ignoreCase: true);
this.RedirectToDefaultIfNotFound(controllerType, requestContext.HttpContext.Response);
this.RedirectToDefault(controllerType, requestContext.HttpContext.Response);
var controller = this.serviceProvider.GetService(controllerType) as IController;
this.RedirectToDefaultIfNotFound(controller, requestContext.HttpContext.Response);
this.RedirectToDefault(controller, requestContext.HttpContext.Response);
return controller;
}
@@ -43,11 +43,11 @@
}
}
private void RedirectToDefaultIfNotFound(object resource, HttpResponseBase response)
private void RedirectToDefault(object resource, HttpResponseBase response)
{
if (response is null)
if (resource is null)
{
response.RedirectToRoute("MVC_Default");
response.Redirect("/");
response.End();
}
}
@@ -5,9 +5,6 @@
public class HomeController : Controller
{
[HttpGet]
public ActionResult Index()
{
return this.View();
}
public ActionResult Index() => this.View();
}
}
@@ -0,0 +1,98 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System.Web.Mvc;
[Authorize]
public class ProtocolController : Controller
{
public const string FilePDF = nameof(FilePDF);
private readonly IProtocolService protocolService;
public ProtocolController(IProtocolService protocolService)
=> this.protocolService = protocolService;
[HttpGet]
public ActionResult Index(int orderId = 0)
{
var orderClientModel = this.protocolService.FindOrder(orderId);
return this.View(orderClientModel);
}
[HttpPost]
public ActionResult Index(OrderClientModel model)
{
var files = this.Request.Files;
if (files.Count > 0)
{
var file = this.Request.Files.Get(0);
if (file.ContentType == "application/pdf" && model.ClientId > 0 && model.OrderId > 0)
{
model.FileId = this.protocolService.SaveFile(file.InputStream, model.ClientId.Value, model.OrderId.Value);
if (model.FileId > 0)
{
return this.RedirectToAction(nameof(this.Document), model);
}
else
{
this.TempData[FilePDF] = $"Der PDF Datei wurde nicht hochgeladen.";
}
}
else
{
this.TempData[FilePDF] = $"Bitte, PDF Datei hochladen.";
}
}
else
{
this.TempData[FilePDF] = "Kein PDF Datei wurde ausgewählt.";
}
return this.View(model);
}
[HttpGet]
public ActionResult Document(OrderClientModel model)
{
model.FileContent = this.protocolService.FileContent(model.FileId);
return this.View(model);
}
public ActionResult Clients(string search = null)
{
var clientsOrders = this.protocolService.FindOrdersByClient(search);
return this.PartialView(clientsOrders);
}
public ActionResult Orders(int search = 0)
{
var clientsOrders = this.protocolService.FindOrdersById(search);
return this.PartialView(clientsOrders);
}
public ActionResult Body(int orderId = 0)
{
var testStatus = this.protocolService.LoadTestStatus(orderId);
return this.PartialView(testStatus);
}
[HttpGet]
public ActionResult Print(int orderId = 0)
{
var orderClientModel = this.protocolService.FindOrder(orderId);
return this.View(orderClientModel);
}
}
}
@@ -0,0 +1,31 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.Services.Interfaces;
using System.Web.Mvc;
[Authorize]
public class SearchController : Controller
{
private readonly IOrdersService ordersService;
public SearchController(IOrdersService ordersService)
=> this.ordersService = ordersService;
[HttpGet]
public ActionResult Orders(string search)
{
var model = this.ordersService.FindOrders(search);
return this.PartialView(model);
}
[HttpGet]
public ActionResult Positions(string orderNr)
{
var model = this.ordersService.FindPositions(orderNr);
return this.PartialView(model);
}
}
}
@@ -0,0 +1,128 @@
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Web.Mvc;
using SystemFile = System.IO.File;
[Authorize]
public class ShipmentsController : Controller
{
private readonly IShipmentsService shipmentsService;
public ShipmentsController(IShipmentsService shipmentsService)
=> this.shipmentsService = shipmentsService;
[HttpGet]
public ActionResult Index()
=> this.View(new ShipmentModel());
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Index(ShipmentModel model)
=> this.View(model);
public ActionResult Batch(OrderScanModel model)
{
var batchModel = this.shipmentsService
.LoadBatchModel(model ?? new OrderScanModel());
this.UpdateClientName(batchModel);
return this.PartialView(batchModel);
}
public ActionResult Scan(OrderScanModel model)
{
var palletsCount = this.shipmentsService.GetPalletsCount(model);
model.UpdatePalletsCount(palletsCount);
return this.PartialView(model);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ScanPost(OrderScanModel model)
{
if (this.ModelState.IsValid)
{
model.Host = this.HttpContext.Request.UserHostAddress;
model.Place = this.HttpContext.Request.UserHostName;
model.SerialNr = model.SerialNr?.Replace(" ", string.Empty);
var result = this.shipmentsService.UpdateBatchModel(model);
if (result)
{
model.SerialNr = default(string);
}
else
{
this.TempData[nameof(model.SerialNr)] = result;
}
}
return this.View(nameof(this.Index), new ShipmentModel(model));
}
[HttpGet]
public ActionResult Delete(int id)
{
var orderScanModel = this.shipmentsService.DeletePalletEntry(id);
return this.View(nameof(this.Index), new ShipmentModel(orderScanModel));
}
[HttpGet]
public ActionResult Print(OrderScanModel model)
{
var batchModel = this.shipmentsService.LoadBatchModel(model);
var batchPrintModel = new BatchPrintModel(batchModel);
return this.View(batchPrintModel);
}
[HttpGet]
public ActionResult Download(OrderScanModel model)
{
var batchBuffer = this.shipmentsService.LoadBatchBuffer(model);
var fileName = $"{model.OrderNr}_{model.PositionNr}_{model.PalletsCount}.csv";
this.Response.AddHeader("Content-Disposition", $"attachment;filename={fileName}");
return this.File(batchBuffer, "application/vnd.ms-excel");
}
private void UpdateClientName(PalletsBatchModel batchModel)
{
try
{
var path = this.Server.MapPath("~/App_Data/client_map.json");
var jsonContent = SystemFile.ReadAllText(path);
var clientMap = JsonConvert.DeserializeObject<IDictionary<string, string>>(jsonContent);
var additionalText = batchModel.AdditionalText ?? string.Empty;
foreach (var kvp in clientMap)
{
if (additionalText.Contains(kvp.Key))
{
batchModel.ClientName = kvp.Value;
break;
}
}
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
}
}
@@ -69,8 +69,8 @@
<Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -93,6 +93,9 @@
<Reference Include="System.Web.Mvc, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.9\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.9\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
@@ -118,21 +121,12 @@
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -145,6 +139,9 @@
<Compile Include="App_Start\ServicesConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ProtocolController.cs" />
<Compile Include="Controllers\SearchController.cs" />
<Compile Include="Controllers\ShipmentsController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@@ -160,19 +157,36 @@
<Content Include="App_Content\svg\sensus_xylem_logo.svg" />
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Web.config" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\Web.config" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<None Include="packages.config" />
<Content Include="Views\Shared\_PrintLayout.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
<Content Include="App_Content\font\fonts\bootstrap-icons.woff2" />
<None Include="packages.config" />
<Content Include="libman.json" />
<Content Include="App_Content\css\bootstrap.min.css.map" />
<Content Include="App_Data\client_map.json" />
<Content Include="Views\Protocol\Body.cshtml" />
<Content Include="Views\Protocol\Clients.cshtml" />
<Content Include="Views\Protocol\Document.cshtml" />
<Content Include="Views\Protocol\Index.cshtml" />
<Content Include="Views\Protocol\Orders.cshtml" />
<Content Include="Views\Protocol\Print.cshtml" />
<Content Include="Views\Search\Orders.cshtml" />
<Content Include="Views\Search\Positions.cshtml" />
<Content Include="Views\Shipments\Batch.cshtml" />
<Content Include="Views\Shipments\Index.cshtml" />
<Content Include="Views\Shipments\Print.cshtml" />
<Content Include="Views\Shipments\Scan.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj">
@@ -1,8 +1,4 @@
@{
ViewBag.Title = "Home Page";
}
<div class="container my-5 py-5">
<div class="container my-5 py-5">
<div class="row">
<div class="col-12">
<div class="jumbotron">
@@ -0,0 +1,74 @@
@model IEnumerable<LaaProductionWeb.Services.Models.TestStatus>
@{
Func<bool?, string> testPassed = testStatus =>
{
if (testStatus is null)
{
return "bi bi-check2 text-secondary opacity-25 fs-3";
}
else if (testStatus == false)
{
return "bi bi-x text-danger fs-3";
}
else
{
return "bi bi-check2 text-teal fs-3";
}
};
}
<tbody>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th class="white-space-nowrap">Pos. No.</th>
<th class="white-space-nowrap">Serial No.</th>
<th>Tightness Test</th>
<th>Pressure and burst test composit transducer</th>
<th>Metrological testing</th>
<th>Config comparison and radio test</th>
</tr>
<tr>
<th colspan="2">Acceptance Norms</th>
<td>Rejected in case of leakage</td>
<td>Rejected in case of leakage or breakage</td>
<td>
Maximum Permissible Error at
<br>Q1 < ± 5%
<br>Q2 < ± 2%
<br>Q3 < ± 2%
</td>
<td>
Main functions,
<br>LCD display,
<br>LED,
<br>Radio functions according to specs
<br>
<br>Parameter readable and according to customer specification
</td>
</tr>
@foreach (var item in this.Model)
{
<tr>
<td class="va-middle">@item.PosNr</td>
<td class="va-middle white-space-nowrap px-5">@item.SerialNr</td>
<td class="text-center">
<bi class="@testPassed(item.HeliumTest)"></bi>
</td>
<td class="text-center">
<bi class="@testPassed(item.PressureTest)"></bi>
</td>
<td class="text-center">
<bi class="@testPassed(item.MetroTest)"></bi>
</td>
<td class="text-center">
<bi class="@testPassed(item.RadioTest)"></bi>
</td>
</tr>
}
</table>
</td>
</tr>
</tbody>
@@ -0,0 +1,16 @@
@model IEnumerable<KeyValuePair<int, string>>
@if (this.Model != null && this.Model.Any())
{
foreach (var kvp in this.Model)
{
<li><a class="dropdown-item" href="#@kvp.Key">@kvp.Key - @kvp.Value</a></li>
}
}
else
{
<li>
<a class="dropdown-item text-secondary bg-light text-normal" href="#"><i class="bi bi-search"></i> Search by client name</a>
</li>
}
@@ -0,0 +1,19 @@
@model OrderClientModel
@using LaaProductionWeb.Services.Models
<form>
@this.Html.HiddenFor(x => x.FileId)
@this.Html.HiddenFor(x => x.OrderId)
@this.Html.HiddenFor(x => x.ClientId)
@this.Html.HiddenFor(x => x.ClientName)
@this.Html.HiddenFor(x => x.Positions)
</form>
<div class="container-fluid h-100 p-0">
<div class="row h-100">
<div class="position-relative h-100">
<iframe class="position-absolute align-top align-left w-100 h-100" src="@this.Model.FileContent" frameborder="0" allowfullscreen />
</div>
</div>
</div>
@@ -0,0 +1,133 @@
@model OrderClientModel
@using LaaProductionWeb.Controllers
@using LaaProductionWeb.Services.Models
<table class="table table-bordered">
<thead>
<tr>
<th class="align-top p-0 w-100">
<table class="table table-bordered">
<tr>
<td colspan="2" class="py-1 fs-5 white-space-nowrap text-center text-smallcaps">Test Protocol</td>
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="client_name">Client</label></td>
<td class="p-1 dropdown">
<input id="client_name" class="form-control border-0 rounded-0" value="@this.Model.ClientName" />
<ul class="dropdown-menu mt-2 w-100" id="client_name_options">
<li class="text-secondary bg-light text-normal">Search by client name</li>
</ul>
</td>
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="order_no">Order No.</label></td>
<td class="p-1">
<input id="order_no" class="form-control border-0 rounded-0" value="@this.Model.OrderId" />
<ul class="dropdown-menu mt-2 w-100" id="order_no_options">
<li class="text-secondary bg-light text-normal">Search by order no.</li>
</ul>
</td>
</tr>
<tr class="border-bottom-0">
<td class="py-1 white-space-nowrap va-middle">Positions</td>
<td class="p-1">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.Positions))
{
<span class="text-white">...</span>
}
else
{
<span>@this.Model.Positions</span>
}
</div>
</td>
</tr>
</table>
</th>
<th class="text-center va-middle w-auto">
<img src="~/App_Content/svg/sensus_xylem_logo.svg" width="210" class="mx-5"/>
<form action="/Protocol/Index" method="post" enctype="multipart/form-data">
@this.Html.HiddenFor(x => x.OrderId)
@this.Html.HiddenFor(x => x.ClientId)
@this.Html.HiddenFor(x => x.ClientName)
@this.Html.HiddenFor(x => x.Positions)
<input name="FilePDF" id="FilePDF" type="file" class="d-none" accept="application/pdf" />
<div class="input-group flex-nowrap mt-3">
<a class="btn btn-light white-space-nowrap" href="/Protocol/Print?orderId=@this.Model.OrderId" target="_blank"><i class="bi bi-printer me-2"></i> Vorschau</a>
<label for="FilePDF" class="btn btn-outline-light border text-dark white-space-nowrap"><i class="bi bi-filetype-pdf"></i> Auswählen</label>
<button type="submit" class="btn btn-success white-space-nowrap"><i class="bi bi-upload"></i> Hochladen</button>
</div>
@if (this.TempData.TryGetValue(ProtocolController.FilePDF, out object errorMessage))
{
<div class="text-danger small">
@($"{errorMessage}")
</div>
}
</form>
</th>
</tr>
</thead>
@if (this.Model.OrderId > 0)
{
this.Html.RenderAction(nameof(ProtocolController.Body), new { orderId = this.Model.OrderId });
}
</table>
@section scripts {
<script>
document.addEventListener("DOMContentLoaded", () => {
const show = 'show';
let clientNrInput = document.getElementById('client_name');
let clientMenu = document.getElementById('client_name_options');
if (clientNrInput && clientMenu) {
clientNrInput.oninput = function loadOrdersByOrderNr() {
setTimeout(function handler() {
let search = clientNrInput.value;
if (search && search.length > 3) {
fetch(`/Protocol/Clients?search=${search}`)
.then(response => response.text())
.then(orderItems => {
clientMenu.innerHTML = orderItems;
clientMenu.classList.add(show);
})
} else {
clientMenu.classList.remove(show);
}
}, 50);
};
}
let orderNrInput = document.getElementById('order_no');
let orderMenu = document.getElementById('order_no_options');
if (orderNrInput && orderMenu) {
orderNrInput.oninput = function loadOrdersByOrderNr() {
setTimeout(function handler() {
let search = orderNrInput.value;
if (search && search.length > 3) {
fetch(`/Protocol/Orders?search=${search}`)
.then(response => response.text())
.then(orderItems => {
orderMenu.innerHTML = orderItems;
orderMenu.classList.add(show);
})
} else {
orderMenu.classList.remove(show);
}
}, 50);
};
}
window.addEventListener('hashchange', function () {
clientMenu.classList.remove(show);
orderMenu.classList.remove(show);
location.href = `/Protocol?orderId=${location.hash.substring(1)}`
});
});
</script>
}
@@ -0,0 +1,15 @@
@model IEnumerable<KeyValuePair<int, string>>
@if (this.Model != null && this.Model.Any())
{
foreach (var kvp in this.Model)
{
<li><a class="dropdown-item" href="#@kvp.Key">@kvp.Key - @kvp.Value</a></li>
}
}
else
{
<li>
<a class="dropdown-item text-secondary bg-light text-normal" href="#"><i class="bi bi-search"></i> Search by order no.</a>
</li>
}
@@ -0,0 +1,74 @@
@model OrderClientModel
@using LaaProductionWeb.Controllers
@using LaaProductionWeb.Services.Models
@{
this.Layout = "~/Views/Shared/_PrintLayout.cshtml";
}
<table class="table table-bordered">
<thead>
<tr>
<th class="align-top p-0 w-100">
<table class="table table-bordered">
<tr>
<td colspan="2" class="py-1 fs-5 white-space-nowrap text-center text-smallcaps">Test Protocol</td>
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="client_name">Client</label></td>
<td class="p-1 dropdown">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.ClientName))
{
<span class="text-white">...</span>
}
else
{
<span>@this.Model.ClientName</span>
}
</div>
</td>
</tr>
<tr>
<td class="py-1 white-space-nowrap va-middle"><label for="order_no">Order No.</label></td>
<td class="p-1">
<div class="form-control border-0 rounded-0">
@if (this.Model.OrderId is null)
{
<span class="text-white">...</span>
}
else
{
<span>@this.Model.OrderId</span>
}
</div>
</td>
</tr>
<tr class="border-bottom-0">
<td class="py-1 white-space-nowrap va-middle">Positions</td>
<td class="p-1">
<div class="form-control border-0 rounded-0">
@if (string.IsNullOrWhiteSpace(this.Model.Positions))
{
<span class="text-white">...</span>
}
else
{
<span>@this.Model.Positions</span>
}
</div>
</td>
</tr>
</table>
</th>
<th class="text-center va-middle w-auto p-3">
<img src="~/App_Content/svg/sensus_xylem_logo.svg" width="210" class="mx-5" />
</th>
</tr>
</thead>
@if (this.Model.OrderId > 0)
{
this.Html.RenderAction(nameof(ProtocolController.Body), new { orderId = this.Model.OrderId });
}
</table>
@@ -0,0 +1,6 @@
@model LaaProductionWeb.Services.Models.OrdersFoundModel
@foreach (var order in this.Model)
{
<li><a class="dropdown-item" href="#@order.Nr,@order.ProductionOrderNr">@($"{order.OrderNr, 10} / {order.ProductionOrderNr, 10}") - @order.ClientName</a></li>
}
@@ -0,0 +1,6 @@
@model LaaProductionWeb.Services.Models.OrderPositions
@foreach (var position in this.Model)
{
<li><span class="dropdown-item">@position</span></li>
}
@@ -8,7 +8,7 @@
}
<!DOCTYPE html>
<html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
@Styles.Render("~/bootstrap_css")
@Styles.Render("~/bootstrap_icons")
@Styles.Render("~/styles_css")
</head>
<body>
@this.RenderBody()
@Scripts.Render("~/bootstrap_js")
@Scripts.Render("~/barcodes_js")
@Scripts.Render("~/scripts_js")
@this.RenderSection("scripts", required: false)
</body>
</html>
@@ -0,0 +1,72 @@
@using LaaProductionWeb.Services.Models
@model PalletsBatchModel
<div class="d-flex justify-content-center">
<div id="batch" class="print-page border rounded shadow-sm mt-5 p-5">
<div class="table-responsive">
<table>
<tr>
<th colspan="2" class="fs-5">Paletten Begleitschein</th>
<th colspan="2" class="fs-5">@this.Model.ClientName</th>
</tr>
<tr>
<td class="py-0 pe-3 white-space-nowrap">Kunden-Auftrag/Pos.Nr.</td>
<td class="py-0 pe-3">@this.Model.OrderNr/@this.Model.PositionNr</td>
<td class="py-0 pe-3 white-space-nowrap">Fertigungsauftrags-Nr.</td>
<td class="py-0 pe-3">@this.Model.ProductionOrderNr</td>
</tr>
<tr>
<td class="py-0 pe-3 white-space-nowrap">Auftragsmenge</td>
<td class="py-0 pe-3">@this.Model.TotlalItemsCount</td>
<td class="py-0 pe-3 white-space-nowrap">Typ</td>
<td class="py-0 pe-3">@this.Model.ItemsType</td>
</tr>
</table>
<table class="table table-borderless table-striped">
<thead>
<tr>
<th>Nr.</th>
<th class="w-100">Serial Nr.</th>
<th class="w-100">Barcode</th>
<th class="white-space-nowrap">Paletten Nr.</th>
<th class="w-100"></th>
</tr>
</thead>
<tbody>
@{
var count = 1;
foreach (var item in this.Model.Items)
{
<tr class="is_scaned_@(item.IsScaned ? 1 : 0)">
<td class="va-middle @(item.IsScaned ? null : "text-secondary")">@(count++).</td>
<td class="va-middle w-100 @(item.IsScaned ? null : "text-secondary")">@item.BarcodeNr</td>
<td class="va-middle w-100 text-center">
<svg class="barcode"
jsbarcode-format="auto"
jsbarcode-value="@item.BarcodeNr"
jsbarcode-displayValue="false"
jsbarcode-background="transparent"
jsbarcode-lineColor="@(item.IsScaned ? "black" : "#ced4da")"
jsbarcode-height="50"
jsbarcode-margin="0"
jsbarcode-textmargin="0"
jsbarcode-fontoptions="bold">
</svg>
</td>
<td class="va-middle text-end">@(item.IsScaned ? item.PalletNr : null)</td>
<td class="va-middle text-center">
<a class="btn btn-sm btn-danger" href="/Shipments/Delete/@item.Id">
<i class="bi bi-x"></i>
</a>
</td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
</div>
@@ -0,0 +1,150 @@
@using LaaProductionWeb.Controllers
@using LaaProductionWeb.Services.Models
@model ShipmentModel
<div class="container-fluid h-100">
<div class="row h-100 overflow-hidden">
<div class="col-md-3 py-3 h-100 scrollable-sm bg-light border-end shadow-sm">
<h5 class="text-smallcaps">Palettenbegleiter</h5>
<hr />
<form id="order_form" action="/Shipments" method="post" autocomplete="off">
@this.Html.AntiForgeryToken()
<div class="form-floating mb-3 dropdown">
@this.Html.TextBoxFor(x => x.OrderNr, new { id = "order_nr", @class = "form-control", placeholder = "0000000000" })
@this.Html.LabelFor(x => x.OrderNr, new { @for = "order_nr", @class = "text-smallcaps" })
@this.Html.ValidationMessageFor(x => x.OrderNr, string.Empty, new { @class = "small text-danger m-0 p-0" })
<ul id="order_nr_menu" class="dropdown-menu w-100 mt-1"></ul>
</div>
<div class="form-floating mb-3 dropdown">
@this.Html.TextBoxFor(x => x.PositionNr, new { id = "pos_nr", @class = "form-control", placeholder = "0000000000" })
@this.Html.LabelFor(x => x.PositionNr, new { @for = "pos_nr", @class = "text-smallcaps" })
@this.Html.ValidationMessageFor(x => x.PositionNr, string.Empty, new { @class = "small text-danger m-0 p-0" })
<i class="bi bi-chevron-down" style="position: absolute;right: 3.5%;top: 35%;"></i>
<ul id="pos_nr_menu" class="dropdown-menu w-100 mt-1">
<li class="dropdown-item disabled white-space-break">Keine Positionen vorhanden.</li>
</ul>
</div>
<div class="form-floating mb-3">
<button type="submit" class="btn btn-primary py-3 w-100 text-smallcaps">
@this.Model.BtnSubmit <i class="bi bi-chevron-right ms-2"></i>
</button>
</div>
</form>
@if (this.IsPost || this.Model.HasOrder)
{
this.Html.RenderAction(nameof(ShipmentsController.Scan), this.Model.OrderScanModel);
}
</div>
<div class="col-md-9 h-100 scrollable-sm pb-5">
@if (this.IsPost || this.Model.HasOrder)
{
this.Html.RenderAction(nameof(ShipmentsController.Batch), this.Model.OrderScanModel);
}
</div>
</div>
</div>
@section scripts {
<script>
(function autocompleteHandler() {
const show = 'show';
let orderNrInput = document.getElementById('order_nr');
let orderNrMenu = document.getElementById('order_nr_menu');
let positionNrInput = document.getElementById('pos_nr');
let positionNrMenu = document.getElementById('pos_nr_menu');
let orderChanged = false;
function ordersAutocomplete(orders) {
if (orders) {
orderNrMenu.innerHTML = orders;
if (orderNrMenu.children.length == 1) {
let firstOrder = orderNrMenu.querySelector('a.dropdown-item');
if (firstOrder) {
firstOrder.click();
} else {
orderNrMenu.classList.add(show);
}
} else {
orderNrMenu.classList.add(show);
}
}
}
function onOrderNrInput() {
orderNrMenu.classList.remove(show);
orderNrMenu.innerHTML = null;
let orderNr = orderNrInput.value;
if (orderNr && orderNr.length > 3) {
fetch(`/Search/Orders?search=${orderNr}`)
.then(response => response.text())
.then(data => ordersAutocomplete(data))
.catch(error => console.log(error));
}
}
function positionsHandler(data) {
const dropdownItemSelector = '#pos_nr_menu span.dropdown-item';
positionNrMenu.innerHTML = data;
positionNrMenu
.querySelectorAll(dropdownItemSelector)
.forEach(x => x.onclick = function (e) {
positionNrInput.value = e.target.innerText;
document
.getElementById('order_form')
.submit();
});
orderNrMenu.classList.remove(show);
if (orderChanged) {
orderChanged = false;
positionNrInput.value = positionNrMenu
.querySelector(dropdownItemSelector)
.innerHTML;
document
.getElementById('order_form')
.submit();
}
}
function getPositions(orderNr) {
if (orderNr && orderNr.length > 3) {
fetch(`/Search/Positions?ordernr=${orderNr}`)
.then(response => response.text())
.then(data => positionsHandler(data))
.catch(error => console.log(error));
}
}
window.addEventListener('hashchange', function () {
if (location.hash) {
orderChanged = true;
let orderNr = location
.hash
.substring(1)
.split(',')[0];
orderNrInput.value = orderNr;
getPositions(orderNr);
}
});
orderNrInput.oninput = function () {
setTimeout(onOrderNrInput, 50);
};
positionNrInput.setAttribute('data-bs-toggle', 'dropdown');
positionNrInput.setAttribute('aria-expanded', 'false');
positionNrMenu.innerHTML = '<li class="dropdown-item disabled white-space-break">Keine Positionen vorhanden.</li>';
getPositions('@this.Model.OrderNr');
JsBarcode(".barcode").init();
let serialNrInput = document.getElementById('serial_nr');
if (serialNrInput) {
serialNrInput.focus({ focusVisible: true });
}
})();
</script>
}
@@ -0,0 +1,91 @@
@model LaaProductionWeb.Services.Models.BatchPrintModel
@{
this.Layout = "~/Views/Shared/_PrintLayout.cshtml";
var items = this.Model.Items;
var itemsLength = items.Length;
}
<table class="table table-borderless table-striped">
<thead>
<tr>
<th colspan="6" class="px-0">
<table class="table table-borderless">
<thead>
<tr>
<th colspan="2" class="fs-4">Paletten Begleitschein</th>
<th colspan="2" class="fs-4">@this.Model.ClientName</th>
</tr>
<tr>
<td class="py-0 white-space-nowrap">Kunden-Auftrag/Pos.Nr.</td>
<td class="py-0 fw-normal">@this.Model.OrderNr/@this.Model.PositionNr</td>
<td class="py-0 white-space-nowrap">Fertigungsauftrags-Nr.</td>
<td class="py-0 fw-normal">@this.Model.ProductionOrderNr</td>
</tr>
<tr>
<td class="py-0 white-space-nowrap">Auftragsmenge</td>
<td class="py-0 fw-normal">@this.Model.TotlalItemsCount</td>
<td class="py-0 white-space-nowrap">Typ</td>
<td class="py-0 fw-normal">@this.Model.ItemsType</td>
</tr>
</thead>
</table>
</th>
</tr>
<tr>
<th class="small">No.</th>
<th class="small">Serial No.</th>
<th class="small"></th>
<th class="small">No.</th>
<th class="small">Serial No.</th>
<th class="small"></th>
</tr>
</thead>
<tbody>
@for (var i = 0; i < itemsLength; i += 2)
{
var ni = i + 1;
var item = items[i];
<tr>
<td class="va-middle">@(i + 1)</td>
<td class="va-middle">@item.BarcodeNr</td>
<td class="va-middle">
<svg class="barcode"
jsbarcode-height="50"
jsbarcode-format="auto"
jsbarcode-displayValue="false"
jsbarcode-background="transparent"
jsbarcode-value="@item.BarcodeNr" />
</td>
@if (ni < itemsLength)
{
var nitem = items[ni];
<td class="va-middle">@(ni + 1)</td>
<td class="va-middle">@nitem.BarcodeNr</td>
<td class="va-middle">
<svg class="barcode"
jsbarcode-height="50"
jsbarcode-format="auto"
jsbarcode-displayValue="false"
jsbarcode-background="transparent"
jsbarcode-value="@nitem.BarcodeNr" />
</td>
}
else
{
<td></td>
<td></td>
<td></td>
}
</tr>
}
</tbody>
</table>
@section scripts {
<script>
JsBarcode(".barcode").init();
</script>
}
@@ -0,0 +1,51 @@
@model LaaProductionWeb.Services.Models.OrderScanModel
<div>
<h5 class="text-smallcaps">@this.Model.ScanTitle</h5>
<hr />
</div>
<form id="scan_form" action="/Shipments/ScanPost" method="post" autocomplete="off">
@this.Html.AntiForgeryToken()
@this.Html.HiddenFor(x => x.OrderNr)
@this.Html.HiddenFor(x => x.PositionNr)
@this.Html.HiddenFor(x => x.PalletsCount)
<div class="d-flex flex-wrap">
@foreach (var pallet in this.Model.Pallets)
{
var css = pallet.Key != this.Model.PalletNr
? "btn btn-outline-success"
: "btn btn-success";
var id = $"pallet_{pallet.Key}";
<label for="@id" class="@css mb-3 me-3">@pallet.Key</label>
<input id="@id" name="@nameof(this.Model.PalletNr)" value="@pallet.Key" class="d-none" type="submit" />
}
<a class="btn btn-outline-secondary mb-3 me-3" href="@this.Model.PrintUrl" target="_blank">
<i class="bi bi-printer"></i> Druckvorschau
</a>
<a class="btn btn-outline-secondary mb-3 me-3" href="@this.Model.DownloadUrl">
<i class="bi bi-filetype-csv"></i> Herunterladen
</a>
</div>
<div class="input-group">
<div class="form-floating w-auto">
@this.Html.TextBoxFor(x => x.SerialNr, new { id = "serial_nr", @class = "form-control form-control-success text-center", placeholder = "0000000000" })
@this.Html.LabelFor(x => x.SerialNr, new { @for = "serial_nr", @class = "text-smallcaps" })
</div>
<div class="form-floating">
@this.Html.TextBoxFor(x => x.PalletNr, new { id = "pallet_nr", @class = "form-control form-control-success text-center", placeholder = "0" })
@this.Html.LabelFor(x => x.PalletNr, new { @for = "pallet_nr", @class = "text-smallcaps" })
</div>
</div>
@if (this.TempData.TryGetValue(nameof(this.Model.SerialNr), out object errorMessage))
{
<div class="text-danger small">
@($"{errorMessage}")
</div>
}
<div class="my-3">
<button class="btn btn-success py-3 w-100 text-smallcaps">
@this.Model.BtnSerialNr <i class="bi bi-chevron-right ms-2"></i>
</button>
</div>
</form>
@@ -9,6 +9,7 @@
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="ConnectionString" value="Data Source=SLASQL01.emea.sensus.net;Initial Catalog=Auftrag;Password=ServiceParingfile;Persist Security Info=True;User ID=ServiceParingfile;"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.2" />
@@ -53,6 +54,10 @@
<assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
@@ -0,0 +1,13 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "bootstrap@5.2.3",
"destination": "App_Content/",
"files": [
"css/bootstrap.min.css.map"
]
}
]
}
@@ -15,7 +15,7 @@
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="7.0.0" targetFramework="net462" />
<package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="WebGrease" version="1.6.0" targetFramework="net462" />
</packages>