From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。

---
 HotelPms.Client.Blazor/ViewModel/ColSettingData.cs |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/HotelPms.Client.Blazor/ViewModel/ColSettingData.cs b/HotelPms.Client.Blazor/ViewModel/ColSettingData.cs
new file mode 100644
index 0000000..476ea6e
--- /dev/null
+++ b/HotelPms.Client.Blazor/ViewModel/ColSettingData.cs
@@ -0,0 +1,119 @@
+using HotelPms.Client.Blazor.Util;
+using HotelPms.Data;
+using HotelPms.Data.Common;
+using Grpc.Net.Client;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Channels;
+using System.Threading.Tasks;
+using HotelPms.Data.Client;
+
+namespace HotelPms.Client.Blazor.ViewModel
+{
+    public class ColSettingData
+    {
+        /// <summary>
+        /// 帳票ID
+        /// </summary>
+        public int ReportID { get; set; } = 0;
+
+        /// <summary>
+        /// 帳票名
+        /// </summary>
+        public string ReportName { get; set; }
+
+        /// <summary>
+        /// 項目一覧(S_ReportCol)
+        /// </summary>
+        public List<string> OrgColList { get; set; }
+
+        /// <summary>
+        /// 出力パターンID
+        /// </summary>
+        public int OutputID { get; set; }
+
+        /// <summary>
+        ///  出力パターン名
+        /// </summary>
+        public string OutputName { get; set; }
+
+        /// <summary>
+        /// 出力パターン候補一覧
+        /// </summary>
+        internal List<HotelPms.Data.Master.Output> OutputList { get; set; }
+
+        /// <summary>
+        /// 第一ソート順
+        /// </summary>
+        public string Sort1 { get; set; }
+
+        /// <summary>
+        /// 第二ソート順
+        /// </summary>
+        public string Sort2 { get; set; }
+
+        public List<ColSettingRow> Rows { get; set; }
+
+
+        /// <summary>
+        /// 帳票設定データの作成
+        /// </summary>
+        /// <param name="reportID"></param>
+        /// <param name="channel"></param>
+        /// <returns></returns>
+        public static async Task<ColSettingData> Create(int reportID, GrpcChannel channel)
+        {
+            string name = string.Empty;
+            GrpcSet grpcSet = await GrpcClient.GetDataSet(channel, (int)ESetActionType.ColSetting, $"{Environment.MachineName},{EnvironmentSetting.UserName},{reportID}");
+            if (grpcSet.ErrNo != 0) { return null; }
+
+            using (DataTable dataTable = grpcSet.Tables[0].ToDataTable())
+            {
+                if (dataTable.Rows.Count > 0)
+                {
+                    name = dataTable.Rows[0]["Name"].ToString();
+                }
+            }
+
+            List<string> list = new List<string>();
+            using (DataTable dataTable = grpcSet.Tables[3].ToDataTable())
+            {
+                foreach(DataColumn col in dataTable.Columns)
+                {
+                    list.Add(col.ColumnName);
+                }
+            }
+
+            //取得する(列設定情報)
+            ColSettingData data = new ColSettingData
+            {
+                ReportID = reportID,
+                ReportName = name,
+                OutputList = grpcSet.Tables[1].Convert<HotelPms.Data.Master.Output>(),
+                OrgColList = list,
+                Rows = new List<ColSettingRow>(),
+            };
+
+            //Dict化
+            Dictionary<int, HotelPms.Data.Master.Output> dict = new Dictionary<int, HotelPms.Data.Master.Output>();
+            foreach (HotelPms.Data.Master.Output item in data.OutputList) { dict.Add(item.ID, item); } 
+
+            //明細
+            using (DataTable detail = grpcSet.Tables[2].ToDataTable())
+            {
+                foreach (DataRow row in detail.Rows)
+                {
+                    Data.Master.OutputItem outputItem = new Data.Master.OutputItem();
+                    outputItem.ConvertDataRow(row);
+                    Data.Master.Output parent = null;
+                    if (!dict.TryGetValue(outputItem.OutputID, out parent)) { continue; }
+                    parent.Items.Add(outputItem);
+                }
+            }
+
+            return data;
+        }
+    }
+}

--
Gitblit v1.10.0