scanning serial nummern

This commit is contained in:
Stoyan Zlatev
2023-05-11 09:31:14 +02:00
parent 720247e48b
commit d39ac8988b
20 changed files with 507 additions and 376 deletions
@@ -1,5 +1,6 @@
namespace LaaProductionWeb.Services.Models
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -13,7 +14,7 @@
public int PalletsCount { get; set; }
[Display(Name = "Paletten-Nr.")]
public int PalletNr { get; set; } = 1;
public int PalletNr { get; set; }
public IDictionary<int, bool> Pallets { get; set; }
= new Dictionary<int, bool> { { 1, false } };
@@ -21,16 +22,21 @@
public string PrintUrl
=> $"~/Shipments/Print?ordernr={this.OrderNr}&positionnr={this.PositionNr}&palletnr={this.PalletNr}";
public string DownloadUrl
=> $"~/Shipments/Download?ordernr={this.OrderNr}&positionnr={this.PositionNr}&palletnr={this.PalletNr}";
public string PalletUrl
=> $"~/Shipments/Pallet?ordernr={this.OrderNr}&positionnr={this.PositionNr}";
public void UpdatePalletsCount(int palletsCount)
public void UpdatePallets(IEnumerable<int> pallets)
{
this.PalletsCount = palletsCount;
this.Pallets = Enumerable
.Range(1, palletsCount)
.ToDictionary(x => x, x => false);
this.Pallets[this.PalletNr] = true;
this.Pallets = pallets.ToDictionary(x => x, x => x == this.PalletNr);
if (this.PalletNr == 0)
{
this.PalletNr = this.Pallets.Keys.Last();
}
else if (!this.Pallets.ContainsKey(this.PalletNr))
{
this.Pallets[this.PalletNr] = true;
}
}
}
}