Merge remote-tracking branch 'gitlab.seriate/DataLayer' into develop
This commit is contained in:
@@ -193,6 +193,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
dbCtx.MachGroupList.Remove(MG2Del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// registro modifica StatusMap
|
||||
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
|
||||
@@ -379,15 +379,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// preparo elenco
|
||||
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
|
||||
|
||||
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
|
||||
List<PartModel> PartList2Add = new List<PartModel>();
|
||||
// cerco le MG esistenti --> aggiorno
|
||||
foreach (var item in MachGroupList)
|
||||
{
|
||||
#if false
|
||||
var currMG = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
|
||||
.SingleOrDefault();
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
|
||||
.SingleOrDefault();
|
||||
#endif
|
||||
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
||||
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
|
||||
if (currMG != null)
|
||||
{
|
||||
@@ -402,11 +406,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currMG.Name = convCurrMG.Name;
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
// registro modifica StatusMap
|
||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsMG2Add.Add(convCurrMG);
|
||||
// registro modifica StatusMap
|
||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
}
|
||||
}
|
||||
// aggiungo MachGroup
|
||||
@@ -417,7 +425,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// verifico di nuovo l'elenco delle MG x le relative PART...
|
||||
foreach (var item in MachGroupList)
|
||||
{
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, item.Id).MachGroupDbId;
|
||||
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
|
||||
int MachGroupDbId = currMG.MachGroupDbId;
|
||||
bool addMg = false;
|
||||
bool modMg = false;
|
||||
// verifico se uguali o meno...
|
||||
foreach (var currPartM in item.PartMList)
|
||||
{
|
||||
@@ -442,13 +453,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currPart.NAM = convCurrPartM.NAM;
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
modMg = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartList2Add.Add(convCurrPartM);
|
||||
addMg = true;
|
||||
}
|
||||
}
|
||||
// verifico se salvare...
|
||||
if (modMg)
|
||||
{
|
||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
if(addMg)
|
||||
{
|
||||
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo PartList
|
||||
@@ -456,6 +478,21 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
|
||||
// sel dei MachGroup da prod OLD
|
||||
List<MachGroupModel> itemsMGOld = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId)
|
||||
.ToList();
|
||||
// elenco degli ID del MachGroup NON trovati
|
||||
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
|
||||
// processo i MachGroup eliminati
|
||||
foreach (var item in MgId2rem)
|
||||
{
|
||||
MachGroupController.man.Delete(ProdId, item);
|
||||
}
|
||||
|
||||
|
||||
// aggiorno valore isNew a false x PROD
|
||||
currData.IsNew = false;
|
||||
|
||||
|
||||
@@ -147,8 +147,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
|
||||
// svuoto dati precedenti
|
||||
done = DeleteSession("");
|
||||
#if false
|
||||
// svuoto dati precedenti IN BLOCCO
|
||||
done = DeleteSession("");
|
||||
#endif
|
||||
// gestione corretta x multi-supervisors
|
||||
done = DeleteSession(SupervisorId);
|
||||
|
||||
// se ho fatto inserisco nuovo
|
||||
if (done)
|
||||
@@ -215,6 +219,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
|
||||
// vecchia versione
|
||||
#if false
|
||||
// recupero record richiesto
|
||||
var currRecor = dbCtx
|
||||
.StatusMapList
|
||||
@@ -226,6 +233,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currRecor.Operation = Operation;
|
||||
currRecor.Val = Value;
|
||||
|
||||
#endif
|
||||
// creo un nuovo record
|
||||
DateTime adesso = DateTime.Now;
|
||||
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
|
||||
dbCtx.StatusMapList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
|
||||
Reference in New Issue
Block a user