This commit is contained in:
Roland Drabesch
2023-04-14 13:37:37 +02:00
25 changed files with 380 additions and 282 deletions
@@ -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())
{
@@ -84,6 +85,27 @@
return firstOrDefaultResult;
}
public int ExecuteNonQuery(string query, Action<ParameterCollection> parameters)
{
var rowsAffected = 0;
using (var sqlConnection = new SqlConnection(this.connectionString))
{
sqlConnection.OpenWithErrorHandling();
using (var sqlCommand = sqlConnection.CreateCommand())
{
sqlCommand.CommandText = query;
parameters(sqlCommand.Parameters);
rowsAffected = sqlCommand.ExecuteNonQuery();
}
}
return rowsAffected;
}
public T ScalarTransaction<T>(string query, Action<ParameterCollection> parameters)
{
var scalarResult = default(T);
@@ -3,8 +3,7 @@
using LaaProductionWeb.Data.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Data.SqlClient;
using System.Diagnostics;
@@ -9,6 +9,8 @@
IEnumerable<T> AsEnumerable<T>(string query, Func<ISqlReader, T> reader);
int ExecuteNonQuery(string query, Action<ParameterCollection> parameters);
T FirstOrDefault<T>(string query, Action<ParameterCollection> parameters, Func<ISqlReader, T> reader);
T ScalarTransaction<T>(string query, Action<ParameterCollection> parameters);
@@ -2,6 +2,7 @@
{
using LaaProductionWeb.Data.Interfaces;
using System;
using System.Data;
using System.Data.SqlClient;
@@ -14,17 +15,23 @@
public IParameterCollection Add(string name, object value)
{
this.parameters.Add(new SqlParameter(name, value));
this.parameters.Add(new SqlParameter(name, value ?? DBNull.Value));
return this;
}
public IParameterCollection AddFile(string name, byte[] fileContent)
{
var sqlParameter = new SqlParameter(name, SqlDbType.VarBinary)
var sqlParameter = new SqlParameter(name, SqlDbType.VarBinary);
if (fileContent is null)
{
Value = fileContent
};
sqlParameter.Value = DBNull.Value;
}
else
{
sqlParameter.Value = fileContent;
}
this.parameters.Add(sqlParameter);
@@ -19,6 +19,8 @@
IEnumerable<TestStatus> LoadTestStatus(int orderId);
bool OrderCompleted(int orderNr);
int SaveFile(Stream fileStream, int clientId, int orderId);
}
}
@@ -70,6 +70,7 @@
<Compile Include="Models\HeliumReportItem.cs" />
<Compile Include="Models\HeliumReportModel.cs" />
<Compile Include="Models\HeliumReportModelExtensions.cs" />
<Compile Include="Models\OrderIdentity.cs" />
<Compile Include="Models\PalletPosition.cs" />
<Compile Include="Models\RoleModel.cs" />
<Compile Include="Models\UserRole.cs" />
@@ -11,25 +11,25 @@
{
var model = default(HeliumReportItem);
this.Add(model.Property(x => x.FertigungNr, this.Count));
this.Add(model.Property(x => x.AuftragNr, this.Count));
this.Add(model.Property(x => x.PositionNr, this.Count));
this.Add(model.Property(x => x.SerialNr, this.Count));
this.Add(model.Property(x => x.IdentNr, this.Count));
this.Add(model.Property(x => x.HeId, this.Count));
this.Add(model.Property(x => x.HeTestId, this.Count));
this.Add(model.Property(x => x.PcbId, this.Count));
this.Add(model.Property(x => x.Nennweite, this.Count));
this.Add(model.Property(x => x.Baulaenge, this.Count));
this.Add(model.Property(x => x.Typ, this.Count));
this.Add(model.Property(x => x.Druck, this.Count));
this.Add(model.Property(x => x.Temperatur, this.Count));
this.Add(model.Property(x => x.HeLakeRate, this.Count));
this.Add(model.Property(x => x.HeTestPressure, this.Count));
this.Add(model.Property(x => x.IsValid, this.Count));
this.Add(model.Text(x => x.FertigungNr, this.Count));
this.Add(model.Text(x => x.AuftragNr, this.Count));
this.Add(model.Text(x => x.PositionNr, this.Count));
this.Add(model.Text(x => x.SerialNr, this.Count));
this.Add(model.Text(x => x.IdentNr, this.Count));
this.Add(model.Text(x => x.HeId, this.Count));
this.Add(model.Text(x => x.HeTestId, this.Count));
this.Add(model.Text(x => x.PcbId, this.Count));
this.Add(model.Text(x => x.Nennweite, this.Count));
this.Add(model.Text(x => x.Baulaenge, this.Count));
this.Add(model.Text(x => x.Typ, this.Count));
this.Add(model.Text(x => x.Druck, this.Count));
this.Add(model.Text(x => x.Temperatur, this.Count));
this.Add(model.Text(x => x.HeLakeRate, this.Count));
this.Add(model.Text(x => x.HeTestPressure, this.Count));
this.Add(model.Boolean(x => x.IsValid, this.Count));
this.Add(model.Text(x => x.Text, this.Count));
this.Add(model.DateTime(x => x.TestDate, this.Count, -1));
this.Add(model.Property(x => x.Tester, this.Count));
this.Add(model.Property(x => x.Text, this.Count));
this.Add(model.Text(x => x.Tester, this.Count));
}
internal SqlExpression OrderBy()
@@ -57,25 +57,32 @@
foreach (var property in this)
{
if (property.Type == "date")
if (string.IsNullOrWhiteSpace(property.Like))
{
continue;
}
if (property.Type == PropertyType.Date)
{
if (!string.IsNullOrWhiteSpace(property.Like))
{
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,20 +90,25 @@
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);
}
}
}
}
else if (string.IsNullOrWhiteSpace(property.Like))
else if (property.Type == PropertyType.Bool)
{
continue;
var propertyName = $"{property.Property}_{property.Index}";
var propertyValue = int.TryParse(property.Like, out int bit) ? bit : 0;
sqlExpression.Add($"{property.Column} = @{propertyName}", propertyName, property.Like);
}
else
{
@@ -4,7 +4,7 @@
{
public int Index { get; set; }
public string Type { get; set; }
public PropertyType Type { get; set; }
public string Property { get; set; }
@@ -5,31 +5,31 @@
using System.Linq.Expressions;
using System.Reflection;
public enum PropertyType
{
Text,
Date,
Bool
}
public static class HeliumReportModelExtensions
{
public static HeliumReportFilterProperty Property(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
{
var memberInfo = default(MemberInfo);
if (expression.Body is MemberExpression memberExpression)
{
memberInfo = memberExpression.Member;
}
else if (expression.Body is UnaryExpression unaryExpression && unaryExpression.Operand is MemberExpression operandExpression)
{
memberInfo = operandExpression.Member;
}
public static HeliumReportFilterProperty Text(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
=> model.Property(expression, index, PropertyType.Text, orderBy);
return new HeliumReportFilterProperty
{
Column = memberInfo?.GetCustomAttribute<ColumnAttribute>()?.Name,
Property = memberInfo?.Name,
OrderBy = orderBy,
Index = index,
Type = "text"
};
}
public static HeliumReportFilterProperty DateTime(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
=> model.Property(expression, index, PropertyType.Date, orderBy);
public static HeliumReportFilterProperty Boolean(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
=> model.Property(expression, index, PropertyType.Bool, orderBy);
public static HeliumReportFilterProperty Property(
this HeliumReportItem model
, Expression<Func<HeliumReportItem, object>> expression
, int index
, PropertyType propertyType
, int orderBy)
{
var memberInfo = default(MemberInfo);
@@ -48,7 +48,7 @@
Property = memberInfo?.Name,
OrderBy = orderBy,
Index = index,
Type = "date"
Type = propertyType
};
}
}
@@ -0,0 +1,13 @@
namespace LaaProductionWeb.Services.Models
{
public class OrderIdentity
{
public int OrderNr { get; set; }
public int PositionNr { get; set; }
public int SerialNr { get; set; }
public string ClientSerialNr { get; set; }
}
}
@@ -9,8 +9,7 @@
[Required]
public int? OrderNr { get; set; }
[Required]
public int? PositionNr { get; set; }
[Required]
@@ -22,8 +22,7 @@
[Required(ErrorMessage = "Auftrags-Nr. ist erforderlich!")]
[Display(Name = "Auftrags-Nr. scanen oder eingeben")]
public int? OrderNr { get; set; }
[Required(ErrorMessage = "Positions-Nr. ist erforderlich!")]
[Display(Name = "Positions-Nr. auswählen")]
public int? PositionNr { get; set; }
@@ -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";
@@ -33,11 +33,12 @@
var palletsCount = this.dbContext.FirstOrDefault(
query: $@"
SELECT COUNT(1)
FROM (SELECT [PalettenNr] AS [PalletNr]
, COUNT([SerienNr]) AS [Count]
FROM (SELECT [PalettenNr] AS [PalletNr]
, COUNT([SerienNr]) AS [Count]
FROM [PalettenScan]
WHERE [AuftragNr] = @{nameof(model.OrderNr)}
AND [PositionNr] = @{nameof(model.PositionNr)}
WHERE [AuftragNr] = @{nameof(model.OrderNr)}
AND (@{nameof(model.PositionNr)} IS NULL
OR [PositionNr] = @{nameof(model.PositionNr)})
GROUP BY [PalettenNr])
AS [Paletten]
WHERE [Count] > 0",
@@ -90,10 +91,13 @@
AND [PalettenScan].[PositionNr] = [AuftragPositionSerienNr].[PositionNr]
AND [PalettenScan].[SerienNr] = REPLACE(RTRIM(LTRIM([AuftragPositionSerienNr].[KundeneigeneSerienNr])), ' ', '')
WHERE [AuftragPositionSerienNr].[AuftragNr] = @{nameof(model.OrderNr)}
AND (@{nameof(model.PositionNr)} IS NULL
OR [AuftragPositionSerienNr].[PositionNr] = @{nameof(model.PositionNr)})
AND ([PalettenScan].[PalettenNr] = @{nameof(model.PalletNr)}
OR [PalettenScan].[PalettenNr] IS NULL)",
parameters: parameters => parameters
.Add(nameof(model.OrderNr), model.OrderNr)
.Add(nameof(model.PositionNr), model.PositionNr)
.Add(nameof(model.PalletNr), model.PalletNr),
reader: reader => new SerialNr
{
@@ -111,22 +115,24 @@
public PalletsBatchModel LoadBatchModel(OrderScanModel model)
{
const string orderNr = nameof(model.OrderNr);
const string posNr = nameof(model.PositionNr);
const string palNr = nameof(model.PalletNr);
var batchModel = this.dbContext.FirstOrDefault(
query: $@"
SELECT TOP 1
[Auftrag].[AuftragNr] -- 0
, [Auftrag].[FertigungsauftragNr] -- 1
, [Auftrag].[Menge] -- 2
, [Kunde].[Name] -- 3
, [Auftrag].[ZusatzText] -- 4
[Auftrag].[AuftragNr] -- 0
, [Auftrag].[FertigungsauftragNr] -- 1
, (SELECT SUM([AAP].[Menge])
FROM [AlleAuftragPositionen] AS [AAP]
WHERE [AAP].[AuftragNr] = [Auftrag].[AuftragNr]) -- 2
, [Kunde].[Name] -- 3
, [Auftrag].[ZusatzText] -- 4
FROM [AlleAuftragPositionen] AS [Auftrag]
JOIN [Kunde] ON [Kunde].[KundenNr] = [Auftrag].[KundenNr]
WHERE [Auftrag].[AuftragNr] = @{orderNr}
AND [Auftrag].[PositionNr] = @{posNr}
ORDER BY [Auftrag].[FertigungsauftragNr] DESC",
WHERE [Auftrag].[AuftragNr] = @{nameof(model.OrderNr)}
AND (@{nameof(model.PositionNr)} IS NULL
OR [Auftrag].[PositionNr] = @{nameof(model.PositionNr)})
ORDER BY [Auftrag].[FertigungsauftragNr] DESC",
parameters: parameters => parameters
.Add(nameof(model.OrderNr), model.OrderNr)
.Add(nameof(model.PositionNr), model.PositionNr),
@@ -196,16 +202,16 @@
return $"Der Packet mit Serien-Nr: {model.SerialNr} wurde bereits hinzugefügt.";
}
var orderKVP = this.GetOrderKVP(model.OrderNr, model.PositionNr, model.SerialNr);
var orderIdentity = this.UpdateOrderIdentifiers(model.OrderNr, model.PositionNr, model.SerialNr);
if (orderKVP.Key <= 0)
if (orderIdentity is null)
{
return $"Der Packet mit Serien-Nr: {model.SerialNr} ist nicht dem Auftrag/Position: {model.OrderNr}/{model.PositionNr} zugewiesen.";
}
else
{
model.SerialNr = orderKVP.Value;
model.PalletNr = this.GetPalletNr(model);
model.SerialNr = orderIdentity.ClientSerialNr;
model.PositionNr = orderIdentity.PositionNr;
}
var rowsAffected = this.InsertPalletEntry(model);
@@ -216,18 +222,6 @@
return false;
}
private int GetPalletNr(OrderScanModel model)
=> this.dbContext.FirstOrDefault(
query: $@"
SELECT MAX([PalettenNr]) + 1
FROM [PalettenScan]
WHERE [AuftragNr] = @{nameof(model.OrderNr)}
AND [PositionNr] = @{nameof(model.PositionNr)}",
parameters: parameters => parameters
.Add(nameof(model.OrderNr), model.OrderNr)
.Add(nameof(model.PositionNr), model.PositionNr),
reader: reader => Math.Min(reader.GetValue<int>(0), model.PalletNr));
private OrderScanModel DeletePalletEntryById(int id)
=> this.dbContext.FirstOrDefault(
query: $@"
@@ -245,26 +239,31 @@
PalletNr = reader.GetValue<short>(2)
});
private KeyValuePair<int, string> GetOrderKVP(int? orderNr, int? positionNr, string serialNr)
private OrderIdentity UpdateOrderIdentifiers(int? orderNr, int? positionNr, string serialNr)
=> this.dbContext.FirstOrDefault(
query: $@"
SELECT DISTINCT TOP 1
[AuftragPositionSerienNr].[SerienNr] -- 0
, REPLACE(RTRIM(LTRIM([AuftragPositionSerienNr].[KundeneigeneSerienNr])), ' ', '') -- 1
[AuftragPositionSerienNr].[PositionNr] -- 0
, [AuftragPositionSerienNr].[SerienNr] -- 1
, REPLACE(RTRIM(LTRIM([AuftragPositionSerienNr].[KundeneigeneSerienNr])), ' ', '') -- 2
FROM [AuftragPositionSerienNr]
WHERE [AuftragPositionSerienNr].[AuftragNr] = @{nameof(orderNr)}
AND [AuftragPositionSerienNr].[PositionNr] = @{nameof(positionNr)}
AND @{nameof(serialNr)} LIKE '%' + (REPLACE(RTRIM(LTRIM([AuftragPositionSerienNr].[KundeneigeneSerienNr])), ' ', '')) + '%'",
WHERE [AuftragPositionSerienNr].[AuftragNr] = @{nameof(orderNr)}
AND ([AuftragPositionSerienNr].[PositionNr] = @{nameof(positionNr)} OR @{nameof(positionNr)} IS NULL)
AND @{nameof(serialNr)} LIKE '%' + (REPLACE(RTRIM(LTRIM([AuftragPositionSerienNr].[KundeneigeneSerienNr])), ' ', '')) + '%'",
parameters: parameters => parameters
.Add(nameof(orderNr), orderNr)
.Add(nameof(positionNr), positionNr)
.Add(nameof(serialNr), serialNr),
reader: reader => new KeyValuePair<int, string>(
key: reader.GetValue<int>(0),
value: reader.GetValue<string>(1)));
reader: reader => new OrderIdentity
{
OrderNr = orderNr ?? -1,
PositionNr = reader.GetValue<short>(0),
SerialNr = reader.GetValue<int>(1),
ClientSerialNr = reader.GetValue<string>(2),
});
private int InsertPalletEntry(OrderScanModel model)
=> this.dbContext.ScalarTransaction<int>($@"
=> this.dbContext.ExecuteNonQuery($@"
INSERT
INTO [PalettenScan] (
[PalettenNr]
@@ -294,11 +293,9 @@
SELECT CAST(CASE WHEN [PalettenScan].[ID] IS NULL THEN 0 ELSE 1 END AS BIT)
FROM [PalettenScan]
WHERE [PalettenScan].[AuftragNr] = @{nameof(orderNr)}
AND [PalettenScan].[PositionNr] = @{nameof(positionNr)}
AND [PalettenScan].[SerienNr] = @{nameof(serialNr)}",
parameters => parameters
.Add(nameof(orderNr), orderNr)
.Add(nameof(positionNr), positionNr)
.Add(nameof(serialNr), serialNr),
reader => reader.GetValue<bool>(0));
@@ -32,37 +32,47 @@
[HttpPost]
public ActionResult Index(OrderClientModel model)
{
var files = this.Request.Files;
if (model.OrderId is null || model.OrderId <= 0)
if (model.OrderId > 0 && model.ClientId > 0)
{
this.TempData[FilePDF] = $"Bitte Auftrag auswählen.";
}
else if (files.Count > 0)
{
var file = this.Request.Files.Get(0);
var files = this.Request.Files;
if (file.ContentType == "application/pdf" && model.ClientId > 0 && model.OrderId > 0)
if (files.Count > 0)
{
model.FileId = this.protocolService.SaveFile(file.InputStream, model.ClientId.Value, model.OrderId.Value);
var file = files.Get(0);
if (model.FileId > 0)
if (file.ContentType == "application/pdf")
{
return this.RedirectToAction(nameof(this.Document), model);
if (this.protocolService.OrderCompleted(model.OrderId.Value))
{
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] = $"Auftrag enthält nicht bestandene Prüfungen.";
}
}
else
{
this.TempData[FilePDF] = $"Der PDF Datei wurde nicht hochgeladen.";
this.TempData[FilePDF] = $"Bitte, PDF Datei hochladen.";
}
}
else
{
this.TempData[FilePDF] = $"Bitte, PDF Datei hochladen.";
this.TempData[FilePDF] = "Kein PDF Datei wurde ausgewählt.";
}
}
else
{
this.TempData[FilePDF] = "Kein PDF Datei wurde ausgewählt.";
this.TempData[FilePDF] = $"Bitte Auftrag auswählen.";
}
return this.View(model);
@@ -63,6 +63,7 @@
if (result)
{
model.PositionNr = null;
model.SerialNr = default(string);
}
else
@@ -78,6 +79,7 @@
public ActionResult Delete(int id)
{
var orderScanModel = this.shipmentsService.DeletePalletEntry(id);
orderScanModel.PositionNr = null;
return this.View(nameof(this.Index), new ShipmentModel(orderScanModel));
}
@@ -9,7 +9,7 @@
}
else if (testStatus is null)
{
return new MvcHtmlString("<td class=\"text-center text-secondary small\">NULL</td>");
return new MvcHtmlString("<td class=\"text-center text-secondary small\">n/a</td>");
}
else if (testStatus == false)
{
@@ -123,6 +123,10 @@
<td class="va-middle py-0">Packaging of meter</td>
<td class="va-middle py-0">SENSUS-1-924</td>
</tr>
<tr>
<th class="va-middle py-0">n/a</th>
<td class="va-middle py-0" colspan="3">Not applicable</td>
</tr>
<tr>
<th class="va-middle py-0">Ok</th>
<td class="va-middle py-0" colspan="3">Test passed</td>
@@ -98,7 +98,7 @@
clientMenu.classList.add(show);
})
} else {
clientMenu.classList.remove(show);
orderMenu.classList.remove(show);
}
}, 50);
};
@@ -14,7 +14,8 @@
style="min-width: 200px"
class="form-control form-control-sm mb-1"
name="@this.Model.LikeName"
value="@(!string.IsNullOrWhiteSpace(this.Model.Like) ? this.Model.Like : "dd.MM.yyyy - dd.MM.yyyy")" />
value="@this.Model.Like"
placeholder="dd.MM.yyyy-dd.MM.yyyy"/>
<div class="input-group flex-nowrap justify-content-center">
<input id="@(this.Model.OrderById)_1" name="@this.Model.OrderByName" type="radio" value="1" @isChecked(this.Model.OrderBy == 1) class="d-none" />
@@ -5,10 +5,10 @@
Func<bool, string> bgColor = x => !x ? "bg-light" : string.Empty;
}
<input type="hidden" name="@this.Model.TypeName" value="@this.Model.Type" />
<input type="hidden" name="@this.Model.IndexName" value="@this.Model.Index" />
<input type="hidden" name="@this.Model.ColumnName" value="@this.Model.Column" />
<input type="hidden" name="@this.Model.PropertyName" value="@this.Model.Property" />
<input type="hidden" name="@this.Model.TypeName" value="@this.Model.Type" />
<input name="@this.Model.LikeName" class="form-control form-control-sm mb-1" autocomplete="off" value="@this.Model.Like" />
<div class="input-group flex-nowrap justify-content-center">
@@ -1,7 +1,7 @@
@model LaaProductionWeb.Services.Models.HeliumReportModel
<form action="/Report" method="post" autocomplete="off" class="h-100" id="he_report">
<div class="table-responsive mh-100">
<div class="table-responsive h-100 mh-100">
<table class="table table-sm table-bordered mb-0">
<thead class="bg-light">
<tr>
@@ -21,14 +21,14 @@
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeLakeRate)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.HeTestPressure)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.IsValid)</th>
<th class="p-2" style="min-width: 200px">@this.Model.Display(x => x.Text)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestDate)</th>
<th class="text-nowrap p-2">@this.Model.Display(x => x.Tester)</th>
<th class="p-2">@this.Model.Display(x => x.Text)</th>
</tr>
<tr>
@foreach (var filter in this.Model.Filter)
{
if (filter.Type == "date")
if (filter.Type == LaaProductionWeb.Services.Models.PropertyType.Date)
{
<td>@this.Html.Partial("DateFilter", filter)</td>
}
@@ -42,31 +42,31 @@
<tbody>
@foreach (var item in this.Model.Items)
{
<tr>
<td class="text-nowrap p-2">@item.FertigungNr</td>
<td class="text-nowrap p-2">@item.AuftragNr</td>
<td class="text-nowrap p-2">@item.PositionNr</td>
<td class="text-nowrap p-2">@item.SerialNr</td>
<td class="text-nowrap p-2">@item.IdentNr</td>
<td class="text-nowrap p-2">@item.HeId</td>
<td class="text-nowrap p-2">
<a class="text-decoration-none cursor-pointer" href="#@item.HeTestId">
@item.HeTestId
</a>
</td>
<td class="text-nowrap p-2">@item.PcbId</td>
<td class="text-nowrap p-2">@item.Nennweite</td>
<td class="text-nowrap p-2">@item.Baulaenge</td>
<td class="text-nowrap p-2">@item.Typ</td>
<td class="text-nowrap p-2">@item.Druck</td>
<td class="text-nowrap p-2">@item.Temperatur</td>
<td class="text-nowrap p-2">@item.HeLakeRate</td>
<td class="text-nowrap p-2">@item.HeTestPressure</td>
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.IsValid ? "bi-check text-success" : "bi-x text-danger")"></i></td>
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
<td class="text-nowrap p-2">@item.Tester</td>
<td class="p-2">@item.Text</td>
</tr>
<tr>
<td class="text-nowrap p-2">@item.FertigungNr</td>
<td class="text-nowrap p-2">@item.AuftragNr</td>
<td class="text-nowrap p-2">@item.PositionNr</td>
<td class="text-nowrap p-2">@item.SerialNr</td>
<td class="text-nowrap p-2">@item.IdentNr</td>
<td class="text-nowrap p-2">@item.HeId</td>
<td class="text-nowrap p-2">
<a class="text-decoration-none cursor-pointer" href="#@item.HeTestId">
@item.HeTestId
</a>
</td>
<td class="text-nowrap p-2">@item.PcbId</td>
<td class="text-nowrap p-2">@item.Nennweite</td>
<td class="text-nowrap p-2">@item.Baulaenge</td>
<td class="text-nowrap p-2">@item.Typ</td>
<td class="text-nowrap p-2">@item.Druck</td>
<td class="text-nowrap p-2">@item.Temperatur</td>
<td class="text-nowrap p-2">@item.HeLakeRate</td>
<td class="text-nowrap p-2">@item.HeTestPressure</td>
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.IsValid ? "bi-check text-success" : "bi-x text-danger")"></i></td>
<td class="p-2">@item.Text</td>
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
<td class="text-nowrap p-2">@item.Tester</td>
</tr>
}
</tbody>
</table>
@@ -1,5 +1,7 @@
@model LaaProductionWeb.Services.Models.OrderPositions
<li><span class="dropdown-item">Alle</span></li>
@foreach (var position in this.Model)
{
<li><span class="dropdown-item">@position</span></li>
@@ -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>
}
@@ -17,10 +17,9 @@
<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.TextBoxFor(x => x.PositionNr, new { id = "pos_nr", @class = "form-control bg-white cursor-pointer", placeholder = "0000000000", @readonly = "readonly" })
@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>
<i class="bi bi-chevron-down" style="position: absolute;right: 3.5%;top: 35%;" data-bs-toggle="dropdown"></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>
@@ -95,15 +94,6 @@
.submit();
});
orderNrMenu.classList.remove(show);
if (orderChanged) {
orderChanged = false;
positionNrInput.value = positionNrMenu
.querySelector(dropdownItemSelector)
.innerHTML;
document
.getElementById('order_form')
.submit();
}
}
function getPositions(orderNr) {
@@ -1,51 +1,53 @@
@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)
@if (this.Model.OrderNr > 0)
{
<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))
{
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" />
<div class="text-danger small">
@($"{errorMessage}")
</div>
}
<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 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 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>
</form>
}