|
@@ -150,7 +150,7 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
|
|
schoolCodes.Add($"Product-{schId}");
|
|
schoolCodes.Add($"Product-{schId}");
|
|
}
|
|
}
|
|
string schoolCodesStr = JsonSerializer.Serialize(schoolCodes);
|
|
string schoolCodesStr = JsonSerializer.Serialize(schoolCodes);
|
|
- string SqlSchProdSoft = $"SELECT c.code, c.id, c.serial, ARRAY_LENGTH(c.deviceBound) as deviceBoundCnt, c.clientQty, c.regDate, c.endDate, c.deviceMax, c.aprule, c.expireStatus, c.prodCode FROM c WHERE c.dataType = 'serial' AND c.expireStatus = 'A' AND ARRAY_CONTAINS({schoolCodesStr}, c.code, true)";
|
|
|
|
|
|
+ string SqlSchProdSoft = $"SELECT * FROM c WHERE c.dataType = 'serial' AND c.expireStatus = 'A' AND ARRAY_CONTAINS({schoolCodesStr}, c.code, true)";
|
|
try
|
|
try
|
|
{
|
|
{
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: SqlSchProdSoft, requestOptions: null ))
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: SqlSchProdSoft, requestOptions: null ))
|
|
@@ -159,6 +159,17 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
{
|
|
{
|
|
SchoolProductSerial serialRow = obj.ToObject<SchoolProductSerial>();
|
|
SchoolProductSerial serialRow = obj.ToObject<SchoolProductSerial>();
|
|
|
|
+ SchAuthDataSerial schAuthDataSerial = new SchAuthDataSerial();
|
|
|
|
+ schAuthDataSerial.prodCode = serialRow.prodCode;
|
|
|
|
+ schAuthDataSerial.serial = serialRow.serial;
|
|
|
|
+ schAuthDataSerial.deviceBoundCnt = (serialRow.deviceBound != null) ? serialRow.deviceBound.Count : 0;
|
|
|
|
+ schAuthDataSerial.clientQty = serialRow.clientQty;
|
|
|
|
+ schAuthDataSerial.regDate = serialRow.regDate;
|
|
|
|
+ schAuthDataSerial.startDate = serialRow.startDate;
|
|
|
|
+ schAuthDataSerial.endDate = serialRow.endDate;
|
|
|
|
+ schAuthDataSerial.deviceMax = serialRow.deviceMax;
|
|
|
|
+ schAuthDataSerial.aprule = serialRow.aprule;
|
|
|
|
+
|
|
string schId = serialRow.code.Replace("Product-", "");
|
|
string schId = serialRow.code.Replace("Product-", "");
|
|
if (!serialResultDic.ContainsKey(schId)) serialResultDic.Add(schId, new List<SchProdSerial>());
|
|
if (!serialResultDic.ContainsKey(schId)) serialResultDic.Add(schId, new List<SchProdSerial>());
|
|
SchProdSerial schProdSerialNow = serialResultDic[schId].Where(s => s.prodCode.Equals(serialRow.prodCode) && s.endDate.Equals(serialRow.endDate) && s.deviceMax.Equals(serialRow.deviceMax)).FirstOrDefault();
|
|
SchProdSerial schProdSerialNow = serialResultDic[schId].Where(s => s.prodCode.Equals(serialRow.prodCode) && s.endDate.Equals(serialRow.endDate) && s.deviceMax.Equals(serialRow.deviceMax)).FirstOrDefault();
|
|
@@ -168,12 +179,12 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
|
|
schProdSerialNew.prodCode = serialRow.prodCode;
|
|
schProdSerialNew.prodCode = serialRow.prodCode;
|
|
schProdSerialNew.endDate = serialRow.endDate;
|
|
schProdSerialNew.endDate = serialRow.endDate;
|
|
schProdSerialNew.deviceMax = serialRow.deviceMax;
|
|
schProdSerialNew.deviceMax = serialRow.deviceMax;
|
|
- schProdSerialNew.serials.Add(serialRow);
|
|
|
|
|
|
+ schProdSerialNew.serials.Add(schAuthDataSerial);
|
|
serialResultDic[schId].Add(schProdSerialNew);
|
|
serialResultDic[schId].Add(schProdSerialNew);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- schProdSerialNow.serials.Add(serialRow);
|
|
|
|
|
|
+ schProdSerialNow.serials.Add(schAuthDataSerial);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -434,12 +445,24 @@ namespace TEAMModelBI.Controllers.ProductAnalysis
|
|
public string prodCode { get; set; }
|
|
public string prodCode { get; set; }
|
|
public long endDate { get; set; }
|
|
public long endDate { get; set; }
|
|
public int deviceMax { get; set; }
|
|
public int deviceMax { get; set; }
|
|
- public List<SchoolProductSerial> serials { get; set; } = new List<SchoolProductSerial>();
|
|
|
|
|
|
+ public List<SchAuthDataSerial> serials { get; set; } = new List<SchAuthDataSerial>();
|
|
}
|
|
}
|
|
private class SchAuthData {
|
|
private class SchAuthData {
|
|
public string schId { get; set; }
|
|
public string schId { get; set; }
|
|
public List<SchProdSerial> authSerial { get; set; } = new();
|
|
public List<SchProdSerial> authSerial { get; set; } = new();
|
|
public List<SchoolProductSumDataService> authService { get; set; } = new();
|
|
public List<SchoolProductSumDataService> authService { get; set; } = new();
|
|
}
|
|
}
|
|
|
|
+ private class SchAuthDataSerial
|
|
|
|
+ {
|
|
|
|
+ public string prodCode { get; set; }
|
|
|
|
+ public string serial { get; set; }
|
|
|
|
+ public int deviceBoundCnt { get; set; }
|
|
|
|
+ public int clientQty { get; set; }
|
|
|
|
+ public long regDate { get; set; }
|
|
|
|
+ public long startDate { get; set; }
|
|
|
|
+ public long endDate { get; set; }
|
|
|
|
+ public int deviceMax { get; set; }
|
|
|
|
+ public object aprule { get; set; }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|