excel처리 시스템 변경
This commit is contained in:
parent
ef25bc6d3b
commit
63b86328bc
|
|
@ -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<sheet> sheets;
|
||||
|
||||
public string repositoryPath { get { return _repositoryPath; } }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -32,6 +35,7 @@ namespace Server.Git
|
|||
Push(excel);
|
||||
if (isRestart)
|
||||
goto restart;
|
||||
DataSet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 엑셀 데이터 저장
|
||||
/// </summary>
|
||||
public void DataSet()
|
||||
{
|
||||
int index = sheets.FindIndex(n => n.name == Statics.equipmentExcel.sheetName);
|
||||
if(index != 0)
|
||||
Statics.equipmentExcel.init(sheets[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Git
|
|||
List<string> fileList = GetFiles(repositoryPath, ".xlsx");
|
||||
|
||||
Dictionary<string, Dictionary<long, Dictionary<string, object>>> clientSheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>();
|
||||
List<sheet> sheets = null;
|
||||
|
||||
for (int n = 0; n < fileList.Count; n++)
|
||||
{
|
||||
ExcelManager em = new ExcelManager(fileList[n]);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,3 @@ app.MapPost("/spin/random", Spin.Random);
|
|||
#endif
|
||||
|
||||
app.Run(Statics.URL);
|
||||
|
||||
|
||||
//서버 테이블과 클라이언트 테이블을 찾아 따로두고
|
||||
//서버 업데이트시 db에서 한번더 받아오는것이 아닌 받은값을 서버에 바로 세팅하는 방식으로 변경
|
||||
|
|
@ -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<long, EquipmentData> 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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue