Subversion Repositories DevTools

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                                XML BOM Gen                                    |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0    ' always load the page, dont store
%>
<!--#include file="common/globals.asp"-->
<!--#include file="common/config.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_popup_window_common.asp"-->

<%
'------------ VARIABLE DEFINITION -------------
Dim objWSH
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------

'--------------------------------------------------------------------------------------------------------------------------
%>
<%
Function DateReversed ( dDate )
        ' Ensures Reverse Date format YYYY-MM-DD
        If IsNull(dDate) Then Exit Function
        DateReversed = Year(dDate) &"-"&  Month(dDate) &"-"& Day(dDate)
End Function
'**************************** M  A  I  N ******************************

If Request("bom_id") <> "" Then

        OraDatabase.Parameters.Add "BOM_ID",      Request("bom_id"),            ORAPARM_INPUT, ORATYPE_NUMBER
        OraDatabase.Parameters.Add "USER_ID",     objAccessControl.UserId,              ORAPARM_INPUT, ORATYPE_NUMBER

        objEH.TryORA ( OraSession )
        
        OraDatabase.ExecuteSQL _
        "BEGIN   pk_Bom.Update_Nodes_Version ( :BOM_ID, :USER_ID );   END;"
        
        objEH.CatchORA ( OraSession )

        OraDatabase.Parameters.Remove "BOM_ID"  
        OraDatabase.Parameters.Remove "USER_ID" 

        
                
        
        Set objWSH = Server.CreateObject("WScript.Shell")
        objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& APP_ROOT &"\jobs\ToProductionManager.wsf /bom_id:"& Request("bom_id") , 0, True 
        
        OraDatabase.Parameters.Add "BOM_ID",    Request("bom_id"),                      ORAPARM_INPUT, ORATYPE_NUMBER
        OraDatabase.Parameters.Add "USER_ID",   objAccessControl.UserId,        ORAPARM_INPUT, ORATYPE_NUMBER 
        
        objEH.TryORA ( OraSession )
        
        OraDatabase.ExecuteSQL _
        "BEGIN   pk_Bom.Log_Bom_Trail ( :BOM_ID, 'XML BOM GENERATED TO PRODUCTION MANAGER', :USER_ID, NULL );   END;"
        
        objEH.CatchORA ( OraSession )
                
        OraDatabase.Parameters.Remove "BOM_ID"
        OraDatabase.Parameters.Remove "USER_ID" 
        
        'Dim rsQry, objZIPObject
        '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))
        
        'Set objZIPObject = Server.CreateObject("aspZip.EasyZIP")
        
        'objZIPObject.ZipFileName = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
        'objZIPObject.ArgsClear
        'objZIPObject.ArgsAdd(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &"\*.*")
        'objZIPObject.Zip
        
        'Response.Write "Files Zipped=" & objZIPObject.SuccessCNT & " with Error="& objZIPObject.Error
        'Response.Write(""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("bom_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip")
        

        
        'Dim myMail, LocalPath
        'Set myMail=Server.CreateObject("Persits.MailSender")
        'LocalPath = ""& Request.ServerVariables("APPL_PHYSICAL_PATH") &"deployment_manager\downloads\"& rsQry("branch_name") &"\"& rsQry("version") &"\"& DateReversed(Date) &".zip"
        '       
        'myMail.Host = SMTP_HOST
        'myMail.Subject="XML BOM Generated from Deployment Manager"
        'myMail.From="releasem@erggroup.com"
        'myMail.AddAddress objAccessControl.UserEmail
        ' Attach the file
        'myMail.AddAttachment LocalPath
        'myMail.Body = "Your requested xml files .." 
        'myMail.Send
                
        'set myMail = nothing
        'set objWSH = nothing
        
        'rsQry.Close
        'Set rsQry = nothing
        
        'Response.write "<br>You will be emailed shortly with the XML files generated.<br>"
        'Response.write "Go to <a href='\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads'>\\auperaweb08\wwwTRD\manager_suite_DEVELOPMENT\deployment_manager\downloads</a>"
        
Else
        Response.write "Please specify bom_id. <br>Example:<br> "& SCRIPT_NAME &"?bom_id=1234"
End If

'**********************************************************************
%>
<script language="Javascript">
alert("XML files generated in Production Manager. Click OK to Redirect to Previous Page...")
history.back()
</script>
<%
'------------ RUN AFTER CODE RUN --------------
'----------------------------------------------
%><!--#include file="common/globals_destructor.asp"-->