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.ExecSQL(strSQL)
_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
本文介绍了一个用于批量作业处理的应用程序组件,该组件能够查询与更新数据库中的作业记录。主要功能包括:根据作业编号查询作业详情,根据产品编号获取作业列表,并支持作业信息的插入与更新操作。
883

被折叠的 条评论
为什么被折叠?



