strSql.Append("select tr_qty_loc,in_qty_oh,in_qty_ord,in_qty_all from qad.in_mstr inner join")
strSql.Append("qad.tr_hist on Upper(tr_part) = Upper(in_part) ")
strSql.Append("where Upper(in_domain)='" & Domain & "' ")
strSql.Append("and Upper(in_part) = '" & ps_comp & "' and upper(in_site) = '" & Site & "' ")
strSql.Append("and (Upper(tr_loc) = '3205' or upper(tr_loc) Like '2%')")
อันนี้ของเดิมครับ ที่ ตาราง in_mstr (in_qty_oh) sum ผลมา (อันนี้ใช้งานได้ปกติ)
Code (VB.NET)
strSql.Append("select in_qty_oh,in_qty_ord,in_qty_all from qad.in_mstr where Upper(in_domain)='" & Domain & "' ")
strSql.Append("and Upper(in_part) = '" & ps_comp & "' and upper(in_site) = '" & Site & "' ")
query ใน oracle Code (VB.NET)
select sum(tr_qty_loc) , min (in_qty_oh) ,min( in_qty_ord ), min(in_qty_all) from qad.in_mstr a inner join
qad.tr_hist on Upper(in_part)= Upper(tr_part)
and Upper(in_site)= Upper(tr_site)
and Upper(in_domain)= Upper(tr_domain)
where Upper(in_part) = '13750217'
and Upper(in_domain) = '2000' and Upper(in_site) = '2100'
and (Upper(tr_loc) = '3205' or upper(tr_loc) Like '2%')
--group by Upper(in_part)
Dim GetqtyDS As DataSet = New DataSet
GetqtyDS = Getqty(dm("ps_comp"), Session("domain"), Session("site"))
If GetqtyDS.Tables(0) IsNot Nothing AndAlso GetqtyDS.Tables(0).Rows.Count > 0 Then
qty_oh = IIf(IsDBNull(GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_oh")) = True, "0", GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_oh"))
qty_ord = IIf(IsDBNull(GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_ord")) = True, "0", GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_ord"))
qty_all = IIf(IsDBNull(GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_all")) = True, "0", GetqtyDS.Tables(0).Rows.Item(0).Item("in_qty_all"))
qty_loc = IIf(IsDBNull(GetqtyDS.Tables(0).Rows.Item(0).Item("tr_qty_loc")) = True, "0", GetqtyDS.Tables(0).Rows.Item(0).Item("tr_qty_loc"))
Else
qty_oh = 0
qty_ord = 0
qty_all = 0
qty_loc = 0
End If
Code (VB.NET)
Public Shared Function Getqty(ByVal ps_comp As String, ByVal Domain As String, ByVal Site As String) As DataSet
Try
strSql = New StringBuilder()
strSql.Append("select min(in_qty_oh) ,min( in_qty_ord ), min(in_qty_all) , sum(tr_qty_loc) from qad.in_mstr a")
strSql.Append("inner join qad.tr_hist on Upper(tr_part)= Upper(in_part) ")
strSql.Append("and Upper(in_site)= Upper(tr_site)")
strSql.Append("and Upper(in_domain)= Upper(tr_domain)")
strSql.Append("where Upper(in_part) = '" & ps_comp & "' ")
strSql.Append("and (Upper(in_domain) = '" & Domain & "' and Upper(in_site) = '" & Site & "')")
strSql.Append("and (Upper(tr_loc) = '3205' or Upper(tr_loc) Like '2%')")
Dim result = strSql.ToString
Return GetDataOracle(strSql.ToString, "Getqty", constrdata)
Catch ex As Exception
Throw ex
End Try
End Function