diff --git a/Server/Git/AbstractGit.cs b/Server/Git/AbstractGit.cs index 2b97cd3..19ed821 100644 --- a/Server/Git/AbstractGit.cs +++ b/Server/Git/AbstractGit.cs @@ -1,4 +1,5 @@ -using LibGit2Sharp; +using Aspose.Cells.Rendering; +using LibGit2Sharp; using Newtonsoft.Json.Linq; using NLog; using Server.SQL; @@ -14,6 +15,8 @@ namespace Server.Git public bool isRestart; string _repositoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "excel"); + public List sheets; + public string repositoryPath { get { return _repositoryPath; } } /// @@ -32,6 +35,7 @@ namespace Server.Git Push(excel); if (isRestart) goto restart; + DataSet(); } /// @@ -100,12 +104,12 @@ namespace Server.Git logger.Info("version : " + ProtocolProcessor.version); if (ProtocolProcessor.version == "") { - ProtocolProcessor.version = Statics.dynamicData.SelectName("version").value; + ProtocolProcessor.version = Statics.dynamicDataSQL.SelectName("version").value; logger.Info("Select version : " + ProtocolProcessor.version); } else { - Statics.dynamicData.Update(1, ProtocolProcessor.version); + Statics.dynamicDataSQL.Update(1, ProtocolProcessor.version); logger.Info("Update version : " + ProtocolProcessor.version); } @@ -159,5 +163,16 @@ namespace Server.Git return xlsxFileList; } + + + /// + /// 엑셀 데이터 저장 + /// + public void DataSet() + { + int index = sheets.FindIndex(n => n.name == Statics.equipmentExcel.sheetName); + if(index != 0) + Statics.equipmentExcel.init(sheets[index]); + } } } diff --git a/Server/Git/XlsxToJson.cs b/Server/Git/XlsxToJson.cs index 01ef7b5..f64f7a0 100644 --- a/Server/Git/XlsxToJson.cs +++ b/Server/Git/XlsxToJson.cs @@ -11,7 +11,7 @@ namespace Server.Git List fileList = GetFiles(repositoryPath, ".xlsx"); Dictionary>> clientSheetList = new Dictionary>>(); - List sheets = null; + for (int n = 0; n < fileList.Count; n++) { ExcelManager em = new ExcelManager(fileList[n]); diff --git a/Server/Program.cs b/Server/Program.cs index 208f7ed..d4a883b 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -25,7 +25,3 @@ app.MapPost("/spin/random", Spin.Random); #endif app.Run(Statics.URL); - - -// ̺ Ŭ̾Ʈ ̺ ã εΰ -// Ʈ db ѹ ޾ƿ° ƴ ٷ ϴ \ No newline at end of file diff --git a/Server/SQL/EquipmentData.cs b/Server/SQL/EquipmentData.cs index 4df99c0..c414f20 100644 --- a/Server/SQL/EquipmentData.cs +++ b/Server/SQL/EquipmentData.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using Server.Git; using Server.System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -12,11 +13,11 @@ namespace Server.SQL public int part { get; set; } } - public class EquipmentDataSQL + public class EquipmentDataExcel { private Dictionary equipmentData; - public string sheetName = "equipment"; + public string sheetName = "EquipmentData"; public EquipmentData getEquipmentData(long key) { @@ -27,9 +28,14 @@ namespace Server.SQL { return equipmentData.Values.ToList(); } - public void init() + public void init(sheet data) { - + foreach (var item in data.dicViewer) + { + EquipmentData equipmentData = new EquipmentData(); + equipmentData.index = item.Key; + equipmentData.part = (int)item.Value["part"]; + } } } } diff --git a/Server/Service/EquipChange.cs b/Server/Service/EquipChange.cs index f21e776..302de4f 100644 --- a/Server/Service/EquipChange.cs +++ b/Server/Service/EquipChange.cs @@ -26,7 +26,7 @@ namespace Server.Service { throw new RuntimeException("Not Data", Error.nodata); } - EquipmentData equipmentData = Statics.equipmentData[equipment.equipment_data_id]; + EquipmentData equipmentData = Statics.equipmentExcel.getEquipmentData(equipment.equipment_data_id); if (req.is_equipment) { switch (equipmentData.part) diff --git a/Server/System/Statics.cs b/Server/System/Statics.cs index 21beaf0..727921f 100644 --- a/Server/System/Statics.cs +++ b/Server/System/Statics.cs @@ -25,9 +25,9 @@ namespace Server.System public static DeckUnitInfoSQL deckUnitInfoSQL = new DeckUnitInfoSQL(); public static EquipmentrSQL equipmentrSQL = new EquipmentrSQL(); public static UserSQL userSQL = new UserSQL(); - //DATA + public static DynamicDataSQL dynamicDataSQL = new DynamicDataSQL(); - public static DynamicDataSQL dynamicData = new DynamicDataSQL(); - public static EquipmentDataSQL equipmentData = new EquipmentDataSQL(); + //DATA + public static EquipmentDataExcel equipmentExcel = new EquipmentDataExcel(); } }