Преглед изворни кода

处理返回服务的code问题

Li пре 2 година
родитељ
комит
1ba85e57e1

+ 8 - 10
TEAMModelBI/Controllers/BIHome/OnLineController.cs

@@ -419,19 +419,17 @@ namespace TEAMModelBI.Controllers.BIHome
                     //scProCnt.serial = ScProductSum.serial.Count();
                     //scProCnt.service = ScProductSum.service.Count();
                     //scProCnt.hard = ScProductSum.hard.Count();
-                    int pSeriCnt = ScProductSum.serial.Count();
-                    int pServCnt = ScProductSum.service.Count();
-                    int pHardCnt = ScProductSum.hard.Count();
+                    List<string> pSeriCnt = ScProductSum.serial.Select(s=> s.prodCode).ToList();
+                    List<string> pServCnt = ScProductSum.service.Select(s=>s.prodCode).ToList();
+                    List<string> pHardCnt = ScProductSum.hard.Select(s=>s.prodCode).ToList();
                     scProCnt.serial = pSeriCnt;
                     scProCnt.service = pServCnt;
                     scProCnt.hard = pHardCnt;
-                    if (scProCnt.scale >= 500 && (pSeriCnt > 0 || pServCnt > 0 || pHardCnt > 0)) peCnt += 1;
+                    if (scProCnt.scale >= 500 && (pSeriCnt.Count > 0 || pServCnt.Count > 0 || pHardCnt.Count > 0)) peCnt += 1;
                 }
 
-                if (scProCnt.scale >= 500 && scProCnt.serial == 0 && scProCnt.service == 0 && scProCnt.hard == 0) seCnt += 1;
+                if (scProCnt.scale >= 500 && scProCnt.serial.Count == 0 && scProCnt.service.Count == 0 && scProCnt.hard.Count == 0) seCnt += 1;
                 if (scProCnt.scale == 0) beCnt += 1;
-
-
             });
 
             return Ok(new { state = 200, beCnt, seCnt, peCnt, scEdCnt });
@@ -446,9 +444,9 @@ namespace TEAMModelBI.Controllers.BIHome
             public string name { get; set; }
             public int size { get; set; }
             public int scale { get; set; }
-            public int serial { get; set; } = 0;//软体
-            public int service { get; set; } = 0; //服务
-            public int hard { get; set; } = 0; //硬体
+            public List<string> serial { get; set; } = new List<string>();//软体
+            public List<string> service { get; set; } = new List<string>(); //服务
+            public List<string> hard { get; set; } = new List<string>(); //硬体
         }
 
         /// <summary>

+ 6 - 6
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -1656,9 +1656,9 @@ namespace TEAMModelBI.Controllers.BISchool
             //if ($"{site}".Equals(BIConst.Global))
             //    cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
             AnSchool school = new();  //学校基础基础信息
-            int serial = 0;     //学校软体数量
-            int service = 0;    //学校服务数量
-            int hard = 0;     //学校硬件数量
+            List<string> serial = new();     //学校软体数量
+            List<string> service = new();    //学校服务数量
+            List<string> hard = new();     //学校硬件数量
 
             var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
             if (response.Status == 200)
@@ -1685,15 +1685,15 @@ namespace TEAMModelBI.Controllers.BISchool
                 using var json = await JsonDocument.ParseAsync(responseProduct.ContentStream);
                 if (json.RootElement.TryGetProperty("serial", out JsonElement _serial) && !_serial.ValueKind.Equals(JsonValueKind.Null))
                 {
-                    serial = _serial.ToObject<List<SchoolProductSumData>>().Count;//.Select(x => x.prodCode).ToList();
+                    serial = _serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
                 }
                 if (json.RootElement.TryGetProperty("service", out JsonElement _service) && !_service.ValueKind.Equals(JsonValueKind.Null))
                 {
-                    service = _service.ToObject<List<SchoolProductSumData>>().Count;//.Select(x => x.prodCode).ToList();
+                    service = _service.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
                 }
                 if (json.RootElement.TryGetProperty("hard", out JsonElement _hard) && !_hard.ValueKind.Equals(JsonValueKind.Null))
                 {
-                    hard = _hard.ToObject<List<SchoolProductSumDataHard>>().Count();//.Select(x => x.prodCode).ToList();
+                    hard = _hard.ToObject<List<SchoolProductSumDataHard>>().Select(x => x.prodCode).ToList();
                 }
             }