개정판 73e71c89
Fix: FinalProcess의 log4.net 설정 파일 이름 변경
- log4.net upgrade
- Final Process에서 UploadFinal DLL을 로딩하도록 수정
Change-Id: Iaf430376278a88d96b0a4799e0cfba1c3b4a9398
FinalService/KCOM_FinalService_DL/FinalProcess/FinalProcess.csproj | ||
---|---|---|
32 | 32 |
<ErrorReport>prompt</ErrorReport> |
33 | 33 |
<WarningLevel>4</WarningLevel> |
34 | 34 |
</PropertyGroup> |
35 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> |
|
36 |
<DebugSymbols>true</DebugSymbols> |
|
37 |
<OutputPath>..\KCOM_FinalService\bin\x64\Debug\</OutputPath> |
|
38 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
39 |
<DebugType>full</DebugType> |
|
40 |
<PlatformTarget>x64</PlatformTarget> |
|
41 |
<LangVersion>7.3</LangVersion> |
|
42 |
<ErrorReport>prompt</ErrorReport> |
|
43 |
<Prefer32Bit>true</Prefer32Bit> |
|
44 |
</PropertyGroup> |
|
45 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> |
|
46 |
<OutputPath>bin\x64\Release\</OutputPath> |
|
47 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
48 |
<DebugType>pdbonly</DebugType> |
|
49 |
<PlatformTarget>x64</PlatformTarget> |
|
50 |
<LangVersion>7.3</LangVersion> |
|
51 |
<ErrorReport>prompt</ErrorReport> |
|
52 |
<Prefer32Bit>true</Prefer32Bit> |
|
53 |
</PropertyGroup> |
|
35 | 54 |
<ItemGroup> |
36 | 55 |
<Reference Include="System" /> |
37 | 56 |
<Reference Include="System.Core" /> |
... | ... | |
53 | 72 |
<None Include="FinalService.ini"> |
54 | 73 |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
55 | 74 |
</None> |
56 |
<None Include="Log.config"> |
|
57 |
<SubType>Designer</SubType> |
|
58 |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|
75 |
<None Include="LogProcess.config"> |
|
76 |
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|
59 | 77 |
</None> |
60 | 78 |
</ItemGroup> |
61 | 79 |
<ItemGroup> |
... | ... | |
69 | 87 |
<Version>5.5.13.3</Version> |
70 | 88 |
</PackageReference> |
71 | 89 |
<PackageReference Include="log4net"> |
72 |
<Version>2.0.12</Version>
|
|
90 |
<Version>2.0.17</Version>
|
|
73 | 91 |
</PackageReference> |
74 | 92 |
</ItemGroup> |
75 | 93 |
<ItemGroup> |
FinalService/KCOM_FinalService_DL/FinalProcess/Log.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<configuration> |
|
3 |
<configSections> |
|
4 |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> |
|
5 |
</configSections> |
|
6 |
<log4net> |
|
7 |
<!--<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> |
|
8 |
<applicationName value="ServiceStation"/> |
|
9 |
<layout type="log4net.Layout.PatternLayout"> |
|
10 |
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> |
|
11 |
</layout> |
|
12 |
</appender>--> |
|
13 |
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> |
|
14 |
<file type="log4net.Util.PatternString" value="${programdata}\FinalService\Process\Log\"/> |
|
15 |
<appendtofile value="true"/> |
|
16 |
<datepattern value="'Final_'yyyy-MM-dd'.log'"/> |
|
17 |
<staticlogfilename value="false"/> |
|
18 |
<rollingstyle value="Date"/> |
|
19 |
<layout type="log4net.Layout.PatternLayout"> |
|
20 |
<conversionpattern value="%d [%t] %-5p - %m%n"/> |
|
21 |
</layout> |
|
22 |
</appender> |
|
23 |
<root> |
|
24 |
<level value="All" /> |
|
25 |
<!-- <appender-ref ref="EventLogAppender" />--> |
|
26 |
<appender-ref ref="RollingFileAppender" /> |
|
27 |
</root> |
|
28 |
</log4net> |
|
29 |
</configuration> |
FinalService/KCOM_FinalService_DL/FinalProcess/LogProcess.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<configuration> |
|
3 |
<configSections> |
|
4 |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> |
|
5 |
</configSections> |
|
6 |
<log4net> |
|
7 |
<!--<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> |
|
8 |
<applicationName value="ServiceStation"/> |
|
9 |
<layout type="log4net.Layout.PatternLayout"> |
|
10 |
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> |
|
11 |
</layout> |
|
12 |
</appender>--> |
|
13 |
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> |
|
14 |
<file type="log4net.Util.PatternString" value="${programdata}\FinalService\Process\Log\"/> |
|
15 |
<appendtofile value="true"/> |
|
16 |
<datepattern value="yyyy-MM-dd'.log'"/> |
|
17 |
<staticlogfilename value="false"/> |
|
18 |
<rollingstyle value="Composite"/> |
|
19 |
<layout type="log4net.Layout.PatternLayout"> |
|
20 |
<conversionpattern value="%d [%t] %-5p - %m%n"/> |
|
21 |
</layout> |
|
22 |
</appender> |
|
23 |
<root> |
|
24 |
<level value="All" /> |
|
25 |
<!-- <appender-ref ref="EventLogAppender" />--> |
|
26 |
<appender-ref ref="RollingFileAppender" /> |
|
27 |
</root> |
|
28 |
</log4net> |
|
29 |
</configuration> |
FinalService/KCOM_FinalService_DL/FinalProcess/Program.cs | ||
---|---|---|
1 | 1 |
using IFinalPDF; |
2 |
using KCOMDataModel.Common; |
|
2 | 3 |
using KCOMDataModel.DataModel; |
3 | 4 |
using log4net; |
4 | 5 |
using MarkupToPDF; |
... | ... | |
6 | 7 |
using System.Collections.Generic; |
7 | 8 |
using System.IO; |
8 | 9 |
using System.Linq; |
10 |
using System.Reflection; |
|
9 | 11 |
using System.Text; |
10 | 12 |
using System.Threading.Tasks; |
11 | 13 |
using System.Windows.Forms; |
... | ... | |
16 | 18 |
{ |
17 | 19 |
class Program |
18 | 20 |
{ |
21 |
#region FinalPDF 완료 후 관련 정보를 문서 관리 시스템에 Upload |
|
22 |
public static MethodInfo UploadFinalPDFMethod { get; set; } |
|
23 |
public static object UploadFinalPDFInst { get; set; } |
|
24 |
public static string UploadFinalAssmPath { get; set; } |
|
25 |
#endregion |
|
26 |
|
|
19 | 27 |
public static bool IsEndFinal = false; |
20 | 28 |
/// <summary> |
21 |
/// protected static ILog logger;
|
|
29 |
protected static ILog _logger { get; set; } = null;
|
|
22 | 30 |
/// </summary> |
23 |
public static CommonLib.LogManager logger { get; } = new CommonLib.LogManager(); |
|
24 |
public static FINAL_PDF finalPdf = null; |
|
31 |
|
|
32 |
public static FINAL_PDF finalPdf { get; set; } = null;
|
|
25 | 33 |
public static string RemoteAddress = null; |
26 | 34 |
|
27 | 35 |
#region CommonLib로 옮김 |
... | ... | |
93 | 101 |
{ |
94 | 102 |
try |
95 | 103 |
{ |
96 |
///logger = LogManager.GetLogger(typeof(Program)); |
|
104 |
log4net.Config.BasicConfigurator.Configure(); |
|
105 |
_logger = LogManager.GetLogger(typeof(Program)); |
|
97 | 106 |
|
98 | 107 |
if (args.Length == 2) |
99 | 108 |
{ |
109 |
#region get legacy interface for upload final pdf file |
|
110 |
string UploadFinalDllPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFinal.dll"); |
|
111 |
if (File.Exists(UploadFinalDllPath)) |
|
112 |
{ |
|
113 |
Assembly asm = Assembly.Load(UploadFinalDllPath); |
|
114 |
|
|
115 |
UploadFinalAssmPath = UploadFinalDllPath; |
|
116 |
|
|
117 |
Type _UploadFinalClassType = asm.GetType("UploadFinal.UploadFinal"); |
|
118 |
|
|
119 |
//Legacy IF |
|
120 |
Program.UploadFinalPDFMethod = _UploadFinalClassType.GetMethod("UploadFinalPDF", new Type[] { typeof(string), typeof(string), typeof(KCOMDataModel.DataModel.FINAL_PDF), typeof(string) }); |
|
121 |
if (null != Program.UploadFinalPDFMethod) |
|
122 |
{ |
|
123 |
Program.UploadFinalPDFInst = Activator.CreateInstance(_UploadFinalClassType, null); |
|
124 |
} |
|
125 |
} |
|
126 |
#endregion |
|
127 |
|
|
100 | 128 |
string sFinalID = args[1]; |
101 | 129 |
string sProjectNo = args[0]; |
102 | 130 |
//RemoteAddress = args[1]; |
103 | 131 |
|
104 |
logger.Log(CommonLib.ELogLv.info, $"FinalProcess Final ID : {sFinalID}, Project No : {sProjectNo}");
|
|
132 |
_logger.Info($"FinalProcess Final ID : {sFinalID}, Project No : {sProjectNo}");
|
|
105 | 133 |
|
106 |
MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF(logger); |
|
134 |
MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF(_logger);
|
|
107 | 135 |
_markuptoPDF.FinalMakeError += new EventHandler<MarkupToPDF.MakeFinalErrorArgs>(_markuptoPDF_FinalMakeError); |
108 | 136 |
_markuptoPDF.StatusChanged += new EventHandler<MarkupToPDF.StatusChangedEventArgs>(_markuptoPDF_StatusChange); |
109 | 137 |
_markuptoPDF.EndFinal += _markuptoPDF_EndFinal; |
... | ... | |
123 | 151 |
} |
124 | 152 |
else |
125 | 153 |
{ |
126 |
logger.Log(CommonLib.ELogLv.info, "Arguments is null");
|
|
154 |
_logger.Warn("Arguments is null");
|
|
127 | 155 |
} |
128 | 156 |
} |
129 | 157 |
catch (Exception ex) |
130 | 158 |
{ |
131 |
logger.Log(CommonLib.ELogLv.error, $"FinalProcess Final ID : {args[1]}, Project No : {args[0]}{Environment.NewLine}Error Message : {ex.ToString()}{Environment.NewLine}Stack Trace : {ex.StackTrace}");
|
|
159 |
_logger.Error($"FinalProcess Final ID : {args[1]}, Project No : {args[0]}{Environment.NewLine}Error Message : {ex.ToString()}{Environment.NewLine}Stack Trace : {ex.StackTrace}");
|
|
132 | 160 |
} |
133 | 161 |
finally |
134 | 162 |
{ |
... | ... | |
142 | 170 |
} |
143 | 171 |
|
144 | 172 |
/// <summary> |
145 |
/// 오류 및 완료 시간을 저장한다.
|
|
173 |
/// DATABASE에서 상태를 변경한다.
|
|
146 | 174 |
/// </summary> |
147 |
/// <param name="sender"></param> |
|
148 |
/// <param name="e"></param> |
|
149 |
private static void _markuptoPDF_EndFinal(object sender, EndFinalEventArgs e) |
|
175 |
/// <param name="finalID"></param> |
|
176 |
/// <param name="status"></param> |
|
177 |
/// <param name="log"></param> |
|
178 |
private static void SetFinalState(string finalID, FinalStatus status, string log = null) |
|
150 | 179 |
{ |
151 |
logger.Log(CommonLib.ELogLv.info, $"Connection String : {KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()}");
|
|
180 |
_logger.Info($"Connection String : {KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()}");
|
|
152 | 181 |
using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
153 | 182 |
{ |
154 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == e.FinalPDF.ID && final.PROJECT_NO == e.FinalPDF.PROJECT_NO).ToList();
|
|
183 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == finalID);
|
|
155 | 184 |
if (finalList.Any()) |
156 | 185 |
{ |
157 |
var final = finalList[0]; |
|
158 |
if (e.FinalPDF.STATUS == (int)FinalStatus.Create) |
|
186 |
if (status == FinalStatus.Create) |
|
159 | 187 |
{ |
160 | 188 |
var sb = new System.Text.StringBuilder(); |
161 | 189 |
sb.AppendLine("V3"); |
162 |
sb.AppendLine(final.EXCEPTION); |
|
190 |
sb.AppendLine(finalList.First().EXCEPTION);
|
|
163 | 191 |
|
164 |
final.EXCEPTION = sb.ToString(); |
|
165 |
final.START_DATETIME = DateTime.Now; |
|
192 |
finalList.First().EXCEPTION = sb.ToString();
|
|
193 |
finalList.First().START_DATETIME = DateTime.Now;
|
|
166 | 194 |
} |
167 |
|
|
168 |
if (e.FinalPDF.STATUS == (int)FinalStatus.Success) |
|
195 |
else if (status == FinalStatus.Success) |
|
169 | 196 |
{ |
170 |
final.END_DATETIME = DateTime.Now; |
|
171 |
final.STATUS = (int)FinalStatus.Success; |
|
197 |
finalList.First().END_DATETIME = DateTime.Now; |
|
172 | 198 |
} |
173 |
|
|
174 |
if (e.FinalPDF.STATUS == (int)FinalStatus.PdfStamp && !string.IsNullOrWhiteSpace(e.Error)) |
|
199 |
else if (status == FinalStatus.PdfStamp && !string.IsNullOrWhiteSpace(log)) |
|
175 | 200 |
{ |
176 | 201 |
var sb = new System.Text.StringBuilder(); |
177 |
sb.AppendLine(e.Message);
|
|
178 |
sb.AppendLine(final.EXCEPTION); |
|
202 |
sb.AppendLine(log);
|
|
203 |
sb.AppendLine(finalList.First().EXCEPTION);
|
|
179 | 204 |
|
180 |
final.EXCEPTION = e.Message;
|
|
205 |
finalList.First().EXCEPTION = log;
|
|
181 | 206 |
} |
182 | 207 |
|
183 |
final.STATUS = e.FinalPDF.STATUS; |
|
184 |
|
|
185 |
logger.Log(CommonLib.ELogLv.info, $"Final PDF Before Status : {e.FinalPDF.STATUS}"); |
|
208 |
finalList.First().STATUS = (int)status; |
|
186 | 209 |
_entity.SaveChanges(); |
187 |
logger.Log(CommonLib.ELogLv.info, $"Final PDF After Status : {final.STATUS}"); |
|
188 | 210 |
} |
189 | 211 |
} |
212 |
} |
|
213 |
|
|
214 |
/// <summary> |
|
215 |
/// 오류 및 완료 시간을 저장한다. |
|
216 |
/// </summary> |
|
217 |
/// <param name="sender"></param> |
|
218 |
/// <param name="e"></param> |
|
219 |
private static void _markuptoPDF_EndFinal(object sender, EndFinalEventArgs e) |
|
220 |
{ |
|
221 |
try |
|
222 |
{ |
|
223 |
#region 문서 관리 시스템에 정보를 업로드 |
|
224 |
string soapurl = CommonLib.Common.GetConfigString("UpLoadServiceUrl", "URL", ""); |
|
225 |
if (!string.IsNullOrEmpty(soapurl) && (Program.UploadFinalPDFInst != null) && (Program.UploadFinalPDFMethod != null)) |
|
226 |
{ |
|
227 |
string pdfpath = e.FinalPDFRemotePath; |
|
228 |
object[] parameters = new object[] { pdfpath, e.OriginPDFName, e.FinalPDF, soapurl }; |
|
229 |
|
|
230 |
///_Logger.Write("UploadPDF.dll Path :" + Program.UploadFinalAssmPath, LogLevel.Info); |
|
231 |
///_Logger.Write("Call Upload Final .." + pdfpath + " finalPDFPath : " + e.FinalPDFPath + " FinalPDFRemotePath : " + e.FinalPDFRemotePath + ",CreateUser:" + e.FinalPDF.CREATE_USER_ID + ",CreateUser:" + e.FinalPDF.DOCUMENT_ID + ",pdfname:" + e.OriginPDFName + ",finalPDF ID : " + e.FinalPDF.ID + ",soapUri:" + soapurl, LogLevel.Info); |
|
232 |
|
|
233 |
KeyValuePair<bool, string> result = (KeyValuePair<bool, string>)(Program.UploadFinalPDFMethod.Invoke(Program.UploadFinalPDFInst, parameters)); |
|
234 |
if (result.Key) |
|
235 |
{ |
|
236 |
SetFinalState(e.FinalPDF.ID, FinalStatus.Success); |
|
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
SetFinalState(e.FinalPDF.ID, FinalStatus.Error); |
|
241 |
///_Logger.Write("Upload error .." + pdfpath + ",pdfname:" + e.OriginPDFName + " Msg : " + result.Value, LogLevel.Error); |
|
242 |
} |
|
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
string savepath = CommonLib.Common.GetConfigString("DebugSavePath", "URL", ""); |
|
247 |
|
|
248 |
string sFolder = e.FinalPDF.DOCUMENT_ID.All(char.IsDigit) ? (Convert.ToInt64(e.FinalPDF.DOCUMENT_ID) / 100).ToString() : e.FinalPDF.DOCUMENT_ID.Substring(0, 5); |
|
249 |
string saveFolder = String.Format(savepath, e.FinalPDF.PROJECT_NO, sFolder, e.FinalPDF.DOCUMENT_ID); |
|
250 |
if (!System.IO.Directory.Exists(saveFolder)) |
|
251 |
{ |
|
252 |
System.IO.Directory.CreateDirectory(saveFolder); |
|
253 |
} |
|
254 |
|
|
255 |
///_Logger.Write(String.Format("saveFolder : {0}", saveFolder), LogLevel.Info); |
|
256 |
|
|
257 |
try |
|
258 |
{ |
|
259 |
System.IO.File.Copy(e.FinalPDFPath, saveFolder + e.OriginPDFName, true); |
|
260 |
///_Logger.Write($"End Final SaveFile :{saveFolder + e.OriginPDFName}", LogLevel.Info); |
|
261 |
} |
|
262 |
catch (Exception ex) |
|
263 |
{ |
|
264 |
///_Logger.Write(ex); |
|
265 |
} |
|
266 |
|
|
267 |
using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(e.FinalPDF.PROJECT_NO).ToString())) |
|
268 |
{ |
|
269 |
var item = _entity.DOCUMENT_ITEM.Where(d => d.DOCUMENT_ID == e.FinalPDF.DOCUMENT_ID).FirstOrDefault(); |
|
270 |
string resultpath = CommonLib.Common.GetConfigString("DebugResultUrlPath", "URL", ""); |
|
271 |
|
|
272 |
try |
|
273 |
{ |
|
274 |
item.RESULT_FILE = String.Format(resultpath, e.FinalPDF.PROJECT_NO, sFolder, e.FinalPDF.DOCUMENT_ID, e.OriginPDFName); |
|
275 |
} |
|
276 |
catch (Exception ex) |
|
277 |
{ |
|
278 |
///_Logger.Write(new Exception($"DebugResultUrlPath의 Index를 확인 하세요.{resultpath}", ex)); |
|
279 |
} |
|
280 |
|
|
281 |
///_Logger.Write($"End FinalId:{item.ID} RESULT_FILE_PATH:{item.RESULT_FILE}", LogLevel.Info); |
|
282 |
_entity.SaveChanges(); |
|
283 |
SetFinalState(e.FinalPDF.ID, FinalStatus.Success); |
|
284 |
} |
|
285 |
|
|
286 |
#if DEBUG |
|
287 |
//this.WaitingQueue.Enqueue(_item); |
|
288 |
#endif |
|
289 |
} |
|
290 |
#endregion |
|
291 |
} |
|
292 |
catch (Exception ex) |
|
293 |
{ |
|
294 |
SetFinalState(e.FinalPDF.ID, FinalStatus.Error); |
|
295 |
///_Logger.Write(ex); |
|
296 |
} |
|
190 | 297 |
|
191 | 298 |
IsEndFinal = true; |
192 | 299 |
} |
FinalService/KCOM_FinalService_DL/FinalProcess/Properties/AssemblyInfo.cs | ||
---|---|---|
34 | 34 |
// [assembly: AssemblyVersion("1.0.*")] |
35 | 35 |
[assembly: AssemblyVersion("1.0.0.0")] |
36 | 36 |
[assembly: AssemblyFileVersion("1.0.0.0")] |
37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)] |
|
37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "LogProcess.config", Watch = true)] |
FinalService/KCOM_FinalService_DL/KCOM_FinalService/FinalService.cs | ||
---|---|---|
7 | 7 |
using System.Linq; |
8 | 8 |
using System.ServiceProcess; |
9 | 9 |
using System.Threading; |
10 |
using System.Diagnostics; |
|
11 | 10 |
|
12 | 11 |
namespace KCOM_FinalService |
13 | 12 |
{ |
... | ... | |
93 | 92 |
lock (FinalPDFAgentMap) |
94 | 93 |
{ |
95 | 94 |
FinalPDFAgentMap.Add(FinalID, new DocumentProcess($"{ProjectNo}-{FinalID}", -1)); |
96 |
|
|
97 | 95 |
LaunchFindPDFAgent(FinalID, ProjectNo, FinalID); |
98 | 96 |
} |
99 | 97 |
} |
... | ... | |
184 | 182 |
} |
185 | 183 |
#endregion |
186 | 184 |
} |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
//if (kv.Value.Id == -1) |
|
194 |
//{ |
|
195 |
// //_Timer.Elapsed -= _Timer_Elapsed; |
|
196 |
// var tokens = kv.Value.Document.Split('-'); |
|
197 |
// using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
198 |
// { |
|
199 |
// string sID = tokens[1]; |
|
200 |
// string sProjectNo = tokens[0]; |
|
201 |
|
|
202 |
// var items = _entity.FINAL_PDF.Where(x => x.ID == sID && x.PROJECT_NO == sProjectNo); |
|
203 |
// if (items.Any() && items.First().STATUS == 0) |
|
204 |
// { |
|
205 |
// LaunchFindPDFAgent(kv.Key, tokens[0], tokens[1]); |
|
206 |
// } |
|
207 |
|
|
208 |
// } |
|
209 |
// //_Timer.Elapsed += _Timer_Elapsed; |
|
210 |
//} |
|
211 |
//else |
|
212 |
//{ |
|
213 |
// try |
|
214 |
// { |
|
215 |
// #region 실행 중인 프로세스를 확인 |
|
216 |
// var process = Process.GetProcessById(kv.Value.Id); |
|
217 |
// #endregion |
|
218 |
// } |
|
219 |
// catch (ArgumentException ex) |
|
220 |
// { |
|
221 |
// var tokens = kv.Value.Document.Split('-'); |
|
222 |
// string FinalID = tokens[1]; |
|
223 |
// #region FinalPDF 완료 여부 확인 후 완료되지 않았으면 agent 실행 |
|
224 |
// using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
225 |
// { |
|
226 |
// var items = _entity.FINAL_PDF.Where(x => x.ID == FinalID); |
|
227 |
// if (items.Any() && items.First().STATUS == 4) |
|
228 |
// { |
|
229 |
// FinalPDFAgentMap.Remove(kv.Key); |
|
230 |
// } |
|
231 |
// else |
|
232 |
// { |
|
233 |
// LaunchFindPDFAgent(kv.Key, tokens[0], tokens[1]); |
|
234 |
// } |
|
235 |
// } |
|
236 |
// #endregion |
|
237 |
// } |
|
238 |
//} |
|
239 | 185 |
} |
240 | 186 |
} |
241 | 187 |
|
FinalService/KCOM_FinalService_DL/KCOM_FinalService/KCOM_FinalService.csproj | ||
---|---|---|
17 | 17 |
<DebugSymbols>true</DebugSymbols> |
18 | 18 |
<DebugType>full</DebugType> |
19 | 19 |
<Optimize>false</Optimize> |
20 |
<OutputPath>bin\Debug\</OutputPath> |
|
20 |
<OutputPath>bin\x64\Debug\</OutputPath>
|
|
21 | 21 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
22 | 22 |
<ErrorReport>prompt</ErrorReport> |
23 | 23 |
<WarningLevel>4</WarningLevel> |
... | ... | |
42 | 42 |
<SpecificVersion>False</SpecificVersion> |
43 | 43 |
<HintPath>..\KCOMDataModel\bin\Debug\KCOMDataModel.dll</HintPath> |
44 | 44 |
</Reference> |
45 |
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
|
46 |
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
|
|
45 |
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
|
46 |
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
|
47 | 47 |
</Reference> |
48 | 48 |
<Reference Include="System" /> |
49 | 49 |
<Reference Include="System.Configuration" /> |
FinalService/KCOM_FinalService_DL/KCOM_FinalService/Log.config | ||
---|---|---|
13 | 13 |
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> |
14 | 14 |
<file type="log4net.Util.PatternString" value="${programdata}\FinalService\Log\"/> |
15 | 15 |
<appendtofile value="true"/> |
16 |
<datepattern value="'Final_'yyyy-MM-dd'.log'"/>
|
|
16 |
<datepattern value="yyyy-MM-dd'.log'"/> |
|
17 | 17 |
<staticlogfilename value="false"/> |
18 | 18 |
<rollingstyle value="Date"/> |
19 | 19 |
<layout type="log4net.Layout.PatternLayout"> |
FinalService/KCOM_FinalService_DL/KCOM_FinalService/Program.cs | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public static ServiceBase[] ServicesToRun = null; |
27 | 27 |
|
28 |
public static MethodInfo UploadFinalPDFMethod { get; set; } |
|
29 |
public static object UploadFinalPDFInst { get; set; } |
|
30 |
public static string UploadFinalAssmPath { get; set; } |
|
31 |
|
|
32 | 28 |
public static MarkusFinalService service; |
33 | 29 |
|
34 | 30 |
/// <summary> |
... | ... | |
40 | 36 |
|
41 | 37 |
log4net.GlobalContext.Properties["LogFilePath"] = Path.Combine(AppDataFolder, "Log", "FinalService.log"); |
42 | 38 |
|
43 |
#region get legacy interface for upload final pdf file |
|
44 |
string UploadFinalDllPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFinal.dll"); |
|
45 |
if (File.Exists(UploadFinalDllPath)) |
|
46 |
{ |
|
47 |
Assembly asm = Assembly.Load(UploadFinalDllPath); |
|
48 |
|
|
49 |
UploadFinalAssmPath = UploadFinalDllPath; |
|
50 |
|
|
51 |
Type _UploadFinalClassType = asm.GetType("UploadFinal.UploadFinal"); |
|
52 |
|
|
53 |
//Legacy IF |
|
54 |
Program.UploadFinalPDFMethod = _UploadFinalClassType.GetMethod("UploadFinalPDF", new Type[] { typeof(string), typeof(string), typeof(KCOMDataModel.DataModel.FINAL_PDF), typeof(string) }); |
|
55 |
if (null != Program.UploadFinalPDFMethod) |
|
56 |
{ |
|
57 |
Program.UploadFinalPDFInst = Activator.CreateInstance(_UploadFinalClassType, null); |
|
58 |
} |
|
59 |
} |
|
60 |
#endregion |
|
61 |
|
|
62 | 39 |
try |
63 | 40 |
{ |
64 | 41 |
if (Environment.UserInteractive) |
FinalService/KCOM_FinalService_DL/KCOM_FinalService/Remoting/RemFinalPDFStation.cs | ||
---|---|---|
305 | 305 |
{ |
306 | 306 |
try |
307 | 307 |
{ |
308 |
if (OnAskFinalPDF != null) |
|
309 |
OnAskFinalPDF(ProjectNo, FinalID); |
|
310 |
//TODO: FinalPDFAgent로 옮겨야 함 |
|
311 |
/* |
|
312 |
using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
|
313 |
{ |
|
314 |
FINAL_PDF finalpdf = _entity.FINAL_PDF.Where(final =>final.PROJECT_NO == ProjectNo && final.ID == FinalID).FirstOrDefault(); |
|
315 |
if (finalpdf != null) |
|
316 |
{ |
|
317 |
#region 쓰레드를 실행하여 MakeMergedPDF 수행 |
|
318 |
ThreadPool.QueueUserWorkItem(this.MakeMergedPDF, finalpdf); |
|
319 |
#endregion |
|
320 |
} |
|
321 |
else |
|
322 |
{ |
|
323 |
throw new ArgumentException(string.Format("ProjectNo : {0}, FinalID : {1}", ProjectNo, FinalID)); |
|
324 |
} |
|
325 |
} |
|
326 |
*/ |
|
308 |
if (OnAskFinalPDF != null) OnAskFinalPDF(ProjectNo, FinalID); |
|
327 | 309 |
} |
328 | 310 |
catch(Exception ex) |
329 | 311 |
{ |
... | ... | |
386 | 368 |
pdfpath = !string.IsNullOrEmpty(finalpdfroot) ? finalpdfroot + filename : filename; |
387 | 369 |
} |
388 | 370 |
|
389 |
if (!string.IsNullOrEmpty(soapurl) && (Program.UploadFinalPDFInst != null) && (Program.UploadFinalPDFMethod != null)) |
|
371 |
/*if (!string.IsNullOrEmpty(soapurl) && (Program.UploadFinalPDFInst != null) && (Program.UploadFinalPDFMethod != null))
|
|
390 | 372 |
{ |
391 | 373 |
object[] parameters = new object[] { pdfpath, e.OriginPDFName, e.FinalPDF, soapurl }; |
392 | 374 |
|
... | ... | |
406 | 388 |
_Logger.Write("Upload error .." + pdfpath + ",pdfname:" + e.OriginPDFName + " Msg : " + result.Value, LogLevel.Error); |
407 | 389 |
} |
408 | 390 |
} |
409 |
else |
|
391 |
else*/
|
|
410 | 392 |
{ |
411 | 393 |
///TODO: 저장할 폴더 위치를 configuration으로 빼주세요 |
412 | 394 |
|
... | ... | |
470 | 452 |
finally |
471 | 453 |
{ |
472 | 454 |
WorkingList.Remove(_T.First()); |
473 |
|
|
474 | 455 |
} |
475 | 456 |
|
476 | 457 |
/// 대기중인 merged pdf가 있을 경우 merged pdf를 생성한다 |
... | ... | |
588 | 569 |
pdfpath = !string.IsNullOrEmpty(finalpdfroot) ? finalpdfroot + filename : filename; |
589 | 570 |
} |
590 | 571 |
|
591 |
if (!string.IsNullOrEmpty(soapurl) && (Program.UploadFinalPDFInst != null) && (Program.UploadFinalPDFMethod != null)) |
|
572 |
/*if (!string.IsNullOrEmpty(soapurl) && (Program.UploadFinalPDFInst != null) && (Program.UploadFinalPDFMethod != null))
|
|
592 | 573 |
{ |
593 | 574 |
object[] parameters = new object[] { FinalPDFPath, OriginFileName, _item, soapurl }; |
594 | 575 |
|
... | ... | |
608 | 589 |
_Logger.Write("Upload error .." + pdfpath + ",pdfname:" + FinalPDFPath + " Msg : " + result.Value, LogLevel.Error); |
609 | 590 |
} |
610 | 591 |
} |
611 |
else |
|
592 |
else*/
|
|
612 | 593 |
{ |
613 | 594 |
///TODO: 저장할 폴더 위치를 configuration으로 빼주세요 |
614 | 595 |
|
FinalService/KCOM_FinalService_DL/KCOM_FinalService/packages.config | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<packages> |
3 |
<package id="log4net" version="2.0.12" targetFramework="net461" />
|
|
3 |
<package id="log4net" version="2.0.17" targetFramework="net461" />
|
|
4 | 4 |
</packages> |
FinalService/KCOM_FinalService_DL/KCOM_FinalService_DL.sln | ||
---|---|---|
163 | 163 |
{EB1DE04A-D86E-4BF7-B095-F72207923C3B}.Release|x86.Build.0 = Release|Any CPU |
164 | 164 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
165 | 165 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
166 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
167 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.Build.0 = Debug|Any CPU
|
|
166 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.ActiveCfg = Debug|x64
|
|
167 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x64.Build.0 = Debug|x64
|
|
168 | 168 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x86.ActiveCfg = Debug|Any CPU |
169 | 169 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Debug|x86.Build.0 = Debug|Any CPU |
170 | 170 |
{9CF3737A-E04D-4A55-924E-C88725DFBEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
... | ... | |
205 | 205 |
{99E36DFB-0C2C-432D-BC33-7CF6D4B947C2}.Release|x86.Build.0 = Release|Any CPU |
206 | 206 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
207 | 207 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
208 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
209 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x64.Build.0 = Debug|Any CPU
|
|
208 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x64.ActiveCfg = Debug|x64
|
|
209 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x64.Build.0 = Debug|x64
|
|
210 | 210 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x86.ActiveCfg = Debug|Any CPU |
211 | 211 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Debug|x86.Build.0 = Debug|Any CPU |
212 | 212 |
{6CD6E8FE-A661-4B9E-AE63-B7826921EE9B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
FinalService/KCOM_FinalService_DL/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
22 | 22 |
{ |
23 | 23 |
public class MarkupToPDF : IDisposable |
24 | 24 |
{ |
25 |
public dynamic _LogManager = null;
|
|
26 |
public MarkupToPDF(CommonLib.LogManager LogManager = null)
|
|
25 |
public log4net.ILog _LogManager = null;
|
|
26 |
public MarkupToPDF(log4net.ILog LogManager = null)
|
|
27 | 27 |
{ |
28 | 28 |
if (LogManager != null) |
29 | 29 |
_LogManager = LogManager; |
... | ... | |
90 | 90 |
private void SetFinalPDFLog(CommonLib.ELogLv logLv, string finalID, string projectNo, string message) |
91 | 91 |
{ |
92 | 92 |
if (_LogManager != null) |
93 |
_LogManager.Log(logLv, $"Final ID : {finalID}, Project No : {projectNo}, Message : {message}");
|
|
93 |
_LogManager.Info($"Final ID : {finalID}, Project No : {projectNo}, Message : {message}");
|
|
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
private string GetFileName(string hrefLink) |
... | ... | |
1270 | 1270 |
if (File.Exists(destfilepath)) |
1271 | 1271 |
File.Delete(destfilepath); |
1272 | 1272 |
|
1273 |
File.Move(FinalPDFPath.FullName, destfilepath); |
|
1273 |
File.Copy(FinalPDFPath.FullName, destfilepath); |
|
1274 |
/* |
|
1274 | 1275 |
FinalPDFPath = new FileInfo(destfilepath); |
1275 | 1276 |
File.Delete(WorkingFilePath); |
1277 |
*/ |
|
1276 | 1278 |
} |
1277 | 1279 |
catch (Exception ex) |
1278 | 1280 |
{ |
FinalService/KCOM_FinalService_DL/MarkupToPDF/MarkupToPDF.csproj | ||
---|---|---|
63 | 63 |
<SpecificVersion>False</SpecificVersion> |
64 | 64 |
<HintPath>..\KCOMDataModel\bin\Debug\KCOMDataModel.dll</HintPath> |
65 | 65 |
</Reference> |
66 |
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> |
|
67 |
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath> |
|
68 |
</Reference> |
|
66 | 69 |
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> |
67 | 70 |
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath> |
68 | 71 |
</Reference> |
FinalService/KCOM_FinalService_DL/MarkupToPDF/packages.config | ||
---|---|---|
2 | 2 |
<packages> |
3 | 3 |
<package id="BouncyCastle" version="1.8.9" targetFramework="net461" /> |
4 | 4 |
<package id="iTextSharp" version="5.5.13.3" targetFramework="net461" /> |
5 |
<package id="log4net" version="2.0.17" targetFramework="net461" /> |
|
5 | 6 |
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net40" requireReinstallation="true" /> |
6 | 7 |
<package id="Rx-Main" version="1.0.11226" targetFramework="net40" /> |
7 | 8 |
<package id="Rxx" version="1.3.4451.33754" targetFramework="net40" /> |
FinalService/KCOM_FinalService_DL/UploadFinal/UploadFinal_Daelim.csproj | ||
---|---|---|
19 | 19 |
<DebugSymbols>true</DebugSymbols> |
20 | 20 |
<DebugType>full</DebugType> |
21 | 21 |
<Optimize>false</Optimize> |
22 |
<OutputPath>bin\Debug\</OutputPath> |
|
22 |
<OutputPath>..\KCOM_FinalService\bin\Debug\</OutputPath>
|
|
23 | 23 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
24 | 24 |
<ErrorReport>prompt</ErrorReport> |
25 | 25 |
<WarningLevel>4</WarningLevel> |
... | ... | |
37 | 37 |
<PropertyGroup> |
38 | 38 |
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
39 | 39 |
</PropertyGroup> |
40 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> |
|
41 |
<DebugSymbols>true</DebugSymbols> |
|
42 |
<OutputPath>..\KCOM_FinalService\bin\x64\Debug\</OutputPath> |
|
43 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
44 |
<DebugType>full</DebugType> |
|
45 |
<PlatformTarget>x64</PlatformTarget> |
|
46 |
<LangVersion>7.3</LangVersion> |
|
47 |
<ErrorReport>prompt</ErrorReport> |
|
48 |
</PropertyGroup> |
|
49 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> |
|
50 |
<OutputPath>bin\x64\Release\</OutputPath> |
|
51 |
<DefineConstants>TRACE</DefineConstants> |
|
52 |
<Optimize>true</Optimize> |
|
53 |
<DebugType>pdbonly</DebugType> |
|
54 |
<PlatformTarget>x64</PlatformTarget> |
|
55 |
<LangVersion>7.3</LangVersion> |
|
56 |
<ErrorReport>prompt</ErrorReport> |
|
57 |
</PropertyGroup> |
|
40 | 58 |
<ItemGroup> |
41 | 59 |
<Reference Include="System" /> |
42 | 60 |
<Reference Include="System.Core" /> |
... | ... | |
59 | 77 |
<WCFMetadata Include="Service References\" /> |
60 | 78 |
</ItemGroup> |
61 | 79 |
<ItemGroup> |
80 |
<PackageReference Include="log4net"> |
|
81 |
<Version>2.0.17</Version> |
|
82 |
</PackageReference> |
|
83 |
</ItemGroup> |
|
84 |
<ItemGroup> |
|
62 | 85 |
<ProjectReference Include="..\CommonLib\CommonLib.csproj"> |
63 | 86 |
<Project>{ee9aaabc-1678-43a4-878e-cedbb577cf01}</Project> |
64 | 87 |
<Name>CommonLib</Name> |
... | ... | |
68 | 91 |
<Name>KCOMDataModel</Name> |
69 | 92 |
</ProjectReference> |
70 | 93 |
</ItemGroup> |
71 |
<ItemGroup> |
|
72 |
<PackageReference Include="log4net"> |
|
73 |
<Version>2.0.12</Version> |
|
74 |
</PackageReference> |
|
75 |
</ItemGroup> |
|
76 | 94 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
77 | 95 |
<!-- test |
78 | 96 |
To modify your build process, add your task inside one of the targets below and uncomment it. |
내보내기 Unified diff