Production approval - fertigung auftrag - autocomplete
This commit is contained in:
@@ -7,5 +7,7 @@
|
||||
OrdersFoundModel FindOrders(string search);
|
||||
|
||||
OrderPositions FindPositions(string id);
|
||||
|
||||
ProductionOrders FindProductionOrders(string productionNr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
<Compile Include="Models\OrderIdentity.cs" />
|
||||
<Compile Include="Models\PalletPosition.cs" />
|
||||
<Compile Include="Models\ProductionApproval.cs" />
|
||||
<Compile Include="Models\ProductionOrders.cs" />
|
||||
<Compile Include="Models\RoleModel.cs" />
|
||||
<Compile Include="Models\UserRole.cs" />
|
||||
<Compile Include="Models\UserPermissions.cs" />
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ProductionOrders : IEnumerable<int>
|
||||
{
|
||||
private readonly IEnumerable<int> productionOrders;
|
||||
|
||||
public ProductionOrders(IEnumerable<int> productionOrders)
|
||||
=> this.productionOrders = productionOrders;
|
||||
|
||||
public IEnumerator<int> GetEnumerator()
|
||||
=> this.productionOrders.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> this.GetEnumerator();
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,20 @@
|
||||
|
||||
return new OrderPositions(positionsFound);
|
||||
}
|
||||
|
||||
public ProductionOrders FindProductionOrders(string productionNr)
|
||||
{
|
||||
var ordersFound = this.dbContext.ExecuteReader($@"
|
||||
SELECT DISTINCT
|
||||
[AlleAuftragPositionen].[FertigungsauftragNr] -- 1
|
||||
FROM [AlleAuftragPositionen]
|
||||
WHERE [AlleAuftragPositionen].[Versand_Ist_datum] IS NOT NULL
|
||||
AND [AlleAuftragPositionen].[AuftragNr] LIKE @{nameof(productionNr)}
|
||||
ORDER BY [AlleAuftragPositionen].[FertigungsauftragNr]",
|
||||
parameters => parameters.Add(nameof(productionNr), $"{productionNr}%"),
|
||||
reader => reader.GetValue<int>());
|
||||
|
||||
return new ProductionOrders(ordersFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
});
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Add(ProductionApproval approval)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
return this.PartialView(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Production(string productionNr)
|
||||
{
|
||||
var model = this.ordersService.FindProductionOrders(productionNr);
|
||||
|
||||
return this.PartialView(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Positions(string orderNr)
|
||||
{
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
<Content Include="Views\Report\DateFilter.cshtml" />
|
||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||
<Content Include="Views\Approvals\Add.cshtml" />
|
||||
<Content Include="Views\Search\Production.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@model LaaProductionWeb.Services.Models.ProductionApproval
|
||||
|
||||
<form action="/Approvals/Add" method="post" autocomplete="off">
|
||||
@this.Html.AntiForgeryToken()
|
||||
<div class="container my-3">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -10,14 +11,15 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.OrderNr, new { @class = "form-control", placeholder = "Creator" })
|
||||
<div class="form-floating dropdown mb-3">
|
||||
@this.Html.TextBoxFor(x => x.OrderNr, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.OrderNr, labelText: "FertigungsNr")
|
||||
<ul class="dropdown-menu w-100 shadow-sm mt-2" id="fertigungNrMenu" style="max-height: 500px; overflow-y: auto;"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.PcbId, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.PcbId, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.PcbId, labelText: "PcbId")
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,13 +27,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.OverrideFwCheck, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.OverrideFwCheck, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.OverrideFwCheck, labelText: "OverrideFwCheck")
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.OverrideLutCheck, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.OverrideLutCheck, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.OverrideLutCheck, labelText: "OverrideLutCheck")
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,13 +41,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsAssembly, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsAssembly, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsAssembly, labelText: "RequiredLifeTimeYearsAssembly")
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsShipping, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.RequiredLifeTimeYearsShipping, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "RequiredLifeTimeYearsShipping")
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,7 +61,7 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.KitronProductionDate, new { @class = "form-control", placeholder = "Creator", type = "date" })
|
||||
@this.Html.TextBoxFor(x => x.KitronProductionDate, new { @class = "form-control", placeholder = "0", type = "date" })
|
||||
@this.Html.LabelFor(x => x.KitronProductionDate, labelText: "KitronProductionDate")
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,13 +69,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.MaxDrainedBatteryLoadPercent, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.MaxDrainedBatteryLoadPercent, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "MaxDrainedBatteryLoadPercent")
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.MaxStorageMonths, new { @class = "form-control", placeholder = "Creator" })
|
||||
@this.Html.TextBoxFor(x => x.MaxStorageMonths, new { @class = "form-control", placeholder = "0" })
|
||||
@this.Html.LabelFor(x => x.RequiredLifeTimeYearsShipping, labelText: "MaxStorageMonths")
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,13 +83,13 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.ApproverName, new { @class = "form-control bg-light border-light", placeholder = "Creator", @readonly = "readonly" })
|
||||
@this.Html.TextBoxFor(x => x.ApproverName, new { @class = "form-control bg-light border-light", placeholder = "0", @readonly = "readonly" })
|
||||
@this.Html.LabelFor(x => x.ApproverName, labelText: "Name des Genehmigers")
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.ApprovalDate, new { @class = "form-control bg-light border-light", placeholder = "Creator", @readonly = "readonly" })
|
||||
@this.Html.TextBoxFor(x => x.ApprovalDate, new { @class = "form-control bg-light border-light", placeholder = "0", @readonly = "readonly" })
|
||||
@this.Html.LabelFor(x => x.ApprovalDate, labelText: "Datum der Genehmigung")
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,7 +97,7 @@
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextAreaFor(x => x.ApprovalComment, new { @class = "form-control", placeholder = "Creator", style = "height: 210px" })
|
||||
@this.Html.TextAreaFor(x => x.ApprovalComment, new { @class = "form-control", placeholder = "0", style = "height: 210px" })
|
||||
@this.Html.LabelFor(x => x.ApprovalComment, labelText: "Genehmigungskommentar")
|
||||
@this.Html.ValidationMessageFor(x => x.ApprovalComment, string.Empty, new { @class = "small text-danger" })
|
||||
</div>
|
||||
@@ -106,22 +108,22 @@
|
||||
<input type="submit" class="btn btn-primary py-3 px-5 me-3" value="Neue Genehmigung erstellen" />
|
||||
@if (this.TempData.TryGetValue("Success", out object message))
|
||||
{
|
||||
<div class="toast fade show position-relative align-items-center text-bg-success border-0 ms-auto" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast fade show position-relative align-items-center text-bg-success border-0 ms-auto w-100" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<i class="bi-bold bi-check text-success me-2 fs-4"></i>
|
||||
<strong class="me-auto text-success">@message</strong>
|
||||
<small>Just now</small>
|
||||
<small class="text-nowrap">Just now</small>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (this.TempData.TryGetValue("Error", out object error))
|
||||
{
|
||||
<div class="toast fade show position-relative align-items-center text-bg-danger border-0 ms-auto" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast fade show position-relative align-items-center text-bg-danger border-0 ms-auto w-100" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<i class="bi-bold bi-x text-danger me-2 fs-4"></i>
|
||||
<strong class="me-auto text-danger">@error</strong>
|
||||
<small>Just now</small>
|
||||
<small class="text-nowrap">Just now</small>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -131,4 +133,40 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
(function () {
|
||||
let fertigungNrMenu = document.getElementById('fertigungNrMenu');
|
||||
let orderNrInput = document.getElementById('OrderNr');
|
||||
|
||||
if (fertigungNrMenu && orderNrInput) {
|
||||
function loadDropdownItems(html) {
|
||||
fertigungNrMenu.innerHTML = html;
|
||||
let items = fertigungNrMenu.querySelectorAll('.dropdown-item');
|
||||
if (items && items.length == 1) {
|
||||
orderNrInput.value = items.item(0).innerHTML;
|
||||
fertigungNrMenu.classList.remove('show');
|
||||
}
|
||||
}
|
||||
orderNrInput.onfocus = () => fertigungNrMenu.classList.add('show');
|
||||
orderNrInput.oninput = (e) => {
|
||||
let value = e.target.value;
|
||||
if (value && value.length > 2) {
|
||||
fetch(`/Search/Production?productionNr=${orderNrInput.value}`)
|
||||
.then(response => response.text())
|
||||
.then(html => loadDropdownItems(html))
|
||||
.catch(error => console.log(error));
|
||||
fertigungNrMenu.classList.add('show');
|
||||
} else {
|
||||
fertigungNrMenu.innerHTML = null;
|
||||
fertigungNrMenu.classList.remove('show');
|
||||
}
|
||||
};
|
||||
window.addEventListener('hashchange', function () {
|
||||
orderNrInput.value = location.hash.substring(1);
|
||||
fertigungNrMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@model LaaProductionWeb.Services.Models.ProductionOrders
|
||||
|
||||
@foreach (var fertigungNr in this.Model)
|
||||
{
|
||||
<li><a href="#@fertigungNr" class="dropdown-item" onclick="console.log(`#${@fertigungNr}`)">@fertigungNr</a></li>
|
||||
}
|
||||
@@ -51,7 +51,6 @@
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user