[Declarations]
Dim session As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Public Class ReceiptInfo_CIMES
Public LotNo As String '//lotno(multi)
Public EmpNo As String '//開單者工號
Sub new
End Sub
End Class
Public Class ReturnData
Public code As String
Public message As String
'Public SerialNumber As String
Sub new
End Sub
End Class
Class AP110_CreateDoc
Sub NEW()
Set s = New NotesSession
Set db = s.currentdatabase
End Sub
'Function CreateNewDoc_CIMES(LotNo As String, EmpNo As String, returnFault As WS_FAULT) As ReturnData
Function CreateNewDoc_CIMES(LotNo As String, EmpNo As String, returnFault As WS_FAULT) As String
On Error Goto processError
Dim docSetup As NotesDocument
Dim itemAuthors As NotesItem
Dim itemReaders As NotesItem
Dim viewStationByDefect As NotesView
Dim viewDefect As NotesView
Dim docStation As NotesDocument
Dim docDefect As NotesDocument
Dim strSubject As String
Dim UserDoc As NotesDocument
Print db.Title + " run WebService: AP110_CreateDoc start..." + Now()
Set docSetup = GetSystemDocument("Form-SystemSetup")
Set CreateNewDoc_CIMES = New ReturnData
Set doc = New NotesDocument (db)
doc.Form = "Form-Main"
doc.SignStatus = "Status1"
doc.SignStatusDesc = "Preparing"
doc.ImportFrom = "CIMES"
doc.DateComposed = doc.Created
doc.From = doc.EmpEname
Call Doc.ReplaceItemValue("pwcUniqueID", Evaluate(|@Text(@Year(@Today))+@Text(@Month(@Today))+@Unique+@Text(@Second(@Today)) |, Doc))
'
doc.LotNo = CIMESdata.LotNo '//7.lotno(multi)
doc.EmpNo = CIMESdata.EmpNo '//11.開單者工號
Call QueryLotInfo(doc)
Call GetEmpData(doc)
'
Set UserDoc =sourcedb.createDocument()
Call UserDoc.replaceItemValue("Form", "Form-SwitchUserName")
Call UserDoc.replaceItemValue("UserName", doc.getItemValue("EmpEname"))
Call UserDoc.computeWithForm(True, True)
Set itemAuthors = doc.replaceItemValue( "Authors", UserDoc.getItemValue("CanonicalizeUserName") )
itemAuthors.IsAuthors=True
'doc.ALARM_ID = CIMESdata.ALARM_ID
'doc.ALARM_other = CIMESdata.ALARM_other
Call doc.save(True,False)
CreateNewDoc_CIMES.code="S"
Print db.Title + " run WebService: AP110_CreateDoc end..." + Now()
Exit Function
processError:
CreateNewDoc_CIMES.code="F"
CreateNewDoc_CIMES.message=""
Call throwFault(returnFault, "Error Cretae New documents from CIMES: " & Error & " Alarm At Line"+Cstr(Erl) + " , Error:"+ Cstr(Err) + " " + Error(Err) )
Exit Function
End Function
Private Sub throwFault (fault As WS_FAULT, faultText As String)
Call fault.setFault(True)
Call fault.setFaultString(faultText)
End Sub
End Class
沒有留言:
張貼留言