public void GetData() { GetSplitTimeOfDay(); GetStatusList(); GetModelList(); foreach (var model in ReqRpt018Models) { bool HasInserted = ShareDataEntity.GetSingleEntity().db.EQP_UPm_018.Any(w => w.Date == model.SomeDay && w.EqpID == model.EqpID); var model_020 = ReqRpt020Models.Where(w => w.EqpID == model.EqpID && w.SomeDay == model.SomeDay).First(); if (HasInserted) { int ids = ShareDataEntity.GetSingleEntity().db.EQP_UPm_018.Where(w => w.Date == model.SomeDay && w.EqpID == model.EqpID).FirstOrDefault().EntityID; EQP_UPm_018Entity entity = ShareDataEntity.GetSingleEntity().db.EQP_UPm_018.Find(ids); entity.PRDMin = model.PRDTimeSpan; entity.SBYMin = model.SBYTimeSpan; entity.SDTMin = model.SDTTimeSpan; entity.UDTMin = model.UDTTimeSpan; entity.ENGMin = model.ENGTimeSpan; entity.NSTMin = model.NSTTimeSpan; entity.PRDTestMin = model.PRDTestTimeSpan; entity.PMMin = model.PMTimeSpan; entity.Passqty = model_020.PassQty; entity.ReworkQty = model_020.ReworkQty; entity.EffMove = model_020.EffMove; } else { ShareDataEntity.GetSingleEntity().db.EQP_UPm_018.Add(new EQP_UPm_018Entity() { EqpID = model.EqpID, EqpType = ReqRpt018EqpStatusEntities.Where(w => w.EQP_ID == model.EqpID).FirstOrDefault().EQP_Type, Date = model.SomeDay, PRDMin = model.PRDTimeSpan, SBYMin = model.SBYTimeSpan, SDTMin = model.SDTTimeSpan, UDTMin = model.UDTTimeSpan, ENGMin = model.ENGTimeSpan, NSTMin = model.NSTTimeSpan, PRDTestMin = model.PRDTestTimeSpan, PMMin = model.PMTimeSpan, Passqty = model_020.PassQty, ReworkQty = model_020.ReworkQty, EffMove = model_020.EffMove }); } } ShareDataEntity.GetSingleEntity().db.SaveChanges(); }
public void TestGetData() { GetStatusList(); GetModelList(); var testModel = ReqRpt018Models.Where(w => w.EqpID == "TC-PLS-01"); var model = testModel.First(); Entity = new EQP_UPm_018Entity() { EqpID = model.EqpID, EqpType = ReqRpt018EqpStatusEntities.Where(w => w.EQP_ID == model.EqpID).FirstOrDefault().EQP_Type, Date = model.SomeDay, PRDMin = model.PRDTimeSpan, SBYMin = model.SBYTimeSpan, SDTMin = model.SDTTimeSpan, UDTMin = model.UDTTimeSpan, ENGMin = model.ENGTimeSpan, NSTMin = model.NSTTimeSpan, PRDTestMin = model.PRDTestTimeSpan, PMMin = model.PMTimeSpan }; }