| | 1 | | using ReportingServices.Shared.HelperClasses; |
| | 2 | | using ReportingServices.Shared.Models.ProductionReport; |
| | 3 | | using ReportingServices.Shared.ViewModels.ProductionReport; |
| | 4 | |
|
| | 5 | | namespace ReportingServices.Shared.ViewModels.ProductionReport |
| | 6 | | { |
| | 7 | | public class DailyReport |
| | 8 | | { |
| 0 | 9 | | public DateTime StartDate { get; set; } |
| 0 | 10 | | public YieldStatistics CurrentWeek { get; set; } |
| 0 | 11 | | public YieldStatistics PreviousWeek { get; set; } |
| 0 | 12 | | public Dictionary<string, List<EquipmentStateByDay>> ToolAvailibilityByType { get; set; } |
| 0 | 13 | | public Dictionary<string, ToolStateByType> ToolStateByType { get; set; } |
| 0 | 14 | | public Dictionary<string, List<string>> ToolStatesByOwner { get; set; } |
| 0 | 15 | | public Dictionary<string, List<int>> DualLayerReactors { get; set; } |
| 0 | 16 | | public ManualReportEntries ManualReportEntries { get; set; } |
| 0 | 17 | | public List<UnloadTempsByDay> UnloadTempsByDay { get; set; } |
| 0 | 18 | | public List<SLLTool> SLLTools { get; set; } |
| 0 | 19 | | public int NumberOfToolsWaferSize6IN { get; set; } |
| 0 | 20 | | public int NumberOfToolsWaferSize8IN { get; set; } |
| 0 | 21 | | public int NumberOfToolsWaferSize6INScheduled { get; set; } |
| 0 | 22 | | public int NumberOfToolsWaferSize8INScheduled { get; set; } |
| 0 | 23 | | public QuarterlyTargets QuarterlyTargets { get; set; } |
| | 24 | |
|
| 0 | 25 | | public DailyReport() |
| 0 | 26 | | { |
| 0 | 27 | | ToolAvailibilityByType = new(); |
| 0 | 28 | | ToolStateByType = new(); |
| 0 | 29 | | DualLayerReactors = new(); |
| 0 | 30 | | UnloadTempsByDay = new(); |
| 0 | 31 | | StartDate = DateTime.Parse(APIHelperFunctions.GetBeginningOfWeekAsAPIString()); |
| 0 | 32 | | CurrentWeek = new(StartDate, true); |
| 0 | 33 | | PreviousWeek = new(StartDate.AddDays(-7), false); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | public void AddToolAvailibilityByType(string key, List<EquipmentStateByDay> states) |
| 0 | 37 | | { |
| 0 | 38 | | ToolAvailibilityByType.Add(key, states); |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | public void AddToolStateByType(string key, List<ToolStateCurrent> states) |
| 0 | 42 | | { |
| 0 | 43 | | ToolStateByType state = new(states); |
| | 44 | |
|
| 0 | 45 | | ToolStateByType.Add(key, state); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | public void SetReactorInfo(List<Reactor> reactors, List<int> unscheduledReactors) |
| 0 | 49 | | { |
| 0 | 50 | | SetToolsByPocketSize(reactors, unscheduledReactors); |
| 0 | 51 | | SetDisabledLoadlocks(reactors); |
| 0 | 52 | | } |
| | 53 | |
|
| | 54 | | public void SetRDSInfo(List<RDS> rdsList) |
| 0 | 55 | | { |
| 0 | 56 | | SetDualLayerReactors(rdsList); |
| 0 | 57 | | SetUnloadTempsLessThan700(rdsList); |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | private void SetToolsByPocketSize(List<Reactor> reactors, List<int> unscheduledReactors) |
| 0 | 61 | | { |
| 0 | 62 | | NumberOfToolsWaferSize6IN = reactors.Where(react => react.PocketSize.Contains("150")).Count(); |
| 0 | 63 | | NumberOfToolsWaferSize8IN = reactors.Where(react => react.PocketSize.Contains("200")).Count(); |
| | 64 | |
|
| 0 | 65 | | NumberOfToolsWaferSize6INScheduled = |
| 0 | 66 | | reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber) |
| 0 | 67 | | && react.PocketSize.Contains("150")).Count(); |
| 0 | 68 | | NumberOfToolsWaferSize8INScheduled = |
| 0 | 69 | | reactors.Where(react => !unscheduledReactors.Contains(react.ReactorNumber) |
| 0 | 70 | | && react.PocketSize.Contains("200")).Count(); |
| 0 | 71 | | } |
| | 72 | |
|
| | 73 | | private void SetDisabledLoadlocks(List<Reactor> reactors) |
| 0 | 74 | | { |
| 0 | 75 | | List<Reactor> reactorsWithDisabledLoadlocks = reactors.Where(react => react.HasDisabledLoadlock).ToList(); |
| | 76 | |
|
| 0 | 77 | | int singleLoadlockASM = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("ASM")).Count(); |
| 0 | 78 | | int singleLoadlockHTR = reactorsWithDisabledLoadlocks.Where(react => react.Type.Contains("HTR")).Count(); |
| | 79 | |
|
| 0 | 80 | | foreach (SLLTool sll in SLLTools) |
| 0 | 81 | | { |
| 0 | 82 | | if (sll.Date.Date == DateTime.Now.Date) |
| 0 | 83 | | { |
| 0 | 84 | | sll.ASM = singleLoadlockASM; |
| 0 | 85 | | sll.HTR = singleLoadlockHTR; |
| 0 | 86 | | return; |
| | 87 | | } |
| 0 | 88 | | } |
| | 89 | |
|
| 0 | 90 | | SLLTools.Add(new SLLTool |
| 0 | 91 | | { |
| 0 | 92 | | Date = DateTime.Now.Date, |
| 0 | 93 | | ASM = singleLoadlockASM, |
| 0 | 94 | | HTR = singleLoadlockHTR |
| 0 | 95 | | }); |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | private void SetDualLayerReactors(List<RDS> rdsList) |
| 0 | 99 | | { |
| 0 | 100 | | DateTime compareDate = DateTime.Now.Date; |
| 0 | 101 | | List<RDS> rdsWithDualLayerPSN = rdsList.Where(rds => rds.LayerType.Contains("2 Layer") && rds.DateOut == com |
| | 102 | |
|
| 0 | 103 | | DualLayerReactors.Add("ASM", rdsWithDualLayerPSN. |
| 0 | 104 | | Where(rds => rds.ReactorType.Contains("ASM")). |
| 0 | 105 | | OrderBy(rds => rds.Reactor). |
| 0 | 106 | | Select(rds => rds.Reactor). |
| 0 | 107 | | Distinct().ToList()); |
| 0 | 108 | | DualLayerReactors.Add("HTR", rdsWithDualLayerPSN. |
| 0 | 109 | | Where(rds => rds.ReactorType.Contains("HTR")). |
| 0 | 110 | | OrderBy(rds => rds.Reactor). |
| 0 | 111 | | Select(rds => rds.Reactor). |
| 0 | 112 | | Distinct().ToList()); |
| 0 | 113 | | DualLayerReactors.Add("EPP", rdsWithDualLayerPSN. |
| 0 | 114 | | Where(rds => rds.ReactorType.Contains("EPP")). |
| 0 | 115 | | OrderBy(rds => rds.Reactor). |
| 0 | 116 | | Select(rds => rds.Reactor). |
| 0 | 117 | | Distinct().ToList()); |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | private void SetUnloadTempsLessThan700(List<RDS> rdsList) |
| 0 | 121 | | { |
| 0 | 122 | | var rdsWithTempsLessThan700 = rdsList.Where(rds => rds.UnloadTemp < 700).GroupBy(rds => rds.DateOut); |
| | 123 | |
|
| 0 | 124 | | foreach (var group in rdsWithTempsLessThan700) |
| 0 | 125 | | { |
| 0 | 126 | | UnloadTempsByDay.Add(new UnloadTempsByDay |
| 0 | 127 | | { |
| 0 | 128 | | Date = group.Key, |
| 0 | 129 | | ASMUnloadsBelow700 = group.Where(rds => rds.ReactorType.Contains("ASM")).Select(rds => rds.Reactor). |
| 0 | 130 | | HTRUnloadsBelow700 = group.Where(rds => rds.ReactorType.Contains("HTR")).Select(rds => rds.Reactor). |
| 0 | 131 | | }); |
| 0 | 132 | | } |
| 0 | 133 | | } |
| | 134 | |
|
| | 135 | | public void ReverseLists() |
| 0 | 136 | | { |
| 0 | 137 | | CurrentWeek.ScrapByDay = APIHelperFunctions.ReverseList(CurrentWeek.ScrapByDay); |
| 0 | 138 | | PreviousWeek.ScrapByDay = APIHelperFunctions.ReverseList(PreviousWeek.ScrapByDay); |
| | 139 | |
|
| 0 | 140 | | ToolAvailibilityByType["ASM"] = APIHelperFunctions.ReverseList(ToolAvailibilityByType["ASM"]); |
| 0 | 141 | | ToolAvailibilityByType["EPP"] = APIHelperFunctions.ReverseList(ToolAvailibilityByType["EPP"]); |
| 0 | 142 | | ToolAvailibilityByType["HTR"] = APIHelperFunctions.ReverseList(ToolAvailibilityByType["HTR"]); |
| 0 | 143 | | } |
| | 144 | | } |
| | 145 | | } |