쿼리 치환 변수를 클래스 전체 이름 형식으로 교체 (치환 실패 → ORA 오류 수정)
레거시 런타임 bzDesignSheetLoader.ConvertQuery 는 토큰 접두어를 PatientInfo/SheetInfo/WorkInfo 의 GetType.FullName 과 Select Case 완전일치로 비교한다. 기존 목록은 <<PatientInfo.ChtNum>> 축약형이라 어떤 토큰도 치환되지 않고 <<...>> 가 SQL 에 리터럴로 남아 ORA 구문오류를 냈다 — 그 데이터소스를 참조하는 컨트롤이 전부 공백이 되는 조용한 실패다. 기존 서식의 쿼리는 원문 보존이라 영향 없고, 신규 작성분만 해당된다. 접두어는 ucLoadSheetBase.vb:7619-7631 이 형을 고정한다: PatientInfo/WorkInfo → M.CMM.HISOperatingInfo.* SheetInfo → M.EMR.SheetLoadOperatingInfo.bzSheetInfo 기존 20개 중 8개는 접두어뿐 아니라 속성명 자체가 실존하지 않았다(리플렉션 null): PatientInfo.OdrNum/OdrSeq, SheetInfo.EmrGbn/PatTyp/OdrNum/OdrSeq, WorkInfo.WrkNam/AdpDep. bzPatientInfo/bzSheetInfo/bzWorkInfo 의 실존 공개 스칼라 속성으로 다시 큐레이션했다. DataRow 접근형(...PatInfDR.item(컬럼))은 LastIndexOf(.) 규칙이 접두어를 깨뜨려 이 경로에서 반드시 실패하므로 목록에서 제외. - LegacyQueryVariableCatalog 신설(그룹/설명 포함 레코드) - 편집기 목록을 그룹 헤더 + 설명/토큰 2줄 + 툴팁으로 — 축약 오해 재발 방지 - 상용구 편집의 QueryEditorWindow 재사용에 showVariables:false 추가 (상용구 문구 화면에 SQL 변수 목록이 노출되던 오조작 여지 제거) 검증: 테스트 70/70(레거시 완전일치 규칙 시뮬레이션 + 운영 실사용 토큰 존재 검사 포함), edit-smoke 에 두 모드 실제 창 생성 검사 추가 — 실패 0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c445b851a1
commit
d0538ef95a
@@ -384,7 +384,24 @@ public static class EditSmoke
|
||||
var fromJson = jsonSerializer.Read(json);
|
||||
Check("JSON 왕복 — XML 동일", serializer.Write(fromJson) == serializer.Write(designer.Document));
|
||||
|
||||
// 22) 연속 Undo 로 빈 문서까지
|
||||
// 22) 쿼리 편집기 — XAML 로드/바인딩과 두 모드(SQL/상용구)를 실제로 생성해 확인
|
||||
var sqlEditor = new Views.QueryEditorWindow("스모크", "SELECT 1 FROM DUAL");
|
||||
var variableItems = (sqlEditor.FindName("VariableList") as System.Windows.Controls.ListBox)?
|
||||
.ItemsSource?.Cast<object>().Count() ?? 0;
|
||||
Check("쿼리 편집기: 치환 변수 목록 바인딩",
|
||||
variableItems == Core.Catalog.LegacyQueryVariableCatalog.All.Count,
|
||||
$"바인딩 {variableItems}건 / 카탈로그 {Core.Catalog.LegacyQueryVariableCatalog.All.Count}건");
|
||||
Check("쿼리 편집기: 변수 패널 표시",
|
||||
(sqlEditor.FindName("VariablePane") as UIElement)?.Visibility == Visibility.Visible);
|
||||
sqlEditor.Close();
|
||||
|
||||
var wordEditor = new Views.QueryEditorWindow("상용구 수정", "문구", showVariables: false);
|
||||
Check("상용구 모드: 변수 패널 숨김",
|
||||
(wordEditor.FindName("VariablePane") as UIElement)?.Visibility == Visibility.Collapsed);
|
||||
Check("상용구 모드: 제목에 '쿼리' 없음", !wordEditor.Title.Contains("쿼리"), wordEditor.Title);
|
||||
wordEditor.Close();
|
||||
|
||||
// 23) 연속 Undo 로 빈 문서까지
|
||||
var guard = 0;
|
||||
while (designer.Undo.CanUndo && guard++ < 80)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Window x:Class="SheetMe.Designer.Views.QueryEditorWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="쿼리 편집" Width="860" Height="560" MinWidth="640" MinHeight="400"
|
||||
Title="쿼리 편집" Width="960" Height="560" MinWidth="720" MinHeight="400"
|
||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
|
||||
<DockPanel Margin="12">
|
||||
<TextBlock DockPanel.Dock="Top" Foreground="{DynamicResource B.Muted}" TextWrapping="Wrap" Margin="0,0,0,8"
|
||||
Text="작성 시점에 <<변수>> 가 실제 값으로 치환되어 실행됩니다. 우측 변수를 더블클릭하면 커서 위치에 삽입됩니다."/>
|
||||
<TextBlock x:Name="HintText" DockPanel.Dock="Top" Foreground="{DynamicResource B.Muted}" TextWrapping="Wrap" Margin="0,0,0,8"
|
||||
Text="작성 시점에 <<변수>> 가 실제 값으로 치환됩니다. 변수는 클래스 전체 이름을 포함해야 하므로 우측 목록을 더블클릭해 삽입하세요 — 임의로 줄여 쓰면 치환되지 않고 SQL 에 그대로 남아 오류가 납니다."/>
|
||||
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
|
||||
<TextBlock x:Name="LengthText" VerticalAlignment="Center" Margin="0,0,12,0" Foreground="{DynamicResource B.Muted}"/>
|
||||
@@ -16,8 +16,8 @@
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition Width="230"/>
|
||||
<ColumnDefinition x:Name="SplitterColumn" Width="8"/>
|
||||
<ColumnDefinition x:Name="VariableColumn" Width="330"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- SQL 편집 영역 -->
|
||||
@@ -30,12 +30,33 @@
|
||||
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Background="{DynamicResource B.Line}"/>
|
||||
|
||||
<!-- 치환 변수 목록 -->
|
||||
<DockPanel Grid.Column="2">
|
||||
<!-- 치환 변수 목록 (SQL 용도에서만 표시) -->
|
||||
<DockPanel x:Name="VariablePane" Grid.Column="2">
|
||||
<TextBlock DockPanel.Dock="Top" Text="치환 변수 (더블클릭 삽입)" FontWeight="Bold"
|
||||
Foreground="{DynamicResource B.Muted}" Margin="4,0,0,6"/>
|
||||
<ListBox x:Name="VariableList" FontSize="12" MouseDoubleClick="OnInsertVariable"
|
||||
FontFamily="Consolas, D2Coding, 굴림체"/>
|
||||
<ListBox x:Name="VariableList" FontSize="11" MouseDoubleClick="OnInsertVariable"
|
||||
FontFamily="Consolas, D2Coding, 굴림체"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="0,1" ToolTip="{Binding Token}">
|
||||
<TextBlock Text="{Binding Description}" FontFamily="Segoe UI, 맑은 고딕" FontSize="12"/>
|
||||
<TextBlock Text="{Binding Token}" Foreground="{DynamicResource B.Muted}" FontSize="10"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" Margin="2,8,0,3"
|
||||
FontFamily="Segoe UI, 맑은 고딕" FontSize="12"
|
||||
Foreground="{DynamicResource B.Accent}"/>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ListBox.GroupStyle>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
@@ -1,54 +1,52 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using SheetMe.Core.Catalog;
|
||||
|
||||
namespace SheetMe.Designer.Views;
|
||||
|
||||
/// <summary>
|
||||
/// 데이터소스(MDataTable) 쿼리 전용 편집기 — 큰 SQL 편집 영역 + 치환 변수 삽입.
|
||||
/// 치환 규칙 원본: [014]EMRLoader bzDesignSheetLoader.ConvertQuery — <<PatientInfo/SheetInfo/WorkInfo.속성>> 리플렉션 치환.
|
||||
/// 변수 목록 출처: [021]SheetLoadOperatingInfo 의 bzPatientInfo/bzSheetInfo/bzWorkInfo 공개 속성(스칼라만 큐레이션, 2026-07-16).
|
||||
/// 치환 규칙 원본: [014]EMRLoader bzDesignSheetLoader.ConvertQuery.
|
||||
/// 토큰 접두어는 <b>클래스 전체 이름</b>이어야 하며 런타임이 GetType.FullName 과 완전일치로 비교한다
|
||||
/// (ucLoadSheetBase.vb:7619-7631 이 형을 고정). 목록은 <see cref="LegacyQueryVariableCatalog"/> 참조.
|
||||
///
|
||||
/// 큰 다중행 편집 영역이 필요한 다른 용도(상용구 문구)에도 재사용한다 —
|
||||
/// 그 경우 <c>showVariables: false</c> 로 SQL 변수 패널을 숨긴다.
|
||||
/// </summary>
|
||||
public partial class QueryEditorWindow : Window
|
||||
{
|
||||
#region Member Fields
|
||||
/// <summary>치환 변수 목록 — 작성 시점 실제 값으로 치환됨</summary>
|
||||
private static readonly string[] Variables =
|
||||
{
|
||||
"<<PatientInfo.ChtNum>>",
|
||||
"<<PatientInfo.ComNum>>",
|
||||
"<<PatientInfo.PatTyp>>",
|
||||
"<<PatientInfo.OdrNum>>",
|
||||
"<<PatientInfo.OdrSeq>>",
|
||||
"<<SheetInfo.ShtCod>>",
|
||||
"<<SheetInfo.ShtNam>>",
|
||||
"<<SheetInfo.EmrKey>>",
|
||||
"<<SheetInfo.EmrGbn>>",
|
||||
"<<SheetInfo.AdpDtm>>",
|
||||
"<<SheetInfo.PatTyp>>",
|
||||
"<<SheetInfo.OdrNum>>",
|
||||
"<<SheetInfo.OdrSeq>>",
|
||||
"<<SheetInfo.TemKey>>",
|
||||
"<<WorkInfo.WrkUid>>",
|
||||
"<<WorkInfo.WrkNam>>",
|
||||
"<<WorkInfo.WrkDte>>",
|
||||
"<<WorkInfo.WrkDtm>>",
|
||||
"<<WorkInfo.AdpDep>>",
|
||||
"<<WorkInfo.AdpDtm>>",
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>편집 결과 SQL — 확인 시 채워짐</summary>
|
||||
/// <summary>편집 결과 텍스트 — 확인 시 채워짐</summary>
|
||||
public string QueryText { get; private set; } = string.Empty;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public QueryEditorWindow(string ownerLabel, string initialQuery)
|
||||
/// <param name="ownerLabel">제목에 붙일 대상 이름</param>
|
||||
/// <param name="initialQuery">초기 텍스트</param>
|
||||
/// <param name="showVariables">SQL 치환 변수 패널 표시 여부 — 상용구 등 SQL 이 아닌 용도에서는 false</param>
|
||||
public QueryEditorWindow(string ownerLabel, string initialQuery, bool showVariables = true)
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = $"쿼리 편집 — {ownerLabel}";
|
||||
SqlBox.Text = initialQuery;
|
||||
VariableList.ItemsSource = Variables;
|
||||
|
||||
if (showVariables)
|
||||
{
|
||||
Title = $"쿼리 편집 — {ownerLabel}";
|
||||
var view = new CollectionViewSource { Source = LegacyQueryVariableCatalog.All };
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription(nameof(QueryVariable.Group)));
|
||||
VariableList.ItemsSource = view.View;
|
||||
}
|
||||
else
|
||||
{
|
||||
Title = ownerLabel;
|
||||
HintText.Text = "내용을 편집한 뒤 확인을 누르세요.";
|
||||
VariablePane.Visibility = Visibility.Collapsed;
|
||||
SplitterColumn.Width = new GridLength(0);
|
||||
VariableColumn.Width = new GridLength(0);
|
||||
}
|
||||
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
SqlBox.Focus();
|
||||
@@ -63,13 +61,13 @@ public partial class QueryEditorWindow : Window
|
||||
|
||||
private void OnInsertVariable(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (VariableList.SelectedItem is not string variable)
|
||||
if (VariableList.SelectedItem is not QueryVariable variable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var caret = SqlBox.CaretIndex;
|
||||
SqlBox.Text = SqlBox.Text.Insert(caret, variable);
|
||||
SqlBox.CaretIndex = caret + variable.Length;
|
||||
SqlBox.Text = SqlBox.Text.Insert(caret, variable.Token);
|
||||
SqlBox.CaretIndex = caret + variable.Token.Length;
|
||||
SqlBox.Focus();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ public partial class RecordWordDialogView : Window
|
||||
{
|
||||
return;
|
||||
}
|
||||
var editor = new QueryEditorWindow($"상용구 수정", selected.Value) { Owner = this };
|
||||
// QueryEditorWindow 재사용(큰 편집 영역) — 변수 삽입은 무시해도 무해
|
||||
// QueryEditorWindow 재사용(큰 다중행 편집 영역) — SQL 이 아니므로 치환 변수 패널은 숨긴다
|
||||
var editor = new QueryEditorWindow("상용구 수정", selected.Value, showVariables: false) { Owner = this };
|
||||
if (editor.ShowDialog() != true)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user