Imports Gates.MES.DA
Imports System.Data
Imports System.Data.sqlClient
Namespace BL
Public Class QueyUpdate
Private _DBTans As DBTransaction
Private _errorMessage As String = ""
Public Sub New(ByVal DBTrans As DBTransaction)
_DBTans = DBTrans
End Sub
Public ReadOnly Property errorMessage() As String
Get
Return _errorMessage
End Get
End Property
Public Function QuerySplitJob(ByVal Job As String) As DataSet
Dim strsql As String = ""
Dim resultDS As New DataSet
Try
strsql = "select * from [MES_TRANS_MCD].[APPS].[HDMT_LOG] where lotid ='" & _
Job & "' and secondLOTID ='" & Job & "'"
resultDS = _DBTans.sqlToDataSet("splitJOb",strsql)
Return resultDS
Catch ex As Exception
Throw ex
End Try
End Function
Public Function GetJobbyPN(ByVal PN As String) As DataSet
Dim strsql As String
Dim resultDS As New DataSet
Try
strsql = " select * from apps.releasedjob where 1=1 "
If PN <> "" Then
strsql &= " and partnumber ='" & PN & "'"
End If
resultDS = _DBTans.sqlToDataSet("test",strsql)
Return resultDS
Catch ex As Exception
Throw ex
End Try
End Function
Public Function InsertSpliJob(ByVal sJob As SplitJob) As Boolean
Dim strsql As String = ""
Dim newQty As Integer = 0
Try
_DBTans.BeginTransaction()
strsql = "insert into [MES_TRANS_MCD].[APPS].[HDMT_LOG] ( lotid,partno,mesqty,SecondLotid) " & _
" values ( '" & sJob.NewJob & "','" & sJob.NewQty & "','" & sJob.OriginalJob & "')"
_DBTans.Execsql(strsql)
newQty = sJob.OriginalQTY - sJob.NewQty
strsql = " Update [MES_TRANS_MCD].[APPS].[HDMT_LOG] set mesqty= " & newQty & " where lotid= '" & sJob.OriginalJob & "')"
_DBTans.CommitTransaction()
Catch ex As Exception
_DBTans.RollbackTransaction()
Throw ex
Return False
End Try
End Function
End Class
Public Class SplitJob
Public OriginalJob As String
Public pn As String
Public OriginalQTY As Integer
Public NewQty As Integer
Public NewJob As String
End Class
End Namespace
原文链接:/vb/257886.html