개정판 dc56e95e
issue #937: fixed load UploadFinal.dll dynamically
Change-Id: I53497df92063e9ea42c974c84d22d91b3f79027e
FinalService/KCOM_FinalService/FinalService_Watcher/FinalService_Watcher.csproj | ||
---|---|---|
11 | 11 |
<RootNamespace>FinalService_Watcher</RootNamespace> |
12 | 12 |
<AssemblyName>FinalService_Watcher</AssemblyName> |
13 | 13 |
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
14 |
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
|
14 |
<TargetFrameworkProfile> |
|
15 |
</TargetFrameworkProfile> |
|
15 | 16 |
<FileAlignment>512</FileAlignment> |
16 | 17 |
</PropertyGroup> |
17 | 18 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> |
... | ... | |
28 | 29 |
<PlatformTarget>x86</PlatformTarget> |
29 | 30 |
<DebugType>pdbonly</DebugType> |
30 | 31 |
<Optimize>true</Optimize> |
31 |
<OutputPath>bin\Release\</OutputPath>
|
|
32 |
<OutputPath>..\..\..\Setup\FinalService\</OutputPath>
|
|
32 | 33 |
<DefineConstants>TRACE</DefineConstants> |
33 | 34 |
<ErrorReport>prompt</ErrorReport> |
34 | 35 |
<WarningLevel>4</WarningLevel> |
FinalService/KCOM_FinalService/FinalService_Watcher/Properties/Settings.Designer.cs | ||
---|---|---|
1 | 1 |
//------------------------------------------------------------------------------ |
2 | 2 |
// <auto-generated> |
3 |
// This code was generated by a tool.
|
|
4 |
// Runtime Version:4.0.30319.42000
|
|
3 |
// 이 코드는 도구를 사용하여 생성되었습니다.
|
|
4 |
// 런타임 버전:4.0.30319.42000
|
|
5 | 5 |
// |
6 |
// Changes to this file may cause incorrect behavior and will be lost if
|
|
7 |
// the code is regenerated.
|
|
6 |
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
|
7 |
// 이러한 변경 내용이 손실됩니다.
|
|
8 | 8 |
// </auto-generated> |
9 | 9 |
//------------------------------------------------------------------------------ |
10 | 10 |
|
... | ... | |
12 | 12 |
|
13 | 13 |
|
14 | 14 |
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
15 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
|
15 |
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
|
16 | 16 |
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { |
17 | 17 |
|
18 | 18 |
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
FinalService/KCOM_FinalService/FinalService_Watcher/app.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?>
|
|
1 |
<?xml version="1.0" encoding="utf-8"?>
|
|
2 | 2 |
<configuration> |
3 | 3 |
<configSections> |
4 |
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
|
5 |
<section name="FinalService_Watcher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
|
4 |
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
|
5 |
<section name="FinalService_Watcher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/> |
|
6 | 6 |
</sectionGroup> |
7 | 7 |
</configSections> |
8 | 8 |
<userSettings> |
... | ... | |
12 | 12 |
</setting> |
13 | 13 |
</FinalService_Watcher.Properties.Settings> |
14 | 14 |
</userSettings> |
15 |
</configuration> |
|
15 |
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> |
FinalService/KCOM_FinalService/KCOM_FinalService/FinalService.cs | ||
---|---|---|
18 | 18 |
System.Timers.Timer _Timer = new System.Timers.Timer(); |
19 | 19 |
RemFinalPDFStation _remotingFinal = null; |
20 | 20 |
ServiceEventLog _log = null; |
21 |
public ServiceEventLog logger
|
|
21 |
public ServiceEventLog Logger
|
|
22 | 22 |
{ |
23 | 23 |
get { return this._log; } |
24 | 24 |
} |
FinalService/KCOM_FinalService/KCOM_FinalService/KCOM_FinalService.csproj | ||
---|---|---|
78 | 78 |
<Project>{a714bd67-8aac-4ed8-8ecf-7853c3549a68}</Project> |
79 | 79 |
<Name>MarkupToPDF</Name> |
80 | 80 |
</ProjectReference> |
81 |
<ProjectReference Include="..\UploadFinal\UploadFinal.csproj"> |
|
82 |
<Project>{9cf3737a-e04d-4a55-924e-c88725dfbec7}</Project> |
|
83 |
<Name>UploadFinal</Name> |
|
84 |
</ProjectReference> |
|
85 | 81 |
</ItemGroup> |
86 | 82 |
<ItemGroup> |
87 | 83 |
<None Include="app.config" /> |
FinalService/KCOM_FinalService/KCOM_FinalService/Program.cs | ||
---|---|---|
1 |
using System; |
|
1 |
#if DEBUG |
|
2 |
using KCOM_FinalService.Remoting; |
|
3 |
#endif |
|
4 |
using System; |
|
2 | 5 |
using System.Collections.Generic; |
3 | 6 |
using System.Linq; |
4 | 7 |
using System.ServiceProcess; |
... | ... | |
16 | 19 |
static void Main() |
17 | 20 |
{ |
18 | 21 |
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
19 |
|
|
22 |
#if DEBUG |
|
23 |
RemFinalPDFStation oFinalStation = new RemFinalPDFStation(); |
|
24 |
#else |
|
20 | 25 |
ServicesToRun = new ServiceBase[] |
21 | 26 |
{ |
22 | 27 |
new FinalService() |
23 | 28 |
}; |
24 | 29 |
ServiceBase.Run(ServicesToRun); |
30 |
#endif |
|
25 | 31 |
} |
26 | 32 |
|
27 | 33 |
/// <summary> |
... | ... | |
35 | 41 |
{ |
36 | 42 |
try |
37 | 43 |
{ |
38 |
(Program.ServicesToRun[0] as FinalService).logger.Write(String.Format("Error : {0}", e.ExceptionObject.ToString()) + DateTime.Now);
|
|
44 |
(Program.ServicesToRun[0] as FinalService).Logger.Write(String.Format("Error : {0}", e.ExceptionObject.ToString()) + DateTime.Now);
|
|
39 | 45 |
} |
40 | 46 |
catch (Exception ex) |
41 | 47 |
{ |
FinalService/KCOM_FinalService/KCOM_FinalService/Remoting/RemFinalPDFStation.cs | ||
---|---|---|
7 | 7 |
using System.Collections.Generic; |
8 | 8 |
using System.IO; |
9 | 9 |
using System.Linq; |
10 |
using System.Reflection; |
|
10 | 11 |
using System.Runtime.Remoting.Channels.Tcp; |
11 | 12 |
using System.Threading; |
12 | 13 |
using System.Threading.Tasks; |
... | ... | |
23 | 24 |
string _NoticeTitleBase = null; |
24 | 25 |
string _MyIP = null; |
25 | 26 |
int _TypeName = 1; |
26 |
Properties.Settings _SettingPlace = null; |
|
27 |
readonly Properties.Settings _SettingPlace = null;
|
|
27 | 28 |
|
28 | 29 |
//Queue<FINAL_PDF> _WorkItem = new Queue<FINAL_PDF>(); |
29 | 30 |
ConcurrentQueue<FINAL_PDF> WorkingQueue = null; |
30 | 31 |
List<FINAL_PDF> WaitThread = null; |
31 | 32 |
List<FINAL_PDF> WorkingThread = null; |
32 |
#endregion |
|
33 |
|
|
34 |
private Type _UploadFinalType { get; set; } /// upload final class type |
|
35 |
#endregion |
|
33 | 36 |
|
34 | 37 |
public RemFinalPDFStation() |
35 | 38 |
{ |
36 | 39 |
System.Diagnostics.EventLog _eventLog = new System.Diagnostics.EventLog(); |
37 | 40 |
_Log = new ServiceEventLog(_eventLog, "FinalService", "Application"); |
41 |
|
|
42 |
/// get legacy interface for upload final pdf file |
|
43 |
string UploadFinalDllPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFinal.dll"); |
|
44 |
_Log.Write(UploadFinalDllPath); |
|
45 |
if (File.Exists(UploadFinalDllPath)) |
|
46 |
{ |
|
47 |
Assembly asm = Assembly.LoadFrom(UploadFinalDllPath); |
|
48 |
this._UploadFinalType = asm.GetType("UploadFinal.UploadFinal"); |
|
49 |
} |
|
50 |
/// up to here |
|
51 |
|
|
38 | 52 |
Init(); |
39 | 53 |
} |
40 | 54 |
|
... | ... | |
42 | 56 |
{ |
43 | 57 |
System.Diagnostics.EventLog _eventlog = new System.Diagnostics.EventLog(); |
44 | 58 |
_Log = new ServiceEventLog(_eventlog, "FinalService", "Application"); |
59 |
|
|
60 |
/// get legacy interface for upload final pdf file |
|
61 |
string UploadFinalDllPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFinal.dll"); |
|
62 |
_Log.Write(UploadFinalDllPath); |
|
63 |
if (File.Exists(UploadFinalDllPath)) |
|
64 |
{ |
|
65 |
Assembly asm = Assembly.LoadFrom(UploadFinalDllPath); |
|
66 |
this._UploadFinalType = asm.GetType("UploadFinal.UploadFinal"); |
|
67 |
} |
|
68 |
/// up to here |
|
69 |
|
|
45 | 70 |
Init(); |
46 | 71 |
} |
47 | 72 |
|
... | ... | |
79 | 104 |
if (_Log != null) |
80 | 105 |
{ |
81 | 106 |
_Log.Write("RemFinalPDFStation : " + _Log.ToString()); |
82 |
|
|
83 | 107 |
} |
84 | 108 |
} |
85 | 109 |
IFinalPDF.Cache.Attach(this); |
... | ... | |
135 | 159 |
{ |
136 | 160 |
Task tDeq = Task.Factory.StartNew(() => |
137 | 161 |
{ |
138 |
FINAL_PDF _item; |
|
162 |
FINAL_PDF _item = null;
|
|
139 | 163 |
try |
140 | 164 |
{ |
141 | 165 |
while (WorkingQueue.Count > 0) |
... | ... | |
167 | 191 |
MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF(); |
168 | 192 |
_markuptoPDF.FinalMakeError += new EventHandler<MarkupToPDF.MakeFinalErrorArgs>(_markuptoPDF_FinalMakeError); |
169 | 193 |
_markuptoPDF.EndFinal += new EventHandler<MarkupToPDF.EndFinalEventArgs>(_markuptoPDF_EndFinal); |
170 |
Thread _stathread = new Thread(new ParameterizedThreadStart(_markuptoPDF.MakeFinalPDF)); |
|
171 |
_stathread.Name = _item.ID.ToString(); |
|
194 |
Thread _stathread = new Thread(new ParameterizedThreadStart(_markuptoPDF.MakeFinalPDF)) |
|
195 |
{ |
|
196 |
Name = _item.ID.ToString() |
|
197 |
}; |
|
172 | 198 |
SetFinalState(_item.ID, IFinalPDF.FinalStatus.Create); |
173 | 199 |
//_stathread.Priority = ThreadPriority.Normal; |
174 | 200 |
_stathread.SetApartmentState(ApartmentState.STA); |
... | ... | |
199 | 225 |
return new FinalPDFResult(); |
200 | 226 |
} |
201 | 227 |
|
202 |
|
|
203 |
|
|
204 |
|
|
205 | 228 |
void _markuptoPDF_EndFinal(object sender, MarkupToPDF.EndFinalEventArgs e) |
206 | 229 |
{ |
207 | 230 |
var _T = WorkingThread.Where(t => t == (sender as MarkupToPDF.MarkupToPDF).FinalItem); |
... | ... | |
218 | 241 |
string finalpdfroot = CommonLib.Common.GetConfigString("FinalPDFRootUrl", "URL", ""); |
219 | 242 |
string filename = Path.GetFileName(e.FinalPDFPath); |
220 | 243 |
string pdfpath = !string.IsNullOrEmpty(finalpdfroot) ? finalpdfroot + filename : filename; |
221 |
if (!string.IsNullOrEmpty(soapurl)) |
|
244 |
if (!string.IsNullOrEmpty(soapurl) && (this._UploadFinalType != null))
|
|
222 | 245 |
{ |
223 | 246 |
//Legacy IF |
224 |
KeyValuePair<bool, string> result = UploadFinal.UploadFinal.UploadFinalPDF(pdfpath, e.OriginPDFName, e.FinalPDF, soapurl);
|
|
225 |
if (result.Key)
|
|
247 |
MethodInfo UploadFinalPDFMethod = this._UploadFinalType.GetMethod("UploadFinalPDF", new Type[] { typeof(string), typeof(string), typeof(FINAL_PDF), typeof(string) });
|
|
248 |
if (null != UploadFinalPDFMethod)
|
|
226 | 249 |
{ |
227 |
SetFinalState(_item.ID, FinalStatus.Success); |
|
228 |
} |
|
229 |
else |
|
230 |
{ |
|
231 |
SetFinalState(_item.ID, FinalStatus.Error); |
|
232 |
_Log.Write("Upload error .." + filename + ",pdfname:" + e.OriginPDFName); |
|
250 |
object inst = Activator.CreateInstance(this._UploadFinalType, null); |
|
251 |
object[] parameters = new object[] { pdfpath, e.OriginPDFName, e.FinalPDF, soapurl }; |
|
252 |
KeyValuePair<bool, string> result = (KeyValuePair<bool, string>)(UploadFinalPDFMethod.Invoke(inst, parameters)); |
|
253 |
///KeyValuePair<bool, string> result = UploadFinal.UploadFinal.UploadFinalPDF(pdfpath, e.OriginPDFName, e.FinalPDF, soapurl); |
|
254 |
if (result.Key) |
|
255 |
{ |
|
256 |
SetFinalState(_item.ID, FinalStatus.Success); |
|
257 |
} |
|
258 |
else |
|
259 |
{ |
|
260 |
SetFinalState(_item.ID, FinalStatus.Error); |
|
261 |
_Log.Write("Upload error .." + filename + ",pdfname:" + e.OriginPDFName); |
|
262 |
} |
|
233 | 263 |
} |
234 | 264 |
WorkingThread.Remove(_T.First()); |
235 | 265 |
} |
FinalService/KCOM_FinalService/KCOM_FinalService/bin/Debug/KCOM_FinalService.exe.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<configuration> |
|
3 |
<configSections> |
|
4 |
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > |
|
5 |
<section name="KCOM_FinalService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> |
|
6 |
</sectionGroup> |
|
7 |
</configSections> |
|
8 |
<userSettings> |
|
9 |
<KCOM_FinalService.Properties.Settings> |
|
10 |
<setting name="RemotingPort" serializeAs="String"> |
|
11 |
<value>9092</value> |
|
12 |
</setting> |
|
13 |
<setting name="MultipleFinalCount" serializeAs="String"> |
|
14 |
<value>15</value> |
|
15 |
</setting> |
|
16 |
<setting name="NoticeTitleBase" serializeAs="String"> |
|
17 |
<value><VPCS - Final PDF Creation Notice> Slip No : ({SlipNo}) ({PoNo}) ({VendorName} , {VendorItemNo})</value> |
|
18 |
</setting> |
|
19 |
<setting name="OpenFinalPDFPageUrl" serializeAs="String"> |
|
20 |
<value>finalpdf.daelim.com</value> |
|
21 |
</setting> |
|
22 |
<setting name="WorkflowLink" serializeAs="String"> |
|
23 |
<value>http://esb-vpcs-new.daelimplant.com/ProjectPortal/UserControls/DaelimCI2/UserControls/Form/Workflow/VPC/default.aspx?TYPE={Status}&WFTYPE=VPC&ProjectName={ProjectNo}&id={WorkflowID}&bpartner={bPartner}&USERID={userID}</value> |
|
24 |
</setting> |
|
25 |
<setting name="manyFinalMsg" serializeAs="String"> |
|
26 |
<value>All final PDF (Slip no. {SlipNo}) files were created and published to server successfully.</value> |
|
27 |
</setting> |
|
28 |
<setting name="SingleFinalMsg" serializeAs="String"> |
|
29 |
<value>Final PDF (Slip no. {SlipNo}) file was created and published to server successfully.</value> |
|
30 |
</setting> |
|
31 |
<setting name="NoticeSendDisplayID" serializeAs="String"> |
|
32 |
<value>[PDFPublishAdmin]</value> |
|
33 |
</setting> |
|
34 |
<setting name="finalnoticehtmlPath" serializeAs="String"> |
|
35 |
<value>D:\FinalPDF\HtmlFile\FinalPdfNotice.html</value> |
|
36 |
</setting> |
|
37 |
<setting name="finalnoticehtmlPath_TR" serializeAs="String"> |
|
38 |
<value>D:\FinalPDF\HtmlFile\FinalPdfNotice_TR.html</value> |
|
39 |
</setting> |
|
40 |
<setting name="saveFileFolder" serializeAs="String"> |
|
41 |
<value>D:\\Develop\\Ensemble\\{0}_app\\VPCS_DOCLIB\\{1}\\{2}\\ToVendor\\</value> |
|
42 |
</setting> |
|
43 |
<setting name="resultFileFolder" serializeAs="String"> |
|
44 |
<value>http://cloud.devdoftech.co.kr:5977/FinalPDF/{0}_app/VPCS_DOCLIB/{1}/{2}/ToVendor/{3}</value> |
|
45 |
</setting> |
|
46 |
</KCOM_FinalService.Properties.Settings> |
|
47 |
</userSettings> |
|
48 |
</configuration> |
FinalService/KCOM_FinalService/KCOM_FinalService/bin/Debug/MarkupToPDF.dll.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<configuration> |
|
3 |
<configSections> |
|
4 |
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
|
5 |
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> |
|
6 |
</configSections> |
|
7 |
<connectionStrings> |
|
8 |
<add name="Entity" connectionString="metadata=res://*/Database.Entity.csdl|res://*/Database.Entity.ssdl|res://*/Database.Entity.msl;provider=System.Data.SqlClient;provider connection string="data source=cloud.devdoftech.co.kr,7777;initial catalog=markus;user id=doftech;password=dof1073#;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/> |
|
9 |
<add name="Kcom_entity" connectionString="metadata=res://*/Database.Kcom_Entity.csdl|res://*/Database.Kcom_Entity.ssdl|res://*/Database.Kcom_Entity.msl;provider=System.Data.SqlClient;provider connection string="data source=cloud.devdoftech.co.kr,7777;initial catalog=markus;user id=doftech;password=dof1073#;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/> |
|
10 |
<add name="Kcom_Entity" connectionString="metadata=res://*/Database.Kcom_Entity.csdl|res://*/Database.Kcom_Entity.ssdl|res://*/Database.Kcom_Entity.msl;provider=System.Data.SqlClient;provider connection string="data source=cloud.devdoftech.co.kr,7777;initial catalog=markus;user id=doftech;password=dof1073#;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient"/> |
|
11 |
</connectionStrings> |
|
12 |
<entityFramework> |
|
13 |
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> |
|
14 |
</entityFramework> |
|
15 |
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> |
FinalService/KCOM_FinalService/UploadFinal/UploadFinal.csproj | ||
---|---|---|
27 | 27 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
28 | 28 |
<DebugType>pdbonly</DebugType> |
29 | 29 |
<Optimize>true</Optimize> |
30 |
<OutputPath>bin\Release\</OutputPath>
|
|
30 |
<OutputPath>..\..\..\Setup\FinalService\</OutputPath>
|
|
31 | 31 |
<DefineConstants>TRACE</DefineConstants> |
32 | 32 |
<ErrorReport>prompt</ErrorReport> |
33 | 33 |
<WarningLevel>4</WarningLevel> |
내보내기 Unified diff