public SummaryStatistic GetStatisticByDateAndShiftNum(DateTime shift, int shiftNum) { IntegramMESDataContext db = new IntegramMESDataContext(); var statistic = db.IWS_SP_GetProductionStatisticsByDateAndShift(shift, shiftNum).FirstOrDefault(); if (statistic != null) { SummaryStatistic summary = new SummaryStatistic { FrontOffline = statistic.FrontOffline, RearOffline = statistic.RearOffline, FirstRowFTT = (double)statistic.FirstRowFTT, FirstRowProduction = (int)statistic.FirstRowProduction, FirstRowRepairs = (int)statistic.FirstRowRepairs, FrontPerformance = (int)statistic.FrontPerformance, FrontRollingTarget = (int)statistic.FrontRollingTarget, FrontRollingTargetPercent = (int)statistic.FrontRollingTargetPercent, RearPerformance = (int)statistic.RearPerformance, RearRollingTarget = (int)statistic.RearRollingTarget, RearRollingTargetPercent = (int)statistic.RearRollingTargetPercent, SecondRowFTT = (double)statistic.SecondRowFTT, SecondRowProduction = (int)statistic.SecondRowProduction, SecondRowRepairs = (int)statistic.SecondRowRepairs, ThirdRowFTT = (double)statistic.ThirdRowFTT, ThirdRowProduction = (int)statistic.ThirdRowProduction, ThirdRowRepairs = (int)statistic.ThirdRowRepairs, WAPProduction = (int)statistic.WAPProduction, TotalLoadsShipped = (int)statistic.TotalLoadsShipped, }; return summary; } return null; }
public RULabelVerification ValidateRUJLabels([FromBody]RULabelVerification verification) { IntegramMESDataContext dbMes = new IntegramMESDataContext(); ReworkDataContext db = new ReworkDataContext(); string stationId = GetStationIdByLineId(verification.LineId); var scanner = db.IWS_SP_GetScannerTrackingByStationId(stationId).FirstOrDefault(); if (scanner != null) { var scannedData = scanner.Data.Trim(); //var scannedData = "5LA501D2AC5309107C"; if (scannedData != string.Empty) { //var dfd = verification.Serials.Where(s => RemoveSpecialCharacters(s.SerialNbr.Trim()) == scannedData).ToList(); if (verification.Serials.Any(s => RemoveSpecialCharacters(s.SerialNbr.Trim()).Equals(scannedData))) { var verfies = verification.Serials.Where(s => RemoveSpecialCharacters(s.SerialNbr.Trim()) == scannedData).ToList(); foreach (var v in verfies) v.Repaired = true; } } } return verification; }
public List<StationOvercycle> GetTopStationOvercycleSummaryByLineId(int id, int count) { IntegramMESDataContext db = new IntegramMESDataContext(); var overcycle = (from o in db.IWS_SP_GetTopOvercycleSummaryByLineId(id, count) select new StationOvercycle { StationId = o.StationId, TotalOvercycle = o.OvercycleMinutes }).ToList(); return overcycle; }
public List<AgvTracking> GetAgvTrackingByLineId(int id) { IntegramMESDataContext db = new IntegramMESDataContext(); var tracking = (from a in db.IWS_SP_GetAGVTrackingByLineId(id) select new AgvTracking { AgvNum = (int)a.AgvNum, JobId = (int)a.JobId, StationId = a.StationId }).ToList(); return tracking; }
public List<DowntimeEvent> GetDowntimeEventsByDateShiftLine(DateTime date, int shift, int lineId) { IntegramMESDataContext db = new IntegramMESDataContext(); var events = (from e in db.IWS_SP_GetDowntimeEvents(lineId, date, shift) select new DowntimeEvent { EventId = e.EventId, DowntimeType = e.DowntimeType, Category = new DowntimeCategory { Id = e.CategoryId, ShortDescription = e.CategoryShort, Description = e.CategoryLong }, SubCategory = new DowntimeSubCategory { Id = e.SubCategoryId, Description = e.SubCategory }, DowntimeHistory = new DowntimeHistory { DowntimeStation = new DowntimeStation { Id = e.StationId, Description = e.StationDescription }, DowntimeId = e.DowntimeId, DowntimeSeconds = (double)e.DowntimeSeconds, LineId = (int)e.LineId, DowntimeSide = new DowntimeSide { Id = e.SideId, Description = e.SideDescription }, DowntimeDTM = (DateTime)e.DowntimeDTM, DowntimeType = new DowntimeType { Id = e.DowntimeTypeId, Description = e.DowntimeType } }, Supplier = new DowntimeSupplier { Id = e.SupplierId, Description = e.Supplier }, Comments = e.Comments }).ToList(); return events; }
public PalletChange GetPalletChange(int palletId) { DispositionDataContext db = new DispositionDataContext(); IntegramMESDataContext trackDb = new IntegramMESDataContext(); MesDataContext dbMes = new MesDataContext(); ItemDetailsModel itemDetailModel = new ItemDetailsModel(); ReworkFactory reworkFactory = new ReworkFactory(); var palletHdr = (from p in dbMes.PalletInfos where p.PalletNbr == palletId && (p.Pallet_Type == "S1" || p.Pallet_Type == "S2") select p).FirstOrDefault(); if (palletHdr == null) return null; var jobInfo = (from j in dbMes.MasterJobTables where j.Job_ID == palletHdr.Job_ID select j).FirstOrDefault(); if (jobInfo == null) return null; var item = itemDetailModel.GetItemInfo(jobInfo.SKU); var convertSkuInfo = reworkFactory.GetSkuInfo(item).OrderBy(s=>s.PartIndex).ToList(); var palletChangeHistory = trackDb.PalletChangeHistories.Where(p => p.JobId == jobInfo.Job_ID).ToList(); PalletChange palletChange = new PalletChange { PalletId = palletId, Sku = jobInfo.SKU, JobId = jobInfo.Job_ID, OrderNumber = jobInfo.Order_Nbr, SkuInfo = convertSkuInfo, FinishDTM = (DateTime)jobInfo.FinishBld_DTTM, PalletChangeHistory = palletChangeHistory }; return palletChange; }
public List<IWS_SP_GetDowntimeStationIdResult> GetDowntimeStationId(int lineId) { IntegramMESDataContext db = new IntegramMESDataContext(); var stations = db.IWS_SP_GetDowntimeStationId(lineId).ToList(); return stations; }
public DowntimeEvent UpdateDowntimeEvent([FromBody]DowntimeEvent dtEvent) { IntegramMESDataContext db = new IntegramMESDataContext(); bool utcConvert = false; if (dtEvent.DowntimeHistory.DowntimeDTM.Kind == DateTimeKind.Utc) { utcConvert = true; dtEvent.DowntimeHistory.DowntimeDTM = dtEvent.DowntimeHistory.DowntimeDTM.ToLocalTime(); } var dbResult = db.IWS_SP_InsertDowntimeEvent(dtEvent.EventId, dtEvent.DowntimeHistory.DowntimeId, dtEvent.DowntimeHistory.DowntimeType.Id, dtEvent.DowntimeHistory.LineId, dtEvent.DowntimeHistory.DowntimeStation.Description, dtEvent.DowntimeHistory.DowntimeSide.Id, dtEvent.DowntimeHistory.DowntimeSeconds, dtEvent.DowntimeHistory.DowntimeDTM, dtEvent.Category.Id, dtEvent.SubCategory.Id, dtEvent.Supplier == null ? null : dtEvent.Supplier.Id, dtEvent.Comments).FirstOrDefault(); if (dbResult != null) { int? eventId = dbResult.EventId; int? downtimeId = dbResult.DowntimeId; dtEvent.EventId = eventId; dtEvent.DowntimeHistory.DowntimeId = downtimeId; //convert back to UTC for the client if (utcConvert) dtEvent.DowntimeHistory.DowntimeDTM = dtEvent.DowntimeHistory.DowntimeDTM.ToUniversalTime(); return dtEvent; } return null; }
public void DeleteDowntimeEvent(int id) { IntegramMESDataContext db = new IntegramMESDataContext(); var result = db.IWS_SP_DeleteDowntimeEvent(id); }
public List<RecipeBit> GetRecipeDefinition(int buildcode, int lineId) { IntegramMESDataContext db = new IntegramMESDataContext(); var bits = (from b in db.IWS_SP_GetRecipeDefinition(buildcode, lineId) select new RecipeBit { BitNo = b.BitNo, BitValue = (int)b.BitValue, Description = b.Description, Line = b.Line, LineId = b.LineId, BitOffMsgFull = b.BitOffMsgFull, BitOffMsgShort = b.BitOffMsgShort, BitOnMsgFull = b.BitOnMsgFull, BitOnMsgShort = b.BitOnMsgShort, OnOff = Convert.ToBoolean(b.OnOff), Obsolete = b.Obsolete }).ToList(); return bits; }
public LineStatistics GetStatisticsByLine(int lineId) { IntegramMESDataContext db = new IntegramMESDataContext(); var statistic = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault(); if (lineId == 1) { return new LineStatistics { FTT = (double)statistic.FirstRowFTT, Performance = (int)statistic.FrontPerformance, Production = (int)statistic.FirstRowProduction, Repairs = (int)statistic.FirstRowRepairs, RollingTarget = (int)statistic.FrontRollingTarget, RollingTargetPercent = (int)statistic.RearRollingTargetPercent, WAPProduction = (int)statistic.WAPProduction, TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped, TotalLoadsShipped = (int)statistic.TotalLoadsShipped, ShipBank = (int)statistic.ShipBank, FrontCleanLoads = (int)statistic.FrontCleanLoads, Inventory = statistic.FrontInventory, RearCleanLoads = (int)statistic.RearCleanLoads, AGVCount = statistic.FirstRowAgvCount, AGVCountVariance = statistic.FirstRowAgvVariance, }; } else if (lineId == 2) { return new LineStatistics { FTT = (double)statistic.SecondRowFTT, Performance = (int)statistic.RearPerformance, Production = (int)statistic.SecondRowProduction, Repairs = (int)statistic.SecondRowRepairs, RollingTarget = (int)statistic.RearRollingTarget, RollingTargetPercent = (int)statistic.RearRollingTargetPercent, WAPProduction = (int)statistic.WAPProduction, TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped, TotalLoadsShipped = (int)statistic.TotalLoadsShipped, ShipBank = (int)statistic.ShipBank, FrontCleanLoads = (int)statistic.FrontCleanLoads, RearCleanLoads = (int)statistic.RearCleanLoads, Inventory = statistic.RearInventory, AGVCount = statistic.SecondRowAgvCount, AGVCountVariance = statistic.SecondRowAgvVariance, }; } else if (lineId == 3) { return new LineStatistics { FTT = (double)statistic.ThirdRowFTT, Performance = (int)statistic.RearPerformance, Production = (int)statistic.ThirdRowProduction, Repairs = (int)statistic.ThirdRowRepairs, RollingTarget = (int)statistic.RearRollingTarget, RollingTargetPercent = (int)statistic.RearRollingTargetPercent, WAPProduction = (int)statistic.WAPProduction, TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped, TotalLoadsShipped = (int)statistic.TotalLoadsShipped, ShipBank = (int)statistic.ShipBank, FrontCleanLoads = (int)statistic.FrontCleanLoads, RearCleanLoads = (int)statistic.RearCleanLoads, Inventory = statistic.RearInventory, AGVCount = statistic.ThirdRowAgvCount, AGVCountVariance = statistic.ThirdRowAgvVariance, }; } return null; }
public List<IWS_SP_GetTopDefectSummaryByLineIdResult> GetTopDefectSummaryByLineId(int id, int count) { IntegramMESDataContext db = new IntegramMESDataContext(); var defects = db.IWS_SP_GetTopDefectSummaryByLineId(id, count).ToList(); return defects; }
public IWS_SP_GetProductionCurrentStatisticsResult GetCurrentStatistic() { IntegramMESDataContext db = new IntegramMESDataContext(); var statistic = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault(); return statistic; }
public List<IWS_SP_GetDowntimeSidesResult> GetDowntimeSides() { IntegramMESDataContext db = new IntegramMESDataContext(); var sides = db.IWS_SP_GetDowntimeSides().ToList(); return sides; }
public List<IWS_SP_GetDowntimeSubCategoriesResult> GetDowntimeSubCategories() { IntegramMESDataContext db = new IntegramMESDataContext(); var subCats = db.IWS_SP_GetDowntimeSubCategories().ToList(); return subCats; }
public List<IWS_SP_GetDowntimeCategoriesResult> GetDowntimeCategories() { IntegramMESDataContext db = new IntegramMESDataContext(); var cat = db.IWS_SP_GetDowntimeCategories().ToList(); return cat; }
public List<IWS_SP_GetDowntimeSuppliersResult> GetDowntimeSuppliers() { IntegramMESDataContext db = new IntegramMESDataContext(); var suppliers = db.IWS_SP_GetDowntimeSuppliers().ToList(); return suppliers; }
public List<PalletHistorySummary> GetPalletHistorySummaryByPalletId(int palletId) { IntegramMESDataContext db = new IntegramMESDataContext(); var history = (from s in db.IWS_SP_GetPalletHistorySummaryByPalletId(palletId) select new PalletHistorySummary() { JobId = (long)s.JobID, PalletID = (int)s.PalletID, ReceivedOn = (DateTime)s.PalletReceivedOn, ShipOrderNumber = s.ShipOrderNumber, ShipOrderSequenceNumber = s.ShipOrderSequenceNumber, Sku = s.PalletPickSku, Vin= s.Vin, ShippedOn = (DateTime)s.ShippedOn, }).ToList(); return history; }
public List<IWS_SP_GetSubCategoriesByCategoryIdResult> GetDowntimeSubCategoriesByCategoryId(int id) { IntegramMESDataContext db = new IntegramMESDataContext(); var sub = db.IWS_SP_GetSubCategoriesByCategoryId(id).ToList(); return sub; }
public List<RecipeBit> GetRecipesByLine(int lineId) { IntegramMESDataContext db = new IntegramMESDataContext(); var bits = (from b in db.vwRecipeDefinitions.Where(r => r.LineId == lineId) select new RecipeBit { BitNo = b.BitNo, BitValue = (int)b.BitValue, Description = b.Description, Line = b.Line, LineId = b.LineId, BitOffMsgFull = b.BitOffMsgFull, BitOffMsgShort = b.BitOffMsgShort, BitOnMsgFull = b.BitOnMsgFull, BitOnMsgShort = b.BitOnMsgShort, OnOff = false, Obsolete = b.Obsolete }).ToList(); return bits; }
public void SaveRUJLabelVerification([FromBody]RULabelVerification verification, int userId) { IntegramMESDataContext dbMes = new IntegramMESDataContext(); foreach (var s in verification.Serials) dbMes.IWS_SP_InsertRUJLabelVerification(userId, s.JobId, s.CSType, s.SerialNbr, s.StationId, s.Repaired); }