Merge remote-tracking branch 'gitlab.seriate/DataLayer' into feature/NewWarehouse
This commit is contained in:
@@ -28,6 +28,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool servOk = commLib.CheckRemote();
|
||||
Log.Info($"Avviato MagmanController | server: {ServerAddress} | timeout: standard (500ms)| CheckRemote OK: {servOk}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init controller gestione MagmanSync
|
||||
/// </summary>
|
||||
@@ -252,14 +253,56 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue sync forzato risorse (Materiali + RawItem):
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ResourcesForceSyncAll()
|
||||
{
|
||||
bool answ = false;
|
||||
// verifico server ok
|
||||
bool servOk = commLib.CheckRemote();
|
||||
if (servOk)
|
||||
{
|
||||
using (MaterialsController matDbContr = new MaterialsController())
|
||||
{
|
||||
using (RawItemsController rawItemDbContr = new RawItemsController())
|
||||
{
|
||||
// elenco di tutti i materiali
|
||||
var matListAll = commLib.MaterialsGet();
|
||||
// ciclo 1:1 materiali + inventario
|
||||
foreach (var mat in matListAll)
|
||||
{
|
||||
List<MaterialDTO> list2merge = commLib.InventoryGet(mat.MatCloudId);
|
||||
// ciclo sui materiali...
|
||||
if (list2merge != null)
|
||||
{
|
||||
foreach (var item in list2merge)
|
||||
{
|
||||
_ = matDbContr.Insert(MaterialsController.ConvToModel(item));
|
||||
// ora processo 1:1 gli items...
|
||||
foreach (var rawItem in item.ItemList)
|
||||
{
|
||||
rawItemDbContr.Upsert(RawItemsController.ConvToModel(rawItem, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue sync risorse (Materiali + RawItem) dato elenco MatId:
|
||||
/// - upload + sync (cloud)
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="MatIdList">
|
||||
/// Elenco Id dei materiali (DB LOCALE):
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// Elenco Id dei materiali (DB LOCALE): saranno inviati x sync (con quantità sovrascritta)
|
||||
/// SOLO SE RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public bool ResourcesSync(List<int> MatIdList)
|
||||
@@ -371,8 +414,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="MatIdList">
|
||||
/// Elenco Id dei materiali (DB LOCALE):
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// Elenco Id dei materiali (DB LOCALE): saranno inviati x sync (con quantità sovrascritta)
|
||||
/// SOLO SE RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ResourcesSyncAsync(List<int> MatIdList)
|
||||
@@ -404,8 +447,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="itemList">
|
||||
/// Elenco item dal DB locale
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// Elenco item dal DB locale saranno inviati x sync (con quantità sovrascritta) SOLO SE
|
||||
/// RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ResourcesSyncAsync(List<RawItemModel> itemList)
|
||||
|
||||
Reference in New Issue
Block a user