/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/multibin/split.ashx
73 строки
2 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ WebHandler Language="VB" Class="getsqldata" %> Imports System Imports System.Web Imports Newtonsoft.Json Public Class getsqldata : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest context.Response.ContentType = "text/plain" With context.Request Dim sql As New StringBuilder Dim o_su As String = .QueryString("o_su") Dim t_su As String = .QueryString("t_su") Dim t_qty As String = .QueryString("t_qty") Dim result As Integer sql.AppendLine("declare @n1 as int ") sql.AppendLine("declare @n2 as int ") sql.AppendLine("begin transaction ") sql.AppendLine("update [Multi-bin].[dbo].[Stock] ") sql.AppendLine("set qty = cast(qty as numeric) - cast(" & t_qty & " as numeric) ") sql.AppendLine("where su = '" & o_su & "' ") sql.AppendLine("set @n1 = @@ROWCOUNT ") sql.AppendLine("insert into [Multi-bin].[dbo].[Stock] ") sql.AppendLine("(su, material, qty, bin, zone) ") sql.AppendLine("select ") sql.AppendLine("'" & t_su & "' as su ") sql.AppendLine(",material ") sql.AppendLine("," & t_qty & " ") sql.AppendLine(",Bin ") sql.AppendLine(",Zone ") sql.AppendLine("from [Multi-bin].[dbo].[Stock] ") sql.AppendLine("where su = '" & o_su & "'") sql.AppendLine("set @n2 = @@ROWCOUNT ") sql.AppendLine("if @n1 > 0 and @n2 > 0 commit transaction else rollback transaction ") sql.AppendLine(" ") Dim sqlf As New sharedClasses.dbFunctions.SqlFunctions Dim dt As Data.DataTable = Nothing result = sqlf.NonQuery(sql.ToString) Try If result > 0 Then context.Response.Write("[{""msg"":""OK""}]") Else context.Response.Write("[{""msg"":""Error during split""}]") End If Catch ex As Exception context.Response.Write("[{""msg"":""Connection problem. Try-Catch triggered""}]") End Try End With End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property End Class