Fix errore display WeekPlan

This commit is contained in:
Samuele Locatelli
2021-08-24 10:13:06 +02:00
parent 6717945249
commit 42e3e44cd2
9 changed files with 41 additions and 48 deletions
+10 -20
View File
@@ -327,10 +327,16 @@ namespace GWMS.Data.Controllers
public List<WeekPlanModel> GetWeekPlan()
{
var dbResult = dbCtx
.DbSetPlantSupplWeekPlan
.ToList();
List<WeekPlanModel> dbResult = new List<WeekPlanModel>();
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
{
dbResult = dbCtx
.DbSetPlantSupplWeekPlan
.Include(p => p.Plant)
.Include(s => s.Supplier)
.Include(t => t.Transporter)
.ToList();
}
return dbResult;
}
@@ -422,25 +428,9 @@ namespace GWMS.Data.Controllers
localDbCtx.Entry(updItem).State = EntityState.Modified;
localDbCtx.SaveChanges();
}
//// se ho modificato data --> cambio codice ordine!
//if (!dbCtx.Entry(updItem).OriginalValues["DtOrder"].Equals(dbCtx.Entry(updItem).CurrentValues["DtOrder"]))
//{
// updItem.OrderCode = $"O{updItem.Plant.PlantCode}{updItem.DtOrder:yyMMddHHmm}";
// updItem.OrderDesc = $"Ordine {updItem.Plant.PlantDesc} - {updItem.DtOrder}";
//}
//dbCtx.Entry(updItem).State = EntityState.Modified;
//dbCtx.SaveChanges();
}
else
{
//using (GWMSContext localDbCtx = new GWMSContext(_configuration))
//{
// localDbCtx
// .DbSetOrders
// .Add(updItem);
// localDbCtx.SaveChanges();
//}
dbCtx
.DbSetOrders
.Add(updItem);
+2 -2
View File
@@ -25,7 +25,7 @@
foreach (var item in _currList)
{
<div class="col-12">
<button class="btn btn-block btn-outline-dark" @onclick="() => Edit(item)">
<button class="btn btn-block btn-outline-dark px-1" @onclick="() => Edit(item)">
<div class="d-flex justify-content-between">
<div class="px-1">
<i class="fas fa-gas-pump" aria-hidden="true"></i> @item.Plant.PlantDesc
@@ -60,7 +60,7 @@
{
get
{
return _currList = null;
return _currList;
}
set
{
+1 -1
View File
@@ -777,7 +777,7 @@ namespace GWMS.UI.Data
dbResult = dbController.GetWeekPlan();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per WeekPlanGet: {ts.TotalMilliseconds} ms");
Log.Info($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2108.2409</Version>
<Version>1.0.2108.2410</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
</PropertyGroup>
+11 -11
View File
@@ -5,10 +5,10 @@
<div class="card">
<div class="card-header table-primary">
<div class="row">
<div class="col-9">
<div class="col-6 col-lg-8 col-xl-9">
<h3>Week Plan</h3>
</div>
<div class="col-3">
<div class="col-6 col-lg-4 col-xl-3">
<button class="btn btn-block btn-success" @onclick="CreateNew">Aggiunta Consegna <i class="far fa-calendar-plus"></i></button>
</div>
</div>
@@ -29,7 +29,7 @@
Legenda
</div>
<div class="col-12 text-center">
<table class="table table-sm table-striped">
<table class="table table-sm table-striped table-responsive-sm">
<thead>
<tr>
<th></th>
@@ -46,14 +46,14 @@
@for (int i = startHour; i <= endHour; i++)
{
<tr class="small">
<td style="width: 5.5%;">@i</td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(DayOfWeek.Monday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Tuesday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Wednesday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Thursday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Friday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Saturday, i)"></ItemPlanDetail></td>
<td style="width: 13.5%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Sunday, i)"></ItemPlanDetail></td>
<td style="width: 3.4%;">@i</td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(DayOfWeek.Monday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Tuesday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Wednesday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Thursday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Friday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Saturday, i)"></ItemPlanDetail></td>
<td style="width: 13.8%;"><ItemPlanDetail selRecordChanged="EditRecord" currList="@SlotList(@DayOfWeek.Sunday, i)"></ItemPlanDetail></td>
</tr>
}
</tbody>
+13 -10
View File
@@ -184,17 +184,20 @@ namespace GWMS.UI.Pages
{
int minHour = 7;
int maxHour = 21;
var minRecord = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault();
if (minRecord != null)
if (ListRecords != null)
{
minHour = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
_startHour = _startHour < minHour ? _startHour : minHour;
}
var maxRecord = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault();
if (maxRecord != null)
{
maxHour = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
_endHour = _endHour > maxHour ? _endHour : maxHour;
var minRecord = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault();
if (minRecord != null)
{
minHour = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
_startHour = _startHour < minHour ? _startHour : minHour;
}
var maxRecord = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault();
if (maxRecord != null)
{
maxHour = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
_endHour = _endHour > maxHour ? _endHour : maxHour;
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2108.2409</h4>
<h4>Versione: 1.0.2108.2410</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2108.2409
1.0.2108.2410
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2108.2409</version>
<version>1.0.2108.2410</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>