| Line 27... |
Line 27... |
| 27 |
'--------------------------------------------------------------------------------------------------------------------------
|
27 |
'--------------------------------------------------------------------------------------------------------------------------
|
| 28 |
|
28 |
|
| 29 |
'--------------------------------------------------------------------------------------------------------------------------
|
29 |
'--------------------------------------------------------------------------------------------------------------------------
|
| 30 |
%>
|
30 |
%>
|
| 31 |
<%
|
31 |
<%
|
| - |
|
32 |
Function DateReversed ( dDate )
|
| - |
|
33 |
' Ensures Reverse Date format YYYY-MM-DD
|
| - |
|
34 |
If IsNull(dDate) Then Exit Function
|
| - |
|
35 |
DateReversed = Year(dDate) &"-"& Month(dDate) &"-"& Day(dDate)
|
| - |
|
36 |
End Function
|
| 32 |
'**************************** M A I N ******************************
|
37 |
'**************************** M A I N ******************************
|
| 33 |
|
38 |
|
| 34 |
If Request("bom_id") <> "" Then
|
39 |
If Request("bom_id") <> "" Then
|
| 35 |
Set objWSH = Server.CreateObject("WScript.Shell")
|
40 |
Set objWSH = Server.CreateObject("WScript.Shell")
|
| 36 |
objWSH.Run "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\PostBOMRelease.wsf /bom_id:"& Request("bom_id") , 0, True
|
41 |
objWSH.Run "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\PostBOMRelease.wsf /bom_id:"& Request("bom_id") , 0, True
|
| 37 |
|
42 |
|
| - |
|
43 |
OraDatabase.Parameters.Add "BOM_ID", Request("bom_id"), ORAPARM_INPUT, ORATYPE_NUMBER
|
| - |
|
44 |
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
|
| - |
|
45 |
|
| - |
|
46 |
objEH.TryORA ( OraSession )
|
| - |
|
47 |
|
| - |
|
48 |
OraDatabase.ExecuteSQL _
|
| - |
|
49 |
"BEGIN pk_Bom.Log_Bom_Trail ( :BOM_ID, 'XML BOM GENERATED', :USER_ID, NULL ); END;"
|
| - |
|
50 |
|
| - |
|
51 |
objEH.CatchORA ( OraSession )
|
| - |
|
52 |
|
| - |
|
53 |
OraDatabase.Parameters.Remove "BOM_ID"
|
| - |
|
54 |
OraDatabase.Parameters.Remove "USER_ID"
|
| - |
|
55 |
|
| - |
|
56 |
Dim rsQry, objZIPObject
|
| 38 |
Response.write "XML Generated.<br>"
|
57 |
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))
|
| - |
|
58 |
|
| - |
|
59 |
Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
|
| - |
|
60 |
|
| - |
|
61 |
objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
|
| - |
|
62 |
objZIPObject.ArgsClear
|
| - |
|
63 |
objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
|
| - |
|
64 |
objZIPObject.Zip
|
| - |
|
65 |
|
| - |
|
66 |
Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error
|
| - |
|
67 |
'Response.Write(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("bom_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip")
|
| - |
|
68 |
|
| - |
|
69 |
|
| - |
|
70 |
|
| - |
|
71 |
Dim myMail, LocalPath
|
| - |
|
72 |
Set myMail=Server.CreateObject("Persits.MailSender")
|
| - |
|
73 |
LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
|
| - |
|
74 |
|
| - |
|
75 |
myMail.Host = SMTP_HOST
|
| - |
|
76 |
myMail.Subject="XML BOM Generated from Deployment Manager"
|
| - |
|
77 |
myMail.From="releasem@erggroup.com"
|
| - |
|
78 |
myMail.AddAddress objAccessControl.UserEmail
|
| - |
|
79 |
' Attach the file
|
| - |
|
80 |
myMail.AddAttachment LocalPath
|
| - |
|
81 |
myMail.Body = "Your requested xml files .."
|
| - |
|
82 |
myMail.Send
|
| - |
|
83 |
|
| - |
|
84 |
set myMail=nothing
|
| - |
|
85 |
|
| - |
|
86 |
rsQry.Close
|
| - |
|
87 |
Set rsQry = nothing
|
| - |
|
88 |
|
| - |
|
89 |
'Response.write "<br>You will be emailed shortly with the XML files generated.<br>"
|
| 39 |
Response.write "Go to <a href='\\auperaweb08\wwwTRD\manager_suite\deployment_manager\downloads'>\\auperaweb08\wwwTRD\manager_suite\deployment_manager\downloads</a>"
|
90 |
'Response.write "Go to <a href='\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads'>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads</a>"
|
| 40 |
|
91 |
|
| 41 |
Else
|
92 |
Else
|
| 42 |
Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
|
93 |
Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
|
| 43 |
End If
|
94 |
End If
|
| 44 |
|
95 |
|
| 45 |
'**********************************************************************
|
96 |
'**********************************************************************
|
| 46 |
%>
|
97 |
%>
|
| - |
|
98 |
<script language="Javascript">
|
| - |
|
99 |
alert("You will be emailed shortly with the XML files generated. Click OK to Redirect to Previous Page...")
|
| - |
|
100 |
history.back()
|
| - |
|
101 |
</script>
|
| 47 |
<%
|
102 |
<%
|
| 48 |
'------------ RUN AFTER CODE RUN --------------
|
103 |
'------------ RUN AFTER CODE RUN --------------
|
| 49 |
'----------------------------------------------
|
104 |
'----------------------------------------------
|
| 50 |
%><!--#include file="common/globals_destructor.asp"-->
|
105 |
%><!--#include file="common/globals_destructor.asp"-->
|