Shipment - hide/show - serials scan and serials list.
HeReport - date filter from to date. Protocol - denyed upload of files when order has failed tests.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
public class DbContext : IDbContext
|
||||
@@ -25,7 +26,7 @@
|
||||
|
||||
parameters(sqlCommand.Parameters);
|
||||
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
@@ -46,7 +47,7 @@
|
||||
{
|
||||
sqlCommand.CommandText = query;
|
||||
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
@@ -71,7 +72,7 @@
|
||||
|
||||
parameters(sqlCommand.Parameters);
|
||||
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||
{
|
||||
if (sqlReader.Read())
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
IEnumerable<TestStatus> LoadTestStatus(int orderId);
|
||||
|
||||
bool OrderCompleted(int orderNr);
|
||||
|
||||
int SaveFile(Stream fileStream, int clientId, int orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,19 +63,21 @@
|
||||
{
|
||||
var dateTokens = property
|
||||
.Like
|
||||
.Split(new[] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => DateTimeOffset.TryParse($"{x}", new CultureInfo("de"), DateTimeStyles.None, out DateTimeOffset date)
|
||||
? (DateTimeOffset?)date.AddHours(-date.Hour)
|
||||
.Split(new[] { '-' })
|
||||
.Select(x => DateTimeOffset.TryParse($"{x}".Trim(), new CultureInfo("de"), DateTimeStyles.None, out DateTimeOffset date)
|
||||
? (DateTimeOffset?)date
|
||||
: null)
|
||||
.ToArray();
|
||||
|
||||
if (dateTokens.Length >= 1)
|
||||
{
|
||||
var propertyValue = dateTokens[0];
|
||||
var date1 = dateTokens.FirstOrDefault();
|
||||
|
||||
if (propertyValue != null)
|
||||
if (date1 != null)
|
||||
{
|
||||
var date = date1.Value;
|
||||
var propertyName = $"{property.Property}_{property.Index}_From";
|
||||
var propertyValue = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
|
||||
|
||||
sqlExpression.Add($"{property.Column} >= @{propertyName}", propertyName, propertyValue);
|
||||
}
|
||||
@@ -83,11 +85,13 @@
|
||||
|
||||
if (dateTokens.Length >= 2)
|
||||
{
|
||||
var propertyValue = dateTokens[1];
|
||||
var date2 = dateTokens.LastOrDefault();
|
||||
|
||||
if (propertyValue != null)
|
||||
if (date2 != null)
|
||||
{
|
||||
var date = date2.Value.AddDays(1);
|
||||
var propertyName = $"{property.Property}_{property.Index}_To";
|
||||
var propertyValue = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
|
||||
|
||||
sqlExpression.Add($"{property.Column} <= @{propertyName}", propertyName, propertyValue);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
public class ProtocolService : IProtocolService
|
||||
{
|
||||
@@ -162,6 +163,37 @@
|
||||
RadioTest = reader.GetValue<bool?>(5),
|
||||
});
|
||||
|
||||
public bool OrderCompleted(int orderId)
|
||||
{
|
||||
var sumResults = this.dbContext.AsEnumerable($@"
|
||||
SELECT CAST(CASE WHEN ISNULL([CPT].[CordonelPressureTest_Valid], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ CAST(CASE WHEN ISNULL([DP].[Dicht], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ ISNULL(MAX([APS].[StatusFertigung]) - 30, 0)
|
||||
+ CAST(CASE WHEN ISNULL([CRRH].[Result], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
FROM [AuftragPositionSerienNr] AS [APS]
|
||||
LEFT JOIN [Genesis_Meter] AS [GM] ON [GM].[Seriennummer] = [APS].[SerienNr]
|
||||
LEFT JOIN [MapPcbIdToSerialNumber] AS [PCB] ON [PCB].[MapPcbIdToSerialNumber_SerialNumber] = [GM].[Seriennummer]
|
||||
LEFT JOIN [Cordonel_Radio_RSSI_History] AS [CRRH] ON [CRRH].[RadioAdress] = [GM].[Adresse] - 10000000000
|
||||
AND [CRRH].[IsLast] = 1
|
||||
AND [CRRH].[Result] = 1
|
||||
LEFT JOIN [Druckpruefung] AS [DP] ON [DP].[FabNr] = [PCB].[MapPcbIdToSerialNumber_PcbId]
|
||||
AND [DP].[Dicht] = 1
|
||||
LEFT JOIN [Cordonel_PressureTest] AS [CPT] ON [CPT].[CordonelPressureTest_PcbId] = [PCB].[MapPcbIdToSerialNumber_PcbId]
|
||||
AND [CPT].[CordonelPressureTest_Valid] = 1
|
||||
WHERE [APS].[AuftragNr] = @{nameof(orderId)}
|
||||
GROUP BY [APS].[PositionNr]
|
||||
, [APS].[SerienNr]
|
||||
, [APS].[KundeneigeneSerienNr]
|
||||
, [CPT].[CordonelPressureTest_Valid]
|
||||
, [DP].[Dicht]
|
||||
, [CRRH].[Result]",
|
||||
parameters => parameters.Add(nameof(orderId), orderId),
|
||||
reader => reader.GetValue<int>(0))
|
||||
.Sum(x => x);
|
||||
|
||||
return sumResults == 0;
|
||||
}
|
||||
|
||||
public int SaveFile(Stream fileStream, int clientId, int orderId)
|
||||
{
|
||||
var fileName = $"{clientId}_{orderId}.pdf";
|
||||
|
||||
@@ -44,15 +44,22 @@
|
||||
|
||||
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)
|
||||
if (!this.protocolService.OrderCompleted(model.OrderId.Value))
|
||||
{
|
||||
return this.RedirectToAction(nameof(this.Document), model);
|
||||
this.TempData[FilePDF] = $"Auftrag enthält nicht bestandene Prüfungen.";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.TempData[FilePDF] = $"Der PDF Datei wurde nicht hochgeladen.";
|
||||
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
|
||||
|
||||
@@ -2,86 +2,88 @@
|
||||
|
||||
@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 class="table table-borderless">
|
||||
<tr>
|
||||
<th colspan="2" class="fs-5">Paletten Begleitschein</th>
|
||||
<th colspan="2" class="fs-5">@this.Model.ClientName</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="py-1 white-space-nowrap">Kunden-Auftrag</th>
|
||||
<td class="py-1">@this.Model.OrderNr</td>
|
||||
<th class="py-1 white-space-nowrap">Fertigungsauftrags-Nr.</th>
|
||||
<td class="py-1">@this.Model.ProductionOrderNr</td>
|
||||
</tr>
|
||||
@{
|
||||
var isFirst = true;
|
||||
|
||||
foreach (var position in this.Model.Positions)
|
||||
{
|
||||
<tr>
|
||||
<th class="py-1">@(isFirst ? "Position Nr" : string.Empty)</th>
|
||||
<td class="py-1">@position.PositionNr</td>
|
||||
<th class="py-1">@(isFirst ? "Bezeichnung" : string.Empty)</th>
|
||||
<td class="py-1">@position.Description</td>
|
||||
</tr>
|
||||
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
<tr>
|
||||
<th class="py-1 white-space-nowrap">Palettemenge</th>
|
||||
<td class="py-1">@this.Model.ItemsCount</td>
|
||||
<th class="py-1 white-space-nowrap">Auftragsmenge</th>
|
||||
<td class="py-1">@this.Model.TotlalItemsCount</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table table-borderless table-striped">
|
||||
<thead>
|
||||
@if (!string.IsNullOrWhiteSpace(this.Model.ClientName))
|
||||
{
|
||||
<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 class="table table-borderless">
|
||||
<tr>
|
||||
<th>Nr.</th>
|
||||
<th class="w-100">(Pos) Serial Nr.</th>
|
||||
<th class="w-100">Barcode</th>
|
||||
<th class="white-space-nowrap">Paletten Nr.</th>
|
||||
<th class="w-100"></th>
|
||||
<th colspan="2" class="fs-5">Paletten Begleitschein</th>
|
||||
<th colspan="2" class="fs-5">@this.Model.ClientName</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="py-1 white-space-nowrap">Kunden-Auftrag</th>
|
||||
<td class="py-1">@this.Model.OrderNr</td>
|
||||
<th class="py-1 white-space-nowrap">Fertigungsauftrags-Nr.</th>
|
||||
<td class="py-1">@this.Model.ProductionOrderNr</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
var count = 1;
|
||||
var isFirst = true;
|
||||
|
||||
foreach (var item in this.Model.Items)
|
||||
foreach (var position in this.Model.Positions)
|
||||
{
|
||||
<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.PositionNr) @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>
|
||||
<th class="py-1">@(isFirst ? "Position Nr" : string.Empty)</th>
|
||||
<td class="py-1">@position.PositionNr</td>
|
||||
<th class="py-1">@(isFirst ? "Bezeichnung" : string.Empty)</th>
|
||||
<td class="py-1">@position.Description</td>
|
||||
</tr>
|
||||
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<th class="py-1 white-space-nowrap">Palettemenge</th>
|
||||
<td class="py-1">@this.Model.ItemsCount</td>
|
||||
<th class="py-1 white-space-nowrap">Auftragsmenge</th>
|
||||
<td class="py-1">@this.Model.TotlalItemsCount</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table table-borderless table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nr.</th>
|
||||
<th class="w-100">(Pos) 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.PositionNr) @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>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,51 +1,54 @@
|
||||
@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>
|
||||
@if (this.Model.PositionNr != null)
|
||||
{
|
||||
<div>
|
||||
<h5 class="text-smallcaps">@this.Model.ScanTitle</h5>
|
||||
<hr />
|
||||
</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" })
|
||||
<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>
|
||||
<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" })
|
||||
@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>
|
||||
</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>
|
||||
</form>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user