JuliaBuz 2 سال پیش
والد
کامیت
7fb75e299f
1فایلهای تغییر یافته به همراه38 افزوده شده و 3 حذف شده
  1. 38 3
      WSUniversalLib/Calculation.cs

+ 38 - 3
WSUniversalLib/Calculation.cs

@@ -6,11 +6,46 @@ using System.Threading.Tasks;
 
 namespace WSUniversalLib
 {
-    public class Calculation 
+    public class Calculation
     {
-        public int GetPriorityForAgent(int agentType, float age, float experience)
+        public int GetQuantityForProduct(int productType, int materialType, int count, float width, float length)
         {
-            return agentType; 
+            if (count < 0 || width <= 0 || length <= 0)
+            {
+                return -1;
+            }
+            double productCoff = 0;
+            switch (productType)
+            {
+                case 1:
+                    productCoff = 1.1;
+                    break;
+                case 2:
+                    productCoff = 2.5;
+                    break;
+                case 3:
+                    productCoff = 8.43;
+                    break;
+                default:
+                    return -1;
+            }
+
+            double materialCoff = 0;
+            switch (materialType)
+            {
+                case 1:
+                    materialCoff = 0.003;
+                    break;
+                case 2:
+                    materialCoff = 0.0012;
+                    break;
+                default:
+                    return -1;
+            }
+
+            int countMaterial = Convert.ToInt32(Math.Ceiling(productCoff * count * width * length + (productCoff * count * width * length * materialCoff)));
+            return countMaterial;
         }
+
     }
 }