Update x gestione AnagCategorie

This commit is contained in:
Samuele Locatelli
2024-02-12 17:45:06 +01:00
parent b6010d7aae
commit fda3f58009
20 changed files with 1969 additions and 187 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.0.2402.1215</Version>
<Version>2.0.2402.1217</Version>
<Copyright>Egalware 2021+</Copyright>
</PropertyGroup>
+33 -10
View File
@@ -1494,16 +1494,16 @@ namespace SHERPA.BBM.CORE.Controllers
/// <summary>
/// Elenco Items x tipo risorsa da view
/// </summary>
/// <param name="ResType"></param>
/// <param name="ResTypeId"></param>
/// <returns></returns>
public List<vItemsDataModel> ItemGetFilt(BbmResType ResType = BbmResType.ND)
public List<vItemsDataModel> ItemGetFilt(int ResTypeId = 0)
{
List<vItemsDataModel> dbResult = new List<vItemsDataModel>();
using (SHERPABBMContext dbCtx = new SHERPABBMContext(_configuration))
{
dbResult = dbCtx
.DbSetItemData
.Where(x => x.ResType != BbmResType.ND && (x.ResType == ResType || ResType == BbmResType.ND))
.Where(x => x.ResTypeId != 0 && (x.ResTypeId == ResTypeId || ResTypeId == 0))
.Include(i => i.TagNav)
//.OrderByDescending(x => x.CodItem)
.ToList();
@@ -1530,6 +1530,23 @@ namespace SHERPA.BBM.CORE.Controllers
return numDone;
}
/// <summary>
/// Elenco tipi risorse/item
/// </summary>
/// <returns></returns>
public List<ItemResTypeModel> ItemResTypeGetAll()
{
List<ItemResTypeModel> dbResult = new List<ItemResTypeModel>();
using (SHERPABBMContext dbCtx = new SHERPABBMContext(_configuration))
{
dbResult = dbCtx
.DbSetItemResType
.OrderBy(x => x.Name)
.ToList();
}
return dbResult;
}
public int ItemsCount()
{
int answ = 0;
@@ -1562,7 +1579,7 @@ namespace SHERPA.BBM.CORE.Controllers
{
currData.CodItem = updItem.CodItem;
currData.Descript = updItem.Descript;
currData.ResType = updItem.ResType;
currData.ResTypeId = updItem.ResTypeId;
currData.UM = updItem.UM;
currData.UnitPrice = updItem.UnitPrice;
dbCtx.Entry(currData).State = EntityState.Modified;
@@ -1812,6 +1829,10 @@ namespace SHERPA.BBM.CORE.Controllers
return done;
}
/// <summary>
/// Elenco annualità con negoziazioni presenti
/// </summary>
/// <returns></returns>
public List<int> NegotYears()
{
List<int> dbResult = new List<int>();
@@ -2327,20 +2348,22 @@ namespace SHERPA.BBM.CORE.Controllers
}
/// <summary>
/// Elenco ultimi Items
/// Elenco Risorse da filtro
/// </summary>
/// <param name="docId"></param>
/// <param name="ResType"></param>
/// <param name="numRecord"></param>
/// <param name="anno">Anno</param>
/// <param name="baskId">Basket</param>
/// <param name="negoId">Negoziazione</param>
/// <param name="docId">Documento</param>
/// <param name="ResTypeId">Tipo risorsa</param>
/// <returns></returns>
public List<ResourcesModel> ResourceGetLastDesc(int anno, int baskId, int negoId, int docId, BbmResType ResType = BbmResType.ND)
public List<ResourcesModel> ResourceGetLastDesc(int anno, int baskId, int negoId, int docId, int ResTypeId = 0)
{
List<ResourcesModel> dbResult = new List<ResourcesModel>();
using (SHERPABBMContext dbCtx = new SHERPABBMContext(_configuration))
{
dbResult = dbCtx
.DbSetResources
.Where(x => (x.Anno == anno || anno == 0) && (x.Item.ResType == ResType || ResType == BbmResType.ND) && (x.DocNav.NegotNav.BasketId == baskId || baskId <= 1) && (x.DocNav.NegotiationId == negoId || negoId <= 1) && (x.DocId == docId || docId <= 1) && (docId > 0 || x.DocNav.IsActive))
.Where(x => (x.Anno == anno || anno == 0) && (x.Item.ResTypeId == ResTypeId || ResTypeId == 0) && (x.DocNav.NegotNav.BasketId == baskId || baskId <= 1) && (x.DocNav.NegotiationId == negoId || negoId <= 1) && (x.DocId == docId || docId <= 1) && (docId > 0 || x.DocNav.IsActive))
.Include(r => r.Item)
.OrderByDescending(x => x.Ordinal)
.ToList();
+6 -2
View File
@@ -28,8 +28,8 @@ namespace SHERPA.BBM.CORE.DbModels
[Column("CodItem"), MaxLength(50)]
public string CodItem { get; set; } = "ITEM.000000";
[Column("ResType")]
public BbmResType ResType { get; set; } = BbmResType.ND;
[Column("ResTypeId")]
public int ResTypeId { get; set; } = 0;
[Column("UM"), MaxLength(50)]
public string UM { get; set; } = "nr";
@@ -62,8 +62,12 @@ namespace SHERPA.BBM.CORE.DbModels
}
[ForeignKey("ResTypeId")]
public virtual ItemResTypeModel ResTypeNav { get; set; }
public virtual ICollection<OrderResModel> OrdResNav { get; set; }
public virtual ICollection<ResourcesModel> ResNav { get; set; }
public virtual ICollection<TagItemModel> TagNav { get; set; }
}
}
+2 -2
View File
@@ -24,8 +24,8 @@ namespace SHERPA.BBM.CORE.DbModels
[Column("CodItem"), MaxLength(50)]
public string CodItem { get; set; } = "ITEM.000000";
[Column("ResType")]
public BbmResType ResType { get; set; } = BbmResType.ND;
[Column("ResTypeId")]
public int ResTypeId { get; set; } = 0;
[Column("UM"), MaxLength(50)]
public string UM { get; set; } = "nr";
+3 -1
View File
@@ -20,6 +20,7 @@ namespace SHERPA.BBM
Licenza = 10000
}
#if false
/// <summary>
/// Tipo Risorsa BBM
/// </summary>
@@ -30,7 +31,8 @@ namespace SHERPA.BBM
License = 2,
HW = 3,
Service = 4
}
}
#endif
/// <summary>
/// Tipo Tag
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SHERPA.BBM.CORE.Migrations
{
public partial class AddFK_ResType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ResType",
table: "Items",
newName: "ResTypeId");
migrationBuilder.CreateIndex(
name: "IX_Items_ResTypeId",
table: "Items",
column: "ResTypeId");
migrationBuilder.AddForeignKey(
name: "FK_Items_ResType_ResTypeId",
table: "Items",
column: "ResTypeId",
principalTable: "ResType",
principalColumn: "ResTypeId",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Items_ResType_ResTypeId",
table: "Items");
migrationBuilder.DropIndex(
name: "IX_Items_ResTypeId",
table: "Items");
migrationBuilder.RenameColumn(
name: "ResTypeId",
table: "Items",
newName: "ResType");
}
}
}
@@ -497,9 +497,9 @@ namespace SHERPA.BBM.CORE.Migrations
.HasColumnType("nvarchar(250)")
.HasColumnName("Descript");
b.Property<int>("ResType")
b.Property<int>("ResTypeId")
.HasColumnType("int")
.HasColumnName("ResType");
.HasColumnName("ResTypeId");
b.Property<string>("UM")
.HasMaxLength(50)
@@ -512,6 +512,8 @@ namespace SHERPA.BBM.CORE.Migrations
b.HasKey("ItemId");
b.HasIndex("ResTypeId");
b.ToTable("Items");
});
@@ -1070,7 +1072,7 @@ namespace SHERPA.BBM.CORE.Migrations
.HasColumnType("int")
.HasColumnName("OrdNumRef");
b.Property<int>("ResType")
b.Property<int>("ResTypeId")
.HasColumnType("int")
.HasColumnName("ResType");
@@ -1429,6 +1431,17 @@ namespace SHERPA.BBM.CORE.Migrations
b.Navigation("Document");
});
modelBuilder.Entity("SHERPA.BBM.CORE.DbModels.ItemsModel", b =>
{
b.HasOne("SHERPA.BBM.CORE.DbModels.ItemResTypeModel", "ResTypeNav")
.WithMany()
.HasForeignKey("ResTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ResTypeNav");
});
modelBuilder.Entity("SHERPA.BBM.CORE.DbModels.NegotiationsModel", b =>
{
b.HasOne("SHERPA.BBM.CORE.DbModels.BasketsModel", "Basket")
+1 -2
View File
@@ -51,8 +51,7 @@ namespace SHERPA.BBM.UI.Components
answ = (currItem.DocId == DocId) ? "table-info" : "";
}
catch
{
}
{ }
}
return answ;
+3 -3
View File
@@ -16,10 +16,10 @@
</div>
</div><div class="col-6 col-lg-3">
<label for="dataIns">Tipo:</label>
<InputSelect @bind-Value="@_currItem.ResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
<InputSelect @bind-Value="@_currItem.ResTypeId" class="form-control form-control-sm">
@foreach (var item in ResTypeList)
{
<option>@value</option>
<option value="@item.ResTypeId">@item.Name</option>
}
</InputSelect>
</div>
@@ -28,6 +28,9 @@ namespace SHERPA.BBM.UI.Components
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public List<ItemResTypeModel> ResTypeList { get; set; } = null!;
#endregion Public Properties
#region Protected Fields
@@ -19,10 +19,10 @@
<span class="oi oi-tag" aria-hidden="true"></span>
</span>
</div>
<select @bind="@currResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
<select @bind="@currResTypeId" class="form-control form-control-sm">
@foreach (var item in ListResType)
{
<option>@value</option>
<option value="@item.ResTypeId">@item.Name</option>
}
</select>
</div>
@@ -53,7 +53,7 @@
{
@foreach (var item in itemsList)
{
<option value="@item.ItemId">@item.ResType | @item.Descript | @item.UnitPrice.ToString("C2")/@item.UM</option>
<option value="@item.ItemId">@item.ResTypeId | @item.Descript | @item.UnitPrice.ToString("C2")/@item.UM</option>
}
}
</InputSelect>
@@ -22,18 +22,18 @@ namespace SHERPA.BBM.UI.Components
}
[Parameter]
public BbmResType currResType
public int currResTypeId
{
get
{
return _currResType;
return _currResTypeId;
}
set
{
if (!_currResType.Equals(value))
if (!_currResTypeId.Equals(value))
{
_currResType = value;
_currResTypeId = value;
ReloadAllData().ConfigureAwait(false);
}
}
@@ -50,7 +50,7 @@ namespace SHERPA.BBM.UI.Components
#region Protected Fields
protected ResourcesModel _currItem = new ResourcesModel();
protected BbmResType _currResType = BbmResType.ND;
protected int _currResTypeId = 0;
protected int _selTagId = 0;
#endregion Protected Fields
@@ -184,7 +184,8 @@ namespace SHERPA.BBM.UI.Components
protected async Task ReloadAllData()
{
tagsList = await BBMService.TagsGetAll(TagType.Items);
var rawItems = await BBMService.ItemsGetFilt(currResType, "");
ListResType = await BBMService.ItemResTypeGetAll();
var rawItems = await BBMService.ItemsGetFilt(currResTypeId, "");
// filtro x tag se necessario...
if (SelTagId != 0)
{
@@ -203,6 +204,7 @@ namespace SHERPA.BBM.UI.Components
#region Private Fields
private List<vItemsDataModel>? itemsList;
private List<ItemResTypeModel> ListResType = new List<ItemResTypeModel>();
private List<TagModel>? tagsList;
#endregion Private Fields
+49 -4
View File
@@ -1069,13 +1069,50 @@ namespace SHERPA.BBM.UI.Data
}
}
/// <summary>
/// Elenco tipi risorse/item
/// </summary>
/// <returns></returns>
public Task<List<ItemResTypeModel>> ItemResTypeGetAll()
{
string source = "DB";
List<ItemResTypeModel>? dbResult = new List<ItemResTypeModel>();
string currKey = $"{rKeyListSel}:ItemResType";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = redisDb.StringGet(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
try
{
dbResult = JsonConvert.DeserializeObject<List<ItemResTypeModel>>(rawData);
}
catch
{ }
}
else
{
dbResult = dbController.ItemResTypeGetAll();
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
redisDb.StringSet(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<ItemResTypeModel>();
}
stopWatch.Stop();
LogDebug($"ItemResTypeGetAll | {source} ", stopWatch.Elapsed);
return Task.FromResult(dbResult);
}
/// <summary>
/// Gestione items con cache redis x tipo...
/// </summary>
/// <param name="ResType"></param>
/// <param name="searchVal"></param>
/// <returns></returns>
public Task<List<vItemsDataModel>> ItemsGetFilt(BbmResType ResType, string searchVal)
public Task<List<vItemsDataModel>> ItemsGetFilt(int ResType, string searchVal)
{
string source = "DB";
List<vItemsDataModel>? dbResult = new List<vItemsDataModel>();
@@ -1819,10 +1856,18 @@ namespace SHERPA.BBM.UI.Data
return Task.FromResult(dbController.ResourceGetLastDesc(anno, numRec));
}
public Task<List<ResourcesModel>> ResourcesGetAsync(int anno, int baskId, int negoId, int docId, BbmResType resType)
/// <summary>
/// Elenco Risorse da filtro
/// </summary>
/// <param name="anno">Anno</param>
/// <param name="baskId">Basket</param>
/// <param name="negoId">Negoziazione</param>
/// <param name="docId">Documento</param>
/// <param name="ResTypeId">Tipo risorsa</param>
/// <returns></returns>
public Task<List<ResourcesModel>> ResourcesGetAsync(int anno, int baskId, int negoId, int docId, int resTypeId)
{
//baskId, negoId,
return Task.FromResult(dbController.ResourceGetLastDesc(anno, baskId, negoId, docId, resType));
return Task.FromResult(dbController.ResourceGetLastDesc(anno, baskId, negoId, docId, resTypeId));
}
public Task<double> ResourcesGetGrandTotal(int DocId)
+1 -1
View File
@@ -146,7 +146,7 @@ namespace SHERPA.BBM.UI.Pages
listReplace.Add("{{DATA_DOC}}", $"{DateTime.Today:ddd dd/MM/yyyy}");
officeXmlMan.replaceDocxText(destPath, listReplace);
// aggiungo tab risorse ordine
var listDocRes = await BBMService.ResourcesGetAsync(0, 0, 0, currRecord.DocId, BbmResType.ND);
var listDocRes = await BBMService.ResourcesGetAsync(0, 0, 0, currRecord.DocId, 0);
officeXmlMan.InsertOrderResTable(destPath, "BMARK_RISORSE", listDocRes);
}
catch (Exception exc)
+4 -4
View File
@@ -34,9 +34,9 @@
</span>
</div>
<select @bind="@SelResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
@foreach (var item in ListResType)
{
<option>@value</option>
<option value="@item.ResTypeId">@item.Name</option>
}
</select>
<div class="input-group-append">
@@ -52,7 +52,7 @@
<div class="card-body">
@if (currItem != null && EditMode)
{
<ItemsEditor currItem="@currItem" DataReset="ResetData" DataUpdated="ForceReloadData"></ItemsEditor>
<ItemsEditor currItem="@currItem" DataReset="ResetData" DataUpdated="ForceReloadData" ResTypeList="@ListResType"></ItemsEditor>
}
@if (ListRecords == null)
{
@@ -119,7 +119,7 @@
}
</td>
<td>@record.CodItem</td>
<td>@record.ResType</td>
<td>@record.ResTypeId</td>
<td>@record.UM</td>
<td>@record.Descript</td>
<td class="text-right">
+107 -101
View File
@@ -49,6 +49,15 @@ namespace SHERPA.BBM.UI.Pages
[Inject]
protected BBM_EFService BBMService { get; set; } = null!;
protected bool EditMode { get; set; } = true;
protected string EditModeMsg
{
get => EditMode ? "Standard Edit" : "Merge Item";
}
protected List<int> Item2Merge { get; set; } = new List<int>();
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -68,7 +77,7 @@ namespace SHERPA.BBM.UI.Pages
ItemsModel newRecord = new ItemsModel()
{
CodItem = newCode,
ResType = BbmResType.ND,
ResTypeId = 0,
UM = "NR",
UnitPrice = 1,
Descript = "Nuovo Item"
@@ -84,6 +93,27 @@ namespace SHERPA.BBM.UI.Pages
await BBMService.ItemDelete(currRecord.ItemId);
await ForceReloadData();
}
/// <summary>
/// Esegue merge degli item selezionati..
/// </summary>
/// <returns></returns>
protected async Task DoMerge()
{
if (currItem != null)
{
await BBMService.ItemMerge(currItem.ItemId, Item2Merge);
DoReset();
}
await ForceReloadData();
}
protected void DoReset()
{
currItem = null;
Item2Merge = new List<int>();
}
/// <summary>
/// Edit record
/// </summary>
@@ -92,6 +122,69 @@ namespace SHERPA.BBM.UI.Pages
{
currItem = await BBMService.ItemFind(currRecord.ItemId);
}
protected async Task ForceReloadData()
{
currItem = null;
await Task.Delay(1);
await ReloadAllData();
}
protected async Task NewRelease(vItemsDataModel currRecord)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler clonare l'item corrente?"))
return;
// recupero counter
int lastDot = currRecord.CodItem.LastIndexOf(".");
string oldCode = currRecord.CodItem.Substring(0, lastDot);
string newCode = BBMService.CounterGetNext(oldCode, 2);
ItemsModel newRecord = new ItemsModel()
{
CodItem = newCode,
ResTypeId = currRecord.ResTypeId,
UM = currRecord.UM,
UnitPrice = currRecord.UnitPrice,
Descript = "COPIA di " + currRecord.Descript
};
currItem = newRecord;
}
protected override async Task OnInitializedAsync()
{
MService.NotifyHeadChanged();
MService.ShowSearch = true;
MService.SearchVal = "";
MService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
protected async void OnSeachUpdated()
{
currPage = 1;
Log.Trace($"SearchVal: {MService.SearchVal}");
await ReloadAllData();
await InvokeAsync(StateHasChanged);
}
protected async Task ReloadAllData()
{
ListResType = await BBMService.ItemResTypeGetAll();
SearchRecords = await BBMService.ItemsGetFilt(SelResType, MService.SearchVal);
TotalCount = SearchRecords.Count();
SortTable();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
protected void ResetData()
{
if (currItem != null)
{
BBMService.rollBackEdit(currItem);
}
currItem = null;
}
/// <summary>
/// Selezione x Merge
/// </summary>
@@ -124,102 +217,18 @@ namespace SHERPA.BBM.UI.Pages
}
}
/// <summary>
/// Esegue merge degli item selezionati..
/// </summary>
/// <returns></returns>
protected async Task DoMerge()
{
if (currItem != null)
{
await BBMService.ItemMerge(currItem.ItemId, Item2Merge);
DoReset();
}
await ForceReloadData();
}
protected void DoReset()
{
currItem = null;
Item2Merge = new List<int>();
}
protected List<int> Item2Merge { get; set; } = new List<int>();
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
await ReloadAllData();
}
protected async Task ForceReloadData()
{
currItem = null;
await Task.Delay(1);
await ReloadAllData();
}
protected async Task SetNumPage(int newNum)
{
currPage = newNum;
await ReloadAllData();
}
protected async Task NewRelease(vItemsDataModel currRecord)
protected async Task SetNumRec(int newNum)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler clonare l'item corrente?"))
return;
// recupero counter
int lastDot = currRecord.CodItem.LastIndexOf(".");
string oldCode = currRecord.CodItem.Substring(0, lastDot);
string newCode = BBMService.CounterGetNext(oldCode, 2);
ItemsModel newRecord = new ItemsModel()
{
CodItem = newCode,
ResType = currRecord.ResType,
UM = currRecord.UM,
UnitPrice = currRecord.UnitPrice,
Descript = "COPIA di " + currRecord.Descript
};
currItem = newRecord;
}
protected override async Task OnInitializedAsync()
{
MService.NotifyHeadChanged();
MService.ShowSearch = true;
MService.SearchVal = "";
MService.EA_SearchUpdated += OnSeachUpdated;
numRecord = newNum;
await ReloadAllData();
}
protected async void OnSeachUpdated()
{
currPage = 1;
Log.Trace($"SearchVal: {MService.SearchVal}");
await ReloadAllData();
await InvokeAsync(StateHasChanged);
}
protected async Task ReloadAllData()
{
SearchRecords = await BBMService.ItemsGetFilt(SelResType, MService.SearchVal);
TotalCount = SearchRecords.Count();
SortTable();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
protected void ResetData()
{
if (currItem != null)
{
BBMService.rollBackEdit(currItem);
}
currItem = null;
}
protected async Task SortRequested(SortCallBack e)
{
sortField = e.ParamName;
@@ -227,13 +236,6 @@ namespace SHERPA.BBM.UI.Pages
await ReloadAllData();
}
protected bool EditMode { get; set; } = true;
protected string EditModeMsg
{
get => EditMode ? "Standard Edit" : "Merge Item";
}
#endregion Protected Methods
#region Private Fields
@@ -241,6 +243,7 @@ namespace SHERPA.BBM.UI.Pages
private static Logger Log = LogManager.GetCurrentClassLogger();
private ItemsModel? currItem = null;
private List<vItemsDataModel> ListRecords = new List<vItemsDataModel>();
private List<ItemResTypeModel> ListResType = new List<ItemResTypeModel>();
private List<vItemsDataModel> SearchRecords = new List<vItemsDataModel>();
private bool sortAsc = true;
@@ -250,7 +253,7 @@ namespace SHERPA.BBM.UI.Pages
#region Private Properties
private BbmResType _SelResType { get; set; } = BbmResType.ND;
private int _SelResType { get; set; } = 0;
private string cssBtnResRType
{
@@ -263,7 +266,7 @@ namespace SHERPA.BBM.UI.Pages
private int numRecord { get; set; } = 10;
private BbmResType SelResType
private int SelResType
{
get
{
@@ -271,9 +274,12 @@ namespace SHERPA.BBM.UI.Pages
}
set
{
_SelResType = value;
var pUpd = Task.Run(async () => await ReloadAllData());
pUpd.Wait();
if (_SelResType != value)
{
_SelResType = value;
var pUpd = Task.Run(async () => await ReloadAllData());
pUpd.Wait();
}
}
}
@@ -344,11 +350,11 @@ namespace SHERPA.BBM.UI.Pages
case "Tipo":
if (sortAsc)
{
SearchRecords = SearchRecords.OrderBy(x => x.ResType).ToList();
SearchRecords = SearchRecords.OrderBy(x => x.ResTypeId).ToList();
}
else
{
SearchRecords = SearchRecords.OrderByDescending(x => x.ResType).ToList();
SearchRecords = SearchRecords.OrderByDescending(x => x.ResTypeId).ToList();
}
break;
+3 -3
View File
@@ -29,9 +29,9 @@
</span>
</div>
<select @bind="@SelResType" class="form-control form-control-sm">
@foreach (var value in Enum.GetValues(typeof(BbmResType)))
@foreach (var item in ListResType)
{
<option>@value</option>
<option value="@item.ResTypeId">@item.Name</option>
}
</select>
</div>
@@ -44,7 +44,7 @@
<div class="card-body">
@if (currItem != null)
{
<ResourcesEditor currItem="@currItem" currResType="@SelResType" DataReset="ResetData" DataUpdated="UpdateData"></ResourcesEditor>
<ResourcesEditor currItem="@currItem" currResTypeId="@SelResType" DataReset="ResetData" DataUpdated="UpdateData"></ResourcesEditor>
}
@if (ListRecords == null)
{
+47 -39
View File
@@ -9,25 +9,6 @@ namespace SHERPA.BBM.UI.Pages
{
public partial class Resources : ComponentBase
{
#region Public Methods
private string checkSelect(int ResourceId)
{
string answ = "";
if (currItem != null)
{
try
{
answ = (currItem.ResourceId == ResourceId) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
#endregion Public Methods
#region Protected Fields
protected int totalCount = 0;
@@ -57,6 +38,22 @@ namespace SHERPA.BBM.UI.Pages
#region Protected Methods
protected void Clone(ResourcesModel currRecord)
{
int newOrd = SearchRecords != null ? SearchRecords.Count + 1 : 1;
currItem = new ResourcesModel()
{
DocId = currRecord.DocId,
ItemId = currRecord.ItemId,
Anno = currRecord.Anno,
Note = currRecord.Note,
QtyPrev = currRecord.QtyPrev,
QtyOff = currRecord.QtyOff,
UnitPriceOff = currRecord.UnitPriceOff,
Ordinal = newOrd
};
}
protected void CreateNew()
{
int newOrd = SearchRecords != null ? SearchRecords.Count + 1 : 1;
@@ -90,22 +87,6 @@ namespace SHERPA.BBM.UI.Pages
{
currItem = currRecord;
}
protected void Clone(ResourcesModel currRecord)
{
int newOrd = SearchRecords != null ? SearchRecords.Count + 1 : 1;
currItem = new ResourcesModel()
{
DocId = currRecord.DocId,
ItemId = currRecord.ItemId,
Anno = currRecord.Anno,
Note = currRecord.Note,
QtyPrev = currRecord.QtyPrev,
QtyOff = currRecord.QtyOff,
UnitPriceOff = currRecord.UnitPriceOff,
Ordinal = newOrd
};
}
protected async Task ForceReload(int newNum)
{
@@ -167,6 +148,7 @@ namespace SHERPA.BBM.UI.Pages
protected async Task ReloadAllData()
{
ListResType = await BBMService.ItemResTypeGetAll();
await updateTable();
}
@@ -204,21 +186,26 @@ namespace SHERPA.BBM.UI.Pages
private ResourcesModel? currItem = null;
private List<ResourcesModel> ListRecords = new List<ResourcesModel>();
private List<ItemResTypeModel> ListResType = new List<ItemResTypeModel>();
private List<ResourcesModel> SearchRecords = new List<ResourcesModel>();
#endregion Private Fields
#region Private Properties
private BbmResType _SelResType { get; set; } = BbmResType.ND;
private int _SelResType { get; set; } = 0;
private string _SelUM { get; set; } = "";
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
private BbmResType SelResType
private int SelResType
{
get
{
@@ -226,8 +213,11 @@ namespace SHERPA.BBM.UI.Pages
}
set
{
_SelResType = value;
updateTable().ConfigureAwait(false);
if (_SelResType != value)
{
_SelResType = value;
updateTable().ConfigureAwait(false);
}
}
}
@@ -246,5 +236,23 @@ namespace SHERPA.BBM.UI.Pages
#endregion Private Properties
#region Private Methods
private string checkSelect(int ResourceId)
{
string answ = "";
if (currItem != null)
{
try
{
answ = (currItem.ResourceId == ResourceId) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>60fcdaab-6c1e-4bec-9d88-f7727ef1c12c</UserSecretsId>
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
<Version>2.0.2402.1215</Version>
<Version>2.0.2402.1217</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Copyright>Egalware 2021+</Copyright>