public void GetGeneralMineData(MineGeneral model) { model.ProdPlan = _cdbService.GetPlanData(model.LocationID, fromDate, toDate); var location = _cdbService.FindLocationByLocationID(model.LocationID); var oracleShop = (OracleShop)Enum.Parse(typeof(OracleShop), model.LocationID); try { var staffnum = _cdbService.GetStuffCount((int)oracleShop, fromDate, toDate); model.Productivity = (float)model.ProdFact / staffnum; } catch (Exception e) { _logger.Error(e, "Exception getting data for GetGeneralData"); } model.MineName = GetLocationNameOnCurrentLanguate(model.LocationID); }
private MnemonicMain GetMnemoticMainModel() { var model = new MnemonicMain(); var fromDate = GetDateFromCookie("fromdate"); var toDate = GetDateFromCookie("todate"); try { var prodFactDataTask = Task.Run(() => { var cdb = new CtsDbContext(); var prodFactData = cdb.SkipTransfers.Where(d => d.TransferTimeStamp >= fromDate && d.TransferTimeStamp <= toDate).Where(v => v.IsValid == true).Select(s => new SkipIndexData() { LocationID = s.Equip.Location.ID, ProdData = s.SkipWeight, LiftingID = s.LiftingID }).ToArray(); model.Kuz.ProdFact = GetProductionData("kuz", prodFactData); model.Kost.ProdFact = GetProductionData("kost", prodFactData); model.Abay.ProdFact = GetProductionData("abay", prodFactData); model.Len.ProdFact = GetProductionData("len", prodFactData); model.Sar1.ProdFact = GetProductionData("sar1", prodFactData); model.Sar3.ProdFact = GetProductionData("sar3", prodFactData); model.Kaz.ProdFact = GetProductionData("kaz", prodFactData); model.Shah.ProdFact = GetProductionData("shah", prodFactData); model.Tent.ProdFact = (int)Builder.GetBeltScaleModel(21).ProductionPerTimeInterval; }); var planDataTask = Task.Run(() => { var service = new CentralDBService(); model.Kuz.ProdPlan = service.GetPlanData("kuz", fromDate, toDate); model.Kost.ProdPlan = service.GetPlanData("kost", fromDate, toDate); model.Abay.ProdPlan = service.GetPlanData("abay", fromDate, toDate); model.Len.ProdPlan = service.GetPlanData("len", fromDate, toDate); model.Sar1.ProdPlan = service.GetPlanData("sar1", fromDate, toDate); model.Sar3.ProdPlan = service.GetPlanData("sar3", fromDate, toDate); model.Kaz.ProdPlan = service.GetPlanData("kaz", fromDate, toDate); model.Shah.ProdPlan = service.GetPlanData("shah", fromDate, toDate); model.Tent.ProdPlan = service.GetPlanData("tent", fromDate, toDate); }); var shippedDataTask = Task.Run(() => { var cdb = new CtsDbContext(); var shippedData = cdb.WagonTransfers.Where(d => d.TransferTimeStamp >= fromDate && d.TransferTimeStamp <= toDate).Where(v => v.IsValid == true).Select(s => new WagonIndexData() { LocationID = s.Equip.LocationID, Direction = s.Direction, Brutto = s.Brutto, ToDest = s.ToDest }).ToArray(); model.Kuz.Shipped = GetShippedData("kuz", shippedData); model.Kost.Shipped = GetShippedData("kost", shippedData); model.Abay.Shipped = GetShippedData("abay", shippedData); model.Len.Shipped = GetShippedData("len", shippedData); model.Sar1.Shipped = GetShippedData("sar1", shippedData); model.Sar3.Shipped = GetShippedData("sar3", shippedData); model.Kaz.Shipped = GetShippedData("kaz", shippedData); model.Shah.Shipped = GetShippedData("shah", shippedData); model.Tent.Shipped = GetShippedData("tent", shippedData); model.COF.Shipped = GetShippedData("cofv", shippedData); model.StAbay.Outcome = GetShippedData("sabay", shippedData); model.StDubov.Outcome = GetShippedData("sdub", shippedData); model.StRaspor.Outcome = GetShippedData("srasp", shippedData); model.StUgler.Outcome = GetShippedData("sugl", shippedData); model.StAbay.Income = GetStationIncome(shippedData, cdb.Locations.Find("sabay").LocationName); model.StDubov.Income = GetStationIncome(shippedData, cdb.Locations.Find("sdub").LocationName); model.StRaspor.Income = GetStationIncome(shippedData, cdb.Locations.Find("srasp").LocationName); model.StUgler.Income = GetStationIncome(shippedData, cdb.Locations.Find("sugl").LocationName); }); var atStockpileTask = Task.Run(() => { var cdb = new CtsDbContext(); var skladData = cdb.WarehouseTransfers.Where(d => d.TransferTimeStamp >= fromDate && d.TransferTimeStamp <= toDate).Select(s => new StocpileIndexData() { LocationID = s.Warehouse.LocationID, TransferTimeStamp = s.TransferTimeStamp, TotalQuantity = s.TotalQuantity }).ToArray(); model.Kuz.AtStockpile = GetStockpileValue("kuz", skladData); model.Kost.AtStockpile = GetStockpileValue("kost", skladData); model.Abay.AtStockpile = GetStockpileValue("abay", skladData); model.Len.AtStockpile = GetStockpileValue("len", skladData); model.Sar1.AtStockpile = GetStockpileValue("sar1", skladData); model.Sar3.AtStockpile = GetStockpileValue("sar3", skladData); model.Kaz.AtStockpile = GetStockpileValue("kaz", skladData); model.Shah.AtStockpile = GetStockpileValue("shah", skladData); model.Tent.AtStockpile = GetStockpileValue("tent", skladData); }); var warningTask = Task.Run(() => { AlarmHepler.GetMineAlarmLevel(model.Kuz, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Kost, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Abay, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Len, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Sar1, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Sar3, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Kaz, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Shah, fromDate, toDate); AlarmHepler.GetMineAlarmLevel(model.Tent, fromDate, toDate); }); Task.WaitAll(prodFactDataTask, planDataTask, shippedDataTask, atStockpileTask, warningTask); model.Abay.MineName = GetLocationNameOnCurrentLanguate("abay"); model.Kaz.MineName = GetLocationNameOnCurrentLanguate("kaz"); model.Kost.MineName = GetLocationNameOnCurrentLanguate("kost"); model.Kuz.MineName = GetLocationNameOnCurrentLanguate("kuz"); model.Len.MineName = GetLocationNameOnCurrentLanguate("len"); model.Sar1.MineName = GetLocationNameOnCurrentLanguate("sar1"); model.Sar3.MineName = GetLocationNameOnCurrentLanguate("sar3"); model.Shah.MineName = GetLocationNameOnCurrentLanguate("shah"); model.Tent.MineName = GetLocationNameOnCurrentLanguate("tent"); model.StAbay.StationName = GetLocationNameOnCurrentLanguate("sabay"); model.StAbay.StationID = "sabay"; model.StDubov.StationName = GetLocationNameOnCurrentLanguate("sdub"); model.StAbay.StationID = "sbub"; model.StRaspor.StationName = GetLocationNameOnCurrentLanguate("srasp"); model.StAbay.StationID = "srasp"; model.StUgler.StationName = GetLocationNameOnCurrentLanguate("sugl"); model.StAbay.StationID = "sugl"; } catch (Exception e) { _logger.Error(e, "Exception getting data for GetMnemoticMainModel"); } return(model); }