mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-10 08:04:56 +03:00
feat(skd): dataSetLinks с расширенными атрибутами
skd-decompile теперь извлекает блоки <dataSetLink> на уровне схемы, skd-compile поддерживает поля parameterListAllowed/startExpression/ linkConditionExpression (раньше был только parameter). На sample30 это даёт −1100 строк diff (4873 → 3773), один отчёт (АнализНачисленийНДССАвансовПолученных) переходит в bit-perfect.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.62 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.63 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -1090,6 +1090,15 @@ function Emit-DataSetLinks {
|
||||
if ($link.parameter) {
|
||||
X "`t`t<parameter>$(Esc-Xml "$($link.parameter)")</parameter>"
|
||||
}
|
||||
if ($link.PSObject.Properties.Match('parameterListAllowed').Count -gt 0 -and $link.parameterListAllowed) {
|
||||
X "`t`t<parameterListAllowed>true</parameterListAllowed>"
|
||||
}
|
||||
if ($link.PSObject.Properties.Match('startExpression').Count -gt 0 -and $null -ne $link.startExpression) {
|
||||
X "`t`t<startExpression>$(Esc-Xml "$($link.startExpression)")</startExpression>"
|
||||
}
|
||||
if ($link.PSObject.Properties.Match('linkConditionExpression').Count -gt 0 -and $null -ne $link.linkConditionExpression) {
|
||||
X "`t`t<linkConditionExpression>$(Esc-Xml "$($link.linkConditionExpression)")</linkConditionExpression>"
|
||||
}
|
||||
X "`t</dataSetLink>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.62 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.63 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -851,6 +851,12 @@ def emit_data_set_links(lines, defn):
|
||||
lines.append(f'\t\t<destinationExpression>{esc_xml(dst_ex)}</destinationExpression>')
|
||||
if link.get('parameter'):
|
||||
lines.append(f'\t\t<parameter>{esc_xml(str(link["parameter"]))}</parameter>')
|
||||
if link.get('parameterListAllowed'):
|
||||
lines.append('\t\t<parameterListAllowed>true</parameterListAllowed>')
|
||||
if link.get('startExpression') is not None:
|
||||
lines.append(f'\t\t<startExpression>{esc_xml(str(link["startExpression"]))}</startExpression>')
|
||||
if link.get('linkConditionExpression') is not None:
|
||||
lines.append(f'\t\t<linkConditionExpression>{esc_xml(str(link["linkConditionExpression"]))}</linkConditionExpression>')
|
||||
lines.append('\t</dataSetLink>')
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# skd-decompile v0.46 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||
# skd-decompile v0.47 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -2114,6 +2114,27 @@ foreach ($dsNode in $dsNodes) {
|
||||
$dsi++
|
||||
}
|
||||
|
||||
# --- 5a-bis. dataSetLinks ---
|
||||
|
||||
$dataSetLinks = @()
|
||||
$dslNodes = $root.SelectNodes("r:dataSetLink", $ns)
|
||||
foreach ($dslNode in $dslNodes) {
|
||||
$link = [ordered]@{}
|
||||
$link['sourceDataSet'] = Get-Text $dslNode.SelectSingleNode("r:sourceDataSet", $ns)
|
||||
$link['destinationDataSet'] = Get-Text $dslNode.SelectSingleNode("r:destinationDataSet", $ns)
|
||||
$link['sourceExpression'] = Get-Text $dslNode.SelectSingleNode("r:sourceExpression", $ns)
|
||||
$link['destinationExpression'] = Get-Text $dslNode.SelectSingleNode("r:destinationExpression", $ns)
|
||||
$pNode = $dslNode.SelectSingleNode("r:parameter", $ns)
|
||||
if ($pNode) { $link['parameter'] = Get-Text $pNode }
|
||||
$plaNode = $dslNode.SelectSingleNode("r:parameterListAllowed", $ns)
|
||||
if ($plaNode -and ((Get-Text $plaNode) -eq 'true')) { $link['parameterListAllowed'] = $true }
|
||||
$seNode = $dslNode.SelectSingleNode("r:startExpression", $ns)
|
||||
if ($seNode) { $link['startExpression'] = Get-Text $seNode }
|
||||
$lceNode = $dslNode.SelectSingleNode("r:linkConditionExpression", $ns)
|
||||
if ($lceNode) { $link['linkConditionExpression'] = Get-Text $lceNode }
|
||||
$dataSetLinks += $link
|
||||
}
|
||||
|
||||
# --- 5b. calculatedFields ---
|
||||
|
||||
$calculatedFields = @()
|
||||
@@ -2182,6 +2203,7 @@ foreach ($p in $paramsRaw) {
|
||||
$out = [ordered]@{}
|
||||
if ($emitDataSources) { $out['dataSources'] = $dataSources }
|
||||
$out['dataSets'] = $dataSets
|
||||
if ($dataSetLinks.Count -gt 0) { $out['dataSetLinks'] = $dataSetLinks }
|
||||
if ($calculatedFields.Count -gt 0) { $out['calculatedFields'] = $calculatedFields }
|
||||
if ($totalFields.Count -gt 0) { $out['totalFields'] = $totalFields }
|
||||
if ($parameters.Count -gt 0) { $out['parameters'] = $parameters }
|
||||
|
||||
Reference in New Issue
Block a user