mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-10 16:14:54 +03:00
feat(skd): viewMode/userSettingPresentation на dataParameters items
Build-DataParameters не читал viewMode и userSettingPresentation на отдельных
параметрах данных — теряли 74 viewMode references только в одном крупном отчёте.
Теперь object form {parameter, value, valueType?, viewMode?, userSettingID?, ...}
с auto-конверсией bool/decimal по xsi:type.
Compile добавлен early-branch на полный xsi:type (xs:boolean, dcscor:DesignTimeValue
и т.п.) — раньше string "true" эмитился как xs:string вместо xs:boolean.
Расследование: viewmode-trace.py показал ровно 66 LOST viewMode=Normal
+ 8 Inaccessible на пути '/r:DataCompositionSchema/r:settingsVariant/
dcsset:settings/dcsset:dataParameters/dcscor:item[SettingsParameterValue]'.
sample30: −204 строки (1982 → 1778).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.74 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.75 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -2549,6 +2549,10 @@ function Emit-DataParameters {
|
||||
X "$indent`t`t`t<v8:startDate>$(Esc-Xml $_sd)</v8:startDate>"
|
||||
X "$indent`t`t`t<v8:endDate>$(Esc-Xml $_ed)</v8:endDate>"
|
||||
X "$indent`t`t</dcscor:value>"
|
||||
} elseif ($vtype -match '^[a-zA-Z]+:') {
|
||||
# Полный xsi:type из decompile (например "xs:boolean", "dcscor:DesignTimeValue").
|
||||
$vStr = if ($dp.value -is [bool]) { "$($dp.value)".ToLower() } else { "$($dp.value)" }
|
||||
X "$indent`t`t<dcscor:value xsi:type=`"$vtype`">$(Esc-Xml $vStr)</dcscor:value>"
|
||||
} elseif ($vtype -eq 'boolean' -or $dp.value -is [bool]) {
|
||||
$bv = "$($dp.value)".ToLower()
|
||||
X "$indent`t`t<dcscor:value xsi:type=`"xs:boolean`">$(Esc-Xml $bv)</dcscor:value>"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.74 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.75 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -2071,6 +2071,10 @@ def emit_data_parameters(lines, items, indent):
|
||||
lines.append(f'{indent}\t\t\t<v8:startDate>{esc_xml(sd)}</v8:startDate>')
|
||||
lines.append(f'{indent}\t\t\t<v8:endDate>{esc_xml(ed)}</v8:endDate>')
|
||||
lines.append(f'{indent}\t\t</dcscor:value>')
|
||||
elif re.match(r'^[a-zA-Z]+:', vtype):
|
||||
# Полный xsi:type из decompile (например "xs:boolean", "dcscor:DesignTimeValue").
|
||||
v_str = str(val).lower() if isinstance(val, bool) else str(val)
|
||||
lines.append(f'{indent}\t\t<dcscor:value xsi:type="{vtype}">{esc_xml(v_str)}</dcscor:value>')
|
||||
elif vtype == 'boolean' or isinstance(val, bool):
|
||||
bv = str(val).lower()
|
||||
lines.append(f'{indent}\t\t<dcscor:value xsi:type="xs:boolean">{esc_xml(bv)}</dcscor:value>')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# skd-decompile v0.57 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||
# skd-decompile v0.58 — Decompile 1C DCS Template.xml to JSON DSL (draft)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -1760,6 +1760,10 @@ function Build-DataParameters {
|
||||
# use на dataParameter item — это <dcscor:use> (не dcsset)
|
||||
$use = Get-Text $it "dcscor:use"
|
||||
if ($use -eq 'false') { $canAuto = $false }
|
||||
# viewMode / userSettingPresentation на dataParameter item — это dcsset:* (после value)
|
||||
$vmN = $it.SelectSingleNode("dcsset:viewMode", $ns)
|
||||
$uspN = $it.SelectSingleNode("dcsset:userSettingPresentation", $ns)
|
||||
if ($vmN -or $uspN) { $canAuto = $false }
|
||||
$tp = $visibleTop[$pn]
|
||||
$flags = @()
|
||||
if ($usid) { $flags += '@user' }
|
||||
@@ -1790,11 +1794,30 @@ function Build-DataParameters {
|
||||
# Compare to top-level default
|
||||
if ($tp -and $tp.valueDisplay -ne $vDisplay) { $canAuto = $false }
|
||||
if (-not $tp) { $canAuto = $false } # extra param not in top-level
|
||||
if ($stdPeriodObj) {
|
||||
# Object form для StandardPeriod с явными датами
|
||||
$obj = [ordered]@{ parameter = $pn; value = $stdPeriodObj }
|
||||
# Object form требуется если есть viewMode / userSettingPresentation / StandardPeriod-с-датами
|
||||
if ($stdPeriodObj -or $vmN -or $uspN) {
|
||||
$obj = [ordered]@{ parameter = $pn }
|
||||
if ($stdPeriodObj) {
|
||||
$obj['value'] = $stdPeriodObj
|
||||
} elseif ($null -ne $vDisplay -and $vDisplay -ne '') {
|
||||
# Конвертация для типизированных значений (compile различает по типу JSON)
|
||||
if ($vt -eq 'boolean') { $obj['value'] = ($vDisplay -eq 'true') }
|
||||
elseif ($vt -eq 'decimal') {
|
||||
if ($vDisplay -match '^-?\d+$') { $obj['value'] = [int]$vDisplay }
|
||||
else { $obj['value'] = [double]$vDisplay }
|
||||
}
|
||||
else { $obj['value'] = $vDisplay }
|
||||
# Сохраняем полный xsi:type для bit-perfect эмиссии
|
||||
$ta = $valNode.Attributes['xsi:type']
|
||||
if ($ta) { $obj['valueType'] = $ta.Value }
|
||||
}
|
||||
if ($use -eq 'false') { $obj['use'] = $false }
|
||||
if ($usid) { $obj['userSettingID'] = 'auto' }
|
||||
if ($vmN) { $obj['viewMode'] = $vmN.InnerText }
|
||||
if ($uspN) {
|
||||
$uspV = Get-MLText $uspN
|
||||
if ($uspV) { $obj['userSettingPresentation'] = $uspV }
|
||||
}
|
||||
$entries += $obj
|
||||
} else {
|
||||
# Build shorthand entry
|
||||
|
||||
Reference in New Issue
Block a user