KWD 3 months ago
parent
commit
1752da033e
1 changed files with 19 additions and 5 deletions
  1. 19 5
      TeamAAS-VM/Core/Management.cs

+ 19 - 5
TeamAAS-VM/Core/Management.cs

@@ -4210,12 +4210,26 @@ namespace TeamAAS_VP.Core
                 var currentproduct = _productService.GetCurrentProduct();
                 if (currentproduct == null) return;
                 TotalQuantity = await _systemDatabaseService.GetOverallProductionAsync(currentproduct.Name);
-                TotalQuantityToday = await _systemDatabaseService.GetTodayProductionAsync(currentproduct.Name);
-                CurrentUPH = await _systemDatabaseService.GetLastHourProductionAsync(currentproduct.Name);
-                //
+                //TotalQuantityToday = await _systemDatabaseService.GetTodayProductionAsync(currentproduct.Name);
+                //CurrentUPH = await _systemDatabaseService.GetLastHourProductionAsync(currentproduct.Name);
+                ////
                 ThrowNumber = await _systemDatabaseService.GetThrowNumberAsync();
-                NgNumber = await _systemDatabaseService.GetNGProductionAsync(currentproduct.Name);
-                Yield = ((double)TotalQuantityToday - (double)NgNumber) / (double)TotalQuantityToday * 100;
+                //NgNumber = await _systemDatabaseService.GetNGProductionAsync(currentproduct.Name);
+                //Yield = ((double)TotalQuantityToday - (double)NgNumber) / (double)TotalQuantityToday * 100;
+
+                TotalQuantityToday = 0;
+                CurrentUPH = 0;
+                NgNumber = 0;
+                Yield = 0;
+                ObservableCollection<ProductModel> ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                foreach (var product in ProductList)
+                {
+                    //TotalQuantity += await _systemDatabaseService.GetOverallProductionAsync(product.Name);
+                    TotalQuantityToday += await _systemDatabaseService.GetTodayProductionAsync(product.Name);
+                    CurrentUPH += await _systemDatabaseService.GetLastHourProductionAsync(product.Name);
+                    NgNumber += await _systemDatabaseService.GetNGProductionAsync(product.Name);
+                    Yield += ((double)TotalQuantityToday - (double)NgNumber) / (double)TotalQuantityToday * 100;
+                }
             }
             catch (Exception)
             {