Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15 rsolanki 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|			          XML BOM Gen				 	 |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
Response.Expires = 0	' always load the page, dont store
12
%>
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/config.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
 
18
<%
19
'------------ VARIABLE DEFINITION -------------
20
Dim objWSH
19 rsolanki 21
Dim rsQry
22
Dim generated
15 rsolanki 23
'------------ CONSTANTS DECLARATION -----------
24
'------------ VARIABLE INIT -------------------
25
'------------ CONDITIONS ----------------------
26
'----------------------------------------------
27
%>
28
<%
19 rsolanki 29
Function DateReversed ( dDate )
30
	' Ensures Reverse Date format YYYY-MM-DD
31
	If IsNull(dDate) Then Exit Function
32
	DateReversed = Year(dDate) &"-"&  Month(dDate) &"-"& Day(dDate)
33
End Function
15 rsolanki 34
'--------------------------------------------------------------------------------------------------------------------------
35
 
36
'--------------------------------------------------------------------------------------------------------------------------
37
%>
38
<%
39
'**************************** M  A  I  N ******************************
40
 
41
If Request("bom_id") <> "" Then
42
 
19 rsolanki 43
	OraDatabase.Parameters.Add "BOM_ID",	Request("bom_id"),	ORAPARM_INPUT, ORATYPE_NUMBER 
44
	Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("NodesSpecFileNames.sql"), cint(0))
45
	OraDatabase.Parameters.Remove "BOM_ID"
15 rsolanki 46
 
19 rsolanki 47
	If rsQry.RecordCount <> 0 Then 
48
 
49
		generated = true
50
 
51
		Set objWSH = Server.CreateObject("WScript.Shell")
52
		objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\NodesSpecRelease.wsf /bom_id:"& Request("bom_id") , 0, True 
53
 
54
		OraDatabase.Parameters.Add "BOM_ID", 	Request("bom_id"), 			ORAPARM_INPUT, ORATYPE_NUMBER
55
		OraDatabase.Parameters.Add "USER_ID", 	objAccessControl.UserId, 	ORAPARM_INPUT, ORATYPE_NUMBER 
56
 
57
		objEH.TryORA ( OraSession )
58
 
59
		OraDatabase.ExecuteSQL _
60
		"BEGIN   pk_Bom.Log_Bom_Trail ( :BOM_ID, 'NODE SPECS FILE GENERATED', :USER_ID, NULL );   END;"
61
 
62
		objEH.CatchORA ( OraSession )
63
 
64
		OraDatabase.Parameters.Remove "BOM_ID"
65
		OraDatabase.Parameters.Remove "USER_ID"	
66
 
67
		Dim objZIPObject
68
		Set rsQry = OraDatabase.DbCreateDynaset( "SELECT bn.BOM_NAME, br.BRANCH_NAME, bn.BOM_NAME ||''|| b.BOM_VERSION ||'.'|| b.BOM_LIFECYCLE AS VERSION FROM BOMS B, BRANCHES BR, BOM_NAMES BN WHERE B.BOM_ID = "& Request("bom_id") &" AND B.BRANCH_ID = BR.BRANCH_ID AND B.BOM_NAME_ID = BN.BOM_NAME_ID", cint(0))
69
 
70
		Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
71
 
72
		objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
73
		objZIPObject.ArgsClear
74
		objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
75
		objZIPObject.Zip
76
 
77
		Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error		
78
 
4177 dpurdie 79
		Response.write "Node Spec Files Generated for: "&objAccessControl.UserEmail&"<br>"
80
		Response.write "Go to <a href=\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\nodespecfiles>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\nodespecfiles</a>"
19 rsolanki 81
		Dim myMail, LocalPath
82
		Set myMail=Server.CreateObject("Persits.MailSender")
83
		LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\nodespecfiles\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
84
 
85
		myMail.Host = SMTP_HOST
86
		myMail.Subject="NODESPEC FILES Generated from Deployment Manager"
87
		myMail.From="releasem@erggroup.com"
88
		myMail.AddAddress objAccessControl.UserEmail
89
		' Attach the file
90
		myMail.AddAttachment LocalPath
91
		myMail.Body = "Your requested node spec files .." 
92
		myMail.Send
93
 
94
		set myMail = nothing
95
		set objWSH = nothing
96
 
97
		rsQry.Close
98
		Set rsQry = nothing
99
	Else	
100
	generated = false
101
		Response.write "Node spec filenames not found in the BOM!!!"
102
 
103
	End If	
104
 
15 rsolanki 105
Else
106
	Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
107
End If
108
 
109
'**********************************************************************
19 rsolanki 110
If generated Then
15 rsolanki 111
%>
19 rsolanki 112
<script language="Javascript">
113
alert("You will be emailed shortly with the NodeSpec files generated. Click OK to Redirect to Previous Page...")
114
history.back()
115
</script>
15 rsolanki 116
<%
19 rsolanki 117
Else
118
%>
119
<script language="Javascript">
120
alert("Click OK to Redirect to Previous Page...")
121
history.back()
122
</script>
123
<%
124
End If
15 rsolanki 125
'------------ RUN AFTER CODE RUN --------------
126
'----------------------------------------------
127
%><!--#include file="common/globals_destructor.asp"-->