This commit is contained in:
2026-04-17 15:02:54 +03:00
parent 2e0b71cf3f
commit c9a229cc8e
3 changed files with 114 additions and 6 deletions
+62 -2
View File
@@ -60,6 +60,7 @@ WITH
AND siv."__deletedAt" IS NULL
and d."__deletedAt" IS NULL
and a."__deletedAt" IS NULL
and s.probability_pc >= 50
--and a.is_actual
and siv.type IN (2,3)
),
@@ -196,6 +197,43 @@ WITH
z.__id ,
z.__name
),
sold_gpu as
(
SELECT
z.id_klienta as WZ ,
z.__name as client ,
z.__id as company_uid,
round(sum(c.cnt*o.cnt)) as quantity ,
count(*) as lines ,
STRING_AGG(distinct c.code,', ' order by c.code) as codes
FROM
stair o
JOIN
elma.companies z on (o._companies=z.__id)
LEFT JOIN component c on c.__id = o.param_id
WHERE
--c.code SIMILAR TO 'iaas.(ngc|dcp).%.vcpu%-_'
(c.code LIKE 'iaas.ngc.%.gpu%-_' OR c.code LIKE 'iaas.dcp.%.gpu%-_')
AND c.cnt <> 0
AND o.cnt <> 0
GROUP BY
z.id_klienta,
z.__id ,
z.__name
),
gpu_alloc as
(
select
c."ClientID" as wz ,
-- json_agg("GPU") as gpu,
string_agg("GPU"::text||' '||"OrgStatus",', ') as gpu,
count(*) as gpu_alloc
from
vmreports.vm_gpu c
where
ts= (select max(ts) from vmreports.vm_gpu)
group by
c."ClientID" ),
deal_stat as
(
select
@@ -233,6 +271,10 @@ select
<d:field title="Коды Дисков">d.codes as disk_codes</d:field>
<d:field title="Диски GB Elma">d.quantity as disk_sold</d:field>
<d:field title="Диски Cloud">da.disk_alloc</d:field>
<d:field title="Коды GPU">g.codes as gpu_codes</d:field>
<d:field title="GPU Elma">g.quantity as gpu_sold</d:field>
<d:field title="GPU Cloud">ga.gpu_alloc</d:field>
<d:field title="GPU">ga.gpu</d:field>
<d:field>z.__name as alloc_company</d:field>
<d:field>z.__id as alloc_company_uid</d:field>
<d:field>ds.ar_status_ids</d:field>
@@ -241,8 +283,10 @@ from sold_ram r
join deal_stat ds on (lower(r.wz)=lower(ds.wz))
join sold_cpu c on (lower(r.wz)=lower(c.wz))
left join sold_disk d on (lower(r.wz)=lower(d.wz))
left join sold_gpu g on (lower(r.wz)=lower(g.wz))
full join alloc a on (lower(r.wz)=lower(a.wz))
left join disk_alloc da on (a.wz=da.wz)
left join gpu_alloc ga on (a.wz=ga.wz)
left join elma.companies z on (lower(a.wz)=lower(z.id_klienta))
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
@@ -316,7 +360,14 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<th width="10%"><layout:column_head name="disk_codes"/></th>
<th width="3%"><layout:column_head name="disk_sold"/></th>
<th width="3%"><layout:column_head name="disk_alloc"/></th>
<th width="3%"><layout:column_head name="disk_alloc"/></th>
<th width="10%"><layout:column_head name="gpu_codes"/></th>
<th width="3%"><layout:column_head name="gpu_sold"/></th>
<th width="3%"><layout:column_head name="gpu_alloc"/></th>
<th width="10%"><layout:column_head name="gpu"/></th>
<!--- <th width="3%"><layout:column_head name="disk_sold"/></th> --->
</layout:grid_head>
</thead>
@@ -350,6 +401,11 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<td>#disk_codes#</td>
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
<td>#gpu_codes#</td>
<td class="r"<cfif gpu_sold GT gpu_alloc> style="background:lightgreen;"</cfif>>#gpu_sold#</td>
<td class="r"<cfif gpu_sold LT gpu_alloc> style="background:lightcoral;"</cfif>>#gpu_alloc#</td>
<td>#gpu#</td>
</tr>
</cfoutput>
@@ -363,6 +419,7 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
,sum(ram_alloc_on) as ram_alloc_on
,sum(disk_sold) as disk_sold
,sum(disk_alloc) as disk_alloc
,sum(gpu_sold) as gpu_sold
from qRead
</cfquery>
@@ -382,7 +439,10 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<td></td>
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
<td></td>
<td class="r">#gpu_sold#</td>
</tr>
</cfoutput>