vb.net query update

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值